target = $target; $this->healAmount = $healAmount; $this->message = $message; } /** * Return the heal amount. * @return int */ public function getHealAmount(): int { return $this->healAmount; } /** * @inheritDoc */ public function apply() { parent::apply(); if ($this->healAmount === 0) { return; } elseif ($this->healAmount > 0) { $this->target->setHealth($this->target->getHealth() + $this->healAmount); } else { $this->target->setHealth($this->target->getHealth() + $this->healAmount); } } /** * @inheritDoc */ public function decorate(Game $game): string { parent::decorate($game); return str_replace( [ "{target}", "{damage}" ], [ $this->target->getDisplayName(), $this->healAmount, ], $this->message ); } }