fix: Adds FindItemOnLayer generic (#1223)
This commit is contained in:
parent
053dbcbad0
commit
fd6f4239e2
20 changed files with 112 additions and 169 deletions
|
|
@ -33,12 +33,24 @@ namespace Server.Spells.Bushido
|
|||
return false;
|
||||
}
|
||||
|
||||
if (caster.FindItemOnLayer(Layer.OneHanded) is not BaseWeapon weap)
|
||||
{
|
||||
weap = caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
|
||||
}
|
||||
var weap =
|
||||
caster.FindItemOnLayer<BaseWeapon>(Layer.OneHanded) ??
|
||||
caster.FindItemOnLayer<BaseWeapon>(Layer.TwoHanded);
|
||||
|
||||
if (weap != null)
|
||||
if (weap == null)
|
||||
{
|
||||
if (caster.FindItemOnLayer(Layer.TwoHanded) is not BaseShield)
|
||||
{
|
||||
if (messages)
|
||||
{
|
||||
// You must have a weapon or a shield equipped to use this ability!
|
||||
caster.SendLocalizedMessage(1062944);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Core.ML && caster.Skills[weap.Skill].Base < 50)
|
||||
{
|
||||
|
|
@ -51,15 +63,6 @@ namespace Server.Spells.Bushido
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if (caster.FindItemOnLayer(Layer.TwoHanded) is not BaseShield)
|
||||
{
|
||||
if (messages)
|
||||
{
|
||||
caster.SendLocalizedMessage(1062944); // You must have a weapon or a shield equipped to use this ability!
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!caster.CanBeginAction<Evasion>())
|
||||
{
|
||||
|
|
@ -76,10 +79,9 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static bool CheckSpellEvasion(Mobile defender)
|
||||
{
|
||||
if (defender.FindItemOnLayer(Layer.OneHanded) is not BaseWeapon weap)
|
||||
{
|
||||
weap = defender.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
|
||||
}
|
||||
var weap =
|
||||
defender.FindItemOnLayer<BaseWeapon>(Layer.OneHanded) ??
|
||||
defender.FindItemOnLayer<BaseWeapon>(Layer.TwoHanded);
|
||||
|
||||
if (Core.ML)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,22 +12,18 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public override bool Validate(Mobile from)
|
||||
{
|
||||
if (from.FindItemOnLayer(Layer.TwoHanded) is BaseShield)
|
||||
var twoHanded = from.FindItemOnLayer(Layer.TwoHanded);
|
||||
if (twoHanded is BaseShield)
|
||||
{
|
||||
from.SendLocalizedMessage(1063096); // You cannot use this ability while holding a shield.
|
||||
return false;
|
||||
}
|
||||
|
||||
Item handOne = from.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
|
||||
var meleeWeapon =
|
||||
twoHanded is BaseWeapon and not BaseRanged ||
|
||||
from.FindItemOnLayer(Layer.OneHanded) is BaseWeapon and not BaseRanged;
|
||||
|
||||
if (handOne != null && handOne is not BaseRanged)
|
||||
{
|
||||
return base.Validate(from);
|
||||
}
|
||||
|
||||
Item handTwo = from.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
|
||||
|
||||
if (handTwo != null && handTwo is not BaseRanged)
|
||||
if (meleeWeapon)
|
||||
{
|
||||
return base.Validate(from);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue