本文整理汇总了PHP中SR_Player::getY方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::getY方法的具体用法?PHP SR_Player::getY怎么用?PHP SR_Player::getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::getY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: calcDistance
public static function calcDistance(SR_Player $player, SR_Player $target)
{
$x1 = $player->getX();
$y1 = $player->getY();
$x2 = $target->getX();
$y2 = $target->getY();
return self::calcDistanceB($x1, $y1, $x2, $y2);
}
示例3: moveTowards
public function moveTowards(SR_Player $player, SR_Player $target)
{
$move = $player->getMovePerSecond();
$d1 = $player->getY();
$d2 = $target->getY();
$dt = $d1 - $d2;
if ($dt < 0) {
$dt = -$dt;
if ($move > $dt) {
$move = $dt;
}
$move = -$move;
} else {
if ($move > $dt) {
$move = $dt;
}
}
$pid = $player->getID();
$move = -$move;
$new_d = 0;
$move = round($move, 1);
$this->movePlayerB($pid, $move, $new_d);
$new_d = round($new_d, 1);
$busy = $player->busy(25);
$name = $player->displayNameNB();
$tn = $target->displayNameNB();
$ep = $this->getEnemyParty();
$args = array($name, abs($move), $tn, $new_d, $busy);
$this->ntice('5097', $args);
$ep->ntice('5097', $args);
// $ep->ntice('5098', array($name, abs($move), $tn, $new_d));
// $this->notice(sprintf('%s moves %.01f meters towards %s and is now on position %.01f meters. %ds busy.', $name, abs($move), $tn, $new_d, $busy));
// $this->getEnemyParty()->notice(sprintf('%s moves %.01f meters towards %s and is now on position %.01f meters.', $name, abs($move), $tn, $new_d));
return true;
}