Menu

## DamageEvent extends BattleEvent
in package

DamageEvent.php : 12

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

DamageEvent.php : 15
`protected FighterInstance $attacker`

#### $damage

DamageEvent.php : 19
`protected int $damage`

Damage applied

#### $defender

DamageEvent.php : 17
`protected FighterInstance $defender`

#### $applied

BattleEvent.php : 14
`private mixed $applied = false`

### Methods

#### __construct()

DamageEvent.php : 27

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()

DamageEvent.php : 48

Applies the event.

`public apply() : mixed`

##### Tags

inheritDoc

##### Return values

mixed —

#### decorate()

DamageEvent.php : 62

Returns a string describing the event.

`public decorate(Game $game) : string`

##### Parameters

$game : Game

##### Tags

inheritDoc

##### Return values

string —

#### getDamage()

DamageEvent.php : 40

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.

##### Return values

int —

## Search results