This commit is contained in:
mark 2009-07-19 05:13:25 +00:00
parent cc7814db35
commit bcdee05c6c
83 changed files with 268 additions and 146 deletions

View file

@ -74,6 +74,7 @@ namespace Server.Spells.Ninjitsu
public override bool CheckFizzle()
{
// Spell is initially always successful, and with no skill gain.
return true;
}
@ -97,7 +98,8 @@ namespace Server.Spells.Ninjitsu
if ( context != null )
{
RemoveContext( Caster, context, true );
if( ConsumeMana() )
RemoveContext( Caster, context, true );
}
else if ( Caster is PlayerMobile )
{
@ -108,13 +110,13 @@ namespace Server.Spells.Ninjitsu
}
else
{
if ( Morph( Caster, GetLastAnimalForm( Caster ) ) == MorphResult.Fail )
if ( ConsumeMana() && Morph( Caster, GetLastAnimalForm( Caster ) ) == MorphResult.Fail )
DoFizzle();
}
}
else
{
if ( Morph( Caster, GetLastAnimalForm( Caster ) ) == MorphResult.Fail )
if ( ConsumeMana() && Morph( Caster, GetLastAnimalForm( Caster ) ) == MorphResult.Fail )
DoFizzle();
}
}
@ -122,6 +124,21 @@ namespace Server.Spells.Ninjitsu
FinishSequence();
}
public bool ConsumeMana()
{
int mana = ScaleMana( RequiredMana );
if ( Caster.Mana < mana )
{
Caster.SendLocalizedMessage( 1060174, mana.ToString() ); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
Caster.Mana -= mana;
return true;
}
private static Hashtable m_LastAnimalForms = new Hashtable();
public int GetLastAnimalForm( Mobile m )
@ -379,7 +396,7 @@ namespace Server.Spells.Ninjitsu
{
int entryID = info.Switches[0] - 100;
if ( AnimalForm.Morph( m_Caster, entryID ) == MorphResult.Fail )
if ( m_Spell.ConsumeMana() && AnimalForm.Morph( m_Caster, entryID ) == MorphResult.Fail )
{
m_Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502632 ); // The spell fizzles.
m_Caster.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist );