-
Notifications
You must be signed in to change notification settings - Fork 1
Fixes 0 health actor being selected #34
Fixes 0 health actor being selected #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, hit enter too early - please hold...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality mostly LGTM. One change for throwing an error in the edge case.
src/BattleMovr.ts
Outdated
|
||
return i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. If no actors are alive, what should we do here?
The battle can't start if none are provided, let's throw an error instead.
I was getting a linting error about moving the method outside of the class since it doesn't use this anywhere so I did that and added an error message as well. |
@Phansa there are a few stylistic differences in this from the rest of the code, but they're super small and nitpicky so I'll make them myself. 👍 |
Fixes a scenario where an actor with 0 health can be sent out in battle. It will now check for the first actor who has current health !== 0 and send that out.