From 31e1c9f1a460756c6fe169eaefc52bb53dce2274 Mon Sep 17 00:00:00 2001 From: Fang Sihan Date: Mon, 18 Mar 2024 21:31:01 +0800 Subject: [PATCH] run can only use in battleinterface --- src/main/java/command/fight/RunningCommand.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/command/fight/RunningCommand.java b/src/main/java/command/fight/RunningCommand.java index 94f1f5bf5c..83bcac6a87 100644 --- a/src/main/java/command/fight/RunningCommand.java +++ b/src/main/java/command/fight/RunningCommand.java @@ -2,6 +2,7 @@ import command.Command; import map.*; +import map.BattleInterface.BattleInterface; public class RunningCommand extends Command { public RunningCommand() { @@ -9,10 +10,12 @@ public RunningCommand() { } @Override public void execute(){ - AMap initMap = new FirstMap(); - initMap.initMap(30, 10); - initMap.initPlayerLocation(0, 0); - initMap.placeMonsterInTheMap(2, 3); - currentMap = initMap; + if(currentMap instanceof BattleInterface) { + AMap initMap = new FirstMap(); + initMap.initMap(30, 10); + initMap.initPlayerLocation(0, 0); + initMap.placeMonsterInTheMap(2, 3); + currentMap = initMap; + } } }