public static void AddContext( Mobile m, TransformContext context ) { m_Table[m] = context; if ( context.Type == typeof( HorrificBeastSpell ) ) m.Delta( MobileDelta.WeaponDamage ); }
public static void RemoveContext(Mobile m, TransformContext context, bool resetGraphics) { m_Table.Remove(m); List <ResistanceMod> mods = context.Mods; for (int i = 0; i < mods.Count; ++i) { m.RemoveResistanceMod(mods[i]); } if (resetGraphics) { m.HueMod = -1; m.BodyMod = 0; } context.Timer.Stop(); if (context.Type == typeof(HorrificBeastSpell)) { m.Delta(MobileDelta.WeaponDamage); } }
public static void RemoveContext( Mobile m, TransformContext context, bool resetGraphics ) { m_Table.Remove( m ); List<ResistanceMod> mods = context.Mods; for ( int i = 0; i < mods.Count; ++i ) m.RemoveResistanceMod( mods[i] ); if ( resetGraphics ) { m.HueMod = -1; m.BodyMod = 0; } context.Timer.Stop(); if ( context.Type == typeof( HorrificBeastSpell ) ) m.Delta( MobileDelta.WeaponDamage ); }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); //SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent after AoS /* Temporarily chokes off the air suply of the target with poisonous fumes. * The target is inflicted with poison damage over time. * The amount of damage dealt each "hit" is based off of the caster's Spirit Speak skill and the Target's current Stamina. * The less Stamina the target has, the more damage is done by Strangle. * Duration of the effect is Spirit Speak skill level / 10 rounds, with a minimum number of 4 rounds. * The first round of damage is dealt after 5 seconds, and every next round after that comes 1 second sooner than the one before, until there is only 1 second between rounds. * The base damage of the effect lies between (Spirit Speak skill level / 10) - 2 and (Spirit Speak skill level / 10) + 1. * Base damage is multiplied by the following formula: (3 - (target's current Stamina / target's maximum Stamina) * 2). * Example: * For a target at full Stamina the damage multiplier is 1, * for a target at 50% Stamina the damage multiplier is 2 and * for a target at 20% Stamina the damage multiplier is 2.6 */ if (m.Spell != null) { m.Spell.OnCasterHurt(); } m.PlaySound(0x22F); m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head); m.FixedParticles(0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255); if (!m_Table.Contains(m)) { Timer t = new InternalTimer(m, Caster); t.Start(); m_Table[m] = t; } HarmfulSpell(m); } //Calculations for the buff bar double spiritlevel = Caster.Skills[SkillName.SpiritSpeak].Value / 10; if (spiritlevel < 4) { spiritlevel = 4; } int d_MinDamage = 4; int d_MaxDamage = ((int)spiritlevel + 1) * 3; int damageBonus = 0; double inscribeSkill = GetInscribeSkill(Caster); int inscribeBonus = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10; int intBonus = Caster.Int / 10; int ArcaneEmpowermentBonus = 0; int sdiBonus = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage); TransformContext context = TransformationSpellHelper.GetContext(Caster); if (context != null && context.Spell is ReaperFormSpell) { damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus; } damageBonus += inscribeBonus + intBonus + ArcaneEmpowermentBonus; if (Core.SE && m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10) { sdiBonus = 15 + ((int)inscribeSkill) / 10; } d_MinDamage *= (100 + sdiBonus + damageBonus); d_MinDamage /= 100; d_MaxDamage *= (100 + sdiBonus + damageBonus); d_MaxDamage /= 100; string args = String.Format("{0}\t{1}", d_MinDamage, d_MaxDamage); int i_Count = (int)spiritlevel; int i_MaxCount = i_Count; int i_HitDelay = 5; int i_Length = i_HitDelay; while (i_Count > 1) { --i_Count; if (i_HitDelay > 1) { if (i_MaxCount < 5) { --i_HitDelay; } else { int delay = (int)(Math.Ceiling((1.0 + (5 * i_Count)) / i_MaxCount)); if (delay <= 5) { i_HitDelay = delay; } else { i_HitDelay = 5; } } } i_Length += i_HitDelay; } TimeSpan t_Duration = TimeSpan.FromSeconds(i_Length); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, t_Duration, m, args.ToString())); FinishSequence(); }
public override void OnCast() { Mobile caster = this.Caster; if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (!caster.CanBeginAction(typeof(PolymorphSpell))) { Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } else if (Spells.Ninjitsu.AnimalForm.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. } else if (!caster.CanBeginAction(typeof(IncognitoSpell)) || (caster.IsBodyMod && GetContext(caster) == null)) { DoFizzle(); } else if (CheckSequence()) { TransformContext context = GetContext(caster); Type ourType = this.GetType(); bool wasTransformed = (context != null); bool ourTransform = (wasTransformed && context.Type == ourType); if (wasTransformed) { RemoveContext(caster, context, true); if (ourTransform) { caster.PlaySound(0xFA); caster.FixedParticles(0x3728, 1, 13, 5042, EffectLayer.Waist); } } if (!ourTransform) { ArrayList mods = new ArrayList(); if (PhysResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Physical, PhysResistOffset)); } if (FireResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Fire, FireResistOffset)); } if (ColdResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Cold, ColdResistOffset)); } if (PoisResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Poison, PoisResistOffset)); } if (NrgyResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Energy, NrgyResistOffset)); } if (!((Body)this.Body).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } caster.BodyMod = this.Body; caster.HueMod = this.Hue; for (int i = 0; i < mods.Count; ++i) { caster.AddResistanceMod((ResistanceMod)mods[i]); } PlayEffect(caster); Timer timer = new TransformTimer(caster, this); timer.Start(); AddContext(caster, new TransformContext(timer, mods, ourType)); } } FinishSequence(); }
public static bool UnderTransformation(Mobile m, Type type) { TransformContext context = GetContext(m); return(context != null && context.Type == type); }
public override void OnCast() { Mobile caster = this.Caster; /*if ( caster.Mounted ) * { * } * else */ if (Factions.Sigil.ExistsOn(Caster)) { } else if (!caster.CanBeginAction(typeof(PolymorphSpell))) { } else if (!caster.CanBeginAction(typeof(IncognitoSpell)) || !caster.CanBeginAction(typeof(PolymorphSpell)) || (caster.IsBodyMod && GetContext(caster) == null)) { DoFizzle(); } else if (CheckSequence()) { TransformContext context = GetContext(caster); Type ourType = this.GetType(); bool wasTransformed = (context != null); bool ourTransform = (wasTransformed && context.Type == ourType); if (wasTransformed) { RemoveContext(caster, context, ourTransform); if (ourTransform) { caster.PlaySound(0xFA); caster.FixedParticles(0x3728, 1, 13, 5042, EffectLayer.Waist); } } if (!ourTransform) { ArrayList mods = new ArrayList(); if (PhysResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Physical, PhysResistOffset)); } if (FireResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Fire, FireResistOffset)); } if (ColdResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Cold, ColdResistOffset)); } if (PoisResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Poison, PoisResistOffset)); } if (NrgyResistOffset != 0) { mods.Add(new ResistanceMod(ResistanceType.Energy, NrgyResistOffset)); } if (!((Body)this.Body).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } caster.BodyMod = this.Body; caster.HueMod = this.Hue; for (int i = 0; i < mods.Count; ++i) { caster.AddResistanceMod((ResistanceMod)mods[i]); } PlayEffect(caster); Timer timer = new TransformTimer(caster, this); timer.Start(); AddContext(caster, new TransformContext(timer, mods, ourType)); } } FinishSequence(); }
public override void OnCast() { if (CheckSequence()) { /* Creates a withering frost around the Caster, * which deals Cold Damage to all valid targets in a radius of 5 tiles. */ Map map = Caster.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); BaseCreature cbc = Caster as BaseCreature; bool isMonster = (cbc != null && !cbc.Controlled && !cbc.Summoned); int damageBonus = 0; double inscribeSkill = GetInscribeSkill(Caster); int inscribeBonus = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10; int intBonus = Caster.Int / 10; int ArcaneEmpowermentBonus = 0; int sdiBonus = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage); TransformContext context = TransformationSpellHelper.GetContext(Caster); if (context != null && context.Spell is ReaperFormSpell) { damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus; } damageBonus += inscribeBonus + intBonus + ArcaneEmpowermentBonus; foreach (Mobile m in Caster.GetMobilesInRange(Core.ML ? 4 : 5)) { if (Caster != m && Caster.InLOS(m) && (SpellHelper.ValidIndirectTarget(Caster, m)) && Caster.CanBeHarmful(m, false)) { if (isMonster) { if (m is BaseCreature) { BaseCreature bc = (BaseCreature)m; if (!bc.Controlled && !bc.Summoned && bc.Team == cbc.Team) { continue; } } else if (!m.Player) { continue; } } targets.Add(m); } } Effects.PlaySound(Caster.Location, map, 0x1FB); Effects.PlaySound(Caster.Location, map, 0x10B); Effects.SendLocationParticles(EffectItem.Create(Caster.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0); for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; Caster.DoHarmful(m); m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255); double damage = Utility.RandomMinMax(30, 35); damage *= (300 + (m.Karma / 100) + (GetDamageSkill(Caster) * 10)); damage /= 1000; // PvP spell damage increase cap of 15% from an item’s magic property in Publish 33(SE) if (Core.SE && m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10) { sdiBonus = 15 + ((int)inscribeSkill) / 10; } damage *= (100 + sdiBonus + damageBonus); damage /= 100; // TODO: cap? //if ( damage > 40 ) // damage = 40; SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0); } } } FinishSequence(); }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); //SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent asfter AoS /* Temporarily causes intense physical pain to the target, dealing direct damage. * After 10 seconds the spell wears off, and if the target is still alive, * some of the Hit Points lost through Pain Spike are restored. */ m.FixedParticles(0x37C4, 1, 8, 9916, 39, 3, EffectLayer.Head); m.FixedParticles(0x37C4, 1, 8, 9502, 39, 4, EffectLayer.Head); m.PlaySound(0x210); double damage = ((GetDamageSkill(Caster) - GetResistSkill(m)) / 10) + (m.Player ? 18 : 30); double sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; double inscribeSkill = GetInscribeSkill(Caster); int ArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, m.Player && Caster.Player); sdiBonus += ArcaneEmpowermentBonus; // PvP spell damage increase cap of 15% from an item’s magic property if (m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10) { sdiBonus = 15 + ((int)inscribeSkill) / 10; } if (Scroll != null)//doesn't appear to work { sdiBonus += (int)inscribeSkill / 10; } TransformContext context = TransformationSpellHelper.GetContext(Caster); if (context != null && context.Spell is ReaperFormSpell) { sdiBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus; } damage = AOS.Scale((int)damage, (int)(100 + sdiBonus)); m.CheckSkill(SkillName.MagicResist, 0.0, 120.0); //Skill check for gain if (damage < 1) { damage = 1; } TimeSpan buffTime = TimeSpan.FromSeconds(10.0); if (m_Table.Contains(m)) { damage = Utility.RandomMinMax(3, 7); Timer t = m_Table[m] as Timer; if (t != null) { t.Delay += TimeSpan.FromSeconds(2.0); buffTime = t.Next - DateTime.UtcNow; } } else { new InternalTimer(m, damage).Start(); } BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString((int)damage))); Misc.WeightOverloading.DFA = Misc.DFAlgorithm.PainSpike; m.Damage((int)damage, Caster); SpellHelper.DoLeech((int)damage, Caster, m); Misc.WeightOverloading.DFA = Misc.DFAlgorithm.Standard; //SpellHelper.Damage( this, m, damage, 100, 0, 0, 0, 0, Misc.DFAlgorithm.PainSpike ); HarmfulSpell(m); } FinishSequence(); }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ //CheckResisted( m ); // Check magic resist for skill, but do not use return value //reports from OSI: Necro spells don't give Resist gain Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0); Effects.PlaySound(m.Location, m.Map, 0x229); double damage = Utility.RandomMinMax((Core.ML ? 32 : 36), 40) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000); double sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; double inscribeSkill = GetInscribeSkill(Caster);//0-100 double inscribeBonus = (inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 1000; double intBonus = Caster.Int / 1000; double ArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, m.Player && Caster.Player) / 100; TransformContext context = TransformationSpellHelper.GetContext(Caster); double pvmDamage = damage * (1 + sdiBonus + inscribeBonus + intBonus + ArcaneEmpowermentBonus); if (Core.ML && sdiBonus > 0.15 + inscribeSkill / 1000) { sdiBonus = 0.15 + inscribeSkill / 1000; } if (context != null && context.Spell is ReaperFormSpell) { sdiBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus; } double pvpDamage = damage * (1 + sdiBonus + inscribeBonus + intBonus + ArcaneEmpowermentBonus); Map map = m.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); if (Caster.CanBeHarmful(m, false)) { targets.Add(m); } if (Caster.Skills.Poisoning.Value / 200.0 >= Utility.RandomDouble()) { m.ApplyPoison(Caster, Poison.Lesser); } foreach (Mobile targ in m.GetMobilesInRange(2)) { if ((targ != Caster && m != targ) && (SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false))) { targets.Add(targ); } } for (int i = 0; i < targets.Count; ++i) { Mobile targ = targets[i]; int num; if (targ.InRange(m.Location, 0)) { num = 1; } else if (targ.InRange(m.Location, 1)) { num = 2; } else { num = 3; } Caster.DoHarmful(targ); SpellHelper.Damage(this, targ, ((m.Player && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0); } } } FinishSequence(); }