void Awake() { meleeSpell = new MeleeSpell(meleeDamage, meleeRange, meleeCooldown); blinkSpell = new BlinkSpell(blinkRange, blinkCooldown); fireballSpell = new FireballSpell(fireballDamage, fireballMoveSpeed, fireballTravelDistance, fireballCooldown, FireballPrefab); meteorSpell = new MeteorSpell(meteorInitialFallingHeight, meteorCastRange, meteorAreaOfDamage, meteorDamage, meteorCooldown, MeteorPrefab); }
/// <inheritdoc /> protected override void PlaceEffect(MobileEntity source, Point2D location) { var spell = new FireballSpell() { Item = this, Intensity = 2, SkillLevel = 12, Cost = 0, }; spell.Warm(source); spell.CastAt(location); }
public override void Ability(Vector2 playerPosition, Vector2 playerFacingDirection, Animator playerAnimator = null, Rigidbody2D playerRigidbody = null) { float facingRotation = Mathf.Atan2(playerFacingDirection.y, playerFacingDirection.x) * Mathf.Rad2Deg; float startRotation = facingRotation + projectileSpread / 2f; float angleIncrease = projectileSpread / ((float)numberOfProjectiles - 1f); for (int i = 0; i < numberOfProjectiles; i++) { float tempRot = startRotation - angleIncrease * i; GameObject newProjectile = Instantiate(thisProjectile, playerPosition, Quaternion.Euler(0f, 0f, tempRot)); FireballSpell temp = newProjectile.GetComponent <FireballSpell>(); if (temp) { temp.Setup(new Vector2(Mathf.Cos(tempRot * Mathf.Deg2Rad), Mathf.Sin(tempRot * Mathf.Deg2Rad))); } } }
public virtual Spell GetRandomDamageSpell(Mobile c) { int maxCircle = (int)((m_Mobile.Skills[SkillName.Magery].Value + 20.0) / (100.0 / 7.0)); if (maxCircle < 1) { maxCircle = 1; } Spell spell = null; switch (Utility.Random(maxCircle * 2)) { case 0: case 1: spell = new MagicArrowSpell(m_Mobile, null); break; case 2: case 3: spell = new HarmSpell(m_Mobile, null); break; case 4: case 5: spell = new FireballSpell(m_Mobile, null); break; case 6: case 7: spell = new LightningSpell(m_Mobile, null); break; case 8: case 9: spell = new MindBlastSpell(m_Mobile, null); break; case 10: spell = new EnergyBoltSpell(m_Mobile, null); break; case 11: spell = new ExplosionSpell(m_Mobile, null); break; default: spell = new FlameStrikeSpell(m_Mobile, null); break; } return(spell); }
public virtual Spell ChooseSpell(Mobile c) { Spell spell = null; if (!SmartAI) { spell = CheckCastHealingSpell(); if (spell != null) { return(spell); } switch (Utility.Random(16)) { case 0: { spell = new FireballSpell(m_Mobile, null); break; } case 1: { m_Mobile.DebugSay("Protecting myself"); spell = new ProtectionSpell(m_Mobile, null); break; } case 2: // Poison them { m_Mobile.DebugSay("Attempting to poison"); if (!c.Poisoned) { spell = new PoisonSpell(m_Mobile, null); } break; } case 3: // Bless ourselves. { m_Mobile.DebugSay("Blessing myself"); spell = new BlessSpell(m_Mobile, null); break; } case 4: { m_Mobile.DebugSay("Summoning FIRE FIELD!!!"); spell = new FireFieldSpell(m_Mobile, null); break; } case 5: case 6: // Curse them. { m_Mobile.DebugSay("Attempting to curse"); spell = GetRandomCurseSpell(); break; } case 7: // Paralyze them. { m_Mobile.DebugSay("Attempting to paralyze"); if (m_Mobile.Skills[SkillName.Magery].Value > 50.0) { spell = new ParalyzeSpell(m_Mobile, null); } break; } case 8: // Drain mana { m_Mobile.DebugSay("Attempting to drain mana"); spell = GetRandomManaDrainSpell(); break; } default: // Damage them. { m_Mobile.DebugSay("Just doing damage"); spell = GetRandomDamageSpell(); break; } } return(spell); } spell = CheckCastHealingSpell(); if (spell != null) { return(spell); } if (!c.Poisoned && c.Spell != null && c.Mana > (c.ManaMax / 2)) { return(GetRandomManaDrainSpell()); } if (m_Mobile.Hits < (m_Mobile.HitsMax / 2) && 0.30 > Utility.RandomDouble()) { spell = new ProtectionSpell(m_Mobile, null); if (spell == null) { spell = new BlessSpell(m_Mobile, null); } if (spell != null) { return(spell); } } if (c.Hits < (c.HitsMax * 0.30)) //They're dying, set up a kill combo { m_Combo = 0; if (!c.Poisoned) { spell = new PoisonSpell(m_Mobile, null); } else { spell = new ParalyzeSpell(m_Mobile, null); } } switch (Utility.Random(10)) { default: case 0: // Deal some damage { spell = GetRandomDamageSpell(); break; } case 1: // Poison them { if (!c.Poisoned) { spell = new PoisonSpell(m_Mobile, null); } break; } case 2: // Set up a combo { if (m_Mobile.Mana < 40 && m_Mobile.Mana > 15) { if (c.Paralyzed && !c.Poisoned) { m_Mobile.DebugSay("I am going to meditate"); m_Mobile.UseSkill(SkillName.Meditation); } else if (!c.Poisoned) { spell = new ParalyzeSpell(m_Mobile, null); } } else if (m_Mobile.Mana > 60) { if (Utility.Random(2) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned) { m_Combo = 0; spell = new ParalyzeSpell(m_Mobile, null); } else { m_Combo = 1; spell = new ExplosionSpell(m_Mobile, null); } } break; } case 3: { spell = GetRandomCurseSpell(); break; } } return(spell); }
public virtual Spell DoCombo(Mobile c) { Spell spell = null; if (m_ComboType == ComboType.None) { m_ComboType = (ComboType)Utility.RandomMinMax(1, 7); } if (m_Combo == 1) { switch (m_ComboType) { case ComboType.Exp_FS_Poison: case ComboType.Exp_MB_Poison: case ComboType.Exp_EB_Poison: case ComboType.Exp_FB_MA_Poison: case ComboType.Exp_FB_Poison_Light: case ComboType.Exp_FB_MA_Light: case ComboType.Exp_Poison_FB_Light: spell = new ExplosionSpell(m_Mobile, null); break; } } else if (m_Combo == 2) { switch (m_ComboType) { case ComboType.Exp_FS_Poison: spell = new FlameStrikeSpell(m_Mobile, null); break; case ComboType.Exp_MB_Poison: spell = new MindBlastSpell(m_Mobile, null); break; case ComboType.Exp_EB_Poison: spell = new EnergyBoltSpell(m_Mobile, null); break; case ComboType.Exp_FB_MA_Poison: spell = new FireballSpell(m_Mobile, null); break; case ComboType.Exp_FB_Poison_Light: spell = new FireballSpell(m_Mobile, null); break; case ComboType.Exp_FB_MA_Light: spell = new FireballSpell(m_Mobile, null); break; case ComboType.Exp_Poison_FB_Light: spell = new PoisonSpell(m_Mobile, null); break; } } else if (m_Combo == 3) { switch (m_ComboType) { case ComboType.Exp_FS_Poison: case ComboType.Exp_MB_Poison: case ComboType.Exp_EB_Poison: spell = new PoisonSpell(m_Mobile, null); EndCombo(); return(spell); case ComboType.Exp_FB_MA_Poison: spell = new MagicArrowSpell(m_Mobile, null); break; case ComboType.Exp_FB_Poison_Light: spell = new PoisonSpell(m_Mobile, null); break; case ComboType.Exp_FB_MA_Light: spell = new MagicArrowSpell(m_Mobile, null); break; case ComboType.Exp_Poison_FB_Light: spell = new FireballSpell(m_Mobile, null); break; } } else if (m_Combo == 4) { switch (m_ComboType) { case ComboType.Exp_FS_Poison: case ComboType.Exp_MB_Poison: case ComboType.Exp_EB_Poison: spell = new LightningSpell(m_Mobile, null); EndCombo(); return(spell); case ComboType.Exp_FB_MA_Poison: spell = new PoisonSpell(m_Mobile, null); break; case ComboType.Exp_FB_Poison_Light: case ComboType.Exp_FB_MA_Light: case ComboType.Exp_Poison_FB_Light: spell = new LightningSpell(m_Mobile, null); EndCombo(); return(spell); } } else if (m_Combo == 5) { switch (m_ComboType) { case ComboType.Exp_FS_Poison: case ComboType.Exp_MB_Poison: case ComboType.Exp_EB_Poison: case ComboType.Exp_FB_MA_Poison: case ComboType.Exp_FB_Poison_Light: case ComboType.Exp_FB_MA_Light: case ComboType.Exp_Poison_FB_Light: spell = new LightningSpell(m_Mobile, null); EndCombo(); return(spell); } } m_Combo++; // Move to next spell if (spell == null) { spell = new PoisonSpell(m_Mobile, null); } return(spell); }
public override Spell DoCombo(Mobile c) { Spell spell = null; if (m_NecroComboType == NecroComboType.None) { m_NecroComboType = (NecroComboType)Utility.RandomMinMax(1, 7); m_Combo = 0; m_Mobile.DebugSay("Doing {0} Combo", m_NecroComboType); } if (m_Combo == 0) { switch (m_NecroComboType) { case NecroComboType.Exp_FS_Omen_Poison_PS: case NecroComboType.Exp_MB_Omen_Poison_PS: case NecroComboType.Exp_EB_Omen_Poison_PS: case NecroComboType.Exp_FB_MA_Poison_PS: case NecroComboType.Exp_FB_Poison_PS: case NecroComboType.Exp_FB_MA_PS: case NecroComboType.Exp_Poison_FB_PS: spell = new ExplosionSpell(m_Mobile, null); break; } ++m_Combo; } else if (m_Combo == 1) { switch (m_NecroComboType) { case NecroComboType.Exp_FS_Omen_Poison_PS: spell = new FlameStrikeSpell(m_Mobile, null); break; case NecroComboType.Exp_MB_Omen_Poison_PS: spell = new MindBlastSpell(m_Mobile, null); break; case NecroComboType.Exp_EB_Omen_Poison_PS: spell = new EnergyBoltSpell(m_Mobile, null); break; case NecroComboType.Exp_FB_MA_Poison_PS: case NecroComboType.Exp_FB_Poison_PS: case NecroComboType.Exp_FB_MA_PS: spell = new FireballSpell(m_Mobile, null); break; case NecroComboType.Exp_Poison_FB_PS: spell = new PoisonSpell(m_Mobile, null); break; } ++m_Combo; } else if (m_Combo == 2) { switch (m_NecroComboType) { case NecroComboType.Exp_FS_Omen_Poison_PS: case NecroComboType.Exp_MB_Omen_Poison_PS: case NecroComboType.Exp_EB_Omen_Poison_PS: spell = new EvilOmenSpell(m_Mobile, null); break; case NecroComboType.Exp_FB_MA_Poison_PS: spell = new MagicArrowSpell(m_Mobile, null); break; case NecroComboType.Exp_FB_Poison_PS: spell = new PoisonSpell(m_Mobile, null); break; case NecroComboType.Exp_FB_MA_PS: spell = new MagicArrowSpell(m_Mobile, null); break; case NecroComboType.Exp_Poison_FB_PS: spell = new FireballSpell(m_Mobile, null); break; } ++m_Combo; } else if (m_Combo == 3) { switch (m_NecroComboType) { case NecroComboType.Exp_FS_Omen_Poison_PS: case NecroComboType.Exp_MB_Omen_Poison_PS: case NecroComboType.Exp_EB_Omen_Poison_PS: case NecroComboType.Exp_FB_MA_Poison_PS: case NecroComboType.Exp_FB_Poison_PS: spell = new PoisonSpell(m_Mobile, null); break; case NecroComboType.Exp_FB_MA_PS: case NecroComboType.Exp_Poison_FB_PS: if (Utility.RandomBool()) { spell = new PoisonStrikeSpell(m_Mobile, null); } else { spell = new PainSpikeSpell(m_Mobile, null); } EndCombo(); return(spell); } ++m_Combo; } else if (m_Combo == 4) { switch (m_NecroComboType) { case NecroComboType.Exp_FS_Omen_Poison_PS: case NecroComboType.Exp_MB_Omen_Poison_PS: case NecroComboType.Exp_EB_Omen_Poison_PS: case NecroComboType.Exp_FB_MA_Poison_PS: case NecroComboType.Exp_FB_Poison_PS: case NecroComboType.Exp_FB_MA_PS: case NecroComboType.Exp_Poison_FB_PS: if (Utility.RandomBool()) { spell = new PoisonStrikeSpell(m_Mobile, null); } else { spell = new PainSpikeSpell(m_Mobile, null); } EndCombo(); return(spell); } } return(spell); }
public override bool DoActionCombat() { m_Mobile.DebugSay("doing HumanMageAI combat action"); Mobile c = m_Mobile.Combatant; m_Mobile.Warmode = 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.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 is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell)) { m_EnemyCountersPara = true; } if (c.Paralyzed || c.Frozen) { if (m_Mobile.InRange(c, 1)) { RunFrom(c); } } if (m_Mobile.Paralyzed) { UseTrapPouch(m_Mobile); } TrapPouch(m_Mobile); 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 (!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.Hits < m_Mobile.HitsMax * 20 / 100) { // We are low on health, should we flee? bool flee = false; if (m_Mobile.Hits < c.Hits) { // We are more hurt than them int diff = c.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}", c.Name); } Action = ActionType.Flee; return(true); } } if (m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange(c, 12)) { // We are ready to cast a spell Spell spell = null; Mobile toDispel = FindDispelTarget(true); //try an cure with a pot first if the poison is serious or where in the middle of dumping if (UsesPotions && (m_Mobile.Poisoned && m_Mobile.Poison.Level >= 3) || m_Mobile.Poisoned && Combo != -1) { DrinkCure(m_Mobile); } if (m_Mobile.Poisoned) // Top cast priority is cure { spell = new CureSpell(m_Mobile, null); try { if ((((m_Mobile.Skills[SkillName.Magery].Value / (m_Mobile.Poison.Level + 1)) - 20) * 7.5) > 50) { spell = new CureSpell(m_Mobile, null); } else { spell = new ArchCureSpell(m_Mobile, null); } } catch { spell = new CureSpell(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); } else if (toDispel != null) // Something dispellable is attacking us { spell = DoDispel(toDispel); } //take down reflect on are enemy if its up else if (c.MagicDamageAbsorb > 5) { m_Mobile.DebugSay("Takeing Down Reflect"); spell = new FireballSpell(m_Mobile, null); } else if (Combo != -1) // We are doing a spell combo { spell = DoCombo(c); } else { spell = ChooseSpell(c); } if (SmartAI && toDispel != null) { if (m_Mobile.InRange(toDispel, 10)) { RunFrom(toDispel); } else if (!m_Mobile.InRange(toDispel, 12)) { RunTo(toDispel, CanRun); } } else { if (m_RegainingMana == false) { RunTo(c, CanRun); } } if (spell != null && spell.Cast()) { TimeSpan delay; //spell cast time is equal to the delay for the spells. delay = spell.GetCastDelay() + spell.GetCastRecovery(); m_NextCastTime = DateTime.Now + delay; } } else if ((m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting) && m_RegainingMana == false) { RunTo(c, CanRun); } return(true); }