function battleinfantery($prod_id, $bonus) { $this->prod_id = $prod_id; $sth = mysql_query("select p.name,p.typ,i.attack,i.defense,i.armour,i.initiative,i.tonnage as storage from production p,shipvalues i where p.prod_id=" . $prod_id . " and i.prod_id=p.prod_id and p.typ='I'"); if (!$sth || mysql_num_rows($sth) == 0) { throw new SQLException(); } list($name, $type, $attack, $defense, $armor, $initiative, $this->storage) = mysql_fetch_row($sth); if (!$this->name) { $this->name = $name; } // mop: hmmm...die kampfsysteme sind ja jetzt in einem....irgendwie die komischen infwerte auf neues system anpassen $this->agility = round($defense / 10); $this->currenthull = $armor; $this->weaponpower = $attack; $this->shield = round($defense / 10); $this->ecm = round($defense / 10); $this->sensor = $attack; $this->weaponskill = round($this->attack / 2); $this->special = ""; $this->armor = $armor; $this->base_initiative = $initiative; $this->num_attacks = 1; // mop: bonus vom admiral if ($bonus) { $this->agility += $bonus["agility"]; $this->base_initiative += $bonus["initiative"]; $this->sensor += $bonus["sensor"]; $this->weaponskill += $bonus["weaponskill"]; } $this->type = battleunit::typetranslate($type); $this->target1 = battleunit::typetranslate($type); $this->can_attack = UNITTYPE_INFANTERY | UNITTYPE_PLANETAR; $this->challenge_points = $this->base_initiative + $this->agility + $this->hull + $this->weaponpower + $this->shield + $this->ecm + $target + $this->sensor + $this->weaponskill + $this->armor; }
/** * ctor * * @param $prod_id * @return */ function battleship($prod_id, $fid, $bonus) { $this->fo_id = $fid; $this->prod_id = $prod_id; $sth = mysql_query("select p.name,p.typ,s.initiative,s.agility,s.hull,s.weaponpower,s.shield,s.ecm,s.target1,s.sensor,s.weaponskill,s.special,s.armor,s.num_attacks from shipvalues s, production p where s.prod_id=" . $prod_id . " and s.prod_id=p.prod_id"); if (!$sth || mysql_num_rows($sth) == 0) { throw new SQLException(); } list($this->name, $type, $this->base_initiative, $this->agility, $this->currenthull, $this->weaponpower, $this->shield, $this->ecm, $target, $this->sensor, $this->weaponskill, $this->special, $this->armor, $this->num_attacks) = mysql_fetch_row($sth); // mop: bonus vom admiral if ($bonus) { $this->agility += $bonus["agility"]; $this->base_initiative += $bonus["initiative"]; $this->sensor += $bonus["sensor"]; $this->weaponskill += $bonus["weaponskill"]; } $this->target1 = battleunit::typetranslate($target); $this->type = battleunit::typetranslate($type); $this->currentshield = $this->shield; // mop: super bitoperatoren....da steht dann bei schiffen 0111 drinn....bei planetaren (0x8) 1000...schneller als arrays $this->can_attack = UNITTYPE_LIGHTSHIP | UNITTYPE_MEDIUMSHIP | UNITTYPE_HEAVYSHIP; $this->challenge_points = $this->base_initiative + $this->agility + $this->currenthull + $this->weaponpower + $this->shield + $this->ecm + $target + $this->sensor + $this->weaponskill + $this->armor; // mop: bei specialfeatures einfach noch was drauflegen if ($this->special != "") { if ($this->special == "B") { $this->can_attack |= UNITTYPE_PLANETAR | UNITTYPE_ORBITAL | UNITTYPE_INFANTERY; } $this->challenge_points += 100; } }
function battleunitsimulator($uid, $side, $prod_id) { $this->fo_id = $side; $this->prod_id = $prod_id; $sth = mysql_query("select p.name,p.typ,s.initiative,s.agility,s.hull,s.weaponpower,s.shield,s.ecm,s.target1,s.sensor,s.weaponskill,s.special,s.armor,s.num_attacks from battle_" . $uid . " s, production p where s.prod_id=" . $prod_id . " and s.prod_id=p.prod_id and s.side=" . $side); if (!$sth || mysql_num_rows($sth) == 0) { return false; } list($this->name, $type, $this->base_initiative, $this->agility, $this->currenthull, $this->weaponpower, $this->shield, $this->ecm, $target, $this->sensor, $this->weaponskill, $this->special, $this->armor, $this->num_attacks) = mysql_fetch_row($sth); $this->target1 = battleunit::typetranslate($target); $this->type = battleunit::typetranslate($type); $this->currentshield = $this->shield; // mop: super bitoperatoren....da steht dann bei schiffen 0111 drinn....bei planetaren (0x8) 1000...schneller als arrays $this->can_attack = UNITTYPE_LIGHTSHIP | UNITTYPE_MEDIUMSHIP | UNITTYPE_HEAVYSHIP | UNITTYPE_PLANETAR | UNITTYPE_ORBITAL | UNITTYPE_INFANTERY; $this->challenge_points = $this->base_initiative + $this->agility + $this->currenthull + $this->weaponpower + $this->shield + $this->ecm + $target + $this->sensor + $this->weaponskill + $this->armor; }
function battlebuilding($prod_id) { $this->prod_id = $prod_id; $sth = mysql_query("select p.name,p.typ,s.initiative,s.agility,s.hull,s.weaponpower,s.shield,s.ecm,s.target1,s.sensor,s.weaponskill,s.special,s.armor,s.num_attacks from shipvalues s, production p where s.prod_id=" . $prod_id . " and s.prod_id=p.prod_id"); if (!$sth || mysql_num_rows($sth) == 0) { throw new SQLException(); } list($this->name, $type, $this->base_initiative, $this->agility, $this->currenthull, $this->weaponpower, $this->shield, $this->ecm, $target, $this->sensor, $this->weaponskill, $this->special, $this->armor, $this->num_attacks) = mysql_fetch_row($sth); $this->currentshield = $this->shield; $this->target1 = battleunit::typetranslate($target); $this->type = battleunit::typetranslate($type); // mop: super bitoperatoren....da steht dann bei schiffen 0111 drinn....bei planetaren (0x8) 1000...schneller als arrays $this->can_attack = 0; $this->challenge_points = $this->base_initiative + $this->agility + $this->currenthull + $this->weaponpower + $this->shield + $this->ecm + $target + $this->sensor + $this->weaponskill + $this->armor; if ($this->special != "") { $this->challenge_points += 100; } }