Closed maxpetul closed 2 years ago
Taking a look at this PR, I'd been leaving it for @WildWeazel since he already did a pass, but that's been almost a month now.
Programming this stuff made me realize there are many edge cases in Civ 3 where I'm not sure of the rules. For example, is it possible for a unit to retreat while defending a city? If a unit attacks with 1 HP, can it get killed by defensive bombard? In both cases, I think the answer is "no" since I can't recall ever seeing those things happen, but I'm not sure about that.
I also think the answer is "no", 100% sure on not being able to retreat while defending a city, 98.1% sure on defensive bombard. I also don't recall seeing either of them.
Oh and also thanks for leaving a good overview comment. That really helped with orienting myself at the start.
This PR finishes off "Combat Part Two", the second pass over the combat mechanics for Carthage. Major changes:
MapUnit.OnBeginTurn
method, which also resets movement and flags.MapUnit.fight
that produces the behavior.MapUnit.fight
since it multiplies the possible combat outcomes.CombatResult
andCombatRole
enums for better abstraction in combat code. E.g:MapUnit.fight
returns a CombatResult instead of a win/loss boolean. There's a new methodUnitPrototype.BaseStrength
that returns base strength for each combat role. The variousStrengthVersus
methods have been merged into one that's parameterized by combat role.Programming this stuff made me realize there are many edge cases in Civ 3 where I'm not sure of the rules. For example, is it possible for a unit to retreat while defending a city? If a unit attacks with 1 HP, can it get killed by defensive bombard? In both cases, I think the answer is "no" since I can't recall ever seeing those things happen, but I'm not sure about that.