fix: add missing check to reality stone

This commit is contained in:
punchready 2021-08-10 12:35:08 +02:00
parent 9f5303ba74
commit ebd7d2a12b
1 changed files with 13 additions and 1 deletions

View File

@ -139,7 +139,19 @@ public class GameLogic {
requireLineOfSight(state, data.originField, data.targetField);
}
case RealityStone -> {
// no check done
boolean rock = false;
boolean empty = true;
for(Entity entity: state.entities.findByPosition(data.targetField)) {
if(entity.id.type == EntityType.Rocks) {
rock = true;
break;
}else {
empty = false;
}
}
if(!empty && !rock) {
throw new InvalidRequestException("Using reality stone on non-free field without a rock");
}
}
case PowerStone -> {
Character target = getCharacter(state, data.targetField, data.targetEntity);