Fixes chaos damage bug with the spell system. Fixes various small other bugs. Fixes more merge cast type checks and uses default values.
This commit is contained in:
parent
9542c79ea4
commit
c155c82325
115 changed files with 644 additions and 1041 deletions
|
|
@ -37,9 +37,7 @@ namespace Server.Spells.Bushido
|
|||
if (Caster == null) // Sanity
|
||||
return false;
|
||||
|
||||
BaseWeapon weap = Caster.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
|
||||
|
||||
if (weap == null)
|
||||
if (!(Caster.FindItemOnLayer(Layer.OneHanded) is BaseWeapon weap))
|
||||
weap = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
|
||||
|
||||
if (weap != null)
|
||||
|
|
@ -70,9 +68,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static bool CheckSpellEvasion(Mobile defender)
|
||||
{
|
||||
BaseWeapon weap = defender.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
|
||||
|
||||
if (weap == null)
|
||||
if (!(defender.FindItemOnLayer(Layer.OneHanded) is BaseWeapon weap))
|
||||
weap = defender.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
|
||||
|
||||
if (Core.ML)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
ClearCurrentMove(attacker);
|
||||
|
||||
HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;
|
||||
|
||||
if (info != null)
|
||||
if (m_Table[attacker] is HonorableExecutionInfo info)
|
||||
{
|
||||
info.Clear();
|
||||
|
||||
|
|
@ -54,14 +52,15 @@ namespace Server.Spells.Bushido
|
|||
}
|
||||
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));
|
||||
|
||||
ArrayList mods = new ArrayList
|
||||
{
|
||||
new ResistanceMod(ResistanceType.Physical, -40),
|
||||
new ResistanceMod(ResistanceType.Fire, -40),
|
||||
new ResistanceMod(ResistanceType.Cold, -40),
|
||||
new ResistanceMod(ResistanceType.Poison, -40),
|
||||
new ResistanceMod(ResistanceType.Energy, -40)
|
||||
};
|
||||
|
||||
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
|
||||
|
||||
if (resSpells > 0.0)
|
||||
|
|
@ -78,9 +77,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static int GetSwingBonus(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
if (info == null)
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info))
|
||||
return 0;
|
||||
|
||||
return info.m_SwingBonus;
|
||||
|
|
@ -88,9 +85,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static bool IsUnderPenalty(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
if (info == null)
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info))
|
||||
return false;
|
||||
|
||||
return info.m_Penalty;
|
||||
|
|
@ -98,9 +93,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void RemovePenalty(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
if (info == null || !info.m_Penalty)
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info) || !info.m_Penalty)
|
||||
return;
|
||||
|
||||
info.Clear();
|
||||
|
|
@ -112,9 +105,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public void EndEffect(object state)
|
||||
{
|
||||
HonorableExecutionInfo info = (HonorableExecutionInfo)state;
|
||||
|
||||
RemovePenalty(info.m_Mobile);
|
||||
RemovePenalty(((HonorableExecutionInfo)state).m_Mobile);
|
||||
}
|
||||
|
||||
private class HonorableExecutionInfo
|
||||
|
|
@ -125,15 +116,11 @@ namespace Server.Spells.Bushido
|
|||
public int m_SwingBonus;
|
||||
public Timer m_Timer;
|
||||
|
||||
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, int swingBonus, ArrayList mods, bool penalty)
|
||||
public HonorableExecutionInfo(Mobile from, int swingBonus, ArrayList mods = null, bool penalty = false)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_SwingBonus = swingBonus;
|
||||
|
|
@ -152,10 +139,10 @@ namespace Server.Spells.Bushido
|
|||
{
|
||||
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 resistanceMod)
|
||||
m_Mobile.AddResistanceMod(resistanceMod);
|
||||
else if (mod is SkillMod skillMod)
|
||||
m_Mobile.AddSkillMod(skillMod);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -168,10 +155,10 @@ namespace Server.Spells.Bushido
|
|||
{
|
||||
object mod = m_Mods[i];
|
||||
|
||||
if (mod is ResistanceMod)
|
||||
m_Mobile.RemoveResistanceMod((ResistanceMod)mod);
|
||||
else if (mod is SkillMod)
|
||||
m_Mobile.RemoveSkillMod((SkillMod)mod);
|
||||
if (mod is ResistanceMod resistanceMod)
|
||||
m_Mobile.RemoveResistanceMod(resistanceMod);
|
||||
else if (mod is SkillMod skillMod)
|
||||
m_Mobile.RemoveSkillMod(skillMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue