コード例 #1
0
ファイル: Wizard.php プロジェクト: jonwurtzler/advent_of_code
 /**
  * Spend mana for a spell
  *
  * @param Spell $spell
  *
  * @return bool
  */
 public function spendMana($spell)
 {
     $this->mp -= $spell->getCost();
     if ($this->mp <= 0) {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: part2.php プロジェクト: ultramega/adventofcode2015
 public function isSpellAvailable(Spell $spell)
 {
     if ($spell instanceof Effect && $spell->isActive()) {
         return false;
     }
     return $spell->getCost() <= $this->playerMana;
 }