public virtual double GetSlayerDamageBonus(Mobile defender) { double slayerBonus = 0; PlayerMobile pm = m_Caster as PlayerMobile; if (pm == null) { return(slayerBonus); } Spellbook atkBook; BaseCreature bc_Defender = defender as BaseCreature; //Player Has a Bound Enhanced Spellbook if (pm.FindItemOnLayer(Layer.OneHanded) is EnhancedSpellbook) { EnhancedSpellbook enhancedSpellbook = pm.FindItemOnLayer(Layer.OneHanded) as EnhancedSpellbook; //Enhanced Spellbook is Currently Equipped on Player and is Slayer Type if (enhancedSpellbook.EnhancedType == EnhancedSpellbookType.Slayer && bc_Defender != null) { if (enhancedSpellbook.SlayerGroup == bc_Defender.SlayerGroup) { defender.FixedEffect(0x37B9, 10, 5); Boolean isTamedTarget = SpellHelper.IsTamedTarget(m_Caster, defender); if (isTamedTarget) { slayerBonus = SpellHelper.SlayerTamedBonus; } else { slayerBonus = SpellHelper.SlayerBonus; } enhancedSpellbook.OnSpellCast(m_Caster); } } else { return(slayerBonus); } } else { return(slayerBonus); } return(slayerBonus); }
public static void ApplyEffect(Mobile Caster, Mobile target) { if (target.Spell != null) { target.Spell.OnCasterHurt(); } double magerySkill = Caster.Skills[SkillName.Magery].Value; double poisoningSkill = Caster.Skills[SkillName.Poisoning].Value; if (poisoningSkill > magerySkill) { if (!(poisoningSkill > 100 && magerySkill == 100)) { poisoningSkill = magerySkill; } } if (poisoningSkill > 100 && Caster is PlayerMobile && target is PlayerMobile) { poisoningSkill = 100; } int poisonLevel = 0; if (Caster is PlayerMobile) { poisonLevel = 1; } double greaterPoisonChance = (poisoningSkill / 100) * .5; double deadlyPoisonChance = (poisoningSkill / 100) * .2; double creaturePoisonUpgradeChanceScalar = 1.0; double playerPoisonUpgradeChanceScalar = 1.0; double greaterPoisonSkillMinimum = 50; double deadlyPoisonSkillMinimum = 75; double enhancedChanceScalar = 1.5; bool enhanceChargeUsed = false; //Against Players if (target is PlayerMobile) { if (poisoningSkill >= greaterPoisonSkillMinimum) { if (Utility.RandomDouble() <= greaterPoisonChance * playerPoisonUpgradeChanceScalar) { poisonLevel = 2; } } if (poisoningSkill >= deadlyPoisonSkillMinimum) { if (Utility.RandomDouble() <= deadlyPoisonChance * playerPoisonUpgradeChanceScalar) { poisonLevel = 3; } } } //Against Creatures if (target is BaseCreature) { bool enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, null, EnhancedSpellbookType.Warlock, true, false); if (enhancedSpellcast) { enhanceChargeUsed = true; greaterPoisonChance *= enhancedChanceScalar; deadlyPoisonChance *= enhancedChanceScalar; } if (poisoningSkill >= greaterPoisonSkillMinimum) { if (Utility.RandomDouble() <= greaterPoisonChance * creaturePoisonUpgradeChanceScalar) { poisonLevel = 2; } } if (poisoningSkill >= deadlyPoisonSkillMinimum) { if (Utility.RandomDouble() <= deadlyPoisonChance * creaturePoisonUpgradeChanceScalar) { poisonLevel = 3; } } if (enhanceChargeUsed && poisonLevel > 1) { if (Caster.FindItemOnLayer(Layer.OneHanded) is EnhancedSpellbook) { EnhancedSpellbook spellbook = Caster.FindItemOnLayer(Layer.OneHanded) as EnhancedSpellbook; if (spellbook != null) { spellbook.OnSpellCast(Caster); } } } } target.ApplyPoison(Caster, Poison.GetPoison(poisonLevel)); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3); foreach (Mobile m in eable) { if (Caster.CanBeBeneficial(m, false)) { targets.Add(m); } } eable.Free(); } if (Core.AOS) { Party party = Party.Get(Caster); for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; if (m == Caster || (party != null && party.Contains(m))) { Caster.DoBeneficial(m); Spells.Second.ProtectionSpell.Toggle(Caster, m); } } } else { Effects.PlaySound(p, Caster.Map, 0x299); int val = (int)(Caster.Skills[SkillName.Magery].Value / 10.0 + 1); bool chargeUsed = false; for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; if (m.BeginAction(typeof(ProtectionSpell))) { if (m.Player) { Caster.DoBeneficial(m); } m.VirtualArmorMod += val; new InternalTimer(m, Caster, val).Start(); bool enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, null, EnhancedSpellbookType.Wizard, false, false); if (enhancedSpellcast) { chargeUsed = true; } int spellHue = Enhancements.GetMobileSpellHue(Caster, Enhancements.SpellType.ArchProtection); if (enhancedSpellcast) { m.FixedParticles(0x375A, 9, 40, 5027, spellHue, 0, EffectLayer.Waist); m.PlaySound(0x1F7); } else { m.FixedParticles(0x375A, 9, 20, 5027, spellHue, 0, EffectLayer.Waist); m.PlaySound(0x1F7); } } } if (chargeUsed) { if (Caster.FindItemOnLayer(Layer.OneHanded) is EnhancedSpellbook) { EnhancedSpellbook spellbook = Caster.FindItemOnLayer(Layer.OneHanded) as EnhancedSpellbook; if (spellbook != null) { spellbook.OnSpellCast(Caster); } } } } } FinishSequence(); }