/// <summary> /// Method for a lord to cast a heal spell /// </summary> /// <param name="lord">The lord object</param> public static void LordCastHealSpell(GameKeepGuard lord) { //decide which healing spell Spell spell = GetLordHealSpell((eRealm)lord.Realm); //cast the healing spell if (spell != null && !lord.IsStunned && !lord.IsMezzed) { lord.StopAttack(); lord.TargetObject = lord; lord.CastSpell(spell, SpellMgr.GuardSpellLine); } }
/// <summary> /// We need an event after an attack is finished so we know when players are unreachable by archery /// </summary> /// <param name="e"></param> /// <param name="sender"></param> /// <param name="arguments"></param> public static void AttackFinished(DOLEvent e, object sender, EventArgs arguments) { GameKeepGuard guard = sender as GameKeepGuard; if (guard.TargetObject == null) { return; } if (!guard.AttackState) { return; } if (guard is GuardArcher == false && guard is GuardLord == false && guard is GuardCaster == false) { return; } AttackFinishedEventArgs afargs = arguments as AttackFinishedEventArgs; if (guard.ActiveWeaponSlot != eActiveWeaponSlot.Distance && !guard.IsMoving) { eAttackResult result = afargs.AttackData.AttackResult; if (result == eAttackResult.OutOfRange) { guard.StopAttack(); lock (guard.Attackers) { foreach (GameLiving living in guard.Attackers) { if (guard.IsWithinRadius(living, guard.AttackRange)) { guard.StartAttack(living); return; } } } if (guard.IsWithinRadius(guard.TargetObject, guard.AttackRangeDistance)) { if (guard.MaxSpeedBase == 0 || (guard is GuardArcher && !guard.BeenAttackedRecently)) { guard.SwitchToRanged(guard.TargetObject); } } } return; } if (guard.ActiveWeaponSlot == eActiveWeaponSlot.Distance) { if (GameServer.ServerRules.IsAllowedToAttack(guard, guard.TargetObject as GameLiving, true) == false) { guard.StopAttack(); return; } if (!guard.IsWithinRadius(guard.TargetObject, guard.AttackRange)) { guard.StopAttack(); return; } } GamePlayer player = null; if (guard.TargetObject is GamePlayer) { player = guard.TargetObject as GamePlayer; } else if (guard.TargetObject is GameNPC) { GameNPC npc = (guard.TargetObject as GameNPC); if (npc.Brain != null && ((npc is GameKeepGuard) == false) && npc.Brain is IControlledBrain) { player = (npc.Brain as IControlledBrain).GetPlayerOwner(); } } if (player != null) { player.Out.SendCheckLOS(guard, guard.TargetObject, new CheckLOSResponse(guard.GuardStopAttackCheckLOS)); } }
/// <summary> /// Method for a lord to cast a heal spell /// </summary> /// <param name="lord">The lord object</param> public static void LordCastHealSpell(GameKeepGuard lord) { //decide which healing spell Spell spell = GetLordHealSpell((eRealm)lord.Realm); //cast the healing spell if (spell != null && !lord.IsStunned && !lord.IsMezzed) { lord.StopAttack(); lord.TargetObject = lord; lord.CastSpell(spell, SpellMgr.GuardSpellLine); } }