mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Hushbringer improvements
This commit is contained in:
@@ -19,11 +19,13 @@ package forge.game.trigger;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Multimaps;
|
import com.google.common.collect.Multimaps;
|
||||||
|
import com.google.common.collect.Table.Cell;
|
||||||
|
|
||||||
import forge.game.CardTraitBase;
|
import forge.game.CardTraitBase;
|
||||||
import forge.game.CardTraitPredicates;
|
import forge.game.CardTraitPredicates;
|
||||||
@@ -445,29 +447,71 @@ public class TriggerHandler {
|
|||||||
|
|
||||||
// Torpor Orb check
|
// Torpor Orb check
|
||||||
if (game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCreatureETBTriggers)
|
if (game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCreatureETBTriggers)
|
||||||
&& !regtrig.isStatic() && mode.equals(TriggerType.ChangesZone)) {
|
&& !regtrig.isStatic()) {
|
||||||
if (runParams.get(AbilityKey.Destination) instanceof String) {
|
if (mode.equals(TriggerType.ChangesZone)) {
|
||||||
final String dest = (String) runParams.get(AbilityKey.Destination);
|
if (runParams.get(AbilityKey.Destination) instanceof String) {
|
||||||
if (dest.equals("Battlefield") && runParams.get(AbilityKey.Card) instanceof Card) {
|
final String dest = (String) runParams.get(AbilityKey.Destination);
|
||||||
final Card card = (Card) runParams.get(AbilityKey.Card);
|
if (dest.equals("Battlefield") && runParams.get(AbilityKey.Card) instanceof Card) {
|
||||||
if (card.isCreature()) {
|
final Card card = (Card) runParams.get(AbilityKey.Card);
|
||||||
return false;
|
if (card.isCreature()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (mode.equals(TriggerType.ChangesZoneAll)) {
|
||||||
|
CardZoneTable table = (CardZoneTable) runParams.get(AbilityKey.Cards);
|
||||||
|
// find out if any other cards would still trigger it
|
||||||
|
boolean found = false;
|
||||||
|
for (Cell<ZoneType, ZoneType, CardCollection> cell : table.cellSet()) {
|
||||||
|
// this currently assumes the table will not contain multiple destinations
|
||||||
|
// however with some effects (e.g. Goblin Welder) that should indeed be the case
|
||||||
|
// once Forge handles that correctly this section needs to account for that
|
||||||
|
// (by doing a closer check of the triggered ability first)
|
||||||
|
if (cell.getColumnKey() != ZoneType.Battlefield) {
|
||||||
|
found = true;
|
||||||
|
} else if (Iterables.any(cell.getValue(), Predicates.not(CardPredicates.isType("Creature")))) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) break;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // Torpor Orb check
|
} // Torpor Orb check
|
||||||
|
|
||||||
if (game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCreatureDyingTriggers)
|
if (game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCreatureDyingTriggers)
|
||||||
&& !regtrig.isStatic() && mode.equals(TriggerType.ChangesZone)) {
|
&& !regtrig.isStatic()) {
|
||||||
if (runParams.get(AbilityKey.Destination) instanceof String && runParams.get(AbilityKey.Origin) instanceof String) {
|
if (mode.equals(TriggerType.ChangesZone)) {
|
||||||
final String dest = (String) runParams.get(AbilityKey.Destination);
|
if (runParams.get(AbilityKey.Destination) instanceof String && runParams.get(AbilityKey.Origin) instanceof String) {
|
||||||
final String origin = (String) runParams.get(AbilityKey.Origin);
|
final String dest = (String) runParams.get(AbilityKey.Destination);
|
||||||
if (dest.equals("Graveyard") && origin.equals("Battlefield") && runParams.get(AbilityKey.Card) instanceof Card) {
|
final String origin = (String) runParams.get(AbilityKey.Origin);
|
||||||
final Card card = (Card) runParams.get(AbilityKey.Card);
|
if (dest.equals("Graveyard") && origin.equals("Battlefield") && runParams.get(AbilityKey.Card) instanceof Card) {
|
||||||
if (card.isCreature()) {
|
// It will trigger if the ability is of a dying creature that triggers only when that creature is put into a graveyard from anywhere
|
||||||
return false;
|
if (!"Card.Self".equals(regtrig.getParam("ValidCard")) || (regtrig.hasParam("Origin") && !"Any".equals(regtrig.getParam("Origin")))) {
|
||||||
|
final Card card = (Card) runParams.get(AbilityKey.Card);
|
||||||
|
if (card.isCreature()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (mode.equals(TriggerType.ChangesZoneAll)) {
|
||||||
|
CardZoneTable table = (CardZoneTable) runParams.get(AbilityKey.Cards);
|
||||||
|
boolean found = false;
|
||||||
|
for (Cell<ZoneType, ZoneType, CardCollection> cell : table.cellSet()) {
|
||||||
|
if (cell.getRowKey() != ZoneType.Battlefield) {
|
||||||
|
found = true;
|
||||||
|
} else if (cell.getColumnKey() != ZoneType.Graveyard) {
|
||||||
|
found = true;
|
||||||
|
} else if (Iterables.any(cell.getValue(), Predicates.not(CardPredicates.isType("Creature")))) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) break;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ Types:Creature Avatar
|
|||||||
PT:5/7
|
PT:5/7
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDestroy | TriggerDescription$ When CARDNAME enters the battlefield, destroy up to three other target nonland permanents. For each of those permanents, its controller creates a 3/3 white Angel creature token with flying.
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDestroy | TriggerDescription$ When CARDNAME enters the battlefield, destroy up to three other target nonland permanents. For each of those permanents, its controller creates a 3/3 white Angel creature token with flying.
|
||||||
SVar:TrigDestroy:DB$ Destroy | TargetMin$ 0 | TargetMax$ 3 | ValidTgts$ Permanent.nonLand | TgtPrompt$ Choose up to three nonland permanents | RememberTargets$ True | SubAbility$ MakeTokens
|
SVar:TrigDestroy:DB$ Destroy | TargetMin$ 0 | TargetMax$ 3 | ValidTgts$ Permanent.nonLand | TgtPrompt$ Choose up to three nonland permanents | RememberTargets$ True | SubAbility$ MakeTokens
|
||||||
SVar:MakeTokens:DB$ RepeatEach | RepeatSubAbility$ DBToken | DefinedCards$ Remembered | UseImprinted$ True | ChangeZoneTable$ True
|
SVar:MakeTokens:DB$ RepeatEach | RepeatSubAbility$ DBToken | DefinedCards$ Remembered | UseImprinted$ True | ChangeZoneTable$ True | SubAbility$ DBCleanup
|
||||||
SVar:DBToken:DB$ Token | TokenScript$ w_3_3_angel_flying | TokenOwner$ ImprintedController
|
SVar:DBToken:DB$ Token | TokenScript$ w_3_3_angel_flying | TokenOwner$ ImprintedController
|
||||||
|
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||||
DeckHas:Ability$Token & Type$Angel
|
DeckHas:Ability$Token & Type$Angel
|
||||||
Oracle:When Soul of Emancipation enters the battlefield, destroy up to three other target nonland permanents. For each of those permanents, its controller creates a 3/3 white Angel creature token with flying.
|
Oracle:When Soul of Emancipation enters the battlefield, destroy up to three other target nonland permanents. For each of those permanents, its controller creates a 3/3 white Angel creature token with flying.
|
||||||
|
|||||||
Reference in New Issue
Block a user