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;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
@ -24,9 +25,8 @@ namespace Server.Spells.Ninjitsu
9002
);
private static Hashtable m_LastAnimalForms = new Hashtable();
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, int> m_LastAnimalForms = new Dictionary<Mobile, int>();
private static Dictionary<Mobile, AnimalFormContext> m_Table = new Dictionary<Mobile, AnimalFormContext>();
private bool m_WasMoving;
@ -82,7 +82,7 @@ namespace Server.Spells.Ninjitsu
public override bool CheckCast()
{
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
return false;
@ -129,7 +129,7 @@ namespace Server.Spells.Ninjitsu
public override void OnCast()
{
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
}
@ -137,7 +137,7 @@ namespace Server.Spells.Ninjitsu
{
Caster.SendLocalizedMessage(1063219); // You cannot mimic an animal while in that form.
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod && GetContext(Caster) == null)
else if (!Caster.CanBeginAction<IncognitoSpell>() || Caster.IsBodyMod && GetContext(Caster) == null)
{
DoFizzle();
}
@ -162,7 +162,7 @@ namespace Server.Spells.Ninjitsu
if (GetLastAnimalForm(Caster) == -1 || !skipGump)
{
Caster.CloseGump(typeof(AnimalFormGump));
Caster.CloseGump<AnimalFormGump>();
Caster.SendGump(new AnimalFormGump(Caster, Entries, this));
}
else
@ -197,8 +197,8 @@ namespace Server.Spells.Ninjitsu
public int GetLastAnimalForm(Mobile m)
{
if (m_LastAnimalForms.Contains(m))
return (int)m_LastAnimalForms[m];
if (m_LastAnimalForms.ContainsKey(m))
return m_LastAnimalForms[m];
return -1;
}
@ -214,7 +214,7 @@ namespace Server.Spells.Ninjitsu
if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
{
string args = $"{entry.ReqSkill.ToString("F1")}\t{SkillName.Ninjitsu}\t ";
string args = $"{entry.ReqSkill:F1}\t{SkillName.Ninjitsu}\t ";
m.SendLocalizedMessage(1063013,
args); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
return MorphResult.NoSkill;
@ -257,8 +257,7 @@ namespace Server.Spells.Ninjitsu
if (entry.StealthBonus)
{
mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
mod.ObeyCap = true;
mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0) { ObeyCap = true };
m.AddSkillMod(mod);
}
@ -266,8 +265,7 @@ namespace Server.Spells.Ninjitsu
if (entry.StealingBonus)
{
stealingMod = new DefaultSkillMod(SkillName.Stealing, true, 10.0);
stealingMod.ObeyCap = true;
stealingMod = new DefaultSkillMod(SkillName.Stealing, true, 10.0) { ObeyCap = true };
m.AddSkillMod(stealingMod);
}
@ -325,19 +323,17 @@ namespace Server.Spells.Ninjitsu
public static AnimalFormContext GetContext(Mobile m)
{
return m_Table[m] as AnimalFormContext;
return m_Table[m];
}
public static bool UnderTransformation(Mobile m)
{
return GetContext(m) != null;
return m_Table.ContainsKey(m);
}
public static bool UnderTransformation(Mobile m, Type type)
{
AnimalFormContext context = GetContext(m);
return context != null && context.Type == type;
return GetContext(m)?.Type == type;
}
/*
@ -400,14 +396,12 @@ namespace Server.Spells.Ninjitsu
//TODO: Convert this for ML to the BaseImageTileButtonsgump
private Mobile m_Caster;
private AnimalForm m_Spell;
private Item m_Talisman;
public AnimalFormGump(Mobile caster, AnimalFormEntry[] entries, AnimalForm spell)
: base(50, 50)
{
m_Caster = caster;
m_Spell = spell;
m_Talisman = caster.Talisman;
AddPage(0);
@ -615,7 +609,7 @@ namespace Server.Spells.Ninjitsu
{
m_Mobile.RevealingAction();
m_Mobile.PlaySound(0x227);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0, false, false, 0, 0);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0, false, false);
DelayCall(TimeSpan.FromSeconds(1), BreathDamage_Callback, target);
}
@ -631,4 +625,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Ninjitsu
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
return 1.0 + ninjitsu / 360 + Tracking.GetStalkingBonus(attacker, defender) / 100;
}
@ -37,8 +37,8 @@ namespace Server.Spells.Ninjitsu
if (valid)
{
attacker.BeginAction(typeof(Stealth));
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction(typeof(Stealth)); });
attacker.BeginAction<Stealth>();
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction<Stealth>(); });
}
return valid;

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.SkillHandlers;
@ -7,7 +8,7 @@ namespace Server.Spells.Ninjitsu
{
public class DeathStrike : NinjaMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, DeathStrikeInfo> m_Table = new Dictionary<Mobile, DeathStrikeInfo>();
public override int BaseMana => 30;
public override double RequiredSkill => 85.0;
@ -27,7 +28,7 @@ namespace Server.Spells.Ninjitsu
ClearCurrentMove(attacker);
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
double chance;
bool
@ -48,18 +49,16 @@ namespace Server.Spells.Ninjitsu
}
DeathStrikeInfo info;
DeathStrikeInfo info = m_Table[defender];
int damageBonus = 0;
if (m_Table.Contains(defender))
if (info != null)
{
defender.SendLocalizedMessage(1063092); // Your opponent lands another Death Strike!
info = (DeathStrikeInfo)m_Table[defender];
if (info.m_Steps > 0)
damageBonus = attacker.Skills[SkillName.Ninjitsu].Fixed / 150;
damageBonus = attacker.Skills.Ninjitsu.Fixed / 150;
info.m_Timer?.Stop();
@ -75,8 +74,10 @@ namespace Server.Spells.Ninjitsu
defender.FixedParticles(0x374A, 1, 17, 0x26BC, EffectLayer.Waist);
attacker.PlaySound(attacker.Female ? 0x50D : 0x50E);
info = new DeathStrikeInfo(defender, attacker, damageBonus, isRanged);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(ProcessDeathStrike), defender);
info = new DeathStrikeInfo(defender, attacker, damageBonus, isRanged)
{
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), ProcessDeathStrike, defender)
};
m_Table[defender] = info;
@ -85,29 +86,29 @@ namespace Server.Spells.Ninjitsu
public static void AddStep(Mobile m)
{
if (!(m_Table[m] is DeathStrikeInfo info))
DeathStrikeInfo info = m_Table[m];
if (info == null)
return;
if (++info.m_Steps >= 5)
ProcessDeathStrike(m);
}
private static void ProcessDeathStrike(object state)
private static void ProcessDeathStrike(Mobile defender)
{
Mobile defender = (Mobile)state;
if (!(m_Table[defender] is DeathStrikeInfo info)) //sanity
DeathStrikeInfo info = m_Table[defender];
if (info == null)
return;
int damage;
double ninjitsu = info.m_Attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = info.m_Attacker.Skills.Ninjitsu.Value;
double stalkingBonus = Tracking.GetStalkingBonus(info.m_Attacker, info.m_Target);
if (Core.ML)
{
double scalar = (info.m_Attacker.Skills[SkillName.Hiding].Value +
info.m_Attacker.Skills[SkillName.Stealth].Value) / 220;
double scalar = (info.m_Attacker.Skills.Hiding.Value +
info.m_Attacker.Skills.Stealth.Value) / 220;
if (scalar > 1)
scalar = 1;
@ -159,4 +160,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}

View file

@ -34,14 +34,14 @@ namespace Server.Spells.Ninjitsu
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
return 1.0 + ninjitsu * ninjitsu / 43636;
}
public override double GetPropertyBonus(Mobile attacker)
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
double bonus = ninjitsu * ninjitsu / 43636;

View file

@ -1,12 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Ninjitsu
{
public class KiAttack : NinjaMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, KiAttackInfo> m_Table = new Dictionary<Mobile, KiAttackInfo>();
public override int BaseMana => 25;
public override double RequiredSkill => 80.0;
@ -20,7 +21,7 @@ namespace Server.Spells.Ninjitsu
return;
KiAttackInfo info = new KiAttackInfo(from);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(EndKiAttack), info);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(2.0), EndKiAttack, info);
m_Table[from] = info;
}
@ -33,12 +34,12 @@ namespace Server.Spells.Ninjitsu
return false;
}
if (Core.ML && @from.Weapon is BaseRanged)
if (Core.ML && from.Weapon is BaseRanged)
{
from.SendLocalizedMessage(1075858); // You can only use this with melee attacks.
return false;
}
return base.Validate(from);
}
@ -80,18 +81,21 @@ namespace Server.Spells.Ninjitsu
public override void OnClearMove(Mobile from)
{
if (m_Table[@from] is KiAttackInfo info)
{
info.m_Timer?.Stop();
KiAttackInfo info = m_Table[from];
m_Table.Remove(info.m_Mobile);
}
if (info == null)
return;
info.m_Timer?.Stop();
m_Table.Remove(info.m_Mobile);
}
public static double GetBonus(Mobile from)
{
if (!(m_Table[@from] is KiAttackInfo info))
return 0.0;
KiAttackInfo info = m_Table[from];
if (info == null)
return 0;
int xDelta = info.m_Location.X - from.X;
int yDelta = info.m_Location.Y - from.Y;
@ -104,10 +108,8 @@ namespace Server.Spells.Ninjitsu
return bonus;
}
private static void EndKiAttack(object state)
private static void EndKiAttack(KiAttackInfo info)
{
KiAttackInfo info = (KiAttackInfo)state;
info.m_Timer?.Stop();
ClearCurrentMove(info.m_Mobile);
@ -129,4 +131,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}

View file

@ -87,7 +87,7 @@ namespace Server.Spells.Ninjitsu
{
Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
}
else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null)
else if (Region.Find(to, map).IsPartOf<HouseRegion>())
{
Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
}

View file

@ -1,12 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.SkillHandlers;
namespace Server.Spells.Ninjitsu
{
public class SurpriseAttack : NinjaMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, SurpriseAttackInfo> m_Table = new Dictionary<Mobile, SurpriseAttackInfo>();
public override int BaseMana => 20;
public override double RequiredSkill => Core.ML ? 60.0 : 30.0;
@ -32,8 +33,8 @@ namespace Server.Spells.Ninjitsu
if (valid)
{
attacker.BeginAction(typeof(Stealth));
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction(typeof(Stealth)); });
attacker.BeginAction<Stealth>();
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction<Stealth>(); });
}
return valid;
@ -52,23 +53,21 @@ namespace Server.Spells.Ninjitsu
attacker.RevealingAction();
SurpriseAttackInfo info;
SurpriseAttackInfo info = m_Table[defender];
if (m_Table.Contains(defender))
if (info != null)
{
info = (SurpriseAttackInfo)m_Table[defender];
info.m_Timer?.Stop();
m_Table.Remove(defender);
}
int ninjitsu = attacker.Skills[SkillName.Ninjitsu].Fixed;
int ninjitsu = attacker.Skills.Ninjitsu.Fixed;
int malus = ninjitsu / 60 + (int)Tracking.GetStalkingBonus(attacker, defender);
info = new SurpriseAttackInfo(defender, malus);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(8.0), new TimerStateCallback(EndSurprise), info);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(8.0), EndSurprise, info);
m_Table[defender] = info;
@ -86,19 +85,18 @@ namespace Server.Spells.Ninjitsu
public static bool GetMalus(Mobile target, ref int malus)
{
if (!(m_Table[target] is SurpriseAttackInfo info))
SurpriseAttackInfo info = m_Table[target];
if (info == null)
return false;
malus = info.m_Malus;
return true;
}
private static void EndSurprise(object state)
private static void EndSurprise(SurpriseAttackInfo info)
{
SurpriseAttackInfo info = (SurpriseAttackInfo)state;
info.m_Timer?.Stop();
info.m_Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal.
m_Table.Remove(info.m_Target);
@ -117,4 +115,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}