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.Items
{
@ -8,7 +9,7 @@ namespace Server.Items
/// </summary>
public class Block : WeaponAbility
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, BlockInfo> m_Table = new Dictionary<Mobile, BlockInfo>();
public override int BaseMana => 30;
@ -36,15 +37,16 @@ namespace Server.Items
attacker.FixedParticles(0x37C4, 1, 16, 0x251D, 0x39D, 0x3, EffectLayer.RightHand);
int bonus = (int)(10.0 * ((Math.Max(attacker.Skills[SkillName.Bushido].Value,
attacker.Skills[SkillName.Ninjitsu].Value) - 50.0) / 70.0 + 5));
int bonus = (int)(10.0 * ((Math.Max(attacker.Skills.Bushido.Value,
attacker.Skills.Ninjitsu.Value) - 50.0) / 70.0 + 5));
BeginBlock(attacker, bonus);
}
public static bool GetBonus(Mobile targ, ref int bonus)
{
if (!(m_Table[targ] is BlockInfo info))
BlockInfo info = m_Table[targ];
if (info == null)
return false;
bonus = info.m_Bonus;
@ -54,33 +56,29 @@ namespace Server.Items
public static void BeginBlock(Mobile m, int bonus)
{
EndBlock(m);
BlockInfo info = new BlockInfo(m, bonus);
info.m_Timer = new InternalTimer(m);
m_Table[m] = info;
m_Table[m] = new BlockInfo(m, bonus);
}
public static void EndBlock(Mobile m)
{
if (m_Table[m] is BlockInfo info)
{
info.m_Timer?.Stop();
BlockInfo info = m_Table[m];
m_Table.Remove(m);
}
if (info == null)
return;
info.m_Timer?.Stop();
m_Table.Remove(m);
}
private class BlockInfo
{
public int m_Bonus;
public Mobile m_Target;
public Timer m_Timer;
public BlockInfo(Mobile target, int bonus)
{
m_Target = target;
m_Bonus = bonus;
m_Timer = new InternalTimer(target);
}
}
@ -100,4 +98,4 @@ namespace Server.Items
}
}
}
}
}