Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,162 +1,167 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Factions;
using Server.Mobiles;
using Server.Spells.Fifth;
using Server.Spells.Ninjitsu;
using Server.Spells.Seventh;
namespace Server.Spells.Mysticism
{
public class StoneFormSpell : MysticSpell
{
public static void Initialize()
{
EventSink.PlayerDeath += OnPlayerDeath;
}
public class StoneFormSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Stone Form", "In Rel Ylem",
-1,
9002,
Reagent.Bloodmoss,
Reagent.FertileDirt,
Reagent.Garlic
);
private static SpellInfo m_Info = new SpellInfo(
"Stone Form", "In Rel Ylem",
-1,
9002,
Reagent.Bloodmoss,
Reagent.FertileDirt,
Reagent.Garlic
);
private static Hashtable m_Table = new Hashtable();
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds( 1.5 );
public StoneFormSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override double RequiredSkill => 33.0;
public override int RequiredMana => 11;
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
private static Hashtable m_Table = new Hashtable();
public override double RequiredSkill => 33.0;
public override int RequiredMana => 11;
public static bool UnderEffect( Mobile m )
{
return m_Table.Contains( m );
}
public static void Initialize()
{
EventSink.PlayerDeath += OnPlayerDeath;
}
public StoneFormSpell( Mobile caster, Item scroll )
: base( caster, scroll, m_Info )
{
}
public static bool UnderEffect(Mobile m)
{
return m_Table.Contains(m);
}
public override bool CheckCast()
{
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
return false;
}
public override bool CheckCast()
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
return false;
}
if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) )
{
Caster.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.
return false;
}
if ( Ninjitsu.AnimalForm.UnderTransformation( Caster ) )
{
Caster.SendLocalizedMessage( 1063218 ); // You cannot use that ability in this form.
return false;
}
if ( Caster.Flying )
{
Caster.SendLocalizedMessage( 1113415 ); // You cannot use this ability while flying.
return false;
}
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
return false;
}
return base.CheckCast();
}
if (AnimalForm.UnderTransformation(Caster))
{
Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form.
return false;
}
public override void OnCast()
{
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 ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) || ( Caster.IsBodyMod && !UnderEffect( Caster ) ) )
{
Caster.SendLocalizedMessage( 1063218 ); // You cannot use that ability in this form.
}
else if ( CheckSequence() )
{
if ( UnderEffect( Caster ) )
{
RemoveEffects( Caster );
if (Caster.Flying)
{
Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying.
return false;
}
Caster.PlaySound( 0xFA );
Caster.Delta( MobileDelta.Resistances );
}
else
{
var mount = Caster.Mount;
return base.CheckCast();
}
if ( mount != null )
mount.Rider = null;
public override void OnCast()
{
if (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 (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod && !UnderEffect(Caster))
{
Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form.
}
else if (CheckSequence())
{
if (UnderEffect(Caster))
{
RemoveEffects(Caster);
Caster.BodyMod = 0x2C1;
Caster.HueMod = 0;
Caster.PlaySound(0xFA);
Caster.Delta(MobileDelta.Resistances);
}
else
{
IMount mount = Caster.Mount;
var offset = (int) ( ( GetBaseSkill( Caster ) + GetBoostSkill( Caster ) ) / 24.0 );
if (mount != null)
mount.Rider = null;
var mods = new List<ResistanceMod>
{
new ResistanceMod( ResistanceType.Physical, offset ),
new ResistanceMod( ResistanceType.Fire, offset ),
new ResistanceMod( ResistanceType.Cold, offset ),
new ResistanceMod( ResistanceType.Poison, offset ),
new ResistanceMod( ResistanceType.Energy, offset )
};
Caster.BodyMod = 0x2C1;
Caster.HueMod = 0;
foreach ( var mod in mods )
Caster.AddResistanceMod( mod );
int offset = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 24.0);
m_Table[Caster] = mods;
List<ResistanceMod> mods = new List<ResistanceMod>
{
new ResistanceMod(ResistanceType.Physical, offset),
new ResistanceMod(ResistanceType.Fire, offset),
new ResistanceMod(ResistanceType.Cold, offset),
new ResistanceMod(ResistanceType.Poison, offset),
new ResistanceMod(ResistanceType.Energy, offset)
};
Caster.PlaySound( 0x65A );
Caster.Delta( MobileDelta.Resistances );
foreach (ResistanceMod mod in mods)
Caster.AddResistanceMod(mod);
BuffInfo.AddBuff( Caster, new BuffInfo( BuffIcon.StoneForm, 1080145, 1080146,
$"-10\t-2\t{offset}\t{GetResistCapBonus(Caster)}\t{GetDIBonus(Caster)}", false ) );
}
}
m_Table[Caster] = mods;
FinishSequence();
}
Caster.PlaySound(0x65A);
Caster.Delta(MobileDelta.Resistances);
public static int GetDIBonus( Mobile m )
{
return (int) ( ( GetBaseSkill( m ) + GetBoostSkill( m ) ) / 12.0 );
}
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.StoneForm, 1080145, 1080146,
$"-10\t-2\t{offset}\t{GetResistCapBonus(Caster)}\t{GetDIBonus(Caster)}", false));
}
}
public static int GetResistCapBonus( Mobile m )
{
return (int) ( ( GetBaseSkill( m ) + GetBoostSkill( m ) ) / 48.0 );
}
FinishSequence();
}
public static void RemoveEffects( Mobile m )
{
var mods = (List<ResistanceMod>) m_Table[m];
public static int GetDIBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 12.0);
}
foreach ( var mod in mods )
m.RemoveResistanceMod( mod );
public static int GetResistCapBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 48.0);
}
m.BodyMod = 0;
m.HueMod = -1;
public static void RemoveEffects(Mobile m)
{
List<ResistanceMod> mods = (List<ResistanceMod>)m_Table[m];
m_Table.Remove( m );
foreach (ResistanceMod mod in mods)
m.RemoveResistanceMod(mod);
BuffInfo.RemoveBuff( m, BuffIcon.StoneForm );
}
m.BodyMod = 0;
m.HueMod = -1;
private static void OnPlayerDeath( PlayerDeathEventArgs e )
{
var m = e.Mobile;
m_Table.Remove(m);
if ( UnderEffect( m ) )
RemoveEffects( m );
}
}
}
BuffInfo.RemoveBuff(m, BuffIcon.StoneForm);
}
private static void OnPlayerDeath(PlayerDeathEventArgs e)
{
Mobile m = e.Mobile;
if (UnderEffect(m))
RemoveEffects(m);
}
}
}