Godot-Barebone-RPG icon indicating copy to clipboard operation
Godot-Barebone-RPG copied to clipboard

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

Open 0x7357 opened this issue 2 years ago • 1 comments

https://github.com/Hairic95/Godot-Barebone-RPG/blob/62584179a14789daa44af73223730cbbc6760a00/src/entities/Player.gd#L24

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

0x7357 avatar Apr 10 '22 11:04 0x7357

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

Hairic95 avatar Apr 10 '22 18:04 Hairic95