mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Merge branch 'update_run_trigger_callers_part_2' into 'master'
Update run trigger callers part 2 See merge request core-developers/forge!2115
This commit is contained in:
@@ -400,8 +400,7 @@ public class GameAction {
|
|||||||
// play the change zone sound
|
// play the change zone sound
|
||||||
game.fireEvent(new GameEventCardChangeZone(c, zoneFrom, zoneTo));
|
game.fireEvent(new GameEventCardChangeZone(c, zoneFrom, zoneTo));
|
||||||
|
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(lastKnownInfo);
|
||||||
runParams.put(AbilityKey.Card, lastKnownInfo);
|
|
||||||
runParams.put(AbilityKey.Cause, cause);
|
runParams.put(AbilityKey.Cause, cause);
|
||||||
runParams.put(AbilityKey.Origin, zoneFrom != null ? zoneFrom.getZoneType().name() : null);
|
runParams.put(AbilityKey.Origin, zoneFrom != null ? zoneFrom.getZoneType().name() : null);
|
||||||
runParams.put(AbilityKey.Destination, zoneTo.getZoneType().name());
|
runParams.put(AbilityKey.Destination, zoneTo.getZoneType().name());
|
||||||
@@ -414,8 +413,7 @@ public class GameAction {
|
|||||||
|
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, true);
|
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, true);
|
||||||
if (zoneFrom != null && zoneFrom.is(ZoneType.Battlefield) && !zoneFrom.getPlayer().equals(zoneTo.getPlayer())) {
|
if (zoneFrom != null && zoneFrom.is(ZoneType.Battlefield) && !zoneFrom.getPlayer().equals(zoneTo.getPlayer())) {
|
||||||
final Map<AbilityKey, Object> runParams2 = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams2 = AbilityKey.mapFromCard(lastKnownInfo);
|
||||||
runParams2.put(AbilityKey.Card, lastKnownInfo);
|
|
||||||
runParams2.put(AbilityKey.OriginalController, zoneFrom.getPlayer());
|
runParams2.put(AbilityKey.OriginalController, zoneFrom.getPlayer());
|
||||||
if(params != null) {
|
if(params != null) {
|
||||||
runParams2.putAll(params);
|
runParams2.putAll(params);
|
||||||
@@ -600,8 +598,7 @@ public class GameAction {
|
|||||||
c.setTurnInZone(tiz);
|
c.setTurnInZone(tiz);
|
||||||
c.setCameUnderControlSinceLastUpkeep(true);
|
c.setCameUnderControlSinceLastUpkeep(true);
|
||||||
|
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
|
||||||
runParams.put(AbilityKey.Card, c);
|
|
||||||
runParams.put(AbilityKey.OriginalController, original);
|
runParams.put(AbilityKey.OriginalController, original);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams, false);
|
||||||
|
|
||||||
@@ -699,8 +696,7 @@ public class GameAction {
|
|||||||
final Card copied = moveTo(removed, c, cause, params);
|
final Card copied = moveTo(removed, c, cause, params);
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
|
||||||
runParams.put(AbilityKey.Card, c);
|
|
||||||
runParams.put(AbilityKey.Cause, cause);
|
runParams.put(AbilityKey.Cause, cause);
|
||||||
runParams.put(AbilityKey.Origin, origin.getZoneType().name());
|
runParams.put(AbilityKey.Origin, origin.getZoneType().name());
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
@@ -894,10 +890,10 @@ public class GameAction {
|
|||||||
// preList means that this is run by a pre Check with LKI objects
|
// preList means that this is run by a pre Check with LKI objects
|
||||||
// in that case Always trigger should not Run
|
// in that case Always trigger should not Run
|
||||||
if (preList.isEmpty()) {
|
if (preList.isEmpty()) {
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Always, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Always, runParams, false);
|
||||||
|
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Immediate, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Immediate, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update P/T and type in the view only once after all the cards have been processed, to avoid flickering
|
// Update P/T and type in the view only once after all the cards have been processed, to avoid flickering
|
||||||
@@ -1416,10 +1412,9 @@ public class GameAction {
|
|||||||
game.fireEvent(new GameEventCardDestroyed());
|
game.fireEvent(new GameEventCardDestroyed());
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
|
||||||
runParams.put("Card", c);
|
runParams.put(AbilityKey.Causer, activator);
|
||||||
runParams.put("Causer", activator);
|
game.getTriggerHandler().runTrigger(TriggerType.Destroyed, runParams, false);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Destroyed, runParams, false);
|
|
||||||
|
|
||||||
final Card sacrificed = sacrificeDestroy(c, sa, table);
|
final Card sacrificed = sacrificeDestroy(c, sa, table);
|
||||||
return sacrificed != null;
|
return sacrificed != null;
|
||||||
@@ -1596,8 +1591,7 @@ public class GameAction {
|
|||||||
checkStateEffects(true); // why?
|
checkStateEffects(true); // why?
|
||||||
|
|
||||||
// Run Trigger beginning of the game
|
// Run Trigger beginning of the game
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
game.getTriggerHandler().runTrigger(TriggerType.NewGame, AbilityKey.newMap(), true);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.NewGame, runParams, true);
|
|
||||||
//</THIS CODE WILL WORK WITH PHASE = NULL>
|
//</THIS CODE WILL WORK WITH PHASE = NULL>
|
||||||
|
|
||||||
|
|
||||||
@@ -1760,9 +1754,9 @@ public class GameAction {
|
|||||||
game.setMonarch(p);
|
game.setMonarch(p);
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Player", p);
|
runParams.put(AbilityKey.Player, p);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.BecomeMonarch, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.BecomeMonarch, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make scry an action function so that it can be used for mulligans (with a null cause)
|
// Make scry an action function so that it can be used for mulligans (with a null cause)
|
||||||
@@ -1822,9 +1816,9 @@ public class GameAction {
|
|||||||
|
|
||||||
if (cause != null) {
|
if (cause != null) {
|
||||||
// set up triggers (but not actually do them until later)
|
// set up triggers (but not actually do them until later)
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Player", p);
|
runParams.put(AbilityKey.Player, p);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Scry, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Scry, runParams, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package forge.game;
|
package forge.game;
|
||||||
|
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardCollection;
|
import forge.game.card.CardCollection;
|
||||||
import forge.game.card.CardCollectionView;
|
import forge.game.card.CardCollectionView;
|
||||||
@@ -214,13 +215,13 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
|||||||
int prevent = damage - restDamage;
|
int prevent = damage - restDamage;
|
||||||
preventMap.put(source, this, damage - restDamage);
|
preventMap.put(source, this, damage - restDamage);
|
||||||
|
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("DamageTarget", this);
|
runParams.put(AbilityKey.DamageTarget, this);
|
||||||
runParams.put("DamageAmount", prevent);
|
runParams.put(AbilityKey.DamageAmount, prevent);
|
||||||
runParams.put("DamageSource", source);
|
runParams.put(AbilityKey.DamageSource, source);
|
||||||
runParams.put("IsCombatDamage", isCombat);
|
runParams.put(AbilityKey.IsCombatDamage, isCombat);
|
||||||
|
|
||||||
getGame().getTriggerHandler().runTriggerOld(TriggerType.DamagePrevented, runParams, false);
|
getGame().getTriggerHandler().runTrigger(TriggerType.DamagePrevented, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return restDamage;
|
return restDamage;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.google.common.collect.HashBasedTable;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Table;
|
import com.google.common.collect.Table;
|
||||||
|
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CounterType;
|
import forge.game.card.CounterType;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
@@ -47,9 +48,9 @@ public class GameEntityCounterTable extends ForwardingTable<GameEntity, CounterT
|
|||||||
|
|
||||||
public void triggerCountersPutAll(final Game game) {
|
public void triggerCountersPutAll(final Game game) {
|
||||||
if (!isEmpty()) {
|
if (!isEmpty()) {
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Objects", this);
|
runParams.put(AbilityKey.Objects, this);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.CounterAddedAll, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.CounterAddedAll, runParams, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package forge.game;
|
package forge.game;
|
||||||
|
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
@@ -36,10 +37,10 @@ public enum PlanarDice {
|
|||||||
trigRes = Chaos;
|
trigRes = Chaos;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<String,Object> runParams = new HashMap<>();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Player", roller);
|
runParams.put(AbilityKey.Player, roller);
|
||||||
runParams.put("Result", trigRes);
|
runParams.put(AbilityKey.Result, trigRes);
|
||||||
roller.getGame().getTriggerHandler().runTriggerOld(TriggerType.PlanarDice, runParams,false);
|
roller.getGame().getTriggerHandler().runTrigger(TriggerType.PlanarDice, runParams,false);
|
||||||
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -1,29 +1,51 @@
|
|||||||
package forge.game.ability;
|
package forge.game.ability;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys for Ability parameter maps.
|
* Keys for Ability parameter maps.
|
||||||
*/
|
*/
|
||||||
public enum AbilityKey {
|
public enum AbilityKey {
|
||||||
|
AbilityMana("AbilityMana"),
|
||||||
Affected("Affected"),
|
Affected("Affected"),
|
||||||
|
Attacker("Attacker"),
|
||||||
Attackers("Attackers"),
|
Attackers("Attackers"),
|
||||||
AttackingPlayer("AttackingPlayer"),
|
AttackingPlayer("AttackingPlayer"),
|
||||||
AttackedTarget("AttackedTarget"),
|
AttackedTarget("AttackedTarget"),
|
||||||
|
Blocker("Blocker"),
|
||||||
|
Blockers("Blockers"),
|
||||||
Card("Card"),
|
Card("Card"),
|
||||||
CardLKI("CardLKI"),
|
CardLKI("CardLKI"),
|
||||||
Cause("Cause"),
|
Cause("Cause"),
|
||||||
|
Causer("Causer"),
|
||||||
|
Championed("Championed"),
|
||||||
CounteredSA("CounteredSA"),
|
CounteredSA("CounteredSA"),
|
||||||
|
DamageAmount("DamageAmount"),
|
||||||
|
DamageSource("DamageSource"),
|
||||||
|
DamageTarget("DamageTarget"),
|
||||||
|
Defender("Defender"),
|
||||||
|
DefendingPlayer("DefendingPlayer"),
|
||||||
Destination("Destination"),
|
Destination("Destination"),
|
||||||
Event("Event"),
|
Event("Event"),
|
||||||
|
Fighter("Fighter"),
|
||||||
Fizzle("Fizzle"),
|
Fizzle("Fizzle"),
|
||||||
|
IsCombatDamage("IsCombatDamage"),
|
||||||
Player("Player"),
|
Player("Player"),
|
||||||
IndividualCostPaymentInstance("IndividualCostPaymentInstance"),
|
IndividualCostPaymentInstance("IndividualCostPaymentInstance"),
|
||||||
|
MonstrosityAmount("MonstrosityAmount"),
|
||||||
|
NumBlockers("NumBlockers"),
|
||||||
|
Objects("Objects"),
|
||||||
Origin("Origin"),
|
Origin("Origin"),
|
||||||
OriginalController("OriginalController"),
|
OriginalController("OriginalController"),
|
||||||
|
Produced("Produced"),
|
||||||
|
Result("Result"),
|
||||||
|
Scheme("Scheme"),
|
||||||
SpellAbilityStackInstance("SpellAbilityStackInstance"),
|
SpellAbilityStackInstance("SpellAbilityStackInstance"),
|
||||||
StackSa("StackSa"),
|
StackSa("StackSa"),
|
||||||
StackSi("StackSi");
|
StackSi("StackSi"),
|
||||||
|
Target("Target"),
|
||||||
|
Won("Won");
|
||||||
|
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
@@ -40,4 +62,11 @@ public enum AbilityKey {
|
|||||||
public static <V> EnumMap<AbilityKey, V> newMap() {
|
public static <V> EnumMap<AbilityKey, V> newMap() {
|
||||||
return new EnumMap<>(AbilityKey.class);
|
return new EnumMap<>(AbilityKey.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<AbilityKey, Object> mapFromCard(forge.game.card.Card card) {
|
||||||
|
final Map<AbilityKey, Object> runParams = newMap();
|
||||||
|
|
||||||
|
runParams.put(Card, card);
|
||||||
|
return runParams;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
@@ -40,9 +40,9 @@ public class AbandonEffect extends SpellAbilityEffect {
|
|||||||
controller.getZone(ZoneType.SchemeDeck).add(source);
|
controller.getZone(ZoneType.SchemeDeck).add(source);
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Scheme", source);
|
runParams.put(AbilityKey.Scheme, source);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Abandoned, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Abandoned, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.event.GameEventCombatChanged;
|
import forge.game.event.GameEventCombatChanged;
|
||||||
@@ -11,7 +12,6 @@ import forge.game.trigger.TriggerType;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -40,13 +40,13 @@ public class BecomesBlockedEffect extends SpellAbilityEffect {
|
|||||||
game.getCombat().setBlocked(c, true);
|
game.getCombat().setBlocked(c, true);
|
||||||
if (!c.getDamageHistory().getCreatureGotBlockedThisCombat()) {
|
if (!c.getDamageHistory().getCreatureGotBlockedThisCombat()) {
|
||||||
isCombatChanged = true;
|
isCombatChanged = true;
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Attacker", c);
|
runParams.put(AbilityKey.Attacker, c);
|
||||||
runParams.put("Blockers", Lists.<Card>newArrayList());
|
runParams.put(AbilityKey.Blockers, Lists.<Card>newArrayList());
|
||||||
runParams.put("NumBlockers", 0);
|
runParams.put(AbilityKey.NumBlockers, 0);
|
||||||
runParams.put("Defender", game.getCombat().getDefenderByAttacker(c));
|
runParams.put(AbilityKey.Defender, game.getCombat().getDefenderByAttacker(c));
|
||||||
runParams.put("DefendingPlayer", game.getCombat().getDefenderPlayerByAttacker(c));
|
runParams.put(AbilityKey.DefendingPlayer, game.getCombat().getDefenderPlayerByAttacker(c));
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.AttackerBlocked, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.AttackerBlocked, runParams, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
@@ -53,26 +53,28 @@ public class BlockEffect extends SpellAbilityEffect {
|
|||||||
blocker.addBlockedThisTurn(attacker);
|
blocker.addBlockedThisTurn(attacker);
|
||||||
attacker.addBlockedByThisTurn(blocker);
|
attacker.addBlockedByThisTurn(blocker);
|
||||||
|
|
||||||
Map<String, Object> runParams = Maps.newHashMap();
|
{
|
||||||
runParams.put("Attacker", attacker);
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Blocker", blocker);
|
runParams.put(AbilityKey.Attacker, attacker);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.AttackerBlockedByCreature, runParams, false);
|
runParams.put(AbilityKey.Blocker, blocker);
|
||||||
|
game.getTriggerHandler().runTrigger(TriggerType.AttackerBlockedByCreature, runParams, false);
|
||||||
|
}
|
||||||
|
|
||||||
runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Blocker", blocker);
|
runParams.put(AbilityKey.Blocker, blocker);
|
||||||
runParams.put("Attackers", attacker);
|
runParams.put(AbilityKey.Attackers, attacker);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Blocks, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Blocks, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
attacker.getDamageHistory().setCreatureGotBlockedThisCombat(true);
|
attacker.getDamageHistory().setCreatureGotBlockedThisCombat(true);
|
||||||
if (!wasBlocked) {
|
if (!wasBlocked) {
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Attacker", attacker);
|
runParams.put(AbilityKey.Attacker, attacker);
|
||||||
runParams.put("Blockers", blockers);
|
runParams.put(AbilityKey.Blockers, blockers);
|
||||||
runParams.put("NumBlockers", blockers.size());
|
runParams.put(AbilityKey.NumBlockers, blockers.size());
|
||||||
runParams.put("Defender", combat.getDefenderByAttacker(attacker));
|
runParams.put(AbilityKey.Defender, combat.getDefenderByAttacker(attacker));
|
||||||
runParams.put("DefendingPlayer", combat.getDefenderPlayerByAttacker(attacker));
|
runParams.put(AbilityKey.DefendingPlayer, combat.getDefenderPlayerByAttacker(attacker));
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.AttackerBlocked, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.AttackerBlocked, runParams, false);
|
||||||
|
|
||||||
combat.orderBlockersForDamageAssignment(attacker, new CardCollection(blockers));
|
combat.orderBlockersForDamageAssignment(attacker, new CardCollection(blockers));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameActionUtil;
|
import forge.game.GameActionUtil;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.*;
|
import forge.game.card.*;
|
||||||
@@ -79,10 +79,10 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
|
|||||||
if (!libCards.isEmpty()) {
|
if (!libCards.isEmpty()) {
|
||||||
sa.getActivatingPlayer().getController().reveal(libCards, ZoneType.Library, libCards.get(0).getOwner());
|
sa.getActivatingPlayer().getController().reveal(libCards, ZoneType.Library, libCards.get(0).getOwner());
|
||||||
}
|
}
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Player", sa.getActivatingPlayer());
|
runParams.put(AbilityKey.Player, sa.getActivatingPlayer());
|
||||||
runParams.put("Target", tgtPlayers);
|
runParams.put(AbilityKey.Target, tgtPlayers);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.SearchedLibrary, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.SearchedLibrary, runParams, false);
|
||||||
}
|
}
|
||||||
if (origin.contains(ZoneType.Hand) && sa.hasParam("Search")) {
|
if (origin.contains(ZoneType.Hand) && sa.hasParam("Search")) {
|
||||||
CardCollection handCards = CardLists.filterControlledBy(CardLists.getValidCards(cards, "Card.inZoneHand", sa.getActivatingPlayer(), source),
|
CardCollection handCards = CardLists.filterControlledBy(CardLists.getValidCards(cards, "Card.inZoneHand", sa.getActivatingPlayer(), source),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.google.common.base.Predicate;
|
|||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import forge.GameCommand;
|
import forge.GameCommand;
|
||||||
import forge.card.CardStateName;
|
import forge.card.CardStateName;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
@@ -831,10 +830,10 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Player", decider);
|
runParams.put(AbilityKey.Player, decider);
|
||||||
runParams.put("Target", Lists.newArrayList(player));
|
runParams.put(AbilityKey.Target, Lists.newArrayList(player));
|
||||||
decider.getGame().getTriggerHandler().runTriggerOld(TriggerType.SearchedLibrary, runParams, false);
|
decider.getGame().getTriggerHandler().runTrigger(TriggerType.SearchedLibrary, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined && changeType != null) {
|
if (!defined && changeType != null) {
|
||||||
@@ -1132,10 +1131,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (champion) {
|
if (champion) {
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(source);
|
||||||
runParams.put("Card", source);
|
runParams.put(AbilityKey.Championed, c);
|
||||||
runParams.put("Championed", c);
|
game.getTriggerHandler().runTrigger(TriggerType.Championed, runParams, false);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Championed, runParams, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remember) {
|
if (remember) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.game.ability.effects;
|
|||||||
|
|
||||||
import forge.game.GameAction;
|
import forge.game.GameAction;
|
||||||
import forge.game.GameLogEntryType;
|
import forge.game.GameLogEntryType;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
@@ -12,7 +13,7 @@ import forge.game.trigger.TriggerType;
|
|||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ClashEffect extends SpellAbilityEffect {
|
public class ClashEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -32,8 +33,8 @@ public class ClashEffect extends SpellAbilityEffect {
|
|||||||
final boolean victory = clashWithOpponent(sa);
|
final boolean victory = clashWithOpponent(sa);
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final HashMap<String, Object> runParams = new HashMap<>();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Player", sa.getHostCard().getController());
|
runParams.put(AbilityKey.Player, sa.getHostCard().getController());
|
||||||
|
|
||||||
if (victory) {
|
if (victory) {
|
||||||
|
|
||||||
@@ -42,18 +43,18 @@ public class ClashEffect extends SpellAbilityEffect {
|
|||||||
AbilityUtils.resolve(sub);
|
AbilityUtils.resolve(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
runParams.put("Won", "True");
|
runParams.put(AbilityKey.Won, "True");
|
||||||
} else {
|
} else {
|
||||||
AbilitySub sub = sa.getAdditionalAbility("OtherwiseSubAbility");
|
AbilitySub sub = sa.getAdditionalAbility("OtherwiseSubAbility");
|
||||||
if (sub != null) {
|
if (sub != null) {
|
||||||
AbilityUtils.resolve(sub);
|
AbilityUtils.resolve(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
runParams.put("Won", "False");
|
runParams.put(AbilityKey.Won, "False");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sa.getHostCard().getGame().getTriggerHandler().runTriggerOld(TriggerType.Clashed, runParams, false);
|
sa.getHostCard().getGame().getTriggerHandler().runTrigger(TriggerType.Clashed, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -209,9 +209,8 @@ public class CounterEffect extends SpellAbilityEffect {
|
|||||||
+ srcSA.getHostCard().getName());
|
+ srcSA.getHostCard().getName());
|
||||||
}
|
}
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(tgtSA.getHostCard());
|
||||||
runParams.put(AbilityKey.Player, tgtSA.getActivatingPlayer());
|
runParams.put(AbilityKey.Player, tgtSA.getActivatingPlayer());
|
||||||
runParams.put(AbilityKey.Card, tgtSA.getHostCard());
|
|
||||||
runParams.put(AbilityKey.Cause, srcSA.getHostCard());
|
runParams.put(AbilityKey.Cause, srcSA.getHostCard());
|
||||||
runParams.put(AbilityKey.CounteredSA, tgtSA);
|
runParams.put(AbilityKey.CounteredSA, tgtSA);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.Countered, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Countered, runParams, false);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import forge.game.Game;
|
|||||||
import forge.game.GameEntity;
|
import forge.game.GameEntity;
|
||||||
import forge.game.GameEntityCounterTable;
|
import forge.game.GameEntityCounterTable;
|
||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
@@ -189,11 +190,10 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (obj instanceof Card) {
|
if (obj instanceof Card) {
|
||||||
Card tgtCard = gameCard;
|
counterAmount = sa.usesTargeting() && sa.hasParam("DividedAsYouChoose") ? sa.getTargetRestrictions().getDividedValue(gameCard) : counterAmount;
|
||||||
counterAmount = sa.usesTargeting() && sa.hasParam("DividedAsYouChoose") ? sa.getTargetRestrictions().getDividedValue(tgtCard) : counterAmount;
|
if (!sa.usesTargeting() || gameCard.canBeTargetedBy(sa)) {
|
||||||
if (!sa.usesTargeting() || tgtCard.canBeTargetedBy(sa)) {
|
|
||||||
if (max != -1) {
|
if (max != -1) {
|
||||||
counterAmount = Math.max(Math.min(max - tgtCard.getCounters(counterType), counterAmount), 0);
|
counterAmount = Math.max(Math.min(max - gameCard.getCounters(counterType), counterAmount), 0);
|
||||||
}
|
}
|
||||||
if (sa.hasParam("UpTo")) {
|
if (sa.hasParam("UpTo")) {
|
||||||
Map<String, Object> params = Maps.newHashMap();
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
@@ -204,15 +204,15 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
// Adapt need extra logic
|
// Adapt need extra logic
|
||||||
if (sa.hasParam("Adapt")) {
|
if (sa.hasParam("Adapt")) {
|
||||||
if (!(tgtCard.getCounters(CounterType.P1P1) == 0
|
if (!(gameCard.getCounters(CounterType.P1P1) == 0
|
||||||
|| tgtCard.hasKeyword("CARDNAME adapts as though it had no +1/+1 counters"))) {
|
|| gameCard.hasKeyword("CARDNAME adapts as though it had no +1/+1 counters"))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Tribute")) {
|
if (sa.hasParam("Tribute")) {
|
||||||
// make a copy to check if it would be on the battlefield
|
// make a copy to check if it would be on the battlefield
|
||||||
Card noTributeLKI = CardUtil.getLKICopy(tgtCard);
|
Card noTributeLKI = CardUtil.getLKICopy(gameCard);
|
||||||
// this check needs to check if this card would be on the battlefield
|
// this check needs to check if this card would be on the battlefield
|
||||||
noTributeLKI.setLastKnownZone(activator.getZone(ZoneType.Battlefield));
|
noTributeLKI.setLastKnownZone(activator.getZone(ZoneType.Battlefield));
|
||||||
|
|
||||||
@@ -235,65 +235,58 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String message = "Do you want to put " + counterAmount + " +1/+1 counters on " + tgtCard + " ?";
|
String message = "Do you want to put " + counterAmount + " +1/+1 counters on " + gameCard + " ?";
|
||||||
Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa, "Choose an opponent");
|
Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa, "Choose an opponent");
|
||||||
|
|
||||||
if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.Tribute, message)) {
|
if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.Tribute, message)) {
|
||||||
tgtCard.setTributed(true);
|
gameCard.setTributed(true);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rememberCards) {
|
if (rememberCards) {
|
||||||
card.addRemembered(tgtCard);
|
card.addRemembered(gameCard);
|
||||||
}
|
}
|
||||||
final Zone zone = tgtCard.getGame().getZoneOf(tgtCard);
|
final Zone zone = gameCard.getGame().getZoneOf(gameCard);
|
||||||
if (zone == null || zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Stack)) {
|
if (zone == null || zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Stack)) {
|
||||||
if (etbcounter) {
|
if (etbcounter) {
|
||||||
tgtCard.addEtbCounter(counterType, counterAmount, placer);
|
gameCard.addEtbCounter(counterType, counterAmount, placer);
|
||||||
} else {
|
} else {
|
||||||
tgtCard.addCounter(counterType, counterAmount, placer, true, table);
|
gameCard.addCounter(counterType, counterAmount, placer, true, table);
|
||||||
}
|
}
|
||||||
if (remember) {
|
if (remember) {
|
||||||
final int value = tgtCard.getTotalCountersToAdd();
|
final int value = gameCard.getTotalCountersToAdd();
|
||||||
tgtCard.addCountersAddedBy(card, counterType, value);
|
gameCard.addCountersAddedBy(card, counterType, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Evolve")) {
|
if (sa.hasParam("Evolve")) {
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
game.getTriggerHandler().runTrigger(TriggerType.Evolved, AbilityKey.mapFromCard(gameCard), false);
|
||||||
runParams.put("Card", tgtCard);
|
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Evolved, runParams, false);
|
|
||||||
}
|
}
|
||||||
if (sa.hasParam("Monstrosity")) {
|
if (sa.hasParam("Monstrosity")) {
|
||||||
tgtCard.setMonstrous(true);
|
gameCard.setMonstrous(true);
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(gameCard);
|
||||||
runParams.put("Card", tgtCard);
|
runParams.put(AbilityKey.MonstrosityAmount, counterAmount);
|
||||||
runParams.put("MonstrosityAmount", counterAmount);
|
game.getTriggerHandler().runTrigger(TriggerType.BecomeMonstrous, runParams, false);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.BecomeMonstrous, runParams, false);
|
|
||||||
}
|
}
|
||||||
if (sa.hasParam("Renown")) {
|
if (sa.hasParam("Renown")) {
|
||||||
tgtCard.setRenowned(true);
|
gameCard.setRenowned(true);
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
game.getTriggerHandler().runTrigger(TriggerType.BecomeRenowned, AbilityKey.mapFromCard(gameCard), false);
|
||||||
runParams.put("Card", tgtCard);
|
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.BecomeRenowned, runParams, false);
|
|
||||||
}
|
}
|
||||||
if (sa.hasParam("Adapt")) {
|
if (sa.hasParam("Adapt")) {
|
||||||
// need to remove special keyword
|
// need to remove special keyword
|
||||||
tgtCard.removeHiddenExtrinsicKeyword("CARDNAME adapts as though it had no +1/+1 counters");
|
gameCard.removeHiddenExtrinsicKeyword("CARDNAME adapts as though it had no +1/+1 counters");
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
game.getTriggerHandler().runTrigger(TriggerType.Adapt, AbilityKey.mapFromCard(gameCard), false);
|
||||||
runParams.put("Card", tgtCard);
|
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Adapt, runParams, false);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// adding counters to something like re-suspend cards
|
// adding counters to something like re-suspend cards
|
||||||
// etbcounter should apply multiplier
|
// etbcounter should apply multiplier
|
||||||
if (etbcounter) {
|
if (etbcounter) {
|
||||||
tgtCard.addEtbCounter(counterType, counterAmount, placer);
|
gameCard.addEtbCounter(counterType, counterAmount, placer);
|
||||||
} else {
|
} else {
|
||||||
tgtCard.addCounter(counterType, counterAmount, placer, false, table);
|
gameCard.addCounter(counterType, counterAmount, placer, false, table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.updateLastStateForCard(tgtCard);
|
game.updateLastStateForCard(gameCard);
|
||||||
}
|
}
|
||||||
} else if (obj instanceof Player) {
|
} else if (obj instanceof Player) {
|
||||||
// Add Counters to players!
|
// Add Counters to players!
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameEntityCounterTable;
|
import forge.game.GameEntityCounterTable;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardCollection;
|
import forge.game.card.CardCollection;
|
||||||
@@ -16,7 +16,6 @@ import forge.game.zone.ZoneType;
|
|||||||
import forge.util.Lang;
|
import forge.util.Lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ExploreEffect extends SpellAbilityEffect {
|
public class ExploreEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -83,9 +82,7 @@ public class ExploreEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// a creature does explore even if it isn't on the battlefield anymore
|
// a creature does explore even if it isn't on the battlefield anymore
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
game.getTriggerHandler().runTrigger(TriggerType.Explores, AbilityKey.mapFromCard(c), false);
|
||||||
runParams.put("Card", c);
|
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Explores, runParams, false);
|
|
||||||
}
|
}
|
||||||
table.triggerCountersPutAll(game);
|
table.triggerCountersPutAll(game);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameEntityCounterTable;
|
import forge.game.GameEntityCounterTable;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardDamageMap;
|
import forge.game.card.CardDamageMap;
|
||||||
@@ -59,9 +59,9 @@ public class FightEffect extends DamageBaseEffect {
|
|||||||
dealDamage(sa, fighters.get(0), fighters.get(1));
|
dealDamage(sa, fighters.get(0), fighters.get(1));
|
||||||
|
|
||||||
for (Card c : fighters) {
|
for (Card c : fighters) {
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Fighter", c);
|
runParams.put(AbilityKey.Fighter, c);
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.Fight, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Fight, runParams, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
@@ -209,10 +209,10 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
|||||||
caller.getGame().getAction().nofityOfValue(sa, caller, wonFlip ? "win" : "lose", null);
|
caller.getGame().getAction().nofityOfValue(sa, caller, wonFlip ? "win" : "lose", null);
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
Map<String,Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put("Player", caller);
|
runParams.put(AbilityKey.Player, caller);
|
||||||
runParams.put("Result", Boolean.valueOf(wonFlip));
|
runParams.put(AbilityKey.Result, wonFlip);
|
||||||
caller.getGame().getTriggerHandler().runTriggerOld(TriggerType.FlippedCoin, runParams, false);
|
caller.getGame().getTriggerHandler().runTrigger(TriggerType.FlippedCoin, runParams, false);
|
||||||
} while (sa.hasParam("FlipUntilYouLose") && wonFlip);
|
} while (sa.hasParam("FlipUntilYouLose") && wonFlip);
|
||||||
|
|
||||||
if (sa.hasParam("FlipUntilYouLose") && sa.hasAdditionalAbility("LoseSubAbility")) {
|
if (sa.hasParam("FlipUntilYouLose") && sa.hasAdditionalAbility("LoseSubAbility")) {
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import com.google.common.base.Predicate;
|
|||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.card.CardRulesPredicates;
|
import forge.card.CardRulesPredicates;
|
||||||
import forge.card.ColorSet;
|
import forge.card.ColorSet;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardFactory;
|
import forge.game.card.CardFactory;
|
||||||
@@ -23,7 +23,6 @@ import forge.item.PaperCard;
|
|||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class PlayLandVariantEffect extends SpellAbilityEffect {
|
public class PlayLandVariantEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -80,9 +79,7 @@ public class PlayLandVariantEffect extends SpellAbilityEffect {
|
|||||||
game.fireEvent(new GameEventLandPlayed(activator, source));
|
game.fireEvent(new GameEventLandPlayed(activator, source));
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
game.getTriggerHandler().runTrigger(TriggerType.LandPlayed, AbilityKey.mapFromCard(source), false);
|
||||||
runParams.put("Card", source);
|
|
||||||
game.getTriggerHandler().runTriggerOld(TriggerType.LandPlayed, runParams, false);
|
|
||||||
game.getStack().unfreezeStack();
|
game.getStack().unfreezeStack();
|
||||||
activator.addLandPlayedThisTurn();
|
activator.addLandPlayedThisTurn();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import forge.card.mana.ManaAtom;
|
import forge.card.mana.ManaAtom;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.trigger.Trigger;
|
import forge.game.trigger.Trigger;
|
||||||
import forge.game.trigger.TriggerHandler;
|
import forge.game.trigger.TriggerHandler;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
@@ -166,13 +167,11 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
manaPool.add(this.lastManaProduced);
|
manaPool.add(this.lastManaProduced);
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
final Map<String, Object> runParams = Maps.newHashMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(source);
|
||||||
|
runParams.put(AbilityKey.Player, player);
|
||||||
runParams.put("Card", source);
|
runParams.put(AbilityKey.AbilityMana, sa);
|
||||||
runParams.put("Player", player);
|
runParams.put(AbilityKey.Produced, afterReplace);
|
||||||
runParams.put("AbilityMana", sa);
|
player.getGame().getTriggerHandler().runTrigger(TriggerType.TapsForMana, runParams, false);
|
||||||
runParams.put("Produced", afterReplace);
|
|
||||||
player.getGame().getTriggerHandler().runTriggerOld(TriggerType.TapsForMana, runParams, false);
|
|
||||||
if (source.isLand()) {
|
if (source.isLand()) {
|
||||||
player.setTappedLandForManaThisTurn(true);
|
player.setTappedLandForManaThisTurn(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.gamesimulationtests.util;
|
|||||||
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.*;
|
import forge.game.*;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.event.GameEventGameFinished;
|
import forge.game.event.GameEventGameFinished;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
@@ -137,8 +138,7 @@ public class GameWrapper {
|
|||||||
//game.getAction().startGame( null ) determines starting player, draws starting hands, handles mulligans, and initiates the first turn
|
//game.getAction().startGame( null ) determines starting player, draws starting hands, handles mulligans, and initiates the first turn
|
||||||
//skip drawing initial hand and mulliganing
|
//skip drawing initial hand and mulliganing
|
||||||
game.setAge( GameStage.Play );
|
game.setAge( GameStage.Play );
|
||||||
final HashMap<String, Object> runParams = new HashMap<>();
|
game.getTriggerHandler().runTrigger(TriggerType.NewGame, AbilityKey.newMap(), false);
|
||||||
game.getTriggerHandler().runTriggerOld( TriggerType.NewGame, runParams, false );
|
|
||||||
|
|
||||||
//first player in the list starts, no coin toss etc
|
//first player in the list starts, no coin toss etc
|
||||||
game.getPhaseHandler().startFirstTurn( game.getPlayers().get( 0 ) );
|
game.getPhaseHandler().startFirstTurn( game.getPlayers().get( 0 ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user