* Implemeented consumable flag for asThoughtEffects and a player choice which effect to use if multiple consumable effects allow the same action.

This commit is contained in:
LevelX2 2020-08-21 20:49:43 +02:00
parent 8105d8b26c
commit 90c6637dc2
10 changed files with 78 additions and 18 deletions

View file

@ -215,6 +215,17 @@ public class ChoiceImpl implements Choice, Serializable {
answers.remove(needChoice);
return true;
}
}
}
// no key answer found, try to macht by text starting with
for (String needChoice : answers) {
for (Map.Entry<String, String> currentChoice : this.getKeyChoices().entrySet()) {
if (currentChoice.getValue().startsWith(needChoice)) {
this.setChoiceByKey(currentChoice.getKey());
answers.remove(needChoice);
return true;
}
}
}
} else {
@ -231,4 +242,4 @@ public class ChoiceImpl implements Choice, Serializable {
}
return false; // can't find answer
}
}
}