mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
more mechanical transformations
This commit is contained in:
@@ -9,6 +9,7 @@ import java.util.Map;
|
||||
public enum AbilityKey {
|
||||
AbilityMana("AbilityMana"),
|
||||
Affected("Affected"),
|
||||
AllVotes("AllVotes"),
|
||||
Attacker("Attacker"),
|
||||
Attackers("Attackers"),
|
||||
AttackingPlayer("AttackingPlayer"),
|
||||
@@ -20,17 +21,24 @@ public enum AbilityKey {
|
||||
Cause("Cause"),
|
||||
Causer("Causer"),
|
||||
Championed("Championed"),
|
||||
CounterAmount("CounterAmount"),
|
||||
CounteredSA("CounteredSA"),
|
||||
CounterType("CounterType"),
|
||||
CumulativeUpkeepPaid("CumulativeUpkeepPaid"),
|
||||
DamageAmount("DamageAmount"),
|
||||
DamageSource("DamageSource"),
|
||||
DamageTarget("DamageTarget"),
|
||||
Defender("Defender"),
|
||||
DefendingPlayer("DefendingPlayer"),
|
||||
Destination("Destination"),
|
||||
Devoured("Devoured"),
|
||||
EchoPaid("EchoPaid"),
|
||||
Exploited("Exploited"),
|
||||
Event("Event"),
|
||||
Fighter("Fighter"),
|
||||
Fizzle("Fizzle"),
|
||||
IsCombatDamage("IsCombatDamage"),
|
||||
PayingMana("PayingMana"),
|
||||
Player("Player"),
|
||||
IndividualCostPaymentInstance("IndividualCostPaymentInstance"),
|
||||
MonstrosityAmount("MonstrosityAmount"),
|
||||
@@ -41,10 +49,12 @@ public enum AbilityKey {
|
||||
Produced("Produced"),
|
||||
Result("Result"),
|
||||
Scheme("Scheme"),
|
||||
Source("Source"),
|
||||
SpellAbilityStackInstance("SpellAbilityStackInstance"),
|
||||
StackSa("StackSa"),
|
||||
StackSi("StackSi"),
|
||||
Target("Target"),
|
||||
Transformer("Transformer"),
|
||||
Won("Won");
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.event.GameEventCardRegenerated;
|
||||
@@ -44,10 +45,9 @@ public class RegenerationEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// Run triggers
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("Card", c);
|
||||
runParams.put("Cause", host);
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.Regenerated, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
|
||||
runParams.put(AbilityKey.Cause, host);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Regenerated, runParams, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
@@ -74,9 +75,7 @@ public class RevealEffect extends SpellAbilityEffect {
|
||||
|
||||
game.getAction().reveal(revealed, p);
|
||||
for (final Card c : revealed) {
|
||||
Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("Card", c);
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.Revealed, runParams, false);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Revealed, AbilityKey.mapFromCard(c), false);
|
||||
if (sa.hasParam("RememberRevealed")) {
|
||||
host.addRemembered(c);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import forge.card.mana.ManaCost;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameActionUtil;
|
||||
import forge.game.GameEntityCounterTable;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.*;
|
||||
@@ -36,10 +37,9 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
isPaid = activator.getController().payManaOptional(card, new Cost(sa.getParam("Echo"), true),
|
||||
sa, "Pay Echo", ManaPaymentPurpose.Echo);
|
||||
}
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("EchoPaid", Boolean.valueOf(isPaid));
|
||||
runParams.put("Card", card);
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.PayEcho, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(card);
|
||||
runParams.put(AbilityKey.EchoPaid, isPaid);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.PayEcho, runParams, false);
|
||||
if (isPaid || !card.getController().equals(activator)) {
|
||||
return;
|
||||
}
|
||||
@@ -65,11 +65,10 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
sb.append("Cumulative upkeep for ").append(card);
|
||||
|
||||
boolean isPaid = activator.getController().payManaOptional(card, payCost, sa, sb.toString(), ManaPaymentPurpose.CumulativeUpkeep);
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("CumulativeUpkeepPaid", Boolean.valueOf(isPaid));
|
||||
runParams.put("Card", card);
|
||||
runParams.put("PayingMana", StringUtils.join(sa.getPayingMana(), ""));
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.PayCumulativeUpkeep, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(card);
|
||||
runParams.put(AbilityKey.CumulativeUpkeepPaid, isPaid);
|
||||
runParams.put(AbilityKey.PayingMana, StringUtils.join(sa.getPayingMana(), ""));
|
||||
game.getTriggerHandler().runTrigger(TriggerType.PayCumulativeUpkeep, runParams, false);
|
||||
if (isPaid || !card.getController().equals(activator)) {
|
||||
return;
|
||||
}
|
||||
@@ -147,16 +146,15 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
// Run Devour Trigger
|
||||
if (devour) {
|
||||
card.addDevoured(lKICopy);
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("Devoured", sac);
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.Devoured, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Devoured, sac);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Devoured, runParams, false);
|
||||
}
|
||||
if (exploit) {
|
||||
card.addExploited(lKICopy);
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("Exploited", lKICopy);
|
||||
runParams.put("Card", card);
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.Exploited, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(card);
|
||||
runParams.put(AbilityKey.Exploited, lKICopy);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Exploited, runParams, false);
|
||||
}
|
||||
if (wasDestroyed || wasSacrificed) {
|
||||
countSacrificed++;
|
||||
|
||||
@@ -3,6 +3,7 @@ package forge.game.ability.effects;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
@@ -46,9 +47,9 @@ public class SetInMotionEffect extends SpellAbilityEffect {
|
||||
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
|
||||
|
||||
// Run triggers
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("Scheme", controller.getActiveScheme());
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.SetInMotion, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Scheme, controller.getActiveScheme());
|
||||
game.getTriggerHandler().runTrigger(TriggerType.SetInMotion, runParams, false);
|
||||
} else {
|
||||
controller.setSchemeInMotion();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.game.ability.AbilityKey;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
@@ -99,9 +100,9 @@ public class VoteEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("AllVotes", votes);
|
||||
game.getTriggerHandler().runTriggerOld(TriggerType.Vote, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.AllVotes, votes);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Vote, runParams, false);
|
||||
|
||||
List<String> subAbs = Lists.newArrayList();
|
||||
final List<Object> mostVotes = getMostVotes(votes);
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostParser;
|
||||
import forge.game.*;
|
||||
import forge.game.ability.AbilityFactory;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.ApiType;
|
||||
import forge.game.ability.effects.CharmEffect;
|
||||
@@ -567,9 +568,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
// Clear old dfc trigger from the trigger handler
|
||||
getGame().getTriggerHandler().clearInstrinsicActiveTriggers(this, null);
|
||||
getGame().getTriggerHandler().registerActiveTrigger(this, false);
|
||||
Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("Transformer", this);
|
||||
getGame().getTriggerHandler().runTriggerOld(TriggerType.Transformed, runParams, false);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Transformer, this);
|
||||
getGame().getTriggerHandler().runTrigger(TriggerType.Transformed, runParams, false);
|
||||
incrementTransformedTimestamp();
|
||||
|
||||
return result;
|
||||
@@ -687,9 +688,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
// Run triggers
|
||||
getGame().getTriggerHandler().registerActiveTrigger(this, false);
|
||||
final Map<String, Object> runParams = Maps.newTreeMap();
|
||||
runParams.put("Card", this);
|
||||
getGame().getTriggerHandler().runTriggerOld(TriggerType.TurnFaceUp, runParams, false);
|
||||
getGame().getTriggerHandler().runTrigger(TriggerType.TurnFaceUp, AbilityKey.mapFromCard(this), false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1281,18 +1280,17 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
// Run triggers
|
||||
final Map<String, Object> runParams = Maps.newHashMap();
|
||||
runParams.put("Card", this);
|
||||
runParams.put("Source", source);
|
||||
runParams.put("CounterType", counterType);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(this);
|
||||
runParams.put(AbilityKey.Source, source);
|
||||
runParams.put(AbilityKey.CounterType, counterType);
|
||||
for (int i = 0; i < addAmount; i++) {
|
||||
runParams.put("CounterAmount", oldValue + i + 1);
|
||||
getGame().getTriggerHandler().runTriggerOld(
|
||||
runParams.put(AbilityKey.CounterAmount, oldValue + i + 1);
|
||||
getGame().getTriggerHandler().runTrigger(
|
||||
TriggerType.CounterAdded, Maps.newHashMap(runParams), false);
|
||||
}
|
||||
if (addAmount > 0) {
|
||||
runParams.put("CounterAmount", addAmount);
|
||||
getGame().getTriggerHandler().runTriggerOld(
|
||||
runParams.put(AbilityKey.CounterAmount, addAmount);
|
||||
getGame().getTriggerHandler().runTrigger(
|
||||
TriggerType.CounterAddedOnce, Maps.newHashMap(runParams), false);
|
||||
}
|
||||
} else {
|
||||
@@ -4900,17 +4898,17 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
source.addDealtDamageToThisTurn(this, damageIn);
|
||||
|
||||
// Run triggers
|
||||
final Map<String, Object> runParams = Maps.newTreeMap();
|
||||
runParams.put("DamageSource", source);
|
||||
runParams.put("DamageTarget", this);
|
||||
runParams.put("DamageAmount", damageIn);
|
||||
runParams.put("IsCombatDamage", isCombat);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.DamageSource, source);
|
||||
runParams.put(AbilityKey.DamageTarget, this);
|
||||
runParams.put(AbilityKey.DamageAmount, damageIn);
|
||||
runParams.put(AbilityKey.IsCombatDamage, isCombat);
|
||||
if (!isCombat) {
|
||||
runParams.put("SpellAbilityStackInstance", game.stack.peek());
|
||||
runParams.put(AbilityKey.SpellAbilityStackInstance, game.stack.peek());
|
||||
}
|
||||
// Defending player at the time the damage was dealt
|
||||
runParams.put("DefendingPlayer", game.getCombat() != null ? game.getCombat().getDefendingPlayerRelatedTo(source) : null);
|
||||
getGame().getTriggerHandler().runTriggerOld(TriggerType.DamageDone, runParams, false);
|
||||
runParams.put(AbilityKey.DefendingPlayer, game.getCombat() != null ? game.getCombat().getDefendingPlayerRelatedTo(source) : null);
|
||||
getGame().getTriggerHandler().runTrigger(TriggerType.DamageDone, runParams, false);
|
||||
|
||||
GameEventCardDamaged.DamageType damageType = DamageType.Normal;
|
||||
if (isPlaneswalker()) {
|
||||
|
||||
Reference in New Issue
Block a user