saltyhotdog / BattletechIssueTracker

Public issue tracker to communicate with modders and HBS.
MIT License
6 stars 0 forks source link

Full structure location can be crit'ed #23

Open Sheep-y opened 6 years ago

Sheep-y commented 6 years ago

Describe the problem A location with exactly zero armour but has taken no damage to the structure can still be crit'ed.

Provide an example of the code where the problem occurs Mech.ResolveWeaponDamage(WeaponHitInfo, Weapon, MeleeAttackType)

Problem is that the crit loop check only that this.ArmorForLocation( keyValuePair.Key ) is 0, and does not check whether location structure is actually damaged.

Provide an example of your proposed solution After checking armour, check this.StructureForLocation( chassisLocation ) < this.MaxStructureForLocation( chassisLocation ).

This reduce false positives, but does not prevent the edge case of stripping armour off a previously damaged location. To fully fix it, WeaponHitLocation may need to be expanded to mark whether a location is structurally damaged in Mech.DamageLocation.

Provide a link to a commit in the private repo for this issue Private repo access request pending.

Leave any additional comments here Workaround: Bug is patched in AIM mod v2.5.