- Added support for "Play the Specified Permanent" type objective to Puzzle Mode (e.g. Inquest puzzles).

This commit is contained in:
Agetian
2017-08-20 17:37:54 +00:00
parent e77eb8a563
commit 1a1bcc8d5c

View File

@@ -24,6 +24,7 @@ public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzl
String difficulty; String difficulty;
String description; String description;
String targets; String targets;
int targetCount = 1;
int turns; int turns;
public Puzzle(Map<String, List<String>> puzzleLines) { public Puzzle(Map<String, List<String>> puzzleLines) {
@@ -49,6 +50,8 @@ public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzl
this.description = split[1].trim(); this.description = split[1].trim();
} else if ("Targets".equalsIgnoreCase(split[0])) { } else if ("Targets".equalsIgnoreCase(split[0])) {
this.targets = split[1].trim(); this.targets = split[1].trim();
} else if ("TargetCount".equalsIgnoreCase(split[0])) {
this.targetCount = Integer.parseInt(split[1]);
} }
} }
} }
@@ -138,6 +141,22 @@ public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzl
String countVar = "Count$Valid " + targets; String countVar = "Count$Valid " + targets;
goalCard.setSVar("PermCount", countVar); goalCard.setSVar("PermCount", countVar);
break; break;
case "put the specified permanent on the battlefield":
case "play the specified permanent":
if (targets == null) {
System.err.println("Error: target was not specified for the puzzle with an OTB permanent objective!");
break;
}
String trigPlay = "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCards$ " + targets + " | " +
"Static$ True | TriggerDescription$ When the specified permanent enters the battlefield, you win the game.";
String effPlay = "DB$ WinsGame | Defined$ You | ConditionCheckSVar$ PermCount | ConditionSVarCompare$ GE" + targetCount;
final Trigger triggerPlay = TriggerHandler.parseTrigger(trigPlay, goalCard, true);
triggerPlay.setOverridingAbility(AbilityFactory.getAbility(effPlay, goalCard));
goalCard.addTrigger(triggerPlay);
String countPerm = "Count$Valid " + targets;
goalCard.setSVar("PermCount", countPerm);
break;
default: default:
break; break;
} }