本文整理汇总了PHP中Weapon::getUserAttackWeapons方法的典型用法代码示例。如果您正苦于以下问题:PHP Weapon::getUserAttackWeapons方法的具体用法?PHP Weapon::getUserAttackWeapons怎么用?PHP Weapon::getUserAttackWeapons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weapon
的用法示例。
在下文中一共展示了Weapon::getUserAttackWeapons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$weapon->weaponId = $wId;
$weapon->isAttack = 0;
$weapon->weaponCount = $amount;
$weapon->weaponStrength = $conf['weapon' . $wId . 'strength'];
if ($amount and $weapon->create()) {
$t->daWeapons[] = $weapon;
}
}
$user->cacheStats();
}
else {
$t->err = 'Not enough Gold';
}
}
$t->user = $user;
if (!$t->saWeapons and !$t->daWeapons) {
$t->saWeapons = Weapon::getUserAttackWeapons($user->id);
$t->daWeapons = Weapon::getUserDefenseWeapons($user->id);
}
$t->saRatio = Weapon::getStrengthRatio($user->id, 1);
$t->daRatio = Weapon::getStrengthRatio($user->id, 0);
$t->pageTitle = 'Armoury';
$t->display();
?>
示例2: debug
$defenseWeaponsRatio = Weapon::getStrengthRatio($target->id, false);
debug("defenseRatio: $defenseWeaponsRatio->ratio");
$attacklog->attackerRA = $user->RA * rand($attackLowPer, 100) * 0.01;
$attacklog->targetRA = $target->RA * rand($defenseLowPer, 100) * 0.01;
debug("attacker RA: $attacklog->attackerRA, <Br>targetRA: $attacklog->targetRA");
$raWeapons = array();
$raWeaponsRatio = 0;
if ($attacklog->attackerRA > $attacklog->targetRA) {
// Attacker has more RA, so he can damage the target's attack weapons
$attackWeaponsRatio->ratio *= 1.03;
$raWeapons = Weapon::getUserAttackWeapons($target->id);
$raWeaponsRatio = Weapon::getStrengthRatio($target->id, true);
$raDmg = floor($raWeaponsRatio->ratio * 0.002 * $attackTurns);
debug("Attacker won in RA, ratio: $raWeaponsRatio->ratio");
debug("raDmg: floor($raWeaponsRatio->ratio * 0.002 * $attackTurns) = $raDmg");
}
else {
// Target has more RA, so he can damage the attacker's defense weapons
$defenseWeaponsRatio->ratio *= 1.03;
$raWeapons = Weapon::getUserDefenseWeapons($user->id);
$raWeaponsRatio = Weapon::getStrengthRatio($user->id, false);
$raDmg = floor($raWeaponsRatio->ratio * 0.002 * $attackTurns);
debug("Target won in RA, ratio: $raWeaponsRatio->ratio");
debug("raDmg: floor($raWeaponsRatio->ratio * 0.002 * $attackTurns) = $raDmg");
}