Skip to content
Snippets Groups Projects
Commit 2c158de0 authored by Camille Okubo's avatar Camille Okubo
Browse files

fix actions

parent fad0fc7b
Branches
No related tags found
No related merge requests found
......@@ -110,11 +110,13 @@ class Main {
ActionType type = null;
for(Action a : actionList) if(a.getName().equals(input.getInput())) type = a.getActionType();
if(type == ActionType.ATTACK) {
Attack attack = (Attack) actionList.get(actionList.indexOf(input.getInput()));
Attack attack = Attack.PUNCH;
for(Action a : actionList) if(a.getName().equals(input.getInput())) attack = (Attack) a;
level.playerHasEnergy(attack);
} else
if(type == ActionType.DEFENSE) {
Defense defense = (Defense) actionList.get(actionList.indexOf(input.getInput()));
Defense defense = Defense.HIGHBLOCK;
for(Action a : actionList) if(a.getName().equals(input.getInput())) defense = (Defense) a;
Attack randomEnemyAttack = Attack.values()[(int) rand.nextDouble()*Attack.values().length];
level.defends(player, defense, randomEnemyAttack);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment