FightEngine

public final class FightEngine

Class for processing color-based operations such as attacks and updates.

The specific rules for color interactions are defined by:

  • so-called base colors, which specify which attack the colors can perform

  • interaction matrix, which defines how much damage one color deals to another upon attacking.

During the game, actual RGB colors are mapped to the base color closest by some internal metric (currently L1). The damage defined by interaction matrix is also multiplied by a coefficient dependent on the distance between the base color and the actual color.

As the only class that is allowed to perform color updates, this class also stores Tickers that govern units' color update periods.

Parameters

baseColors

The list of all base colors and their properties.

interactionMatrix

The matrix that defines damage from one color to another.

Constructors

Link copied to clipboard
FightEngine FightEngine(List<BaseColorStats> baseColors, Grid2D<Integer> interactionMatrix)

Types

Link copied to clipboard
public interface UnsafeMethods

Methods that must be used instead of their usual FightEngine counterparts if and only if explicitly told to.

Functions

Link copied to clipboard
final Unit attack(GameUnit from, GameUnit to)

Calculates and performs an attack from one GameUnit to another.

Link copied to clipboard
final Unit attackDirectly(GameUnit to, Integer attack)

Performs an attack on to with attack damage.

Link copied to clipboard
final Unit changeMaxHp(HpGameUnit unit, Integer amount)

Unconditionally adds amount to unit's maxHp property.

Link copied to clipboard
final Unit changeRGB(GameUnit unit, RGB newRgb)

Unconditionally sets the color of unit to newRgb.

final Unit changeRGB(GameUnit unit, RGBDelta delta)

Unconditionally adds delta to unit's color.

Link copied to clipboard
final String getBaseColorName(GameUnit unit)

Returns the current base color name for unit.

Link copied to clipboard
final Integer newTeamId()

Returns a unique teamId.

Link copied to clipboard
final Unit registerUnit(GameUnit unit)

Registers unit in this FightEngine.

Link copied to clipboard
final Unit unregisterUnit(GameUnit unit)

Unregisters unit from this FightEngine.

Link copied to clipboard
final Unit update(GameUnit unit, ControlParams controlParams)

Performs a color update for unit.