Skip to content

Match base game promotion behavior after a failed promotion roll - #1136

Open
zack-the-coding-actuary wants to merge 2 commits into
C7-Game:Developmentfrom
zack-the-coding-actuary:combat_promotion
Open

zack-the-coding-actuary wants to merge 2 commits into
C7-Game:Developmentfrom
zack-the-coding-actuary:combat_promotion

Conversation

@zack-the-coding-actuary

Copy link
Copy Markdown
Contributor

In response to issue #1121

This was a pretty lightweight fix, notes below:

  • Add a guaranteedPromotion flag to MapUnit that is set when a unit wins a fight but fails its promotion roll, so all later victories that turn are guaranteed to promote
  • Skip promotion rolls entirely when the defeated opponent is not a combat unit (attack and defense both 0)
  • Add Player.ResetUnitPromotionFlags to clear the flag on every unit
  • Call ResetUnitPromotionFlags for each player at the start of a new turn in TurnHandling

This all matches the base game logic for promotions - hence why a single spearman fighting off a horde of barbarian horsemen seems to promote EVERY turn once it starts promoting. Never actually knew this before working on this issue. Adding some tests in a moment.

Lmk if y'all have changes, thanks!

- Add a guaranteedPromotion flag to MapUnit that is set when a unit wins a fight but fails its promotion roll, so all later victories that turn are guaranteed to promote
- Skip promotion rolls entirely when the defeated opponent is not a combat unit (attack and defense both 0)
- Add Player.ResetUnitPromotionFlags to clear the flag on every unit
- Call ResetUnitPromotionFlags for each player at the start of a new turn in TurnHandling
Covers guaranteed promotion on a second win in one turn, the flag reset at turn start, and no promotion or flag when the opponent has no combat strength
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant