Skip to content

Commit

Permalink
Merge pull request #575 from Krztk/fix/calculate-total-attack-for-dis…
Browse files Browse the repository at this point in the history
…tance-weapon

fix: total attack calculation for distance weapon
  • Loading branch information
MarcusViniciusSS authored Feb 15, 2024
2 parents 61f924e + 8cf330c commit fb0dca1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static ushort CalculateTotalAttack(this Inventory inventory)
case IDistanceWeapon distance:
{
attack += distance.ExtraAttack;
if (inventory.Ammo != null) attack += distance.ExtraAttack;
if (inventory.Ammo != null) attack += inventory.Ammo.Attack;
break;
}
case IThrowableDistanceWeaponItem distance:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public void Inventory_total_attack_is_the_distance_weapon_extra_attack_plus_ammo

var ammo = ItemTestData.CreateAmmo(1, 50, new (ItemAttribute, IConvertible)[]
{
(ItemAttribute.Attack, 50)
(ItemAttribute.Attack, 60)
});

inventory.AddItem(weapon);
inventory.AddItem(ammo);

//assert
inventory.TotalAttack.Should().Be(100);
inventory.TotalAttack.Should().Be(110);
}

[Fact]
Expand Down

0 comments on commit fb0dca1

Please sign in to comment.