Some more fixes for Puzzle mode

This commit is contained in:
Sol
2017-05-09 02:04:08 +00:00
parent dcd08f0954
commit 546b9ac214
6 changed files with 51 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import com.google.common.collect.Lists;
import forge.card.CardStateName;
import forge.game.Game;
import forge.game.GameEntity;
import forge.game.ability.AbilityFactory;
import forge.game.ability.effects.DetachedCardEffect;
import forge.game.card.Card;
import forge.game.card.CardCollection;
@@ -51,6 +52,8 @@ public abstract class GameState {
private final Map<Integer, Card> idToCard = new HashMap<>();
private final Map<Card, Integer> cardToAttachId = new HashMap<>();
private final Map<String, String> abilityString = new HashMap<>();
private String tChangePlayer = "NONE";
private String tChangePhase = "NONE";
@@ -286,6 +289,10 @@ public abstract class GameState {
aiCardTexts.put(ZoneType.Command, categoryValue);
}
else if (categoryName.startsWith("ability")) {
abilityString.put(categoryName.substring("ability".length()), categoryValue);
}
else {
System.out.println("Unknown key: " + categoryName);
}
@@ -452,6 +459,9 @@ public abstract class GameState {
} else if (info.startsWith("Attaching:")) {
int id = Integer.parseInt(info.substring(info.indexOf(':') + 1));
cardToAttachId.put(c, id);
} else if (info.startsWith("Ability:")) {
String abString = info.substring(info.indexOf(':') + 1).toLowerCase();
c.addSpellAbility(AbilityFactory.getAbility(abilityString.get(abString), c));
}
}