Fixes dictionary uses (#7)

This commit is contained in:
Kamron Batman 2018-11-02 08:16:42 -07:00 committed by GitHub
parent d4a52344f2
commit 916d404c51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 1211 additions and 1722 deletions

View file

@ -65,7 +65,7 @@ namespace Server.Items
ConsumeUse(weapon);
if (CombatCheck(from, target))
Timer.DelayCall(TimeSpan.FromSeconds(1.0), OnHit, new object[] { from, target, weapon });
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => OnHit(from, target, weapon));
Timer.DelayCall(TimeSpan.FromSeconds(2.5), ResetUsing, from);
}
@ -187,15 +187,15 @@ namespace Server.Items
BaseWeapon defWeapon = defender.Weapon as BaseWeapon;
Skill atkSkill = defender.Skills.Ninjitsu;
Skill defSkill = defender.Skills[defWeapon.Skill];
// Skill defSkill = defender.Skills[defWeapon.Skill];
double atSkillValue = attacker.Skills.Ninjitsu.Value;
double defSkillValue = defWeapon.GetDefendSkillValue(attacker, defender);
double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);
double defSkillValue = defWeapon?.GetDefendSkillValue(attacker, defender) ?? 0.0;
if (defSkillValue <= -20.0) defSkillValue = -19.9;
double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);
if (DivineFurySpell.UnderEffect(attacker)) attackValue += 10;
if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) ||
@ -230,29 +230,24 @@ namespace Server.Items
return attacker.CheckSkill(atkSkill.SkillName, chance);
}
private static void OnHit(object[] states)
private static void OnHit(Mobile from, Mobile target, INinjaWeapon weapon)
{
Mobile from = states[0] as Mobile;
Mobile target = states[1] as Mobile;
INinjaWeapon weapon = states[2] as INinjaWeapon;
if (!from.CanBeHarmful(target))
return;
from.DoHarmful(target);
if (from.CanBeHarmful(target))
AOS.Damage(target, from, weapon.WeaponDamage, 100, 0, 0, 0, 0);
if (weapon.Poison != null && weapon.PoisonCharges > 0)
{
from.DoHarmful(target);
if (EvilOmenSpell.TryEndEffect(target))
target.ApplyPoison(from, Poison.GetPoison(weapon.Poison.Level + 1));
else
target.ApplyPoison(from, weapon.Poison);
AOS.Damage(target, from, weapon.WeaponDamage, 100, 0, 0, 0, 0);
weapon.PoisonCharges--;
if (weapon.Poison != null && weapon.PoisonCharges > 0)
{
if (EvilOmenSpell.TryEndEffect(target))
target.ApplyPoison(from, Poison.GetPoison(weapon.Poison.Level + 1));
else
target.ApplyPoison(from, weapon.Poison);
weapon.PoisonCharges--;
if (weapon.PoisonCharges < 1) weapon.Poison = null;
}
if (weapon.PoisonCharges < 1) weapon.Poison = null;
}
}
@ -314,4 +309,4 @@ namespace Server.Items
}
}
}
}
}