fix(items): normalize Reactive Paralyze values

This commit is contained in:
Crome696 2026-07-11 23:53:08 +02:00
parent c82b826137
commit 1bf9c263d5
2 changed files with 29 additions and 2 deletions

View file

@ -61,6 +61,33 @@ public class ReactiveParalyzePropertyTests
AssertStaffEditable(typeof(AosWeaponAttributes), nameof(AosWeaponAttributes.ReactiveParalyze));
}
[Fact]
public void Attributes_NormalizeReactiveParalyzeToBinaryPresence()
{
var shield = new BronzeShield();
var weapon = new Halberd();
try
{
shield.ArmorAttributes.ReactiveParalyze = -1;
weapon.WeaponAttributes.ReactiveParalyze = 2;
Assert.Equal(1, shield.ArmorAttributes.ReactiveParalyze);
Assert.Equal(1, weapon.WeaponAttributes.ReactiveParalyze);
shield.ArmorAttributes.ReactiveParalyze = 0;
weapon.WeaponAttributes.ReactiveParalyze = 0;
Assert.Equal(0, shield.ArmorAttributes.ReactiveParalyze);
Assert.Equal(0, weapon.WeaponAttributes.ReactiveParalyze);
}
finally
{
shield.Delete();
weapon.Delete();
}
}
[Fact]
public void GetProperties_GatesReactiveParalyzeToStygianAbyssAndSupportedHosts()
{

View file

@ -1121,7 +1121,7 @@ namespace Server
? this[AosWeaponAttribute.ReactiveParalyze]
: 0;
set => this[AosWeaponAttribute.ReactiveParalyze] =
Owner is BaseWeapon { Layer: Layer.TwoHanded } weapon && weapon is not BaseRanged ? value : 0;
Owner is BaseWeapon { Layer: Layer.TwoHanded } weapon && weapon is not BaseRanged && value != 0 ? 1 : 0;
}
public static int GetValue(Mobile m, AosWeaponAttribute attribute)
@ -1975,7 +1975,7 @@ namespace Server
public int ReactiveParalyze
{
get => Owner is BaseShield ? this[AosArmorAttribute.ReactiveParalyze] : 0;
set => this[AosArmorAttribute.ReactiveParalyze] = Owner is BaseShield ? value : 0;
set => this[AosArmorAttribute.ReactiveParalyze] = Owner is BaseShield && value != 0 ? 1 : 0;
}
public static int GetValue(Mobile m, AosArmorAttribute attribute)