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

View File

@ -139,7 +139,19 @@ public class GameLogic {
requireLineOfSight(state, data.originField, data.targetField); requireLineOfSight(state, data.originField, data.targetField);
} }
case RealityStone -> { 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 -> { case PowerStone -> {
Character target = getCharacter(state, data.targetField, data.targetEntity); Character target = getCharacter(state, data.targetField, data.targetEntity);