<?php

$village1 = new Dolumar_Players_DummyVillage();
$village2 = new Dolumar_Players_DummyVillage();
$slots = $village1->getAttackSlots($village2);
$attacking = array();
$defending = array();
$logger = new Dolumar_Battle_Logger();
foreach ($slots as $k => $v) {
    $tmp = new Dolumar_Units_Archers($village1);
    $tmp->setBattleSlot($v);
    $tmp->addAmount(5000, 5000, 5000);
    $attacking[$k] = $tmp;
    $tmp = new Dolumar_Units_Archers($village2);
    $tmp->setBattleSlot($v);
    $tmp->addAmount(5000, 5000, 5000);
    $defending[$k] = $tmp;
}
// Let's do the fight
$fight = new Dolumar_Battle_Fight($village1, $village2, $attacking, $defending, $slots, array(), $logger);
echo '<h2>Combat result</h2>';
echo $fight->getResult();
echo '<h2>Debugger</h2>';
echo '<pre>' . $logger->getDebugLog() . '</pre>';
unset($fight);
unset($village1);
unset($village2);
unset($attacking);
unset($defending);
unset($logger);
echo '<h2>Profiler</h2>';
Esempio n. 2
0
 public static function getFromLogger(Dolumar_Battle_Logger $logger)
 {
     $class = get_called_class();
     $report = new $class(0, null, true);
     $data = array();
     $data['resources'] = null;
     $data['runes'] = null;
     $data['fightDate'] = time() - 1;
     $data['fightDuration'] = $logger->getDuration();
     $data['fromId'] = 0;
     $data['targetId'] = 0;
     //var_dump ($logger->getSquads ());
     $data['squads'] = $logger->getSquads();
     $data['slots'] = $logger->getInitialSlots();
     $data['fightLog'] = $logger->getFightSummary();
     $data['battleLog'] = $logger->getFightLog();
     $data['resultLog'] = null;
     $data['victory'] = $logger->getVictory();
     $data['execDate'] = time();
     $data['specialUnits'] = $logger->getSpecialUnits();
     $report->setData($data);
     return $report;
 }