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
}
}
}
}
}