public function action_attack() { $character = $this->character; $battle = $character->battle; if (!Battle::can_fight($character) or !Battle::can_fight($battle)) { $this->request->redirect('battle/end'); } Battle::fight($character, $battle); $this->request->redirect('battle'); }
public function fight() { // these are the "face down" cards $this->takePair(); return parent::fight(); }
<?php $battle = new Battle(); $character1 = array(); $character1['name'] = 'Xaoziq'; $character1['level'] = 1; $character1['attack'] = 10; $character1['defense'] = 50; $character1['hp'] = 100; $character2 = array(); $character2['name'] = 'Evolutionary'; $character2['level'] = 1; $character2['attack'] = 10; $character2['defense'] = 50; $character2['hp'] = 100; ?> <div class="col-lg-9"> <?php $battle->fight($character1, $character2); ?> </div>