本文整理汇总了PHP中SR_Player::getSpell方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::getSpell方法的具体用法?PHP SR_Player::getSpell怎么用?PHP SR_Player::getSpell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::getSpell方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cast
public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
{
// echo "Casting Firewall with level $level and $hits hits.\n";
# Firebolt ads 0.20 per level
$firebolt = $potion_player->getSpell('firebolt');
$firebolt = $firebolt === false ? 0 : $firebolt->getLevel($potion_player);
$firebolt = round($firebolt / 5, 1);
$level += $firebolt;
# Fireball ads 0.25 per level
$fireball = $potion_player->getSpell('fireball');
$fireball = $fireball === false ? 0 : $fireball->getLevel($potion_player);
$fireball = round($fireball / 4, 1);
$level += $fireball;
$line = $target->getY();
$damage = array();
$ep = $target->getParty();
foreach ($ep->getMembers() as $t) {
$t instanceof SR_Player;
$d = abs($line - $t->getY());
// echo "Distance to target is $d\n";
$l = $level - $d;
if ($l >= 0) {
$hits = $this->dice($potion_player, $t, $l);
$damage[$t->getID()] = $this->calcFirewallDamage($player, $t, $level, $hits);
}
}
$this->announceADV($player, $target, $level);
Shadowfunc::multiDamage($player, $damage);
return true;
}
示例2: cast
public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
{
echo "Casting Vulcano with level {$level} and {$hits} hits.\n";
$this->announceADV($player, $target, $level);
# Firebolt ads 0.20 per level
$firebolt = $potion_player->getSpell('firebolt');
$firebolt = $firebolt === false ? 0 : $firebolt->getLevel($player);
$firebolt = round($firebolt / 5, 1);
$level += $firebolt;
# Fireball ads 0.25 per level
$fireball = $potion_player->getSpell('fireball');
$fireball = $fireball === false ? 0 : $fireball->getLevel($player);
$fireball = round($fireball / 4, 1);
$level += $fireball;
# Firewall ads 0.3 per level
$firewall = $potion_player->getSpell('firewall');
$firewall = $firewall === false ? 0 : $firewall->getLevel($player);
$firewall = round($firewall * 0.3, 1);
$level += $firewall;
# Inaccurate
$inaccuracy = Common::clamp(3 - $level * 0.1, 1);
$targets = SR_Grenade::computeDistances($target, $inaccuracy);
$p = $player->getParty();
$ep = $p->getEnemyParty();
$damage = array();
foreach ($targets as $data) {
list($pid, $d) = $data;
$target = $ep->getMemberByPID($pid);
$d = Common::clamp($d, 1);
$hits = $this->dice($potion_player, $target, $level);
# Dice hits
echo "!! Vulcano hits={$hits}, Distance={$d}";
$min = 1.0 + $level * 1.0;
# Min damage is quite low
$max = $min + $level + $hits * 1.2;
# The max damage is min + hits
$dmg = Shadowfunc::diceFloat($min, $max);
$dmg /= $d / SR_Party::X_COORD_INC * 1.2;
# Apply area reduction
$dmg = round($dmg, 1);
$damage[$pid] = $dmg;
}
$this->spellDamageMultiTargets($player, $damage, $level);
return true;
}
示例3: execute
public static function execute(SR_Player $player, array $args)
{
if (count($args) === 1) {
$arg = $args[0];
if (false === ($spell = $player->getSpell($arg))) {
self::rply($player, '1023');
# You don't have this knowledge.
return false;
} else {
return Shadowhelp::getHelp($player, $spell->getName());
}
} else {
return self::reply($player, Shadowfunc::getSpells($player, '5054'));
}
return true;
}
示例4: cast
public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
{
echo "Casting Fireball with level {$level} and {$hits} hits.\n";
$this->announceADV($player, $target, $level);
# Firebolt ads 0.20 per level
$firebolt = $potion_player->getSpell('firebolt');
$firebolt = $firebolt === false ? 0 : $firebolt->getLevel($potion_player);
$firebolt = round($firebolt / 5, 1);
$level += $firebolt;
# Inaccuracy
$inaccuracy = Common::clamp(4 - $level * 0.15, 1);
$targets = SR_Grenade::computeDistances($target, $inaccuracy);
$p = $player->getParty();
$ep = $p->getEnemyParty();
$damage = array();
foreach ($targets as $data) {
list($pid, $d) = $data;
$target = $ep->getMemberByPID($pid);
$d = Common::clamp($d, 1);
$hits = $this->dice($potion_player, $target, $level);
# Dice hits
echo "!! Fireball hits={$hits}, Distance={$d}\n";
// $hits /= 2; # We take half..
// $hits /= ($d * 5); # And divide by distance
// $hits = round($hits, 1);
// echo " Fireball hits=$hits\n";
$min = 1.0 + $level * 0.5;
# Min damage is quite low
$max = $min + $level + $hits * 0.5;
# The max damage is min + hits
$dmg = Shadowfunc::diceFloat($min, $max);
$dmg /= $d / SR_Party::X_COORD_INC * 1.4;
# Apply area reduction
$dmg = round($dmg, 1);
// $player->message(sprintf("You have hit %s with %d hits, your damage is %.02f-%.02f, Distance from impact: %.02fm", $target->getName(), $hits, $min, $max, $d));
$damage[$pid] = $dmg;
}
$this->spellDamageMultiTargets($player, $damage, $level);
return true;
}