Skip to content

ComputerFighter

namespace Griff.Modules.Fighting;
public sealed class ComputerFighter : Component, IPlaytestReport

Has the computer play a FightingCharacter, for one player against the computer and for a training dummy: it walks in, attacks with the fighter’s own moves when it’s close enough, guards (low against a low) as its opponent attacks, jumps in with an air move now and then, and cancels a hit into a special. Or it just stands, crouches or jumps, for training (Behavior). It works the fighter as a player would, holding directions and doing moves by name, so the fighter’s frame data, blocking and combos are the same either way.

What it decides comes from its own Seed, kept with the scene, so the same fight goes the same way every time and after a rewind. The fighter’s own controls are ignored while it has one.

This is a component: its saved properties are on its component page.

public ComputerBehavior Behavior { get; set; }

What it does: fight, or stand, crouch or jump as a training dummy.

public string BehaviorName { get; }

Its Behavior in words, for a training menu’s label: “Fight”, “Stand”, “Crouch” or “Jump”.

public ComputerDifficulty Difficulty { get; set; }

How well it fights: how quickly it reacts, how often it guards and attacks.

public bool Guarding { get; set; }

True while it’s guarding against the move its opponent is doing. Set by the game.

public int HoldX { get; set; }

Which way it holds the stick now, in the world: -1 left, 1 right. Set by the game.

public int HoldY { get; set; }

Whether it holds the stick up (1) or down (-1). Set by the game.

public float Range { get; set; }

How close it closes in before attacking, in units between their middles.

public string? SawMove { get; set; }

The step its opponent’s move it has already chosen whether to guard against started on, as “move@frame”. Set by the game.

public int Seed { get; set; }

Where its next choice comes from: the same seed makes the same fight. Set by the game as it chooses.

public string? UseMoves { get; set; }

The moves it uses, by name, separated by commas; empty for every one the fighter has.

public int Wait { get; set; }

Steps until it chooses what to do next. Set by the game.

public void NextBehavior()

Changes its Behavior to the next: Fight, Stand, Crouch, Jump, and round again (a training dummy’s).

public override bool Uses(string property)