Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Fixes 0 health actor being selected #34

Merged
merged 5 commits into from
Mar 9, 2018

Conversation

Phansa
Copy link
Contributor

@Phansa Phansa commented Mar 9, 2018

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.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a 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...

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a 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.


return i;
Copy link
Member

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.

@Phansa
Copy link
Contributor Author

Phansa commented Mar 9, 2018

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.

@JoshuaKGoldberg
Copy link
Member

@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. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants