Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -3,181 +3,177 @@ using System.Collections;
|
|||
|
||||
namespace Server.Spells.Bushido
|
||||
{
|
||||
public class HonorableExecution : SamuraiMove
|
||||
{
|
||||
public HonorableExecution()
|
||||
{
|
||||
}
|
||||
public class HonorableExecution : SamuraiMove
|
||||
{
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
public override int BaseMana => 0;
|
||||
public override double RequiredSkill => 25.0;
|
||||
public override int BaseMana => 0;
|
||||
public override double RequiredSkill => 25.0;
|
||||
|
||||
public override TextDefinition AbilityMessage => new TextDefinition( 1063122 ); // You better kill your enemy with your next hit or you'll be rather sorry...
|
||||
public override TextDefinition AbilityMessage =>
|
||||
new TextDefinition(1063122); // You better kill your enemy with your next hit or you'll be rather sorry...
|
||||
|
||||
public override double GetDamageScalar( Mobile attacker, Mobile defender )
|
||||
{
|
||||
double bushido = attacker.Skills[SkillName.Bushido].Value;
|
||||
public override double GetDamageScalar(Mobile attacker, Mobile defender)
|
||||
{
|
||||
double bushido = attacker.Skills[SkillName.Bushido].Value;
|
||||
|
||||
// TODO: 20 -> Perfection
|
||||
return 1.0 + (bushido * 20) / 10000;
|
||||
}
|
||||
// TODO: 20 -> Perfection
|
||||
return 1.0 + bushido * 20 / 10000;
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, int damage )
|
||||
{
|
||||
if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
|
||||
return;
|
||||
public override void OnHit(Mobile attacker, Mobile defender, int damage)
|
||||
{
|
||||
if (!Validate(attacker) || !CheckMana(attacker, true))
|
||||
return;
|
||||
|
||||
ClearCurrentMove( attacker );
|
||||
ClearCurrentMove(attacker);
|
||||
|
||||
HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;
|
||||
HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;
|
||||
|
||||
if ( info != null )
|
||||
{
|
||||
info.Clear();
|
||||
if (info != null)
|
||||
{
|
||||
info.Clear();
|
||||
|
||||
info.m_Timer?.Stop();
|
||||
}
|
||||
info.m_Timer?.Stop();
|
||||
}
|
||||
|
||||
if ( !defender.Alive )
|
||||
{
|
||||
attacker.FixedParticles( 0x373A, 1, 17, 0x7E2, EffectLayer.Waist );
|
||||
if (!defender.Alive)
|
||||
{
|
||||
attacker.FixedParticles(0x373A, 1, 17, 0x7E2, EffectLayer.Waist);
|
||||
|
||||
double bushido = attacker.Skills[SkillName.Bushido].Value;
|
||||
double bushido = attacker.Skills[SkillName.Bushido].Value;
|
||||
|
||||
attacker.Hits += 20 + (int)((bushido * bushido) / 480.0);
|
||||
attacker.Hits += 20 + (int)(bushido * bushido / 480.0);
|
||||
|
||||
int swingBonus = Math.Max( 1, (int)((bushido * bushido) / 720.0) );
|
||||
int swingBonus = Math.Max(1, (int)(bushido * bushido / 720.0));
|
||||
|
||||
info = new HonorableExecutionInfo( attacker, swingBonus );
|
||||
info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 20.0 ), new TimerStateCallback( EndEffect ), info );
|
||||
info = new HonorableExecutionInfo(attacker, swingBonus);
|
||||
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(EndEffect), info);
|
||||
|
||||
m_Table[attacker] = info;
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrayList mods = new ArrayList();
|
||||
m_Table[attacker] = info;
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrayList mods = new ArrayList();
|
||||
|
||||
mods.Add( new ResistanceMod( ResistanceType.Physical, -40 ) );
|
||||
mods.Add( new ResistanceMod( ResistanceType.Fire, -40 ) );
|
||||
mods.Add( new ResistanceMod( ResistanceType.Cold, -40 ) );
|
||||
mods.Add( new ResistanceMod( ResistanceType.Poison, -40 ) );
|
||||
mods.Add( new ResistanceMod( ResistanceType.Energy, -40 ) );
|
||||
mods.Add(new ResistanceMod(ResistanceType.Physical, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Fire, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Cold, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Poison, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Energy, -40));
|
||||
|
||||
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
|
||||
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
|
||||
|
||||
if ( resSpells > 0.0 )
|
||||
mods.Add( new DefaultSkillMod( SkillName.MagicResist, true, -resSpells ) );
|
||||
if (resSpells > 0.0)
|
||||
mods.Add(new DefaultSkillMod(SkillName.MagicResist, true, -resSpells));
|
||||
|
||||
info = new HonorableExecutionInfo( attacker, mods );
|
||||
info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 7.0 ), new TimerStateCallback( EndEffect ), info );
|
||||
info = new HonorableExecutionInfo(attacker, mods);
|
||||
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerStateCallback(EndEffect), info);
|
||||
|
||||
m_Table[attacker] = info;
|
||||
}
|
||||
m_Table[attacker] = info;
|
||||
}
|
||||
|
||||
CheckGain( attacker );
|
||||
}
|
||||
CheckGain(attacker);
|
||||
}
|
||||
|
||||
public static int GetSwingBonus(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
if (info == null)
|
||||
return 0;
|
||||
|
||||
public static int GetSwingBonus( Mobile target )
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
return info.m_SwingBonus;
|
||||
}
|
||||
|
||||
if ( info == null )
|
||||
return 0;
|
||||
public static bool IsUnderPenalty(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
return info.m_SwingBonus;
|
||||
}
|
||||
if (info == null)
|
||||
return false;
|
||||
|
||||
public static bool IsUnderPenalty( Mobile target )
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
return info.m_Penalty;
|
||||
}
|
||||
|
||||
if ( info == null )
|
||||
return false;
|
||||
public static void RemovePenalty(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
return info.m_Penalty;
|
||||
}
|
||||
if (info == null || !info.m_Penalty)
|
||||
return;
|
||||
|
||||
public static void RemovePenalty( Mobile target )
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
info.Clear();
|
||||
|
||||
if ( info == null || !info.m_Penalty )
|
||||
return;
|
||||
info.m_Timer?.Stop();
|
||||
|
||||
info.Clear();
|
||||
m_Table.Remove(target);
|
||||
}
|
||||
|
||||
info.m_Timer?.Stop();
|
||||
public void EndEffect(object state)
|
||||
{
|
||||
HonorableExecutionInfo info = (HonorableExecutionInfo)state;
|
||||
|
||||
m_Table.Remove( target );
|
||||
}
|
||||
RemovePenalty(info.m_Mobile);
|
||||
}
|
||||
|
||||
private class HonorableExecutionInfo
|
||||
{
|
||||
public Mobile m_Mobile;
|
||||
public int m_SwingBonus;
|
||||
public ArrayList m_Mods;
|
||||
public bool m_Penalty;
|
||||
public Timer m_Timer;
|
||||
private class HonorableExecutionInfo
|
||||
{
|
||||
public Mobile m_Mobile;
|
||||
public ArrayList m_Mods;
|
||||
public bool m_Penalty;
|
||||
public int m_SwingBonus;
|
||||
public Timer m_Timer;
|
||||
|
||||
public HonorableExecutionInfo( Mobile from, int swingBonus ) : this( from, swingBonus, null, false )
|
||||
{
|
||||
}
|
||||
public HonorableExecutionInfo(Mobile from, int swingBonus) : this(from, swingBonus, null, false)
|
||||
{
|
||||
}
|
||||
|
||||
public HonorableExecutionInfo( Mobile from, ArrayList mods ) : this( from, 0, mods, true )
|
||||
{
|
||||
}
|
||||
public HonorableExecutionInfo(Mobile from, ArrayList mods) : this(from, 0, mods, true)
|
||||
{
|
||||
}
|
||||
|
||||
public HonorableExecutionInfo( Mobile from, int swingBonus, ArrayList mods, bool penalty )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_SwingBonus = swingBonus;
|
||||
m_Mods = mods;
|
||||
m_Penalty = penalty;
|
||||
public HonorableExecutionInfo(Mobile from, int swingBonus, ArrayList mods, bool penalty)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_SwingBonus = swingBonus;
|
||||
m_Mods = mods;
|
||||
m_Penalty = penalty;
|
||||
|
||||
Apply();
|
||||
}
|
||||
Apply();
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
{
|
||||
if ( m_Mods == null )
|
||||
return;
|
||||
public void Apply()
|
||||
{
|
||||
if (m_Mods == null)
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Mods.Count; ++i )
|
||||
{
|
||||
object mod = m_Mods[i];
|
||||
for (int i = 0; i < m_Mods.Count; ++i)
|
||||
{
|
||||
object mod = m_Mods[i];
|
||||
|
||||
if ( mod is ResistanceMod )
|
||||
m_Mobile.AddResistanceMod( (ResistanceMod) mod );
|
||||
else if ( mod is SkillMod )
|
||||
m_Mobile.AddSkillMod( (SkillMod) mod );
|
||||
}
|
||||
}
|
||||
if (mod is ResistanceMod)
|
||||
m_Mobile.AddResistanceMod((ResistanceMod)mod);
|
||||
else if (mod is SkillMod)
|
||||
m_Mobile.AddSkillMod((SkillMod)mod);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
if ( m_Mods == null )
|
||||
return;
|
||||
public void Clear()
|
||||
{
|
||||
if (m_Mods == null)
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Mods.Count; ++i )
|
||||
{
|
||||
object mod = m_Mods[i];
|
||||
for (int i = 0; i < m_Mods.Count; ++i)
|
||||
{
|
||||
object mod = m_Mods[i];
|
||||
|
||||
if ( mod is ResistanceMod )
|
||||
m_Mobile.RemoveResistanceMod( (ResistanceMod) mod );
|
||||
else if ( mod is SkillMod )
|
||||
m_Mobile.RemoveSkillMod( (SkillMod) mod );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EndEffect( object state )
|
||||
{
|
||||
HonorableExecutionInfo info = (HonorableExecutionInfo)state;
|
||||
|
||||
RemovePenalty( info.m_Mobile );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mod is ResistanceMod)
|
||||
m_Mobile.RemoveResistanceMod((ResistanceMod)mod);
|
||||
else if (mod is SkillMod)
|
||||
m_Mobile.RemoveSkillMod((SkillMod)mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue