示例#1
0
function calchp($sid, $fid)
{
    for ($x = 1; $x < getShipNumber() + 1; $x++) {
        $str = 'ship' . $x;
        $query = "SELECT {$str} FROM fleet{$sid} WHERE id={$fid}";
        $result = mysql_query($query);
        $row = mysql_fetch_array($result);
        $hp += $row[0] * getShipStat(hp, $x);
    }
    return $hp;
}
示例#2
0
function calcDef($sid, $pid)
{
    $query = "SELECT id FROM fleet{$sid} WHERE loc={$pid} AND destination=0";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        for ($i = 1; $i < getShipNumber() + 1; $i++) {
            $str = "ship" . $i;
            $num += getShipStat(defend, $i) * getFleetStat($str, $sid, $row[id]);
        }
    }
    if (!($num > 0)) {
        $num = 0;
    }
    return $num + getPlantStat(cannon, $sid, $pid);
}