Ejemplo n.º 1
0
 /**
  * @return void
  */
 private function stealthStrike(Player $attacker, Player $target)
 {
     $target->harm($attacker->getStrength());
     $attacker->turns = $attacker - turns - 1 * self::STEALTH_STRIKE_COST;
 }
Ejemplo n.º 2
0
 /**
  * Normal attack on a single thief.
  */
 private function attackNormalThief(Player $player)
 {
     $damage = rand(0, 35);
     // Damage done
     $gold = 0;
     if ($victory = $player->harm($damage)) {
         $gold = rand(0, 40);
         // Gold in question
         if ($damage > 30) {
             // Steal gold
             $player->setGold(max(0, $player->gold - $gold));
         } else {
             if ($damage < 30) {
                 // award gold and item
                 $player->setGold($player->gold + $gold);
                 $inventory = new Inventory($player);
                 $inventory->add('shuriken', 1);
             }
         }
     }
     $player->save();
     return ['npc.thief.tpl', ['attack' => $damage, 'gold' => $gold, 'victory' => $victory]];
 }