public bool DoChoosenAttack() { if (m_Mobile == null) { return(false); } SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile); if (special != null) { return(false); } else if (m_NextCastTime < DateTime.UtcNow) { if (m_Mobile.Hidden) { special = GetHiddenSpecialMove(); } else { special = GetSpecialMove(); } SpecialMove.SetCurrentMove(m_Mobile, special); m_NextCastTime = DateTime.UtcNow + GetCastDelay(); return(true); } return(false); }
public override bool DoActionCombat() { base.DoActionCombat(); Mobile c = m_Mobile.Combatant as Mobile; if (c != null) { SpecialMove move = SpecialMove.GetCurrentMove(m_Mobile); if (move == null && m_NextSpecial < DateTime.UtcNow && 0.05 > Utility.RandomDouble()) { move = GetSpecialMove(); if (move != null) { SpecialMove.SetCurrentMove(m_Mobile, move); m_NextSpecial = DateTime.UtcNow + GetCastDelay(); } } else if (m_Mobile.Spell == null && m_NextCastTime < DateTime.UtcNow && 0.05 > Utility.RandomDouble()) { Spell spell = GetRandomSpell(); if (spell != null) { spell.Cast(); m_NextCastTime = DateTime.UtcNow + GetCastDelay(); } } } return(true); }
public override void OnThink() { base.OnThink(); if (Combatant == null) { return; } if (Core.TickCount - _NextMastery >= 0) { object spell = GetMasterySpell(); if (spell == null) { return; } if (spell is SkillMasterySpell && !SkillMasterySpell.HasSpell(this, ((SkillMasterySpell)spell).GetType())) { ((SkillMasterySpell)spell).Cast(); _NextMastery = Core.TickCount + (int)TimeSpan.FromSeconds(Utility.RandomMinMax(15, 30)).TotalMilliseconds; } else if (spell is SpecialMove) { SpecialMove.SetCurrentMove(this, (SpecialMove)spell); _NextMastery = Core.TickCount + (int)TimeSpan.FromSeconds(Utility.RandomMinMax(15, 30)).TotalMilliseconds; } } }
public override void OnThink() { base.OnThink(); if (Combatant == null) { return; } if (_NextMastery < DateTime.UtcNow) { if (SkillMasterySpell.HasSpell(this, typeof(RampageSpell)) || Utility.RandomDouble() > 0.5) { SpecialMove.SetCurrentMove(this, SpellRegistry.GetSpecialMove(740)); } else { SkillMasterySpell spell = new RampageSpell(this, null); spell.Cast(); } _NextMastery = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 70)); } if (_NextSpecial < DateTime.UtcNow) { DoSpecial(); _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60)); } }
public override void AlterMeleeDamageTo(Mobile to, ref int damage) { if (to is BaseCreature) { damage *= 10; } // little complex math here. 0 = nothing, // 1 = air 1st hit, 2 = air 2nd hit, 3 = air 3rd hit, 4 = air combo. // and so on. if (OnCombo == 0) { OnCombo = (Utility.Random(6) * 4) + 1; } // This system works fine for pure element combos. int oncombo = OnCombo / 4; if (OnCombo % 4 == 0) // On Finisher { OnCombo = 0; } else { ++OnCombo; } SpecialMove.SetCurrentMove(this, new MonkStrike((MonkElement)oncombo)); // TODO support mixed elements. }
private static void Targeted_Spell(TargetedSpellEventArgs e) { try { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } Spellbook book = null; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Mobile to = World.FindMobile(e.Target.Serial); Item toI = World.FindItem(e.Target.Serial); Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (to != null) { spell.InstantTarget = to; } else if (toI != null) { spell.InstantTarget = toI as IDamageableItem; } if (spell != null) { spell.Cast(); } else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } } catch { } }
private bool PerformFocusAttack() { if (Utility.RandomBool() && CanUseAbility(60.0, 20, focusChance)) { SpecialMove.SetCurrentMove(m_Mobile, new FocusAttack()); return(true); } return(false); }
private bool PerformFocusAttack() { if (Utility.RandomBool() && CanUseAbility(60.0, 20, focusChance)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(500)); // Focus Attack return(true); } return(false); }
private static void Targeted_Spell(TargetedSpellEventArgs e) { try { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } int spellID = e.SpellID; Spellbook book = Find(from, spellID); if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else if (e.Target != null) { Mobile to = World.FindMobile(e.Target.Serial); Item toI = World.FindItem(e.Target.Serial); Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null && !Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { if (to != null) { spell.InstantTarget = to; } else if (toI != null) { spell.InstantTarget = toI as IDamageableItem; } spell.Cast(); } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } } catch (Exception ex) { Diagnostics.ExceptionLogging.LogException(ex); } }
public override bool DoActionWander() { m_Mobile.DebugSay("I am wandering around."); if (formChange && m_NextMorphTime < DateTime.UtcNow) { if (m_Mobile.BodyMod == 0) { ChangeForm(m_Bodies[Utility.Random(m_Bodies.Length)]); } else { ChangeForm(0); } } //relax mode m_Mobile.DebugSay("Threat gone, I am going to relax down myself..."); if (m_Mobile.Hidden) { m_Mobile.Hidden = false; } SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile); if (special != null) { SpecialMove.SetCurrentMove(m_Mobile, null); return(true); } //relax mode if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.DebugSay("Enemy detected: going to enter sneak mode and attack"); if (!m_Mobile.Hidden && Utility.RandomDouble() < m_Mobile.Skills[SkillName.Hiding].Value / 100 && (m_Mobile.GetDistanceToSqrt(m_Mobile.FocusMob) > 3 || m_Mobile.FocusMob.Warmode == false)) { TryPerformHide(); } m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; } else { return(base.DoActionWander()); } return(true); }
public override bool DoActionCombat() { base.DoActionCombat(); if (m_Mobile.Combatant is Mobile c) { if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CheckCanFlee()) { m_Mobile.DebugSay("I am going to flee from {0}", c.Name); Action = ActionType.Flee; } else { SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile); if (special == null && m_NextCastTime < DateTime.UtcNow && 0.05 > Utility.RandomDouble()) { if (0.05 > Utility.RandomDouble()) { new MirrorImage(m_Mobile, null).Cast(); } else { if (m_Mobile.Hidden) { special = GetHiddenSpecialMove(); } else { special = GetSpecialMove(); } if (special != null) { SpecialMove.SetCurrentMove(m_Mobile, special); m_NextCastTime = DateTime.UtcNow + GetCastDelay(); } } } if (m_NextRanged < DateTime.UtcNow && 0.08 > Utility.RandomDouble()) { DoRangedAttack(); } } } return(true); }
private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e) { Mobile from = e.Mobile; Spell spell = SpellRegistry.NewSpell(e.SpellID, from, null); if (!Multis.DesignContext.Check(from)) { return; // They are customizing } if (spell != null && from.AccessLevel > AccessLevel.Player) { spell.Cast(); //staff do not need the spellbook return; } Spellbook book = e.Spellbook as Spellbook; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { if (spell != null) { spell.Cast(); } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } }
private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e) { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } Spellbook book = e.Spellbook as Spellbook; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null) { spell.Cast(); } else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } }
public override bool DoActionCombat() { base.DoActionCombat(); if (m_Mobile.Combatant == null) { return(true); } SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile); if (special == null && m_NextCastTime < DateTime.UtcNow && 0.05 > Utility.RandomDouble()) { if (0.05 > Utility.RandomDouble()) { new MirrorImage(m_Mobile, null).Cast(); } else { if (m_Mobile.Hidden) { special = GetHiddenSpecialMove(); } else { special = GetSpecialMove(); } if (special != null) { SpecialMove.SetCurrentMove(m_Mobile, special); m_NextCastTime = DateTime.UtcNow + GetCastDelay(); } } } if (m_NextRanged < DateTime.UtcNow && 0.08 > Utility.RandomDouble()) { DoRangedAttack(); } return(true); }
private void UseAttackAbility() { ArrayList t = BaseAttackHelperSE.GetAllAttackers(m_Mobile, 2); if (t.Count > 1) { if (Utility.Random(3) != 1) { if (CanUseAbility(70.0, 10, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(405)); // Momentum Strike return; } } } if (CanUseAbility(50.0, 5, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(404)); // Lightning Strike } return; }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 0) { return; } switch (info.ButtonID) { case 1: { SpecialMove.SetCurrentMove(sender.Mobile, new AssassinateMove()); sender.Mobile.SendMessage("You prepare to use Assassinate."); break; } case 2: { WeaponAbility.SetCurrentAbility(sender.Mobile, new ArmorIgnore()); sender.Mobile.SendMessage("You prepare to use Armor Ignore."); break; } case 3: { WeaponAbility.SetCurrentAbility(sender.Mobile, new BleedAttack()); sender.Mobile.SendMessage("You prepare to use Bleed Attack"); break; } case 4: { WeaponAbility.SetCurrentAbility(sender.Mobile, new MortalStrike()); sender.Mobile.SendMessage("You prepare to use Mortal Strike"); break; } case 5: { WeaponAbility.SetCurrentAbility(sender.Mobile, new ShadowStrike()); sender.Mobile.SendMessage("You prepare to use Shadow Strike"); break; } } sender.Mobile.CloseGump(typeof(AssassinSkillsGump)); sender.Mobile.SendGump(new AssassinSkillsGump(sender.Mobile)); }
private static void Targeted_Spell(TargetedSpellEventArgs e) { Mobile from = e.NetState.Mobile; if (!Multis.DesignContext.Check(from)) { return; // They are customizing } int spellID = e.SpellID; SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null) { try { from.TargetLocked = true; Mobile targeted = World.FindMobile(e.Target.Serial); spell.DefineTargetForeignSpell(targeted); spell.Cast(); } catch { Console.WriteLine("Erro target Spell."); } finally { from.TargetLocked = false; } } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } }
public override bool DoActionCombat() { Mobile combatant = m_Mobile.Combatant; if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet) { m_Mobile.DebugSay("My combatant is gone, so my guard is up"); Action = ActionType.Guard; return(true); } if (MoveTo(combatant, true, m_Mobile.RangeFight)) { m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant); } else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { if (m_Mobile.Debug) { m_Mobile.DebugSay("My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name); } m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; return(true); } else if (m_Mobile.GetDistanceToSqrt(combatant) > m_Mobile.RangePerception + 1) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I cannot find {0}, so my guard is up", combatant.Name); } Action = ActionType.Guard; return(true); } else { if (m_Mobile.Debug) { m_Mobile.DebugSay("I should be closer to {0}", combatant.Name); } } if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee) { if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100) { // We are low on health, should we flee? bool flee = false; if (m_Mobile.Hits < combatant.Hits) { // We are more hurt than them int diff = combatant.Hits - m_Mobile.Hits; flee = (Utility.Random(0, 100) < (10 + diff)); // (10 + diff)% chance to flee } else { flee = Utility.Random(0, 100) < 10; // 10% chance to flee } if (flee) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name); } Action = ActionType.Flee; } } } if (combatant.Hits < (Utility.Random(10) + 10)) { if (CanUseAbility(25.0, 0, heChance)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(400)); // Honorable Execution return(true); } } UseSamuraiAbility(); return(true); }
public static void AC_OnCommand(CommandEventArgs e) { if (!AssassinControl.IsAssassin(e.Mobile) && e.Mobile.AccessLevel == AccessLevel.Player) { e.Mobile.SendMessage(1194, "You must be an assassin to use this command."); return; } else if (!Multis.DesignContext.Check(e.Mobile)) { return; // They are customizing their house } string words = e.GetString(0).ToLower(); if (words == null || words == "") { e.Mobile.CloseGump(typeof(AssassinSkillsGump)); e.Mobile.SendGump(new AssassinSkillsGump(e.Mobile)); } else if (words == "help") { e.Mobile.SendMessage(1194, "\"[ACreed\" opens the assassin's skills menu where you can use other weapon abilities."); e.Mobile.SendMessage(1194, "\"[ACreed assassinate\" sets your weapon ability to Assassinate."); e.Mobile.SendMessage(1194, "\"[ACreed armorignore\" sets your weapon ability to Armor Ignore."); e.Mobile.SendMessage(1194, "\"[ACreed bleedattack\" sets your weapon ability to Bleed Attack."); e.Mobile.SendMessage(1194, "\"[ACreed mortalstrike\" sets your weapon ability to Mortal Strike."); e.Mobile.SendMessage(1194, "\"[ACreed shadowstrike\" sets your weapon ability to Shadow Strike."); e.Mobile.SendMessage(1194, "\"[ACreed heal\" Attempts to heal. In order of attempts; assassin's belt, bandage, heal potions."); e.Mobile.SendMessage(1194, "\"[ACreed title\" Updates your Assassin title based on assassin gear worn."); //e.Mobile.SendMessage( 1194, "\"[ACreed travel\" opens a special assassin only recall/mark menu."); } else if (words == "assassinate") { SpecialMove.SetCurrentMove(e.Mobile, new AssassinateMove()); e.Mobile.SendMessage(1194, "You prepare to use Assassinate."); } else if (words == "armorignore") { SpecialMove.SetCurrentMove(e.Mobile, new ArmorIgnoreMove()); e.Mobile.SendMessage(1194, "You prepare to use Armor Ignore"); } else if (words == "bleedattack") { SpecialMove.SetCurrentMove(e.Mobile, new BleedAttackMove()); e.Mobile.SendMessage(1194, "You prepare to use Bleed Attack"); } else if (words == "mortalstrike") { SpecialMove.SetCurrentMove(e.Mobile, new MortalStrikeMove()); e.Mobile.SendMessage(1194, "You prepare to use Mortal Strike"); } else if (words == "shadowstrike") { SpecialMove.SetCurrentMove(e.Mobile, new ShadowStrikeMove()); e.Mobile.SendMessage(1194, "You prepare to use Shadow Strike"); } else if (words == "heal") { if (e.Mobile.Hits == e.Mobile.HitsMax) { e.Mobile.SendMessage(1194, "You are already at full life."); return; } // Belt ACreedBelt belt = e.Mobile.FindItemOnLayer(Layer.Waist) as ACreedBelt; if (belt != null) { if (DateTime.Now > belt.HealDelay) { belt.OnDoubleClick(e.Mobile); return; } } if (e.Mobile.Backpack == null) { return; } // Bandage if (e.Mobile.Backpack.ConsumeTotal(typeof(Bandage), 1)) { if (BandageContext.GetContext(e.Mobile) == null) { e.Mobile.SendLocalizedMessage(500956); // You begin applying the bandages. BandageContext.BeginHeal(e.Mobile, e.Mobile); return; } } // Heal Potions BaseHealPotion potion = e.Mobile.Backpack.FindItemByType(typeof(GreaterHealPotion)) as BaseHealPotion; if (potion == null) { potion = e.Mobile.Backpack.FindItemByType(typeof(HealPotion)) as BaseHealPotion; } if (potion == null) { potion = e.Mobile.Backpack.FindItemByType(typeof(LesserHealPotion)) as BaseHealPotion; } if (potion != null) { potion.OnDoubleClick(e.Mobile); return; } e.Mobile.SendMessage(1194, "No way to heal found."); } else if (words == "title") { int gear = 0; if (e.Mobile.FindItemOnLayer(Layer.Helm) is ACreedGarb) // Chain Coif { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.Neck) is ACreedGarb) // Mempo { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.MiddleTorso) is ACreedGarb) // Jin Bori { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.InnerTorso) is ACreedGarb) // Studded Chest { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.Waist) is ACreedGarb) // Belt { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.Pants) is ACreedGarb) // Thigh Boots { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.Shoes) is ACreedGarb) // Skirt { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.Arms) is ACreedGarb) // Bone Arms { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.OuterLegs) is ACreedGarb) // Kilt { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.Shirt) is ACreedGarb) // Shirt { ++gear; } if (e.Mobile.FindItemOnLayer(Layer.Gloves) is ACreedGarb) // Gloves { ++gear; } switch (gear) { case 0: case 1: e.Mobile.Title = "the Thief"; break; case 2: case 3: e.Mobile.Title = "the Rogue"; break; case 4: case 5: e.Mobile.Title = "the Assassin"; break; case 6: case 7: e.Mobile.Title = "the Skilled Assassin"; break; case 8: case 9: e.Mobile.Title = "the Master Assassin"; break; case 10: case 11: e.Mobile.Title = "the Grandmaster Assassin"; break; } } else if (words == "travel") { // Todo: Finish e.Mobile.CloseGump(typeof(AssassinSkillsGump)); e.Mobile.SendGump(new AssassinSkillsGump(e.Mobile)); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 0) { return; } MonkFists mf = sender.Mobile.FindItemOnLayer(Layer.Gloves) as MonkFists; if (mf == null) { sender.Mobile.SendMessage("Only monks can use this strike."); return; } if (info.ButtonID == 999) { new MonkCombos.WholenessOfBodyTimer(sender.Mobile).Start(); if (sender.Mobile.HasGump(typeof(MonkStrikeGump))) { sender.Mobile.CloseGump(typeof(MonkStrikeGump)); } sender.Mobile.SendGump(new MonkStrikeGump(sender.Mobile)); return; } switch ((MonkElement)info.ButtonID) { case MonkElement.None: { sender.Mobile.Freeze(TimeSpan.FromSeconds(1)); sender.Mobile.Animate(17, 7, 1, true, false, 0); MonkSystem.AddHit(sender.Mobile, (MonkElement)info.ButtonID); if (sender.Mobile.HasGump(typeof(MonkStrikeGump))) { sender.Mobile.CloseGump(typeof(MonkStrikeGump)); } sender.Mobile.SendGump(new MonkStrikeGump(sender.Mobile)); break; } case MonkElement.FireCombo: { MonkCombos.FireCombo(sender.Mobile); break; } case MonkElement.LightCombo: { MonkCombos.LightCombo(sender.Mobile); goto case MonkElement.None; } case MonkElement.LightAirCombo: { MonkCombos.LightAirCombo(sender.Mobile); goto case MonkElement.None; } case MonkElement.LightEarthCombo: { MonkCombos.LightEarthCombo(sender.Mobile); goto case MonkElement.None; } case MonkElement.LightFireCombo: { MonkCombos.LightFireCombo(sender.Mobile); goto case MonkElement.None; } case MonkElement.LightWaterCombo: { MonkCombos.LightWaterCombo(sender.Mobile); goto case MonkElement.None; } case MonkElement.LightVoidCombo: { // Moment of Clarity: Activate this to grant your allies a +5 Insight bonus to hit and to skill checks for a very short period of time. goto case MonkElement.None; } case MonkElement.LightSpecialOne: { mf.LightEnergy = mf.DarkEnergy = 0; break; } case MonkElement.LightSpecialTwo: { mf.LightEnergy = mf.DarkEnergy = 0; break; } case MonkElement.DarkSpecialOne: { mf.LightEnergy = mf.DarkEnergy = 0; break; } case MonkElement.DarkSpecialTwo: { mf.LightEnergy = mf.DarkEnergy = 0; break; } default: { if (Enum.IsDefined(typeof(MonkElement), info.ButtonID)) { SpecialMove.SetCurrentMove(sender.Mobile, new MonkStrike((MonkElement)info.ButtonID)); } break; } } }
public override bool DoActionWander() { m_Mobile.DebugSay("I am wandering around."); if (turnOrHideChance > Utility.RandomDouble() && !m_Mobile.Hidden) { if (Utility.RandomBool()) { if (m_Mobile.BodyMod == 0) { ChangeForm(m_Bodies[Utility.Random(m_Bodies.Length)]); } else { ChangeForm(0); } } else { PerformHide(); m_Mobile.UseSkill(SkillName.Stealth); } } if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.DebugSay("I have detected {0}, going to try and sneak up on them!", m_Mobile.FocusMob.Name); if (m_Mobile.Hidden) // we are hidden { if (m_Mobile.GetDistanceToSqrt(m_Mobile.FocusMob) <= 2) { if (CanUseAbility(85.0, 30, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, new DeathStrike()); m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; } else { m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; } } else if (m_Mobile.GetDistanceToSqrt(m_Mobile.FocusMob) <= 10) { //MoveTo( m_Mobile.FocusMob, true, 1 ); WalkMobileRange(m_Mobile.FocusMob, 10, true, 2, 1); } } else { m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; } } else { return(base.DoActionWander()); } return(true); }
public override bool DoActionCombat() { if (m_Mobile.BodyMod != 0) { ChangeForm(0); } Mobile combatant = m_Mobile.Combatant; if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet) { m_Mobile.DebugSay("My combatant is gone, so my guard is up"); Action = ActionType.Guard; return(true); } /*if ( !m_Mobile.InLOS( combatant ) ) * { * if ( AquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) * { * m_Mobile.Combatant = combatant = m_Mobile.FocusMob; * m_Mobile.FocusMob = null; * } * }*/ if (MoveTo(combatant, true, m_Mobile.RangeFight)) { m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant); } else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.DebugSay("My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name); m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; return(true); } else if (m_Mobile.GetDistanceToSqrt(combatant) > m_Mobile.RangePerception + 1) { m_Mobile.DebugSay("I cannot find {0}, so my guard is up", combatant.Name); Action = ActionType.Guard; return(true); } else { m_Mobile.DebugSay("I should be closer to {0}", combatant.Name); } if (!m_Mobile.Controlled && !m_Mobile.Summoned) { if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100) { // We are low on health, should we flee? bool flee = false; if (m_Mobile.Hits < combatant.Hits) { // We are more hurt than them int diff = combatant.Hits - m_Mobile.Hits; flee = (Utility.Random(0, 100) < (10 + diff)); // (10 + diff)% chance to flee } else { flee = Utility.Random(0, 100) < 10; // 10% chance to flee } if (flee) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name); } Action = ActionType.Flee; if (CanUseAbility(50.0, 15, shadowJumpChance)) { PerformHide(); m_Mobile.UseSkill(SkillName.Stealth); if (m_Mobile.AllowedStealthSteps != 0) { if (PerformShadowjump(combatant)) { m_Mobile.Mana -= 15; } } } } } } if (combatant.Hits < (Utility.Random(10) + 10)) { if (CanUseAbility(85.0, 30, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, new DeathStrike()); return(true); } } double dstToTarget = m_Mobile.GetDistanceToSqrt(combatant); if (dstToTarget > 2.0 && dstToTarget <= (m_Mobile.Skills[SkillName.Ninjitsu].Value / 10.0) && m_Mobile.Mana > 45 && comboChance > (Utility.RandomDouble() + MagnitudeBySkill())) { PerformHide(); m_Mobile.UseSkill(SkillName.Stealth); if (m_Mobile.AllowedStealthSteps != 0) { if (CanUseAbility(20.0, 30, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, new Backstab()); } if (CanUseAbility(30.0, 20, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, new SurpriseAttack()); } PerformFocusAttack(); if (PerformShadowjump(combatant)) { m_Mobile.Mana -= 15; } } return(true); } if (PerformMirror()) { return(true); } if (CanUseAbility(80.0, 25, kiChance) && m_Mobile.GetDistanceToSqrt(combatant) < 2.0) { SpecialMove.SetCurrentMove(m_Mobile, new KiAttack()); return(true); } PerformFocusAttack(); return(true); }