DamageEvent
extends BattleEvent
in package
BattleEvent.
Table of Contents
- $attacker : FighterInstance
- $damage : int
- $defender : FighterInstance
- $applied : mixed
- __construct() : mixed
- Construct a new DamageEvent of $attacker attacking $defender.
- apply() : mixed
- Applies the event.
- decorate() : string
- Returns a string describing the event.
- getDamage() : int
- Returns the damage that is applied in this fight.
Properties
$attacker
protected
FighterInstance
$attacker
$damage
protected
int
$damage
Damage applied
$defender
protected
FighterInstance
$defender
$applied
private
mixed
$applied
= false
Methods
__construct()
Construct a new DamageEvent of $attacker attacking $defender.
public
__construct(FighterInterface $attacker, FighterInterface $defender, int $damage) : mixed
Parameters
- $attacker : FighterInterface
- $defender : FighterInterface
- $damage : int
Return values
mixed —apply()
Applies the event.
public
apply() : mixed
Tags
Return values
mixed —decorate()
Returns a string describing the event.
public
decorate(Game $game) : string
Parameters
- $game : Game
Tags
Return values
string —getDamage()
Returns the damage that is applied in this fight.
public
getDamage() : int
If the damage is > 0, the damage is applied to the defender. If it's < 0, it's applied to the attacker.