Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"choose_action" in "Player.gd" appends "action" to "possbile_actions" if has_max_uses returns true and current_uses is 0 #1

Open
0x7357 opened this issue Apr 10, 2022 · 1 comment

Comments

@0x7357
Copy link

0x7357 commented Apr 10, 2022

if action.has_max_uses() && action.current_uses > 0:

This line makes no sense because if "action" answers "true" to "has_max_uses()" but "current_uses" equals "0", "else" is called and accordingly "action" is added to the "possible_actions".

Instead, the code should look like this:

var possible_actions: Array = []

for action in unit.get_actions():
	if action.has_max_uses():
		if action.current_uses > 0:
			possible_actions.append(action)
	else:
		possible_actions.append(action)

Please correct me if I'm wrong - I'm just reading the code. :-D

@Hairic95
Copy link
Owner

you are definitly right, right no action implements a maximum amount of uses and I still have to implement them properly.

I'll try to fix this next time I work on the project, thanks for noticing

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

No branches or pull requests

2 participants