using System; using DOL.GS.Effects; using DOL.GS.PacketHandler; using DOL.Events; namespace DOL.GS.Spells { public abstract class SavageBuff : PropertyChangingSpell { // bonus category public override int BonusCategory1 { get { return 1; } } /// /// send updates about the changes /// /// protected override void SendUpdates(GameLiving target) { GamePlayer player = target as GamePlayer; // need new prop system to not worry about updates if (player != null) { player.Out.SendCharStatsUpdate(); player.Out.SendUpdateWeaponAndArmorStats(); player.UpdateEncumberance(); player.UpdatePlayerStatus(); } if (target.Health < target.MaxHealth) target.StartHealthRegeneration(); else if (target.Health > target.MaxHealth) target.Health = target.MaxHealth; if (target.Mana < target.MaxMana) target.StartPowerRegeneration(); else if (target.Mana > target.MaxMana) target.Mana = target.MaxMana; if (target.Endurance < target.MaxEndurance) target.StartEnduranceRegeneration(); else if (target.Endurance > target.MaxEndurance) target.Endurance = target.MaxEndurance; } public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { int specLevel = 0; if (Caster is GamePlayer) { specLevel = ((GamePlayer)Caster).GetModifiedSpecLevel(m_spellLine.Spec); } effectiveness = 1.00; effectiveness = 1.00; effectiveness = 1.00; base.ApplyEffectOnTarget(target, effectiveness); } public override int OnEffectExpires(GameSpellEffect effect, bool noMessages) { GamePlayer player = effect.Owner as GamePlayer; int healthToRemove = 0; healthToRemove = (~effect.Spell.Power * (player.MaxHealth / 100)); player.Health -= healthToRemove; if (!noMessages) { SendUpdates(effect.Owner); } base.OnEffectExpires(effect, noMessages); return 0; } // constructor public SavageBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) {} } public abstract class SavageNoChangeBuff : SpellHandler { protected void SendUpdates(GameLiving target) { GamePlayer player = target as GamePlayer; // need new prop system to not worry about updates if (player != null) { player.Out.SendCharStatsUpdate(); player.Out.SendUpdateWeaponAndArmorStats(); player.UpdateEncumberance(); player.UpdatePlayerStatus(); } if (target.Health < target.MaxHealth) target.StartHealthRegeneration(); else if (target.Health > target.MaxHealth) target.Health = target.MaxHealth; if (target.Mana < target.MaxMana) target.StartPowerRegeneration(); else if (target.Mana > target.MaxMana) target.Mana = target.MaxMana; if (target.Endurance < target.MaxEndurance) target.StartEnduranceRegeneration(); else if (target.Endurance > target.MaxEndurance) target.Endurance = target.MaxEndurance; } public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { int specLevel = 0; if (Caster is GamePlayer) { specLevel = ((GamePlayer)Caster).GetModifiedSpecLevel(m_spellLine.Spec); } effectiveness = 1.00; effectiveness = 1.00; effectiveness = 1.00; base.ApplyEffectOnTarget(target, effectiveness); } public override int OnEffectExpires(GameSpellEffect effect, bool noMessages) { GamePlayer player = effect.Owner as GamePlayer; int healthToRemove = 0; healthToRemove = (~effect.Spell.Power * (player.MaxHealth / 100)); player.Health -= healthToRemove; if (!noMessages) { SendUpdates(effect.Owner); } base.OnEffectExpires(effect, noMessages); return 0; } // constructor public SavageNoChangeBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) {} } [SpellHandlerAttribute("SavageCombatSpeedBuff")] public class SavageCombatSpeedBuff : SavageBuff { public override eProperty Property1 { get { return eProperty.CombatSpeed; } } public override bool IsOverwritable(GameSpellEffect compare) { if (compare.Spell.SpellType != Spell.SpellType) return false; if (compare.Spell.Target != Spell.Target) return false; return compare.SpellHandler.SpellLine.IsBaseLine == SpellLine.IsBaseLine; } // constructor public SavageCombatSpeedBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } /// /// Thrust resistance buff /// [SpellHandlerAttribute("SavageThrustBuff")] public class SavageThrustBuff : SavageBuff { public override int BonusCategory1 { get { return 1; } } public override eProperty Property1 { get { return eProperty.Resist_Thrust; } } // constructor public SavageThrustBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } /// /// Slash resistance buff /// [SpellHandlerAttribute("SavageSlashBuff")] public class SavageSlashBuff : SavageBuff { public override int BonusCategory1 { get { return 1; } } public override eProperty Property1 { get { return eProperty.Resist_Slash; } } // constructor public SavageSlashBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } /// /// Crush resistance buff /// [SpellHandlerAttribute("SavageCrushBuff")] public class SavageCrushBuff : SavageBuff { public override int BonusCategory1 { get { return 1; } } public override eProperty Property1 { get { return eProperty.Resist_Crush; } } // constructor public SavageCrushBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } [SpellHandlerAttribute("SavageEvadeBuff")] public class SavageEvadeBuff : SavageNoChangeBuff { public SavageEvadeBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } [SpellHandlerAttribute("SavageParryBuff")] public class SavageParryBuff : SavageNoChangeBuff { public SavageParryBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } [SpellHandlerAttribute("SavageDamageBuff")] public class SavageDamageBuff : SavageNoChangeBuff { public SavageDamageBuff(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } [SpellHandlerAttribute("SavageEndHeal")] public class SavageEndHeal : SpellHandler { public override void OnDirectEffect(GameLiving target, double effectiveness) { int endHealValue = (1 + ((int)Spell.Value / 10)); int healthToRemove = 0; healthToRemove = (~Spell.Power * (target.MaxHealth / 100)); if (!(target.Health > healthToRemove)) { ((GamePlayer)target).Out.SendMessage("You do not have enough health to use this ability!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow); return; } target.Health -= healthToRemove; if ((target.Endurance * endHealValue) >= target.MaxEndurance) { target.Endurance = target.MaxEndurance; return; } target.Endurance = (target.MaxEndurance *= endHealValue); foreach (GamePlayer t_player in target.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { t_player.Out.SendSpellEffectAnimation(target, target, 11223, 0, false, 1); } } public SavageEndHeal(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { } } }