本文整理匯總了C#中WorldServer.player.Player.getLastMagicAttack方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.getLastMagicAttack方法的具體用法?C# Player.getLastMagicAttack怎麽用?C# Player.getLastMagicAttack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.getLastMagicAttack方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: newMagicAttack
public static void newMagicAttack(Player p, Entity target, int id, bool ancients)
{
int index = getSpellIndex(p, id, ancients);
bool autoCasting = p.getTemporaryAttribute("autoCasting") != null;
bool fakeNPC = target != null && target is Npc && ((Npc)target).getId() == 0;
Entity lastAutocastEntity = null;
bool frozen = false;
if (index == -1) {
return;
}
if (p.getTarget() == null) {
if (autoCasting) {
if (Location.inMultiCombat(p.getLocation())) {
lastAutocastEntity = (Entity) p.getTemporaryAttribute("autocastEntity") == null ? null : (Entity) p.getTemporaryAttribute("autocastEntity");
if (lastAutocastEntity == null || lastAutocastEntity is Player) {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
if (hitsMulti(p, index)) {
Location location = (Location)p.getTemporaryAttribute("autocastLocation");
Entity newTarget = new Npc(0);
newTarget.setLocation(location);
p.setTarget(newTarget);
newMagicAttack(p, newTarget, id, ancients);
return;
}
} else {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
} else {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
} else {
if (!canCastSpell(p, target, index, fakeNPC)) {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
}
int distance = 8;
if (target is Player) {
if (((Player)target).getSprites().getPrimarySprite() != -1) {
distance = 8;
}
}
if (!fakeNPC) { // we're actually attacking a real npc/player
if (!p.getLocation().withinDistance(target.getLocation(), distance)) {
p.getFollow().setFollowing(target);
Event attemptMagicAttackEvent = new Event(500);
int attemptMagicAttackCounter = 0;
attemptMagicAttackEvent.setAction(() => {
if (p.getLocation().withinDistance(target.getLocation(), distance) && p.getTarget() != null) {
attemptMagicAttackEvent.stop();
newMagicAttack(p, target, id, ancients);
return;
}
attemptMagicAttackCounter++;
if (attemptMagicAttackCounter >= 12)
{
attemptMagicAttackEvent.stop();
}
});
Server.registerEvent(attemptMagicAttackEvent);
return;
}
}
int timeSinceLastCast = autoCasting ? 3500 : 2000;
if (Environment.TickCount - p.getLastMagicAttack() < timeSinceLastCast) {
p.getWalkingQueue().resetWalkingQueue();
//return;
}
int time = p.getLastCombatType().Equals(Combat.CombatType.MAGE) ? 1550 : 600;
if (Environment.TickCount - p.getLastAttack() < time) {
int delay = p.getLastCombatType().Equals(Combat.CombatType.MAGE) ? 1350 : 800;
Event attemptMagicAttackEvent = new Event(500);
attemptMagicAttackEvent.setAction(() => {
if (Environment.TickCount - p.getLastAttack() > delay) {
attemptMagicAttackEvent.stop();
newMagicAttack(p, target, id, ancients);
}
});
Server.registerEvent(attemptMagicAttackEvent);
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().clearMapFlag();
p.setLastCombatType(Combat.CombatType.MAGE);
return;
}
if (fakeNPC && !monsterInArea(p, target)) {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
int endGfx = END_GFX[index];
//.........這裏部分代碼省略.........