public virtual Spell DoCombo(Mobile c) { Spell spell = null; if (m_Combo == 0) { spell = new ExplosionSpell(m_Mobile, null); ++m_Combo; // Move to next spell } else if (m_Combo == 1) { spell = new WeakenSpell(m_Mobile, null); ++m_Combo; // Move to next spell } else if (m_Combo == 2) { if (!c.Poisoned) spell = new PoisonSpell(m_Mobile, null); else if (IsNecromancer) spell = new StrangleSpell(m_Mobile, null); ++m_Combo; // Move to next spell } if (m_Combo == 3 && spell == null) { switch (Utility.Random(IsNecromancer ? 4 : 3)) { case 0: { if (c.Int < c.Dex) spell = new FeeblemindSpell(m_Mobile, null); else spell = new ClumsySpell(m_Mobile, null); ++m_Combo; // Move to next spell break; } case 1: { spell = new EnergyBoltSpell(m_Mobile, null); m_Combo = -1; // Reset combo state break; } case 2: { spell = new FlameStrikeSpell(m_Mobile, null); m_Combo = -1; // Reset combo state break; } default: { spell = new PainSpikeSpell(m_Mobile, null); m_Combo = -1; // Reset combo state break; } } } else if (m_Combo == 4 && spell == null) { spell = new MindBlastSpell(m_Mobile, null); m_Combo = -1; } return spell; }
public Spell CheckCurse() { Mobile foe = m_Mobile.Combatant; if ( foe == null ) return null; StatMod mod = foe.GetStatMod( "[Magic] Int Offset" ); if ( mod != null && mod.Offset < 0 ) return null; if ( m_Mobile.Skills[SkillName.Magery].Value >= 40.0 ) return new CurseSpell( m_Mobile, null ); int whichone = 1; Spell spell = null; if ( (mod = foe.GetStatMod( "[Magic] Str Offset" )) != null ) whichone++; if ( (mod= m_Mobile.GetStatMod( "[Magic] Dex Offset" )) != null ) whichone++; switch ( whichone ) { case 1: spell = new FeeblemindSpell( m_Mobile, null ); break; case 2: spell = new WeakenSpell( m_Mobile, null ); break; case 3: spell = new ClumsySpell( m_Mobile, null ); break; } return spell; }
public InternalTarget(WeakenSpell owner) : base(12, false, TargetFlags.Harmful) { m_Owner = owner; }
public InternalSphereTarget(WeakenSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful) { m_Owner = owner; m_Owner.Caster.SendAsciiMessage("Selecione o alvo..."); }
public InternalTarget(WeakenSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful) { this.m_Owner = owner; }
public InternalTarget(WeakenSpell owner) : base(owner.Caster.EraML ? 10 : 12, false, TargetFlags.Harmful) { m_Owner = owner; }
public InternalTarget( WeakenSpell owner ) : base( 12, false, TargetFlags.Harmful ) { m_Owner = owner; }
public bool ApplyStatEffect(PlayerMobile Wearer, bool bStr, bool bDex, bool bInt, int change) { Spell spell = null; if( Wearer == null ) return false; // Try to apply bless to all stats int BlessOffset = change; bool AppliedStr = false; bool AppliedInt = false; bool AppliedDex = false; if( bStr ) { if(BlessOffset > 0) { spell = new StrengthSpell(Wearer, null); } else spell = new WeakenSpell(Wearer, null); if (Wearer.Region.OnBeginSpellCast( Wearer, spell ) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return false; } AppliedStr = AddStatBonus(Wearer, BlessOffset, StatType.Str, TimeSpan.Zero); } if( bInt ) { if(BlessOffset > 0) { spell = new CunningSpell(Wearer, null); } else spell = new FeeblemindSpell(Wearer, null); if (Wearer.Region.OnBeginSpellCast( Wearer, spell ) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return false; } AppliedInt = AddStatBonus(Wearer, BlessOffset, StatType.Int, TimeSpan.Zero); } if( bDex ) { if(BlessOffset > 0) { spell = new AgilitySpell(Wearer, null); } else spell = new ClumsySpell(Wearer, null); if (Wearer.Region.OnBeginSpellCast( Wearer, spell ) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return false; } AppliedDex = AddStatBonus(Wearer, BlessOffset, StatType.Dex, TimeSpan.Zero); } Wearer.CheckStatTimers(); // If any stats were adjusted, start timer to remove the stats after effect expires // return that spell was successful if (AppliedStr || AppliedInt || AppliedDex) /* 7/25/04 smerX */ { if( m_StatEffectTimer != null ) { m_StatEffectTimer.Stop(); m_StatEffectTimer = null; } m_StatEffectTimer = new MagicEffectTimer(Wearer, this, TimeSpan.FromSeconds(120)); m_StatEffectTimer.Start(); return true; } else { return false; } }
public virtual Spell DoCombo( Mobile c ) { Spell spell = null; if ( m_Combo == 0 ) { spell = new ExplosionSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } else if ( m_Combo == 1 ) { spell = new WeakenSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } else if ( m_Combo == 2 ) { if ( !( ( m_Mobile is IEvoCreature || m_Mobile is EvolutionDragon ) && c is PlayerMobile ) && !c.Poisoned ) spell = new PoisonSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } if ( m_Combo == 3 && spell == null ) { switch ( Utility.Random( 3 ) ) { default: case 0: { if ( c.Int < c.Dex ) spell = new FeeblemindSpell( m_Mobile, null ); else spell = new ClumsySpell( m_Mobile, null ); ++m_Combo; // Move to next spell break; } case 1: { spell = new EnergyBoltSpell( m_Mobile, null ); m_Combo = -1; // Reset combo state break; } case 2: { spell = new FlameStrikeSpell( m_Mobile, null ); m_Combo = -1; // Reset combo state break; } } } else if ( m_Combo == 4 && spell == null ) { spell = new MindBlastSpell( m_Mobile, null ); m_Combo = -1; } return spell; }
public virtual Spell DoCombo(Mobile c) { Spell spell = null; if (m_Combo == 0) { //m_Mobile.Say( "combo phase 0" ); spell = new ExplosionSpell(m_Mobile, null); ++m_Combo; // Move to next spell } else if (m_Combo == 1) { //m_Mobile.Say( "combo phase 1" ); spell = new ExplosionSpell(m_Mobile, null); ++m_Combo; // Move to next spell } else if (m_Combo == 2) { //m_Mobile.Say( "combo phase 2" ); if (!c.Poisoned) spell = new PoisonSpell(m_Mobile, null); ++m_Combo; // Move to next spell } else if (m_Combo == 3) { //m_Mobile.Say( "combo phase 3" ); if (c.Poisoned) spell = new WeakenSpell(m_Mobile, null); if (!c.Poisoned) spell = new PoisonSpell(m_Mobile, null); ++m_Combo; // Move to next spell } else if (m_Combo == 4) { // m_Mobile.Say( "combo phase 4 ebolt" ); spell = new EnergyBoltSpell(m_Mobile, null); ++m_Combo; // Move to next spell } else if (m_Combo == 5) { //m_Mobile.Say( "combo phase 5" ); if (c.Poisoned && c.Alive) { spell = new HarmSpell(m_Mobile, null); m_Combo = 5; // Move to next spell } if (!c.Poisoned) { if (m_Mobile.Mana > 20) spell = new EnergyBoltSpell(m_Mobile, null); if (m_Mobile.Mana < 19) spell = new LightningSpell(m_Mobile, null); m_Combo = -1; // Reset combo state } } return spell; }
public void ChargedAbilityAttack( Mobile attacker, Mobile defender ) { if ( m_AbilityCharges <= 0 ) return; AbilitySpell m_Spell = null; Mobile dummy = DummyCaster; switch ( m_ChargedAbility ) { case WeaponChargedAbility.Clumsiness: m_Spell = new ClumsySpell( dummy, null ); break; case WeaponChargedAbility.Feeblemindedness: m_Spell = new FeeblemindSpell( dummy, null ); break; case WeaponChargedAbility.Weakness: m_Spell = new WeakenSpell( dummy, null ); break; case WeaponChargedAbility.Burning : m_Spell = new MagicArrowSpell( dummy, null ); break; case WeaponChargedAbility.Wounding: m_Spell = new HarmSpell( dummy, null ); break; case WeaponChargedAbility.DragonsBreath: case WeaponChargedAbility.DaemonsBreath: m_Spell = new FireballSpell( dummy, null ); break; case WeaponChargedAbility.Thunder: m_Spell = new LightningSpell( dummy, null ); break; case WeaponChargedAbility.MagesBane: m_Spell = new ManaDrainSpell( dummy, null ); break; case WeaponChargedAbility.GhoulsTouch: m_Spell = new ParalyzeSpell( dummy, null ); break; case WeaponChargedAbility.Evil: m_Spell = new CurseSpell( dummy, null ); break; } if ( m_Spell != null ) { m_Spell.OnHit( attacker, defender ); m_AbilityCharges--; } dummy.Delete(); }
public override Spell DoCombo(Mobile c) { //m_Mobile.Say("doing human AI combo"); if (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell)) { m_EnemyCountersPara = true; } Spell spell = null; if (Combo == 0) { //m_Mobile.Say( "combo phase 1" ); spell = new ExplosionSpell(m_Mobile, null); ++Combo; // Move to next spell } if (Combo == 1) { //m_Mobile.Say( "combo phase 1" ); spell = new ExplosionSpell(m_Mobile, null); ++Combo; // Move to next spell } else if (Combo == 2) { //m_Mobile.Say( "combo phase 2" ); if (!c.Poisoned && (CheckCanPoison(c))) spell = new PoisonSpell(m_Mobile, null); ++Combo; // Move to next spell } else if (Combo == 3) { //m_Mobile.Say( "combo phase 3" ); if (c.Poisoned || !CheckCanPoison(c)) spell = new WeakenSpell(m_Mobile, null); if (!c.Poisoned && (CheckCanPoison(c))) spell = new PoisonSpell(m_Mobile, null); ++Combo; // Move to next spell } else if (Combo == 4) { // m_Mobile.Say( "combo phase 4 ebolt" ); if (!c.Poisoned && (CheckCanPoison(c))) { spell = new PoisonSpell(m_Mobile, null); Combo = 4; } else spell = new EnergyBoltSpell(m_Mobile, null); ++Combo; // Move to next spell } else if (Combo == 5) { //m_Mobile.Say( "combo phase 5" ); if (c.Poisoned) { if (c.Hits < 20 && m_Mobile.Mana >= 20) spell = new EnergyBoltSpell(m_Mobile, null); else spell = new HarmSpell(m_Mobile, null); Combo = 5; // Move to next spell } if (!c.Poisoned) { if (m_Mobile.Mana > 20) spell = new EnergyBoltSpell(m_Mobile, null); if (m_Mobile.Mana < 19) spell = new LightningSpell(m_Mobile, null); Combo = -1; // Reset combo state } } return spell; }
public override bool DoActionCombat() { m_Mobile.DebugSay("doing DoActionCombat"); Mobile c = m_Mobile.Combatant; m_Mobile.Warmode = true; // check to see if our attack priority has changed Mobile newTarget = null; if (PriorityTarget(c, out newTarget) == true) { m_Mobile.DebugSay("Higher priority target found switching targets"); m_Mobile.Combatant = c = newTarget; m_Mobile.FocusMob = null; } if (m_Mobile.CanReveal) { if (c == null) { // If we can Recall() a player via FindHiddenTarget, make them our new Combatant. // Keep in mind, CombatTimer.OnTick() will set the Combatant to null if it sees that the mobile is hidden, // for this reason, we make this check in DoActionGuard and again in DoActionCombat if the Combatant is null. Mobile mx = FindHiddenTarget(); if (mx != null) { m_Mobile.DebugSay("C: Ah, I remembered {0}!", mx.Name); c = m_Mobile.Combatant = mx; } } // if we can reveal and our target just hid and we Recall them, lets try to reveal if (c != null && c.Hidden && (Recall(c) || m_Mobile.ConstantFocus == c) && c.Alive && !c.IsDeadBondedPet && m_Mobile.CanBeHarmful(c, false) && !m_Mobile.Controlled) { // we will keep retrying the reveal if (DoProcessReveal(c)) return true; } } if (c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map) { // Our combatant is deleted, dead, hidden, or we cannot hurt them // Try to find another combatant if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { if (m_Mobile.Debug) m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name); m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else { m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard."); Action = ActionType.Guard; return true; } if (!m_Mobile.InRange(c, m_Mobile.RangePerception)) { // They are somewhat far away, can we find something else? if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else if (!m_Mobile.InRange(c, m_Mobile.RangePerception * 3)) { m_Mobile.Combatant = null; } c = m_Mobile.Combatant; if (c == null) { m_Mobile.DebugSay("My combatant has fled, so I am on guard"); Action = ActionType.Guard; return true; } } } if (!m_Mobile.InLOS(c)) { if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } } if (c != null) { int strMod = GetStatMod(c, StatType.Str); Mobile toDispel = null; //dont worry about creatures/pets useing these spells, only players. if (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell)) { EnemyCountersPara = true; } if (UsesPotions && RefreshPotCount >= 1 && m_Mobile.Stam < 20) { DrinkRefresh(m_Mobile); } if (m_Mobile.Paralyzed) { UseTrapPouch(m_Mobile); } TrapPouch(m_Mobile); if ((c.Paralyzed || c.Frozen) && PreferMagic() == true) { if (m_Mobile.InRange(c, 3)) RunAround(c); } if (PreferMagic() == true) if (SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0) EventSink.InvokeStunRequest(new StunRequestEventArgs(m_Mobile)); if (UsesBandages && (IsDamaged || IsPoisoned) && m_Mobile.Skills.Healing.Base > 20.0) { TimeSpan ts = TimeUntilBandage; if (ts == TimeSpan.MaxValue) StartBandage(m_Mobile, m_Mobile); } if (IsPoisoned && UsesPotions && CurePotCount >= 1) if (m_Mobile.Poison.Level >= 3 || Combo != -1 || m_Mobile.Mana < 30) DrinkCure(m_Mobile); if (IsDamaged && UsesPotions && HealPotCount >= 1) if (Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3) if (m_Mobile.Hits < (m_Mobile.HitsMax * .25) || m_Mobile.Mana < (m_Mobile.ManaMax * .25)) DrinkHeal(m_Mobile); if (m_Mobile.Skills[SkillName.Magery].Value >= 50.0 && m_Mobile.Spell == null && DateTime.Now >= m_Mobile.NextSpellTime) { m_Mobile.DebugSay("Doing spell selection"); // We are ready to cast a spell Spell spell = null; toDispel = FindDispelTarget(true); //woot weaken block up to lightening! ISpell i = c.Spell; if (i != null && i.IsCasting) { Spell s = (Spell)i; if (m_Mobile.Hits <= 40 && (s.MaxDamage >= 12 || (s is PoisonSpell && !IsPoisoned && CurePotCount == 0))) { m_Mobile.DebugSay("Damage is {0}", s.MaxDamage); spell = new WeakenSpell(m_Mobile, null); } } // Top cast priority is cure - may override the previous assignment else if (IsPoisoned) { spell = new CureSpell(m_Mobile, null); int level = (m_Mobile.Poison.Level + 1); if (level > 0 && (((m_Mobile.Skills[SkillName.Magery].Value / level) - 20) * 7.5) > 50) { spell = new CureSpell(m_Mobile, null); } else { spell = new ArchCureSpell(m_Mobile, null); } } //were hurt they have atleast half life and were to low on mana to finish them start healing else if (m_Mobile.Hits < 70 && c.Hits > 50 && m_Mobile.Mana < 30) { spell = new HealSpell(m_Mobile, null); } // Something dispellable is attacking us else if (toDispel != null) { if (Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3) { if (UsesPotions && HealPotCount >= 1 && m_Mobile.Hits < (m_Mobile.HitsMax - 20)) DrinkHeal(m_Mobile); else if (m_Mobile.Hits < (m_Mobile.HitsMax - 20)) spell = new HealSpell(m_Mobile, null); } spell = DoDispel(toDispel); } // a friend needs healed else if (CrossHeals && FindHealTarget(true) != null) { spell = new GreaterHealSpell(m_Mobile, null); } //target has reflect up hit is with ManaDrain till down else if (c.MagicDamageAbsorb > 5) { spell = new ManaDrainSpell(m_Mobile, null); } // We are doing a spell combo else if (Combo != -1) { spell = DoCombo(c); } //keep them weakened. else if (m_Mobile.Mana >= 40 && strMod >= 0 && !c.Paralyzed) { spell = new WeakenSpell(m_Mobile, null); } else { spell = ChooseSpell(c); } if (spell != null && m_Mobile.InRange(c, 12)) spell.Cast(); } if (SmartAI && toDispel != null) { if (m_Mobile.InRange(toDispel, 8) && !toDispel.Paralyzed) RunFrom(toDispel); } else if (HoldingWeapon() == true && PreferMagic() == false) { m_Mobile.DebugSay("I will prefer my weapon over magic"); RunTo(c, CanRun); } else { if (c is BaseCreature && ((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned && !c.Paralyzed && m_Mobile.InRange(c, 6)) { RunFrom(c); } if (c is BaseCreature && (((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned) && !m_Mobile.InRange(c, 10)) { RunTo(c, CanRun); } if (RegainingMana == false) { if (c is PlayerMobile || (c is BaseCreature && !((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned)) { RunTo(c, CanRun); } } else { if (c is PlayerMobile || (c is BaseCreature && !((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned)) { if (m_Mobile.InRange(c, 4)) RunAround(c); if (!m_Mobile.InRange(c, 6)) RunTo(c, CanRun); } m_Mobile.UseSkill(SkillName.Meditation); } } return true; } return true; }