Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Bushido
{
@ -11,9 +12,8 @@ namespace Server.Spells.Bushido
9002
);
private static Hashtable m_Table = new Hashtable();
private static Hashtable m_RegenTable = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static Dictionary<Mobile, Timer> m_RegenTable = new Dictionary<Mobile, Timer>();
public Confidence(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -51,27 +51,22 @@ namespace Server.Spells.Bushido
public static bool IsConfident(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
public static void BeginConfidence(Mobile m)
{
Timer t = (Timer)m_Table[m];
Timer timer = m_Table[m];
timer?.Stop();
m_Table[m] = timer = new InternalTimer(m);
t?.Stop();
t = new InternalTimer(m);
m_Table[m] = t;
t.Start();
timer.Start();
}
public static void EndConfidence(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
Timer timer = m_Table[m];
timer?.Stop();
m_Table.Remove(m);
@ -80,27 +75,23 @@ namespace Server.Spells.Bushido
public static bool IsRegenerating(Mobile m)
{
return m_RegenTable.Contains(m);
return m_RegenTable.ContainsKey(m);
}
public static void BeginRegenerating(Mobile m)
{
Timer t = (Timer)m_RegenTable[m];
Timer timer = m_RegenTable[m];
timer?.Stop();
t?.Stop();
m_RegenTable[m] = timer = new RegenTimer(m);
t = new RegenTimer(m);
m_RegenTable[m] = t;
t.Start();
timer.Start();
}
public static void StopRegenerating(Mobile m)
{
Timer t = (Timer)m_RegenTable[m];
t?.Stop();
Timer timer = m_RegenTable[m];
timer?.Stop();
m_RegenTable.Remove(m);
}
@ -149,4 +140,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Bushido
@ -12,7 +13,7 @@ namespace Server.Spells.Bushido
9002
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public CounterAttack(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -28,13 +29,13 @@ namespace Server.Spells.Bushido
if (!base.CheckCast())
return false;
if (Caster.FindItemOnLayer(Layer.TwoHanded) as BaseShield != null)
if (Caster.FindItemOnLayer(Layer.TwoHanded) is BaseShield)
return true;
if (Caster.FindItemOnLayer(Layer.OneHanded) as BaseWeapon != null)
if (Caster.FindItemOnLayer(Layer.OneHanded) is BaseWeapon)
return true;
if (Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon != null)
if (Caster.FindItemOnLayer(Layer.TwoHanded) is BaseWeapon)
return true;
Caster.SendLocalizedMessage(1062944); // You must have a weapon or a shield equipped to use this ability!
@ -64,27 +65,23 @@ namespace Server.Spells.Bushido
public static bool IsCountering(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
public static void StartCountering(Mobile m)
{
Timer t = (Timer)m_Table[m];
Timer timer = m_Table[m];
timer?.Stop();
t?.Stop();
m_Table[m] = timer = new InternalTimer(m);
t = new InternalTimer(m);
m_Table[m] = t;
t.Start();
timer.Start();
}
public static void StopCountering(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
Timer timer = m_Table[m];
timer?.Stop();
m_Table.Remove(m);
@ -108,4 +105,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Bushido
@ -12,7 +13,7 @@ namespace Server.Spells.Bushido
9002
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public Evasion(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
@ -57,7 +58,7 @@ namespace Server.Spells.Bushido
return false;
}
if (!Caster.CanBeginAction(typeof(Evasion)))
if (!Caster.CanBeginAction<Evasion>())
{
if (messages) Caster.SendLocalizedMessage(501789); // You must wait before trying again.
return false;
@ -114,8 +115,8 @@ namespace Server.Spells.Bushido
BeginEvasion(Caster);
Caster.BeginAction(typeof(Evasion));
Timer.DelayCall(TimeSpan.FromSeconds(20.0), delegate { Caster.EndAction(typeof(Evasion)); });
Caster.BeginAction<Evasion>();
Timer.DelayCall(TimeSpan.FromSeconds(20.0), delegate { Caster.EndAction<Evasion>(); });
}
FinishSequence();
@ -123,7 +124,7 @@ namespace Server.Spells.Bushido
public static bool IsEvading(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
public static TimeSpan GetEvadeDuration(Mobile m)
@ -179,22 +180,17 @@ namespace Server.Spells.Bushido
public static void BeginEvasion(Mobile m)
{
Timer t = (Timer)m_Table[m];
Timer timer = m_Table[m];
timer?.Stop();
t?.Stop();
t = new InternalTimer(m, GetEvadeDuration(m));
m_Table[m] = t;
t.Start();
m_Table[m] = timer = new InternalTimer(m, GetEvadeDuration(m));
timer.Start();
}
public static void EndEvasion(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
Timer timer = m_Table[m];
timer?.Stop();
m_Table.Remove(m);
@ -219,4 +215,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -1,11 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Bushido
{
public class HonorableExecution : SamuraiMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, HonorableExecutionInfo> m_Table = new Dictionary<Mobile, HonorableExecutionInfo>();
public override int BaseMana => 0;
public override double RequiredSkill => 25.0;
@ -15,7 +16,7 @@ namespace Server.Spells.Bushido
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
double bushido = attacker.Skills.Bushido.Value;
// TODO: 20 -> Perfection
return 1.0 + bushido * 20 / 10000;
@ -28,10 +29,11 @@ namespace Server.Spells.Bushido
ClearCurrentMove(attacker);
if (m_Table[attacker] is HonorableExecutionInfo info)
HonorableExecutionInfo info = m_Table[attacker];
if (info != null)
{
info.Clear();
info.m_Timer?.Stop();
}
@ -39,20 +41,20 @@ namespace Server.Spells.Bushido
{
attacker.FixedParticles(0x373A, 1, 17, 0x7E2, EffectLayer.Waist);
double bushido = attacker.Skills[SkillName.Bushido].Value;
double bushido = attacker.Skills.Bushido.Value;
attacker.Hits += 20 + (int)(bushido * bushido / 480.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.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), RemovePenalty, info.m_Mobile);
m_Table[attacker] = info;
}
else
{
ArrayList mods = new ArrayList
List<object> mods = new List<object>
{
new ResistanceMod(ResistanceType.Physical, -40),
new ResistanceMod(ResistanceType.Fire, -40),
@ -60,14 +62,14 @@ namespace Server.Spells.Bushido
new ResistanceMod(ResistanceType.Poison, -40),
new ResistanceMod(ResistanceType.Energy, -40)
};
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
double resSpells = attacker.Skills.MagicResist.Value;
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.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), RemovePenalty, info.m_Mobile);
m_Table[attacker] = info;
}
@ -103,24 +105,19 @@ namespace Server.Spells.Bushido
m_Table.Remove(target);
}
public void EndEffect(object state)
{
RemovePenalty(((HonorableExecutionInfo)state).m_Mobile);
}
private class HonorableExecutionInfo
{
public Mobile m_Mobile;
public ArrayList m_Mods;
public List<object> m_Mods;
public bool m_Penalty;
public int m_SwingBonus;
public Timer m_Timer;
public HonorableExecutionInfo(Mobile from, ArrayList mods) : this(from, 0, mods, true)
public HonorableExecutionInfo(Mobile from, List<object> mods) : this(from, 0, mods, true)
{
}
public HonorableExecutionInfo(Mobile from, int swingBonus, ArrayList mods = null, bool penalty = false)
public HonorableExecutionInfo(Mobile from, int swingBonus, List<object> mods = null, bool penalty = false)
{
m_Mobile = from;
m_SwingBonus = swingBonus;
@ -163,4 +160,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -32,7 +32,7 @@ namespace Server.Spells.Bushido
public override bool IgnoreArmor(Mobile attacker)
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
double bushido = attacker.Skills.Bushido.Value;
double criticalChance = bushido * bushido / 72000.0;
return criticalChance >= Utility.RandomDouble();
}

View file

@ -40,7 +40,7 @@ namespace Server.Spells.Bushido
Mobile target = targets[Utility.Random(targets.Count)];
double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0;
double damageBonus = attacker.Skills.Bushido.Value / 100.0;
if (!defender.Alive)
damageBonus *= 1.5;