TriggerHandler: add extra Logic for Panharmonicon

This commit is contained in:
Hanmac
2016-09-23 20:14:15 +00:00
parent d21664fce2
commit 97b17f8e1a
3 changed files with 51 additions and 2 deletions

1
.gitattributes vendored
View File

@@ -11337,6 +11337,7 @@ forge-gui/res/cardsfolder/p/pandemonium.txt -text
forge-gui/res/cardsfolder/p/pang_tong_young_phoenix.txt svneol=native#text/plain
forge-gui/res/cardsfolder/p/panglacial_wurm.txt -text
forge-gui/res/cardsfolder/p/pangosaur.txt svneol=native#text/plain
forge-gui/res/cardsfolder/p/panharmonicon.txt -text svneol=unset#text/plain
forge-gui/res/cardsfolder/p/panic.txt svneol=native#text/plain
forge-gui/res/cardsfolder/p/panic_attack.txt svneol=native#text/plain
forge-gui/res/cardsfolder/p/panic_spellbomb.txt svneol=native#text/plain

View File

@@ -327,7 +327,16 @@ public class TriggerHandler {
// Static triggers
for (final Trigger t : Lists.newArrayList(activeTriggers)) {
if (t.isStatic() && canRunTrigger(t, mode, runParams)) {
runSingleTrigger(t, runParams);
int x = 1;
if (handlePanharmonicon(t, runParams)) {
x += t.getHostCard().getController().getAmountOfKeyword("Panharmonicon");
}
for (int i = 0; i < x; ++i) {
runSingleTrigger(t, runParams);
}
checkStatics = true;
}
}
@@ -387,7 +396,15 @@ public class TriggerHandler {
}
}
runSingleTrigger(t, runParams);
int x = 1;
if (handlePanharmonicon(t, runParams)) {
x += t.getHostCard().getController().getAmountOfKeyword("Panharmonicon");
}
for (int i = 0; i < x; ++i) {
runSingleTrigger(t, runParams);
}
checkStatics = true;
}
}
@@ -610,4 +627,29 @@ public class TriggerHandler {
}
}
}
private boolean handlePanharmonicon(final Trigger t, final Map<String, Object> runParams) {
// not a changesZone trigger
if (t.getMode() != TriggerType.ChangesZone) {
return false;
}
// not a Permanent you control
if (!t.getHostCard().isPermanent() || !t.getHostCard().isInZone(ZoneType.Battlefield)) {
return false;
}
// its not an ETB trigger or the card is not a Artifact or Creature
if (runParams.get("Destination") instanceof String) {
final String dest = (String) runParams.get("Destination");
if (dest.equals("Battlefield") && runParams.get("Card") instanceof Card) {
final Card card = (Card) runParams.get("Card");
if (card.isCreature() || card.isArtifact()) {
return true;
}
}
}
return false;
}
}

View File

@@ -0,0 +1,6 @@
Name:Panharmonicon
ManaCost:4
Types:Artifact
S:Mode$ Continuous | Affected$ You | AddKeyword$ Panharmonicon | Description$ If an artifact or creature entering the battlefield causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time.
SVar:Picture:http://www.wizards.com/global/images/magic/general/panharmonicon.jpg
Oracle:If an artifact or creature entering the battlefield causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time.