/**
  * {@inheritDoc}
  *
  * @param array $options Options to set during initialization
  * */
 public function __construct($options = [])
 {
     $options['deathrattle'] = [new ZombieChowDeathrattle()];
     parent::__construct($options);
 }
Esempio n. 2
0
 /**
  * Remove a minion from the battlefield for a player
  *
  * @param Minion $entity The minion to remove
  * @param Player $player The player that owns the minion
  *
  * @return boolean
  */
 public function removeFromBattlefield(Minion $entity, Player $player)
 {
     // Get minions on battlefield
     $minions = $this->getBattlefieldForPlayer($player);
     // No minions on board
     if (empty($minions)) {
         return false;
     }
     // Loop through minions
     foreach ($minions as $position => $minion) {
         // Found by id match
         if ($entity->getId() === $minion->getId()) {
             // remove at position
             array_splice($this->battlefield[$player->getId()], $position, 1);
             // TODO: Add minion to graveyard list
             return true;
         }
     }
     // Not found
     return false;
 }
Esempio n. 3
0
 /** {@inheritDoc} */
 public function takeDamage($amount = 0, Entity $from = null)
 {
     // Just make sure damage is a positive value so we don't get any wierd interactions
     if ($amount < 0) {
         $amount = 0;
     }
     $armor = $this->getArmor();
     $armorAdjustment = 0;
     if ($armor > 0) {
         $armorAdjustment = $amount > $armor ? $armor : $amount;
         // Adjust the armor value
         $this->armor -= $armorAdjustment;
         // Emit that we removed armor
         $this->emit(EntityEvent::EVENT_ENTITY_REMOVE_ARMOR, ['amount' => $armorAdjustment]);
     }
     // Update amount to reduce for armor removed
     $amount -= $armorAdjustment;
     // Pass back to base entity handling, any leftover amount is handled here.
     return parent::takeDamage($amount, $from);
 }