fix: add missing check to reality stone
This commit is contained in:
parent
9f5303ba74
commit
ebd7d2a12b
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user