using System;
using Server;
using Server.Spells;
using Server.Network;
using Server.Mobiles;
/*Party Defense Chance increased by up to 22%, Damage reduced by up to 22%.
Casting focus bonus 1-6%.*/
namespace Server.Spells.SkillMasteries
{
public class PerseveranceSpell : BardSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Perserverance", "Unus Jux Sanct",
-1,
9002
);
public override double RequiredSkill{ get { return 90; } }
public override double UpKeep { get { return 5; } }
public override int RequiredMana{ get { return 18; } }
public override bool PartyEffects { get { return true; } }
public override SkillName CastSkill { get { return SkillName.Peacemaking; } }
private int m_PropertyBonus;
private int m_PropertyBonus2;
private int m_DamageMod;
public PerseveranceSpell( Mobile caster, Item scroll ) : base(caster, scroll, m_Info)
{
}
public override void OnCast()
{
BardSpell spell = SkillMasterySpell.GetSpell(Caster, this.GetType()) as BardSpell;
if(spell != null)
{
spell.Expire();
Caster.SendLocalizedMessage(1115774); //You halt your spellsong.
}
else if ( CheckSequence() )
{
m_PropertyBonus = (int)((BaseSkillBonus * 3) + CollectiveBonus); // 2 - 24 (30)
m_PropertyBonus2 = (int)((BaseSkillBonus / 2) + (CollectiveBonus / 3)); // 1 - 4 (6)
m_DamageMod = (int)((BaseSkillBonus * 3) + CollectiveBonus); // 2 - 24 (30)
UpdateParty();
BeginTimer();
}
FinishSequence();
}
public override void AddPartyEffects(Mobile m)
{
m.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
m.SendLocalizedMessage(1115739); // The bard's spellsong fills you with a feeling of invincibility.
string args = String.Format("{0}\t-{1}\t{2}", m_PropertyBonus, m_DamageMod, m_PropertyBonus2);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Perseverance, 1115615, 1115732, args.ToString()));
}
public override void RemovePartyEffects(Mobile m)
{
BuffInfo.RemoveBuff(m, BuffIcon.Perseverance);
}
public override void EndEffects()
{
if (PartyList != null)
{
foreach (Mobile m in PartyList) //Original Party list
{
RemovePartyEffects(m);
}
}
RemovePartyEffects(Caster);
}
///
/// Defense Chance Bonus
///
/// Defense Chance Bonus
public override int PropertyBonus()
{
return m_PropertyBonus;
}
///
/// Casting Focus
///
/// Casting Focus
public override int PropertyBonus2()
{
return m_PropertyBonus2;
}
///
/// modifies total damage dealt
///
///
public void AbsorbDamage(ref int damage)
{
damage -= AOS.Scale(damage, m_DamageMod);
}
}
}