本文整理汇总了C#中WorldServer.player.Player.setLastCombatType方法的典型用法代码示例。如果您正苦于以下问题:C# Player.setLastCombatType方法的具体用法?C# Player.setLastCombatType怎么用?C# Player.setLastCombatType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.setLastCombatType方法的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];
//.........这里部分代码省略.........