Bandit Interactions - #2296
Conversation
|
lgtm but should you add some unit and regression tests here? |
ShoT-UPfps
left a comment
There was a problem hiding this comment.
two correctness issues remain
ShoT-UPfps
left a comment
There was a problem hiding this comment.
one correctness issue remains
ShoT-UPfps
left a comment
There was a problem hiding this comment.
two follow-up comments
ShoT-UPfps
left a comment
There was a problem hiding this comment.
two correctness issues remain
| } | ||
|
|
||
| // Do surrender on server and send message to client to update post battle screens | ||
| var surrenderMessage = new BanditsSurrenderAsPrisoners(PlayerEncounter.Battle, PlayerEncounter.Battle.PlayerSide); |
There was a problem hiding this comment.
StartBattle() can still return null for Rejected or Unresolved, so this dereference throws. don't return on null for Unresolved, because that consumes the one-shot surrender before the late-created event attaches
There was a problem hiding this comment.
Added guard against NRE
There was a problem hiding this comment.
this still returns for Unresolved, so the NRE is fixed but the one-shot surrender is still consumed before the late-created event attaches.
There was a problem hiding this comment.
Added guard against null result from StartBattle() for unresolved battles
There was a problem hiding this comment.
this still consumes the one-shot surrender for Unresolved, and it now also returns when PlayerEncounter.Battle already exists because createdBattle is only assigned in the null branch. reuse the existing battle and defer surrender until a late-created event attaches.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
There are a few interactions with bandits that aren't synced:
What is the new behavior?
Resolves #1795
Resolves #3032
Bot Changelog Entry
Surrendering bandits can now be taken prisoner and recruited (with the right perk).