diff --git a/src/GameEnvironment/GameEnv.java b/src/GameEnvironment/GameEnv.java index b25caee..c8abcc8 100644 --- a/src/GameEnvironment/GameEnv.java +++ b/src/GameEnvironment/GameEnv.java @@ -774,26 +774,26 @@ public class GameEnv implements Serializable{ if(npcInstanceBoolean) { List attrs = npcInstance.getAttrs(); for(int j=0; j npcInstances = placeOrigin.getNpcInstances(); - npcInstances.remove(npcInstance); - Place place= this.placeIndex.get(value); - npcInstance.setPlace(place); - npcInstances = place.getNpcInstances(); - npcInstances.add(npcInstance); - return true; + if(names[3].equals("跟随玩家")) { + if(value.equals("是")) { + this.followNpcIndex.put(npcInstance.getName(), npcInstance); + }else if(value.equals("否")) { + this.followNpcIndex.remove(npcInstance.getName()); }else { + continue; + } + return true; + }else if(names[3].equals("所在地点")) { + Place placeOrigin = npcInstance.getPlace(); + List npcInstances = placeOrigin.getNpcInstances(); + npcInstances.remove(npcInstance); + Place place= this.placeIndex.get(value); + npcInstance.setPlace(place); + npcInstances = place.getNpcInstances(); + npcInstances.add(npcInstance); + return true; + }else { + if(names[3].equals(attrs.get(j).getName())) { attrs.get(j).setValue(value); return true; }