diff --git a/Mage.Client/src/main/java/mage/client/dialog/TestCardRenderDialog.java b/Mage.Client/src/main/java/mage/client/dialog/TestCardRenderDialog.java index 7ddeecaeae5..0ec715dc174 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/TestCardRenderDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/TestCardRenderDialog.java @@ -87,7 +87,7 @@ public class TestCardRenderDialog extends MageDialog { game.loadCards(cardsList, controllerId); PermanentCard perm = new PermanentCard(card, controllerId, game); - if (damage > 0) perm.damage(damage, controllerId, game); + if (damage > 0) perm.damage(damage, controllerId, null, game); if (power > 0) perm.getPower().setValue(power); if (toughness > 0) perm.getToughness().setValue(toughness); perm.removeSummoningSickness(); diff --git a/Mage.Common/src/main/java/mage/view/PermanentView.java b/Mage.Common/src/main/java/mage/view/PermanentView.java index 312e1c9e8f2..2031e797ee0 100644 --- a/Mage.Common/src/main/java/mage/view/PermanentView.java +++ b/Mage.Common/src/main/java/mage/view/PermanentView.java @@ -94,7 +94,7 @@ public class PermanentView extends CardView { if (permanent.isFaceDown(game) && card != null) { if (controlled) { // must be a morphed or manifested card - for (Ability permanentAbility : permanent.getAbilities()) { + for (Ability permanentAbility : permanent.getAbilities(game)) { if (permanentAbility.getWorksFaceDown()) { this.rules.add(permanentAbility.getRule(true)); } else if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) { diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index 77f7ecfdf91..caed86ffc6b 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -161,7 +161,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { for (UUID id : target.getTargets()) { target.updateTarget(id, game); if (!target.isNotTarget()) { - game.addSimultaneousEvent(GameEvent.getEvent(GameEvent.EventType.TARGETED, id, ability.getSourceId(), ability.getControllerId())); + game.addSimultaneousEvent(GameEvent.getEvent(GameEvent.EventType.TARGETED, id, ability, ability.getControllerId())); } } } @@ -910,7 +910,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { logger.debug("selectBlockers"); declareBlockers(game, playerId); } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java index 771dc4afcd1..833c18210f0 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java @@ -398,7 +398,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { logger.debug("simulating -- triggered ability:" + ability); game.getStack().push(new StackAbility(ability, playerId)); if (ability.activate(game, false) && ability.isUsesStack()) { - game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability, ability.getControllerId())); } game.applyEffects(); game.getPlayers().resetPassed(); @@ -420,7 +420,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { Game sim = game.copy(); sim.getStack().push(new StackAbility(ability, playerId)); if (ability.activate(sim, false) && ability.isUsesStack()) { - game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability, ability.getControllerId())); } sim.applyEffects(); SimulationNode2 newNode = new SimulationNode2(parent, sim, depth, playerId); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java index ccd5a439c8f..361ac57a6a2 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java @@ -68,14 +68,14 @@ public final class ArtificialScoringSystem { int score = permanent.getCounters(game).getCount(CounterType.CHARGE) * 30; score += permanent.getCounters(game).getCount(CounterType.LEVEL) * 30; score -= permanent.getDamage() * 2; - if (!canTap(permanent)) { + if (!canTap(permanent, game)) { score += getTappedScore(permanent); } if (permanent.getCardType().contains(CardType.CREATURE)) { final int power = permanent.getPower().getValue(); final int toughness = permanent.getToughness().getValue(); int abilityScore = 0; - for (Ability ability : permanent.getAbilities()) { + for (Ability ability : permanent.getAbilities(game)) { abilityScore += MagicAbility.getAbilityScore(ability); } score += power * 300 + getPositive(toughness) * 200 + abilityScore * (getPositive(power) + 1) / 2; @@ -85,7 +85,7 @@ public final class ArtificialScoringSystem { MageObject object = game.getObject(uuid); if (object instanceof Card) { Card card = (Card) object; - int outcomeScore = object.getAbilities().getOutcomeTotal(); + int outcomeScore = card.getAbilities(game).getOutcomeTotal(); if (card.getCardType().contains(CardType.ENCHANTMENT)) { enchantments = enchantments + outcomeScore * 100; } else { @@ -106,15 +106,15 @@ public final class ArtificialScoringSystem { return score; } - private static boolean canTap(Permanent permanent) { + private static boolean canTap(Permanent permanent, Game game) { return !permanent.isTapped() && (!permanent.hasSummoningSickness() || !permanent.getCardType().contains(CardType.CREATURE) - || permanent.getAbilities().contains(HasteAbility.getInstance())); + || permanent.getAbilities(game).contains(HasteAbility.getInstance())); } private static int getPositive(int value) { - return value > 0 ? value : 0; + return Math.max(0, value); } public static int getTappedScore(final Permanent permanent) { diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java index 3d0fe4e6bf7..b292321382a 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java @@ -354,28 +354,6 @@ public final class CombatUtil { if (attacker.getToughness().getValue() <= blocker.getPower().getValue()) { sim.getBattlefield().removePermanent(attacker.getId()); } - - /* - sim.getPlayer(defendingPlayerId).declareBlocker(blocker.getId(), attacker.getId(), sim); - sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defendingPlayerId, defendingPlayerId)); - - sim.checkStateAndTriggered(); - while (!sim.getStack().isEmpty()) { - sim.getStack().resolve(sim); - sim.applyEffects(); - } - sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKERS_STEP_POST, sim.getActivePlayerId(), sim.getActivePlayerId())); - - simulateStep(sim, new FirstCombatDamageStep()); - simulateStep(sim, new CombatDamageStep()); - simulateStep(sim, new EndOfCombatStep()); - // The following commented out call produces random freezes. - //sim.checkStateAndTriggered(); - while (!sim.getStack().isEmpty()) { - sim.getStack().resolve(sim); - sim.applyEffects(); - } - */ return new SurviveInfo(!sim.getBattlefield().containsPermanent(attacker.getId()), !sim.getBattlefield().containsPermanent(blocker.getId())); } diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 48376cafda8..0a26da7dc17 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -9,6 +9,8 @@ import mage.ConditionalMana; import mage.MageObject; import mage.Mana; import mage.abilities.*; +import mage.abilities.costs.AlternativeSourceCosts; +import mage.abilities.costs.OptionalAdditionalSourceCosts; import mage.abilities.costs.VariableCost; import mage.abilities.costs.mana.*; import mage.abilities.effects.Effect; @@ -1238,7 +1240,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { if (!isTestMode()) { // Test player already sends target event as they select the target for (Target target : ability.getModes().getMode().getTargets()) { for (UUID targetId : target.getTargets()) { - game.fireEvent(GameEvent.getEvent(EventType.TARGETED, targetId, ability.getId(), ability.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TARGETED, targetId, ability, ability.getControllerId())); } } } @@ -1250,10 +1252,17 @@ public class ComputerPlayer extends PlayerImpl implements Player { Set lands = new LinkedHashSet<>(); for (Card landCard : hand.getCards(new FilterLandCard(), game)) { // remove lands that can not be played - if (game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, landCard.getId(), landCard.getId(), playerId), null, game, true)) { - break; + boolean canPlay = false; + for (Ability ability : landCard.getAbilities(game)) { + if (ability instanceof PlayLandAbility) { + if (!game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, landCard.getId(), ability, playerId), null, game, true)) { + canPlay = true; + } + } + } + if (canPlay) { + lands.add(landCard); } - lands.add(landCard); } while (!lands.isEmpty() && this.canPlayLand()) { if (lands.size() == 1) { @@ -1321,7 +1330,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { if (mana.enough(avail)) { SpellAbility ability = card.getSpellAbility(); if (ability != null && ability.canActivate(playerId, game).canActivate() - && !game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), ability.getSourceId(), playerId), ability, game, true)) { + && !game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), ability, playerId), ability, game, true)) { if (card.getCardType().contains(CardType.INSTANT) || card.hasAbility(FlashAbility.getInstance(), game)) { playableInstant.add(card); @@ -1534,7 +1543,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { // pay phyrexian life costs if (cost instanceof PhyrexianManaCost) { - return cost.pay(null, game, null, playerId, false, null) || approvingObject != null; + return cost.pay(ability, game, ability, playerId, false, null) || approvingObject != null; } // pay special mana like convoke cost (tap for pay) @@ -1899,7 +1908,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { log.debug("selectBlockers"); List blockers = getAvailableBlockers(game); @@ -1955,10 +1964,10 @@ public class ComputerPlayer extends PlayerImpl implements Player { } @Override - public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { + public void assignDamage(int damage, List targets, String singleTargetName, UUID attackerId, Ability source, Game game) { log.debug("assignDamage"); //TODO: improve this - game.getPermanent(targets.get(0)).damage(damage, sourceId, game); + game.getPermanent(targets.get(0)).damage(damage, attackerId, source, game); } @Override diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java index 08fcecdd00d..f895228e325 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java @@ -194,7 +194,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { StringBuilder sb = new StringBuilder(); sb.append(game.getTurn().getValue(game.getTurnNum())).append(" player ").append(name).append(" blocking: "); getNextAction(game, NextAction.SELECT_BLOCKERS); @@ -219,41 +219,6 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player { MCTSNode.logHitMiss(); } -// @Override -// public UUID chooseAttackerOrder(List attacker, Game game) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public UUID chooseBlockerOrder(List blockers, Game game) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public int getAmount(int min, int max, String message, Game game) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public void sideboard(Match match, Deck deck) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public void construct(Tournament tournament, Deck deck) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public void pickCard(List cards, Deck deck, Draft draft) { -// throw new UnsupportedOperationException("Not supported yet."); -// } - protected long totalThinkTime = 0; protected long totalSimulations = 0; diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java index bdd731ffc40..36cec441e62 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java @@ -178,74 +178,11 @@ public class MCTSPlayer extends ComputerPlayer { @Override public boolean priority(Game game) { -// logger.info("Paused for Priority for player:" + getName()); game.pause(); nextAction = NextAction.PRIORITY; return false; } -// @Override -// public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game) { -// game.end(); -// } -// -// @Override -// public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map options) { -// game.end(); -// } -// -// @Override -// public boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game) { -// game.end(); -// } -// -// @Override -// public boolean chooseTarget(Outcome outcome, Target target, Ability source, Game game) { -// game.end(); -// } -// -// @Override -// public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) { -// game.end(); -// } -// -// @Override -// public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) { -// game.end(); -// } -// -// @Override -// public boolean chooseMulligan(Game game) { -// game.end(); -// } -// -// @Override -// public boolean chooseUse(Outcome outcome, String message, Game game) { -// game.pause(); -// nextAction = NextAction.CHOOSE_USE; -// return false; -// } -// -// @Override -// public boolean choose(Outcome outcome, Choice choice, Game game) { -// game.end(); -// } -// -// @Override -// public int chooseEffect(List rEffects, Game game) { -// game.end(); -// } -// -// @Override -// public TriggeredAbility chooseTriggeredAbility(TriggeredAbilities abilities, Game game) { -// game.end(); -// } -// -// @Override -// public Mode chooseMode(Modes modes, Ability source, Game game) { -// game.end(); -// } - @Override public void selectAttackers(Game game, UUID attackingPlayerId) { game.pause(); @@ -253,29 +190,8 @@ public class MCTSPlayer extends ComputerPlayer { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { game.pause(); nextAction = NextAction.SELECT_BLOCKERS; } - -// @Override -// public UUID chooseAttackerOrder(List attacker, Game game) { -// game.end(); -// } -// -// @Override -// public UUID chooseBlockerOrder(List blockers, Game game) { -// game.end(); -// } -// -// @Override -// public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { -// game.end(); -// } -// -// @Override -// public int getAmount(int min, int max, String message, Game game) { -// game.end(); -// } - } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java index 957f43e5ac1..031eaf16f45 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java @@ -133,7 +133,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { if (ability.isUsesStack()) { game.getStack().push(new StackAbility(ability, playerId)); if (ability.activate(game, false)) { - game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability, ability.getControllerId())); actionCount++; return true; } @@ -174,7 +174,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { // logger.info("select blockers"); int numGroups = game.getCombat().getGroups().size(); if (numGroups == 0) { @@ -403,7 +403,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { } @Override - public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { + public void assignDamage(int damage, List targets, String singleTargetName, UUID attackerId, Ability source, Game game) { if (this.isHuman()) { int remainingDamage = damage; UUID targetId; @@ -418,19 +418,19 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { } Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(amount, sourceId, game, false, true); + permanent.damage(amount, attackerId, source, game, false, true); remainingDamage -= amount; } else { Player player = game.getPlayer(targetId); if (player != null) { - player.damage(amount, sourceId, game); + player.damage(amount, attackerId, source, game); remainingDamage -= amount; } } targets.remove(targetId); } } else { - super.assignDamage(damage, targets, singleTargetName, sourceId, game); + super.assignDamage(damage, targets, singleTargetName, attackerId, source, game); } } diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index 7a912d8adef..6a6e2d642ee 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -642,7 +642,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { logger.debug("selectBlockers"); if (combat != null && !combat.getGroups().isEmpty()) { List groups = game.getCombat().getGroups(); diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java index 4b141ec80a5..06063ae92ec 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java @@ -214,7 +214,7 @@ public class SimulatedPlayer extends ComputerPlayer { logger.debug("simulating -- triggered ability:" + ability); game.getStack().push(new StackAbility(ability, playerId)); if (ability.activate(game, false) && ability.isUsesStack()) { - game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability, ability.getControllerId())); } game.applyEffects(); game.getPlayers().resetPassed(); @@ -235,7 +235,7 @@ public class SimulatedPlayer extends ComputerPlayer { sim.getStack().push(new StackAbility(ability, playerId)); ability.activate(sim, false); if (ability.activate(sim, false) && ability.isUsesStack()) { - game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability, ability.getControllerId())); } sim.applyEffects(); SimulationNode newNode = new SimulationNode(parent, sim, playerId); diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index a0ca6be9b5a..1591e9ba530 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -42,6 +42,7 @@ import mage.game.Game; import mage.game.GameImpl; import mage.game.combat.CombatGroup; import mage.game.draft.Draft; +import mage.game.events.DeclareAttackerEvent; import mage.game.events.GameEvent; import mage.game.match.Match; import mage.game.permanent.Permanent; @@ -1464,8 +1465,7 @@ public class HumanPlayer extends PlayerImpl { } for (Permanent attacker : game.getBattlefield().getAllActivePermanents(filterCreatureForCombat, getId(), game)) { if (game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects( - GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, - attackedDefender, attacker.getId(), attacker.getControllerId()), game)) { + new DeclareAttackerEvent(attackedDefender, attacker.getId(), attacker.getControllerId()), game)) { continue; } // if attacker needs a specific defender to attack so select that one instead @@ -1560,8 +1560,7 @@ public class HumanPlayer extends PlayerImpl { for (Permanent attacker : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, getId(), game)) { if (game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects( - GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, - forcedToAttackId, attacker.getId(), attacker.getControllerId()), game)) { + new DeclareAttackerEvent(forcedToAttackId, attacker.getId(), attacker.getControllerId()), game)) { continue; } // if attacker needs a specific defender to attack so select that one instead @@ -1657,7 +1656,7 @@ public class HumanPlayer extends PlayerImpl { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { if (gameInCheckPlayableState(game)) { return; } @@ -1813,7 +1812,7 @@ public class HumanPlayer extends PlayerImpl { } @Override - public void assignDamage(int damage, java.util.List targets, String singleTargetName, UUID sourceId, Game game) { + public void assignDamage(int damage, java.util.List targets, String singleTargetName, UUID attackerId, Ability source, Game game) { updateGameStatePriority("assignDamage", game); int remainingDamage = damage; while (remainingDamage > 0 && canRespond()) { @@ -1822,17 +1821,17 @@ public class HumanPlayer extends PlayerImpl { if (singleTargetName != null) { target.setTargetName(singleTargetName); } - choose(Outcome.Damage, target, sourceId, game); + choose(Outcome.Damage, target, source.getSourceId(), game); if (targets.isEmpty() || targets.contains(target.getFirstTarget())) { int damageAmount = getAmount(0, remainingDamage, "Select amount", game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.damage(damageAmount, sourceId, game, false, true); + permanent.damage(damageAmount, attackerId, source, game, false, true); remainingDamage -= damageAmount; } else { Player player = game.getPlayer(target.getFirstTarget()); if (player != null) { - player.damage(damageAmount, sourceId, game); + player.damage(damageAmount, attackerId, source, game); remainingDamage -= damageAmount; } } diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java index eb116925a87..f9536489e51 100644 --- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java @@ -3,8 +3,10 @@ package mage.server.util; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; +import mage.abilities.effects.common.InfoEffect; import mage.cards.Card; import mage.cards.repository.CardCriteria; import mage.cards.repository.CardInfo; @@ -245,10 +247,6 @@ public final class SystemUtil { return com; } - public static void addCardsForTesting(Game game) { - addCardsForTesting(game, null, null); - } - /** * Replaces cards in player's hands by specified in config/init.txt.
*
@@ -268,6 +266,10 @@ public final class SystemUtil { */ public static void addCardsForTesting(Game game, String fileSource, Player feedbackPlayer) { + // fake test ability for triggers and events + Ability fakeSourceAbility = new SimpleStaticAbility(Zone.OUTSIDE, new InfoEffect("adding testing cards")); + fakeSourceAbility.setControllerId(feedbackPlayer.getId()); + try { String fileName = fileSource; if (fileName == null) { @@ -341,31 +343,25 @@ public final class SystemUtil { // need to ask logger.info("Found " + groups.size() + " groups. Need to select."); - if (feedbackPlayer != null) { - // choice dialog - Map list = new LinkedHashMap<>(); - Map sort = new LinkedHashMap<>(); - for (Integer i = 0; i < groups.size(); i++) { - list.put(Integer.toString(i + 1), groups.get(i).getPrintNameWithStats()); - sort.put(Integer.toString(i + 1), i); - } - - Choice groupChoice = new ChoiceImpl(false); - groupChoice.setMessage("Choose commands group to run"); - groupChoice.setKeyChoices(list); - groupChoice.setSortData(sort); - - if (feedbackPlayer.choose(Outcome.Benefit, groupChoice, game)) { - String need = groupChoice.getChoiceKey(); - if ((need != null) && list.containsKey(need)) { - runGroup = groups.get(Integer.parseInt(need) - 1); - } - } - } else { - // select default - runGroup = groups.get(0); + // choice dialog + Map list = new LinkedHashMap<>(); + Map sort = new LinkedHashMap<>(); + for (int i = 0; i < groups.size(); i++) { + list.put(Integer.toString(i + 1), groups.get(i).getPrintNameWithStats()); + sort.put(Integer.toString(i + 1), i); } + Choice groupChoice = new ChoiceImpl(false); + groupChoice.setMessage("Choose commands group to run"); + groupChoice.setKeyChoices(list); + groupChoice.setSortData(sort); + + if (feedbackPlayer.choose(Outcome.Benefit, groupChoice, game)) { + String need = groupChoice.getChoiceKey(); + if ((need != null) && list.containsKey(need)) { + runGroup = groups.get(Integer.parseInt(need) - 1); + } + } } if (runGroup == null) { @@ -381,85 +377,79 @@ public final class SystemUtil { Player opponent = game.getPlayer(game.getOpponents(feedbackPlayer.getId()).iterator().next()); + String info; switch (runGroup.name) { case COMMAND_SHOW_OPPONENT_HAND: if (opponent != null) { - String info = getCardsListForSpecialInform(game, opponent.getHand(), runGroup.commands); + info = getCardsListForSpecialInform(game, opponent.getHand(), runGroup.commands); game.informPlayer(feedbackPlayer, info); } break; case COMMAND_SHOW_OPPONENT_LIBRARY: if (opponent != null) { - String info = getCardsListForSpecialInform(game, opponent.getLibrary().getCardList(), runGroup.commands); + info = getCardsListForSpecialInform(game, opponent.getLibrary().getCardList(), runGroup.commands); game.informPlayer(feedbackPlayer, info); } break; case COMMAND_SHOW_MY_HAND: - if (feedbackPlayer != null) { - String info = getCardsListForSpecialInform(game, feedbackPlayer.getHand(), runGroup.commands); + info = getCardsListForSpecialInform(game, feedbackPlayer.getHand(), runGroup.commands); game.informPlayer(feedbackPlayer, info); - } break; case COMMAND_SHOW_MY_LIBRARY: - if (feedbackPlayer != null) { - String info = getCardsListForSpecialInform(game, feedbackPlayer.getLibrary().getCardList(), runGroup.commands); + info = getCardsListForSpecialInform(game, feedbackPlayer.getLibrary().getCardList(), runGroup.commands); game.informPlayer(feedbackPlayer, info); - } break; case COMMAND_ACTIVATE_OPPONENT_ABILITY: // WARNING, maybe very bugged if called in wrong priority // uses choose triggered ability dialog to select it - if (feedbackPlayer != null) { - UUID savedPriorityPlayer = null; - if (game.getActivePlayerId() != opponent.getId()) { - savedPriorityPlayer = game.getActivePlayerId(); - } + UUID savedPriorityPlayer = null; + if (game.getActivePlayerId() != opponent.getId()) { + savedPriorityPlayer = game.getActivePlayerId(); + } - // change active player to find and play selected abilities (it's danger and buggy code) - if (savedPriorityPlayer != null) { - game.getState().setPriorityPlayerId(opponent.getId()); - game.firePriorityEvent(opponent.getId()); - } + // change active player to find and play selected abilities (it's danger and buggy code) + if (savedPriorityPlayer != null) { + game.getState().setPriorityPlayerId(opponent.getId()); + game.firePriorityEvent(opponent.getId()); + } - List abilities = opponent.getPlayable(game, true); - Map choices = new HashMap<>(); - abilities.forEach(ability -> { - MageObject object = ability.getSourceObject(game); - choices.put(ability.getId().toString(), object.getName() + ": " + ability.toString()); - }); - // TODO: set priority for us? - Choice choice = new ChoiceImpl(); - choice.setMessage("Choose playable ability to activate by opponent " + opponent.getName()); - choice.setKeyChoices(choices); - if (feedbackPlayer.choose(Outcome.Detriment, choice, game) && choice.getChoiceKey() != null) { - String needId = choice.getChoiceKey(); - Optional ability = abilities.stream().filter(a -> a.getId().toString().equals(needId)).findFirst(); - if (ability.isPresent()) { - // TODO: set priority for player? - ActivatedAbility activatedAbility = ability.get(); - game.informPlayers(feedbackPlayer.getLogName() + " as another player " + opponent.getLogName() - + " trying to force an activate ability: " + activatedAbility.getGameLogMessage(game)); - if (opponent.activateAbility(activatedAbility, game)) { - game.informPlayers("Force to activate ability: DONE"); - } else { - game.informPlayers("Force to activate ability: FAIL"); - } + List abilities = opponent.getPlayable(game, true); + Map choices = new HashMap<>(); + abilities.forEach(ability -> { + MageObject object = ability.getSourceObject(game); + choices.put(ability.getId().toString(), object.getName() + ": " + ability.toString()); + }); + // TODO: set priority for us? + Choice choice = new ChoiceImpl(); + choice.setMessage("Choose playable ability to activate by opponent " + opponent.getName()); + choice.setKeyChoices(choices); + if (feedbackPlayer.choose(Outcome.Detriment, choice, game) && choice.getChoiceKey() != null) { + String needId = choice.getChoiceKey(); + Optional ability = abilities.stream().filter(a -> a.getId().toString().equals(needId)).findFirst(); + if (ability.isPresent()) { + // TODO: set priority for player? + ActivatedAbility activatedAbility = ability.get(); + game.informPlayers(feedbackPlayer.getLogName() + " as another player " + opponent.getLogName() + + " trying to force an activate ability: " + activatedAbility.getGameLogMessage(game)); + if (opponent.activateAbility(activatedAbility, game)) { + game.informPlayers("Force to activate ability: DONE"); + } else { + game.informPlayers("Force to activate ability: FAIL"); } } - // restore original priority player - if (savedPriorityPlayer != null) { - game.getState().setPriorityPlayerId(savedPriorityPlayer); - game.firePriorityEvent(savedPriorityPlayer); - } + } + // restore original priority player + if (savedPriorityPlayer != null) { + game.getState().setPriorityPlayerId(savedPriorityPlayer); + game.firePriorityEvent(savedPriorityPlayer); } break; } - return; } @@ -508,7 +498,7 @@ public final class SystemUtil { Constructor cons = c.getConstructor(); Object token = cons.newInstance(); if (token instanceof mage.game.permanent.token.Token) { - ((mage.game.permanent.token.Token) token).putOntoBattlefield(command.Amount, game, null, player.getId(), false, false); + ((mage.game.permanent.token.Token) token).putOntoBattlefield(command.Amount, game, fakeSourceAbility, player.getId(), false, false); continue; } } else if ("emblem".equalsIgnoreCase(command.zone)) { @@ -528,7 +518,7 @@ public final class SystemUtil { } else if ("loyalty".equalsIgnoreCase(command.zone)) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(player.getId())) { if (perm.getName().equals(command.cardName) && perm.getCardType().contains(CardType.PLANESWALKER)) { - perm.addCounters(CounterType.LOYALTY.createInstance(command.Amount), null, game); + perm.addCounters(CounterType.LOYALTY.createInstance(command.Amount), fakeSourceAbility, game); } } continue; @@ -551,7 +541,7 @@ public final class SystemUtil { // move card from exile to stack for (Card card : cardsToLoad) { - putCardToZone(game, player, card, Zone.STACK); + putCardToZone(fakeSourceAbility, game, player, card, Zone.STACK); } continue; @@ -626,7 +616,7 @@ public final class SystemUtil { } else { // as other card for (Card card : cardsToLoad) { - putCardToZone(game, player, card, gameZone); + putCardToZone(fakeSourceAbility, game, player, card, gameZone); } } } @@ -636,13 +626,14 @@ public final class SystemUtil { } /** - * Put card to specified (battlefield zone will be tranformed to permanent with initialized effects) + * Put card to specified zone (battlefield zone will be tranformed to permanent with initialized effects) + * Use it for cheats and tests only */ - private static void putCardToZone(Game game, Player player, Card card, Zone zone) { + private static void putCardToZone(Ability source, Game game, Player player, Card card, Zone zone) { // TODO: replace by player.move? switch (zone) { case BATTLEFIELD: - CardUtil.putCardOntoBattlefieldWithEffects(game, card, player); + CardUtil.putCardOntoBattlefieldWithEffects(source, game, card, player); break; case LIBRARY: card.setZone(Zone.LIBRARY, game); diff --git a/Mage.Sets/src/mage/cards/a/AbolisherOfBloodlines.java b/Mage.Sets/src/mage/cards/a/AbolisherOfBloodlines.java index 24049d38b26..5adb55c4af7 100644 --- a/Mage.Sets/src/mage/cards/a/AbolisherOfBloodlines.java +++ b/Mage.Sets/src/mage/cards/a/AbolisherOfBloodlines.java @@ -73,7 +73,7 @@ class AbolisherOfBloodlinesAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TRANSFORMED; + return event.getType() == GameEvent.EventType.TRANSFORMED; } @Override diff --git a/Mage.Sets/src/mage/cards/a/Aboroth.java b/Mage.Sets/src/mage/cards/a/Aboroth.java index 859c35a523a..f02302c0728 100644 --- a/Mage.Sets/src/mage/cards/a/Aboroth.java +++ b/Mage.Sets/src/mage/cards/a/Aboroth.java @@ -49,8 +49,8 @@ class AborothCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(CounterType.M1M1.createInstance(), ability, game); this.paid = true; @@ -60,7 +60,7 @@ class AborothCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } diff --git a/Mage.Sets/src/mage/cards/a/AbyssalPersecutor.java b/Mage.Sets/src/mage/cards/a/AbyssalPersecutor.java index e22fbf203aa..4cb2c669588 100644 --- a/Mage.Sets/src/mage/cards/a/AbyssalPersecutor.java +++ b/Mage.Sets/src/mage/cards/a/AbyssalPersecutor.java @@ -59,13 +59,13 @@ class AbyssalPersecutorCannotWinEffect extends ContinuousRuleModifyingEffectImpl @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOSES || event.getType() == EventType.WINS ; + return event.getType() == GameEvent.EventType.LOSES || event.getType() == GameEvent.EventType.WINS ; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - if ((event.getType() == EventType.LOSES && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) - || (event.getType() == EventType.WINS && event.getPlayerId().equals(source.getControllerId()))) { + if ((event.getType() == GameEvent.EventType.LOSES && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) + || (event.getType() == GameEvent.EventType.WINS && event.getPlayerId().equals(source.getControllerId()))) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/AcademyResearchers.java b/Mage.Sets/src/mage/cards/a/AcademyResearchers.java index 9a1a2a29685..897f2ea4101 100644 --- a/Mage.Sets/src/mage/cards/a/AcademyResearchers.java +++ b/Mage.Sets/src/mage/cards/a/AcademyResearchers.java @@ -78,7 +78,7 @@ class AcademyResearchersEffect extends OneShotEffect { if (auraInHand != null) { game.getState().setValue("attachTo:" + auraInHand.getId(), academyResearchers); controller.moveCards(auraInHand, Zone.BATTLEFIELD, source, game); - if (academyResearchers.addAttachment(auraInHand.getId(), game)) { + if (academyResearchers.addAttachment(auraInHand.getId(), source, game)) { game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + academyResearchers.getLogName() + '.'); return true; } diff --git a/Mage.Sets/src/mage/cards/a/AccursedWitch.java b/Mage.Sets/src/mage/cards/a/AccursedWitch.java index 0bc6e8d72a2..1275d59be45 100644 --- a/Mage.Sets/src/mage/cards/a/AccursedWitch.java +++ b/Mage.Sets/src/mage/cards/a/AccursedWitch.java @@ -85,7 +85,7 @@ class AccursedWitchReturnTransformedEffect extends OneShotEffect { Card card = game.getCard(source.getSourceId()); if (card != null) { if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) { - attachTo.addAttachment(card.getId(), game); + attachTo.addAttachment(card.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/AcidicSoil.java b/Mage.Sets/src/mage/cards/a/AcidicSoil.java index 20892918fce..ce9e972a9c5 100644 --- a/Mage.Sets/src/mage/cards/a/AcidicSoil.java +++ b/Mage.Sets/src/mage/cards/a/AcidicSoil.java @@ -61,7 +61,7 @@ class AcidicSoilEffect extends OneShotEffect { } } if (amount > 0) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/a/AcolytesReward.java b/Mage.Sets/src/mage/cards/a/AcolytesReward.java index 61c892e4762..6c36b175613 100644 --- a/Mage.Sets/src/mage/cards/a/AcolytesReward.java +++ b/Mage.Sets/src/mage/cards/a/AcolytesReward.java @@ -11,6 +11,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetAnyTarget; @@ -83,11 +84,11 @@ class AcolytesRewardEffect extends PreventionEffectImpl { } else { amount = 0; } - GameEvent preventEvent = new PreventDamageEvent(source.getControllerId(), source.getSourceId(), source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage()); if (game.replaceEvent(preventEvent)) { return result; } - Permanent targetCreature = game.getPermanent(source.getFirstTarget()); + Permanent targetCreature = game.getPermanent(event.getTargetId()); if (targetCreature == null) { return result; } @@ -105,12 +106,11 @@ class AcolytesRewardEffect extends PreventionEffectImpl { return result; } game.informPlayers("Acolyte's Reward prevented " + toPrevent + " to " + targetCreature.getName()); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, - source.getControllerId(), source.getSourceId(), source.getControllerId(), toPrevent)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent)); Player targetPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (targetPlayer != null) { - targetPlayer.damage(toPrevent, source.getSourceId(), game); + targetPlayer.damage(toPrevent, source.getSourceId(), source, game); game.informPlayers("Acolyte's Reward deals " + toPrevent + " damage to " + targetPlayer.getLogName()); return result; } @@ -118,7 +118,7 @@ class AcolytesRewardEffect extends PreventionEffectImpl { if (targetDamageCreature == null) { return result; } - targetDamageCreature.damage(toPrevent, source.getSourceId(), game, false, true); + targetDamageCreature.damage(toPrevent, source.getSourceId(), source, game, false, true); game.informPlayers("Acolyte's Reward deals " + toPrevent + " damage to " + targetDamageCreature.getName()); return result; } diff --git a/Mage.Sets/src/mage/cards/a/AcornCatapult.java b/Mage.Sets/src/mage/cards/a/AcornCatapult.java index 7742ba3ae96..a693b1f77dc 100644 --- a/Mage.Sets/src/mage/cards/a/AcornCatapult.java +++ b/Mage.Sets/src/mage/cards/a/AcornCatapult.java @@ -72,7 +72,7 @@ class AcornCatapultEffect extends OneShotEffect { } if (player != null) { - new SquirrelToken().putOntoBattlefield(1, game, source.getSourceId(), player.getId()); + new SquirrelToken().putOntoBattlefield(1, game, source, player.getId()); return true; } diff --git a/Mage.Sets/src/mage/cards/a/ActOfAuthority.java b/Mage.Sets/src/mage/cards/a/ActOfAuthority.java index c1acf361ec1..58656ab2443 100644 --- a/Mage.Sets/src/mage/cards/a/ActOfAuthority.java +++ b/Mage.Sets/src/mage/cards/a/ActOfAuthority.java @@ -105,7 +105,7 @@ class ActOfAuthorityGainControlEffect extends ContinuousEffectImpl { permanent = game.getPermanent(targetPointer.getFirst(game, source)); } if (permanent != null) { - return permanent.changeControllerId(controller, game); + return permanent.changeControllerId(controller, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/a/AdNauseam.java b/Mage.Sets/src/mage/cards/a/AdNauseam.java index 743144cf13a..571d3360501 100644 --- a/Mage.Sets/src/mage/cards/a/AdNauseam.java +++ b/Mage.Sets/src/mage/cards/a/AdNauseam.java @@ -68,7 +68,7 @@ class AdNauseamEffect extends OneShotEffect { controller.moveCards(card, Zone.HAND, source, game); int cmc = card.getConvertedManaCost(); if (cmc > 0) { - controller.loseLife(cmc, game, false); + controller.loseLife(cmc, game, source, false); } controller.revealCards(sourceCard.getIdName() + " put into hand", new CardsImpl(card), game); diff --git a/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java b/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java index 134eaaabf50..30262f2afdd 100644 --- a/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java +++ b/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java @@ -44,9 +44,9 @@ public final class AdamaroFirstToDesire extends CardImpl { class MostCardsInOpponentsHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int maxCards = 0; - for (UUID opponentId : game.getOpponents(source.getControllerId())) { + for (UUID opponentId : game.getOpponents(sourceAbility.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { int cards = opponent.getHand().size(); diff --git a/Mage.Sets/src/mage/cards/a/AdarkarValkyrie.java b/Mage.Sets/src/mage/cards/a/AdarkarValkyrie.java index 4c8c7bc6cc9..78d70f6befa 100644 --- a/Mage.Sets/src/mage/cards/a/AdarkarValkyrie.java +++ b/Mage.Sets/src/mage/cards/a/AdarkarValkyrie.java @@ -115,7 +115,7 @@ class AdarkarValkyrieDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AdventureAwaits.java b/Mage.Sets/src/mage/cards/a/AdventureAwaits.java index 15121a41b94..ec7fc5b76c9 100644 --- a/Mage.Sets/src/mage/cards/a/AdventureAwaits.java +++ b/Mage.Sets/src/mage/cards/a/AdventureAwaits.java @@ -73,7 +73,7 @@ class AdventureAwaitsEffect extends OneShotEffect { player.putCardsOnBottomOfLibrary(cards, game, source, false); } else { player.putCardsOnBottomOfLibrary(cards, game, source, false); - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AeonChronicler.java b/Mage.Sets/src/mage/cards/a/AeonChronicler.java index 8b3f42378d0..d492d17d5c4 100644 --- a/Mage.Sets/src/mage/cards/a/AeonChronicler.java +++ b/Mage.Sets/src/mage/cards/a/AeonChronicler.java @@ -72,7 +72,7 @@ class AeonChroniclerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AetherBarrier.java b/Mage.Sets/src/mage/cards/a/AetherBarrier.java index d7b6233e9c6..bb6e522b4cf 100644 --- a/Mage.Sets/src/mage/cards/a/AetherBarrier.java +++ b/Mage.Sets/src/mage/cards/a/AetherBarrier.java @@ -61,7 +61,7 @@ class AetherBarrierEffect extends SacrificeEffect { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { Cost cost = ManaUtil.createManaCost(1, false); - if (!cost.pay(source, game, player.getId(), player.getId(), false)) { + if (!cost.pay(source, game, source, player.getId(), false)) { super.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/a/AetherCharge.java b/Mage.Sets/src/mage/cards/a/AetherCharge.java index 19bae2ec91d..b2f2265e817 100644 --- a/Mage.Sets/src/mage/cards/a/AetherCharge.java +++ b/Mage.Sets/src/mage/cards/a/AetherCharge.java @@ -61,7 +61,7 @@ class AetherChargeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -111,7 +111,7 @@ class AetherChargeEffect extends OneShotEffect { creature = (Permanent) game.getLastKnownInformation(creatureId, Zone.BATTLEFIELD); } if (creature != null) { - return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), 4, creature.getId(), game, false, true) > 0; + return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), 4, creature.getId(), source, game, false, true) > 0; } return false; } diff --git a/Mage.Sets/src/mage/cards/a/AetherRift.java b/Mage.Sets/src/mage/cards/a/AetherRift.java index 6708c49dc69..59b4c5f8fde 100644 --- a/Mage.Sets/src/mage/cards/a/AetherRift.java +++ b/Mage.Sets/src/mage/cards/a/AetherRift.java @@ -64,7 +64,7 @@ class AetherRiftEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Card card = controller.discardOne(true, source, game); + Card card = controller.discardOne(true, false, source, game); if (card != null && card.isCreature()) { Effect returnEffect = new ReturnFromGraveyardToBattlefieldTargetEffect(); returnEffect.setTargetPointer(new FixedTarget(card.getId())); diff --git a/Mage.Sets/src/mage/cards/a/AetherSnap.java b/Mage.Sets/src/mage/cards/a/AetherSnap.java index 85fbc68ead8..e49176ad9e1 100644 --- a/Mage.Sets/src/mage/cards/a/AetherSnap.java +++ b/Mage.Sets/src/mage/cards/a/AetherSnap.java @@ -72,7 +72,7 @@ class AetherSnapEffect extends OneShotEffect { } Counters counters = permanent.getCounters(game).copy(); for (Counter counter : counters.values()) { - permanent.removeCounters(counter, game); + permanent.removeCounters(counter, source, game); } } controller.moveCards(tokens, Zone.EXILED, source, game); diff --git a/Mage.Sets/src/mage/cards/a/AetherSting.java b/Mage.Sets/src/mage/cards/a/AetherSting.java index aec4593bbbb..f78a22c747f 100644 --- a/Mage.Sets/src/mage/cards/a/AetherSting.java +++ b/Mage.Sets/src/mage/cards/a/AetherSting.java @@ -55,7 +55,7 @@ class AetherStingTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java index 8c51ac17535..a4ee9250cdf 100644 --- a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java +++ b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java @@ -92,7 +92,7 @@ class AetherbornMarauderEffect extends OneShotEffect { numberToMove = controller.getAmount(0, numberOfCounters, "How many +1/+1 counters do you want to move?", game); } if (numberToMove > 0) { - fromPermanent.removeCounters(CounterType.P1P1.createInstance(numberToMove), game); + fromPermanent.removeCounters(CounterType.P1P1.createInstance(numberToMove), source, game); sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), source, game); } } diff --git a/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java b/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java index ef556cbad1d..629de2800eb 100644 --- a/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java +++ b/Mage.Sets/src/mage/cards/a/AethergeodeMiner.java @@ -70,10 +70,10 @@ class AethergeodeMinerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Aethergeode Miner", source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), "Aethergeode Miner", source, game)) { Card card = game.getExile().getCard(source.getSourceId(), game); if (card != null) { - return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + return card.moveToZone(Zone.BATTLEFIELD, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/a/Aetherspouts.java b/Mage.Sets/src/mage/cards/a/Aetherspouts.java index 20c3cbd87e6..2a41ba740bc 100644 --- a/Mage.Sets/src/mage/cards/a/Aetherspouts.java +++ b/Mage.Sets/src/mage/cards/a/Aetherspouts.java @@ -127,7 +127,7 @@ class AetherspoutsEffect extends OneShotEffect { } // move all permanents to lib at the same time for (Permanent permanent : toLibrary) { - player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, false); + player.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, true, false); } // cards to bottom cards.clear(); @@ -165,7 +165,7 @@ class AetherspoutsEffect extends OneShotEffect { } // move all permanents to lib at the same time for (Permanent permanent : toLibrary) { - player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, false, false); + player.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, false, false); } player = playerList.getNext(game, false); } while (player != null && !player.getId().equals(game.getActivePlayerId()) && activePlayer.canRespond()); diff --git a/Mage.Sets/src/mage/cards/a/AfiyaGrove.java b/Mage.Sets/src/mage/cards/a/AfiyaGrove.java index 2bd3e4bb60c..d9c6cd8aba1 100644 --- a/Mage.Sets/src/mage/cards/a/AfiyaGrove.java +++ b/Mage.Sets/src/mage/cards/a/AfiyaGrove.java @@ -76,7 +76,7 @@ class MoveCounterToTargetFromSourceEffect extends OneShotEffect { if (sourceObject != null && controller != null) { Permanent toPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (toPermanent != null && sourceObject.getCounters(game).getCount(CounterType.P1P1) > 0) { - sourceObject.removeCounters(CounterType.P1P1.createInstance(), game); + sourceObject.removeCounters(CounterType.P1P1.createInstance(), source, game); toPermanent.addCounters(CounterType.P1P1.createInstance(), source, game); game.informPlayers("Moved a +1/+1 counter from " + sourceObject.getLogName() + " to " + toPermanent.getLogName()); } diff --git a/Mage.Sets/src/mage/cards/a/Afterlife.java b/Mage.Sets/src/mage/cards/a/Afterlife.java index ba29b8b5784..a2fed4870dc 100644 --- a/Mage.Sets/src/mage/cards/a/Afterlife.java +++ b/Mage.Sets/src/mage/cards/a/Afterlife.java @@ -60,7 +60,7 @@ class AfterlifeEffect extends OneShotEffect { Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (permanent != null) { SpiritWhiteToken token = new SpiritWhiteToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); + token.putOntoBattlefield(1, game, source, permanent.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AgadeemOccultist.java b/Mage.Sets/src/mage/cards/a/AgadeemOccultist.java index 5f0b20db6cf..4b1ee638d2c 100644 --- a/Mage.Sets/src/mage/cards/a/AgadeemOccultist.java +++ b/Mage.Sets/src/mage/cards/a/AgadeemOccultist.java @@ -81,7 +81,7 @@ class AgadeemOccultistEffect extends OneShotEffect { TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(1, 1, filter); if (controller != null) { - if (target.canChoose(source.getControllerId(), game) + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.GainControl, target, source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/a/AgadeemsAwakening.java b/Mage.Sets/src/mage/cards/a/AgadeemsAwakening.java index c42c81fdfba..40a3c19d78f 100644 --- a/Mage.Sets/src/mage/cards/a/AgadeemsAwakening.java +++ b/Mage.Sets/src/mage/cards/a/AgadeemsAwakening.java @@ -100,8 +100,8 @@ class AgadeemsAwakeningTarget extends TargetCardInYourGraveyard { } @Override - public Set possibleTargets(UUID sourceId, UUID playerId, Game game) { - Set possibleTargets = super.possibleTargets(sourceId, playerId, game); + public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { + Set possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set cmcs = this.getTargets() .stream() .map(game::getCard) diff --git a/Mage.Sets/src/mage/cards/a/AgentOfMasks.java b/Mage.Sets/src/mage/cards/a/AgentOfMasks.java index d79877e4fb3..752c9a4cfa7 100644 --- a/Mage.Sets/src/mage/cards/a/AgentOfMasks.java +++ b/Mage.Sets/src/mage/cards/a/AgentOfMasks.java @@ -55,7 +55,7 @@ class AgentOfMasksEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int loseLife = 0; for (UUID opponentId : game.getOpponents(source.getControllerId())) { - loseLife += game.getPlayer(opponentId).loseLife(1, game, false); + loseLife += game.getPlayer(opponentId).loseLife(1, game, source, false); } if (loseLife > 0) game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source); diff --git a/Mage.Sets/src/mage/cards/a/AgonizingMemories.java b/Mage.Sets/src/mage/cards/a/AgonizingMemories.java index 982f875328f..8f4327e5551 100644 --- a/Mage.Sets/src/mage/cards/a/AgonizingMemories.java +++ b/Mage.Sets/src/mage/cards/a/AgonizingMemories.java @@ -75,7 +75,7 @@ class AgonizingMemoriesEffect extends OneShotEffect { if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); if (card != null) { - targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + targetPlayer.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } } diff --git a/Mage.Sets/src/mage/cards/a/AgonizingRemorse.java b/Mage.Sets/src/mage/cards/a/AgonizingRemorse.java index 2b4c26c059c..dd48a4421c7 100644 --- a/Mage.Sets/src/mage/cards/a/AgonizingRemorse.java +++ b/Mage.Sets/src/mage/cards/a/AgonizingRemorse.java @@ -89,7 +89,7 @@ class AgonizingRemorseEffect extends OneShotEffect { return true; } controller.moveCards(card, Zone.EXILED, source, game); - controller.loseLife(1, game, false); + controller.loseLife(1, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/a/AjanisChosen.java b/Mage.Sets/src/mage/cards/a/AjanisChosen.java index 9b550d378cb..f5bc05b79d5 100644 --- a/Mage.Sets/src/mage/cards/a/AjanisChosen.java +++ b/Mage.Sets/src/mage/cards/a/AjanisChosen.java @@ -66,7 +66,7 @@ class AjanisChosenEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Token token = new CatToken(); - if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) { + if (token.putOntoBattlefield(1, game, source, source.getControllerId())) { Permanent enchantment = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (enchantment != null && enchantment.hasSubtype(SubType.AURA, game)) { for (UUID tokenId : token.getLastAddedTokenIds()) { @@ -77,8 +77,8 @@ class AjanisChosenEffect extends OneShotEffect { boolean canAttach = enchantment.getSpellAbility() == null || (!enchantment.getSpellAbility().getTargets().isEmpty() && enchantment.getSpellAbility().getTargets().get(0).canTarget(tokenPermanent.getId(), game)); if (canAttach && controller.chooseUse(Outcome.Neutral, "Attach " + enchantment.getName() + " to the token ?", source, game)) { - if (oldCreature.removeAttachment(enchantment.getId(), game)) { - tokenPermanent.addAttachment(enchantment.getId(), game); + if (oldCreature.removeAttachment(enchantment.getId(), source, game)) { + tokenPermanent.addAttachment(enchantment.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/a/AkiriFearlessVoyager.java b/Mage.Sets/src/mage/cards/a/AkiriFearlessVoyager.java index 554facea924..84db60a03cd 100644 --- a/Mage.Sets/src/mage/cards/a/AkiriFearlessVoyager.java +++ b/Mage.Sets/src/mage/cards/a/AkiriFearlessVoyager.java @@ -170,8 +170,8 @@ class AkiriFearlessVoyagerEffect extends OneShotEffect { if (creature == null) { return false; } - creature.removeAttachment(equipment.getId(), game); - creature.tap(game); + creature.removeAttachment(equipment.getId(), source, game); + creature.tap(source, game); game.addEffect(new GainAbilityTargetEffect( IndestructibleAbility.getInstance(), Duration.EndOfTurn ).setTargetPointer(new FixedTarget(creature, game)), source); diff --git a/Mage.Sets/src/mage/cards/a/AkkiLavarunner.java b/Mage.Sets/src/mage/cards/a/AkkiLavarunner.java index 39b3fe9a07e..27c7929e2d2 100644 --- a/Mage.Sets/src/mage/cards/a/AkkiLavarunner.java +++ b/Mage.Sets/src/mage/cards/a/AkkiLavarunner.java @@ -69,7 +69,7 @@ class AkkiLavarunnerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AkoumFlameseeker.java b/Mage.Sets/src/mage/cards/a/AkoumFlameseeker.java index c8cf5009c3d..58343669f23 100644 --- a/Mage.Sets/src/mage/cards/a/AkoumFlameseeker.java +++ b/Mage.Sets/src/mage/cards/a/AkoumFlameseeker.java @@ -78,9 +78,9 @@ class AkoumFlameseekerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Cards cards = controller.discard(1, false, source, game); + Cards cards = controller.discard(1, false, false, source, game); if (!cards.isEmpty()) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AkoumHellkite.java b/Mage.Sets/src/mage/cards/a/AkoumHellkite.java index 09d4da7474c..10bd65db106 100644 --- a/Mage.Sets/src/mage/cards/a/AkoumHellkite.java +++ b/Mage.Sets/src/mage/cards/a/AkoumHellkite.java @@ -119,18 +119,18 @@ class AkoumHellkiteDamageEffect extends OneShotEffect { Player player = game.getPlayer(source.getFirstTarget()); if (land != null && player != null) { if (land.hasSubtype(SubType.MOUNTAIN, game)) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } else { - player.damage(1, source.getSourceId(), game); + player.damage(1, source.getSourceId(), source, game); } return true; } Permanent permanent = game.getPermanent(source.getFirstTarget()); if (land != null && permanent != null) { if (land.hasSubtype(SubType.MOUNTAIN, game)) { - permanent.damage(2, source.getSourceId(), game); + permanent.damage(2, source.getSourceId(), source, game); } else { - permanent.damage(1, source.getSourceId(), game); + permanent.damage(1, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AkroanHorse.java b/Mage.Sets/src/mage/cards/a/AkroanHorse.java index b85272bfc62..d1c11373578 100644 --- a/Mage.Sets/src/mage/cards/a/AkroanHorse.java +++ b/Mage.Sets/src/mage/cards/a/AkroanHorse.java @@ -112,7 +112,7 @@ class AkroanHorseGainControlEffect extends ContinuousEffectImpl { permanent = game.getPermanent(targetPointer.getFirst(game, source)); } if (permanent != null) { - return permanent.changeControllerId(controller, game); + return permanent.changeControllerId(controller, game, source); } return false; } @@ -143,7 +143,7 @@ class AkroanHorseCreateTokenEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Token token = new SoldierToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), opponentId); + token.putOntoBattlefield(1, game, source, opponentId); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AladdinsLamp.java b/Mage.Sets/src/mage/cards/a/AladdinsLamp.java index 5fb6e9b43cb..234120c1120 100644 --- a/Mage.Sets/src/mage/cards/a/AladdinsLamp.java +++ b/Mage.Sets/src/mage/cards/a/AladdinsLamp.java @@ -75,7 +75,7 @@ class AladdinsLampEffect extends ReplacementEffectImpl { } controller.putCardsOnBottomOfLibrary(cards, game, source, false); game.getState().processAction(game); - controller.drawCards(1, event.getSourceId(), game, event.getAppliedEffects()); + controller.drawCards(1, source, game, event); discard(); return true; } diff --git a/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java b/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java index 75cadc9e6fd..9152b36d549 100644 --- a/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java +++ b/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java @@ -147,7 +147,7 @@ class AlhammarretHighArbiterCantCastEffect extends ContinuousRuleModifyingEffect @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL_LATE; + return event.getType() == GameEvent.EventType.CAST_SPELL_LATE; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java b/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java index b410035bf33..b1c0077a47d 100644 --- a/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java +++ b/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java @@ -9,6 +9,7 @@ import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; +import mage.util.CardUtil; import mage.watchers.common.CardsDrawnDuringDrawStepWatcher; import java.util.UUID; @@ -97,7 +98,7 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(2, event.getSourceId(), game, event.getAppliedEffects()); + controller.drawCards(2, source, game, event); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AllHallowsEve.java b/Mage.Sets/src/mage/cards/a/AllHallowsEve.java index 62e2cdcf704..d05bc89c799 100644 --- a/Mage.Sets/src/mage/cards/a/AllHallowsEve.java +++ b/Mage.Sets/src/mage/cards/a/AllHallowsEve.java @@ -73,9 +73,9 @@ class AllHallowsEveEffect extends OneShotEffect { if (allHallowsEve != null && controller != null && game.getExile().getCard(allHallowsEve.getId(), game) != null) { - allHallowsEve.removeCounters(CounterType.SCREAM.getName(), 1, game); + allHallowsEve.removeCounters(CounterType.SCREAM.getName(), 1, source, game); if (allHallowsEve.getCounters(game).getCount(CounterType.SCREAM) == 0) { - allHallowsEve.moveToZone(Zone.GRAVEYARD, source.getId(), game, false); + allHallowsEve.moveToZone(Zone.GRAVEYARD, source, game, false); for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { diff --git a/Mage.Sets/src/mage/cards/a/AllIsDust.java b/Mage.Sets/src/mage/cards/a/AllIsDust.java index d7cfaffe113..8430ecc3c07 100644 --- a/Mage.Sets/src/mage/cards/a/AllIsDust.java +++ b/Mage.Sets/src/mage/cards/a/AllIsDust.java @@ -50,7 +50,7 @@ class AllIsDustEffect extends OneShotEffect { List permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game); for (Permanent p : permanents) { if (!p.getColor(game).isColorless()) { - p.sacrifice(source.getSourceId(), game); + p.sacrifice(source, game); } } diff --git a/Mage.Sets/src/mage/cards/a/AlleyGrifters.java b/Mage.Sets/src/mage/cards/a/AlleyGrifters.java index bb0bbe0f547..3a2d5aa052c 100644 --- a/Mage.Sets/src/mage/cards/a/AlleyGrifters.java +++ b/Mage.Sets/src/mage/cards/a/AlleyGrifters.java @@ -64,7 +64,7 @@ class AlleyGriftersDiscardEffect extends OneShotEffect { if (blockingCreature != null) { Player opponent = game.getPlayer(blockingCreature.getControllerId()); if (opponent != null) { - opponent.discard(1, false, source, game); + opponent.discard(1, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/a/AlmsCollector.java b/Mage.Sets/src/mage/cards/a/AlmsCollector.java index 7413e549275..b487be58faf 100644 --- a/Mage.Sets/src/mage/cards/a/AlmsCollector.java +++ b/Mage.Sets/src/mage/cards/a/AlmsCollector.java @@ -74,8 +74,8 @@ class AlmsCollectorReplacementEffect extends ReplacementEffectImpl { Player controller = game.getPlayer(source.getControllerId()); Player opponent = game.getPlayer(event.getPlayerId()); if (controller != null && opponent != null) { - controller.drawCards(1, source.getSourceId(), game, event.getAppliedEffects()); - opponent.drawCards(1, source.getSourceId(), game, event.getAppliedEffects()); + controller.drawCards(1, source, game, event); + opponent.drawCards(1, source, game, event); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/AlphaBrawl.java b/Mage.Sets/src/mage/cards/a/AlphaBrawl.java index 758f0a75f82..b5beebd1187 100644 --- a/Mage.Sets/src/mage/cards/a/AlphaBrawl.java +++ b/Mage.Sets/src/mage/cards/a/AlphaBrawl.java @@ -68,10 +68,10 @@ class AlphaBrawlEffect extends OneShotEffect { if (player != null) { int power = creature.getPower().getValue(); for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) { - perm.damage(power, creature.getId(), game, false, true); + perm.damage(power, creature.getId(), source, game, false, true); } for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) { - creature.damage(perm.getPower().getValue(), perm.getId(), game, false, true); + creature.damage(perm.getPower().getValue(), perm.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AmassTheComponents.java b/Mage.Sets/src/mage/cards/a/AmassTheComponents.java index c3cdc37eced..0d9a34c6e69 100644 --- a/Mage.Sets/src/mage/cards/a/AmassTheComponents.java +++ b/Mage.Sets/src/mage/cards/a/AmassTheComponents.java @@ -63,7 +63,7 @@ class AmassTheComponentsEffect extends OneShotEffect { return false; } - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); if (!player.getHand().isEmpty()) { FilterCard filter = new FilterCard("card from your hand to put on the bottom of your library"); TargetCard target = new TargetCard(Zone.HAND, filter); diff --git a/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java b/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java index d2f3040e858..3da6151a018 100644 --- a/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java +++ b/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java @@ -98,7 +98,7 @@ class AminatouPlusEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); putOnLibrary(player, source, game); return true; } @@ -111,7 +111,7 @@ class AminatouPlusEffect extends OneShotEffect { player.chooseTarget(Outcome.ReturnToHand, target, source, game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - return player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + return player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/a/Amnesia.java b/Mage.Sets/src/mage/cards/a/Amnesia.java index b452e933bc8..85214e06e93 100644 --- a/Mage.Sets/src/mage/cards/a/Amnesia.java +++ b/Mage.Sets/src/mage/cards/a/Amnesia.java @@ -60,7 +60,7 @@ class AmnesiaEffect extends OneShotEffect { player.revealCards(source, hand, game); Set cards = hand.getCards(game); cards.removeIf(MageObject::isLand); - player.discard(new CardsImpl(cards), source, game); + player.discard(new CardsImpl(cards), false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/AmphinMutineer.java b/Mage.Sets/src/mage/cards/a/AmphinMutineer.java index 7a6467d532d..2415b26aca3 100644 --- a/Mage.Sets/src/mage/cards/a/AmphinMutineer.java +++ b/Mage.Sets/src/mage/cards/a/AmphinMutineer.java @@ -89,7 +89,7 @@ class AmphinMutineerEffect extends OneShotEffect { return false; } player.moveCards(permanent, Zone.EXILED, source, game); - new SalamnderWarriorToken().putOntoBattlefield(1, game, source.getSourceId(), player.getId()); + new SalamnderWarriorToken().putOntoBattlefield(1, game, source, player.getId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/a/AmuletOfVigor.java b/Mage.Sets/src/mage/cards/a/AmuletOfVigor.java index 0915957d35b..e0e8bc754e4 100644 --- a/Mage.Sets/src/mage/cards/a/AmuletOfVigor.java +++ b/Mage.Sets/src/mage/cards/a/AmuletOfVigor.java @@ -52,7 +52,7 @@ class AmuletOfVigorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AnaBattlemage.java b/Mage.Sets/src/mage/cards/a/AnaBattlemage.java index bed405a1977..7f6c1c97308 100644 --- a/Mage.Sets/src/mage/cards/a/AnaBattlemage.java +++ b/Mage.Sets/src/mage/cards/a/AnaBattlemage.java @@ -90,10 +90,10 @@ class AnaBattlemageKickerEffect extends OneShotEffect { boolean applied = false; Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { - applied = targetCreature.tap(game); + applied = targetCreature.tap(source, game); Player controller = game.getPlayer(targetCreature.getControllerId()); if (controller != null) { - controller.damage(targetCreature.getPower().getValue(), source.getSourceId(), game); + controller.damage(targetCreature.getPower().getValue(), source.getSourceId(), source, game); applied = true; } } diff --git a/Mage.Sets/src/mage/cards/a/AncestralBlade.java b/Mage.Sets/src/mage/cards/a/AncestralBlade.java index fff773546ff..3a138bc2b28 100644 --- a/Mage.Sets/src/mage/cards/a/AncestralBlade.java +++ b/Mage.Sets/src/mage/cards/a/AncestralBlade.java @@ -68,7 +68,7 @@ class AncestralBladeEffect extends CreateTokenEffect { if (p == null) { return false; } - p.addAttachment(source.getSourceId(), game); + p.addAttachment(source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/a/AncientExcavation.java b/Mage.Sets/src/mage/cards/a/AncientExcavation.java index 6aee0c9753c..7967d27995b 100644 --- a/Mage.Sets/src/mage/cards/a/AncientExcavation.java +++ b/Mage.Sets/src/mage/cards/a/AncientExcavation.java @@ -63,8 +63,8 @@ class AncientExcavationEffect extends OneShotEffect { if (player != null) { DynamicValue numCards = CardsInControllerHandCount.instance; int amount = numCards.calculate(game, source, this); - player.drawCards(amount, source.getSourceId(), game); - player.discard(amount, false, source, game); + player.drawCards(amount, source, game); + player.discard(amount, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/AncientRunes.java b/Mage.Sets/src/mage/cards/a/AncientRunes.java index 2aee93bb463..78d4a81a2da 100644 --- a/Mage.Sets/src/mage/cards/a/AncientRunes.java +++ b/Mage.Sets/src/mage/cards/a/AncientRunes.java @@ -58,7 +58,7 @@ class AncientRunesDamageTargetEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int damage = game.getBattlefield().getAllActivePermanents(new FilterControlledArtifactPermanent("artifacts"), targetPointer.getFirst(game, source), game).size(); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/AngelOfCondemnation.java b/Mage.Sets/src/mage/cards/a/AngelOfCondemnation.java index f82b5cbfe43..49844c676d0 100644 --- a/Mage.Sets/src/mage/cards/a/AngelOfCondemnation.java +++ b/Mage.Sets/src/mage/cards/a/AngelOfCondemnation.java @@ -99,7 +99,7 @@ class AngelOfCondemnationExileUntilEOTEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null && sourcePermanent != null) { - if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source, game, Zone.BATTLEFIELD, true)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("return that card to the battlefield under its owner's control"); diff --git a/Mage.Sets/src/mage/cards/a/AngelOfDeliverance.java b/Mage.Sets/src/mage/cards/a/AngelOfDeliverance.java index d238392b9b0..dbddf4e3556 100644 --- a/Mage.Sets/src/mage/cards/a/AngelOfDeliverance.java +++ b/Mage.Sets/src/mage/cards/a/AngelOfDeliverance.java @@ -82,9 +82,9 @@ class AngelOfDeliveranceDealsDamageTriggeredAbility extends TriggeredAbilityImpl @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AngelheartVial.java b/Mage.Sets/src/mage/cards/a/AngelheartVial.java index 3a278abd2f8..080b248ae57 100644 --- a/Mage.Sets/src/mage/cards/a/AngelheartVial.java +++ b/Mage.Sets/src/mage/cards/a/AngelheartVial.java @@ -69,7 +69,7 @@ class AngelheartVialTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java index 167a878e736..35aa43afaa3 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java +++ b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java @@ -105,7 +105,7 @@ class AngelicArbiterEffect2 extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL; + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AngelicAscension.java b/Mage.Sets/src/mage/cards/a/AngelicAscension.java index afe5de86d26..baacb62b570 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicAscension.java +++ b/Mage.Sets/src/mage/cards/a/AngelicAscension.java @@ -62,6 +62,6 @@ class AngelicAscensionEffect extends OneShotEffect { if (permanent == null) { return false; } - return token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); + return token.putOntoBattlefield(1, game, source, permanent.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/a/AngelicBenediction.java b/Mage.Sets/src/mage/cards/a/AngelicBenediction.java index 82717661470..9fe8e665fe1 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicBenediction.java +++ b/Mage.Sets/src/mage/cards/a/AngelicBenediction.java @@ -57,7 +57,7 @@ class AngelicBenedictionTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AngelicChorus.java b/Mage.Sets/src/mage/cards/a/AngelicChorus.java index e9c789a5553..e5139a918e2 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicChorus.java +++ b/Mage.Sets/src/mage/cards/a/AngelicChorus.java @@ -50,7 +50,7 @@ class AngelicChorusTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AngelsGrace.java b/Mage.Sets/src/mage/cards/a/AngelsGrace.java index ed5fc3d7992..c8dd615b5c0 100644 --- a/Mage.Sets/src/mage/cards/a/AngelsGrace.java +++ b/Mage.Sets/src/mage/cards/a/AngelsGrace.java @@ -64,14 +64,14 @@ class AngelsGraceEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.WINS || event.getType() == EventType.LOSES; + return event.getType() == GameEvent.EventType.WINS || event.getType() == GameEvent.EventType.LOSES; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - return (event.getType() == EventType.WINS + return (event.getType() == GameEvent.EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) - || (event.getType() == EventType.LOSES + || (event.getType() == GameEvent.EventType.LOSES && event.getPlayerId().equals(source.getControllerId())); } @@ -96,7 +96,7 @@ class AngelsGraceReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CAUSES_LIFE_LOSS; + return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AngelsTrumpet.java b/Mage.Sets/src/mage/cards/a/AngelsTrumpet.java index 6d66bd8e617..59ec9a469ab 100644 --- a/Mage.Sets/src/mage/cards/a/AngelsTrumpet.java +++ b/Mage.Sets/src/mage/cards/a/AngelsTrumpet.java @@ -76,11 +76,11 @@ class AngelsTrumpetTapEffect extends OneShotEffect { continue; } // Tap the rest. - creature.tap(game); + creature.tap(source, game); count++; } if (count > 0) { - player.damage(count, source.getSourceId(), game); + player.damage(count, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AngrathMinotaurPirate.java b/Mage.Sets/src/mage/cards/a/AngrathMinotaurPirate.java index d9eff6ea194..56cdc8d9ada 100644 --- a/Mage.Sets/src/mage/cards/a/AngrathMinotaurPirate.java +++ b/Mage.Sets/src/mage/cards/a/AngrathMinotaurPirate.java @@ -95,11 +95,11 @@ class AngrathMinotaurPirateThirdAbilityEffect extends OneShotEffect { if (targetOpponent != null) { int powerSum = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); powerSum += permanent.getPower().getValue(); } game.getState().processAction(game); - targetOpponent.damage(powerSum, source.getSourceId(), game); + targetOpponent.damage(powerSum, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AngrathTheFlameChained.java b/Mage.Sets/src/mage/cards/a/AngrathTheFlameChained.java index c37312ddb63..6aa06ba325c 100644 --- a/Mage.Sets/src/mage/cards/a/AngrathTheFlameChained.java +++ b/Mage.Sets/src/mage/cards/a/AngrathTheFlameChained.java @@ -92,7 +92,7 @@ class AngrathTheFlameUltimateEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(opponentId); if (player != null && !player.getGraveyard().isEmpty()) { - player.loseLife(player.getGraveyard().size(), game, false); + player.loseLife(player.getGraveyard().size(), game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/AnimateDead.java b/Mage.Sets/src/mage/cards/a/AnimateDead.java index cab559a1e49..380be31d870 100644 --- a/Mage.Sets/src/mage/cards/a/AnimateDead.java +++ b/Mage.Sets/src/mage/cards/a/AnimateDead.java @@ -108,7 +108,7 @@ class AnimateDeadReAttachEffect extends OneShotEffect { target.addTarget(enchantedCreature.getId(), source, game); animateDead.getSpellAbility().getTargets().clear(); animateDead.getSpellAbility().getTargets().add(target); - enchantedCreature.addAttachment(animateDead.getId(), game); + enchantedCreature.addAttachment(animateDead.getId(), source, game); ContinuousEffect effect = new AnimateDeadAttachToPermanentEffect(); effect.setTargetPointer(new FixedTarget(enchantedCreature, game)); game.addEffect(effect, source); @@ -144,7 +144,7 @@ class AnimateDeadLeavesBattlefieldTriggeredEffect extends OneShotEffect { if (sourcePermanent.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(sourcePermanent.getAttachedTo()); if (attachedTo != null && attachedTo.getZoneChangeCounter(game) == sourcePermanent.getAttachedToZoneChangeCounter()) { - attachedTo.sacrifice(source.getSourceId(), game); + attachedTo.sacrifice(source, game); } } return true; @@ -180,7 +180,7 @@ class AnimateDeadAttachEffect extends OneShotEffect { // Card have no attachedTo attribute yet so write ref only to enchantment now Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null) { - enchantment.attachTo(card.getId(), game); + enchantment.attachTo(card.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AnimationModule.java b/Mage.Sets/src/mage/cards/a/AnimationModule.java index 2263af2ca3c..6ad541e4747 100644 --- a/Mage.Sets/src/mage/cards/a/AnimationModule.java +++ b/Mage.Sets/src/mage/cards/a/AnimationModule.java @@ -151,7 +151,7 @@ class AnimationModuleEffect extends OneShotEffect { if (player.getCounters().size() == 1) { for (Counter counter : player.getCounters().values()) { Counter newCounter = new Counter(counter.getName()); - player.addCounters(newCounter, game); + player.addCounters(newCounter, source, game); } } else { Choice choice = new ChoiceImpl(true); @@ -165,7 +165,7 @@ class AnimationModuleEffect extends OneShotEffect { for (Counter counter : player.getCounters().values()) { if (counter.getName().equals(choice.getChoice())) { Counter newCounter = new Counter(counter.getName()); - player.addCounters(newCounter, game); + player.addCounters(newCounter, source, game); break; } } diff --git a/Mage.Sets/src/mage/cards/a/AnkhOfMishra.java b/Mage.Sets/src/mage/cards/a/AnkhOfMishra.java index c0215c06e13..81be2d3171b 100644 --- a/Mage.Sets/src/mage/cards/a/AnkhOfMishra.java +++ b/Mage.Sets/src/mage/cards/a/AnkhOfMishra.java @@ -58,7 +58,7 @@ class AnkhOfMishraAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AnowonTheRuinThief.java b/Mage.Sets/src/mage/cards/a/AnowonTheRuinThief.java index 49b181a082f..a8250b436d1 100644 --- a/Mage.Sets/src/mage/cards/a/AnowonTheRuinThief.java +++ b/Mage.Sets/src/mage/cards/a/AnowonTheRuinThief.java @@ -134,7 +134,7 @@ class AnowonTheRuinThiefEffect extends OneShotEffect { if (player.millCards(damage, source, game).count(StaticFilters.FILTER_CARD_CREATURE, game) > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/Anthroplasm.java b/Mage.Sets/src/mage/cards/a/Anthroplasm.java index 3561118d748..b389460c65f 100644 --- a/Mage.Sets/src/mage/cards/a/Anthroplasm.java +++ b/Mage.Sets/src/mage/cards/a/Anthroplasm.java @@ -73,7 +73,7 @@ class AnthroplasmEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { //Remove all +1/+1 counters - permanent.removeCounters(permanent.getCounters(game).get(CounterType.P1P1.getName()), game); + permanent.removeCounters(permanent.getCounters(game).get(CounterType.P1P1.getName()), source, game); //put X +1/+1 counters permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), source, game); return true; diff --git a/Mage.Sets/src/mage/cards/a/AntiMagicAura.java b/Mage.Sets/src/mage/cards/a/AntiMagicAura.java index 9b74e2983d5..77a8b95bf33 100644 --- a/Mage.Sets/src/mage/cards/a/AntiMagicAura.java +++ b/Mage.Sets/src/mage/cards/a/AntiMagicAura.java @@ -72,7 +72,7 @@ class AntiMagicAuraRuleEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACH || event.getType() == EventType.STAY_ATTACHED; + return event.getType() == GameEvent.EventType.ATTACH || event.getType() == GameEvent.EventType.STAY_ATTACHED; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AnuridScavenger.java b/Mage.Sets/src/mage/cards/a/AnuridScavenger.java index 55c414c9bab..fe0aad42cd8 100644 --- a/Mage.Sets/src/mage/cards/a/AnuridScavenger.java +++ b/Mage.Sets/src/mage/cards/a/AnuridScavenger.java @@ -66,16 +66,16 @@ class AnuridScavengerCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Removal, controllerId, source.getSourceId(), game)) { for (UUID targetId: targets.get(0).getTargets()) { Card card = game.getCard(targetId); if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) { return false; } - paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true); + paid |= controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, false, true); } } @@ -84,8 +84,8 @@ class AnuridScavengerCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/a/AnvilOfBogardan.java b/Mage.Sets/src/mage/cards/a/AnvilOfBogardan.java index 7c25620ed59..a287e108f1e 100644 --- a/Mage.Sets/src/mage/cards/a/AnvilOfBogardan.java +++ b/Mage.Sets/src/mage/cards/a/AnvilOfBogardan.java @@ -57,8 +57,8 @@ class AnvilOfBogardanEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.drawCards(1, source.getSourceId(), game); - targetPlayer.discard(1, false, source, game); + targetPlayer.drawCards(1, source, game); + targetPlayer.discard(1, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/Apathy.java b/Mage.Sets/src/mage/cards/a/Apathy.java index 5469844970b..639903889b0 100644 --- a/Mage.Sets/src/mage/cards/a/Apathy.java +++ b/Mage.Sets/src/mage/cards/a/Apathy.java @@ -80,7 +80,7 @@ class ApathyEffect extends OneShotEffect { return false; } if (!player.chooseUse(outcome, "Discard a card at random to untap enchanted creature?", source, game) - || player.discardOne(true, source, game) == null) { + || player.discardOne(true, false, source, game) == null) { return false; } Permanent permanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/a/AquamorphEntity.java b/Mage.Sets/src/mage/cards/a/AquamorphEntity.java index 637577aca2e..0eddd538a38 100644 --- a/Mage.Sets/src/mage/cards/a/AquamorphEntity.java +++ b/Mage.Sets/src/mage/cards/a/AquamorphEntity.java @@ -79,7 +79,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { if (event.getTargetId().equals(source.getSourceId())) { Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { @@ -87,7 +87,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl { } } } - if (event.getType() == EventType.TURNFACEUP) { + if (event.getType() == GameEvent.EventType.TURNFACEUP) { if (event.getTargetId().equals(source.getSourceId())) { return true; } diff --git a/Mage.Sets/src/mage/cards/a/ArachnusSpinner.java b/Mage.Sets/src/mage/cards/a/ArachnusSpinner.java index 069581b30b4..fa503828c7b 100644 --- a/Mage.Sets/src/mage/cards/a/ArachnusSpinner.java +++ b/Mage.Sets/src/mage/cards/a/ArachnusSpinner.java @@ -115,7 +115,7 @@ class ArachnusSpinnerEffect extends OneShotEffect { if (permanent != null) { game.getState().setValue("attachTo:" + card.getId(), permanent.getId()); if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) { - permanent.addAttachment(card.getId(), game); // shouldn't this be done automatically by the logic using the "attachTo:" calue? + permanent.addAttachment(card.getId(), source, game); // shouldn't this be done automatically by the logic using the "attachTo:" calue? } } } diff --git a/Mage.Sets/src/mage/cards/a/ArashinSovereign.java b/Mage.Sets/src/mage/cards/a/ArashinSovereign.java index 0aeac68a2d4..2bb3156acb4 100644 --- a/Mage.Sets/src/mage/cards/a/ArashinSovereign.java +++ b/Mage.Sets/src/mage/cards/a/ArashinSovereign.java @@ -69,7 +69,7 @@ class ArashinSovereignEffect extends OneShotEffect { if (controller != null && sourceCard != null) { if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { boolean onTop = controller.chooseUse(outcome, "Put " + sourceCard.getName() + " on top of it's owners library (otherwise on bottom)?", source, game); - controller.moveCardToLibraryWithInfo(sourceCard, source.getSourceId(), game, Zone.GRAVEYARD, onTop, true); + controller.moveCardToLibraryWithInfo(sourceCard, source, game, Zone.GRAVEYARD, onTop, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/ArashinWarBeast.java b/Mage.Sets/src/mage/cards/a/ArashinWarBeast.java index d6f18e479c8..e256e6107c1 100644 --- a/Mage.Sets/src/mage/cards/a/ArashinWarBeast.java +++ b/Mage.Sets/src/mage/cards/a/ArashinWarBeast.java @@ -78,7 +78,7 @@ class ArashinWarBeastTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_CREATURE && + if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getSourceId().equals(this.sourceId) && ((DamagedCreatureEvent) event).isCombatDamage() && !usedForCombatDamageStep) { @@ -91,7 +91,7 @@ class ArashinWarBeastTriggeredAbility extends TriggeredAbilityImpl { return true; } - if (event.getType() == EventType.COMBAT_DAMAGE_STEP_POST) { + if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST) { usedForCombatDamageStep = false; } return false; diff --git a/Mage.Sets/src/mage/cards/a/AraumiOfTheDeadTide.java b/Mage.Sets/src/mage/cards/a/AraumiOfTheDeadTide.java index 0829f1c388b..2a54189e348 100644 --- a/Mage.Sets/src/mage/cards/a/AraumiOfTheDeadTide.java +++ b/Mage.Sets/src/mage/cards/a/AraumiOfTheDeadTide.java @@ -88,7 +88,7 @@ class AraumiOfTheDeadTideCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player == null) { return paid; @@ -96,7 +96,7 @@ class AraumiOfTheDeadTideCost extends CostImpl { int oppCount = game.getOpponents(controllerId).size(); TargetCard target = new TargetCardInYourGraveyard(oppCount, StaticFilters.FILTER_CARD); target.setNotTarget(true); - player.choose(Outcome.Exile, target, sourceId, game); + player.choose(Outcome.Exile, target, source.getSourceId(), game); Cards cards = new CardsImpl(target.getTargets()); if (cards.size() < oppCount) { return paid; @@ -111,7 +111,7 @@ class AraumiOfTheDeadTideCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); return player != null && player.getGraveyard().size() >= game.getOpponents(controllerId).size(); } diff --git a/Mage.Sets/src/mage/cards/a/ArcTrail.java b/Mage.Sets/src/mage/cards/a/ArcTrail.java index 8c75688fea2..2fc795542a3 100644 --- a/Mage.Sets/src/mage/cards/a/ArcTrail.java +++ b/Mage.Sets/src/mage/cards/a/ArcTrail.java @@ -86,11 +86,11 @@ class ArcTrailEffect extends OneShotEffect { } if (permanent != null) { - applied |= (permanent.damage(damage, source.getSourceId(), game, false, true) > 0); + applied |= (permanent.damage(damage, source.getSourceId(), source, game, false, true) > 0); } Player player = game.getPlayer(target.getFirstTarget()); if (player != null) { - applied |= (player.damage(damage, source.getSourceId(), game) > 0); + applied |= (player.damage(damage, source.getSourceId(), source, game) > 0); } twoDamageDone = true; diff --git a/Mage.Sets/src/mage/cards/a/ArcaneArtisan.java b/Mage.Sets/src/mage/cards/a/ArcaneArtisan.java index d46ca7710fd..379f2e9531f 100644 --- a/Mage.Sets/src/mage/cards/a/ArcaneArtisan.java +++ b/Mage.Sets/src/mage/cards/a/ArcaneArtisan.java @@ -91,7 +91,7 @@ class ArcaneArtisanCreateTokenEffect extends OneShotEffect { if (player == null) { return false; } - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); TargetCard target = new TargetCardInHand(1, StaticFilters.FILTER_CARD); if (!player.chooseTarget(Outcome.Exile, player.getHand(), target, source, game)) { return false; diff --git a/Mage.Sets/src/mage/cards/a/ArcaneDenial.java b/Mage.Sets/src/mage/cards/a/ArcaneDenial.java index 3bd0c272fcd..472fa701f93 100644 --- a/Mage.Sets/src/mage/cards/a/ArcaneDenial.java +++ b/Mage.Sets/src/mage/cards/a/ArcaneDenial.java @@ -74,7 +74,7 @@ class ArcaneDenialEffect extends OneShotEffect { controller = game.getPlayer(game.getControllerId(targetId)); } if (targetId != null - && game.getStack().counter(targetId, source.getSourceId(), game)) { + && game.getStack().counter(targetId, source, game)) { countered = true; } if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/a/ArcboundFiend.java b/Mage.Sets/src/mage/cards/a/ArcboundFiend.java index 90ca7524c7e..8ac17dd92d5 100644 --- a/Mage.Sets/src/mage/cards/a/ArcboundFiend.java +++ b/Mage.Sets/src/mage/cards/a/ArcboundFiend.java @@ -79,7 +79,7 @@ class MoveCounterFromTargetToSourceEffect extends OneShotEffect { if (sourceObject != null && controller != null) { Permanent fromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (fromPermanent != null && fromPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { - fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game); + fromPermanent.removeCounters(CounterType.P1P1.createInstance(), source, game); sourceObject.addCounters(CounterType.P1P1.createInstance(), source, game); game.informPlayers("Moved a +1/+1 counter from " + fromPermanent.getLogName() + " to " + sourceObject.getLogName()); } diff --git a/Mage.Sets/src/mage/cards/a/ArchangelsLight.java b/Mage.Sets/src/mage/cards/a/ArchangelsLight.java index 38dabeff48d..c2e5021a360 100644 --- a/Mage.Sets/src/mage/cards/a/ArchangelsLight.java +++ b/Mage.Sets/src/mage/cards/a/ArchangelsLight.java @@ -57,7 +57,7 @@ class ArchangelsLightEffect extends OneShotEffect { if (controller != null) { controller.gainLife(value.calculate(game, source, this) * 2, game, source); for (Card card: controller.getGraveyard().getCards(game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/a/ArchdemonOfGreed.java b/Mage.Sets/src/mage/cards/a/ArchdemonOfGreed.java index 59f015ae4c1..99a30973482 100644 --- a/Mage.Sets/src/mage/cards/a/ArchdemonOfGreed.java +++ b/Mage.Sets/src/mage/cards/a/ArchdemonOfGreed.java @@ -85,16 +85,16 @@ public final class ArchdemonOfGreed extends CardImpl { if (player != null) { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false); // if they can pay the cost, then they must pay - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent humanSacrifice = game.getPermanent(target.getFirstTarget()); if (humanSacrifice != null) { // sacrifice the chosen card - return humanSacrifice.sacrifice(source.getSourceId(), game); + return humanSacrifice.sacrifice(source, game); } } else { - permanent.tap(game); - player.damage(9, source.getSourceId(), game); + permanent.tap(source, game); + player.damage(9, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/ArchfiendOfDepravity.java b/Mage.Sets/src/mage/cards/a/ArchfiendOfDepravity.java index 08b3f76ec44..d281a4b5cf9 100644 --- a/Mage.Sets/src/mage/cards/a/ArchfiendOfDepravity.java +++ b/Mage.Sets/src/mage/cards/a/ArchfiendOfDepravity.java @@ -80,7 +80,7 @@ class ArchfiendOfDepravityEffect extends OneShotEffect { } } for (Permanent creature : creaturesToSacrifice) { - creature.sacrifice(source.getSourceId(), game); + creature.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/ArchfiendOfDespair.java b/Mage.Sets/src/mage/cards/a/ArchfiendOfDespair.java index e7f41f723fb..367dfa7695b 100644 --- a/Mage.Sets/src/mage/cards/a/ArchfiendOfDespair.java +++ b/Mage.Sets/src/mage/cards/a/ArchfiendOfDespair.java @@ -86,7 +86,7 @@ class ArchfiendOfDespairEffect extends OneShotEffect { if (opponent != null) { int lifeLost = watcher.getLifeLost(playerId); if (lifeLost > 0) { - opponent.loseLife(lifeLost, game, false); + opponent.loseLife(lifeLost, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/a/ArchfiendOfSpite.java b/Mage.Sets/src/mage/cards/a/ArchfiendOfSpite.java index fc186f0ba0e..740aa5c673e 100644 --- a/Mage.Sets/src/mage/cards/a/ArchfiendOfSpite.java +++ b/Mage.Sets/src/mage/cards/a/ArchfiendOfSpite.java @@ -135,7 +135,7 @@ class ArchfiendOfSpiteEffect extends OneShotEffect { null, "Lose " + amount + " life", "Sacrifice " + amount + " permanents", source, game )) { - return player.loseLife(amount, game, false) > 0; + return player.loseLife(amount, game, source, false) > 0; } return effect.apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/a/ArchfiendsVessel.java b/Mage.Sets/src/mage/cards/a/ArchfiendsVessel.java index 95d0680393e..e879c473ebf 100644 --- a/Mage.Sets/src/mage/cards/a/ArchfiendsVessel.java +++ b/Mage.Sets/src/mage/cards/a/ArchfiendsVessel.java @@ -116,7 +116,7 @@ class ArchfiendsVesselEffect extends OneShotEffect { boolean moved = controller.moveCards(archfiendsVessel.getMainCard(), Zone.EXILED, source, game); if (moved) { Token token = new DemonToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), controller.getId()); + token.putOntoBattlefield(1, game, source, controller.getId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/ArchiveTrap.java b/Mage.Sets/src/mage/cards/a/ArchiveTrap.java index 0f9f757cc4c..372587cbedb 100644 --- a/Mage.Sets/src/mage/cards/a/ArchiveTrap.java +++ b/Mage.Sets/src/mage/cards/a/ArchiveTrap.java @@ -59,7 +59,7 @@ class ArchiveTrapWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.LIBRARY_SEARCHED + if (event.getType() == GameEvent.EventType.LIBRARY_SEARCHED && event.getTargetId().equals(event.getPlayerId())) { // player searched own library playerIds.add(event.getPlayerId()); } diff --git a/Mage.Sets/src/mage/cards/a/ArchmageAscension.java b/Mage.Sets/src/mage/cards/a/ArchmageAscension.java index e71f21b2b6e..0dbba024818 100644 --- a/Mage.Sets/src/mage/cards/a/ArchmageAscension.java +++ b/Mage.Sets/src/mage/cards/a/ArchmageAscension.java @@ -114,7 +114,7 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl { if (player.searchLibrary(target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); player.shuffleLibrary(source, game); } } diff --git a/Mage.Sets/src/mage/cards/a/ArcumDagsson.java b/Mage.Sets/src/mage/cards/a/ArcumDagsson.java index 7605f75ac07..f4524473955 100644 --- a/Mage.Sets/src/mage/cards/a/ArcumDagsson.java +++ b/Mage.Sets/src/mage/cards/a/ArcumDagsson.java @@ -86,7 +86,7 @@ class ArcumDagssonEffect extends OneShotEffect { if (artifactCreature != null) { Player player = game.getPlayer(artifactCreature.getControllerId()); if (player != null) { - artifactCreature.sacrifice(source.getSourceId(), game); + artifactCreature.sacrifice(source, game); if (player.chooseUse(Outcome.PutCardInPlay, "Search your library for a noncreature artifact card?", source, game)) { TargetCardInLibrary target = new TargetCardInLibrary(filter); if (player.searchLibrary(target, source, game)) { diff --git a/Mage.Sets/src/mage/cards/a/ArdennIntrepidArchaeologist.java b/Mage.Sets/src/mage/cards/a/ArdennIntrepidArchaeologist.java index 0fafafd1144..fbd5b292ad1 100644 --- a/Mage.Sets/src/mage/cards/a/ArdennIntrepidArchaeologist.java +++ b/Mage.Sets/src/mage/cards/a/ArdennIntrepidArchaeologist.java @@ -91,9 +91,9 @@ class ArdennIntrepidArchaeologistEffect extends OneShotEffect { controller.choose(outcome, target, source.getSourceId(), game); for (UUID targetId : target.getTargets()) { if (player != null) { - player.addAttachment(targetId, game); + player.addAttachment(targetId, source, game); } else if (permanent != null) { - permanent.addAttachment(targetId, game); + permanent.addAttachment(targetId, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/Arena.java b/Mage.Sets/src/mage/cards/a/Arena.java index dd81e0ed59a..5a7ce2dcee6 100644 --- a/Mage.Sets/src/mage/cards/a/Arena.java +++ b/Mage.Sets/src/mage/cards/a/Arena.java @@ -65,11 +65,11 @@ class ArenaEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { - creature.tap(game); + creature.tap(source, game); } creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { - creature.tap(game); + creature.tap(source, game); } return new FightTargetsEffect().apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/a/ArgentSphinx.java b/Mage.Sets/src/mage/cards/a/ArgentSphinx.java index cef72466597..f77fa135f76 100644 --- a/Mage.Sets/src/mage/cards/a/ArgentSphinx.java +++ b/Mage.Sets/src/mage/cards/a/ArgentSphinx.java @@ -72,7 +72,7 @@ class ArgentSphinxEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (permanent != null && sourceObject != null) { - if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source, game)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect(); effect.setText("Return it to the battlefield under your control at the beginning of the next end step"); diff --git a/Mage.Sets/src/mage/cards/a/ArgothianWurm.java b/Mage.Sets/src/mage/cards/a/ArgothianWurm.java index c9eda62ed69..3c0d41d0547 100644 --- a/Mage.Sets/src/mage/cards/a/ArgothianWurm.java +++ b/Mage.Sets/src/mage/cards/a/ArgothianWurm.java @@ -73,9 +73,9 @@ class ArgothianWurmEffect extends PutOnLibrarySourceEffect { Cost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent())); Player player = game.getPlayer(playerId); if (player != null - && cost.canPay(source, source.getSourceId(), playerId, game) + && cost.canPay(source, source, playerId, game) && player.chooseUse(Outcome.Sacrifice, "Sacrifice a land?", source, game) - && cost.pay(source, game, source.getSourceId(), playerId, true, null)) { + && cost.pay(source, game, source, playerId, true, null)) { costPaid = true; } } diff --git a/Mage.Sets/src/mage/cards/a/ArjunTheShiftingFlame.java b/Mage.Sets/src/mage/cards/a/ArjunTheShiftingFlame.java index 8a92258bf46..ad79fc33ded 100644 --- a/Mage.Sets/src/mage/cards/a/ArjunTheShiftingFlame.java +++ b/Mage.Sets/src/mage/cards/a/ArjunTheShiftingFlame.java @@ -64,7 +64,7 @@ class ArjunTheShiftingFlameEffect extends OneShotEffect { if (you != null) { int count = you.getHand().size(); you.putCardsOnBottomOfLibrary(you.getHand(), game, source, true); - you.drawCards(count, source.getSourceId(), game); + you.drawCards(count, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/ArmWithAether.java b/Mage.Sets/src/mage/cards/a/ArmWithAether.java index 5c486e3ca0d..36080a55dc9 100644 --- a/Mage.Sets/src/mage/cards/a/ArmWithAether.java +++ b/Mage.Sets/src/mage/cards/a/ArmWithAether.java @@ -62,7 +62,7 @@ class ArmWithAetherTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/ArmoredSkyhunter.java b/Mage.Sets/src/mage/cards/a/ArmoredSkyhunter.java index a722c8506e4..a4d57dfa177 100644 --- a/Mage.Sets/src/mage/cards/a/ArmoredSkyhunter.java +++ b/Mage.Sets/src/mage/cards/a/ArmoredSkyhunter.java @@ -103,7 +103,7 @@ class ArmoredSkyhunterEffect extends OneShotEffect { player.choose(outcome, targetPermanent, source.getSourceId(), game); Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget()); if (permanent != null) { - permanent.addAttachment(equipment.getId(), game); + permanent.addAttachment(equipment.getId(), source, game); } return player.putCardsOnBottomOfLibrary(cards, game, source, false); } diff --git a/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java b/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java index a0de035db23..4324b7276d0 100644 --- a/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java +++ b/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java @@ -95,9 +95,9 @@ class ArmoryAutomatonEffect extends OneShotEffect { if (aura != null) { Permanent attachedTo = game.getPermanent(aura.getAttachedTo()); if (attachedTo != null) { - attachedTo.removeAttachment(aura.getId(), game); + attachedTo.removeAttachment(aura.getId(), source, game); } - sourcePermanent.addAttachment(aura.getId(), game); + sourcePermanent.addAttachment(aura.getId(), source, game); } } else { break; diff --git a/Mage.Sets/src/mage/cards/a/ArtifactPossession.java b/Mage.Sets/src/mage/cards/a/ArtifactPossession.java index 5cd51f52b09..e935ce9f5f3 100644 --- a/Mage.Sets/src/mage/cards/a/ArtifactPossession.java +++ b/Mage.Sets/src/mage/cards/a/ArtifactPossession.java @@ -73,9 +73,16 @@ class AbilityActivatedTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { + UUID tappedPermanent = null; + if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { + tappedPermanent = event.getSourceId(); + } + if (event.getType() == GameEvent.EventType.TAPPED) { + tappedPermanent = event.getTargetId(); + } + Permanent aura = game.getPermanent(this.getSourceId()); - return aura != null && aura.isAttachedTo(event.getSourceId()); - + return aura != null && aura.isAttachedTo(tappedPermanent); } @Override diff --git a/Mage.Sets/src/mage/cards/a/ArtificersHex.java b/Mage.Sets/src/mage/cards/a/ArtificersHex.java index 76d2cc45a34..fee467d6dd1 100644 --- a/Mage.Sets/src/mage/cards/a/ArtificersHex.java +++ b/Mage.Sets/src/mage/cards/a/ArtificersHex.java @@ -77,7 +77,7 @@ class ArtificersHexEffect extends OneShotEffect { if (equipment != null && equipment.getAttachedTo() != null) { Permanent creature = game.getPermanent(equipment.getAttachedTo()); if (creature != null && creature.isCreature()) { - return creature.destroy(source.getSourceId(), game, false); + return creature.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/a/AshZealot.java b/Mage.Sets/src/mage/cards/a/AshZealot.java index 3e6a530c376..4928e87ee59 100644 --- a/Mage.Sets/src/mage/cards/a/AshZealot.java +++ b/Mage.Sets/src/mage/cards/a/AshZealot.java @@ -72,7 +72,7 @@ class AshZealotTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AshenmoorLiege.java b/Mage.Sets/src/mage/cards/a/AshenmoorLiege.java index 1c471a0d003..d1d060173ff 100644 --- a/Mage.Sets/src/mage/cards/a/AshenmoorLiege.java +++ b/Mage.Sets/src/mage/cards/a/AshenmoorLiege.java @@ -83,7 +83,7 @@ class AshenmoorLiegeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AshesToAshes.java b/Mage.Sets/src/mage/cards/a/AshesToAshes.java index a2caa3ab792..23f8286a09c 100644 --- a/Mage.Sets/src/mage/cards/a/AshesToAshes.java +++ b/Mage.Sets/src/mage/cards/a/AshesToAshes.java @@ -69,7 +69,7 @@ class AshesToAshesEffect extends OneShotEffect { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent target = game.getPermanent(permanentId); if (target != null) { - target.moveToExile(exileId, "Ashes to Ashes", source.getSourceId(), game); + target.moveToExile(exileId, "Ashes to Ashes", source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/AshiokNightmareWeaver.java b/Mage.Sets/src/mage/cards/a/AshiokNightmareWeaver.java index 71a24e4c960..3c10f1be957 100644 --- a/Mage.Sets/src/mage/cards/a/AshiokNightmareWeaver.java +++ b/Mage.Sets/src/mage/cards/a/AshiokNightmareWeaver.java @@ -208,7 +208,7 @@ class AshiokNightmareWeaverExileAllEffect extends OneShotEffect { for (UUID cardId : cards) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.HAND, true); } } cards.clear(); @@ -216,7 +216,7 @@ class AshiokNightmareWeaverExileAllEffect extends OneShotEffect { for (UUID cardId : cards) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.GRAVEYARD, true); } } } diff --git a/Mage.Sets/src/mage/cards/a/AshlingTheExtinguisher.java b/Mage.Sets/src/mage/cards/a/AshlingTheExtinguisher.java index ad83866f6e0..4c7d7e48bb2 100644 --- a/Mage.Sets/src/mage/cards/a/AshlingTheExtinguisher.java +++ b/Mage.Sets/src/mage/cards/a/AshlingTheExtinguisher.java @@ -66,7 +66,7 @@ class AshlingTheExtinguisherTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AshlingThePilgrim.java b/Mage.Sets/src/mage/cards/a/AshlingThePilgrim.java index 9188c0d57e9..32680b44c69 100644 --- a/Mage.Sets/src/mage/cards/a/AshlingThePilgrim.java +++ b/Mage.Sets/src/mage/cards/a/AshlingThePilgrim.java @@ -80,7 +80,7 @@ class AshlingThePilgrimEffect extends OneShotEffect { if (counters < 1) { return false; } - sourcePermanent.removeCounters(CounterType.P1P1.createInstance(counters), game); + sourcePermanent.removeCounters(CounterType.P1P1.createInstance(counters), source, game); return new DamageEverythingEffect(counters, StaticFilters.FILTER_PERMANENT_CREATURE).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/a/AssassinsStrike.java b/Mage.Sets/src/mage/cards/a/AssassinsStrike.java index 757a2451b9f..28914b6bec6 100644 --- a/Mage.Sets/src/mage/cards/a/AssassinsStrike.java +++ b/Mage.Sets/src/mage/cards/a/AssassinsStrike.java @@ -63,7 +63,7 @@ class AssassinsStrikeEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.discard(1, false, source, game); + player.discard(1, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java b/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java index 819a800165d..7a72706e8de 100644 --- a/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java +++ b/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java @@ -101,9 +101,9 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect { boolean paid = false; if (opponent != null) { Cost cost = new PayLifeCost(3); - if (cost.canPay(source, source.getSourceId(), opponent.getId(), game) + if (cost.canPay(source, source, opponent.getId(), game) && opponent.chooseUse(outcome, "Pay 3 life to prevent that " + creature.getLogName() + " returns to " + controller.getLogName() + "'s hand?", source, game) - && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { + && cost.pay(source, game, source, opponent.getId(), false, null)) { paid = true; } } @@ -136,7 +136,7 @@ class AthreosDiesCreatureTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AuguryAdept.java b/Mage.Sets/src/mage/cards/a/AuguryAdept.java index 8812eadea6f..b10153d6822 100644 --- a/Mage.Sets/src/mage/cards/a/AuguryAdept.java +++ b/Mage.Sets/src/mage/cards/a/AuguryAdept.java @@ -66,7 +66,7 @@ class AuguryAdeptEffect extends OneShotEffect { } Card card = controller.getLibrary().getFromTop(game); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); int cmc = card.getConvertedManaCost(); if (cmc > 0) { controller.gainLife(cmc, game, source); diff --git a/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java b/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java index 9c0b5f136a7..c92788d1f65 100644 --- a/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java +++ b/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java @@ -76,7 +76,7 @@ class AuntiesSnitchTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AuraBarbs.java b/Mage.Sets/src/mage/cards/a/AuraBarbs.java index 6f1df8e87c6..4e97b996a99 100644 --- a/Mage.Sets/src/mage/cards/a/AuraBarbs.java +++ b/Mage.Sets/src/mage/cards/a/AuraBarbs.java @@ -57,7 +57,7 @@ public final class AuraBarbs extends CardImpl { for (Permanent permanent : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { - controller.damage(2, permanent.getId(), game); + controller.damage(2, permanent.getId(), source, game); game.informPlayers("2 damage assigned to " + controller.getLogName() + " from " + permanent.getName()); } } @@ -67,7 +67,7 @@ public final class AuraBarbs extends CardImpl { if (auraEnchantment.getAttachedTo() != null) { Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo()); if (attachedToCreature != null && attachedToCreature.isCreature()) { - attachedToCreature.damage(2, auraEnchantment.getId(), game, false, true); + attachedToCreature.damage(2, auraEnchantment.getId(), source, game, false, true); game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from " + auraEnchantment.getName()); } } diff --git a/Mage.Sets/src/mage/cards/a/AuraFinesse.java b/Mage.Sets/src/mage/cards/a/AuraFinesse.java index a873394143b..6e9c79ee283 100644 --- a/Mage.Sets/src/mage/cards/a/AuraFinesse.java +++ b/Mage.Sets/src/mage/cards/a/AuraFinesse.java @@ -82,9 +82,9 @@ class AuraFinesseEffect extends OneShotEffect { Target auraTarget = aura.getSpellAbility().getTargets().get(0); if (!auraTarget.canTarget(creature.getId(), game)) { game.informPlayers(aura.getLogName() + " was not attched to " +creature.getLogName() + " because it's no legal target for the aura" ); - } else if (oldCreature.removeAttachment(aura.getId(), game)) { + } else if (oldCreature.removeAttachment(aura.getId(), source, game)) { game.informPlayers(aura.getLogName() + " was unattached from " + oldCreature.getLogName() + " and attached to " + creature.getLogName()); - creature.addAttachment(aura.getId(), game); + creature.addAttachment(aura.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/a/AuraGraft.java b/Mage.Sets/src/mage/cards/a/AuraGraft.java index 541188a4411..08ed4049d54 100644 --- a/Mage.Sets/src/mage/cards/a/AuraGraft.java +++ b/Mage.Sets/src/mage/cards/a/AuraGraft.java @@ -127,8 +127,8 @@ class MoveTargetAuraEffect extends OneShotEffect { && controller.choose(outcome, target, oldAttachment.getId(), game)) { Permanent newAttachment = game.getPermanent(target.getFirstTarget()); if (newAttachment != null - && oldAttachment.removeAttachment(enchantment.getId(), game)) { - newAttachment.addAttachment(enchantment.getId(), game); + && oldAttachment.removeAttachment(enchantment.getId(), source, game)) { + newAttachment.addAttachment(enchantment.getId(), source, game); game.informPlayers(enchantment.getLogName() + " was unattached from " + oldAttachment.getLogName() + " and attached to " + newAttachment.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/a/AuramancersGuise.java b/Mage.Sets/src/mage/cards/a/AuramancersGuise.java index 92f20b1d155..e449f32887c 100644 --- a/Mage.Sets/src/mage/cards/a/AuramancersGuise.java +++ b/Mage.Sets/src/mage/cards/a/AuramancersGuise.java @@ -67,9 +67,9 @@ class EnchantedCreatureAurasCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Permanent aura = game.getPermanent(source.getSourceId()); + Permanent aura = game.getPermanent(sourceAbility.getSourceId()); if (aura != null) { Permanent permanent = game.getPermanent(aura.getAttachedTo()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/a/AuratouchedMage.java b/Mage.Sets/src/mage/cards/a/AuratouchedMage.java index 3b5d13d165c..2a5265fefc6 100644 --- a/Mage.Sets/src/mage/cards/a/AuratouchedMage.java +++ b/Mage.Sets/src/mage/cards/a/AuratouchedMage.java @@ -76,7 +76,7 @@ class AuratouchedMageEffect extends OneShotEffect { && game.getState().getZoneChangeCounter(source.getSourceId()) == source.getSourceObjectZoneChangeCounter()) { game.getState().setValue("attachTo:" + aura.getId(), auratouchedMage); if (controller.moveCards(aura, Zone.BATTLEFIELD, source, game)) { - auratouchedMage.addAttachment(aura.getId(), game); + auratouchedMage.addAttachment(aura.getId(), source, game); } } else { Cards auraRevealed = new CardsImpl(aura); diff --git a/Mage.Sets/src/mage/cards/a/AureliasFury.java b/Mage.Sets/src/mage/cards/a/AureliasFury.java index 1c766ebc4c7..5d54846142c 100644 --- a/Mage.Sets/src/mage/cards/a/AureliasFury.java +++ b/Mage.Sets/src/mage/cards/a/AureliasFury.java @@ -103,7 +103,7 @@ class AureliasFuryEffect extends OneShotEffect { for (UUID creatureId : watcher.getDamagedCreatures()) { Permanent permanent = game.getPermanent(creatureId); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } } for (UUID playerId : watcher.getDamagedPlayers()) { @@ -177,7 +177,7 @@ class AureliasFuryDamagedByWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_CREATURE) { + if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { MageObject obj = game.getObject(event.getSourceId()); if (obj instanceof Spell) { if (sourceId.equals(((Spell) obj).getSourceId())) { @@ -185,7 +185,7 @@ class AureliasFuryDamagedByWatcher extends Watcher { } } } - if (event.getType() == EventType.DAMAGED_PLAYER) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { MageObject obj = game.getObject(event.getSourceId()); if (obj instanceof Spell) { if (sourceId.equals(((Spell) obj).getSourceId())) { diff --git a/Mage.Sets/src/mage/cards/a/Aurification.java b/Mage.Sets/src/mage/cards/a/Aurification.java index e8f87a247a7..145c46b823e 100644 --- a/Mage.Sets/src/mage/cards/a/Aurification.java +++ b/Mage.Sets/src/mage/cards/a/Aurification.java @@ -128,7 +128,7 @@ public final class Aurification extends CardImpl { if (permanent != null) { int numToRemove = permanent.getCounters(game).getCount(CounterType.GOLD); if (numToRemove > 0) { - permanent.removeCounters(CounterType.GOLD.getName(), numToRemove, game); + permanent.removeCounters(CounterType.GOLD.getName(), numToRemove, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/a/AuriokReplica.java b/Mage.Sets/src/mage/cards/a/AuriokReplica.java index e8c4105c651..6f1adc5fc39 100644 --- a/Mage.Sets/src/mage/cards/a/AuriokReplica.java +++ b/Mage.Sets/src/mage/cards/a/AuriokReplica.java @@ -16,6 +16,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.target.TargetSource; import java.util.UUID; @@ -72,17 +73,13 @@ class AuriokReplicaEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamage(event, source, event.getSourceId(), game); - return true; - } - - private void preventDamage(GameEvent event, Ability source, UUID target, Game game) { - GameEvent preventEvent = new PreventDamageEvent(target, source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, target, source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } + return true; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java b/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java index e52e37a0d40..f3968f025df 100644 --- a/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java +++ b/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java @@ -71,7 +71,7 @@ class AuriokSurvivorsEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (p != null && player != null && sourcePermanent != null) { if (player.chooseUse(Outcome.Benefit, "Attach " + p.getName() + " to " + sourcePermanent.getName() + '?', source, game)) { - sourcePermanent.addAttachment(p.getId(), game); + sourcePermanent.addAttachment(p.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AuriokWindwalker.java b/Mage.Sets/src/mage/cards/a/AuriokWindwalker.java index 1df14430c83..1aa0b95c825 100644 --- a/Mage.Sets/src/mage/cards/a/AuriokWindwalker.java +++ b/Mage.Sets/src/mage/cards/a/AuriokWindwalker.java @@ -79,7 +79,7 @@ class AttachTargetEquipmentEffect extends OneShotEffect { Permanent equipment = game.getPermanent(source.getFirstTarget()); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null && equipment != null) { - return creature.addAttachment(equipment.getId(), game); + return creature.addAttachment(equipment.getId(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java index f2191c503bd..7d618e17bc1 100644 --- a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java +++ b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java @@ -114,7 +114,7 @@ class SacrificeAllEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getId(), game); for (Permanent p : permanents) { - p.sacrifice(source.getSourceId(), game); + p.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AvacynThePurifier.java b/Mage.Sets/src/mage/cards/a/AvacynThePurifier.java index 4a1d924f703..270a5704d29 100644 --- a/Mage.Sets/src/mage/cards/a/AvacynThePurifier.java +++ b/Mage.Sets/src/mage/cards/a/AvacynThePurifier.java @@ -107,12 +107,12 @@ class AvacynThePurifierEffect extends OneShotEffect { filter.add(AnotherPredicate.instance); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); } for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.damage(3, source.getSourceId(), game); + opponent.damage(3, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/AvacynsCollar.java b/Mage.Sets/src/mage/cards/a/AvacynsCollar.java index 007439cbc27..68e9226ed70 100644 --- a/Mage.Sets/src/mage/cards/a/AvacynsCollar.java +++ b/Mage.Sets/src/mage/cards/a/AvacynsCollar.java @@ -73,7 +73,7 @@ class AvacynsCollarTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AvariceAmulet.java b/Mage.Sets/src/mage/cards/a/AvariceAmulet.java index 70aec2e44e9..f3b0305fb5e 100644 --- a/Mage.Sets/src/mage/cards/a/AvariceAmulet.java +++ b/Mage.Sets/src/mage/cards/a/AvariceAmulet.java @@ -84,7 +84,7 @@ class AvariceAmuletChangeControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/a/AvenShrine.java b/Mage.Sets/src/mage/cards/a/AvenShrine.java index 7bf7b50760c..927b41bc194 100644 --- a/Mage.Sets/src/mage/cards/a/AvenShrine.java +++ b/Mage.Sets/src/mage/cards/a/AvenShrine.java @@ -60,7 +60,7 @@ class AvenShrineTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AvengingAngel.java b/Mage.Sets/src/mage/cards/a/AvengingAngel.java index 5769a74414a..0013dc22241 100644 --- a/Mage.Sets/src/mage/cards/a/AvengingAngel.java +++ b/Mage.Sets/src/mage/cards/a/AvengingAngel.java @@ -68,7 +68,7 @@ class AvengingAngelEffect extends OneShotEffect { Card sourceCard = game.getCard(source.getSourceId()); if (controller != null && sourceCard != null) { if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { - controller.moveCardToLibraryWithInfo(sourceCard, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(sourceCard, source, game, Zone.GRAVEYARD, true, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AwakenTheErstwhile.java b/Mage.Sets/src/mage/cards/a/AwakenTheErstwhile.java index 13a4d8ad62f..8bb6cd1bc81 100644 --- a/Mage.Sets/src/mage/cards/a/AwakenTheErstwhile.java +++ b/Mage.Sets/src/mage/cards/a/AwakenTheErstwhile.java @@ -63,7 +63,7 @@ class AwakenTheErstwhileEffect extends OneShotEffect { if (player != null) { int cardsInHand = player.getHand().size(); if (cardsInHand > 0) { - player.discard(cardsInHand, false, source, game); + player.discard(cardsInHand, false, false, source, game); cardsAmount.put(playerId, cardsInHand); } } @@ -74,7 +74,7 @@ class AwakenTheErstwhileEffect extends OneShotEffect { Player player = game.getPlayer(discardedHand.getKey()); int tokensCount = discardedHand.getValue(); if (player != null && tokensCount > 0) { - new ZombieToken().putOntoBattlefield(tokensCount, game, source.getSourceId(), player.getId()); + new ZombieToken().putOntoBattlefield(tokensCount, game, source, player.getId()); } }); diff --git a/Mage.Sets/src/mage/cards/a/AwesomePresence.java b/Mage.Sets/src/mage/cards/a/AwesomePresence.java index 732939c93cf..e0654d39ced 100644 --- a/Mage.Sets/src/mage/cards/a/AwesomePresence.java +++ b/Mage.Sets/src/mage/cards/a/AwesomePresence.java @@ -80,8 +80,8 @@ class AwesomePresenceRestrictionEffect extends PayCostToAttackBlockEffectImpl { && enchantment.isAttachedTo(enchantedAttackingCreature.getId())) { Player defendingPlayer = game.getPlayer(blockingCreature.getControllerId()); if (defendingPlayer != null) { - return !manaCosts.canPay(source, source.getSourceId(), defendingPlayer.getId(), game) - || !manaCosts.pay(source, game, source.getSourceId(), defendingPlayer.getId(), false); + return !manaCosts.canPay(source, source, defendingPlayer.getId(), game) + || !manaCosts.pay(source, game, source, defendingPlayer.getId(), false); } } return true; diff --git a/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java b/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java index 5a69e07060d..7006daeb9a8 100644 --- a/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java +++ b/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java @@ -165,10 +165,10 @@ class AzorTheLawbringerAttacksEffect extends OneShotEffect { if (controller.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "? If you do, you gain X life and draw X cards.", source, game)) { int costX = controller.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { controller.resetStoredBookmark(game); // otherwise you can undo the payment controller.gainLife(costX, game, source); - controller.drawCards(costX, source.getSourceId(), game); + controller.drawCards(costX, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/a/AzorsElocutors.java b/Mage.Sets/src/mage/cards/a/AzorsElocutors.java index 84f0ad12ad6..5e1dbb3efae 100644 --- a/Mage.Sets/src/mage/cards/a/AzorsElocutors.java +++ b/Mage.Sets/src/mage/cards/a/AzorsElocutors.java @@ -66,7 +66,7 @@ class AzorsElocutorsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AzorsGateway.java b/Mage.Sets/src/mage/cards/a/AzorsGateway.java index 06a30c883ad..2ffade1102f 100644 --- a/Mage.Sets/src/mage/cards/a/AzorsGateway.java +++ b/Mage.Sets/src/mage/cards/a/AzorsGateway.java @@ -78,7 +78,7 @@ class AzorsGatewayEffect extends OneShotEffect { UUID exileId = CardUtil.getCardExileZoneId(game, source); MageObject sourceObject = source.getSourceObject(game); if (controller != null && exileId != null && sourceObject != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); TargetCardInHand target = new TargetCardInHand(); controller.choose(outcome, target, source.getSourceId(), game); Card cardToExile = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/a/AzraBladeseeker.java b/Mage.Sets/src/mage/cards/a/AzraBladeseeker.java index 3dc89cd1110..7b2634ecb4a 100644 --- a/Mage.Sets/src/mage/cards/a/AzraBladeseeker.java +++ b/Mage.Sets/src/mage/cards/a/AzraBladeseeker.java @@ -83,8 +83,8 @@ class AzraBladeseekerEffect extends OneShotEffect { } } for (PlayerCard playerCard : playerCardList) { - if (playerCard.getPlayer().discard(playerCard.getCard(), source, game)) { - playerCard.getPlayer().drawCards(1, source.getSourceId(), game); + if (playerCard.getPlayer().discard(playerCard.getCard(), false, source, game)) { + playerCard.getPlayer().drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BackFromTheBrink.java b/Mage.Sets/src/mage/cards/b/BackFromTheBrink.java index 09419241fa6..ab3ff9bd532 100644 --- a/Mage.Sets/src/mage/cards/b/BackFromTheBrink.java +++ b/Mage.Sets/src/mage/cards/b/BackFromTheBrink.java @@ -66,19 +66,19 @@ class BackFromTheBrinkCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { Player controller = game.getPlayer(controllerId); if (controller != null) { Card card = controller.getGraveyard().get(targets.getFirstTarget(), game); if (card != null && controller.moveCards(card, Zone.EXILED, ability, game)) { ability.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); - paid = card.getManaCost().pay(ability, game, sourceId, controllerId, noMana); + paid = card.getManaCost().pay(ability, game, source, controllerId, noMana); } } } diff --git a/Mage.Sets/src/mage/cards/b/Backlash.java b/Mage.Sets/src/mage/cards/b/Backlash.java index 574f7593f13..ddb75a6ee5a 100644 --- a/Mage.Sets/src/mage/cards/b/Backlash.java +++ b/Mage.Sets/src/mage/cards/b/Backlash.java @@ -66,10 +66,10 @@ class BacklashEffect extends OneShotEffect { boolean applied = false; Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { - applied = targetCreature.tap(game); + applied = targetCreature.tap(source, game); Player controller = game.getPlayer(targetCreature.getControllerId()); if (controller != null) { - controller.damage(targetCreature.getPower().getValue(), source.getSourceId(), game); + controller.damage(targetCreature.getPower().getValue(), source.getSourceId(), source, game); applied = true; } } diff --git a/Mage.Sets/src/mage/cards/b/BakisCurse.java b/Mage.Sets/src/mage/cards/b/BakisCurse.java index 492ac73f7e3..df8ee1e5418 100644 --- a/Mage.Sets/src/mage/cards/b/BakisCurse.java +++ b/Mage.Sets/src/mage/cards/b/BakisCurse.java @@ -64,7 +64,7 @@ class BakisCurseEffect extends OneShotEffect { count++; } } - creature.damage(count * 2, source.getId(), game, false, true); + creature.damage(count * 2, source.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BalaGedThief.java b/Mage.Sets/src/mage/cards/b/BalaGedThief.java index ddb5924cb50..c8a33308f4e 100644 --- a/Mage.Sets/src/mage/cards/b/BalaGedThief.java +++ b/Mage.Sets/src/mage/cards/b/BalaGedThief.java @@ -104,7 +104,7 @@ class BalaGedThiefEffect extends OneShotEffect { you.choose(Outcome.Neutral, revealedCards, targetInHand, game); Card card = revealedCards.get(targetInHand.getFirstTarget(), game); if (card != null) { - targetPlayer.discard(card, source, game); + targetPlayer.discard(card, false, source, game); game.informPlayers("Bala Ged Thief: " + targetPlayer.getLogName() + " discarded " + card.getName()); } } diff --git a/Mage.Sets/src/mage/cards/b/BalanWanderingKnight.java b/Mage.Sets/src/mage/cards/b/BalanWanderingKnight.java index d2e4c8c68cc..4637b777fe6 100644 --- a/Mage.Sets/src/mage/cards/b/BalanWanderingKnight.java +++ b/Mage.Sets/src/mage/cards/b/BalanWanderingKnight.java @@ -79,8 +79,8 @@ public final class BalanWanderingKnight extends CardImpl { for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (equipment != null) { //If an Equipment can't equip, it isn't attached, and it doesn't become unattached (if it's attached to a creature). - if (!balan.cantBeAttachedBy(equipment, game, false)) { - balan.addAttachment(equipment.getId(), game); + if (!balan.cantBeAttachedBy(equipment, source, game, false)) { + balan.addAttachment(equipment.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/b/BalanceOfPower.java b/Mage.Sets/src/mage/cards/b/BalanceOfPower.java index a53f5812ebc..df2b61daa4c 100644 --- a/Mage.Sets/src/mage/cards/b/BalanceOfPower.java +++ b/Mage.Sets/src/mage/cards/b/BalanceOfPower.java @@ -59,7 +59,7 @@ class BalanceOfPowerEffect extends OneShotEffect { Player opponent = game.getPlayer(source.getFirstTarget()); if (opponent != null && player != null && opponent.getHand().size() > player.getHand().size()) { - player.drawCards(opponent.getHand().size() - player.getHand().size(), source.getSourceId(), game); + player.drawCards(opponent.getHand().size() - player.getHand().size(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/b/BalancingAct.java b/Mage.Sets/src/mage/cards/b/BalancingAct.java index d8cd45b70cd..45403e59038 100644 --- a/Mage.Sets/src/mage/cards/b/BalancingAct.java +++ b/Mage.Sets/src/mage/cards/b/BalancingAct.java @@ -78,7 +78,7 @@ class BalancingActEffect extends OneShotEffect { if (target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledPermanent(), player.getId(), source.getSourceId(), game)) { if (permanent != null && !target.getTargets().contains(permanent.getId())) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } @@ -104,7 +104,7 @@ class BalancingActEffect extends OneShotEffect { if (target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game)) { Cards cards = player.getHand().copy(); cards.removeIf(target.getTargets()::contains); - player.discard(cards, source, game); + player.discard(cards, false, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/b/BalduvianFallen.java b/Mage.Sets/src/mage/cards/b/BalduvianFallen.java index 7d8565f9974..98ad5b6f51f 100644 --- a/Mage.Sets/src/mage/cards/b/BalduvianFallen.java +++ b/Mage.Sets/src/mage/cards/b/BalduvianFallen.java @@ -69,7 +69,7 @@ class BalduvianFallenAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { this.getEffects().clear(); - if(event.getSourceId() != null && event.getSourceId().equals(this.getSourceId()) && event instanceof ManaEvent) { + if(event.getTargetId().equals(this.getSourceId()) && event instanceof ManaEvent) { ManaEvent manaEvent = (ManaEvent) event; int total = manaEvent.getMana().getBlack() + manaEvent.getMana().getRed(); if (total > 0) { diff --git a/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java b/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java index 4c3d6e2644f..a13d998e5ca 100644 --- a/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java +++ b/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java @@ -17,6 +17,7 @@ import mage.filter.common.FilterBlockingCreature; import mage.filter.predicate.permanent.PermanentInListPredicate; import mage.game.Game; import mage.game.combat.CombatGroup; +import mage.game.events.BlockerDeclaredEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -115,7 +116,7 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect { filter.add(new PermanentInListPredicate(list)); TargetAttackingCreature target = new TargetAttackingCreature(1, 1, filter, true); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } else { @@ -132,25 +133,25 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect { chosenGroup.addBlockerToGroup(permanent.getId(), controller.getId(), game); game.getCombat().addBlockingGroup(permanent.getId(), chosenPermanent.getId(), controller.getId(), game); // 702.21h if (notYetBlocked) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, chosenPermanent.getId(), null)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, chosenPermanent.getId(), source, null)); Set morSet = new HashSet<>(); morSet.add(new MageObjectReference(chosenPermanent, game)); for (UUID bandedId : chosenPermanent.getBandedCards()) { CombatGroup bandedGroup = game.getCombat().findGroup(bandedId); if (bandedGroup != null && chosenGroup.getBlockers().size() == 1) { morSet.add(new MageObjectReference(bandedId, game)); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, bandedId, null)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, bandedId, source, null)); } } String key = UUID.randomUUID().toString(); game.getState().setValue("becameBlocked_" + key, morSet); game.fireEvent(GameEvent.getEvent( GameEvent.EventType.BATCH_BLOCK_NONCOMBAT, - source.getSourceId(), source.getSourceId(), + source.getSourceId(), source, source.getControllerId(), key, 0) ); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BLOCKER_DECLARED, chosenPermanent.getId(), permanent.getId(), permanent.getControllerId())); + game.fireEvent(new BlockerDeclaredEvent(chosenPermanent.getId(), permanent.getId(), permanent.getControllerId())); } CombatGroup blockGroup = findBlockingGroup(permanent, game); // a new blockingGroup is formed, so it's necessary to find it again if (blockGroup != null) { diff --git a/Mage.Sets/src/mage/cards/b/BalefireDragon.java b/Mage.Sets/src/mage/cards/b/BalefireDragon.java index de7007a3505..5f560c1d84c 100644 --- a/Mage.Sets/src/mage/cards/b/BalefireDragon.java +++ b/Mage.Sets/src/mage/cards/b/BalefireDragon.java @@ -64,7 +64,7 @@ class BalefireDragonEffect extends OneShotEffect { int amount = (Integer) getValue("damage"); if (amount > 0) { for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game)) { - creature.damage(amount, source.getSourceId(), game, false, true); + creature.damage(amount, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BalefulStare.java b/Mage.Sets/src/mage/cards/b/BalefulStare.java index 16a49f5fa16..8044aaf3ddf 100644 --- a/Mage.Sets/src/mage/cards/b/BalefulStare.java +++ b/Mage.Sets/src/mage/cards/b/BalefulStare.java @@ -70,7 +70,7 @@ class BalefulStareEffect extends OneShotEffect { count++; } } - controller.drawCards(count, source.getSourceId(), game); + controller.drawCards(count, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/b/BalshanBeguiler.java b/Mage.Sets/src/mage/cards/b/BalshanBeguiler.java index c05f908f426..d3de3c7f4c2 100644 --- a/Mage.Sets/src/mage/cards/b/BalshanBeguiler.java +++ b/Mage.Sets/src/mage/cards/b/BalshanBeguiler.java @@ -73,7 +73,7 @@ class BalshanBeguilerEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard()); if (you.choose(Outcome.Benefit, cards, target, game)) { Card card = player.getLibrary().getCard(target.getFirstTarget(), game); - card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, true); + card.moveToZone(Zone.BATTLEFIELD, source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/b/BandTogether.java b/Mage.Sets/src/mage/cards/b/BandTogether.java index 41d1e0499e9..1c61c35ee32 100644 --- a/Mage.Sets/src/mage/cards/b/BandTogether.java +++ b/Mage.Sets/src/mage/cards/b/BandTogether.java @@ -89,10 +89,10 @@ class BandTogetherEffect extends OneShotEffect { } if (permanentDamage1 != null) { - permanentDest.damage(permanentDamage1.getPower().getValue(), permanentDamage1.getId(), game, false, true); + permanentDest.damage(permanentDamage1.getPower().getValue(), permanentDamage1.getId(), source, game, false, true); } if (permanentDamage2 != null) { - permanentDest.damage(permanentDamage2.getPower().getValue(), permanentDamage2.getId(), game, false, true); + permanentDest.damage(permanentDamage2.getPower().getValue(), permanentDamage2.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java b/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java index 51c9ff6ae79..b0bcfcd7c72 100644 --- a/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java +++ b/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java @@ -106,13 +106,13 @@ class BaneAlleyBrokerDrawExileEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); Target target = new TargetCardInHand(new FilterCard("card to exile")); if (controller.chooseTarget(outcome, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); MageObject sourceObject = game.getObject(source.getSourceId()); if (card != null && sourceObject != null) { - if (card.moveToExile(CardUtil.getCardExileZoneId(game, source), sourceObject.getName(), source.getSourceId(), game)) { + if (card.moveToExile(CardUtil.getCardExileZoneId(game, source), sourceObject.getName(), source, game)) { card.setFaceDown(true, game); return true; } diff --git a/Mage.Sets/src/mage/cards/b/BaneOfProgress.java b/Mage.Sets/src/mage/cards/b/BaneOfProgress.java index c6700c74c25..f1f033f01d8 100644 --- a/Mage.Sets/src/mage/cards/b/BaneOfProgress.java +++ b/Mage.Sets/src/mage/cards/b/BaneOfProgress.java @@ -71,7 +71,7 @@ class BaneOfProgressEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int destroyedPermanents = 0; for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { destroyedPermanents++; } } diff --git a/Mage.Sets/src/mage/cards/b/Banefire.java b/Mage.Sets/src/mage/cards/b/Banefire.java index b74cddb4a94..56eba869124 100644 --- a/Mage.Sets/src/mage/cards/b/Banefire.java +++ b/Mage.Sets/src/mage/cards/b/Banefire.java @@ -93,11 +93,11 @@ class BaneFireEffect extends OneShotEffect { int damage = source.getManaCostsToPay().getX(); boolean preventable = damage < 5; if (targetPlayer != null) { - targetPlayer.damage(damage, source.getSourceId(), game, false, preventable); + targetPlayer.damage(damage, source.getSourceId(), source, game, false, preventable); return true; } if (targetCreature != null) { - targetCreature.damage(damage, source.getSourceId(), game, false, preventable); + targetCreature.damage(damage, source.getSourceId(), source, game, false, preventable); return true; } return false; @@ -130,7 +130,7 @@ class BanefireCantCounterEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.COUNTER) { + if (event.getType() == GameEvent.EventType.COUNTER) { Card card = game.getCard(source.getSourceId()); if (card != null) { UUID spellId = card.getSpellAbility().getId(); diff --git a/Mage.Sets/src/mage/cards/b/BanefulOmen.java b/Mage.Sets/src/mage/cards/b/BanefulOmen.java index 7fc1edbecfc..b013a5776de 100644 --- a/Mage.Sets/src/mage/cards/b/BanefulOmen.java +++ b/Mage.Sets/src/mage/cards/b/BanefulOmen.java @@ -54,7 +54,7 @@ public final class BanefulOmen extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override @@ -100,7 +100,7 @@ public final class BanefulOmen extends CardImpl { for (UUID opponentUuid : opponents) { Player opponent = game.getPlayer(opponentUuid); if (opponent != null) { - opponent.loseLife(loseLife, game, false); + opponent.loseLife(loseLife, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BanewaspAffliction.java b/Mage.Sets/src/mage/cards/b/BanewaspAffliction.java index cd0ac1b9b2b..59e8e9dd266 100644 --- a/Mage.Sets/src/mage/cards/b/BanewaspAffliction.java +++ b/Mage.Sets/src/mage/cards/b/BanewaspAffliction.java @@ -74,7 +74,7 @@ class BanewaspAfflictionLoseLifeEffect extends OneShotEffect { if(creature != null){ Player player = game.getPlayer(creature.getOwnerId()); if (player != null) { - player.loseLife(creature.getToughness().getValue(), game, false); + player.loseLife(creature.getToughness().getValue(), game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BansheesBlade.java b/Mage.Sets/src/mage/cards/b/BansheesBlade.java index 18b6f076558..627ee6676ec 100644 --- a/Mage.Sets/src/mage/cards/b/BansheesBlade.java +++ b/Mage.Sets/src/mage/cards/b/BansheesBlade.java @@ -72,10 +72,10 @@ class BansheesBladeAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER - || event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER + || event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE; } @Override @@ -87,7 +87,7 @@ class BansheesBladeAbility extends TriggeredAbilityImpl { return true; } } - if (event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE) { + if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE) { usedInPhase = false; } return false; diff --git a/Mage.Sets/src/mage/cards/b/BarbarianBully.java b/Mage.Sets/src/mage/cards/b/BarbarianBully.java index 02a49107f4b..56ec7f58b9e 100644 --- a/Mage.Sets/src/mage/cards/b/BarbarianBully.java +++ b/Mage.Sets/src/mage/cards/b/BarbarianBully.java @@ -72,7 +72,7 @@ class BarbarianBullyEffect extends OneShotEffect { continue; } if (player.chooseUse(Outcome.UnboostCreature, "Have " + permanent.getName() + " deal 4 damage to you?", source, game)) { - player.damage(4, permanent.getId(), game); + player.damage(4, permanent.getId(), source, game); costPaid = true; } } diff --git a/Mage.Sets/src/mage/cards/b/BarbedShocker.java b/Mage.Sets/src/mage/cards/b/BarbedShocker.java index 48177c00ffe..97406cf6662 100644 --- a/Mage.Sets/src/mage/cards/b/BarbedShocker.java +++ b/Mage.Sets/src/mage/cards/b/BarbedShocker.java @@ -67,8 +67,8 @@ class BarbedShockerEffect extends OneShotEffect { if (targetPlayer == null) { return false; } - int count = targetPlayer.discard(targetPlayer.getHand(), source, game).size(); - targetPlayer.drawCards(count, source.getSourceId(), game); + int count = targetPlayer.discard(targetPlayer.getHand(), false, source, game).size(); + targetPlayer.drawCards(count, source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/b/BarbedWire.java b/Mage.Sets/src/mage/cards/b/BarbedWire.java index 0726332bbcb..e8f42a84fe0 100644 --- a/Mage.Sets/src/mage/cards/b/BarbedWire.java +++ b/Mage.Sets/src/mage/cards/b/BarbedWire.java @@ -73,7 +73,7 @@ class BarbwireDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player activePlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (activePlayer != null) { - activePlayer.damage(1, source.getSourceId(), game); + activePlayer.damage(1, source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/b/BaronVonCount.java b/Mage.Sets/src/mage/cards/b/BaronVonCount.java index 0740dd4f6bf..35a5d1b6de0 100644 --- a/Mage.Sets/src/mage/cards/b/BaronVonCount.java +++ b/Mage.Sets/src/mage/cards/b/BaronVonCount.java @@ -180,7 +180,7 @@ class BaronVonCountMoveDoomCounterEffect extends OneShotEffect { Integer doomNumber = (Integer) game.getState().getValue(mageObject.getId() + "_doom"); if (doomNumber == 1) { // not completely sure if counter should be moving here or not (relevant in case the second trigger gets countered) - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CUSTOM_EVENT, source.getSourceId(), source.getSourceId(), controller.getId(), "DoomCounterReset", 1)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CUSTOM_EVENT, source.getSourceId(), source, controller.getId(), "DoomCounterReset", 1)); } if (doomNumber > 0) { doomNumber--; @@ -211,7 +211,7 @@ class BaronVonCountSecondTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.CUSTOM_EVENT; + return event.getType() == GameEvent.EventType.CUSTOM_EVENT; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BarrinsSpite.java b/Mage.Sets/src/mage/cards/b/BarrinsSpite.java index 5eb3a9baf8e..d828f9755ed 100644 --- a/Mage.Sets/src/mage/cards/b/BarrinsSpite.java +++ b/Mage.Sets/src/mage/cards/b/BarrinsSpite.java @@ -72,10 +72,10 @@ class BarrinsSpiteEffect extends OneShotEffect { && controllerOfCreature.chooseUse(Outcome.Sacrifice, "Sacrifice " + creature.getLogName() + '?', source, game)) || (count == 1 && !sacrificeDone)) { - creature.sacrifice(source.getId(), game); + creature.sacrifice(source, game); sacrificeDone = true; } else { - creature.moveToZone(Zone.HAND, source.getId(), game, false); + creature.moveToZone(Zone.HAND, source, game, false); } count++; } diff --git a/Mage.Sets/src/mage/cards/b/BaruFistOfKrosa.java b/Mage.Sets/src/mage/cards/b/BaruFistOfKrosa.java index d1982ec1f1f..a6807fd0fca 100644 --- a/Mage.Sets/src/mage/cards/b/BaruFistOfKrosa.java +++ b/Mage.Sets/src/mage/cards/b/BaruFistOfKrosa.java @@ -87,7 +87,7 @@ class BaruFistOfKrosaEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int xValue = game.getBattlefield().countAll(filter, source.getControllerId(), game); Token token = new BaruFistOfKrosaToken(xValue); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BattleStrain.java b/Mage.Sets/src/mage/cards/b/BattleStrain.java index 5c18d08891a..e63aada2874 100644 --- a/Mage.Sets/src/mage/cards/b/BattleStrain.java +++ b/Mage.Sets/src/mage/cards/b/BattleStrain.java @@ -55,7 +55,7 @@ class BattleStrainTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BattlefieldScrounger.java b/Mage.Sets/src/mage/cards/b/BattlefieldScrounger.java index caea711bbc7..aa269adad60 100644 --- a/Mage.Sets/src/mage/cards/b/BattlefieldScrounger.java +++ b/Mage.Sets/src/mage/cards/b/BattlefieldScrounger.java @@ -65,16 +65,16 @@ class BattlefieldScroungerCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Removal, controllerId, source.getSourceId(), game)) { for (UUID targetId: targets.get(0).getTargets()) { Card card = game.getCard(targetId); if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) { return false; } - paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true); + paid |= controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, false, true); } } @@ -83,8 +83,8 @@ class BattlefieldScroungerCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/b/BattlegraceAngel.java b/Mage.Sets/src/mage/cards/b/BattlegraceAngel.java index 62e5d7ea988..e02d98bc4cc 100644 --- a/Mage.Sets/src/mage/cards/b/BattlegraceAngel.java +++ b/Mage.Sets/src/mage/cards/b/BattlegraceAngel.java @@ -72,7 +72,7 @@ class BattlegraceAngelAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java index 8a03fb89a77..6e868fda3fd 100644 --- a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java +++ b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java @@ -14,6 +14,7 @@ import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.players.Player; import java.util.UUID; @@ -68,7 +69,7 @@ class BattletideAlchemistEffect extends PreventionEffectImpl { int numberOfClericsControlled = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent(SubType.CLERIC, "Clerics")).calculate(game, source, this); int toPrevent = Math.min(numberOfClericsControlled, event.getAmount()); if (toPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + toPrevent + " damage to " + targetPlayer.getName() + '?', source, game)) { - GameEvent preventEvent = new PreventDamageEvent(targetPlayer.getId(), source.getSourceId(), source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { if (event.getAmount() >= toPrevent) { event.setAmount(event.getAmount() - toPrevent); @@ -77,13 +78,7 @@ class BattletideAlchemistEffect extends PreventionEffectImpl { result = true; } game.informPlayers("Battletide Alchemist prevented " + toPrevent + " damage to " + targetPlayer.getName()); - game.fireEvent(GameEvent.getEvent( - GameEvent.EventType.PREVENTED_DAMAGE, - targetPlayer.getId(), - source.getSourceId(), - source.getControllerId(), - toPrevent)); - + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent)); } } } @@ -92,7 +87,7 @@ class BattletideAlchemistEffect extends PreventionEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } } diff --git a/Mage.Sets/src/mage/cards/b/BatwingBrume.java b/Mage.Sets/src/mage/cards/b/BatwingBrume.java index 2094141eaba..81b2b193e4a 100644 --- a/Mage.Sets/src/mage/cards/b/BatwingBrume.java +++ b/Mage.Sets/src/mage/cards/b/BatwingBrume.java @@ -75,7 +75,7 @@ class BatwingBrumeEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(playerId); if (player != null) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/b/BazaarOfWonders.java b/Mage.Sets/src/mage/cards/b/BazaarOfWonders.java index 70e8fe42298..99959fd2113 100644 --- a/Mage.Sets/src/mage/cards/b/BazaarOfWonders.java +++ b/Mage.Sets/src/mage/cards/b/BazaarOfWonders.java @@ -81,7 +81,7 @@ class BazaarOfWondersEffect extends OneShotEffect { filter1.add(Predicates.not(TokenPredicate.instance)); if (!game.getBattlefield().getActivePermanents(filter1, source.getControllerId(), game).isEmpty()) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); return true; } FilterCard filter2 = new FilterCard(); @@ -92,7 +92,7 @@ class BazaarOfWondersEffect extends OneShotEffect { continue; } if (player.getGraveyard().count(filter2, game) > 0) { - spell.counter(source.getControllerId(), game); + spell.counter(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BazaarTrader.java b/Mage.Sets/src/mage/cards/b/BazaarTrader.java index 4a36535f588..d36009a2678 100644 --- a/Mage.Sets/src/mage/cards/b/BazaarTrader.java +++ b/Mage.Sets/src/mage/cards/b/BazaarTrader.java @@ -88,7 +88,7 @@ class BazaarTraderEffect extends ContinuousEffectImpl { Player player = game.getPlayer(source.getFirstTarget()); Permanent permanent = targetPermanentReference.getPermanent(game); if (player != null && permanent != null) { - return permanent.changeControllerId(player.getId(), game); + return permanent.changeControllerId(player.getId(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/b/BeaconOfImmortality.java b/Mage.Sets/src/mage/cards/b/BeaconOfImmortality.java index 6cccf5fc9c0..2540f70ece0 100644 --- a/Mage.Sets/src/mage/cards/b/BeaconOfImmortality.java +++ b/Mage.Sets/src/mage/cards/b/BeaconOfImmortality.java @@ -62,7 +62,7 @@ class BeaconOfImmortalityEffect extends OneShotEffect { if (player != null) { int amount = player.getLife(); if (amount < 0) { - player.loseLife(-amount, game, false); + player.loseLife(-amount, game, source, false); return true; } if (amount > 0) { diff --git a/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java b/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java index 30853e7e8b7..99a2f4c0a49 100644 --- a/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java +++ b/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java @@ -15,6 +15,7 @@ import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; +import mage.game.events.CopiedStackObjectEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.game.stack.Spell; @@ -180,7 +181,7 @@ class BeamsplitterMageEffect extends OneShotEffect { } } } - game.fireEvent(new GameEvent(GameEvent.EventType.COPIED_STACKOBJECT, copy.getId(), spell.getId(), source.getControllerId())); + game.fireEvent(new CopiedStackObjectEvent(spell, copy, source.getControllerId())); String activateMessage = copy.getActivatedMessage(game); if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); diff --git a/Mage.Sets/src/mage/cards/b/BeastWithin.java b/Mage.Sets/src/mage/cards/b/BeastWithin.java index 4446cc05927..54ee5b33461 100644 --- a/Mage.Sets/src/mage/cards/b/BeastWithin.java +++ b/Mage.Sets/src/mage/cards/b/BeastWithin.java @@ -61,7 +61,7 @@ class BeastWithinEffect extends OneShotEffect { // (2011-06-01) Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); // must use LKI if (permanent != null) { - new BeastToken().putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); + new BeastToken().putOntoBattlefield(1, game, source, permanent.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BeckCall.java b/Mage.Sets/src/mage/cards/b/BeckCall.java index 0695b5644cb..cde2ff0cc47 100644 --- a/Mage.Sets/src/mage/cards/b/BeckCall.java +++ b/Mage.Sets/src/mage/cards/b/BeckCall.java @@ -58,7 +58,7 @@ class BeckTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java b/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java index cecff56cfc4..b0b65e3af98 100644 --- a/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java +++ b/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java @@ -73,7 +73,7 @@ class BedazzleEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } Effect effect = new DamageTargetEffect(StaticValue.get(2), true, "", true); effect.setTargetPointer(new FixedTarget(source.getTargets().get(1).getFirstTarget(), game)); diff --git a/Mage.Sets/src/mage/cards/b/BellowingFiend.java b/Mage.Sets/src/mage/cards/b/BellowingFiend.java index 848f6afcfa4..3e3829b7406 100644 --- a/Mage.Sets/src/mage/cards/b/BellowingFiend.java +++ b/Mage.Sets/src/mage/cards/b/BellowingFiend.java @@ -72,7 +72,7 @@ class BellowingFiendEffect extends OneShotEffect { if (damagedCreature != null) { Player controller = game.getPlayer(damagedCreature.getControllerId()); if (controller != null) { - controller.damage(3, source.getSourceId(), game); + controller.damage(3, source.getSourceId(), source, game); applied = true; } } diff --git a/Mage.Sets/src/mage/cards/b/BelltowerSphinx.java b/Mage.Sets/src/mage/cards/b/BelltowerSphinx.java index ed65fe16d84..08b3c45893f 100644 --- a/Mage.Sets/src/mage/cards/b/BelltowerSphinx.java +++ b/Mage.Sets/src/mage/cards/b/BelltowerSphinx.java @@ -64,7 +64,7 @@ class BelltowerSphinxEffect extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BenalishCommander.java b/Mage.Sets/src/mage/cards/b/BenalishCommander.java index b5d521a8b7d..e402893bdee 100644 --- a/Mage.Sets/src/mage/cards/b/BenalishCommander.java +++ b/Mage.Sets/src/mage/cards/b/BenalishCommander.java @@ -79,7 +79,7 @@ class BenalishCommanderTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BendOrBreak.java b/Mage.Sets/src/mage/cards/b/BendOrBreak.java index bc522120400..b5768d80ace 100644 --- a/Mage.Sets/src/mage/cards/b/BendOrBreak.java +++ b/Mage.Sets/src/mage/cards/b/BendOrBreak.java @@ -172,12 +172,12 @@ class BendOrBreakEffect extends OneShotEffect { List pileToTap = playerPiles.getValue().get(1); for (Permanent permanent : pileToSac) { if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } for (Permanent permanent : pileToTap) { if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/b/BenefactorsDraught.java b/Mage.Sets/src/mage/cards/b/BenefactorsDraught.java index 5d5da26312c..e1f3a0e65ee 100644 --- a/Mage.Sets/src/mage/cards/b/BenefactorsDraught.java +++ b/Mage.Sets/src/mage/cards/b/BenefactorsDraught.java @@ -63,7 +63,7 @@ class BenefactorsDraughtTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BenevolentUnicorn.java b/Mage.Sets/src/mage/cards/b/BenevolentUnicorn.java index c2297b646c0..01c200c75a2 100644 --- a/Mage.Sets/src/mage/cards/b/BenevolentUnicorn.java +++ b/Mage.Sets/src/mage/cards/b/BenevolentUnicorn.java @@ -76,7 +76,7 @@ class BenevolentUnicornEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE || event.getType() == EventType.DAMAGE_PLANESWALKER || event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BenthicExplorers.java b/Mage.Sets/src/mage/cards/b/BenthicExplorers.java index ff764fbea9c..9414e96e3de 100644 --- a/Mage.Sets/src/mage/cards/b/BenthicExplorers.java +++ b/Mage.Sets/src/mage/cards/b/BenthicExplorers.java @@ -80,8 +80,8 @@ class BenthicExplorersCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (target.choose(Outcome.Untap, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (target.choose(Outcome.Untap, controllerId, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { @@ -97,8 +97,8 @@ class BenthicExplorersCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/b/Bereavement.java b/Mage.Sets/src/mage/cards/b/Bereavement.java index 022f727d137..44ff2301782 100644 --- a/Mage.Sets/src/mage/cards/b/Bereavement.java +++ b/Mage.Sets/src/mage/cards/b/Bereavement.java @@ -56,7 +56,7 @@ class BereavementTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/b/Berserk.java b/Mage.Sets/src/mage/cards/b/Berserk.java index 2cb2a76011d..2a1a86dc5ae 100644 --- a/Mage.Sets/src/mage/cards/b/Berserk.java +++ b/Mage.Sets/src/mage/cards/b/Berserk.java @@ -164,7 +164,7 @@ class BerserkDelayedDestroyEffect extends OneShotEffect { if (permanent != null) { AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class); if (watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) { - return permanent.destroy(source.getSourceId(), game, false); + return permanent.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/b/BidentOfThassa.java b/Mage.Sets/src/mage/cards/b/BidentOfThassa.java index 6161b610116..24f72e484cd 100644 --- a/Mage.Sets/src/mage/cards/b/BidentOfThassa.java +++ b/Mage.Sets/src/mage/cards/b/BidentOfThassa.java @@ -67,7 +67,7 @@ class BidentOfThassaTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BioessenceHydra.java b/Mage.Sets/src/mage/cards/b/BioessenceHydra.java index 2d591b829f6..60ed9cec000 100644 --- a/Mage.Sets/src/mage/cards/b/BioessenceHydra.java +++ b/Mage.Sets/src/mage/cards/b/BioessenceHydra.java @@ -116,7 +116,9 @@ class BioessenceHydraTriggeredAbility extends TriggeredAbilityImpl { && permanent.isPlaneswalker() && permanent.isControlledBy(this.getControllerId())) { this.getEffects().clear(); - this.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(event.getAmount()))); + if (event.getAmount() > 0) { + this.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(event.getAmount()))); + } return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BiomanticMastery.java b/Mage.Sets/src/mage/cards/b/BiomanticMastery.java index c0c5d1f57df..1ca6ce79aa9 100644 --- a/Mage.Sets/src/mage/cards/b/BiomanticMastery.java +++ b/Mage.Sets/src/mage/cards/b/BiomanticMastery.java @@ -63,7 +63,7 @@ class BiomanticMasteryEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int creatures = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game); - controller.drawCards(creatures, source.getSourceId(), game); + controller.drawCards(creatures, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/Biorhythm.java b/Mage.Sets/src/mage/cards/b/Biorhythm.java index 1101fde01f6..8192d20f102 100644 --- a/Mage.Sets/src/mage/cards/b/Biorhythm.java +++ b/Mage.Sets/src/mage/cards/b/Biorhythm.java @@ -60,7 +60,7 @@ class BiorhythmEffect extends OneShotEffect { if(player != null) { int diff = player.getLife() - game.getBattlefield().countAll(filter, playerId, game); if(diff > 0) { - player.loseLife(diff, game, false); + player.loseLife(diff, game, source, false); } if(diff < 0) { player.gainLife(-diff, game, source); diff --git a/Mage.Sets/src/mage/cards/b/Bioshift.java b/Mage.Sets/src/mage/cards/b/Bioshift.java index 2876e55ca5c..f821f36d3e5 100644 --- a/Mage.Sets/src/mage/cards/b/Bioshift.java +++ b/Mage.Sets/src/mage/cards/b/Bioshift.java @@ -89,7 +89,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { if (amountCounters > 0) { int amountToMove = controller.getAmount(0, amountCounters, "How many counters do you want to move?", game); if (amountToMove > 0) { - fromPermanent.removeCounters(CounterType.P1P1.createInstance(amountToMove), game); + fromPermanent.removeCounters(CounterType.P1P1.createInstance(amountToMove), source, game); toPermanent.addCounters(CounterType.P1P1.createInstance(amountToMove), source, game); } } diff --git a/Mage.Sets/src/mage/cards/b/BitterOrdeal.java b/Mage.Sets/src/mage/cards/b/BitterOrdeal.java index 7a0fd7d7292..2439cdfeaad 100644 --- a/Mage.Sets/src/mage/cards/b/BitterOrdeal.java +++ b/Mage.Sets/src/mage/cards/b/BitterOrdeal.java @@ -69,7 +69,7 @@ class BitterOrdealEffect extends OneShotEffect { if (controller.searchLibrary(target, source, game, targetPlayer.getId())) { Card card = targetPlayer.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, null, source, game, Zone.LIBRARY, true); } } targetPlayer.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/b/BitterheartWitch.java b/Mage.Sets/src/mage/cards/b/BitterheartWitch.java index 2b4b0623a4a..40cf86ee152 100644 --- a/Mage.Sets/src/mage/cards/b/BitterheartWitch.java +++ b/Mage.Sets/src/mage/cards/b/BitterheartWitch.java @@ -80,7 +80,7 @@ class BitterheartWitchEffect extends OneShotEffect { if (card != null) { game.getState().setValue("attachTo:" + card.getId(), targetPlayer.getId()); if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) { - targetPlayer.addAttachment(card.getId(), game); + targetPlayer.addAttachment(card.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/b/BlackVise.java b/Mage.Sets/src/mage/cards/b/BlackVise.java index 14e9b5782d7..ca0746e4375 100644 --- a/Mage.Sets/src/mage/cards/b/BlackVise.java +++ b/Mage.Sets/src/mage/cards/b/BlackVise.java @@ -58,7 +58,7 @@ class BlackViseTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -95,7 +95,7 @@ class BlackViseEffect extends OneShotEffect { if (chosenPlayer != null) { int damage = chosenPlayer.getHand().size() - 4; if (damage > 0) { - chosenPlayer.damage(damage, source.getSourceId(), game); + chosenPlayer.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BlastOfGenius.java b/Mage.Sets/src/mage/cards/b/BlastOfGenius.java index 5fe18c9ded4..d86f902a312 100644 --- a/Mage.Sets/src/mage/cards/b/BlastOfGenius.java +++ b/Mage.Sets/src/mage/cards/b/BlastOfGenius.java @@ -58,22 +58,22 @@ class BlastOfGeniusEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); TargetDiscard target = new TargetDiscard(player.getId()); if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Discard, target, source.getSourceId(), game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - player.discard(card, source, game); + player.discard(card, false, source, game); int damage = card.getConvertedManaCost(); Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.damage(damage, source.getSourceId(), game, false, true); + creature.damage(damage, source.getSourceId(), source, game, false, true); return true; } Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(damage, source.getSourceId(), game); + targetPlayer.damage(damage, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BlazeCommando.java b/Mage.Sets/src/mage/cards/b/BlazeCommando.java index 64d8c84bf58..c3ba82d68fe 100644 --- a/Mage.Sets/src/mage/cards/b/BlazeCommando.java +++ b/Mage.Sets/src/mage/cards/b/BlazeCommando.java @@ -84,7 +84,7 @@ class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE || event.getType() == EventType.DAMAGED_PLANESWALKER || event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BlazingSalvo.java b/Mage.Sets/src/mage/cards/b/BlazingSalvo.java index bdfb777005b..51fb93c48a7 100644 --- a/Mage.Sets/src/mage/cards/b/BlazingSalvo.java +++ b/Mage.Sets/src/mage/cards/b/BlazingSalvo.java @@ -60,9 +60,9 @@ class BlazingSalvoEffect extends OneShotEffect { if (player != null) { String message = "Have Blazing Salvo do 5 damage to you?"; if (player.chooseUse(Outcome.Damage, message, source, game)) { - player.damage(5, source.getSourceId(), game); + player.damage(5, source.getSourceId(), source, game); } else { - permanent.damage(3, source.getSourceId(), game); + permanent.damage(3, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BlazingSunsteel.java b/Mage.Sets/src/mage/cards/b/BlazingSunsteel.java index 4b41203a9e8..59e13f06281 100644 --- a/Mage.Sets/src/mage/cards/b/BlazingSunsteel.java +++ b/Mage.Sets/src/mage/cards/b/BlazingSunsteel.java @@ -118,12 +118,12 @@ class BlazingSunsteelEffect extends OneShotEffect { } Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damage, creature.getId(), game); + permanent.damage(damage, creature.getId(), source, game); return true; } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(damage, creature.getId(), game); + player.damage(damage, creature.getId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/b/BlazingTorch.java b/Mage.Sets/src/mage/cards/b/BlazingTorch.java index f78a9cd675d..0d8bc07870a 100644 --- a/Mage.Sets/src/mage/cards/b/BlazingTorch.java +++ b/Mage.Sets/src/mage/cards/b/BlazingTorch.java @@ -92,10 +92,10 @@ class BlazingTorchEffect extends OneShotEffect { if (targetedPermanent == null) { Player targetedPlayer = game.getPlayer(source.getFirstTarget()); if (targetedPlayer != null) { - targetedPlayer.damage(2, permanent.getId(), game); + targetedPlayer.damage(2, permanent.getId(), source, game); } } else { - targetedPermanent.damage(2, permanent.getId(), game); + targetedPermanent.damage(2, permanent.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BlessingOfTheNephilim.java b/Mage.Sets/src/mage/cards/b/BlessingOfTheNephilim.java index 1c84ca65722..dcf1da98b72 100644 --- a/Mage.Sets/src/mage/cards/b/BlessingOfTheNephilim.java +++ b/Mage.Sets/src/mage/cards/b/BlessingOfTheNephilim.java @@ -59,9 +59,9 @@ class EnchantedCreatureColorsCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Permanent aura = game.getPermanent(source.getSourceId()); + Permanent aura = game.getPermanent(sourceAbility.getSourceId()); if (aura != null) { Permanent permanent = game.getPermanent(aura.getAttachedTo()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/b/BlimComedicGenius.java b/Mage.Sets/src/mage/cards/b/BlimComedicGenius.java index 3cc635d2b32..546477d5d20 100644 --- a/Mage.Sets/src/mage/cards/b/BlimComedicGenius.java +++ b/Mage.Sets/src/mage/cards/b/BlimComedicGenius.java @@ -97,7 +97,7 @@ class BlimComedicGeniusEffect extends OneShotEffect { if (count < 1) { continue; } - player.loseLife(count, game, true); + player.loseLife(count, game, source, true); TargetDiscard target = new TargetDiscard(StaticFilters.FILTER_CARD, playerId); player.choose(outcome, target, source.getSourceId(), game); cardsMap.put(playerId, new CardsImpl(target.getTargets())); @@ -107,7 +107,7 @@ class BlimComedicGeniusEffect extends OneShotEffect { if (player == null) { continue; } - player.discard(entry.getValue(), source, game); + player.discard(entry.getValue(), false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BlindCreeper.java b/Mage.Sets/src/mage/cards/b/BlindCreeper.java index 99b175b5cce..74014a525f3 100644 --- a/Mage.Sets/src/mage/cards/b/BlindCreeper.java +++ b/Mage.Sets/src/mage/cards/b/BlindCreeper.java @@ -59,7 +59,7 @@ class BlindCreeperAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BlindZealot.java b/Mage.Sets/src/mage/cards/b/BlindZealot.java index 63f8d3ba6b0..9125da73273 100644 --- a/Mage.Sets/src/mage/cards/b/BlindZealot.java +++ b/Mage.Sets/src/mage/cards/b/BlindZealot.java @@ -70,7 +70,7 @@ class BlindZealotTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BlindingBeam.java b/Mage.Sets/src/mage/cards/b/BlindingBeam.java index 92ab1a86272..b77e9348eec 100644 --- a/Mage.Sets/src/mage/cards/b/BlindingBeam.java +++ b/Mage.Sets/src/mage/cards/b/BlindingBeam.java @@ -127,7 +127,7 @@ class BlindingBeamEffect2 extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BlizzardSpecter.java b/Mage.Sets/src/mage/cards/b/BlizzardSpecter.java index cac621a40ec..32af7cfc256 100644 --- a/Mage.Sets/src/mage/cards/b/BlizzardSpecter.java +++ b/Mage.Sets/src/mage/cards/b/BlizzardSpecter.java @@ -80,7 +80,7 @@ class ReturnToHandEffect extends OneShotEffect { return false; } Target target = new TargetControlledPermanent(1, 1, new FilterControlledPermanent(), true); - if (target.canChoose(targetPlayer.getId(), game)) { + if (target.canChoose(source.getSourceId(), targetPlayer.getId(), game)) { targetPlayer.chooseTarget(Outcome.ReturnToHand, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/b/BlizzardStrix.java b/Mage.Sets/src/mage/cards/b/BlizzardStrix.java index 194b0b16297..58f7b35b9c0 100644 --- a/Mage.Sets/src/mage/cards/b/BlizzardStrix.java +++ b/Mage.Sets/src/mage/cards/b/BlizzardStrix.java @@ -92,7 +92,7 @@ class BlizzardStrixEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null && sourcePermanent != null) { - if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source, game, Zone.BATTLEFIELD, true)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step"); diff --git a/Mage.Sets/src/mage/cards/b/BloodClock.java b/Mage.Sets/src/mage/cards/b/BloodClock.java index 886ca0006cc..a0de39fe52f 100644 --- a/Mage.Sets/src/mage/cards/b/BloodClock.java +++ b/Mage.Sets/src/mage/cards/b/BloodClock.java @@ -64,7 +64,7 @@ class BloodClockEffect extends OneShotEffect { return false; } if (player.getLife() > 2 && player.chooseUse(Outcome.Neutral, "Pay 2 life? If you don't, return a permanent you control to its owner's hand.", source, game)) { - player.loseLife(2, game, false); + player.loseLife(2, game, source, false); game.informPlayers(player.getLogName() + " pays 2 life. They will not return a permanent they control."); return true; } else { @@ -73,7 +73,7 @@ class BloodClockEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { game.informPlayers(player.getLogName() + " returns " + permanent.getName() + " to hand."); - return permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + return permanent.moveToZone(Zone.HAND, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/b/BloodHound.java b/Mage.Sets/src/mage/cards/b/BloodHound.java index 98e7ef6b120..f7fb93c540e 100644 --- a/Mage.Sets/src/mage/cards/b/BloodHound.java +++ b/Mage.Sets/src/mage/cards/b/BloodHound.java @@ -73,7 +73,9 @@ class BloodHoundTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(this.getControllerId()) && event.getAmount() > 0) { this.getEffects().clear(); - this.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(event.getAmount()))); + if (event.getAmount() > 0) { + this.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(event.getAmount()))); + } return true; } return false; diff --git a/Mage.Sets/src/mage/cards/b/BloodOath.java b/Mage.Sets/src/mage/cards/b/BloodOath.java index ad728ab74b9..028c9965011 100644 --- a/Mage.Sets/src/mage/cards/b/BloodOath.java +++ b/Mage.Sets/src/mage/cards/b/BloodOath.java @@ -111,7 +111,7 @@ class BloodOathEffect extends OneShotEffect { } } game.informPlayers(sourceObject.getLogName() + " deals " + (damageToDeal == 0 ? "no" : "" + damageToDeal) + " damage to " + opponent.getLogName()); - opponent.damage(damageToDeal, source.getSourceId(), game); + opponent.damage(damageToDeal, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BloodOfTheMartyr.java b/Mage.Sets/src/mage/cards/b/BloodOfTheMartyr.java index a1565e864c6..4e8b0f5a741 100644 --- a/Mage.Sets/src/mage/cards/b/BloodOfTheMartyr.java +++ b/Mage.Sets/src/mage/cards/b/BloodOfTheMartyr.java @@ -68,7 +68,7 @@ class BloodOfTheMartyrEffect extends ReplacementEffectImpl { Player controller = game.getPlayer(source.getControllerId()); DamageEvent damageEvent = (DamageEvent) event; if (controller != null) { - controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/b/BloodScrivener.java b/Mage.Sets/src/mage/cards/b/BloodScrivener.java index 1b8a7a5ea51..a19d7fa7181 100644 --- a/Mage.Sets/src/mage/cards/b/BloodScrivener.java +++ b/Mage.Sets/src/mage/cards/b/BloodScrivener.java @@ -70,8 +70,8 @@ class BloodScrivenerReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { - player.drawCards(2, event.getSourceId(), game, event.getAppliedEffects()); - player.loseLife(1, game, false); + player.drawCards(2, source, game, event); + player.loseLife(1, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BloodSeeker.java b/Mage.Sets/src/mage/cards/b/BloodSeeker.java index 1aa3c2c02e7..2eed5ff4a48 100644 --- a/Mage.Sets/src/mage/cards/b/BloodSeeker.java +++ b/Mage.Sets/src/mage/cards/b/BloodSeeker.java @@ -62,7 +62,7 @@ class BloodSeekerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BloodTithe.java b/Mage.Sets/src/mage/cards/b/BloodTithe.java index 02355d98cd4..f2d6c68cbf3 100644 --- a/Mage.Sets/src/mage/cards/b/BloodTithe.java +++ b/Mage.Sets/src/mage/cards/b/BloodTithe.java @@ -49,7 +49,7 @@ class BloodTitheEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int lifeLost = 0; for (UUID opponentId: game.getOpponents(source.getControllerId())) { - lifeLost += game.getPlayer(opponentId).loseLife(3, game, false); + lifeLost += game.getPlayer(opponentId).loseLife(3, game, source, false); } game.getPlayer(source.getControllerId()).gainLife(lifeLost, game, source); return true; diff --git a/Mage.Sets/src/mage/cards/b/BloodTribute.java b/Mage.Sets/src/mage/cards/b/BloodTribute.java index 5bc65b7e7ec..70ca78bfe07 100644 --- a/Mage.Sets/src/mage/cards/b/BloodTribute.java +++ b/Mage.Sets/src/mage/cards/b/BloodTribute.java @@ -83,7 +83,7 @@ class BloodTributeLoseLifeEffect extends OneShotEffect { if (player != null) { Integer amount = (int) Math.ceil(player.getLife() / 2f); if (amount > 0) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); game.getState().setValue(source.getSourceId().toString() + "_BloodTribute", amount); return true; } diff --git a/Mage.Sets/src/mage/cards/b/BloodTyrant.java b/Mage.Sets/src/mage/cards/b/BloodTyrant.java index ce2c1d712bf..74094dd46eb 100644 --- a/Mage.Sets/src/mage/cards/b/BloodTyrant.java +++ b/Mage.Sets/src/mage/cards/b/BloodTyrant.java @@ -74,7 +74,7 @@ class PlayerLosesTheGameTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOSES; + return event.getType() == GameEvent.EventType.LOSES; } @Override @@ -112,7 +112,7 @@ class BloodTyrantEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - if (player.loseLife(1, game, false) > 0) { + if (player.loseLife(1, game, source, false) > 0) { counters++; } } diff --git a/Mage.Sets/src/mage/cards/b/BloodcrazedHoplite.java b/Mage.Sets/src/mage/cards/b/BloodcrazedHoplite.java index 6a528a475ae..3de01e8f807 100644 --- a/Mage.Sets/src/mage/cards/b/BloodcrazedHoplite.java +++ b/Mage.Sets/src/mage/cards/b/BloodcrazedHoplite.java @@ -70,7 +70,7 @@ class BloodcrazedHopliteTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_ADDED; + return event.getType() == GameEvent.EventType.COUNTER_ADDED; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BloodhallOoze.java b/Mage.Sets/src/mage/cards/b/BloodhallOoze.java index 0601fd2800f..019397cc973 100644 --- a/Mage.Sets/src/mage/cards/b/BloodhallOoze.java +++ b/Mage.Sets/src/mage/cards/b/BloodhallOoze.java @@ -70,7 +70,7 @@ class BloodhallOozeTriggeredAbility1 extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -115,7 +115,7 @@ class BloodhallOozeTriggeredAbility2 extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/b/Bloodletter.java b/Mage.Sets/src/mage/cards/b/Bloodletter.java index cbb888e5f1f..fb483f9a708 100644 --- a/Mage.Sets/src/mage/cards/b/Bloodletter.java +++ b/Mage.Sets/src/mage/cards/b/Bloodletter.java @@ -102,7 +102,7 @@ class BloodletterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { return new DamageEverythingEffect(2).apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/cards/b/BloodshotTrainee.java b/Mage.Sets/src/mage/cards/b/BloodshotTrainee.java index e86f49a3470..1def2ce54b5 100644 --- a/Mage.Sets/src/mage/cards/b/BloodshotTrainee.java +++ b/Mage.Sets/src/mage/cards/b/BloodshotTrainee.java @@ -64,8 +64,8 @@ class BloodshotTraineeCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { if (permanent.getPower().getValue() >= 4) { return true; @@ -75,7 +75,7 @@ class BloodshotTraineeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java b/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java index 86cea40752e..e2d399f21dc 100644 --- a/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java +++ b/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java @@ -60,7 +60,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BlowYourHouseDown.java b/Mage.Sets/src/mage/cards/b/BlowYourHouseDown.java index 4c8bc31c286..de74440f9fa 100644 --- a/Mage.Sets/src/mage/cards/b/BlowYourHouseDown.java +++ b/Mage.Sets/src/mage/cards/b/BlowYourHouseDown.java @@ -64,7 +64,7 @@ class BlowYourHouseDownEffect extends OneShotEffect { .flatMap(Collection::stream) .map(game::getPermanent) .filter(permanent -> permanent != null && permanent.hasSubtype(SubType.WALL, game)) - .forEach(permanent -> permanent.destroy(source.getSourceId(), game, false)); + .forEach(permanent -> permanent.destroy(source, game, false)); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/b/Blustersquall.java b/Mage.Sets/src/mage/cards/b/Blustersquall.java index 91855c8f5fd..a49bdbe90ca 100644 --- a/Mage.Sets/src/mage/cards/b/Blustersquall.java +++ b/Mage.Sets/src/mage/cards/b/Blustersquall.java @@ -62,7 +62,7 @@ class BlustersqallTapAllEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - creature.tap(game); + creature.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BodyDouble.java b/Mage.Sets/src/mage/cards/b/BodyDouble.java index a803f20a283..0e1fec67ce2 100644 --- a/Mage.Sets/src/mage/cards/b/BodyDouble.java +++ b/Mage.Sets/src/mage/cards/b/BodyDouble.java @@ -65,7 +65,7 @@ class BodyDoubleCopyEffect extends OneShotEffect { if (player != null) { Target target = new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")); target.setNotTarget(true); - if (target.canChoose(source.getControllerId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { player.choose(outcome, target, source.getSourceId(), game); Card copyFromCard = game.getCard(target.getFirstTarget()); if (copyFromCard != null) { diff --git a/Mage.Sets/src/mage/cards/b/BodyOfKnowledge.java b/Mage.Sets/src/mage/cards/b/BodyOfKnowledge.java index b0dc71a4373..6cdacf39639 100644 --- a/Mage.Sets/src/mage/cards/b/BodyOfKnowledge.java +++ b/Mage.Sets/src/mage/cards/b/BodyOfKnowledge.java @@ -80,6 +80,6 @@ class BodyOfKnowledgeEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); return player != null && amount > 0 - && player.drawCards(amount, source.getSourceId(), game) > 0; + && player.drawCards(amount, source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/b/BombSquad.java b/Mage.Sets/src/mage/cards/b/BombSquad.java index e5ccc459a27..b82f5b4bdf3 100644 --- a/Mage.Sets/src/mage/cards/b/BombSquad.java +++ b/Mage.Sets/src/mage/cards/b/BombSquad.java @@ -83,7 +83,7 @@ class BombSquadTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_ADDED; + return event.getType() == GameEvent.EventType.COUNTER_ADDED; } @Override @@ -128,8 +128,8 @@ class BombSquadDamgeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.removeCounters(CounterType.FUSE.getName(), creature.getCounters(game).getCount(CounterType.FUSE), game); - creature.destroy(source.getSourceId(), game, false); + creature.removeCounters(CounterType.FUSE.getName(), creature.getCounters(game).getCount(CounterType.FUSE), source, game); + creature.destroy(source, game, false); } if (creature == null) { creature = (Permanent) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD); @@ -137,7 +137,7 @@ class BombSquadDamgeEffect extends OneShotEffect { if (creature != null) { Player controller = game.getPlayer(creature.getControllerId()); if (controller != null) { - controller.damage(4, source.getSourceId(), game); + controller.damage(4, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BondOfPassion.java b/Mage.Sets/src/mage/cards/b/BondOfPassion.java index 3341b1a744c..4e99511df04 100644 --- a/Mage.Sets/src/mage/cards/b/BondOfPassion.java +++ b/Mage.Sets/src/mage/cards/b/BondOfPassion.java @@ -96,11 +96,11 @@ class BondOfPassionEffect extends OneShotEffect { } Permanent permanent2 = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent2 != null) { - permanent2.damage(2, source.getSourceId(), game); + permanent2.damage(2, source.getSourceId(), source, game); } else { Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/b/BondersOrnament.java b/Mage.Sets/src/mage/cards/b/BondersOrnament.java index 3408295c03a..8e36188ee81 100644 --- a/Mage.Sets/src/mage/cards/b/BondersOrnament.java +++ b/Mage.Sets/src/mage/cards/b/BondersOrnament.java @@ -73,7 +73,7 @@ class BondersOrnamentEffect extends OneShotEffect { .noneMatch("Bonder's Ornament"::equals)) { continue; } - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BonfireOfTheDamned.java b/Mage.Sets/src/mage/cards/b/BonfireOfTheDamned.java index 1432e60a3fa..e380672a9cd 100644 --- a/Mage.Sets/src/mage/cards/b/BonfireOfTheDamned.java +++ b/Mage.Sets/src/mage/cards/b/BonfireOfTheDamned.java @@ -60,9 +60,7 @@ class BonfireOfTheDamnedEffect extends OneShotEffect { if (damage < 1) { return false; } - game.damagePlayerOrPlaneswalker( - source.getFirstTarget(), damage, source.getSourceId(), game, false, true - ); + game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), source, game, false, true); Player player = game.getPlayerOrPlaneswalkerController(source.getFirstTarget()); if (player == null) { return true; @@ -70,7 +68,7 @@ class BonfireOfTheDamnedEffect extends OneShotEffect { for (Permanent perm : game.getBattlefield().getAllActivePermanents( StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game )) { - perm.damage(damage, source.getSourceId(), game); + perm.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BookBurning.java b/Mage.Sets/src/mage/cards/b/BookBurning.java index b084527e3fe..379bf4af3da 100644 --- a/Mage.Sets/src/mage/cards/b/BookBurning.java +++ b/Mage.Sets/src/mage/cards/b/BookBurning.java @@ -62,7 +62,7 @@ class BookBurningMillEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && player.chooseUse(Outcome.Detriment, "Have " + sourceObject.getLogName() + " deal 6 damage to you?", source, game)) { millCards = false; - player.damage(6, source.getSourceId(), game); + player.damage(6, source.getSourceId(), source, game); game.informPlayers(player.getLogName() + " has " + sourceObject.getLogName() + " deal 6 damage to them"); } } diff --git a/Mage.Sets/src/mage/cards/b/BoonReflection.java b/Mage.Sets/src/mage/cards/b/BoonReflection.java index 8bafe01e301..b327f9c6111 100644 --- a/Mage.Sets/src/mage/cards/b/BoonReflection.java +++ b/Mage.Sets/src/mage/cards/b/BoonReflection.java @@ -68,7 +68,7 @@ class BoonReflectionEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAIN_LIFE; + return event.getType() == GameEvent.EventType.GAIN_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BoonweaverGiant.java b/Mage.Sets/src/mage/cards/b/BoonweaverGiant.java index 3a8f2c78c27..2ff692bc2ce 100644 --- a/Mage.Sets/src/mage/cards/b/BoonweaverGiant.java +++ b/Mage.Sets/src/mage/cards/b/BoonweaverGiant.java @@ -115,7 +115,7 @@ class BoonweaverGiantEffect extends OneShotEffect { } controller.moveCards(card, Zone.BATTLEFIELD, source, game); if (permanent != null) { - return permanent.addAttachment(card.getId(), game); + return permanent.addAttachment(card.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java index a23a840ddfd..bd434fa2505 100644 --- a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java +++ b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java @@ -94,7 +94,7 @@ class BorderlandExplorerEffect extends OneShotEffect { if (cardsPlayer != null) { for (UUID cardId : cardsPlayer) { Card card = game.getCard(cardId); - player.discard(card, source, game); + player.discard(card, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/b/BorosFuryShield.java b/Mage.Sets/src/mage/cards/b/BorosFuryShield.java index ea5b4233c35..23d8a9bb56a 100644 --- a/Mage.Sets/src/mage/cards/b/BorosFuryShield.java +++ b/Mage.Sets/src/mage/cards/b/BorosFuryShield.java @@ -66,7 +66,7 @@ public final class BorosFuryShield extends CardImpl { Player player = game.getPlayer(target.getControllerId()); if (player != null) { int power = target.getPower().getValue(); - player.damage(power, source.getId(), game); + player.damage(power, source.getId(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/b/BorosReckoner.java b/Mage.Sets/src/mage/cards/b/BorosReckoner.java index e72d0ccbc02..16975a9569e 100644 --- a/Mage.Sets/src/mage/cards/b/BorosReckoner.java +++ b/Mage.Sets/src/mage/cards/b/BorosReckoner.java @@ -72,12 +72,12 @@ class BorosReckonerDealDamageEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); if (creature != null) { - creature.damage(amount, source.getSourceId(), game, false, true); + creature.damage(amount, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BosiumStrip.java b/Mage.Sets/src/mage/cards/b/BosiumStrip.java index 1a008842c76..07a792d8970 100644 --- a/Mage.Sets/src/mage/cards/b/BosiumStrip.java +++ b/Mage.Sets/src/mage/cards/b/BosiumStrip.java @@ -112,8 +112,7 @@ class BosiumStripReplacementEffect extends ReplacementEffectImpl { if (controller != null) { Card card = (Card) game.getState().getValue("BosiumStrip"); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); - return true; + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); } } return false; diff --git a/Mage.Sets/src/mage/cards/b/BottleOfSuleiman.java b/Mage.Sets/src/mage/cards/b/BottleOfSuleiman.java index e7cdc17ed60..f633a3f53a8 100644 --- a/Mage.Sets/src/mage/cards/b/BottleOfSuleiman.java +++ b/Mage.Sets/src/mage/cards/b/BottleOfSuleiman.java @@ -62,10 +62,10 @@ class BottleOfSuleimanEffect extends OneShotEffect { if (you != null) { if (you.flipCoin(source, game, true)) { DjinnToken token = new DjinnToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } else { - you.damage(5, source.getSourceId(), game); + you.damage(5, source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/b/BottledCloister.java b/Mage.Sets/src/mage/cards/b/BottledCloister.java index 8036cdc8f54..d5f45f6e09d 100644 --- a/Mage.Sets/src/mage/cards/b/BottledCloister.java +++ b/Mage.Sets/src/mage/cards/b/BottledCloister.java @@ -74,7 +74,7 @@ class BottledCloisterExileEffect extends OneShotEffect { if (numberOfCards > 0) { UUID exileId = CardUtil.getCardExileZoneId(game, source); for (Card card: controller.getHand().getCards(game)) { - card.moveToExile(exileId, sourcePermanent.getName(), source.getSourceId(), game); + card.moveToExile(exileId, sourcePermanent.getName(), source, game); card.setFaceDown(true, game); } game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " exiles their hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ?"s":"") + ')'); @@ -113,7 +113,7 @@ class BottledCloisterReturnEffect extends OneShotEffect { for (Card card: exileZone.getCards(game)) { if (card.isOwnedBy(controller.getId())) { numberOfCards++; - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); card.setFaceDown(false, game); } } diff --git a/Mage.Sets/src/mage/cards/b/BoundDetermined.java b/Mage.Sets/src/mage/cards/b/BoundDetermined.java index 86d2018d827..ca47dbff3c4 100644 --- a/Mage.Sets/src/mage/cards/b/BoundDetermined.java +++ b/Mage.Sets/src/mage/cards/b/BoundDetermined.java @@ -85,7 +85,7 @@ class BoundEffect extends OneShotEffect { if (controller.chooseTarget(outcome, target, source, game)) { Permanent toSacrifice = game.getPermanent(target.getFirstTarget()); if (toSacrifice != null) { - toSacrifice.sacrifice(source.getSourceId(), game); + toSacrifice.sacrifice(source, game); game.getState().processAction(game); int colors = toSacrifice.getColor(game).getColorCount(); if (colors > 0) { diff --git a/Mage.Sets/src/mage/cards/b/BountyOfTheLuxa.java b/Mage.Sets/src/mage/cards/b/BountyOfTheLuxa.java index 37e29df7f60..219a3ff5909 100644 --- a/Mage.Sets/src/mage/cards/b/BountyOfTheLuxa.java +++ b/Mage.Sets/src/mage/cards/b/BountyOfTheLuxa.java @@ -68,7 +68,7 @@ class BountyOfTheLuxaEffect extends OneShotEffect { if (controller != null) { if (bountyOfLuxa != null && bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD) > 0) { - bountyOfLuxa.removeCounters(CounterType.FLOOD.createInstance(bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD)), game); + bountyOfLuxa.removeCounters(CounterType.FLOOD.createInstance(bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD)), source, game); if (bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD) == 0) { Mana manaToAdd = new Mana(); manaToAdd.increaseColorless(); @@ -80,7 +80,7 @@ class BountyOfTheLuxaEffect extends OneShotEffect { if (bountyOfLuxa != null) { new AddCountersSourceEffect(CounterType.FLOOD.createInstance()).apply(game, source); } - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BoxOfFreerangeGoblins.java b/Mage.Sets/src/mage/cards/b/BoxOfFreerangeGoblins.java index 60c7de54e85..c668a79bba2 100644 --- a/Mage.Sets/src/mage/cards/b/BoxOfFreerangeGoblins.java +++ b/Mage.Sets/src/mage/cards/b/BoxOfFreerangeGoblins.java @@ -56,7 +56,7 @@ class BoxOfFreerangeGoblinsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); CreateTokenEffect effect = new CreateTokenEffect(new GoblinToken(), amount); effect.apply(game, source); return true; diff --git a/Mage.Sets/src/mage/cards/b/BraceForImpact.java b/Mage.Sets/src/mage/cards/b/BraceForImpact.java index 507b658c5a7..a58b9f6c35d 100644 --- a/Mage.Sets/src/mage/cards/b/BraceForImpact.java +++ b/Mage.Sets/src/mage/cards/b/BraceForImpact.java @@ -13,6 +13,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; @@ -70,12 +71,12 @@ class BraceForImpactPreventDamageTargetEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int prevented = 0; int damage = event.getAmount(); event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); prevented = damage; // add counters now diff --git a/Mage.Sets/src/mage/cards/b/BraidOfFire.java b/Mage.Sets/src/mage/cards/b/BraidOfFire.java index b211a5b7e6c..3ee965ee761 100644 --- a/Mage.Sets/src/mage/cards/b/BraidOfFire.java +++ b/Mage.Sets/src/mage/cards/b/BraidOfFire.java @@ -47,7 +47,7 @@ class BraidOfFireCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if(player != null) { player.getManaPool().addMana(Mana.RedMana(1), game, ability); @@ -58,7 +58,7 @@ class BraidOfFireCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return game.getPlayer(controllerId) != null; } diff --git a/Mage.Sets/src/mage/cards/b/BrainGorgers.java b/Mage.Sets/src/mage/cards/b/BrainGorgers.java index df85017892c..e4c6245768c 100644 --- a/Mage.Sets/src/mage/cards/b/BrainGorgers.java +++ b/Mage.Sets/src/mage/cards/b/BrainGorgers.java @@ -74,13 +74,13 @@ class BrainGorgersCounterSourceEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) { cost.clearPaid(); Player player = game.getPlayer(playerId); - if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game) + if (player != null && cost.canPay(source, source, player.getId(), game) && player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + '?', source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/b/BrainMaggot.java b/Mage.Sets/src/mage/cards/b/BrainMaggot.java index 0f254be822a..755d3c87b08 100644 --- a/Mage.Sets/src/mage/cards/b/BrainMaggot.java +++ b/Mage.Sets/src/mage/cards/b/BrainMaggot.java @@ -86,7 +86,7 @@ class BrainMaggotExileEffect extends OneShotEffect { Card card = opponent.getHand().get(target.getFirstTarget(), game); // If source permanent leaves the battlefield before its triggered ability resolves, the target card won't be exiled. if (card != null && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { - controller.moveCardToExileWithInfo(card, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), sourcePermanent.getIdName(), source, game, Zone.HAND, true); } } } diff --git a/Mage.Sets/src/mage/cards/b/BrainPry.java b/Mage.Sets/src/mage/cards/b/BrainPry.java index 8704271ed89..9cc6e159c5f 100644 --- a/Mage.Sets/src/mage/cards/b/BrainPry.java +++ b/Mage.Sets/src/mage/cards/b/BrainPry.java @@ -61,13 +61,13 @@ class BrainPryEffect extends OneShotEffect { boolean hasDiscarded = false; for (Card card : targetPlayer.getHand().getCards(game)) { if (CardUtil.haveSameNames(card, cardName, game)) { - targetPlayer.discard(card, source, game); + targetPlayer.discard(card, false, source, game); hasDiscarded = true; break; } } if (!hasDiscarded) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } controller.lookAtCards(sourceObject.getName() + " Hand", targetPlayer.getHand(), game); } diff --git a/Mage.Sets/src/mage/cards/b/BranchingBolt.java b/Mage.Sets/src/mage/cards/b/BranchingBolt.java index 3e225225107..8716d222e96 100644 --- a/Mage.Sets/src/mage/cards/b/BranchingBolt.java +++ b/Mage.Sets/src/mage/cards/b/BranchingBolt.java @@ -77,12 +77,12 @@ class BranchingBoltEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); } permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BrashTaunter.java b/Mage.Sets/src/mage/cards/b/BrashTaunter.java index d3c35dfb428..f685d13d59e 100644 --- a/Mage.Sets/src/mage/cards/b/BrashTaunter.java +++ b/Mage.Sets/src/mage/cards/b/BrashTaunter.java @@ -91,7 +91,7 @@ class BrashTaunterEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BrassSquire.java b/Mage.Sets/src/mage/cards/b/BrassSquire.java index e166501aa97..67d7adebe18 100644 --- a/Mage.Sets/src/mage/cards/b/BrassSquire.java +++ b/Mage.Sets/src/mage/cards/b/BrassSquire.java @@ -76,7 +76,7 @@ class EquipEffect extends OneShotEffect { Permanent equipment = game.getPermanent(source.getFirstTarget()); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null && equipment != null) { - return creature.addAttachment(equipment.getId(), game); + return creature.addAttachment(equipment.getId(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java b/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java index 2c5230f3971..02f578e74fa 100644 --- a/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java +++ b/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java @@ -83,7 +83,7 @@ class BreachingLeviathanEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List doNotUntapNextUntapStep = new ArrayList<>(); for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - creature.tap(game); + creature.tap(source, game); doNotUntapNextUntapStep.add(creature); } if (!doNotUntapNextUntapStep.isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/b/BreakingPoint.java b/Mage.Sets/src/mage/cards/b/BreakingPoint.java index 4716a594ce4..51752972674 100644 --- a/Mage.Sets/src/mage/cards/b/BreakingPoint.java +++ b/Mage.Sets/src/mage/cards/b/BreakingPoint.java @@ -73,13 +73,13 @@ class BreakingPointDestroyEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 6 damage to you?", source, game)) { destroyCreatures = false; - player.damage(6, source.getSourceId(), game); + player.damage(6, source.getSourceId(), source, game); game.informPlayers(player.getLogName() + " has " + spell.getName() + " deal 6 to them"); } } if (destroyCreatures) { for (Permanent permanent : game.getBattlefield().getActivePermanents(FILTER_PERMANENT_CREATURES, source.getControllerId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); } } return destroyCreatures; diff --git a/Mage.Sets/src/mage/cards/b/BreakingWave.java b/Mage.Sets/src/mage/cards/b/BreakingWave.java index 89ce1491a6b..d1a363dbf33 100644 --- a/Mage.Sets/src/mage/cards/b/BreakingWave.java +++ b/Mage.Sets/src/mage/cards/b/BreakingWave.java @@ -69,7 +69,7 @@ class BreakingWaveEffect extends OneShotEffect { if (creature.isTapped()) { creature.untap(game); } else { - creature.tap(game); + creature.tap(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/Breakthrough.java b/Mage.Sets/src/mage/cards/b/Breakthrough.java index b2392375b4c..09806be9f12 100644 --- a/Mage.Sets/src/mage/cards/b/Breakthrough.java +++ b/Mage.Sets/src/mage/cards/b/Breakthrough.java @@ -64,14 +64,14 @@ class BreakthroughEffect extends OneShotEffect { } int amountToKeep = source.getManaCostsToPay().getX(); if (amountToKeep == 0) { - player.discard(player.getHand(), source, game); + player.discard(player.getHand(), false, source, game); } else if (amountToKeep < player.getHand().size()) { TargetCardInHand target = new TargetCardInHand(amountToKeep, new FilterCard()); target.setTargetName("cards to keep"); target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game); Cards cards = player.getHand().copy(); cards.removeIf(target.getTargets()::contains); - player.discard(cards, source, game); + player.discard(cards, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BreathOfFury.java b/Mage.Sets/src/mage/cards/b/BreathOfFury.java index f493139fadf..b1848222e7a 100644 --- a/Mage.Sets/src/mage/cards/b/BreathOfFury.java +++ b/Mage.Sets/src/mage/cards/b/BreathOfFury.java @@ -71,7 +71,7 @@ class BreathOfFuryAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -129,7 +129,7 @@ class BreathOfFuryEffect extends OneShotEffect { // It's important to check that the creature was successfully sacrificed here. Effects that prevent sacrifice will also prevent Breath of Fury's effect from working. // Commanders going to the command zone and Rest in Peace style replacement effects don't make Permanent.sacrifice return false. if (enchantedCreature != null && controller != null - && enchantedCreature.sacrifice(source.getSourceId(), game) + && enchantedCreature.sacrifice(source, game) && target.canChoose(source.getSourceId(), controller.getId(), game)) { controller.choose(outcome, target, source.getSourceId(), game); Permanent newCreature = game.getPermanent(target.getFirstTarget()); @@ -140,13 +140,13 @@ class BreathOfFuryEffect extends OneShotEffect { if (oldCreature.getId().equals(newCreature.getId())) { success = true; } else { - if (oldCreature.removeAttachment(enchantment.getId(), game) - && newCreature.addAttachment(enchantment.getId(), game)) { + if (oldCreature.removeAttachment(enchantment.getId(), source, game) + && newCreature.addAttachment(enchantment.getId(), source, game)) { game.informPlayers(enchantment.getLogName() + " was unattached from " + oldCreature.getLogName() + " and attached to " + newCreature.getLogName()); success = true; } } - } else if (newCreature.addAttachment(enchantment.getId(), game)) { + } else if (newCreature.addAttachment(enchantment.getId(), source, game)) { game.informPlayers(enchantment.getLogName() + " was attached to " + newCreature.getLogName()); success = true; } diff --git a/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java b/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java index d5dab3a4b8e..c20476c2a14 100644 --- a/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java +++ b/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java @@ -69,7 +69,7 @@ class BreathstealersCryptEffect extends ReplacementEffectImpl { // Gatherer ruling (2007-02-01) // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, // even if the draw is replaced by another draw (such as with Enduring Renewal). - if (cardDrawn == null || player.drawCards(1, event.getSourceId(), game, event.getAppliedEffects()) != 1) { + if (cardDrawn == null || player.drawCards(1, source, game, event) != 1) { return true; } player.revealCards(source, new CardsImpl(cardDrawn), game); @@ -78,10 +78,10 @@ class BreathstealersCryptEffect extends ReplacementEffectImpl { } game.informPlayers("The card drawn by " + player.getName() + " is a creature card. They discard that card unless they pay 3 life."); PayLifeCost cost = new PayLifeCost(3); - if (!cost.canPay(source, source.getSourceId(), player.getId(), game) + if (!cost.canPay(source, source, player.getId(), game) || !player.chooseUse(outcome, "Pay 3 life or discard " + cardDrawn.getIdName() + "?", null, "Pay 3 life", "Discard", source, game) - || !cost.pay(source, game, source.getSourceId(), player.getId(), true, cost)) { - player.discard(cardDrawn, source, game); + || !cost.pay(source, game, source, player.getId(), true, cost)) { + player.discard(cardDrawn, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BredForTheHunt.java b/Mage.Sets/src/mage/cards/b/BredForTheHunt.java index 2c5f15e810a..6dc47efc68d 100644 --- a/Mage.Sets/src/mage/cards/b/BredForTheHunt.java +++ b/Mage.Sets/src/mage/cards/b/BredForTheHunt.java @@ -55,7 +55,7 @@ class BredForTheHuntTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/b/Brightflame.java b/Mage.Sets/src/mage/cards/b/Brightflame.java index 40ebc41836b..b02ad744ffd 100644 --- a/Mage.Sets/src/mage/cards/b/Brightflame.java +++ b/Mage.Sets/src/mage/cards/b/Brightflame.java @@ -68,10 +68,10 @@ class BrightflameEffect extends OneShotEffect { int damageDealt = 0; if (target != null) { ObjectColor color = target.getColor(game); - damageDealt += target.damage(amount.calculate(game, source, this), source.getSourceId(), game); + damageDealt += target.damage(amount.calculate(game, source, this), source.getSourceId(), source, game); for (Permanent p : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (!target.getId().equals(p.getId()) && p.getColor(game).shares(color)) { - damageDealt += p.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); + damageDealt += p.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, true); } } diff --git a/Mage.Sets/src/mage/cards/b/Brightmare.java b/Mage.Sets/src/mage/cards/b/Brightmare.java index 5dfc133b5d1..fe07fce7921 100644 --- a/Mage.Sets/src/mage/cards/b/Brightmare.java +++ b/Mage.Sets/src/mage/cards/b/Brightmare.java @@ -66,7 +66,7 @@ class BrightmareEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.tap(game); + permanent.tap(source, game); Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(permanent.getPower().getValue(), game, source); diff --git a/Mage.Sets/src/mage/cards/b/BrigidHeroOfKinsbaile.java b/Mage.Sets/src/mage/cards/b/BrigidHeroOfKinsbaile.java index 4d480f4a069..5267bbcfcba 100644 --- a/Mage.Sets/src/mage/cards/b/BrigidHeroOfKinsbaile.java +++ b/Mage.Sets/src/mage/cards/b/BrigidHeroOfKinsbaile.java @@ -67,7 +67,7 @@ class BrigidHeroOfKinsbaileEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterAttackingOrBlockingCreature(), targetPlayer.getId(), game)) { - creature.damage(2, source.getSourceId(), game, false, true); + creature.damage(2, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BrimazKingOfOreskos.java b/Mage.Sets/src/mage/cards/b/BrimazKingOfOreskos.java index e54b502cde4..8581d5af7fe 100644 --- a/Mage.Sets/src/mage/cards/b/BrimazKingOfOreskos.java +++ b/Mage.Sets/src/mage/cards/b/BrimazKingOfOreskos.java @@ -78,7 +78,7 @@ class BrimazKingOfOreskosEffect extends OneShotEffect { if (controller != null) { Token token = new CatSoldierCreatureToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); Permanent attackingCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (attackingCreature != null && game.getState().getCombat() != null) { // Possible ruling (see Aetherplasm) diff --git a/Mage.Sets/src/mage/cards/b/BrineSeer.java b/Mage.Sets/src/mage/cards/b/BrineSeer.java index 6035e0b88a3..d8dfaa46e39 100644 --- a/Mage.Sets/src/mage/cards/b/BrineSeer.java +++ b/Mage.Sets/src/mage/cards/b/BrineSeer.java @@ -79,7 +79,7 @@ class BrineSeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/b/BrinkOfMadness.java b/Mage.Sets/src/mage/cards/b/BrinkOfMadness.java index 58a37d6967a..7e383d8b838 100644 --- a/Mage.Sets/src/mage/cards/b/BrinkOfMadness.java +++ b/Mage.Sets/src/mage/cards/b/BrinkOfMadness.java @@ -61,7 +61,7 @@ public final class BrinkOfMadness extends CardImpl { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getFirstTarget()); - return player != null && !player.discard(player.getHand(), source, game).isEmpty(); + return player != null && !player.discard(player.getHand(), false, source, game).isEmpty(); } } } diff --git a/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java b/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java index 6eb0f01472d..0f312ec833b 100644 --- a/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java +++ b/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java @@ -92,7 +92,7 @@ class BriselaVoiceOfNightmaresCantCastEffect extends ContinuousRuleModifyingEffe @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL_LATE; + return event.getType() == GameEvent.EventType.CAST_SPELL_LATE; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BrokenAmbitions.java b/Mage.Sets/src/mage/cards/b/BrokenAmbitions.java index 297b9d1c58b..783f4a8ddab 100644 --- a/Mage.Sets/src/mage/cards/b/BrokenAmbitions.java +++ b/Mage.Sets/src/mage/cards/b/BrokenAmbitions.java @@ -99,9 +99,9 @@ class BrokenAmbitionsEffect extends OneShotEffect { } costToPay.clearPaid(); - if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false, null))) { + if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, source, spell.getControllerId(), false, null))) { game.informPlayers(player.getLogName() + " chooses not to pay " + costValueMessage + " to prevent the counter effect"); - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } game.informPlayers(player.getLogName() + " chooses to pay " + costValueMessage + " to prevent the counter effect"); diff --git a/Mage.Sets/src/mage/cards/b/BrokenVisage.java b/Mage.Sets/src/mage/cards/b/BrokenVisage.java index 519cad5aef0..80d36dd5a5c 100644 --- a/Mage.Sets/src/mage/cards/b/BrokenVisage.java +++ b/Mage.Sets/src/mage/cards/b/BrokenVisage.java @@ -71,7 +71,7 @@ class BrokenVisageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); CreateTokenEffect effect = new CreateTokenEffect(new BrokenVisageSpiritToken(permanent.getPower().getValue(), permanent.getToughness().getValue())); effect.apply(game, source); for (UUID tokenId : effect.getLastAddedTokenIds()) { diff --git a/Mage.Sets/src/mage/cards/b/BronzeBombshell.java b/Mage.Sets/src/mage/cards/b/BronzeBombshell.java index 7cf81f36a0f..518d922b9ec 100644 --- a/Mage.Sets/src/mage/cards/b/BronzeBombshell.java +++ b/Mage.Sets/src/mage/cards/b/BronzeBombshell.java @@ -68,8 +68,8 @@ class LoseControlTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getSourceId().equals(getSourceId())) { - Permanent sourcePermanent = game.getPermanent(event.getSourceId()); + if (event.getTargetId().equals(this.getSourceId())) { + Permanent sourcePermanent = game.getPermanent(event.getTargetId()); if (sourcePermanent != null) { return !(sourcePermanent.getControllerId()).equals(sourcePermanent.getOwnerId()); } @@ -105,8 +105,8 @@ class BronzeBombshellEffect extends OneShotEffect { if (bronzeBombshell != null) { Player newController = game.getPlayer(bronzeBombshell.getControllerId()); if (newController != null) { - if (bronzeBombshell.sacrifice(source.getId(), game)) {//sacrificed by the new controlling player - newController.damage(7, source.getSourceId(), game);//bronze bombshell does 7 damage to the controller + if (bronzeBombshell.sacrifice(source, game)) {//sacrificed by the new controlling player + newController.damage(7, source.getSourceId(), source, game);//bronze bombshell does 7 damage to the controller return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BronzehideLion.java b/Mage.Sets/src/mage/cards/b/BronzehideLion.java index 810d851dc74..6c4f719fdc1 100644 --- a/Mage.Sets/src/mage/cards/b/BronzehideLion.java +++ b/Mage.Sets/src/mage/cards/b/BronzehideLion.java @@ -99,7 +99,7 @@ class BronzehideLionReturnEffect extends OneShotEffect { if (aura == null || creature == null) { return true; } - creature.addAttachment(aura.getId(), game); + creature.addAttachment(aura.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BroodBirthing.java b/Mage.Sets/src/mage/cards/b/BroodBirthing.java index f030bb2ae3a..ac6e71d7607 100644 --- a/Mage.Sets/src/mage/cards/b/BroodBirthing.java +++ b/Mage.Sets/src/mage/cards/b/BroodBirthing.java @@ -60,7 +60,7 @@ class BroodBirthingEffect extends OneShotEffect { EldraziSpawnToken token = new EldraziSpawnToken(); int count = game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0 ? 3 : 1; - token.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(count, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BroodSliver.java b/Mage.Sets/src/mage/cards/b/BroodSliver.java index 39388766e44..56852fec047 100644 --- a/Mage.Sets/src/mage/cards/b/BroodSliver.java +++ b/Mage.Sets/src/mage/cards/b/BroodSliver.java @@ -66,7 +66,7 @@ class BroodSliverEffect extends OneShotEffect { Player permanentController = game.getPlayer(getTargetPointer().getFirst(game, source)); if (permanentController != null) { if (permanentController.chooseUse(outcome, "create a 1/1 colorless Sliver creature token", source, game)) { - return new SliverToken().putOntoBattlefield(1, game, source.getSourceId(), permanentController.getId()); + return new SliverToken().putOntoBattlefield(1, game, source, permanentController.getId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BroodingSaurian.java b/Mage.Sets/src/mage/cards/b/BroodingSaurian.java index 982c95c617f..0d295ecb9e4 100644 --- a/Mage.Sets/src/mage/cards/b/BroodingSaurian.java +++ b/Mage.Sets/src/mage/cards/b/BroodingSaurian.java @@ -89,7 +89,7 @@ class BroodingSaurianControlEffect extends ContinuousEffectImpl { Permanent creature = it.next().getPermanent(game); if (creature != null) { if (!creature.isControlledBy(creature.getOwnerId())) { - creature.changeControllerId(creature.getOwnerId(), game); + creature.changeControllerId(creature.getOwnerId(), game, source); } } else { it.remove(); diff --git a/Mage.Sets/src/mage/cards/b/Browbeat.java b/Mage.Sets/src/mage/cards/b/Browbeat.java index b2bf79ddfe3..e29b566a8fb 100644 --- a/Mage.Sets/src/mage/cards/b/Browbeat.java +++ b/Mage.Sets/src/mage/cards/b/Browbeat.java @@ -71,7 +71,7 @@ class BrowbeatDrawEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 5 damage to you?", source, game)) { drawCards = false; - player.damage(5, source.getSourceId(), game); + player.damage(5, source.getSourceId(), source, game); game.informPlayers(player.getLogName() + " has " + spell.getLogName() + " deal 5 to them"); } } @@ -80,7 +80,7 @@ class BrowbeatDrawEffect extends OneShotEffect { if (targetPlayer != null) { Player player = game.getPlayer(targetPlayer); if (player != null) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java b/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java index dcd09e1ec78..3c756b42e6b 100644 --- a/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java +++ b/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java @@ -156,16 +156,16 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect { for (Permanent aura : fromBattlefield) { Permanent attachedTo = game.getPermanent(aura.getAttachedTo()); if (attachedTo != null) { - attachedTo.removeAttachment(aura.getId(), game); + attachedTo.removeAttachment(aura.getId(), source, game); } - sourcePermanent.addAttachment(aura.getId(), game); + sourcePermanent.addAttachment(aura.getId(), source, game); } // Move cards for (Card aura : fromHandGraveyard) { if (aura != null) { game.getState().setValue("attachTo:" + aura.getId(), sourcePermanent); controller.moveCards(aura, Zone.BATTLEFIELD, source, game); - sourcePermanent.addAttachment(aura.getId(), game); + sourcePermanent.addAttachment(aura.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BrutalHordechief.java b/Mage.Sets/src/mage/cards/b/BrutalHordechief.java index d07da397264..11ee63d559b 100644 --- a/Mage.Sets/src/mage/cards/b/BrutalHordechief.java +++ b/Mage.Sets/src/mage/cards/b/BrutalHordechief.java @@ -166,7 +166,7 @@ class BrutalHordechiefChooseBlockersEffect extends ContinuousRuleModifyingEffect watcher.copyCountApply = watcher.copyCount; Player blockController = game.getPlayer(source.getControllerId()); if (blockController != null) { - game.getCombat().selectBlockers(blockController, game); + game.getCombat().selectBlockers(blockController, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/b/BubblingCauldron.java b/Mage.Sets/src/mage/cards/b/BubblingCauldron.java index 92e311577fa..4f3e0194db6 100644 --- a/Mage.Sets/src/mage/cards/b/BubblingCauldron.java +++ b/Mage.Sets/src/mage/cards/b/BubblingCauldron.java @@ -75,7 +75,7 @@ class BubblingCauldronEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - lostLife += opponent.loseLife(4, game, false); + lostLife += opponent.loseLife(4, game, source, false); } } if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/b/BubblingMuck.java b/Mage.Sets/src/mage/cards/b/BubblingMuck.java index 86d0a4b8206..38280e3352c 100644 --- a/Mage.Sets/src/mage/cards/b/BubblingMuck.java +++ b/Mage.Sets/src/mage/cards/b/BubblingMuck.java @@ -62,13 +62,13 @@ class BubblingMuckTriggeredAbility extends DelayedTriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent land = game.getPermanent(event.getTargetId()); - if (land != null && filter.match(land, game)) { + Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (land != null && filter.match(land, getSourceId(), getControllerId(), game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(land.getControllerId())); } diff --git a/Mage.Sets/src/mage/cards/b/BuildersBane.java b/Mage.Sets/src/mage/cards/b/BuildersBane.java index d29d7db6058..7813efef256 100644 --- a/Mage.Sets/src/mage/cards/b/BuildersBane.java +++ b/Mage.Sets/src/mage/cards/b/BuildersBane.java @@ -76,7 +76,7 @@ class BuildersBaneEffect extends OneShotEffect { for (UUID targetID : this.targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(targetID); if (permanent != null) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { game.getState().processAction(game); if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId()) && game.getState().getZone(permanent.getId()) != Zone.GRAVEYARD) { @@ -92,7 +92,7 @@ class BuildersBaneEffect extends OneShotEffect { for (Map.Entry entry : destroyedArtifactPerPlayer.entrySet()) { Player player = game.getPlayer(entry.getKey()); if (player != null) { - player.damage(entry.getValue(), source.getSourceId(), game); + player.damage(entry.getValue(), source.getSourceId(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/b/Bulwark.java b/Mage.Sets/src/mage/cards/b/Bulwark.java index 93ce1caf69d..291faebd595 100644 --- a/Mage.Sets/src/mage/cards/b/Bulwark.java +++ b/Mage.Sets/src/mage/cards/b/Bulwark.java @@ -63,7 +63,7 @@ class BulwarkDamageEffect extends OneShotEffect { if (opponent != null && controller != null) { int amount = controller.getHand().size() - opponent.getHand().size(); if (amount > 0) { - opponent.damage(amount, source.getSourceId(), game); + opponent.damage(amount, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/Burgeoning.java b/Mage.Sets/src/mage/cards/b/Burgeoning.java index c907a81828e..41b884ec5b3 100644 --- a/Mage.Sets/src/mage/cards/b/Burgeoning.java +++ b/Mage.Sets/src/mage/cards/b/Burgeoning.java @@ -48,7 +48,7 @@ class BurgeoningTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BurnAtTheStake.java b/Mage.Sets/src/mage/cards/b/BurnAtTheStake.java index cfdadba7cd1..84e5632fbd7 100644 --- a/Mage.Sets/src/mage/cards/b/BurnAtTheStake.java +++ b/Mage.Sets/src/mage/cards/b/BurnAtTheStake.java @@ -72,13 +72,13 @@ class BurnAtTheStakeEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); return true; } Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/b/BurnFromWithin.java b/Mage.Sets/src/mage/cards/b/BurnFromWithin.java index 76aff4b1f09..d1c9c1d789e 100644 --- a/Mage.Sets/src/mage/cards/b/BurnFromWithin.java +++ b/Mage.Sets/src/mage/cards/b/BurnFromWithin.java @@ -69,7 +69,7 @@ class BurnFromWithinEffect extends OneShotEffect { int amount = source.getManaCostsToPay().getX(); if (creature != null) { game.addEffect(new DiesReplacementEffect(new MageObjectReference(creature, game), Duration.EndOfTurn), source); - int damageDealt = creature.damage(amount, source.getSourceId(), game, false, true); + int damageDealt = creature.damage(amount, source.getSourceId(), source, game, false, true); if (damageDealt > 0) { ContinuousEffect effect = new LoseAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creature.getId())); @@ -79,7 +79,7 @@ class BurnFromWithinEffect extends OneShotEffect { } Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(amount, source.getSourceId(), game); + targetPlayer.damage(amount, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BurnTheImpure.java b/Mage.Sets/src/mage/cards/b/BurnTheImpure.java index 78c1d16a767..ede92cdc295 100644 --- a/Mage.Sets/src/mage/cards/b/BurnTheImpure.java +++ b/Mage.Sets/src/mage/cards/b/BurnTheImpure.java @@ -58,11 +58,11 @@ class BurnTheImpureEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); if (permanent.getAbilities().contains(InfectAbility.getInstance())) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { - controller.damage(3, source.getSourceId(), game); + controller.damage(3, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BurningCinderFuryOfCrimsonChaosFire.java b/Mage.Sets/src/mage/cards/b/BurningCinderFuryOfCrimsonChaosFire.java index b21dab2e6dd..2298f1fdf84 100644 --- a/Mage.Sets/src/mage/cards/b/BurningCinderFuryOfCrimsonChaosFire.java +++ b/Mage.Sets/src/mage/cards/b/BurningCinderFuryOfCrimsonChaosFire.java @@ -170,7 +170,7 @@ class BurningCinderFuryOfCrimsonChaosFireCreatureGainControlEffect extends Conti permanent = game.getPermanent(targetPointer.getFirst(game, source)); } if (permanent != null && controller != null) { - return permanent.changeControllerId(controller, game); + return permanent.changeControllerId(controller, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/b/BurningOfXinye.java b/Mage.Sets/src/mage/cards/b/BurningOfXinye.java index de7ea301886..7c8c96fa60b 100644 --- a/Mage.Sets/src/mage/cards/b/BurningOfXinye.java +++ b/Mage.Sets/src/mage/cards/b/BurningOfXinye.java @@ -84,7 +84,7 @@ class BurningOfXinyeEffect extends OneShotEffect{ Target target = new TargetControlledPermanent(amount, amount, filter, true); if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } @@ -92,7 +92,7 @@ class BurningOfXinyeEffect extends OneShotEffect{ Permanent permanent = game.getPermanent(target.getTargets().get(idx)); if ( permanent != null ) { - abilityApplied |= permanent.destroy(source.getSourceId(), game, false); + abilityApplied |= permanent.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/b/BurningTreeShaman.java b/Mage.Sets/src/mage/cards/b/BurningTreeShaman.java index 4ea90941b3f..3e7157d5bed 100644 --- a/Mage.Sets/src/mage/cards/b/BurningTreeShaman.java +++ b/Mage.Sets/src/mage/cards/b/BurningTreeShaman.java @@ -62,7 +62,7 @@ class BurningTreeShamanTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATED_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BurningVengeance.java b/Mage.Sets/src/mage/cards/b/BurningVengeance.java index e0766ac8e7b..f7cfb88d7e7 100644 --- a/Mage.Sets/src/mage/cards/b/BurningVengeance.java +++ b/Mage.Sets/src/mage/cards/b/BurningVengeance.java @@ -52,7 +52,7 @@ class BurningVengeanceOnCastAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/b/Burnout.java b/Mage.Sets/src/mage/cards/b/Burnout.java index 8b39366d126..f1487d8959d 100644 --- a/Mage.Sets/src/mage/cards/b/Burnout.java +++ b/Mage.Sets/src/mage/cards/b/Burnout.java @@ -73,7 +73,7 @@ class BurnoutCounterTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Spell targetSpell = game.getStack().getSpell(source.getFirstTarget()); if(targetSpell != null && targetSpell.getColor(game).isBlue()){ - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BushmeatPoacher.java b/Mage.Sets/src/mage/cards/b/BushmeatPoacher.java index 50fd0a2a6e7..f7ca63eeacf 100644 --- a/Mage.Sets/src/mage/cards/b/BushmeatPoacher.java +++ b/Mage.Sets/src/mage/cards/b/BushmeatPoacher.java @@ -98,6 +98,6 @@ class BushmeatPoacherEffect extends OneShotEffect { if (amount > 0) { player.gainLife(amount, game, source); } - return player.drawCards(1, source.getSourceId(), game) > 0; + return player.drawCards(1, source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/CabalExecutioner.java b/Mage.Sets/src/mage/cards/c/CabalExecutioner.java index 7260835daac..87386d8f2cc 100644 --- a/Mage.Sets/src/mage/cards/c/CabalExecutioner.java +++ b/Mage.Sets/src/mage/cards/c/CabalExecutioner.java @@ -67,7 +67,7 @@ class CabalExecutionerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CabalInterrogator.java b/Mage.Sets/src/mage/cards/c/CabalInterrogator.java index e816df2cd82..48d551c67fa 100644 --- a/Mage.Sets/src/mage/cards/c/CabalInterrogator.java +++ b/Mage.Sets/src/mage/cards/c/CabalInterrogator.java @@ -112,7 +112,7 @@ class CabalInterrogatorEffect extends OneShotEffect { card = revealedCards.getRandom(game); } - targetPlayer.discard(card, source, game); + targetPlayer.discard(card, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CabalShrine.java b/Mage.Sets/src/mage/cards/c/CabalShrine.java index fe994ad7734..eb65d5da11c 100644 --- a/Mage.Sets/src/mage/cards/c/CabalShrine.java +++ b/Mage.Sets/src/mage/cards/c/CabalShrine.java @@ -60,7 +60,7 @@ class CabalShrineTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -105,7 +105,7 @@ class CabalShrineEffect extends OneShotEffect { count += player.getGraveyard().count(filterCardName, game); } } - controller.discard(count, false, source, game); + controller.discard(count, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CabalTherapist.java b/Mage.Sets/src/mage/cards/c/CabalTherapist.java index 56725f4cf6d..24777da0288 100644 --- a/Mage.Sets/src/mage/cards/c/CabalTherapist.java +++ b/Mage.Sets/src/mage/cards/c/CabalTherapist.java @@ -95,7 +95,7 @@ class CabalTherapistDiscardEffect extends OneShotEffect { } return !CardUtil.haveSameNames(card, cardName, game); }); - targetPlayer.discard(hand, source, game); + targetPlayer.discard(hand, false, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/c/CabalTherapy.java b/Mage.Sets/src/mage/cards/c/CabalTherapy.java index 569e9a57584..22fb44b0860 100644 --- a/Mage.Sets/src/mage/cards/c/CabalTherapy.java +++ b/Mage.Sets/src/mage/cards/c/CabalTherapy.java @@ -80,7 +80,7 @@ class CabalTherapyEffect extends OneShotEffect { } return !CardUtil.haveSameNames(card, cardName, game); }); - targetPlayer.discard(hand, source, game); + targetPlayer.discard(hand, false, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/c/CagedSun.java b/Mage.Sets/src/mage/cards/c/CagedSun.java index e335e9b7990..439c5ff895c 100644 --- a/Mage.Sets/src/mage/cards/c/CagedSun.java +++ b/Mage.Sets/src/mage/cards/c/CagedSun.java @@ -100,7 +100,7 @@ class CagedSunTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.MANA_ADDED; + return event.getType() == GameEvent.EventType.MANA_ADDED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CallTheCoppercoats.java b/Mage.Sets/src/mage/cards/c/CallTheCoppercoats.java index d4edb90ae12..76273b96462 100644 --- a/Mage.Sets/src/mage/cards/c/CallTheCoppercoats.java +++ b/Mage.Sets/src/mage/cards/c/CallTheCoppercoats.java @@ -76,7 +76,7 @@ class CallTheCoppercoatsEffect extends OneShotEffect { .mapToInt(uuid -> game.getBattlefield().countAll( StaticFilters.FILTER_PERMANENT_CREATURE, uuid, game )).sum(), - game, source.getSourceId(), source.getControllerId() + game, source, source.getControllerId() ); } } diff --git a/Mage.Sets/src/mage/cards/c/CallToHeel.java b/Mage.Sets/src/mage/cards/c/CallToHeel.java index e8127595fca..c74c81a3a0c 100644 --- a/Mage.Sets/src/mage/cards/c/CallToHeel.java +++ b/Mage.Sets/src/mage/cards/c/CallToHeel.java @@ -67,7 +67,7 @@ class CallToHeelEffect extends OneShotEffect { if (permanent != null) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CallousOppressor.java b/Mage.Sets/src/mage/cards/c/CallousOppressor.java index 4ea7f3a5938..f544fbdc404 100644 --- a/Mage.Sets/src/mage/cards/c/CallousOppressor.java +++ b/Mage.Sets/src/mage/cards/c/CallousOppressor.java @@ -118,7 +118,7 @@ class CallousOppressorChooseCreatureTypeEffect extends OneShotEffect { if (controller != null) { TargetOpponent target = new TargetOpponent(true); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } else { diff --git a/Mage.Sets/src/mage/cards/c/CalmingVerse.java b/Mage.Sets/src/mage/cards/c/CalmingVerse.java index a0efbbd80cf..6e49df4b571 100644 --- a/Mage.Sets/src/mage/cards/c/CalmingVerse.java +++ b/Mage.Sets/src/mage/cards/c/CalmingVerse.java @@ -77,7 +77,7 @@ class CalmingVerseEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { // Destroy all other enchantments for (Permanent permanent : game.getBattlefield().getActivePermanents(opponentEnchantmentsFilter, source.getControllerId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } // Then if you control an untapped land, destroy all own enchantments @@ -86,7 +86,7 @@ class CalmingVerseEffect extends OneShotEffect { if (game.getState().getBattlefield().countAll(untappedLandFilter, controller.getId(), game) > 0) { for (Permanent permanent : game.getBattlefield().getActivePermanents(controlledEnchantmentsFilter, source.getControllerId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/c/Camaraderie.java b/Mage.Sets/src/mage/cards/c/Camaraderie.java index 8bbc87a8c50..fc07f33d319 100644 --- a/Mage.Sets/src/mage/cards/c/Camaraderie.java +++ b/Mage.Sets/src/mage/cards/c/Camaraderie.java @@ -67,7 +67,7 @@ class CamaraderieEffect extends OneShotEffect { source.getSourceId(), source.getControllerId(), game ); player.gainLife(xValue, game, source); - player.drawCards(xValue, source.getSourceId(), game); + player.drawCards(xValue, source, game); game.addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn), source); return true; } diff --git a/Mage.Sets/src/mage/cards/c/Camouflage.java b/Mage.Sets/src/mage/cards/c/Camouflage.java index 4ece48153b2..86dd41422d9 100644 --- a/Mage.Sets/src/mage/cards/c/Camouflage.java +++ b/Mage.Sets/src/mage/cards/c/Camouflage.java @@ -22,6 +22,7 @@ import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.combat.CombatGroup; +import mage.game.events.BlockerDeclaredEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -183,10 +184,10 @@ class CamouflageEffect extends ContinuousRuleModifyingEffectImpl { group.addBlockerToGroup(blocker.getId(), blocker.getControllerId(), game); game.getCombat().addBlockingGroup(blocker.getId(), attacker.getId(), blocker.getControllerId(), game); if (notYetBlocked) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, attacker.getId(), null)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, attacker.getId(), source, null)); } // TODO: find an alternate event solution for multi-blockers (as per issue #4285), this will work fine for single blocker creatures though - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BLOCKER_DECLARED, attacker.getId(), blocker.getId(), blocker.getControllerId())); + game.fireEvent(new BlockerDeclaredEvent(attacker.getId(), blocker.getId(), blocker.getControllerId())); } } } diff --git a/Mage.Sets/src/mage/cards/c/CandlesGlow.java b/Mage.Sets/src/mage/cards/c/CandlesGlow.java index 8c9d5388e70..d3829bd6273 100644 --- a/Mage.Sets/src/mage/cards/c/CandlesGlow.java +++ b/Mage.Sets/src/mage/cards/c/CandlesGlow.java @@ -12,6 +12,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.players.Player; import mage.target.common.TargetAnyTarget; @@ -70,20 +71,20 @@ class CandlesGlowPreventDamageTargetEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int prevented; if (event.getAmount() >= this.amount) { int damage = amount; event.setAmount(event.getAmount() - amount); this.used = true; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); prevented = damage; } else { int damage = event.getAmount(); event.setAmount(0); amount -= damage; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); prevented = damage; } diff --git a/Mage.Sets/src/mage/cards/c/Cannibalize.java b/Mage.Sets/src/mage/cards/c/Cannibalize.java index 0d11baf78c4..f9144b09f40 100644 --- a/Mage.Sets/src/mage/cards/c/Cannibalize.java +++ b/Mage.Sets/src/mage/cards/c/Cannibalize.java @@ -69,7 +69,7 @@ class CannibalizeEffect extends OneShotEffect { if (creature != null) { if ((count == 0 && controller.chooseUse(Outcome.Exile, "Exile " + creature.getLogName() + '?', source, game)) || (count == 1 && !exileDone)) { - controller.moveCardToExileWithInfo(creature, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(creature, null, "", source, game, Zone.BATTLEFIELD, true); exileDone = true; } else { creature.addCounters(CounterType.P1P1.createInstance(2), source, game); diff --git a/Mage.Sets/src/mage/cards/c/CantonicaCasino.java b/Mage.Sets/src/mage/cards/c/CantonicaCasino.java index f91d45b6987..97d77800f01 100644 --- a/Mage.Sets/src/mage/cards/c/CantonicaCasino.java +++ b/Mage.Sets/src/mage/cards/c/CantonicaCasino.java @@ -51,15 +51,15 @@ class CantonicaCasinoEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); if (you != null) { // Roll two six-sided dice - int dice1 = you.rollDice(game, 6); - int dice2 = you.rollDice(game, 6); + int dice1 = you.rollDice(source, game, 6); + int dice2 = you.rollDice(source, game, 6); if (dice1 == dice2) { // If you roll doubles, gain 10 life you.gainLife(10, game, source); } else { // Otherwise, lose 1 life - you.loseLife(1, game, false); + you.loseLife(1, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CapriciousEfreet.java b/Mage.Sets/src/mage/cards/c/CapriciousEfreet.java index dbf8c60212c..44fe6b28c5a 100644 --- a/Mage.Sets/src/mage/cards/c/CapriciousEfreet.java +++ b/Mage.Sets/src/mage/cards/c/CapriciousEfreet.java @@ -91,7 +91,7 @@ class CapriciousEfreetEffect extends OneShotEffect { if (!targetPermanents.isEmpty()) { permanent = targetPermanents.get(RandomUtil.nextInt(targetPermanents.size())); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CaptivatingVampire.java b/Mage.Sets/src/mage/cards/c/CaptivatingVampire.java index 1edbe8ce50c..733aba009bb 100644 --- a/Mage.Sets/src/mage/cards/c/CaptivatingVampire.java +++ b/Mage.Sets/src/mage/cards/c/CaptivatingVampire.java @@ -86,7 +86,7 @@ class CaptivatingVampireEffect extends ContinuousEffectImpl { switch (layer) { case ControlChangingEffects_2: if (sublayer == SubLayer.NA) { - permanent.changeControllerId(source.getControllerId(), game); + permanent.changeControllerId(source.getControllerId(), game, source); } break; case TypeChangingEffects_4: diff --git a/Mage.Sets/src/mage/cards/c/CarnageGladiator.java b/Mage.Sets/src/mage/cards/c/CarnageGladiator.java index 830871e3417..7db3205d883 100644 --- a/Mage.Sets/src/mage/cards/c/CarnageGladiator.java +++ b/Mage.Sets/src/mage/cards/c/CarnageGladiator.java @@ -69,7 +69,7 @@ class CarnageGladiatorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CarnivalCarnage.java b/Mage.Sets/src/mage/cards/c/CarnivalCarnage.java index e5cdc2a4437..cc765727975 100644 --- a/Mage.Sets/src/mage/cards/c/CarnivalCarnage.java +++ b/Mage.Sets/src/mage/cards/c/CarnivalCarnage.java @@ -72,10 +72,10 @@ class CarnivalEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.damage(1, source.getSourceId(), game); + permanent.damage(1, source.getSourceId(), source, game); Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.damage(1, source.getSourceId(), game); + player.damage(1, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java b/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java index aa822e5b2e0..dc07dc80573 100644 --- a/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java +++ b/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java @@ -64,8 +64,8 @@ class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.PRECOMBAT_MAIN_PHASE_PRE - || event.getType() == EventType.POSTCOMBAT_MAIN_PHASE_PRE; + return event.getType() == GameEvent.EventType.PRECOMBAT_MAIN_PHASE_PRE + || event.getType() == GameEvent.EventType.POSTCOMBAT_MAIN_PHASE_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CarryAway.java b/Mage.Sets/src/mage/cards/c/CarryAway.java index 1834ff36193..a6b3ab71929 100644 --- a/Mage.Sets/src/mage/cards/c/CarryAway.java +++ b/Mage.Sets/src/mage/cards/c/CarryAway.java @@ -79,7 +79,7 @@ class CarryAwayEffect extends OneShotEffect { if (enchantedEquipment != null) { Permanent equippedCreature = game.getPermanent(enchantedEquipment.getAttachedTo()); if (equippedCreature != null) { - return equippedCreature.removeAttachment(enchantedEquipment.getId(), game); + return equippedCreature.removeAttachment(enchantedEquipment.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/c/Cataclysm.java b/Mage.Sets/src/mage/cards/c/Cataclysm.java index 979b3055af8..76141f38298 100644 --- a/Mage.Sets/src/mage/cards/c/Cataclysm.java +++ b/Mage.Sets/src/mage/cards/c/Cataclysm.java @@ -67,8 +67,8 @@ class CataclysmEffect extends OneShotEffect { Target target3 = new TargetControlledPermanent(1, 1, new FilterControlledEnchantmentPermanent(), true); Target target4 = new TargetControlledPermanent(1, 1, new FilterControlledLandPermanent(), true); - if (target1.canChoose(player.getId(), game)) { - while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game)) { + if (target1.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target1.isChosen() && target1.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target1, source, game); } Permanent artifact = game.getPermanent(target1.getFirstTarget()); @@ -78,8 +78,8 @@ class CataclysmEffect extends OneShotEffect { target1.clearChosen(); } - if (target2.canChoose(player.getId(), game)) { - while (player.canRespond() && !target2.isChosen() && target2.canChoose(player.getId(), game)) { + if (target2.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target2.isChosen() && target2.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target2, source, game); } Permanent creature = game.getPermanent(target2.getFirstTarget()); @@ -89,8 +89,8 @@ class CataclysmEffect extends OneShotEffect { target2.clearChosen(); } - if (target3.canChoose(player.getId(), game)) { - while (player.canRespond() && !target3.isChosen() && target3.canChoose(player.getId(), game)) { + if (target3.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target3.isChosen() && target3.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target3, source, game); } Permanent enchantment = game.getPermanent(target3.getFirstTarget()); @@ -100,8 +100,8 @@ class CataclysmEffect extends OneShotEffect { target3.clearChosen(); } - if (target4.canChoose(player.getId(), game)) { - while (player.canRespond() && !target4.isChosen() && target4.canChoose(player.getId(), game)) { + if (target4.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target4.isChosen() && target4.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target4, source, game); } Permanent land = game.getPermanent(target4.getFirstTarget()); @@ -115,7 +115,7 @@ class CataclysmEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (!chosen.contains(permanent)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CataclysmicGearhulk.java b/Mage.Sets/src/mage/cards/c/CataclysmicGearhulk.java index f3e58623e0e..d1551428b61 100644 --- a/Mage.Sets/src/mage/cards/c/CataclysmicGearhulk.java +++ b/Mage.Sets/src/mage/cards/c/CataclysmicGearhulk.java @@ -100,8 +100,8 @@ class CataclysmicGearhulkEffect extends OneShotEffect { Target target3 = new TargetControlledPermanent(1, 1, filterEnchantment, true); Target target4 = new TargetControlledPermanent(1, 1, filterPlaneswalker, true); - if (target1.canChoose(player.getId(), game)) { - while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game)) { + if (target1.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target1.isChosen() && target1.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target1, source, game); } Permanent artifact = game.getPermanent(target1.getFirstTarget()); @@ -111,8 +111,8 @@ class CataclysmicGearhulkEffect extends OneShotEffect { target1.clearChosen(); } - if (target2.canChoose(player.getId(), game)) { - while (player.canRespond() && !target2.isChosen() && target2.canChoose(player.getId(), game)) { + if (target2.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target2.isChosen() && target2.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target2, source, game); } Permanent creature = game.getPermanent(target2.getFirstTarget()); @@ -122,8 +122,8 @@ class CataclysmicGearhulkEffect extends OneShotEffect { target2.clearChosen(); } - if (target3.canChoose(player.getId(), game)) { - while (player.canRespond() && !target3.isChosen() && target3.canChoose(player.getId(), game)) { + if (target3.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target3.isChosen() && target3.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target3, source, game); } Permanent enchantment = game.getPermanent(target3.getFirstTarget()); @@ -133,8 +133,8 @@ class CataclysmicGearhulkEffect extends OneShotEffect { target3.clearChosen(); } - if (target4.canChoose(player.getId(), game)) { - while (player.canRespond() && !target4.isChosen() && target4.canChoose(player.getId(), game)) { + if (target4.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target4.isChosen() && target4.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target4, source, game); } Permanent planeswalker = game.getPermanent(target4.getFirstTarget()); @@ -148,7 +148,7 @@ class CataclysmicGearhulkEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (!chosen.contains(permanent) && !permanent.isLand()) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/Catastrophe.java b/Mage.Sets/src/mage/cards/c/Catastrophe.java index 2904ce21182..89f9d5a5a65 100644 --- a/Mage.Sets/src/mage/cards/c/Catastrophe.java +++ b/Mage.Sets/src/mage/cards/c/Catastrophe.java @@ -59,11 +59,11 @@ class CatastropheEffect extends OneShotEffect { if (controller != null) { if (controller.chooseUse(outcome, "Destroy all lands? (otherwise all creatures are destroyed)", source, game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), controller.getId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, permanent.isCreature()); + permanent.destroy(source, game, permanent.isCreature()); } } else { for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CatchRelease.java b/Mage.Sets/src/mage/cards/c/CatchRelease.java index 8e2da45ed2a..44e2afa429c 100644 --- a/Mage.Sets/src/mage/cards/c/CatchRelease.java +++ b/Mage.Sets/src/mage/cards/c/CatchRelease.java @@ -86,8 +86,8 @@ class ReleaseSacrificeEffect extends OneShotEffect { Target target4 = new TargetControlledPermanent(1, 1, new FilterControlledLandPermanent(), true); Target target5 = new TargetControlledPermanent(1, 1, new FilterControlledPlaneswalkerPermanent(), true); - if (target1.canChoose(player.getId(), game)) { - while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game)) { + if (target1.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target1.isChosen() && target1.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target1, source, game); } Permanent artifact = game.getPermanent(target1.getFirstTarget()); @@ -97,8 +97,8 @@ class ReleaseSacrificeEffect extends OneShotEffect { target1.clearChosen(); } - if (target2.canChoose(player.getId(), game)) { - while (player.canRespond() && !target2.isChosen() && target2.canChoose(player.getId(), game)) { + if (target2.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target2.isChosen() && target2.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target2, source, game); } Permanent creature = game.getPermanent(target2.getFirstTarget()); @@ -108,8 +108,8 @@ class ReleaseSacrificeEffect extends OneShotEffect { target2.clearChosen(); } - if (target3.canChoose(player.getId(), game)) { - while (player.canRespond() && !target3.isChosen() && target3.canChoose(player.getId(), game)) { + if (target3.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target3.isChosen() && target3.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target3, source, game); } Permanent enchantment = game.getPermanent(target3.getFirstTarget()); @@ -119,8 +119,8 @@ class ReleaseSacrificeEffect extends OneShotEffect { target3.clearChosen(); } - if (target4.canChoose(player.getId(), game)) { - while (player.canRespond() && !target4.isChosen() && target4.canChoose(player.getId(), game)) { + if (target4.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target4.isChosen() && target4.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target4, source, game); } Permanent land = game.getPermanent(target4.getFirstTarget()); @@ -130,8 +130,8 @@ class ReleaseSacrificeEffect extends OneShotEffect { target4.clearChosen(); } - if (target5.canChoose(player.getId(), game)) { - while (player.canRespond() && !target5.isChosen() && target5.canChoose(player.getId(), game)) { + if (target5.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target5.isChosen() && target5.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target5, source, game); } Permanent planeswalker = game.getPermanent(target5.getFirstTarget()); @@ -146,7 +146,7 @@ class ReleaseSacrificeEffect extends OneShotEffect { for (UUID uuid : chosen) { Permanent permanent = game.getPermanent(uuid); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CathedralMembrane.java b/Mage.Sets/src/mage/cards/c/CathedralMembrane.java index e6fc406db16..5eefc5d5c80 100644 --- a/Mage.Sets/src/mage/cards/c/CathedralMembrane.java +++ b/Mage.Sets/src/mage/cards/c/CathedralMembrane.java @@ -98,7 +98,7 @@ class CathedralMembraneEffect extends OneShotEffect { for (UUID uuid : watcher.getBlockedCreatures()) { Permanent permanent = game.getPermanent(uuid); if (permanent != null) { - permanent.damage(6, source.getSourceId(), game, false, true); + permanent.damage(6, source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/c/CausticWasps.java b/Mage.Sets/src/mage/cards/c/CausticWasps.java index 2792391cf63..77c0bc29bf2 100644 --- a/Mage.Sets/src/mage/cards/c/CausticWasps.java +++ b/Mage.Sets/src/mage/cards/c/CausticWasps.java @@ -66,7 +66,7 @@ class CausticWaspsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java b/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java index ff23a54c38f..26c20011077 100644 --- a/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java +++ b/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java @@ -65,7 +65,7 @@ class CavalcadeOfCalamityEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { return game.damagePlayerOrPlaneswalker( game.getCombat().getDefenderId(targetPointer.getFirst(game, source)), 1, - source.getSourceId(), game, false, true + source.getSourceId(), source, game, false, true ) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/CavalierOfDawn.java b/Mage.Sets/src/mage/cards/c/CavalierOfDawn.java index a77ae3e3fd2..943d249e3e1 100644 --- a/Mage.Sets/src/mage/cards/c/CavalierOfDawn.java +++ b/Mage.Sets/src/mage/cards/c/CavalierOfDawn.java @@ -90,7 +90,7 @@ class CavalierOfDawnEffect extends OneShotEffect { return false; } Player player = game.getPlayer(permanent.getControllerId()); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (player == null) { return false; } diff --git a/Mage.Sets/src/mage/cards/c/CavalierOfFlame.java b/Mage.Sets/src/mage/cards/c/CavalierOfFlame.java index 4de1d6c0877..cd31d66bf15 100644 --- a/Mage.Sets/src/mage/cards/c/CavalierOfFlame.java +++ b/Mage.Sets/src/mage/cards/c/CavalierOfFlame.java @@ -104,8 +104,8 @@ class CavalierOfFlameEffect extends OneShotEffect { } TargetCardInHand target = new TargetCardInHand(0, player.getHand().size(), StaticFilters.FILTER_CARD); if (player.choose(Outcome.Discard, player.getHand(), target, game)) { - int counter = player.discard(new CardsImpl(target.getTargets()), source, game).size(); - player.drawCards(counter, source.getSourceId(), game); + int counter = player.discard(new CardsImpl(target.getTargets()), false, source, game).size(); + player.drawCards(counter, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CelestialMantle.java b/Mage.Sets/src/mage/cards/c/CelestialMantle.java index 787c6339816..b33bf167aab 100644 --- a/Mage.Sets/src/mage/cards/c/CelestialMantle.java +++ b/Mage.Sets/src/mage/cards/c/CelestialMantle.java @@ -77,7 +77,7 @@ class CelestialMantleAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CellarDoor.java b/Mage.Sets/src/mage/cards/c/CellarDoor.java index 8dac0e42d9d..4de5078f956 100644 --- a/Mage.Sets/src/mage/cards/c/CellarDoor.java +++ b/Mage.Sets/src/mage/cards/c/CellarDoor.java @@ -69,7 +69,7 @@ class CellarDoorEffect extends OneShotEffect { player.moveCards(card, Zone.GRAVEYARD, source, game); if (card.isCreature()) { ZombieToken token = new ZombieToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CemeteryRecruitment.java b/Mage.Sets/src/mage/cards/c/CemeteryRecruitment.java index d40353072d9..5579374ac1c 100644 --- a/Mage.Sets/src/mage/cards/c/CemeteryRecruitment.java +++ b/Mage.Sets/src/mage/cards/c/CemeteryRecruitment.java @@ -64,7 +64,7 @@ class CemeteryRecruitmentEffect extends OneShotEffect { if (card != null) { if (controller.moveCards(card, Zone.HAND, source, game) && card.hasSubtype(SubType.ZOMBIE, game)) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CephalidShrine.java b/Mage.Sets/src/mage/cards/c/CephalidShrine.java index afbee0c8035..d7ae4283aba 100644 --- a/Mage.Sets/src/mage/cards/c/CephalidShrine.java +++ b/Mage.Sets/src/mage/cards/c/CephalidShrine.java @@ -61,7 +61,7 @@ class CephalidShrineTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -113,14 +113,14 @@ class CephalidShrineEffect extends OneShotEffect { // even if the cost is 0, we still offer Cost cost = ManaUtil.createManaCost(count, true); if (game.getStack().contains(spell) - && cost.canPay(source, source.getSourceId(), controller.getId(), game) + && cost.canPay(source, source, controller.getId(), game) && controller.chooseUse(outcome, "Pay " + cost.getText() + " to prevent countering " + spell.getName() + "?", source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false) + && cost.pay(source, game, source, controller.getId(), false) && cost.isPaid()) { return false; } else { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); game.informPlayers(spell.getName() + " has been countered due to " + controller.getName() + " not paying " + cost.getText()); return true; diff --git a/Mage.Sets/src/mage/cards/c/CerebralEruption.java b/Mage.Sets/src/mage/cards/c/CerebralEruption.java index 320126ce0fc..3d013ebe630 100644 --- a/Mage.Sets/src/mage/cards/c/CerebralEruption.java +++ b/Mage.Sets/src/mage/cards/c/CerebralEruption.java @@ -60,9 +60,9 @@ class CerebralEruptionEffect extends OneShotEffect { player.revealCards(sourceObject.getIdName(), cards, game); game.getState().setValue(source.getSourceId().toString(), card); int damage = card.getConvertedManaCost(); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, player.getId(), game)) { - perm.damage(damage, source.getSourceId(), game, false, true); + perm.damage(damage, source.getSourceId(), source, game, false, true); } if (card.isLand()) { Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); diff --git a/Mage.Sets/src/mage/cards/c/CerebralVortex.java b/Mage.Sets/src/mage/cards/c/CerebralVortex.java index 307e8a9271c..ca12ecb50cc 100644 --- a/Mage.Sets/src/mage/cards/c/CerebralVortex.java +++ b/Mage.Sets/src/mage/cards/c/CerebralVortex.java @@ -66,7 +66,7 @@ class CerebralVortexEffect extends OneShotEffect { if (targetPlayer != null) { CerebralVortexWatcher watcher = game.getState().getWatcher(CerebralVortexWatcher.class); if (watcher != null) { - targetPlayer.damage(watcher.getDraws(targetPlayer.getId()), source.getSourceId(), game); + targetPlayer.damage(watcher.getDraws(targetPlayer.getId()), source.getSourceId(), source, game); return true; } } @@ -84,7 +84,7 @@ class CerebralVortexWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DREW_CARD) { + if (event.getType() == GameEvent.EventType.DREW_CARD) { int count = 1; if (draws.containsKey(event.getPlayerId())) { count += draws.get(event.getPlayerId()); diff --git a/Mage.Sets/src/mage/cards/c/CertainDeath.java b/Mage.Sets/src/mage/cards/c/CertainDeath.java index c555e0611e9..da4cdfd67b2 100644 --- a/Mage.Sets/src/mage/cards/c/CertainDeath.java +++ b/Mage.Sets/src/mage/cards/c/CertainDeath.java @@ -58,10 +58,10 @@ class CertainDeathEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null && you != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); Player permController = game.getPlayer(permanent.getControllerId()); if (permController != null) { - permController.loseLife(2, game, false); + permController.loseLife(2, game, source, false); you.gainLife(2, game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/c/ChainLightning.java b/Mage.Sets/src/mage/cards/c/ChainLightning.java index 35b7eddc7cf..64df9cff81c 100644 --- a/Mage.Sets/src/mage/cards/c/ChainLightning.java +++ b/Mage.Sets/src/mage/cards/c/ChainLightning.java @@ -63,19 +63,19 @@ class ChainLightningEffect extends OneShotEffect { Player affectedPlayer = null; Player player = game.getPlayer(targetId); if (player != null) { - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); affectedPlayer = player; } else { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); affectedPlayer = game.getPlayer(permanent.getControllerId()); } } if (affectedPlayer != null) { if (affectedPlayer.chooseUse(Outcome.Copy, "Pay {R}{R} to copy the spell?", source, game)) { Cost cost = new ManaCostsImpl("{R}{R}"); - if (cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false, null)) { + if (cost.pay(source, game, source, affectedPlayer.getId(), false, null)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); diff --git a/Mage.Sets/src/mage/cards/c/ChainOfPlasma.java b/Mage.Sets/src/mage/cards/c/ChainOfPlasma.java index d9ae96d54de..70886ad6f93 100644 --- a/Mage.Sets/src/mage/cards/c/ChainOfPlasma.java +++ b/Mage.Sets/src/mage/cards/c/ChainOfPlasma.java @@ -63,19 +63,19 @@ class ChainOfPlasmaEffect extends OneShotEffect { Player affectedPlayer = null; Player player = game.getPlayer(targetId); if (player != null) { - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); affectedPlayer = player; } else { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); affectedPlayer = game.getPlayer(permanent.getControllerId()); } } if (affectedPlayer != null) { if (affectedPlayer.chooseUse(Outcome.Copy, "Discard a card to copy the spell?", source, game)) { Cost cost = new DiscardCardCost(); - if (cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false, null)) { + if (cost.pay(source, game, source, affectedPlayer.getId(), false, null)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); diff --git a/Mage.Sets/src/mage/cards/c/ChainOfSilence.java b/Mage.Sets/src/mage/cards/c/ChainOfSilence.java index 379597d6bae..1e0ac05912a 100644 --- a/Mage.Sets/src/mage/cards/c/ChainOfSilence.java +++ b/Mage.Sets/src/mage/cards/c/ChainOfSilence.java @@ -76,7 +76,7 @@ class ChainOfSilenceEffect extends OneShotEffect { TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ')'), true); if (player != null && player.chooseTarget(Outcome.Sacrifice, target, source, game)) { Permanent land = game.getPermanent(target.getFirstTarget()); - if (land != null && land.sacrifice(source.getSourceId(), game)) { + if (land != null && land.sacrifice(source, game)) { if (player.chooseUse(outcome, "Copy the spell?", source, game)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { diff --git a/Mage.Sets/src/mage/cards/c/ChainOfVapor.java b/Mage.Sets/src/mage/cards/c/ChainOfVapor.java index 4318ad28156..1cea8ca6407 100644 --- a/Mage.Sets/src/mage/cards/c/ChainOfVapor.java +++ b/Mage.Sets/src/mage/cards/c/ChainOfVapor.java @@ -73,7 +73,7 @@ class ChainOfVaporEffect extends OneShotEffect { TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ')'), true); if (player != null && player.chooseTarget(Outcome.Sacrifice, target, source, game)) { Permanent land = game.getPermanent(target.getFirstTarget()); - if (land != null && land.sacrifice(source.getSourceId(), game)) { + if (land != null && land.sacrifice(source, game)) { if (player.chooseUse(outcome, "Copy the spell?", source, game)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { diff --git a/Mage.Sets/src/mage/cards/c/ChainStasis.java b/Mage.Sets/src/mage/cards/c/ChainStasis.java index 142f985c114..d8dac1ef10c 100644 --- a/Mage.Sets/src/mage/cards/c/ChainStasis.java +++ b/Mage.Sets/src/mage/cards/c/ChainStasis.java @@ -78,7 +78,7 @@ class ChainStasisEffect extends OneShotEffect { return false; } Cost cost = new ManaCostsImpl("{2}{U}"); - if (cost.pay(source, game, player.getId(), controller.getId(), false)) { + if (cost.pay(source, game, source, controller.getId(), false)) { if (player.chooseUse(outcome, "Copy the spell?", source, game)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { diff --git a/Mage.Sets/src/mage/cards/c/ChainersTorment.java b/Mage.Sets/src/mage/cards/c/ChainersTorment.java index 759f2574a20..6f6057e45c5 100644 --- a/Mage.Sets/src/mage/cards/c/ChainersTorment.java +++ b/Mage.Sets/src/mage/cards/c/ChainersTorment.java @@ -79,7 +79,7 @@ class ChainersTormentEffect extends OneShotEffect { for (UUID tokenId : effect.getLastAddedTokenIds()) { Permanent token = game.getPermanentOrLKIBattlefield(tokenId); if (token != null) { - player.damage(xValue, tokenId, game); + player.damage(xValue, tokenId, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java b/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java index cf972c5e771..2b8b4b2580e 100644 --- a/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java +++ b/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java @@ -72,7 +72,7 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl { return true; } else { // discards a card instead. If the player discards a card this way, they draw a card. - player.discard(1, false, source, game); + player.discard(1, false, false, source, game); return false; // because player draws a card, the draw event is kept } } diff --git a/Mage.Sets/src/mage/cards/c/ChancellorOfTheAnnex.java b/Mage.Sets/src/mage/cards/c/ChancellorOfTheAnnex.java index 5a41b66a398..591b7a9c9e4 100644 --- a/Mage.Sets/src/mage/cards/c/ChancellorOfTheAnnex.java +++ b/Mage.Sets/src/mage/cards/c/ChancellorOfTheAnnex.java @@ -99,7 +99,7 @@ class ChancellorOfTheAnnexDelayedTriggeredAbility extends DelayedTriggeredAbilit @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChancellorOfTheDross.java b/Mage.Sets/src/mage/cards/c/ChancellorOfTheDross.java index d8c83202b5c..28bcfc0ecfc 100644 --- a/Mage.Sets/src/mage/cards/c/ChancellorOfTheDross.java +++ b/Mage.Sets/src/mage/cards/c/ChancellorOfTheDross.java @@ -62,7 +62,7 @@ class ChancellorOfTheDrossDelayedTriggeredAbility extends DelayedTriggeredAbilit @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -90,7 +90,7 @@ class ChancellorOfTheDrossEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int loseLife = 0; for (UUID opponentId : game.getOpponents(source.getControllerId())) { - loseLife += game.getPlayer(opponentId).loseLife(3, game, false); + loseLife += game.getPlayer(opponentId).loseLife(3, game, source, false); } if (loseLife > 0) { game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source); diff --git a/Mage.Sets/src/mage/cards/c/ChancellorOfTheForge.java b/Mage.Sets/src/mage/cards/c/ChancellorOfTheForge.java index 2a9dc6fc88c..b1cabb2b0d3 100644 --- a/Mage.Sets/src/mage/cards/c/ChancellorOfTheForge.java +++ b/Mage.Sets/src/mage/cards/c/ChancellorOfTheForge.java @@ -71,7 +71,7 @@ class ChancellorOfTheForgeDelayedTriggeredAbility extends DelayedTriggeredAbilit @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChancellorOfTheSpires.java b/Mage.Sets/src/mage/cards/c/ChancellorOfTheSpires.java index 8d85f07d285..75644b9222e 100644 --- a/Mage.Sets/src/mage/cards/c/ChancellorOfTheSpires.java +++ b/Mage.Sets/src/mage/cards/c/ChancellorOfTheSpires.java @@ -77,7 +77,7 @@ class ChancellorOfTheSpiresDelayedTriggeredAbility extends DelayedTriggeredAbili @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChancellorOfTheTangle.java b/Mage.Sets/src/mage/cards/c/ChancellorOfTheTangle.java index 3b61a924634..6b5bb2194d2 100644 --- a/Mage.Sets/src/mage/cards/c/ChancellorOfTheTangle.java +++ b/Mage.Sets/src/mage/cards/c/ChancellorOfTheTangle.java @@ -62,7 +62,7 @@ class ChancellorOfTheTangleDelayedTriggeredAbility extends DelayedTriggeredAbili @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.PRECOMBAT_MAIN_PHASE_PRE; + return event.getType() == GameEvent.EventType.PRECOMBAT_MAIN_PHASE_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChandraAblaze.java b/Mage.Sets/src/mage/cards/c/ChandraAblaze.java index 4af1d85d86e..67909eca577 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraAblaze.java +++ b/Mage.Sets/src/mage/cards/c/ChandraAblaze.java @@ -91,7 +91,7 @@ class ChandraAblazeEffect1 extends OneShotEffect { player.choose(Outcome.Discard, target, source.getSourceId(), game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - player.discard(card, source, game); + player.discard(card, false, source, game); source.getEffects().get(1).setValue("discardedCard", card); game.getState().setValue(source.getSourceId().toString(), card); return true; @@ -123,13 +123,13 @@ class ChandraAblazeEffect2 extends OneShotEffect { if (card != null && card.getColor(game).isRed()) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(4, source.getSourceId(), game, false, true); + permanent.damage(4, source.getSourceId(), source, game, false, true); return true; } Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(4, source.getSourceId(), game); + player.damage(4, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/ChandraAcolyteOfFlame.java b/Mage.Sets/src/mage/cards/c/ChandraAcolyteOfFlame.java index 61870696693..5c87e62c390 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraAcolyteOfFlame.java +++ b/Mage.Sets/src/mage/cards/c/ChandraAcolyteOfFlame.java @@ -100,7 +100,7 @@ class ChandraAcolyteOfFlameEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Token token = new RedElementalToken(); - token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(2, game, source, source.getControllerId()); token.getLastAddedTokenIds().stream().forEach(permId -> { Permanent permanent = game.getPermanent(permId); @@ -205,12 +205,7 @@ class ChandraAcolyteOfFlameReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - Card card = game.getCard(this.cardId); - if (controller != null && card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); - return true; - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } diff --git a/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java b/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java index 052ed7c91fc..bd3011a153a 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java +++ b/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java @@ -70,7 +70,7 @@ class ChandraFireArtisanTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getAmount() == 0 || !event.getData().equals("loyalty") - || !event.getTargetId().equals(getSourceId())) { + || !event.getTargetId().equals(this.getSourceId())) { return false; } this.getEffects().clear(); diff --git a/Mage.Sets/src/mage/cards/c/ChandraFlamecaller.java b/Mage.Sets/src/mage/cards/c/ChandraFlamecaller.java index 2124bf9f024..29fe6f395b2 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraFlamecaller.java +++ b/Mage.Sets/src/mage/cards/c/ChandraFlamecaller.java @@ -106,8 +106,8 @@ class ChandraDrawEffect extends OneShotEffect { if (player == null) { return false; } - int amount = player.discard(player.getHand(), source, game).size(); - player.drawCards(amount + 1, source.getSourceId(), game); + int amount = player.discard(player.getHand(), false, source, game).size(); + player.drawCards(amount + 1, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/ChandraFlamesFury.java b/Mage.Sets/src/mage/cards/c/ChandraFlamesFury.java index 13f06164bfa..454b0153f82 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraFlamesFury.java +++ b/Mage.Sets/src/mage/cards/c/ChandraFlamesFury.java @@ -89,8 +89,8 @@ class ChandraFlamesFuryEffect extends OneShotEffect { if (player == null) { return false; } - permanent.damage(4, source.getSourceId(), game); - player.damage(2, source.getSourceId(), game); + permanent.damage(4, source.getSourceId(), source, game); + player.damage(2, source.getSourceId(), source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java b/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java index 50c31a52ebc..f5e9b08bb86 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java +++ b/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java @@ -89,10 +89,10 @@ class ChandraPyromasterEffect1 extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), - 1, source.getSourceId(), game, false, true); + 1, source.getSourceId(), source, game, false, true); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { - creature.damage(1, source.getSourceId(), game, false, true); + creature.damage(1, source.getSourceId(), source, game, false, true); ContinuousEffect effect = new CantBlockTargetEffect(Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java b/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java index f1fdc354327..679e210e22c 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java +++ b/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java @@ -86,7 +86,7 @@ class ChandraRoaringFlameEmblemEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(controller.getId())) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - if (opponent.damage(6, source.getSourceId(), game) > 0) { + if (opponent.damage(6, source.getSourceId(), source, game) > 0) { opponentsEmblem.add(opponent); } } diff --git a/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java b/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java index 905b6b4db13..70cbef16443 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java +++ b/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java @@ -79,7 +79,7 @@ class ChandraTheFirebrandAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChandrasDefeat.java b/Mage.Sets/src/mage/cards/c/ChandrasDefeat.java index 2915dac0146..af7b0453a40 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasDefeat.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasDefeat.java @@ -78,13 +78,13 @@ class ChandrasDefeatEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (permanent != null) { - permanent.damage(5, source.getSourceId(), game, false, true); + permanent.damage(5, source.getSourceId(), source, game, false, true); // If it was a Chandra planeswalker, you may discard a card. If you do, draw a card if (filter.match(permanent, game) && controller != null && controller.chooseUse(outcome, "Discard a card and draw a card?", source, game)) { - controller.discard(1, false, source, game); - controller.drawCards(1, source.getSourceId(), game); + controller.discard(1, false, false, source, game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/ChandrasIgnition.java b/Mage.Sets/src/mage/cards/c/ChandrasIgnition.java index 55208af5e2c..8fd0bddf450 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasIgnition.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasIgnition.java @@ -59,13 +59,13 @@ class ChandrasIgnitionEffect extends OneShotEffect { if (targetCreature != null && targetCreature.getPower().getValue() > 0) { for (Permanent creature : game.getState().getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { if (!creature.getId().equals(targetCreature.getId())) { - creature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game, false, true); + creature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), source, game, false, true); } } for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game); + opponent.damage(targetCreature.getPower().getValue(), targetCreature.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChandrasPhoenix.java b/Mage.Sets/src/mage/cards/c/ChandrasPhoenix.java index 5efc3043906..a14b5510e5f 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasPhoenix.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasPhoenix.java @@ -71,7 +71,7 @@ class ChandrasPhoenixTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChandrasPyreling.java b/Mage.Sets/src/mage/cards/c/ChandrasPyreling.java index 833a3d64759..380ba8a5b91 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasPyreling.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasPyreling.java @@ -64,7 +64,7 @@ class ChandrasPyrelingAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChandrasRegulator.java b/Mage.Sets/src/mage/cards/c/ChandrasRegulator.java index 53010c2af07..0546755dae8 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasRegulator.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasRegulator.java @@ -88,12 +88,12 @@ class ChandrasRegulatorEffect extends OneShotEffect { if (player == null) { return false; } - if (!cost.canPay(source, source.getSourceId(), player.getId(), game) + if (!cost.canPay(source, source, player.getId(), game) || !player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) { return true; } - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (!cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } StackAbility ability = (StackAbility) getValue("stackAbility"); diff --git a/Mage.Sets/src/mage/cards/c/ChandrasRevolution.java b/Mage.Sets/src/mage/cards/c/ChandrasRevolution.java index 2ccf2df9e26..25534a8d790 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasRevolution.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasRevolution.java @@ -64,13 +64,13 @@ class ChandrasRevolutionEffect extends OneShotEffect { // Chandra's Revolution deals 4 damage to target creature. Permanent permanent = game.getPermanent(source.getTargets().get(0).getFirstTarget()); if (permanent != null) { - applied |= permanent.damage(4, source.getSourceId(), game, false, true) > 0; + applied |= permanent.damage(4, source.getSourceId(), source, game, false, true) > 0; } permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { // Tap target land. That land doesn't untap during its controller's next untap step. - permanent.tap(game); + permanent.tap(source, game); ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("that land"); effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/c/ChandrasSpitfire.java b/Mage.Sets/src/mage/cards/c/ChandrasSpitfire.java index 3d29b0c70d4..bf830d49b9f 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasSpitfire.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasSpitfire.java @@ -58,7 +58,7 @@ class ChandrasSpitfireAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChandrasTriumph.java b/Mage.Sets/src/mage/cards/c/ChandrasTriumph.java index 7cfc8e92881..356df7abe44 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasTriumph.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasTriumph.java @@ -78,6 +78,6 @@ class ChandrasTriumphEffect extends OneShotEffect { if (!game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).isEmpty()) { damage = 5; } - return permanent.damage(damage, source.getSourceId(), game) > 0; + return permanent.damage(damage, source.getSourceId(), source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/Channel.java b/Mage.Sets/src/mage/cards/c/Channel.java index 5bec98c7b1e..1726d9f1497 100644 --- a/Mage.Sets/src/mage/cards/c/Channel.java +++ b/Mage.Sets/src/mage/cards/c/Channel.java @@ -110,7 +110,7 @@ class ChannelDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.CLEANUP_STEP_PRE; + return event.getType() == GameEvent.EventType.CLEANUP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChannelHarm.java b/Mage.Sets/src/mage/cards/c/ChannelHarm.java index ecd7da14f4f..10cbd239666 100644 --- a/Mage.Sets/src/mage/cards/c/ChannelHarm.java +++ b/Mage.Sets/src/mage/cards/c/ChannelHarm.java @@ -71,7 +71,7 @@ class ChannelHarmEffect extends PreventionEffectImpl { Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null) { if (sourceController != null && sourceController.chooseUse(outcome, "Would you like to have " + preventionData.getPreventedDamage() + " damage dealt to " + targetCreature.getLogName() + "?", source, game)) { - targetCreature.damage(preventionData.getPreventedDamage(), source.getSourceId(), game, false, true); + targetCreature.damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChanneledForce.java b/Mage.Sets/src/mage/cards/c/ChanneledForce.java index 0ffaf39118a..508bf069f34 100644 --- a/Mage.Sets/src/mage/cards/c/ChanneledForce.java +++ b/Mage.Sets/src/mage/cards/c/ChanneledForce.java @@ -67,11 +67,11 @@ class ChanneledForceEffect extends OneShotEffect { } Player player = game.getPlayer(source.getTargets().get(0).getFirstTarget()); if (player != null) { - player.drawCards(xValue, source.getSourceId(), game); + player.drawCards(xValue, source, game); } game.damagePlayerOrPlaneswalker( source.getTargets().get(1).getFirstTarget(), xValue, - source.getSourceId(), game, false, true + source.getSourceId(), source, game, false, true ); return true; } diff --git a/Mage.Sets/src/mage/cards/c/ChaosHarlequin.java b/Mage.Sets/src/mage/cards/c/ChaosHarlequin.java index 07f2459aa81..e18183a1daa 100644 --- a/Mage.Sets/src/mage/cards/c/ChaosHarlequin.java +++ b/Mage.Sets/src/mage/cards/c/ChaosHarlequin.java @@ -67,7 +67,7 @@ class ChaosHarlequinEffect extends OneShotEffect { if (player != null) { Card card = player.getLibrary().getFromTop(game); if (card != null) { - player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + player.moveCardToExileWithInfo(card, null, "", source, game, Zone.LIBRARY, true); if (card.isLand()) { game.addEffect(new BoostSourceEffect(-4, 0, Duration.EndOfTurn), source); } else { diff --git a/Mage.Sets/src/mage/cards/c/ChaosLord.java b/Mage.Sets/src/mage/cards/c/ChaosLord.java index 71736f0bd49..994971dcdf5 100644 --- a/Mage.Sets/src/mage/cards/c/ChaosLord.java +++ b/Mage.Sets/src/mage/cards/c/ChaosLord.java @@ -124,7 +124,7 @@ class GainControlSourceEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/c/ChaosMoon.java b/Mage.Sets/src/mage/cards/c/ChaosMoon.java index 2d3e2b753cd..763bde414b8 100644 --- a/Mage.Sets/src/mage/cards/c/ChaosMoon.java +++ b/Mage.Sets/src/mage/cards/c/ChaosMoon.java @@ -113,13 +113,13 @@ class ChaosMoonOddTriggeredAbility extends DelayedTriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent land = game.getPermanent(event.getTargetId()); - if (land != null && filter.match(land, game)) { + Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (land != null && filter.match(land, getSourceId(), getControllerId(), game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(land.getControllerId())); } @@ -176,15 +176,14 @@ class ChaosMoonEvenReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); - if (mageObject != null && mageObject.isLand()) { - Permanent land = game.getPermanent(event.getSourceId()); - return land != null && filter.match(land, game); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null && permanent.isLand()) { + return filter.match(permanent, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/c/ChaosWarp.java b/Mage.Sets/src/mage/cards/c/ChaosWarp.java index 0a38d9eb5ef..7399afadae9 100644 --- a/Mage.Sets/src/mage/cards/c/ChaosWarp.java +++ b/Mage.Sets/src/mage/cards/c/ChaosWarp.java @@ -66,7 +66,7 @@ class ChaosWarpShuffleIntoLibraryEffect extends OneShotEffect { if (permanent != null) { Player owner = game.getPlayer(permanent.getOwnerId()); if (owner != null) { - owner.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + owner.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, true, true); owner.shuffleLibrary(source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/c/ChaoticBacklash.java b/Mage.Sets/src/mage/cards/c/ChaoticBacklash.java index 4d81fa26dc5..37f5e9bc801 100644 --- a/Mage.Sets/src/mage/cards/c/ChaoticBacklash.java +++ b/Mage.Sets/src/mage/cards/c/ChaoticBacklash.java @@ -70,7 +70,7 @@ class ChaoticBacklashEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { int amount = 2 * game.getBattlefield().countAll(filter, targetPlayer.getId(), game); - targetPlayer.damage(amount, source.getSourceId(), game); + targetPlayer.damage(amount, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/ChargeOfTheForeverBeast.java b/Mage.Sets/src/mage/cards/c/ChargeOfTheForeverBeast.java index 6e878e63de3..4d3f6ef11a4 100644 --- a/Mage.Sets/src/mage/cards/c/ChargeOfTheForeverBeast.java +++ b/Mage.Sets/src/mage/cards/c/ChargeOfTheForeverBeast.java @@ -71,6 +71,6 @@ class ChargeOfTheForeverBeastEffect extends OneShotEffect { if (card == null) { return false; } - return permanent.damage(card.getPower().getValue(), source.getSourceId(), game) > 0; + return permanent.damage(card.getPower().getValue(), source.getSourceId(), source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java b/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java index 725562f95d0..be386db0bbe 100644 --- a/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java +++ b/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java @@ -97,7 +97,7 @@ class ChargingCinderhornDamageTargetEffect extends OneShotEffect { DynamicValue amount = new CountersSourceCount(CounterType.FURY); Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CharmbreakerDevils.java b/Mage.Sets/src/mage/cards/c/CharmbreakerDevils.java index 45264614756..ef2aab99f96 100644 --- a/Mage.Sets/src/mage/cards/c/CharmbreakerDevils.java +++ b/Mage.Sets/src/mage/cards/c/CharmbreakerDevils.java @@ -88,7 +88,7 @@ class CharmbreakerDevilsEffect extends OneShotEffect { Card[] cards = player.getGraveyard().getCards(filter, game).toArray(new Card[0]); if (cards.length > 0) { Card card = cards[RandomUtil.nextInt(cards.length)]; - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); game.informPlayers("Charmbreaker Devils: " + card.getName() + " returned to the hand of " + player.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/c/CharmingPrince.java b/Mage.Sets/src/mage/cards/c/CharmingPrince.java index 1ed2dc9b705..24a21d37b41 100644 --- a/Mage.Sets/src/mage/cards/c/CharmingPrince.java +++ b/Mage.Sets/src/mage/cards/c/CharmingPrince.java @@ -98,7 +98,7 @@ class CharmingPrinceEffect extends OneShotEffect { if (permanent == null) { return false; } - if (!controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (!controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true)) { return false; } //create delayed triggered ability diff --git a/Mage.Sets/src/mage/cards/c/ChartACourse.java b/Mage.Sets/src/mage/cards/c/ChartACourse.java index a111a9d465b..93afed7f1e5 100644 --- a/Mage.Sets/src/mage/cards/c/ChartACourse.java +++ b/Mage.Sets/src/mage/cards/c/ChartACourse.java @@ -61,7 +61,7 @@ class ChartACourseEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && !RaidCondition.instance.apply(game, source)) { - player.discard(1, false, source, game); + player.discard(1, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/ChecksAndBalances.java b/Mage.Sets/src/mage/cards/c/ChecksAndBalances.java index 6a54d656439..264d6967ea8 100644 --- a/Mage.Sets/src/mage/cards/c/ChecksAndBalances.java +++ b/Mage.Sets/src/mage/cards/c/ChecksAndBalances.java @@ -104,12 +104,12 @@ class ChecksAndBalancesEffect extends OneShotEffect { TargetCardInHand target = new TargetCardInHand(); if (player.choose(Outcome.Discard, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); - player.discard(card, source, game); + player.discard(card, false, source, game); } } } - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/ChickenEgg.java b/Mage.Sets/src/mage/cards/c/ChickenEgg.java index 87018138c13..16b6dc2d81a 100644 --- a/Mage.Sets/src/mage/cards/c/ChickenEgg.java +++ b/Mage.Sets/src/mage/cards/c/ChickenEgg.java @@ -60,7 +60,7 @@ class ChickenEggEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int result = controller.rollDice(game, 6); + int result = controller.rollDice(source, game, 6); if (result == 6) { new SacrificeSourceEffect().apply(game, source); return (new CreateTokenEffect(new GiantBirdToken(), 1)).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/c/ChimneyImp.java b/Mage.Sets/src/mage/cards/c/ChimneyImp.java index 455b303dda8..3c13d0fb4f8 100644 --- a/Mage.Sets/src/mage/cards/c/ChimneyImp.java +++ b/Mage.Sets/src/mage/cards/c/ChimneyImp.java @@ -78,7 +78,7 @@ class ChimneyImpEffect extends OneShotEffect { targetOpponent.choose(Outcome.Detriment, target, source.getSourceId(), game); Card card = targetOpponent.getHand().get(target.getFirstTarget(), game); if (card != null) { - targetOpponent.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + targetOpponent.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/ChitteringRats.java b/Mage.Sets/src/mage/cards/c/ChitteringRats.java index b4d98ea99df..daf109d3d46 100644 --- a/Mage.Sets/src/mage/cards/c/ChitteringRats.java +++ b/Mage.Sets/src/mage/cards/c/ChitteringRats.java @@ -75,7 +75,7 @@ class ChitteringRatsEffect extends OneShotEffect { targetOpponent.choose(Outcome.Detriment, target, source.getSourceId(), game); Card card = targetOpponent.getHand().get(target.getFirstTarget(), game); if (card != null) { - targetOpponent.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + targetOpponent.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/ChoiceOfDamnations.java b/Mage.Sets/src/mage/cards/c/ChoiceOfDamnations.java index f7c51aea941..93608823456 100644 --- a/Mage.Sets/src/mage/cards/c/ChoiceOfDamnations.java +++ b/Mage.Sets/src/mage/cards/c/ChoiceOfDamnations.java @@ -67,7 +67,7 @@ class ChoiceOfDamnationsEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.chooseUse(outcome, "Shall " + targetPlayer.getLogName() + " lose " + amount + " life?", source, game)) { - targetPlayer.loseLife(amount, game, false); + targetPlayer.loseLife(amount, game, source, false); } else { int numberPermanents = game.getState().getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId(), game); if (numberPermanents > amount) { @@ -77,7 +77,7 @@ class ChoiceOfDamnationsEffect extends OneShotEffect { for (UUID uuid : target.getTargets()) { Permanent permanent = game.getPermanent(uuid); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChokingSands.java b/Mage.Sets/src/mage/cards/c/ChokingSands.java index ca4801f552f..d63bdeb41b2 100644 --- a/Mage.Sets/src/mage/cards/c/ChokingSands.java +++ b/Mage.Sets/src/mage/cards/c/ChokingSands.java @@ -72,7 +72,7 @@ class ChokingSandsEffect extends OneShotEffect { if (permanent != null && !permanent.isBasic()) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/ChronicFlooding.java b/Mage.Sets/src/mage/cards/c/ChronicFlooding.java index 131327bd244..245aafaad90 100644 --- a/Mage.Sets/src/mage/cards/c/ChronicFlooding.java +++ b/Mage.Sets/src/mage/cards/c/ChronicFlooding.java @@ -66,7 +66,7 @@ class ChronicFloodingAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED; + return event.getType() == GameEvent.EventType.TAPPED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ChroniclerOfHeroes.java b/Mage.Sets/src/mage/cards/c/ChroniclerOfHeroes.java index a5a3cbccd56..df7f14ee74e 100644 --- a/Mage.Sets/src/mage/cards/c/ChroniclerOfHeroes.java +++ b/Mage.Sets/src/mage/cards/c/ChroniclerOfHeroes.java @@ -74,7 +74,7 @@ class ChroniclerOfHeroesEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (new PermanentsOnTheBattlefieldCondition(filter).apply(game, source)) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CinderCloud.java b/Mage.Sets/src/mage/cards/c/CinderCloud.java index a2208fc8ade..9632ad9685c 100644 --- a/Mage.Sets/src/mage/cards/c/CinderCloud.java +++ b/Mage.Sets/src/mage/cards/c/CinderCloud.java @@ -58,7 +58,7 @@ class CinderCloudEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (permanent != null && permanent.destroy(source.getSourceId(), game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) { + if (permanent != null && permanent.destroy(source, game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) { game.getState().processAction(game); if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId()) && game.getState().getZone(permanent.getId()) != Zone.GRAVEYARD) { @@ -68,7 +68,7 @@ class CinderCloudEffect extends OneShotEffect { Player permanentController = game.getPlayer(permanent.getControllerId()); if (permanentController != null) { int damage = permanent.getPower().getValue(); - permanentController.damage(damage, source.getSourceId(), game); + permanentController.damage(damage, source.getSourceId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/c/CinderSeer.java b/Mage.Sets/src/mage/cards/c/CinderSeer.java index 1b520476c43..83770ff38d6 100644 --- a/Mage.Sets/src/mage/cards/c/CinderSeer.java +++ b/Mage.Sets/src/mage/cards/c/CinderSeer.java @@ -78,7 +78,7 @@ class CinderSeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/c/Cindervines.java b/Mage.Sets/src/mage/cards/c/Cindervines.java index 80233fc9451..528170c47e1 100644 --- a/Mage.Sets/src/mage/cards/c/Cindervines.java +++ b/Mage.Sets/src/mage/cards/c/Cindervines.java @@ -81,8 +81,8 @@ class CindervinesEffect extends OneShotEffect { if (player == null) { return false; } - permanent.destroy(source.getSourceId(), game, false); - player.damage(2, source.getSourceId(), game); + permanent.destroy(source, game, false); + player.damage(2, source.getSourceId(), source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/CircleOfFlame.java b/Mage.Sets/src/mage/cards/c/CircleOfFlame.java index dc1c26cd8d2..6ab381e41ba 100644 --- a/Mage.Sets/src/mage/cards/c/CircleOfFlame.java +++ b/Mage.Sets/src/mage/cards/c/CircleOfFlame.java @@ -57,7 +57,7 @@ class CircleOfFlameTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CirclingVultures.java b/Mage.Sets/src/mage/cards/c/CirclingVultures.java index bee9f4ca4b1..ba55b3ca301 100644 --- a/Mage.Sets/src/mage/cards/c/CirclingVultures.java +++ b/Mage.Sets/src/mage/cards/c/CirclingVultures.java @@ -99,6 +99,6 @@ class CirclingVulturesDiscardEffect extends OneShotEffect { return false; } - return player.discard(card, source, game); + return player.discard(card, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java b/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java index 8d8972b26a0..803f88e3554 100644 --- a/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java +++ b/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java @@ -95,7 +95,7 @@ class CircuDimirLobotomistEffect extends OneShotEffect { if (controller != null && playerTargetLibrary != null && sourcePermanent != null) { UUID exileId = CardUtil.getCardExileZoneId(game, source); controller.moveCardToExileWithInfo(playerTargetLibrary.getLibrary().getFromTop(game), exileId, - sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ')', source.getSourceId(), game, Zone.BATTLEFIELD, true); + sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ')', source, game, Zone.BATTLEFIELD, true); return true; } return false; @@ -129,7 +129,7 @@ class CircuDimirLobotomistRuleModifyingEffect extends ContinuousRuleModifyingEff @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.CAST_SPELL && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { + if (event.getType() == GameEvent.EventType.CAST_SPELL && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { MageObject object = game.getObject(event.getSourceId()); if (object != null) { ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)); diff --git a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java index 8188522fdf1..1246bb5f300 100644 --- a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java +++ b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java @@ -71,7 +71,7 @@ class CitadelOfPainEffect extends OneShotEffect { Player player = game.getPlayer(game.getActivePlayerId()); if (player != null) { int damage = game.getBattlefield().countAll(filter, game.getActivePlayerId(), game); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CitanulFlute.java b/Mage.Sets/src/mage/cards/c/CitanulFlute.java index 36adc7ba2ea..99a71e2ed37 100644 --- a/Mage.Sets/src/mage/cards/c/CitanulFlute.java +++ b/Mage.Sets/src/mage/cards/c/CitanulFlute.java @@ -78,7 +78,7 @@ class CitanulFluteSearchEffect extends OneShotEffect { Card card = player.getLibrary().getCard(target.getFirstTarget(), game); Cards cards = new CardsImpl(); if (card != null){ - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); cards.add(card); } String name = "Reveal"; diff --git a/Mage.Sets/src/mage/cards/c/CityInABottle.java b/Mage.Sets/src/mage/cards/c/CityInABottle.java index 67ea7f44281..8a570d692a1 100644 --- a/Mage.Sets/src/mage/cards/c/CityInABottle.java +++ b/Mage.Sets/src/mage/cards/c/CityInABottle.java @@ -193,7 +193,7 @@ class CityInABottleSacrificeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } @@ -233,7 +233,7 @@ class CityInABottleCantPlayEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.PLAY_LAND || event.getType() == EventType.CAST_SPELL; + return event.getType() == GameEvent.EventType.PLAY_LAND || event.getType() == GameEvent.EventType.CAST_SPELL; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CityOfSolitude.java b/Mage.Sets/src/mage/cards/c/CityOfSolitude.java index 01291a62521..4a05243348f 100644 --- a/Mage.Sets/src/mage/cards/c/CityOfSolitude.java +++ b/Mage.Sets/src/mage/cards/c/CityOfSolitude.java @@ -52,7 +52,7 @@ class CityOfSolitudeEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL || event.getType() == EventType.ACTIVATE_ABILITY; + return event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CityOfTraitors.java b/Mage.Sets/src/mage/cards/c/CityOfTraitors.java index 39b86b5b1a3..b56a6c2b6e4 100644 --- a/Mage.Sets/src/mage/cards/c/CityOfTraitors.java +++ b/Mage.Sets/src/mage/cards/c/CityOfTraitors.java @@ -54,7 +54,7 @@ class CityOfTraitorsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CivicSaber.java b/Mage.Sets/src/mage/cards/c/CivicSaber.java index 1120b592529..22da1ee17a7 100644 --- a/Mage.Sets/src/mage/cards/c/CivicSaber.java +++ b/Mage.Sets/src/mage/cards/c/CivicSaber.java @@ -55,9 +55,9 @@ class CivicSaberColorCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Permanent equipment = game.getPermanent(source.getSourceId()); + Permanent equipment = game.getPermanent(sourceAbility.getSourceId()); if (equipment != null) { Permanent permanent = game.getPermanent(equipment.getAttachedTo()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/c/CivilizedScholar.java b/Mage.Sets/src/mage/cards/c/CivilizedScholar.java index 480d3b6f5e3..22283f729c0 100644 --- a/Mage.Sets/src/mage/cards/c/CivilizedScholar.java +++ b/Mage.Sets/src/mage/cards/c/CivilizedScholar.java @@ -74,8 +74,8 @@ class CivilizedScholarEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(1, source.getSourceId(), game); - Card card = player.discardOne(false, source, game); + player.drawCards(1, source, game); + Card card = player.discardOne(false, false, source, game); if (card != null && card.isCreature()) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/c/ClackbridgeTroll.java b/Mage.Sets/src/mage/cards/c/ClackbridgeTroll.java index fb16cf21538..d92918efb05 100644 --- a/Mage.Sets/src/mage/cards/c/ClackbridgeTroll.java +++ b/Mage.Sets/src/mage/cards/c/ClackbridgeTroll.java @@ -98,23 +98,23 @@ class ClackbridgeTrollEffect extends OneShotEffect { filter.add(TargetController.YOU.getControllerPredicate()); TargetControlledPermanent target = new TargetControlledPermanent(filter); target.setNotTarget(true); - if (!target.canChoose(opponent.getId(), game) + if (!target.canChoose(source.getSourceId(), opponent.getId(), game) || !opponent.chooseUse(Outcome.AIDontUseIt, "Sacrifice a creature?", source, game) || !opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { continue; } Permanent permanent = game.getPermanent(target.getFirstTarget()); - if (permanent == null || !permanent.sacrifice(source.getSourceId(), game)) { + if (permanent == null || !permanent.sacrifice(source, game)) { continue; } flag = true; } if (flag) { if (sourcePerm != null) { - sourcePerm.tap(game); + sourcePerm.tap(source, game); } controller.gainLife(3, game, source); - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/ClamIAm.java b/Mage.Sets/src/mage/cards/c/ClamIAm.java index 5ac727a7c25..3986ab377eb 100644 --- a/Mage.Sets/src/mage/cards/c/ClamIAm.java +++ b/Mage.Sets/src/mage/cards/c/ClamIAm.java @@ -63,7 +63,7 @@ class ClamIAmEffect extends ReplacementEffectImpl { if (numSides == 6 && event.getAmount() == 3) { if (player.chooseUse(outcome, "Reroll the die?", source, game)) { game.informPlayers(player.getLogName() + " chose to reroll the die."); - event.setAmount(player.rollDice(game, 6)); + event.setAmount(player.rollDice(source, game, 6)); } } } diff --git a/Mage.Sets/src/mage/cards/c/Clambassadors.java b/Mage.Sets/src/mage/cards/c/Clambassadors.java index be70dc4f5ef..7b15db58413 100644 --- a/Mage.Sets/src/mage/cards/c/Clambassadors.java +++ b/Mage.Sets/src/mage/cards/c/Clambassadors.java @@ -82,7 +82,7 @@ class ClambassadorsEffect extends OneShotEffect { if (controller != null) { Target target = new TargetControlledPermanent(1, 1, filter, true); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } diff --git a/Mage.Sets/src/mage/cards/c/Cleansing.java b/Mage.Sets/src/mage/cards/c/Cleansing.java index 457e84620ba..a8361db19f9 100644 --- a/Mage.Sets/src/mage/cards/c/Cleansing.java +++ b/Mage.Sets/src/mage/cards/c/Cleansing.java @@ -61,9 +61,9 @@ class CleansingEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if(player != null) { cost.clearPaid(); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(outcome, "Pay 1 life to prevent this?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(player.getLogName() + " pays 1 life to prevent the destruction of " + p.getLogName()); paidLife = true; } @@ -71,7 +71,7 @@ class CleansingEffect extends OneShotEffect { } } if (!paidLife) { - p.destroy(source.getSourceId(), game, false); + p.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/c/CleansingBeam.java b/Mage.Sets/src/mage/cards/c/CleansingBeam.java index 6f6c3c948c6..bb109b42440 100644 --- a/Mage.Sets/src/mage/cards/c/CleansingBeam.java +++ b/Mage.Sets/src/mage/cards/c/CleansingBeam.java @@ -61,10 +61,10 @@ class CleansingBeamEffect extends OneShotEffect { Permanent target = game.getPermanent(targetPointer.getFirst(game, source)); if (target != null) { ObjectColor color = target.getColor(game); - target.damage(2, source.getSourceId(), game); + target.damage(2, source.getSourceId(), source, game); for (Permanent p : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (!target.getId().equals(p.getId()) && p.getColor(game).shares(color)) { - p.damage(2, source.getSourceId(), game, false, true); + p.damage(2, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CleansingMeditation.java b/Mage.Sets/src/mage/cards/c/CleansingMeditation.java index 03bcd502104..dbb5cadb1e2 100644 --- a/Mage.Sets/src/mage/cards/c/CleansingMeditation.java +++ b/Mage.Sets/src/mage/cards/c/CleansingMeditation.java @@ -73,7 +73,7 @@ class CleansingMeditationEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_ENCHANTMENT_PERMANENT, source.getControllerId(), source.getSourceId(), game)) { - if (permanent != null && permanent.destroy(source.getSourceId(), game, false)) { + if (permanent != null && permanent.destroy(source, game, false)) { if (threshold && controller != null && permanent.isOwnedBy(controller.getId())) { cardsToBattlefield.add(permanent); } diff --git a/Mage.Sets/src/mage/cards/c/ClingToDust.java b/Mage.Sets/src/mage/cards/c/ClingToDust.java index b3b32464472..c884a3b802b 100644 --- a/Mage.Sets/src/mage/cards/c/ClingToDust.java +++ b/Mage.Sets/src/mage/cards/c/ClingToDust.java @@ -72,7 +72,7 @@ class ClingToDustEffect extends OneShotEffect { if (isCreature) { player.gainLife(3, game, source); } else { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/ClingingMists.java b/Mage.Sets/src/mage/cards/c/ClingingMists.java index ca0a2c8e530..66d49799848 100644 --- a/Mage.Sets/src/mage/cards/c/ClingingMists.java +++ b/Mage.Sets/src/mage/cards/c/ClingingMists.java @@ -66,7 +66,7 @@ class ClingingMistsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List doNotUntapNextUntapStep = new ArrayList<>(); for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - creature.tap(game); + creature.tap(source, game); doNotUntapNextUntapStep.add(creature); } if (!doNotUntapNextUntapStep.isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/c/CloakOfConfusion.java b/Mage.Sets/src/mage/cards/c/CloakOfConfusion.java index 6a438c75734..e2b4bf256e8 100644 --- a/Mage.Sets/src/mage/cards/c/CloakOfConfusion.java +++ b/Mage.Sets/src/mage/cards/c/CloakOfConfusion.java @@ -73,7 +73,7 @@ class CloakOfConfusionTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARE_BLOCKERS_STEP; + return event.getType() == GameEvent.EventType.DECLARE_BLOCKERS_STEP; } @Override @@ -131,7 +131,7 @@ class CloakOfConfusionEffect extends OneShotEffect { game.addEffect(effect, source); Player defendingPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (defendingPlayer != null) { - defendingPlayer.discard(1, true, source, game); + defendingPlayer.discard(1, true, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CloakingDevice.java b/Mage.Sets/src/mage/cards/c/CloakingDevice.java index 0244c3d4f6f..02c0d2b8043 100644 --- a/Mage.Sets/src/mage/cards/c/CloakingDevice.java +++ b/Mage.Sets/src/mage/cards/c/CloakingDevice.java @@ -102,7 +102,7 @@ class CloakingDeviceLoseLifeDefendingPlayerEffect extends OneShotEffect { if (enchantment != null && enchantment.getAttachedTo() != null) { Player defender = game.getPlayer(game.getCombat().getDefendingPlayerId(enchantment.getAttachedTo(), game)); if (defender != null) { - defender.loseLife(amount.calculate(game, source, this), game, false); + defender.loseLife(amount.calculate(game, source, this), game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/ClockworkHydra.java b/Mage.Sets/src/mage/cards/c/ClockworkHydra.java index 4378e5f50e5..7102dfc6005 100644 --- a/Mage.Sets/src/mage/cards/c/ClockworkHydra.java +++ b/Mage.Sets/src/mage/cards/c/ClockworkHydra.java @@ -79,7 +79,7 @@ class ClockworkHydraEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { - permanent.removeCounters(CounterType.P1P1.createInstance(), game); + permanent.removeCounters(CounterType.P1P1.createInstance(), source, game); Target target = new TargetAnyTarget(); if (controller.chooseTarget(outcome, target, source, game)) { Effect effect = new DamageTargetEffect(1); diff --git a/Mage.Sets/src/mage/cards/c/CloudCover.java b/Mage.Sets/src/mage/cards/c/CloudCover.java index 7367585c444..dcbc69a0878 100644 --- a/Mage.Sets/src/mage/cards/c/CloudCover.java +++ b/Mage.Sets/src/mage/cards/c/CloudCover.java @@ -55,7 +55,7 @@ class CloudCoverAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java b/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java index 23bf56bcd2c..7263bd937c4 100644 --- a/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java +++ b/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java @@ -82,7 +82,7 @@ class CloudstoneCurioEffect extends OneShotEffect { )); TargetPermanent target = new TargetPermanent(1, 1, filter, true); - if (target.canChoose(controller.getId(), game) && controller.chooseTarget(outcome, target, source, game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseTarget(outcome, target, source, game)) { Permanent returningCreature = game.getPermanent(target.getFirstTarget()); if (returningCreature != null) { controller.moveCards(returningCreature, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/c/CoalhaulerSwine.java b/Mage.Sets/src/mage/cards/c/CoalhaulerSwine.java index f57f4e57242..1cd0a5b2e9a 100644 --- a/Mage.Sets/src/mage/cards/c/CoalhaulerSwine.java +++ b/Mage.Sets/src/mage/cards/c/CoalhaulerSwine.java @@ -61,7 +61,7 @@ public final class CoalhaulerSwine extends CardImpl { for (UUID playerId : game.getPlayers().keySet()) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage((Integer) this.getValue("damage"), source.getSourceId(), game); + player.damage((Integer) this.getValue("damage"), source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CoalitionRelic.java b/Mage.Sets/src/mage/cards/c/CoalitionRelic.java index dee6a008adb..c46d1881fe9 100644 --- a/Mage.Sets/src/mage/cards/c/CoalitionRelic.java +++ b/Mage.Sets/src/mage/cards/c/CoalitionRelic.java @@ -71,7 +71,7 @@ class CoalitionRelicEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); - sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), game); + sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), source, game); Mana mana = new Mana(); ChoiceColor choice = new ChoiceColor(); for (int i = 0; i < chargeCounters; i++) { diff --git a/Mage.Sets/src/mage/cards/c/CoastalPiracy.java b/Mage.Sets/src/mage/cards/c/CoastalPiracy.java index 6eef0cd9d1e..3611217db51 100644 --- a/Mage.Sets/src/mage/cards/c/CoastalPiracy.java +++ b/Mage.Sets/src/mage/cards/c/CoastalPiracy.java @@ -55,7 +55,7 @@ class CoastalPiracyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CobraTrap.java b/Mage.Sets/src/mage/cards/c/CobraTrap.java index 2ecb0f346b6..4aafaa6dcd5 100644 --- a/Mage.Sets/src/mage/cards/c/CobraTrap.java +++ b/Mage.Sets/src/mage/cards/c/CobraTrap.java @@ -76,7 +76,7 @@ class CobraTrapWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DESTROYED_PERMANENT) { + if (event.getType() == GameEvent.EventType.DESTROYED_PERMANENT) { Permanent perm = game.getPermanentOrLKIBattlefield(event.getTargetId()); // can regenerate or be indestructible if (perm != null && !perm.isCreature()) { if (!game.getStack().isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/c/Cocoon.java b/Mage.Sets/src/mage/cards/c/Cocoon.java index 30884c4a4e8..b2f46cb37e7 100644 --- a/Mage.Sets/src/mage/cards/c/Cocoon.java +++ b/Mage.Sets/src/mage/cards/c/Cocoon.java @@ -85,10 +85,10 @@ class CocoonEffect extends OneShotEffect { if (permanent != null) { int amount = permanent.getCounters(game).getCount(CounterType.PUPA); if (amount > 0) { - permanent.removeCounters(CounterType.PUPA.createInstance(), game); + permanent.removeCounters(CounterType.PUPA.createInstance(), source, game); } else { Permanent enchantedPermanent = game.getPermanent(permanent.getAttachedTo()); - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); if (enchantedPermanent != null) { Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance()); effect.setTargetPointer(new FixedTarget(enchantedPermanent, game)); diff --git a/Mage.Sets/src/mage/cards/c/CoercedConfession.java b/Mage.Sets/src/mage/cards/c/CoercedConfession.java index db453582136..f6005997ef0 100644 --- a/Mage.Sets/src/mage/cards/c/CoercedConfession.java +++ b/Mage.Sets/src/mage/cards/c/CoercedConfession.java @@ -76,7 +76,7 @@ class CoercedConfessionMillEffect extends OneShotEffect { if (controller == null) { return true; } - controller.drawCards(creaturesMilled, source.getSourceId(), game); + controller.drawCards(creaturesMilled, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CoercivePortal.java b/Mage.Sets/src/mage/cards/c/CoercivePortal.java index fe922573721..e15c1a5aa35 100644 --- a/Mage.Sets/src/mage/cards/c/CoercivePortal.java +++ b/Mage.Sets/src/mage/cards/c/CoercivePortal.java @@ -77,7 +77,7 @@ class CoercivePortalEffect extends OneShotEffect { new SacrificeSourceEffect().apply(game, source); new DestroyAllEffect(new FilterNonlandPermanent()).apply(game, source); } else { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CoffinQueen.java b/Mage.Sets/src/mage/cards/c/CoffinQueen.java index eed0c7c87ce..4aff9d9720a 100644 --- a/Mage.Sets/src/mage/cards/c/CoffinQueen.java +++ b/Mage.Sets/src/mage/cards/c/CoffinQueen.java @@ -103,14 +103,14 @@ class CoffinQueenDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_CONTROL - || event.getType() == EventType.UNTAPPED; + return event.getType() == GameEvent.EventType.LOST_CONTROL + || event.getType() == GameEvent.EventType.UNTAPPED; } @Override public boolean checkTrigger(GameEvent event, Game game) { if (EventType.LOST_CONTROL == event.getType() - && event.getSourceId().equals(getSourceId())) { + && event.getTargetId().equals(this.getSourceId())) { return true; } return EventType.UNTAPPED == event.getType() diff --git a/Mage.Sets/src/mage/cards/c/CoilsOfTheMedusa.java b/Mage.Sets/src/mage/cards/c/CoilsOfTheMedusa.java index fe0bbe9c313..12cd5fd9f79 100644 --- a/Mage.Sets/src/mage/cards/c/CoilsOfTheMedusa.java +++ b/Mage.Sets/src/mage/cards/c/CoilsOfTheMedusa.java @@ -93,7 +93,7 @@ class CoilsOfTheMedusaDestroyEffect extends OneShotEffect { while (!blockers.isEmpty()) { Permanent blocker = game.getPermanent(blockers.remove(0)); if (!blocker.hasAbility(DefenderAbility.getInstance(), game)) { - blocker.destroy(source.getSourceId(), game, false); + blocker.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/ColdEyedSelkie.java b/Mage.Sets/src/mage/cards/c/ColdEyedSelkie.java index 118823d5c2a..aed6ea5dac6 100644 --- a/Mage.Sets/src/mage/cards/c/ColdEyedSelkie.java +++ b/Mage.Sets/src/mage/cards/c/ColdEyedSelkie.java @@ -68,7 +68,7 @@ class ColdEyeSelkieEffect extends OneShotEffect { if (amount > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(amount, source.getSourceId(), game); + controller.drawCards(amount, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/ColdSnap.java b/Mage.Sets/src/mage/cards/c/ColdSnap.java index ee062fe8e9a..0205a00e806 100644 --- a/Mage.Sets/src/mage/cards/c/ColdSnap.java +++ b/Mage.Sets/src/mage/cards/c/ColdSnap.java @@ -66,7 +66,7 @@ class ColdSnapDamageTargetEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int damage = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game).size(); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/ColfenorsUrn.java b/Mage.Sets/src/mage/cards/c/ColfenorsUrn.java index 0c036c17928..a4bda72ea5b 100644 --- a/Mage.Sets/src/mage/cards/c/ColfenorsUrn.java +++ b/Mage.Sets/src/mage/cards/c/ColfenorsUrn.java @@ -80,7 +80,7 @@ class ColfenorsUrnEffect extends OneShotEffect { if (controller != null && permanent != null) { UUID exileId = CardUtil.getCardExileZoneId(game, source); ExileZone exile = game.getExile().getExileZone(exileId); - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { controller.moveCards(exile.getCards(game), Zone.BATTLEFIELD, source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/c/CollectiveDefiance.java b/Mage.Sets/src/mage/cards/c/CollectiveDefiance.java index 81f3abefa9f..34dd41c8afe 100644 --- a/Mage.Sets/src/mage/cards/c/CollectiveDefiance.java +++ b/Mage.Sets/src/mage/cards/c/CollectiveDefiance.java @@ -92,8 +92,8 @@ class CollectiveDefianceEffect extends OneShotEffect { if (targetPlayer == null) { return false; } - int count = targetPlayer.discard(targetPlayer.getHand(), source, game).size(); - targetPlayer.drawCards(count, source.getSourceId(), game); + int count = targetPlayer.discard(targetPlayer.getHand(), false, source, game).size(); + targetPlayer.drawCards(count, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/ColossalWhale.java b/Mage.Sets/src/mage/cards/c/ColossalWhale.java index 8a4ac9a8d23..389c711f176 100644 --- a/Mage.Sets/src/mage/cards/c/ColossalWhale.java +++ b/Mage.Sets/src/mage/cards/c/ColossalWhale.java @@ -69,7 +69,7 @@ class ColossalWhaleAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CombineGuildmage.java b/Mage.Sets/src/mage/cards/c/CombineGuildmage.java index 82d0b72cd7c..1193d7e65f3 100644 --- a/Mage.Sets/src/mage/cards/c/CombineGuildmage.java +++ b/Mage.Sets/src/mage/cards/c/CombineGuildmage.java @@ -135,7 +135,7 @@ class CombineGuildmageCounterEffect extends OneShotEffect { return false; } if (fromPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { - fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game); + fromPermanent.removeCounters(CounterType.P1P1.createInstance(), source, game); toPermanent.addCounters(CounterType.P1P1.createInstance(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/c/ComboAttack.java b/Mage.Sets/src/mage/cards/c/ComboAttack.java index 538197b83dc..a4938ad9b06 100644 --- a/Mage.Sets/src/mage/cards/c/ComboAttack.java +++ b/Mage.Sets/src/mage/cards/c/ComboAttack.java @@ -65,10 +65,10 @@ class ComboAttackEffect extends OneShotEffect { return false; } if (permanent1 != null) { - permanent3.damage(permanent1.getPower().getValue(), permanent1.getId(), game, false, true); + permanent3.damage(permanent1.getPower().getValue(), permanent1.getId(), source, game, false, true); } if (permanent2 != null) { - permanent3.damage(permanent2.getPower().getValue(), permanent2.getId(), game, false, true); + permanent3.damage(permanent2.getPower().getValue(), permanent2.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CombustibleGearhulk.java b/Mage.Sets/src/mage/cards/c/CombustibleGearhulk.java index dbc8f48801c..951b0fc3b1f 100644 --- a/Mage.Sets/src/mage/cards/c/CombustibleGearhulk.java +++ b/Mage.Sets/src/mage/cards/c/CombustibleGearhulk.java @@ -114,7 +114,7 @@ class CombustibleGearhulkMillAndDamageEffect extends OneShotEffect { .sum(); Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(sumCMC, source.getSourceId(), game); + targetPlayer.damage(sumCMC, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CometStorm.java b/Mage.Sets/src/mage/cards/c/CometStorm.java index 97fbbb1fe4a..2da0ec436fe 100644 --- a/Mage.Sets/src/mage/cards/c/CometStorm.java +++ b/Mage.Sets/src/mage/cards/c/CometStorm.java @@ -74,10 +74,10 @@ class CometStormEffect extends OneShotEffect { Permanent permanent = game.getPermanent(uuid); Player player = game.getPlayer(uuid); if (permanent != null) { - permanent.damage(damage, source.getSourceId(), game, false, true); + permanent.damage(damage, source.getSourceId(), source, game, false, true); } if (player != null) { - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/Comeuppance.java b/Mage.Sets/src/mage/cards/c/Comeuppance.java index 0f72194ba83..8e96b057d8a 100644 --- a/Mage.Sets/src/mage/cards/c/Comeuppance.java +++ b/Mage.Sets/src/mage/cards/c/Comeuppance.java @@ -72,7 +72,7 @@ class ComeuppanceEffect extends PreventionEffectImpl { UUID objectControllerId = null; if (damageDealingObject instanceof Permanent) { if (damageDealingObject.isCreature()) { - ((Permanent) damageDealingObject).damage(preventionData.getPreventedDamage(), source.getSourceId(), game); + ((Permanent) damageDealingObject).damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game); } else { objectControllerId = ((Permanent) damageDealingObject).getControllerId(); } @@ -84,7 +84,7 @@ class ComeuppanceEffect extends PreventionEffectImpl { if (objectControllerId != null) { Player objectController = game.getPlayer(objectControllerId); if (objectController != null) { - objectController.damage(preventionData.getPreventedDamage(), source.getSourceId(), game); + objectController.damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/c/CommandTheDreadhorde.java b/Mage.Sets/src/mage/cards/c/CommandTheDreadhorde.java index e343191595e..7dc5cd57b06 100644 --- a/Mage.Sets/src/mage/cards/c/CommandTheDreadhorde.java +++ b/Mage.Sets/src/mage/cards/c/CommandTheDreadhorde.java @@ -72,7 +72,7 @@ class CommandTheDreadhordeEffect extends OneShotEffect { } Cards cards = new CardsImpl(source.getTargets().get(0).getTargets()); int damage = cards.getCards(game).stream().mapToInt(Card::getConvertedManaCost).sum(); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return player.moveCards(cards, Zone.BATTLEFIELD, source, game); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/CommenceTheEndgame.java b/Mage.Sets/src/mage/cards/c/CommenceTheEndgame.java index 1c58d22cf9f..8d4aca084a1 100644 --- a/Mage.Sets/src/mage/cards/c/CommenceTheEndgame.java +++ b/Mage.Sets/src/mage/cards/c/CommenceTheEndgame.java @@ -60,7 +60,7 @@ class CommenceTheEndgameEffect extends OneShotEffect { if (player == null) { return false; } - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); return new AmassEffect(player.getHand().size()).apply(game, source); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/CompellingDeterrence.java b/Mage.Sets/src/mage/cards/c/CompellingDeterrence.java index 246c434497b..8eb79c515ce 100644 --- a/Mage.Sets/src/mage/cards/c/CompellingDeterrence.java +++ b/Mage.Sets/src/mage/cards/c/CompellingDeterrence.java @@ -67,7 +67,7 @@ class CompellingDeterrenceEffect extends OneShotEffect { FilterPermanent zombieFilter = new FilterPermanent(); zombieFilter.add(SubType.ZOMBIE.getPredicate()); if (game.getState().getBattlefield().countAll(zombieFilter, controller.getId(), game) > 0) { - player.discard(1, false, source, game); + player.discard(1, false, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CompulsiveResearch.java b/Mage.Sets/src/mage/cards/c/CompulsiveResearch.java index 11e97e13c6c..840f57400ec 100644 --- a/Mage.Sets/src/mage/cards/c/CompulsiveResearch.java +++ b/Mage.Sets/src/mage/cards/c/CompulsiveResearch.java @@ -64,14 +64,14 @@ class CompulsiveResearchDiscardEffect extends OneShotEffect { } if (targetPlayer.getHand().count(StaticFilters.FILTER_CARD_LAND, game) < 1 || !targetPlayer.chooseUse(outcome, "Discard a land card?", source, game)) { - return !targetPlayer.discard(2, false, source, game).isEmpty(); + return !targetPlayer.discard(2, false, false, source, game).isEmpty(); } TargetDiscard target = new TargetDiscard(StaticFilters.FILTER_CARD_LAND_A, targetPlayer.getId()); targetPlayer.choose(Outcome.Discard, target, source.getSourceId(), game); Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); - if (card != null && targetPlayer.discard(card, source, game)) { + if (card != null && targetPlayer.discard(card, false, source, game)) { return true; } - return !targetPlayer.discard(2, false, source, game).isEmpty(); + return !targetPlayer.discard(2, false, false, source, game).isEmpty(); } } diff --git a/Mage.Sets/src/mage/cards/c/ConchHorn.java b/Mage.Sets/src/mage/cards/c/ConchHorn.java index 94d727ea628..202e7277da7 100644 --- a/Mage.Sets/src/mage/cards/c/ConchHorn.java +++ b/Mage.Sets/src/mage/cards/c/ConchHorn.java @@ -64,7 +64,7 @@ class ConchHornEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); putOnLibrary(player, source, game); return true; } @@ -77,7 +77,7 @@ class ConchHornEffect extends OneShotEffect { player.chooseTarget(Outcome.ReturnToHand, target, source, game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - return player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + return player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/c/ConeOfFlame.java b/Mage.Sets/src/mage/cards/c/ConeOfFlame.java index c64de5418de..3678ef1bc71 100644 --- a/Mage.Sets/src/mage/cards/c/ConeOfFlame.java +++ b/Mage.Sets/src/mage/cards/c/ConeOfFlame.java @@ -84,11 +84,11 @@ class ConeOfFlameEffect extends OneShotEffect { for (Target target : source.getTargets()) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - applied |= (permanent.damage(damage, source.getSourceId(), game, false, true) > 0); + applied |= (permanent.damage(damage, source.getSourceId(), source, game, false, true) > 0); } Player player = game.getPlayer(target.getFirstTarget()); if (player != null) { - applied |= (player.damage(damage, source.getSourceId(), game) > 0); + applied |= (player.damage(damage, source.getSourceId(), source, game) > 0); } damage++; } diff --git a/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java b/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java index c53ffa17e02..5ecccc62b08 100644 --- a/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java +++ b/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java @@ -76,14 +76,14 @@ class ConfiscationCoupEffect extends OneShotEffect { Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetPermanent != null) { Cost cost = new PayEnergyCost(targetPermanent.getManaCost().convertedManaCost()); - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) { + if (cost.canPay(source, source, source.getControllerId(), game)) { int convertedManaCost = targetPermanent.getManaCost().convertedManaCost(); StringBuilder energy = new StringBuilder(convertedManaCost); for (int i = 0; i < convertedManaCost; i++) { energy.append("{E}"); } if (controller.chooseUse(outcome, "Pay " + energy + " to get control of " + targetPermanent.getLogName() + '?', source, game)) { - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (cost.pay(source, game, source, source.getControllerId(), true)) { ContinuousEffect controllEffect = new GainControlTargetEffect(Duration.Custom); controllEffect.setTargetPointer(new FixedTarget(targetPermanent, game)); game.addEffect(controllEffect, source); diff --git a/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java b/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java index 6e60b5d15a8..622082bf9d2 100644 --- a/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java +++ b/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java @@ -80,7 +80,7 @@ class CongregationAtDawnEffect extends OneShotEffect { Card card = revealed.get(targetToLib.getFirstTarget(), game); if (card != null) { revealed.remove(card); - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, true, false); } targetToLib.clearChosen(); @@ -88,7 +88,7 @@ class CongregationAtDawnEffect extends OneShotEffect { if (revealed.size() == 1) { Card card = revealed.get(revealed.iterator().next(), game); - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, true, false); } } diff --git a/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java b/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java index 6e1ed21d91b..01fbcd31632 100644 --- a/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java +++ b/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java @@ -63,8 +63,8 @@ class ConquerorsFlailColorCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { - Player controller = game.getPlayer(source.getControllerId()); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player controller = game.getPlayer(sourceAbility.getControllerId()); int count = 0; if (controller != null) { Mana mana = new Mana(); diff --git a/Mage.Sets/src/mage/cards/c/ConsecrateLand.java b/Mage.Sets/src/mage/cards/c/ConsecrateLand.java index 8ba52ddf806..4f4e437bbe5 100644 --- a/Mage.Sets/src/mage/cards/c/ConsecrateLand.java +++ b/Mage.Sets/src/mage/cards/c/ConsecrateLand.java @@ -72,7 +72,7 @@ class ConsecrateLandRuleEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACH || event.getType() == EventType.STAY_ATTACHED; + return event.getType() == GameEvent.EventType.ATTACH || event.getType() == GameEvent.EventType.STAY_ATTACHED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ConsecratedSphinx.java b/Mage.Sets/src/mage/cards/c/ConsecratedSphinx.java index 61bd7e0c321..fc82fe84819 100644 --- a/Mage.Sets/src/mage/cards/c/ConsecratedSphinx.java +++ b/Mage.Sets/src/mage/cards/c/ConsecratedSphinx.java @@ -63,7 +63,7 @@ class ConsecratedSphinxTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ConsignToThePit.java b/Mage.Sets/src/mage/cards/c/ConsignToThePit.java index 18a9df9d95a..d335919b2d0 100644 --- a/Mage.Sets/src/mage/cards/c/ConsignToThePit.java +++ b/Mage.Sets/src/mage/cards/c/ConsignToThePit.java @@ -62,8 +62,8 @@ class ConsignToThePitEffect extends OneShotEffect { if (player == null) { return false; } - permanent.destroy(source.getSourceId(), game, false); - player.damage(2, source.getSourceId(), game); + permanent.destroy(source, game, false); + player.damage(2, source.getSourceId(), source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java b/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java index 8b0a056a253..35280c643ff 100644 --- a/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java +++ b/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java @@ -89,7 +89,7 @@ class ConsumingFerocityEffect extends OneShotEffect { if (creature.getCounters(game).getCount(CounterType.P1P0) > 2) { Player player = game.getPlayer(creature.getControllerId()); if (player != null) { - player.damage(creature.getPower().getValue(), creature.getId(), game); + player.damage(creature.getPower().getValue(), creature.getId(), source, game); } effect = new DestroyTargetEffect(true); effect.setTargetPointer(new FixedTarget(creature, game)); diff --git a/Mage.Sets/src/mage/cards/c/ConsumingVapors.java b/Mage.Sets/src/mage/cards/c/ConsumingVapors.java index 61d9fbd7fa2..70effb6573b 100644 --- a/Mage.Sets/src/mage/cards/c/ConsumingVapors.java +++ b/Mage.Sets/src/mage/cards/c/ConsumingVapors.java @@ -64,12 +64,12 @@ class ConsumingVaporsEffect extends OneShotEffect { filter.add(TargetController.YOU.getControllerPredicate()); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); - if (player != null && target.canChoose(player.getId(), game)) { + if (player != null && target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); controller.gainLife(permanent.getToughness().getValue(), game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/c/Contamination.java b/Mage.Sets/src/mage/cards/c/Contamination.java index c1e3958483a..359bb5507b2 100644 --- a/Mage.Sets/src/mage/cards/c/Contamination.java +++ b/Mage.Sets/src/mage/cards/c/Contamination.java @@ -18,6 +18,7 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ManaEvent; +import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -78,12 +79,12 @@ class ContaminationReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); - return mageObject != null && mageObject.isLand(); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + return permanent != null && permanent.isLand(); } } diff --git a/Mage.Sets/src/mage/cards/c/ContestedWarZone.java b/Mage.Sets/src/mage/cards/c/ContestedWarZone.java index aea2bc0336c..bbfa6db0c05 100644 --- a/Mage.Sets/src/mage/cards/c/ContestedWarZone.java +++ b/Mage.Sets/src/mage/cards/c/ContestedWarZone.java @@ -114,7 +114,7 @@ class ContestedWarZoneEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(source.getSourceId()); UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString()); if (permanent != null && controllerId != null) { - return permanent.changeControllerId(controllerId, game); + return permanent.changeControllerId(controllerId, game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/c/CoordinatedBarrage.java b/Mage.Sets/src/mage/cards/c/CoordinatedBarrage.java index b2d04a89935..a4bb1a14d41 100644 --- a/Mage.Sets/src/mage/cards/c/CoordinatedBarrage.java +++ b/Mage.Sets/src/mage/cards/c/CoordinatedBarrage.java @@ -68,7 +68,7 @@ class CoordinatedBarrageEffect extends OneShotEffect { int damageDealt = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.damage(damageDealt, source.getSourceId(), game, false, true); + permanent.damage(damageDealt, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CopperhornScout.java b/Mage.Sets/src/mage/cards/c/CopperhornScout.java index 43fa7fa5ef6..59df200f460 100644 --- a/Mage.Sets/src/mage/cards/c/CopperhornScout.java +++ b/Mage.Sets/src/mage/cards/c/CopperhornScout.java @@ -63,7 +63,7 @@ class CopperhornScoutTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CoralFighters.java b/Mage.Sets/src/mage/cards/c/CoralFighters.java index eaee988286d..83ec6b90ffd 100644 --- a/Mage.Sets/src/mage/cards/c/CoralFighters.java +++ b/Mage.Sets/src/mage/cards/c/CoralFighters.java @@ -67,7 +67,7 @@ class CoralFightersEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controller.lookAtCards("Coral Fighters", cards, game); if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", source, game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, false, false); } else { game.informPlayers(controller.getLogName() + " puts the card back on top of the library."); diff --git a/Mage.Sets/src/mage/cards/c/CorpseLunge.java b/Mage.Sets/src/mage/cards/c/CorpseLunge.java index a54c8cd5968..203f61b9406 100644 --- a/Mage.Sets/src/mage/cards/c/CorpseLunge.java +++ b/Mage.Sets/src/mage/cards/c/CorpseLunge.java @@ -75,7 +75,7 @@ class CorpseLungeEffect extends OneShotEffect { if (amount > 0) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/Corrosion.java b/Mage.Sets/src/mage/cards/c/Corrosion.java index 7becca6450d..76b539315e7 100644 --- a/Mage.Sets/src/mage/cards/c/Corrosion.java +++ b/Mage.Sets/src/mage/cards/c/Corrosion.java @@ -84,7 +84,7 @@ class CorrosionUpkeepEffect extends OneShotEffect { // destroy each artifact with converted mana cost less than or equal to the number of rust counters on it for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (permanent.getConvertedManaCost() <= permanent.getCounters(game).getCount(CounterType.RUST)) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); } } return true; @@ -112,7 +112,7 @@ class CorrosionRemoveCountersEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { - permanent.removeCounters(CounterType.RUST.createInstance(permanent.getCounters(game).getCount(CounterType.RUST)), game); + permanent.removeCounters(CounterType.RUST.createInstance(permanent.getCounters(game).getCount(CounterType.RUST)), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java b/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java index eaae709b7c5..b4a6d9dea57 100644 --- a/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java +++ b/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java @@ -106,7 +106,7 @@ class CorrosiveOozeEffect extends OneShotEffect { } } for (Permanent permanent : toDestroy) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; diff --git a/Mage.Sets/src/mage/cards/c/Corrupt.java b/Mage.Sets/src/mage/cards/c/Corrupt.java index 5ffb3b2f8a8..7ec74806833 100644 --- a/Mage.Sets/src/mage/cards/c/Corrupt.java +++ b/Mage.Sets/src/mage/cards/c/Corrupt.java @@ -65,11 +65,11 @@ class CorruptEffect extends OneShotEffect { int damageDealt = amount; Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - damageDealt = permanent.damage(amount, source.getSourceId(), game, false, true); + damageDealt = permanent.damage(amount, source.getSourceId(), source, game, false, true); } else { Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - damageDealt = player.damage(amount, source.getSourceId(), game); + damageDealt = player.damage(amount, source.getSourceId(), source, game); } else return false; } diff --git a/Mage.Sets/src/mage/cards/c/CorruptOfficial.java b/Mage.Sets/src/mage/cards/c/CorruptOfficial.java index c5cdd88794a..e6e7e944622 100644 --- a/Mage.Sets/src/mage/cards/c/CorruptOfficial.java +++ b/Mage.Sets/src/mage/cards/c/CorruptOfficial.java @@ -72,7 +72,7 @@ class CorruptOfficialDiscardEffect extends OneShotEffect { Combat combat = game.getCombat(); Player defendingPlayer = game.getPlayer(combat.getDefendingPlayerId(corruptOfficial.getId(), game)); if (defendingPlayer != null) { - defendingPlayer.discard(1, true, source, game); + defendingPlayer.discard(1, true, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CorruptedResolve.java b/Mage.Sets/src/mage/cards/c/CorruptedResolve.java index 6d181551059..508899057a7 100644 --- a/Mage.Sets/src/mage/cards/c/CorruptedResolve.java +++ b/Mage.Sets/src/mage/cards/c/CorruptedResolve.java @@ -55,7 +55,7 @@ class CorruptedResolveEffect extends OneShotEffect { if (spell != null) { Player player = game.getPlayer(spell.getControllerId()); if (player != null && player.getCounters().containsKey(CounterType.POISON)) - return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game); + return game.getStack().counter(targetPointer.getFirst(game, source), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/c/CosisTrickster.java b/Mage.Sets/src/mage/cards/c/CosisTrickster.java index 31f454c966f..f7011a67278 100644 --- a/Mage.Sets/src/mage/cards/c/CosisTrickster.java +++ b/Mage.Sets/src/mage/cards/c/CosisTrickster.java @@ -59,7 +59,7 @@ class CosisTricksterTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LIBRARY_SHUFFLED; + return event.getType() == GameEvent.EventType.LIBRARY_SHUFFLED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CosmicHorror.java b/Mage.Sets/src/mage/cards/c/CosmicHorror.java index be3398fac5c..bfa80e3c136 100644 --- a/Mage.Sets/src/mage/cards/c/CosmicHorror.java +++ b/Mage.Sets/src/mage/cards/c/CosmicHorror.java @@ -74,12 +74,12 @@ class CosmicHorrorEffect extends OneShotEffect { } if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } - if (cosmicHorror.destroy(source.getSourceId(), game, false)) { - controller.damage(7, source.getSourceId(), game); + if (cosmicHorror.destroy(source, game, false)) { + controller.damage(7, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java b/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java index 55f9a88890c..e27b34bade7 100644 --- a/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java +++ b/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java @@ -85,7 +85,7 @@ class CouncilOfTheAbsoluteReplacementEffect extends ContinuousRuleModifyingEffec @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL; + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CouncilsJudgment.java b/Mage.Sets/src/mage/cards/c/CouncilsJudgment.java index 5c617634188..b58232601e7 100644 --- a/Mage.Sets/src/mage/cards/c/CouncilsJudgment.java +++ b/Mage.Sets/src/mage/cards/c/CouncilsJudgment.java @@ -98,7 +98,7 @@ class CouncilsJudgmentEffect extends OneShotEffect { for (Entry entry : chosenCards.entrySet()) { if (entry.getValue() == maxCount) { Permanent permanent = entry.getKey(); - controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(permanent, null, "", source, game, Zone.BATTLEFIELD, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/Counterbalance.java b/Mage.Sets/src/mage/cards/c/Counterbalance.java index 7526b6b2f0e..8b785562ad5 100644 --- a/Mage.Sets/src/mage/cards/c/Counterbalance.java +++ b/Mage.Sets/src/mage/cards/c/Counterbalance.java @@ -72,7 +72,7 @@ class CounterbalanceEffect extends OneShotEffect { cards.add(topcard); controller.revealCards(sourcePermanent.getName(), cards, game); if (topcard.getConvertedManaCost() == spell.getConvertedManaCost()) { - return game.getStack().counter(spell.getId(), source.getSourceId(), game); + return game.getStack().counter(spell.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/Counterflux.java b/Mage.Sets/src/mage/cards/c/Counterflux.java index 3a688deb879..011bb7e2515 100644 --- a/Mage.Sets/src/mage/cards/c/Counterflux.java +++ b/Mage.Sets/src/mage/cards/c/Counterflux.java @@ -88,7 +88,7 @@ class CounterfluxEffect extends OneShotEffect { } } for (Spell spell : spellsToCounter) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/Counterlash.java b/Mage.Sets/src/mage/cards/c/Counterlash.java index 1ca9eb23239..b89e189edde 100644 --- a/Mage.Sets/src/mage/cards/c/Counterlash.java +++ b/Mage.Sets/src/mage/cards/c/Counterlash.java @@ -70,7 +70,7 @@ class CounterlashEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (stackObject != null && controller != null) { - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); if (controller.chooseUse(Outcome.PlayForFree, "Cast a nonland card in your hand that " + "shares a card type with that spell without paying its mana cost?", source, game)) { FilterCard filter = new FilterCard(); diff --git a/Mage.Sets/src/mage/cards/c/Countermand.java b/Mage.Sets/src/mage/cards/c/Countermand.java index d2dcff87401..df51babe9c8 100644 --- a/Mage.Sets/src/mage/cards/c/Countermand.java +++ b/Mage.Sets/src/mage/cards/c/Countermand.java @@ -59,7 +59,7 @@ class CountermandEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { boolean countered = false; StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source)); - if (game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) { + if (game.getStack().counter(source.getFirstTarget(), source, game)) { countered = true; } if (stackObject != null) { diff --git a/Mage.Sets/src/mage/cards/c/CourtOfAmbition.java b/Mage.Sets/src/mage/cards/c/CourtOfAmbition.java index 15d28bb1b28..9d6d4cbcfd3 100644 --- a/Mage.Sets/src/mage/cards/c/CourtOfAmbition.java +++ b/Mage.Sets/src/mage/cards/c/CourtOfAmbition.java @@ -78,7 +78,7 @@ class CourtOfAmbitionEffect extends OneShotEffect { continue; } if (player.getHand().size() < discardCount || !player.chooseUse(outcome, message, source, game)) { - player.loseLife(discardCount * 3, game, false); + player.loseLife(discardCount * 3, game, source, false); } TargetDiscard target = new TargetDiscard(discardCount, StaticFilters.FILTER_CARD, playerId); player.choose(outcome, target, source.getSourceId(), game); @@ -87,7 +87,7 @@ class CourtOfAmbitionEffect extends OneShotEffect { for (Map.Entry entry : discardMap.entrySet()) { Player player = game.getPlayer(entry.getKey()); if (player != null) { - player.discard(entry.getValue(), source, game); + player.discard(entry.getValue(), false, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CovenantOfMinds.java b/Mage.Sets/src/mage/cards/c/CovenantOfMinds.java index bedea474a8d..7a3c1f58773 100644 --- a/Mage.Sets/src/mage/cards/c/CovenantOfMinds.java +++ b/Mage.Sets/src/mage/cards/c/CovenantOfMinds.java @@ -74,12 +74,12 @@ class CovenantOfMindsEffect extends OneShotEffect { player.moveCards(cards, Zone.HAND, source, game); } else { player.moveCards(cards, Zone.GRAVEYARD, source, game); - player.drawCards(5, source.getSourceId(), game); + player.drawCards(5, source, game); } } else { if (!opponent.chooseUse(Outcome.Benefit, player.getLogName() + "'s library is empty? Do you want them to draw five cards?", source, game)) { - player.drawCards(5, source.getSourceId(), game); + player.drawCards(5, source, game); } } diff --git a/Mage.Sets/src/mage/cards/c/CovetedJewel.java b/Mage.Sets/src/mage/cards/c/CovetedJewel.java index 8f09a76266b..145f39fd20f 100644 --- a/Mage.Sets/src/mage/cards/c/CovetedJewel.java +++ b/Mage.Sets/src/mage/cards/c/CovetedJewel.java @@ -127,7 +127,7 @@ class CovetedJewelControlEffect extends ContinuousEffectImpl { this.discard(); return false; } - permanent.changeControllerId(getTargetPointer().getFirst(game, source), game); + permanent.changeControllerId(getTargetPointer().getFirst(game, source), game, source); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/Cowardice.java b/Mage.Sets/src/mage/cards/c/Cowardice.java index fb8a3982069..887fd71ca73 100644 --- a/Mage.Sets/src/mage/cards/c/Cowardice.java +++ b/Mage.Sets/src/mage/cards/c/Cowardice.java @@ -49,7 +49,7 @@ class CowardiceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CracklingDoom.java b/Mage.Sets/src/mage/cards/c/CracklingDoom.java index 701630c23f1..fd7ceea270a 100644 --- a/Mage.Sets/src/mage/cards/c/CracklingDoom.java +++ b/Mage.Sets/src/mage/cards/c/CracklingDoom.java @@ -104,7 +104,7 @@ class CracklingDoomEffect extends OneShotEffect { } } for (Permanent permanent : toSacrifice) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CragSaurian.java b/Mage.Sets/src/mage/cards/c/CragSaurian.java index 3ecae791a79..1cc78e6d063 100644 --- a/Mage.Sets/src/mage/cards/c/CragSaurian.java +++ b/Mage.Sets/src/mage/cards/c/CragSaurian.java @@ -94,7 +94,7 @@ public final class CragSaurian extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CragganwickCremator.java b/Mage.Sets/src/mage/cards/c/CragganwickCremator.java index e59f756b108..cfe0428185b 100644 --- a/Mage.Sets/src/mage/cards/c/CragganwickCremator.java +++ b/Mage.Sets/src/mage/cards/c/CragganwickCremator.java @@ -68,7 +68,7 @@ class CragganwickCrematorEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Card discardedCard = controller.discardOne(true, source, game); + Card discardedCard = controller.discardOne(true, false, source, game); if (discardedCard != null && discardedCard.isCreature()) { int damage = discardedCard.getPower().getValue(); diff --git a/Mage.Sets/src/mage/cards/c/CranialArchive.java b/Mage.Sets/src/mage/cards/c/CranialArchive.java index 4f91a820ad7..603e6c1b196 100644 --- a/Mage.Sets/src/mage/cards/c/CranialArchive.java +++ b/Mage.Sets/src/mage/cards/c/CranialArchive.java @@ -67,11 +67,11 @@ class CranialArchiveEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { for (Card card: targetPlayer.getGraveyard().getCards(game)){ - targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + targetPlayer.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } targetPlayer.shuffleLibrary(source, game); } - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CraterHellion.java b/Mage.Sets/src/mage/cards/c/CraterHellion.java index ed321bd3287..4e1631667ab 100644 --- a/Mage.Sets/src/mage/cards/c/CraterHellion.java +++ b/Mage.Sets/src/mage/cards/c/CraterHellion.java @@ -70,7 +70,7 @@ class CraterHellionEffect extends OneShotEffect { List permanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { if (!permanent.getId().equals(source.getSourceId())) { - permanent.damage(4, source.getSourceId(), game, false, true); + permanent.damage(4, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CrazedArmodon.java b/Mage.Sets/src/mage/cards/c/CrazedArmodon.java index f910f9fc9d4..d6e2cb84b0f 100644 --- a/Mage.Sets/src/mage/cards/c/CrazedArmodon.java +++ b/Mage.Sets/src/mage/cards/c/CrazedArmodon.java @@ -72,7 +72,7 @@ public final class CrazedArmodon extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CreditVoucher.java b/Mage.Sets/src/mage/cards/c/CreditVoucher.java index 8abaae5f4a4..abfca5c7c6f 100644 --- a/Mage.Sets/src/mage/cards/c/CreditVoucher.java +++ b/Mage.Sets/src/mage/cards/c/CreditVoucher.java @@ -71,7 +71,7 @@ class CreditVoucherEffect extends OneShotEffect { TargetCardInHand target = new TargetCardInHand(0, controller.getHand().size(), filter); target.setRequired(false); int amountShuffled = 0; - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { amountShuffled = target.getTargets().size(); controller.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, source, game); @@ -79,7 +79,7 @@ class CreditVoucherEffect extends OneShotEffect { } controller.shuffleLibrary(source, game); if (amountShuffled > 0) { - controller.drawCards(amountShuffled, source.getSourceId(), game); + controller.drawCards(amountShuffled, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CreepingDread.java b/Mage.Sets/src/mage/cards/c/CreepingDread.java index 12261e5f143..38223ddb135 100644 --- a/Mage.Sets/src/mage/cards/c/CreepingDread.java +++ b/Mage.Sets/src/mage/cards/c/CreepingDread.java @@ -117,7 +117,7 @@ class CreepingDreadEffect extends OneShotEffect { Player player = entry.getKey(); Card cardChosen = entry.getValue(); if (player != null) { - player.discard(cardChosen, source, game); + player.discard(cardChosen, false, source, game); } } } @@ -125,7 +125,7 @@ class CreepingDreadEffect extends OneShotEffect { // each opponent who discarded a card of the same type loses 3 life if (!opponentsAffected.isEmpty()) { for(Player opponent : opponentsAffected) { - opponent.loseLife(3, game, false); + opponent.loseLife(3, game, source, false); } } diff --git a/Mage.Sets/src/mage/cards/c/CreepyDoll.java b/Mage.Sets/src/mage/cards/c/CreepyDoll.java index 71c3056523a..62730f66ad3 100644 --- a/Mage.Sets/src/mage/cards/c/CreepyDoll.java +++ b/Mage.Sets/src/mage/cards/c/CreepyDoll.java @@ -67,7 +67,7 @@ class CreepyDollTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -104,7 +104,7 @@ class CreepyDollEffect extends OneShotEffect { UUID targetId = getTargetPointer().getFirst(game, source); Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/c/CribSwap.java b/Mage.Sets/src/mage/cards/c/CribSwap.java index 42ad6318a2e..99c599a50da 100644 --- a/Mage.Sets/src/mage/cards/c/CribSwap.java +++ b/Mage.Sets/src/mage/cards/c/CribSwap.java @@ -70,7 +70,7 @@ class CribSwapEffect extends OneShotEffect { Permanent targetCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (targetCreature != null) { CribSwapShapeshifterWhiteToken token = new CribSwapShapeshifterWhiteToken(); - return token.putOntoBattlefield(1, game, source.getSourceId(), targetCreature.getControllerId()); + return token.putOntoBattlefield(1, game, source, targetCreature.getControllerId()); } } return false; diff --git a/Mage.Sets/src/mage/cards/c/CrimePunishment.java b/Mage.Sets/src/mage/cards/c/CrimePunishment.java index c6e3cf2fc08..788fdfb64d8 100644 --- a/Mage.Sets/src/mage/cards/c/CrimePunishment.java +++ b/Mage.Sets/src/mage/cards/c/CrimePunishment.java @@ -73,7 +73,7 @@ class PunishmentEffect extends OneShotEffect { && (permanent.isArtifact() || permanent.isCreature() || permanent.isEnchantment())) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java b/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java index 63cc4e30c50..be72bb39da3 100644 --- a/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java +++ b/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java @@ -73,7 +73,7 @@ class CrimsonHonorGuardEffect extends OneShotEffect { if (player != null) { int numCommanders = game.getBattlefield().getAllActivePermanents(filter, player.getId(), game).size(); if (numCommanders == 0) { - player.damage(4, source.getSourceId(), game); + player.damage(4, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CrookedScales.java b/Mage.Sets/src/mage/cards/c/CrookedScales.java index 31a75a2d516..aafd87ef13b 100644 --- a/Mage.Sets/src/mage/cards/c/CrookedScales.java +++ b/Mage.Sets/src/mage/cards/c/CrookedScales.java @@ -75,14 +75,14 @@ class CrookedScalesEffect extends OneShotEffect { do { if (controller.flipCoin(source, game, true)) { if (theirGuy != null) { - theirGuy.destroy(controller.getId(), game, false); + theirGuy.destroy(source, game, false); } keepGoing = false; } else { cost = ManaUtil.createManaCost(3, false); - if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, controller.getId(), controller.getId(), false, null))) { + if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source, controller.getId(), false, null))) { if (yourGuy != null) { - yourGuy.destroy(controller.getId(), game, false); + yourGuy.destroy(source, game, false); } keepGoing = false; } else { diff --git a/Mage.Sets/src/mage/cards/c/CrosisThePurger.java b/Mage.Sets/src/mage/cards/c/CrosisThePurger.java index 02afdcfbccd..0082903a381 100644 --- a/Mage.Sets/src/mage/cards/c/CrosisThePurger.java +++ b/Mage.Sets/src/mage/cards/c/CrosisThePurger.java @@ -91,7 +91,7 @@ class CrosisThePurgerEffect extends OneShotEffect { .filter(card -> card.getColor(game).shares(choice.getColor())) .collect(Collectors.toSet()) ); - damagedPlayer.discard(cards, source, game); + damagedPlayer.discard(cards, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CrosstownCourier.java b/Mage.Sets/src/mage/cards/c/CrosstownCourier.java index bb29e3e6986..80a7dbf0e58 100644 --- a/Mage.Sets/src/mage/cards/c/CrosstownCourier.java +++ b/Mage.Sets/src/mage/cards/c/CrosstownCourier.java @@ -61,7 +61,7 @@ public final class CrosstownCourier extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CrovaxTheCursed.java b/Mage.Sets/src/mage/cards/c/CrovaxTheCursed.java index 3df2c2e0eb3..031d3f43a7b 100644 --- a/Mage.Sets/src/mage/cards/c/CrovaxTheCursed.java +++ b/Mage.Sets/src/mage/cards/c/CrovaxTheCursed.java @@ -87,7 +87,7 @@ class CrovaxTheCursedEffect extends OneShotEffect { } } } else if (sourceObject != null && sourceObject.getCounters(game).containsKey(CounterType.P1P1)) { - sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); + sourceObject.removeCounters(CounterType.P1P1.getName(), 1, source, game); game.informPlayers(controller.getLogName() + " removes a +1/+1 counter from " + sourceObject.getName()); } return true; diff --git a/Mage.Sets/src/mage/cards/c/CrownOfEmpires.java b/Mage.Sets/src/mage/cards/c/CrownOfEmpires.java index 9089c535cfc..6289c5bbf54 100644 --- a/Mage.Sets/src/mage/cards/c/CrownOfEmpires.java +++ b/Mage.Sets/src/mage/cards/c/CrownOfEmpires.java @@ -74,7 +74,7 @@ class CrownOfEmpiresEffect extends OneShotEffect { game.getState().setValue(source.getSourceId().toString(), source.getControllerId()); game.addEffect(effect, source); } else { - target.tap(game); + target.tap(source, game); } return false; } @@ -105,7 +105,7 @@ class CrownOfEmpiresControlEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString()); if (permanent != null && controllerId != null) { - return permanent.changeControllerId(controllerId, game); + return permanent.changeControllerId(controllerId, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java b/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java index 21b8fca6dac..f9c7a827583 100644 --- a/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java +++ b/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java @@ -105,13 +105,13 @@ class CrownOfTheAgesEffect extends OneShotEffect { } // Check for protection MageObject auraObject = game.getObject(aura.getId()); - if (auraObject != null && creatureToAttachAura.cantBeAttachedBy(auraObject, game, true)) { + if (auraObject != null && creatureToAttachAura.cantBeAttachedBy(auraObject, source, game, true)) { passed = false; } } if (passed) { - fromPermanent.removeAttachment(aura.getId(), game); - creatureToAttachAura.addAttachment(aura.getId(), game); + fromPermanent.removeAttachment(aura.getId(), source, game); + creatureToAttachAura.addAttachment(aura.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CruelFate.java b/Mage.Sets/src/mage/cards/c/CruelFate.java index 34e6ba82bf5..c4b96e3d2df 100644 --- a/Mage.Sets/src/mage/cards/c/CruelFate.java +++ b/Mage.Sets/src/mage/cards/c/CruelFate.java @@ -77,7 +77,7 @@ class CruelFateEffect extends OneShotEffect { } else if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); controller.moveCards(card, Zone.GRAVEYARD, source, game); - card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true); + card.moveToZone(Zone.GRAVEYARD, source, game, true); cards.clear(); } } diff --git a/Mage.Sets/src/mage/cards/c/CruelReality.java b/Mage.Sets/src/mage/cards/c/CruelReality.java index 67f52e94db5..ceb5c8b686b 100644 --- a/Mage.Sets/src/mage/cards/c/CruelReality.java +++ b/Mage.Sets/src/mage/cards/c/CruelReality.java @@ -74,7 +74,7 @@ class CruelRealityTriggeredAbiilty extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -128,12 +128,12 @@ class CruelRealityEffect extends OneShotEffect { if (cursedPlayer.choose(Outcome.Sacrifice, target, source.getId(), game)) { Permanent objectToBeSacrificed = game.getPermanent(target.getFirstTarget()); if (objectToBeSacrificed != null) { - if (objectToBeSacrificed.sacrifice(source.getId(), game)) { + if (objectToBeSacrificed.sacrifice(source, game)) { return true; } } } - cursedPlayer.loseLife(5, game, false); + cursedPlayer.loseLife(5, game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CruelRevival.java b/Mage.Sets/src/mage/cards/c/CruelRevival.java index 9e10edc1e0f..9439f859365 100644 --- a/Mage.Sets/src/mage/cards/c/CruelRevival.java +++ b/Mage.Sets/src/mage/cards/c/CruelRevival.java @@ -68,12 +68,12 @@ class CruelRevivalEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent targetDestroy = game.getPermanent(source.getFirstTarget()); if (targetDestroy != null) { - targetDestroy.destroy(source.getSourceId(), game, true); + targetDestroy.destroy(source, game, true); } Card targetRetrieve = game.getCard(source.getTargets().get(1).getFirstTarget()); if (targetRetrieve != null) { - targetRetrieve.moveToZone(Zone.HAND, source.getSourceId(), game, true); + targetRetrieve.moveToZone(Zone.HAND, source, game, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java b/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java index 920e5a62c71..f5efbcc43bf 100644 --- a/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java +++ b/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java @@ -79,7 +79,7 @@ class CrushUnderfootEffect extends OneShotEffect { game.informPlayers("Crush Underfoot: Chosen Giant is " + giant.getName()); Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(giant.getPower().getValue(), source.getSourceId(), game, false, true); + targetCreature.damage(giant.getPower().getValue(), source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CryptChampion.java b/Mage.Sets/src/mage/cards/c/CryptChampion.java index abd95a53c4d..d5c7a4688b8 100644 --- a/Mage.Sets/src/mage/cards/c/CryptChampion.java +++ b/Mage.Sets/src/mage/cards/c/CryptChampion.java @@ -90,7 +90,7 @@ class CryptChampionEffect extends OneShotEffect { filter.add(new OwnerIdPredicate(playerId)); filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4)); Target target = new TargetCardInGraveyard(filter); - if (target.canChoose(playerId, game) + if (target.canChoose(source.getSourceId(), playerId, game) && player.chooseTarget(outcome, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/c/CryptGhast.java b/Mage.Sets/src/mage/cards/c/CryptGhast.java index 686df7a5739..b1bbfa48b03 100644 --- a/Mage.Sets/src/mage/cards/c/CryptGhast.java +++ b/Mage.Sets/src/mage/cards/c/CryptGhast.java @@ -30,8 +30,9 @@ public final class CryptGhast extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); - //Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.) + // Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.) this.addAbility(new ExtortAbility()); + // Whenever you tap a Swamp for mana, add {B} (in addition to the mana the land produces). this.addAbility(new CryptGhastTriggeredAbility()); } @@ -65,12 +66,12 @@ class CryptGhastTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent land = game.getPermanent(event.getTargetId()); + Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); return land != null && filter.match(land, this.getSourceId(), this.getControllerId(), game); } diff --git a/Mage.Sets/src/mage/cards/c/CryptIncursion.java b/Mage.Sets/src/mage/cards/c/CryptIncursion.java index 81a8ce6eecc..342c2e6806e 100644 --- a/Mage.Sets/src/mage/cards/c/CryptIncursion.java +++ b/Mage.Sets/src/mage/cards/c/CryptIncursion.java @@ -58,7 +58,7 @@ class CryptIncursionEffect extends OneShotEffect { int exiledCards = 0; for (Card card : targetPlayer.getGraveyard().getCards(game)) { if (StaticFilters.FILTER_CARD_CREATURE.match(card, game)) { - if (card.moveToExile(null, "", source.getSourceId(), game)) { + if (card.moveToExile(null, "", source, game)) { exiledCards++; } } diff --git a/Mage.Sets/src/mage/cards/c/CrypticCommand.java b/Mage.Sets/src/mage/cards/c/CrypticCommand.java index 53e291976e6..feaf840071c 100644 --- a/Mage.Sets/src/mage/cards/c/CrypticCommand.java +++ b/Mage.Sets/src/mage/cards/c/CrypticCommand.java @@ -90,7 +90,7 @@ class CrypticCommandEffect extends OneShotEffect { return false; } for (Permanent creature : game.getBattlefield().getActivePermanents(filter, player.getId(), source.getSourceId(), game)) { - creature.tap(game); + creature.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CrypticGateway.java b/Mage.Sets/src/mage/cards/c/CrypticGateway.java index 9db7c1b83df..481af3c388c 100644 --- a/Mage.Sets/src/mage/cards/c/CrypticGateway.java +++ b/Mage.Sets/src/mage/cards/c/CrypticGateway.java @@ -68,16 +68,16 @@ class CrypticGatewayCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { int numTargets = 0; Set permanents = new HashSet<>(); - while (numTargets < 2 && target.choose(Outcome.Tap, controllerId, sourceId, game)) { + while (numTargets < 2 && target.choose(Outcome.Tap, controllerId, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } - paid |= permanent.tap(game); + paid |= permanent.tap(source, game); if (paid) { numTargets++; target.clearChosen(); @@ -92,8 +92,8 @@ class CrypticGatewayCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } public CrypticGatewayPredicate getPredicate() { diff --git a/Mage.Sets/src/mage/cards/c/CrystalRod.java b/Mage.Sets/src/mage/cards/c/CrystalRod.java index e6c103e0bfc..b41c72120d8 100644 --- a/Mage.Sets/src/mage/cards/c/CrystalRod.java +++ b/Mage.Sets/src/mage/cards/c/CrystalRod.java @@ -56,7 +56,7 @@ class CrystalRodAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CrystalShard.java b/Mage.Sets/src/mage/cards/c/CrystalShard.java index 15622a72538..e33452edc06 100644 --- a/Mage.Sets/src/mage/cards/c/CrystalShard.java +++ b/Mage.Sets/src/mage/cards/c/CrystalShard.java @@ -80,7 +80,7 @@ class CrystalShardEffect extends OneShotEffect { cost.clearPaid(); final StringBuilder sb = new StringBuilder("Pay {1}? (Otherwise ").append(targetCreature.getName()).append(" will be returned to its owner's hand)"); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { - cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false, null); + cost.pay(source, game, source, targetCreature.getControllerId(), false, null); } if (!cost.isPaid()) { controller.moveCards(targetCreature, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/c/CrystalVein.java b/Mage.Sets/src/mage/cards/c/CrystalVein.java index fe58747c9c2..cce1fdbd130 100644 --- a/Mage.Sets/src/mage/cards/c/CrystalVein.java +++ b/Mage.Sets/src/mage/cards/c/CrystalVein.java @@ -1,4 +1,3 @@ - package mage.cards.c; import java.util.UUID; @@ -23,6 +22,7 @@ public final class CrystalVein extends CardImpl { // {T}: Add {C}. this.addAbility(new ColorlessManaAbility()); + // {T}, Sacrifice Crystal Vein: Add {C}{C}. SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(2), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); diff --git a/Mage.Sets/src/mage/cards/c/Crystallization.java b/Mage.Sets/src/mage/cards/c/Crystallization.java index b1f37a41e9d..34b391d963b 100644 --- a/Mage.Sets/src/mage/cards/c/Crystallization.java +++ b/Mage.Sets/src/mage/cards/c/Crystallization.java @@ -75,7 +75,7 @@ class CrystallizationTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CullingDais.java b/Mage.Sets/src/mage/cards/c/CullingDais.java index 7a26b00aa87..c1e0f39afd4 100644 --- a/Mage.Sets/src/mage/cards/c/CullingDais.java +++ b/Mage.Sets/src/mage/cards/c/CullingDais.java @@ -66,7 +66,7 @@ class CullingDaisEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (p != null && player != null) { int count = p.getCounters(game).getCount(CounterType.CHARGE); - player.drawCards(count, source.getSourceId(), game); + player.drawCards(count, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/Curiosity.java b/Mage.Sets/src/mage/cards/c/Curiosity.java index 434826b466d..57006e2e249 100644 --- a/Mage.Sets/src/mage/cards/c/Curiosity.java +++ b/Mage.Sets/src/mage/cards/c/Curiosity.java @@ -70,7 +70,7 @@ class CuriosityAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CuriousHerd.java b/Mage.Sets/src/mage/cards/c/CuriousHerd.java index e2812e6e374..b430da37cbb 100644 --- a/Mage.Sets/src/mage/cards/c/CuriousHerd.java +++ b/Mage.Sets/src/mage/cards/c/CuriousHerd.java @@ -62,7 +62,7 @@ class CuriousHerdEffect extends OneShotEffect { StaticFilters.FILTER_PERMANENT_ARTIFACT, source.getFirstTarget(), game ); if (artifactCount > 0) { - token.putOntoBattlefield(artifactCount, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(artifactCount, game, source, source.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfChaos.java b/Mage.Sets/src/mage/cards/c/CurseOfChaos.java index 8031db361fe..5711d993d48 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfChaos.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfChaos.java @@ -64,7 +64,7 @@ class CurseOfChaosTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override @@ -114,8 +114,8 @@ class CurseOfChaosEffect extends OneShotEffect { Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (attacker != null) { if (!attacker.getHand().isEmpty() && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)) { - attacker.discard(1, false, source, game); - attacker.drawCards(1, source.getSourceId(), game); + attacker.discard(1, false, false, source, game); + attacker.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfInertia.java b/Mage.Sets/src/mage/cards/c/CurseOfInertia.java index 06ccfc4813e..7ceea562c8b 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfInertia.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfInertia.java @@ -64,7 +64,7 @@ class CurseOfInertiaTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override @@ -115,7 +115,7 @@ class CurseOfInertiaTapOrUntapTargetEffect extends OneShotEffect { } } else { if (player.chooseUse(Outcome.Tap, "Tap that permanent?", source, game)) { - targetPermanent.tap(game); + targetPermanent.tap(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java b/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java index e62b6a30cf1..c94022f6212 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java @@ -92,7 +92,7 @@ class CurseOfMisfortunesEffect extends OneShotEffect { this.setTargetPointer(new FixedTarget(targetPlayer.getId())); game.getState().setValue("attachTo:" + card.getId(), targetPlayer.getId()); if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) { - targetPlayer.addAttachment(card.getId(), game); + targetPlayer.addAttachment(card.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfOblivion.java b/Mage.Sets/src/mage/cards/c/CurseOfOblivion.java index a12ec39a260..0e7c5f0e2bc 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfOblivion.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfOblivion.java @@ -71,7 +71,7 @@ class CurseOfOblivionAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CurseOfPredation.java b/Mage.Sets/src/mage/cards/c/CurseOfPredation.java index 7616a3cc564..1e26ed1c8d8 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfPredation.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfPredation.java @@ -67,7 +67,7 @@ class CurseOfPredationTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CurseOfShallowGraves.java b/Mage.Sets/src/mage/cards/c/CurseOfShallowGraves.java index 7a9a2e8ce67..f9ecfec1f38 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfShallowGraves.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfShallowGraves.java @@ -70,7 +70,7 @@ class CurseOfShallowTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CurseOfStalkedPrey.java b/Mage.Sets/src/mage/cards/c/CurseOfStalkedPrey.java index 69381a42736..b66d2a533db 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfStalkedPrey.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfStalkedPrey.java @@ -73,7 +73,7 @@ class CurseOfStalkedPreyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CurseOfTheBloodyTome.java b/Mage.Sets/src/mage/cards/c/CurseOfTheBloodyTome.java index b1c0bd8ba66..19ab3fd2dab 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfTheBloodyTome.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfTheBloodyTome.java @@ -70,7 +70,7 @@ class CurseOfTheBloodyTomeAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CurseOfTheCabal.java b/Mage.Sets/src/mage/cards/c/CurseOfTheCabal.java index b2bab766740..60be04ef4cf 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfTheCabal.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfTheCabal.java @@ -85,16 +85,16 @@ class CurseOfTheCabalSacrificeEffect extends OneShotEffect { return true; } Target target = new TargetControlledPermanent(amount, amount, StaticFilters.FILTER_CONTROLLED_PERMANENT, true); - if (target.canChoose(targetPlayer.getId(), game)) { + if (target.canChoose(source.getSourceId(), targetPlayer.getId(), game)) { while (!target.isChosen() - && target.canChoose(targetPlayer.getId(), game) && targetPlayer.canRespond()) { + && target.canChoose(source.getSourceId(), targetPlayer.getId(), game) && targetPlayer.canRespond()) { targetPlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } //sacrifice all chosen (non null) permanents target.getTargets().stream() .map(game::getPermanent) .filter(Objects::nonNull) - .forEach(permanent -> permanent.sacrifice(source.getSourceId(), game)); + .forEach(permanent -> permanent.sacrifice(source, game)); } return true; } @@ -142,9 +142,9 @@ class CurseOfTheCabalTriggeredAbilityConditionalDelay extends AddCountersSourceE if (target == null) { return false; } - if (cost.canPay(source, source.getSourceId(), activePlayerId, game) + if (cost.canPay(source, source, activePlayerId, game) && target.chooseUse(Outcome.Sacrifice, "Sacrifice a permanent to delay Curse of the Cabal?", source, game) - && cost.pay(source, game, source.getSourceId(), activePlayerId, true, null)) { + && cost.pay(source, game, source, activePlayerId, true, null)) { return super.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/c/CurseOfTheForsaken.java b/Mage.Sets/src/mage/cards/c/CurseOfTheForsaken.java index ee09485bc1f..433b6fb8769 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfTheForsaken.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfTheForsaken.java @@ -68,7 +68,7 @@ class CurseOfTheForsakenTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CurseOfThePiercedHeart.java b/Mage.Sets/src/mage/cards/c/CurseOfThePiercedHeart.java index dcb248671ab..4c0d37a10c0 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfThePiercedHeart.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfThePiercedHeart.java @@ -71,7 +71,7 @@ class CurseOfThePiercedHeartAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -131,12 +131,12 @@ class CurseOfThePiercedHeartEffect extends OneShotEffect { if (target.choose(Outcome.Damage, controller.getId(), source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - return permanent.damage(1, source.getSourceId(), game, false, true) > 0; + return permanent.damage(1, source.getSourceId(), source, game, false, true) > 0; } } } } - opponent.damage(1, source.getSourceId(), game); + opponent.damage(1, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfTheSwine.java b/Mage.Sets/src/mage/cards/c/CurseOfTheSwine.java index ece104889a3..76ed96c4fa7 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfTheSwine.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfTheSwine.java @@ -87,8 +87,7 @@ class CurseOfTheSwineEffect extends OneShotEffect { } CurseOfTheSwineBoarToken swineToken = new CurseOfTheSwineBoarToken(); for (Map.Entry exiledByController : playersWithTargets.entrySet()) { - swineToken.putOntoBattlefield(exiledByController.getValue(), - game, source.getSourceId(), exiledByController.getKey()); + swineToken.putOntoBattlefield(exiledByController.getValue(), game, source, exiledByController.getKey()); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfThirst.java b/Mage.Sets/src/mage/cards/c/CurseOfThirst.java index 9864782728f..3a74cedfef3 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfThirst.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfThirst.java @@ -71,7 +71,7 @@ class CurseOfThirstAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java b/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java index fe1af03565f..88d30a77ccd 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java @@ -73,7 +73,7 @@ class CurseOfVengeanceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @@ -118,7 +118,7 @@ class CurseOfVengeancePlayerLosesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST; + return event.getType() == GameEvent.EventType.LOST; } @Override @@ -157,7 +157,7 @@ class CurseOfVengeanceDrawLifeEffect extends OneShotEffect { Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceObject != null && controller != null) { if (sourceObject.getCounters(game).containsKey(CounterType.SPITE)) { - controller.drawCards(sourceObject.getCounters(game).getCount(CounterType.SPITE), source.getSourceId(), game); + controller.drawCards(sourceObject.getCounters(game).getCount(CounterType.SPITE), source, game); controller.gainLife(sourceObject.getCounters(game).getCount(CounterType.SPITE), game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/c/CurseOfWizardry.java b/Mage.Sets/src/mage/cards/c/CurseOfWizardry.java index c116ec57911..cc41f02b45d 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfWizardry.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfWizardry.java @@ -62,7 +62,7 @@ class CurseOfWizardryPlayerCastsSpellChosenColorTriggeredAbility extends Trigger @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CursedScroll.java b/Mage.Sets/src/mage/cards/c/CursedScroll.java index 6ed0c99568f..b2c2caf98c9 100644 --- a/Mage.Sets/src/mage/cards/c/CursedScroll.java +++ b/Mage.Sets/src/mage/cards/c/CursedScroll.java @@ -73,12 +73,12 @@ class CursedScrollEffect extends OneShotEffect { if (CardUtil.haveSameNames(card, cardName, game)) { Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); if (creature != null) { - creature.damage(2, source.getSourceId(), game, false, true); + creature.damage(2, source.getSourceId(), source, game, false, true); return true; } Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CustodiSoulcaller.java b/Mage.Sets/src/mage/cards/c/CustodiSoulcaller.java index 1defb822fba..4ec6dd5f61d 100644 --- a/Mage.Sets/src/mage/cards/c/CustodiSoulcaller.java +++ b/Mage.Sets/src/mage/cards/c/CustodiSoulcaller.java @@ -87,9 +87,9 @@ class CustodiSoulcallerWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.BEGIN_COMBAT_STEP_PRE) { + if (event.getType() == GameEvent.EventType.BEGIN_COMBAT_STEP_PRE) { this.playersAttacked.clear(); - } else if (event.getType() == EventType.ATTACKER_DECLARED) { + } else if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { Set attackedPlayers = this.playersAttacked.getOrDefault(event.getPlayerId(), new HashSet<>(1)); attackedPlayers.add(event.getTargetId()); this.playersAttacked.put(event.getPlayerId(), attackedPlayers); diff --git a/Mage.Sets/src/mage/cards/c/CustodyBattle.java b/Mage.Sets/src/mage/cards/c/CustodyBattle.java index 7153e1c7669..d4b69c2b9e6 100644 --- a/Mage.Sets/src/mage/cards/c/CustodyBattle.java +++ b/Mage.Sets/src/mage/cards/c/CustodyBattle.java @@ -93,7 +93,7 @@ class GiveControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } @@ -125,10 +125,10 @@ class CustodyBattleUnlessPaysEffect extends OneShotEffect { String message = "sacrifice a land?"; message = CardUtil.replaceSourceName(message, sourcePermanent.getLogName()); message = Character.toUpperCase(message.charAt(0)) + message.substring(1); - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) + if (cost.canPay(source, source, source.getControllerId(), game) && controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CutTheTethers.java b/Mage.Sets/src/mage/cards/c/CutTheTethers.java index 01b36616d05..b68af30f559 100644 --- a/Mage.Sets/src/mage/cards/c/CutTheTethers.java +++ b/Mage.Sets/src/mage/cards/c/CutTheTethers.java @@ -70,10 +70,10 @@ class CutTheTethersEffect extends OneShotEffect { boolean paid = false; if (player.chooseUse(Outcome.Benefit, "Pay {3} to keep " + creature.getName() + " on the battlefield?", source, game)) { Cost cost = ManaUtil.createManaCost(3, false); - paid = cost.pay(source, game, source.getSourceId(), creature.getControllerId(), false, null); + paid = cost.pay(source, game, source, creature.getControllerId(), false, null); } if (!paid) { - creature.moveToZone(Zone.HAND, source.getSourceId(), game, true); + creature.moveToZone(Zone.HAND, source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/c/Cyclone.java b/Mage.Sets/src/mage/cards/c/Cyclone.java index fa1445b3983..75e687c3f98 100644 --- a/Mage.Sets/src/mage/cards/c/Cyclone.java +++ b/Mage.Sets/src/mage/cards/c/Cyclone.java @@ -75,13 +75,13 @@ class CycloneEffect extends OneShotEffect { DamageEverythingEffect dmg = new DamageEverythingEffect(total); dmg.apply(game, source); } else { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } private boolean choice(Game game, Ability source, Player player, Cost counters) { - return counters.canPay(source, source.getSourceId(), player.getId(), game) + return counters.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Damage, "Pay Cyclone's Upkeep?", source, game); } diff --git a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java index 6b637fda4c2..670884c26a5 100644 --- a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java +++ b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java @@ -195,7 +195,7 @@ class CyclopeanTombCounterWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.COUNTERS_ADDED && event.getData().equals(CounterType.MIRE.getName()) && event.getAmount() > 0) { - Permanent tomb = game.getPermanentOrLKIBattlefield(event.getSourceId()); + Permanent tomb = game.getPermanentOrLKIBattlefield(event.getTargetId()); if (tomb != null) { MageObjectReference cylopeanTombInstance = new MageObjectReference(tomb, game); Set miredLands; diff --git a/Mage.Sets/src/mage/cards/c/CyclopsGladiator.java b/Mage.Sets/src/mage/cards/c/CyclopsGladiator.java index 638e886454f..5d5155ffb36 100644 --- a/Mage.Sets/src/mage/cards/c/CyclopsGladiator.java +++ b/Mage.Sets/src/mage/cards/c/CyclopsGladiator.java @@ -74,8 +74,8 @@ class CyclopsGladiatorEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent cyclops = game.getPermanent(source.getSourceId()); if (permanent != null && cyclops != null) { - permanent.damage(cyclops.getPower().getValue(), cyclops.getId(), game, false, true); - cyclops.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); + permanent.damage(cyclops.getPower().getValue(), cyclops.getId(), source, game, false, true); + cyclops.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java b/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java index 5a27d3ceffc..be887b1c49d 100644 --- a/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java +++ b/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java @@ -88,7 +88,7 @@ class CytoplastRootKinEffect extends OneShotEffect { && targetPermanent != null && !sourcePermanent.getId().equals(targetPermanent.getId()) && targetPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { - targetPermanent.removeCounters(CounterType.P1P1.createInstance(), game); + targetPermanent.removeCounters(CounterType.P1P1.createInstance(), source, game); sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java b/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java index 7f3ff7ac74c..0fe419cb9fe 100644 --- a/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java +++ b/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java @@ -89,7 +89,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { if (fromPermanent != null && fromPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (toPermanent != null) { - fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game); + fromPermanent.removeCounters(CounterType.P1P1.createInstance(), source, game); toPermanent.addCounters(CounterType.P1P1.createInstance(), source, game); game.informPlayers(sourceObject.getLogName() + ": Moved a +1/+1 counter from " + fromPermanent.getLogName() +" to " + toPermanent.getLogName()); } diff --git a/Mage.Sets/src/mage/cards/d/DamnablePact.java b/Mage.Sets/src/mage/cards/d/DamnablePact.java index 33b8f0b960d..3021a7706a2 100644 --- a/Mage.Sets/src/mage/cards/d/DamnablePact.java +++ b/Mage.Sets/src/mage/cards/d/DamnablePact.java @@ -52,8 +52,8 @@ class DamnablePactEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.drawCards(source.getManaCostsToPay().getX(), source.getSourceId(), game); - targetPlayer.loseLife(source.getManaCostsToPay().getX(), game, false); + targetPlayer.drawCards(source.getManaCostsToPay().getX(), source, game); + targetPlayer.loseLife(source.getManaCostsToPay().getX(), game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/DampingMatrix.java b/Mage.Sets/src/mage/cards/d/DampingMatrix.java index 32d153a156b..b4e3804e2fd 100644 --- a/Mage.Sets/src/mage/cards/d/DampingMatrix.java +++ b/Mage.Sets/src/mage/cards/d/DampingMatrix.java @@ -74,7 +74,7 @@ class DampingMatrixEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATE_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DampingSphere.java b/Mage.Sets/src/mage/cards/d/DampingSphere.java index c2177cc6907..60c3ac9309a 100644 --- a/Mage.Sets/src/mage/cards/d/DampingSphere.java +++ b/Mage.Sets/src/mage/cards/d/DampingSphere.java @@ -75,12 +75,12 @@ class DampingSphereReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); + MageObject mageObject = game.getPermanentOrLKIBattlefield(event.getSourceId()); ManaEvent manaEvent = (ManaEvent) event; Mana mana = manaEvent.getMana(); return mageObject != null && mageObject.isLand() && mana.count() > 1; diff --git a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java index 53dd4fb3647..e2ba87f6445 100644 --- a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java +++ b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java @@ -124,7 +124,7 @@ class DanceOfTheDeadReAttachEffect extends OneShotEffect { target.addTarget(enchantedCreature.getId(), source, game); enchantment.getSpellAbility().getTargets().clear(); enchantment.getSpellAbility().getTargets().add(target); - enchantedCreature.addAttachment(enchantment.getId(), game); + enchantedCreature.addAttachment(enchantment.getId(), source, game); } return true; } @@ -157,7 +157,7 @@ class DanceOfTheDeadLeavesBattlefieldTriggeredEffect extends OneShotEffect { if (sourcePermanent.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(sourcePermanent.getAttachedTo()); if (attachedTo != null && attachedTo.getZoneChangeCounter(game) == sourcePermanent.getAttachedToZoneChangeCounter()) { - attachedTo.sacrifice(source.getSourceId(), game); + attachedTo.sacrifice(source, game); } } return true; @@ -193,7 +193,7 @@ class DanceOfTheDeadAttachEffect extends OneShotEffect { // Card have no attachedTo attribute yet so write ref only to enchantment now Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null) { - enchantment.attachTo(card.getId(), game); + enchantment.attachTo(card.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DaredevilDragster.java b/Mage.Sets/src/mage/cards/d/DaredevilDragster.java index d0dcc2315cd..8f544ba7feb 100644 --- a/Mage.Sets/src/mage/cards/d/DaredevilDragster.java +++ b/Mage.Sets/src/mage/cards/d/DaredevilDragster.java @@ -78,8 +78,8 @@ class DaredevilDragsterEffect extends OneShotEffect { if (controller != null && permanent != null) { permanent.addCounters(CounterType.VELOCITY.createInstance(), source, game); if (permanent.getCounters(game).getCount(CounterType.VELOCITY) >= 2) { - permanent.sacrifice(source.getSourceId(), game); - controller.drawCards(2, source.getSourceId(), game); + permanent.sacrifice(source, game); + controller.drawCards(2, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java b/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java index 7f04fb3a778..46e3ecc496f 100644 --- a/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java +++ b/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java @@ -88,8 +88,8 @@ class DarettiDiscardDrawEffect extends OneShotEffect { if (controller != null) { TargetDiscard target = new TargetDiscard(0, 2, new FilterCard(), controller.getId()); target.choose(outcome, controller.getId(), source.getSourceId(), game); - int count = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); - controller.drawCards(count, source.getSourceId(), game); + int count = controller.discard(new CardsImpl(target.getTargets()), false, source, game).size(); + controller.drawCards(count, source, game); return true; } return false; @@ -120,7 +120,7 @@ class DarettiSacrificeEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseTarget(outcome, target, source, game)) { Permanent artifact = game.getPermanent(target.getFirstTarget()); - if (artifact != null && artifact.sacrifice(source.getSourceId(), game)) { + if (artifact != null && artifact.sacrifice(source, game)) { Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null) { return controller.moveCards(card, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/d/DarienKingOfKjeldor.java b/Mage.Sets/src/mage/cards/d/DarienKingOfKjeldor.java index 3d0156fb4a6..4adc2aeaff9 100644 --- a/Mage.Sets/src/mage/cards/d/DarienKingOfKjeldor.java +++ b/Mage.Sets/src/mage/cards/d/DarienKingOfKjeldor.java @@ -66,7 +66,7 @@ class DarienKingOfKjeldorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DarigaazReincarnated.java b/Mage.Sets/src/mage/cards/d/DarigaazReincarnated.java index e4623e5e5a2..f2d07d57fc4 100644 --- a/Mage.Sets/src/mage/cards/d/DarigaazReincarnated.java +++ b/Mage.Sets/src/mage/cards/d/DarigaazReincarnated.java @@ -97,7 +97,7 @@ class DarigaazReincarnatedDiesEffect extends ReplacementEffectImpl { if (permCard == null) { return false; } - return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true) + return controller.moveCardToExileWithInfo(permanent, null, null, source, game, Zone.BATTLEFIELD, true) && permCard.addCounters(CounterType.EGG.createInstance(3), source, game); } return false; diff --git a/Mage.Sets/src/mage/cards/d/DarigaazTheIgniter.java b/Mage.Sets/src/mage/cards/d/DarigaazTheIgniter.java index 26b63ea006e..f09101ce576 100644 --- a/Mage.Sets/src/mage/cards/d/DarigaazTheIgniter.java +++ b/Mage.Sets/src/mage/cards/d/DarigaazTheIgniter.java @@ -81,7 +81,7 @@ class DarigaazTheIgniterEffect extends OneShotEffect { filter.add(new ColorPredicate(choice.getColor())); int damage = damagedPlayer.getHand().count(filter, source.getSourceId(), source.getControllerId(), game); if (damage > 0) { - damagedPlayer.damage(damage, source.getSourceId(), game); + damagedPlayer.damage(damage, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DaringSleuth.java b/Mage.Sets/src/mage/cards/d/DaringSleuth.java index a4fbd3a1c75..824418d168f 100644 --- a/Mage.Sets/src/mage/cards/d/DaringSleuth.java +++ b/Mage.Sets/src/mage/cards/d/DaringSleuth.java @@ -63,7 +63,7 @@ class DaringSleuthTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DarkConfidant.java b/Mage.Sets/src/mage/cards/d/DarkConfidant.java index bb23c67e102..25213693da4 100644 --- a/Mage.Sets/src/mage/cards/d/DarkConfidant.java +++ b/Mage.Sets/src/mage/cards/d/DarkConfidant.java @@ -66,7 +66,7 @@ class DarkConfidantEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controller.revealCards(sourcePermanent.getIdName(), cards, game); controller.moveCards(card, Zone.HAND, source, game); - controller.loseLife(card.getConvertedManaCost(), game, false); + controller.loseLife(card.getConvertedManaCost(), game, source, false); } return true; diff --git a/Mage.Sets/src/mage/cards/d/DarkDeal.java b/Mage.Sets/src/mage/cards/d/DarkDeal.java index e3d836b24c5..d87c478796b 100644 --- a/Mage.Sets/src/mage/cards/d/DarkDeal.java +++ b/Mage.Sets/src/mage/cards/d/DarkDeal.java @@ -62,7 +62,7 @@ class DarkDealEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int cardsInHand = player.getHand().size(); - player.discard(cardsInHand, false, source, game); + player.discard(cardsInHand, false, false, source, game); if (cardsInHand > 1) { cardsToDraw.put(playerId, cardsInHand - 1); } @@ -71,7 +71,7 @@ class DarkDealEffect extends OneShotEffect { for (Map.Entry toDrawByPlayer : cardsToDraw.entrySet()) { Player player = game.getPlayer(toDrawByPlayer.getKey()); if (player != null) { - player.drawCards(toDrawByPlayer.getValue(), source.getSourceId(), game); + player.drawCards(toDrawByPlayer.getValue(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DarkImpostor.java b/Mage.Sets/src/mage/cards/d/DarkImpostor.java index 412a01f2a20..9007312abf5 100644 --- a/Mage.Sets/src/mage/cards/d/DarkImpostor.java +++ b/Mage.Sets/src/mage/cards/d/DarkImpostor.java @@ -75,7 +75,7 @@ class DarkImpostorExileTargetEffect extends OneShotEffect { Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); MageObject sourceObject = source.getSourceObject(game); if (permanent != null) { - permanent.moveToExile(null, null, source.getSourceId(), game); + permanent.moveToExile(null, null, source, game); if (sourceObject instanceof Permanent) { ((Permanent) sourceObject).imprint(permanent.getId(), game); } diff --git a/Mage.Sets/src/mage/cards/d/DarkIntimations.java b/Mage.Sets/src/mage/cards/d/DarkIntimations.java index 7c2973c4773..1340aecef8b 100644 --- a/Mage.Sets/src/mage/cards/d/DarkIntimations.java +++ b/Mage.Sets/src/mage/cards/d/DarkIntimations.java @@ -101,7 +101,7 @@ class DarkIntimationsEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { TargetPermanent target = new TargetPermanent(1, 1, filter, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -110,13 +110,13 @@ class DarkIntimationsEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } for (UUID playerId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.discardOne(false, source, game); + player.discardOne(false, false, source, game); } } TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filterCard); @@ -128,7 +128,7 @@ class DarkIntimationsEffect extends OneShotEffect { } controller.moveCards(card, Zone.HAND, source, game); } - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DarkSphere.java b/Mage.Sets/src/mage/cards/d/DarkSphere.java index 194ec0b305a..b8eda213e7e 100644 --- a/Mage.Sets/src/mage/cards/d/DarkSphere.java +++ b/Mage.Sets/src/mage/cards/d/DarkSphere.java @@ -79,7 +79,7 @@ class DarkSpherePreventionEffect extends ReplacementEffectImpl { MageObject sourceObject = game.getObject(source.getSourceId()); DamageEvent damageEvent = (DamageEvent) event; if (controller != null) { - controller.damage((int) Math.ceil(damageEvent.getAmount() / 2.0), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + controller.damage((int) Math.ceil(damageEvent.getAmount() / 2.0), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); StringBuilder sb = new StringBuilder(sourceObject != null ? sourceObject.getLogName() : ""); sb.append(": ").append(damageEvent.getAmount() / 2).append(" damage prevented"); sb.append(" from ").append(controller.getLogName()); diff --git a/Mage.Sets/src/mage/cards/d/DarkSuspicions.java b/Mage.Sets/src/mage/cards/d/DarkSuspicions.java index ae96cb96a68..6b3f447c69e 100644 --- a/Mage.Sets/src/mage/cards/d/DarkSuspicions.java +++ b/Mage.Sets/src/mage/cards/d/DarkSuspicions.java @@ -59,7 +59,7 @@ class DarkSuspicionsEffect extends OneShotEffect { if (controller != null && opponent != null) { int xValue = opponent.getHand().size() - controller.getHand().size(); if (xValue > 0) { - opponent.loseLife(xValue, game, false); + opponent.loseLife(xValue, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DarkTemper.java b/Mage.Sets/src/mage/cards/d/DarkTemper.java index d772dadbb9c..7b94bcaf47e 100644 --- a/Mage.Sets/src/mage/cards/d/DarkTemper.java +++ b/Mage.Sets/src/mage/cards/d/DarkTemper.java @@ -67,9 +67,9 @@ class DarkTemperEffect extends OneShotEffect { filter.add(new ColorPredicate(ObjectColor.BLACK)); if (game.getBattlefield().countAll(filter, source.getControllerId(), game) == 0) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); } else { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DarkTutelage.java b/Mage.Sets/src/mage/cards/d/DarkTutelage.java index ce6d8ca012d..2298e335f78 100644 --- a/Mage.Sets/src/mage/cards/d/DarkTutelage.java +++ b/Mage.Sets/src/mage/cards/d/DarkTutelage.java @@ -53,8 +53,8 @@ class DarkTutelageEffect extends OneShotEffect { Card card = controller.getLibrary().getFromTop(game); if (card != null) { controller.revealCards(source, new CardsImpl(card), game); - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); - controller.loseLife(card.getConvertedManaCost(), game, false); + card.moveToZone(Zone.HAND, source, game, false); + controller.loseLife(card.getConvertedManaCost(), game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DarthTyranusCountOfSerenno.java b/Mage.Sets/src/mage/cards/d/DarthTyranusCountOfSerenno.java index 6fc58b4f82a..751e05744f5 100644 --- a/Mage.Sets/src/mage/cards/d/DarthTyranusCountOfSerenno.java +++ b/Mage.Sets/src/mage/cards/d/DarthTyranusCountOfSerenno.java @@ -121,7 +121,7 @@ class TransmuteArtifactEffect extends SearchEffect { if (controller.chooseTarget(Outcome.Sacrifice, targetArtifact, source, game)) { Permanent permanent = game.getPermanent(targetArtifact.getFirstTarget()); if (permanent != null) { - sacrifice = permanent.sacrifice(source.getSourceId(), game); + sacrifice = permanent.sacrifice(source, game); } } if (sacrifice && controller.searchLibrary(target, source, game)) { diff --git a/Mage.Sets/src/mage/cards/d/DaruSpiritualist.java b/Mage.Sets/src/mage/cards/d/DaruSpiritualist.java index dbf5f6a79d5..eb3dfeca7c3 100644 --- a/Mage.Sets/src/mage/cards/d/DaruSpiritualist.java +++ b/Mage.Sets/src/mage/cards/d/DaruSpiritualist.java @@ -62,7 +62,7 @@ class DaruSpiritualistTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DashHopes.java b/Mage.Sets/src/mage/cards/d/DashHopes.java index c6eac88e191..3f8f149c1d4 100644 --- a/Mage.Sets/src/mage/cards/d/DashHopes.java +++ b/Mage.Sets/src/mage/cards/d/DashHopes.java @@ -69,13 +69,13 @@ class DashHopesCounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if(player != null) { cost.clearPaid(); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + '?', source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DawnsReflection.java b/Mage.Sets/src/mage/cards/d/DawnsReflection.java index 5fd8abfbf64..a9edf8fc51b 100644 --- a/Mage.Sets/src/mage/cards/d/DawnsReflection.java +++ b/Mage.Sets/src/mage/cards/d/DawnsReflection.java @@ -20,6 +20,7 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; +import mage.target.targetpointer.FixedTarget; import java.util.ArrayList; import java.util.List; @@ -40,6 +41,7 @@ public final class DawnsReflection extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); + // Whenever enchanted land is tapped for mana, its controller adds two mana in any combination of colors. this.addAbility(new DawnsReflectionTriggeredAbility()); } @@ -71,13 +73,17 @@ class DawnsReflectionTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - return enchantment != null && enchantment.isAttachedTo(event.getSourceId()); + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + return enchantedLand != null && enchantedLand.isLand(); + } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java b/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java index e8ce8301e8a..9f83236857f 100644 --- a/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java +++ b/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java @@ -77,7 +77,7 @@ class DayOfTheDragonsEntersEffect extends OneShotEffect { UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); controller.moveCardsToExile(toExile, source, game, true, exileId, sourceObject.getIdName()); DragonToken2 token = new DragonToken2(); - token.putOntoBattlefield(toExile.size(), game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(toExile.size(), game, source, source.getControllerId()); } return true; } @@ -115,7 +115,7 @@ class DayOfTheDragonsLeavesEffect extends OneShotEffect { if (controller != null) { for (Permanent dragon : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (dragon != null) { - dragon.sacrifice(source.getSourceId(), game); + dragon.sacrifice(source, game); } } int zoneChangeCounter = source.getSourceObjectZoneChangeCounter(); diff --git a/Mage.Sets/src/mage/cards/d/DeadIronSledge.java b/Mage.Sets/src/mage/cards/d/DeadIronSledge.java index 6c59f005026..a04cdb271d7 100644 --- a/Mage.Sets/src/mage/cards/d/DeadIronSledge.java +++ b/Mage.Sets/src/mage/cards/d/DeadIronSledge.java @@ -121,7 +121,7 @@ class DeadIronSledgeDestroyEffect extends OneShotEffect { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.destroy(targetId, game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DeadReckoning.java b/Mage.Sets/src/mage/cards/d/DeadReckoning.java index 723ad879f4c..479e8fdf808 100644 --- a/Mage.Sets/src/mage/cards/d/DeadReckoning.java +++ b/Mage.Sets/src/mage/cards/d/DeadReckoning.java @@ -63,9 +63,9 @@ class DeadReckoningEffect extends OneShotEffect { TargetCreaturePermanent target2 = new TargetCreaturePermanent(); if (controller != null) { - if (target1.canChoose(source.getControllerId(), game) + if (target1.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, target1, source.getSourceId(), game) - && target2.canChoose(source.getControllerId(), game) + && target2.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Damage, target2, source.getSourceId(), game)) { Card creatureInGraveyard = game.getCard(target1.getFirstTarget()); if (creatureInGraveyard != null) { @@ -73,7 +73,7 @@ class DeadReckoningEffect extends OneShotEffect { int power = creatureInGraveyard.getPower().getValue(); Permanent creature = game.getPermanent(target2.getFirstTarget()); if (creature != null) { - creature.damage(power, source.getSourceId(), game, false, true); + creature.damage(power, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DeadlyDesigns.java b/Mage.Sets/src/mage/cards/d/DeadlyDesigns.java index 66e51c90cd2..85fb3255b30 100644 --- a/Mage.Sets/src/mage/cards/d/DeadlyDesigns.java +++ b/Mage.Sets/src/mage/cards/d/DeadlyDesigns.java @@ -104,7 +104,7 @@ class DeadlyDesignsEffect extends SacrificeSourceEffect { for (UUID target : getTargetPointer().getTargets(game, source)) { toDestroy = game.getPermanent(target); if (toDestroy != null) { - toDestroy.destroy(source.getId(), game, false); + toDestroy.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/d/DeadlyTempest.java b/Mage.Sets/src/mage/cards/d/DeadlyTempest.java index e09fbd1f653..3f29856cae4 100644 --- a/Mage.Sets/src/mage/cards/d/DeadlyTempest.java +++ b/Mage.Sets/src/mage/cards/d/DeadlyTempest.java @@ -61,7 +61,7 @@ class DeadlyTempestEffect extends OneShotEffect { if (controller != null) { Map destroyedCreatures = new HashMap<>(); for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { int count = destroyedCreatures.getOrDefault(permanent.getControllerId(), 0); destroyedCreatures.put(permanent.getControllerId(), count + 1); } @@ -71,7 +71,7 @@ class DeadlyTempestEffect extends OneShotEffect { if (count > 0) { Player player = game.getPlayer(playerId); if (player != null) { - player.loseLife(count, game, false); + player.loseLife(count, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/d/Deadshot.java b/Mage.Sets/src/mage/cards/d/Deadshot.java index 6e2db1af863..1c8dda94f28 100644 --- a/Mage.Sets/src/mage/cards/d/Deadshot.java +++ b/Mage.Sets/src/mage/cards/d/Deadshot.java @@ -78,7 +78,7 @@ class DeadshotDamageEffect extends OneShotEffect { int damage = ownCreature.getPower().getValue(); Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(damage, ownCreature.getId(), game, false, true); + targetCreature.damage(damage, ownCreature.getId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DearlyDeparted.java b/Mage.Sets/src/mage/cards/d/DearlyDeparted.java index 6083900b5c3..1aa9a2c485f 100644 --- a/Mage.Sets/src/mage/cards/d/DearlyDeparted.java +++ b/Mage.Sets/src/mage/cards/d/DearlyDeparted.java @@ -58,7 +58,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DeathByDragons.java b/Mage.Sets/src/mage/cards/d/DeathByDragons.java index 5f8abb84585..1ff7ef59676 100644 --- a/Mage.Sets/src/mage/cards/d/DeathByDragons.java +++ b/Mage.Sets/src/mage/cards/d/DeathByDragons.java @@ -62,7 +62,7 @@ class DeathByDragonsEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { if (!playerId.equals(this.getTargetPointer().getFirst(game, source))) { Token token = new DragonToken2(); - token.putOntoBattlefield(1, game, source.getSourceId(), playerId); + token.putOntoBattlefield(1, game, source, playerId); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DeathPitOffering.java b/Mage.Sets/src/mage/cards/d/DeathPitOffering.java index c64ba172cb8..3d3a909b351 100644 --- a/Mage.Sets/src/mage/cards/d/DeathPitOffering.java +++ b/Mage.Sets/src/mage/cards/d/DeathPitOffering.java @@ -67,7 +67,7 @@ class DeathPitOfferingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DeathWatch.java b/Mage.Sets/src/mage/cards/d/DeathWatch.java index 281f8ce7635..da387a2010f 100644 --- a/Mage.Sets/src/mage/cards/d/DeathWatch.java +++ b/Mage.Sets/src/mage/cards/d/DeathWatch.java @@ -74,7 +74,7 @@ public final class DeathWatch extends CardImpl { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.gainLife(creature.getToughness().getValue(), game, source); - opponent.loseLife(creature.getPower().getValue(), game, false); + opponent.loseLife(creature.getPower().getValue(), game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DeathbringerLiege.java b/Mage.Sets/src/mage/cards/d/DeathbringerLiege.java index bdbefd59e26..4da8c0d6b64 100644 --- a/Mage.Sets/src/mage/cards/d/DeathbringerLiege.java +++ b/Mage.Sets/src/mage/cards/d/DeathbringerLiege.java @@ -84,7 +84,7 @@ class DeathbringerLiegeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(targetPointer.getFirst(game, source)); if (p != null && p.isTapped()) { - p.destroy(source.getSourceId(), game, false); + p.destroy(source, game, false); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/Deathrender.java b/Mage.Sets/src/mage/cards/d/Deathrender.java index dec0fe1678d..c5a164b8750 100644 --- a/Mage.Sets/src/mage/cards/d/Deathrender.java +++ b/Mage.Sets/src/mage/cards/d/Deathrender.java @@ -75,7 +75,7 @@ class DeathrenderEffect extends OneShotEffect { Card creatureInHand = game.getCard(target.getFirstTarget()); if (creatureInHand != null) { if (controller.moveCards(creatureInHand, Zone.BATTLEFIELD, source, game)) { - game.getPermanent(creatureInHand.getId()).addAttachment(sourcePermanent.getId(), game); + game.getPermanent(creatureInHand.getId()).addAttachment(sourcePermanent.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DeathsPresence.java b/Mage.Sets/src/mage/cards/d/DeathsPresence.java index 0d69324a1cf..ad9a72b70c3 100644 --- a/Mage.Sets/src/mage/cards/d/DeathsPresence.java +++ b/Mage.Sets/src/mage/cards/d/DeathsPresence.java @@ -58,7 +58,7 @@ class DeathsPresenceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java b/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java index e3b3a47a015..4298a32abf3 100644 --- a/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java +++ b/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java @@ -59,7 +59,7 @@ class DebtToTheDeathlessEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - lifeLost += opponent.loseLife(xValue * 2, game, false); + lifeLost += opponent.loseLife(xValue * 2, game, source, false); } } controller.gainLife(lifeLost, game, source); diff --git a/Mage.Sets/src/mage/cards/d/DecayingSoil.java b/Mage.Sets/src/mage/cards/d/DecayingSoil.java index 506ff1df531..06108334b0b 100644 --- a/Mage.Sets/src/mage/cards/d/DecayingSoil.java +++ b/Mage.Sets/src/mage/cards/d/DecayingSoil.java @@ -92,7 +92,7 @@ class DecayingSoilTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -142,13 +142,13 @@ class DecayingSoilEffect extends OneShotEffect { if (player != null) { if (player.chooseUse(Outcome.Benefit, " - Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { UUID target = this.getTargetPointer().getFirst(game, source); if (target != null) { Card card = game.getCard(target); // check if it's still in graveyard if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DeceiverOfForm.java b/Mage.Sets/src/mage/cards/d/DeceiverOfForm.java index d11d20163ec..9dabddba17f 100644 --- a/Mage.Sets/src/mage/cards/d/DeceiverOfForm.java +++ b/Mage.Sets/src/mage/cards/d/DeceiverOfForm.java @@ -88,7 +88,7 @@ class DeceiverOfFormEffect extends OneShotEffect { } } if (controller.chooseUse(outcome, "Move " + copyFromCard.getLogName() + " to the bottom of your library?", source, game)) { - controller.moveCardToLibraryWithInfo(copyFromCard, source.getSourceId(), game, Zone.LIBRARY, false, true); + controller.moveCardToLibraryWithInfo(copyFromCard, source, game, Zone.LIBRARY, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DeclarationInStone.java b/Mage.Sets/src/mage/cards/d/DeclarationInStone.java index c7edeb0cca7..fbe26e91d70 100644 --- a/Mage.Sets/src/mage/cards/d/DeclarationInStone.java +++ b/Mage.Sets/src/mage/cards/d/DeclarationInStone.java @@ -90,7 +90,7 @@ class DeclarationInStoneEffect extends OneShotEffect { controller.moveCards(cardsToExile, Zone.EXILED, source, game); game.getState().processAction(game); if (nonTokenCount > 0) { - new ClueArtifactToken().putOntoBattlefield(nonTokenCount, game, source.getSourceId(), targetPermanent.getControllerId(), false, false); + new ClueArtifactToken().putOntoBattlefield(nonTokenCount, game, source, targetPermanent.getControllerId(), false, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DecoyGambit.java b/Mage.Sets/src/mage/cards/d/DecoyGambit.java index d2385583793..b888d1f2ccd 100644 --- a/Mage.Sets/src/mage/cards/d/DecoyGambit.java +++ b/Mage.Sets/src/mage/cards/d/DecoyGambit.java @@ -124,11 +124,11 @@ class DecoyGambitEffect extends OneShotEffect { the choices made before them. After all choices are made, you draw the appropriate number of cards. After you’ve drawn, the appropriate creatures are all simultaneously returned to their owners’ hands. */ - controller.drawCards(numberOfCardsToDraw, source.getSourceId(), game); + controller.drawCards(numberOfCardsToDraw, source, game); for (Permanent creature : permanentToHand) { if (creature != null && new DecoyGambitCondition(creature).apply(game, source)) { // same controller required - creature.moveToZone(Zone.HAND, source.getSourceId(), game, false); + creature.moveToZone(Zone.HAND, source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DecreeOfAnnihilation.java b/Mage.Sets/src/mage/cards/d/DecreeOfAnnihilation.java index 16f133ac86a..852c6cd7ef1 100644 --- a/Mage.Sets/src/mage/cards/d/DecreeOfAnnihilation.java +++ b/Mage.Sets/src/mage/cards/d/DecreeOfAnnihilation.java @@ -78,7 +78,7 @@ class DecreeOfAnnihilationEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.moveToExile(null, "", source.getSourceId(), game); + permanent.moveToExile(null, "", source, game); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); @@ -86,13 +86,13 @@ class DecreeOfAnnihilationEffect extends OneShotEffect { for (UUID cid : player.getHand().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(null, null, source.getSourceId(), game); + c.moveToExile(null, null, source, game); } } for (UUID cid : player.getGraveyard().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(null, null, source.getSourceId(), game); + c.moveToExile(null, null, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java index 6255aa4521e..e9afaf4ec4c 100644 --- a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java +++ b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java @@ -72,7 +72,7 @@ class DecreeOfJusticeCycleEffect extends OneShotEffect { } int payCount = ManaUtil.playerPaysXGenericMana(true, "Decree of Justice", player, source, game); if (payCount > 0) { - return new SoldierToken().putOntoBattlefield(payCount, game, source.getSourceId(), source.getControllerId()); + return new SoldierToken().putOntoBattlefield(payCount, game, source, source.getControllerId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/DecreeOfPain.java b/Mage.Sets/src/mage/cards/d/DecreeOfPain.java index 1930d1889f4..15f1a8b0da4 100644 --- a/Mage.Sets/src/mage/cards/d/DecreeOfPain.java +++ b/Mage.Sets/src/mage/cards/d/DecreeOfPain.java @@ -68,12 +68,12 @@ class DecreeOfPainEffect extends OneShotEffect { if (controller != null) { int destroyedCreature = 0; for (Permanent creature : game.getState().getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game)) { - if (creature.destroy(source.getSourceId(), game, true)) { + if (creature.destroy(source, game, true)) { destroyedCreature++; } } if (destroyedCreature > 0) { - controller.drawCards(destroyedCreature, source.getSourceId(), game); + controller.drawCards(destroyedCreature, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DeepWater.java b/Mage.Sets/src/mage/cards/d/DeepWater.java index fc41ee608b8..2f6abe18758 100644 --- a/Mage.Sets/src/mage/cards/d/DeepWater.java +++ b/Mage.Sets/src/mage/cards/d/DeepWater.java @@ -78,15 +78,14 @@ class DeepWaterReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); - if (mageObject != null && mageObject.isLand()) { - Permanent land = game.getPermanent(event.getSourceId()); - return land != null && filter.match(land, game); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null && permanent.isLand()) { + return filter.match(permanent, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/DeepfathomSkulker.java b/Mage.Sets/src/mage/cards/d/DeepfathomSkulker.java index d251e952760..bf9adc32962 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfathomSkulker.java +++ b/Mage.Sets/src/mage/cards/d/DeepfathomSkulker.java @@ -73,7 +73,7 @@ class DeepfathomSkulkerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DefiantBloodlord.java b/Mage.Sets/src/mage/cards/d/DefiantBloodlord.java index bf364d9a8a9..cc529f01c07 100644 --- a/Mage.Sets/src/mage/cards/d/DefiantBloodlord.java +++ b/Mage.Sets/src/mage/cards/d/DefiantBloodlord.java @@ -64,7 +64,7 @@ class DefiantBloodlordTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DefiantVanguard.java b/Mage.Sets/src/mage/cards/d/DefiantVanguard.java index b6366edcc61..9ad425d6956 100644 --- a/Mage.Sets/src/mage/cards/d/DefiantVanguard.java +++ b/Mage.Sets/src/mage/cards/d/DefiantVanguard.java @@ -91,7 +91,7 @@ class DefiantVanguardTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED && event.getSourceId().equals(getSourceId()); // Defiant Vanguard is the blocker } @@ -133,13 +133,13 @@ class DefiantVanguardEffect extends OneShotEffect { Permanent defiantVanguard = game.getPermanent(source.getSourceId()); if (blockedCreature != null) { if (game.getState().getValue(blockedCreature.toString()).equals(blockedCreature.getZoneChangeCounter(game))) { // true if it did not change zones - blockedCreature.destroy(source.getSourceId(), game, false); + blockedCreature.destroy(source, game, false); result = true; } } if (defiantVanguard != null) { if (game.getState().getValue(defiantVanguard.toString()).equals(defiantVanguard.getZoneChangeCounter(game))) { // true if it did not change zones - defiantVanguard.destroy(source.getSourceId(), game, false); + defiantVanguard.destroy(source, game, false); result = true; } } diff --git a/Mage.Sets/src/mage/cards/d/DefilerOfSouls.java b/Mage.Sets/src/mage/cards/d/DefilerOfSouls.java index 2e1f05f99d6..e157841250a 100644 --- a/Mage.Sets/src/mage/cards/d/DefilerOfSouls.java +++ b/Mage.Sets/src/mage/cards/d/DefilerOfSouls.java @@ -85,7 +85,7 @@ class DefilerOfSoulsEffect extends OneShotEffect { //had, if thats the case this ability should fizzle. if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) { boolean abilityApplied = false; - while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } @@ -93,7 +93,7 @@ class DefilerOfSoulsEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getTargets().get(idx)); if ( permanent != null ) { - abilityApplied |= permanent.sacrifice(source.getSourceId(), game); + abilityApplied |= permanent.sacrifice(source, game); } } diff --git a/Mage.Sets/src/mage/cards/d/DeflectingPalm.java b/Mage.Sets/src/mage/cards/d/DeflectingPalm.java index f27994dd107..c697331f27d 100644 --- a/Mage.Sets/src/mage/cards/d/DeflectingPalm.java +++ b/Mage.Sets/src/mage/cards/d/DeflectingPalm.java @@ -84,7 +84,7 @@ class DeflectingPalmEffect extends PreventionEffectImpl { if (objectControllerId != null) { Player objectController = game.getPlayer(objectControllerId); if (objectController != null) { - objectController.damage(preventionData.getPreventedDamage(), source.getSourceId(), game); + objectController.damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/Deicide.java b/Mage.Sets/src/mage/cards/d/Deicide.java index a1fa7e38556..d3cc6e48f56 100644 --- a/Mage.Sets/src/mage/cards/d/Deicide.java +++ b/Mage.Sets/src/mage/cards/d/Deicide.java @@ -60,7 +60,7 @@ class DeicideExileEffect extends SearchTargetGraveyardHandLibraryForCardNameAndE if (controller != null && sourceCard != null) { Permanent targetEnchantment = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetEnchantment != null) { - controller.moveCardToExileWithInfo(targetEnchantment, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(targetEnchantment, null, "", source, game, Zone.BATTLEFIELD, true); // 4/26/2014 // Deicide looks at the card in exile, not the permanent that was exiled, to determine // if it is a God. For each of the Gods in the Theros block, it won't matter what your diff --git a/Mage.Sets/src/mage/cards/d/Delay.java b/Mage.Sets/src/mage/cards/d/Delay.java index 59737158f27..9e2a5daa17c 100644 --- a/Mage.Sets/src/mage/cards/d/Delay.java +++ b/Mage.Sets/src/mage/cards/d/Delay.java @@ -71,7 +71,7 @@ class DelayEffect extends OneShotEffect { if (card != null && effect.apply(game, source) && game.getState().getZone(card.getId()) == Zone.EXILED) { boolean hasSuspend = card.getAbilities(game).containsClass(SuspendAbility.class); UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); - if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getLogName(), source.getSourceId(), game, Zone.HAND, true)) { + if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getLogName(), source, game, Zone.HAND, true)) { card.addCounters(CounterType.TIME.createInstance(3), source, game); if (!hasSuspend) { game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source); diff --git a/Mage.Sets/src/mage/cards/d/DelayingShield.java b/Mage.Sets/src/mage/cards/d/DelayingShield.java index 58200955e4c..976ef524aaf 100644 --- a/Mage.Sets/src/mage/cards/d/DelayingShield.java +++ b/Mage.Sets/src/mage/cards/d/DelayingShield.java @@ -68,7 +68,7 @@ class DelayingShieldReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override @@ -104,11 +104,11 @@ class DelayingShieldUpkeepEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { int numCounters = permanent.getCounters(game).getCount(CounterType.DELAY); - permanent.removeCounters(CounterType.DELAY.createInstance(numCounters), game); + permanent.removeCounters(CounterType.DELAY.createInstance(numCounters), source, game); for (int i = numCounters; i > 0; i--) { if (controller.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) { Cost cost = new ManaCostsImpl<>("{1}{W}"); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { continue; } } diff --git a/Mage.Sets/src/mage/cards/d/Delirium.java b/Mage.Sets/src/mage/cards/d/Delirium.java index 4bf991de468..0a4458ac8b3 100644 --- a/Mage.Sets/src/mage/cards/d/Delirium.java +++ b/Mage.Sets/src/mage/cards/d/Delirium.java @@ -74,7 +74,7 @@ class DeliriumEffect extends OneShotEffect { int amount = creature.getPower().getValue(); Player controller = game.getPlayer(creature.getControllerId()); if (controller != null) { - controller.damage(amount, creature.getId(), game); + controller.damage(amount, creature.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DementiaSliver.java b/Mage.Sets/src/mage/cards/d/DementiaSliver.java index f3a971608dd..8aacfe6b5b2 100644 --- a/Mage.Sets/src/mage/cards/d/DementiaSliver.java +++ b/Mage.Sets/src/mage/cards/d/DementiaSliver.java @@ -87,7 +87,7 @@ class DementiaSliverEffect extends OneShotEffect { revealed.add(card); opponent.revealCards(sourceObject.getName(), revealed, game); if (CardUtil.haveSameNames(card, cardName, game)) { - opponent.discard(card, source, game); + opponent.discard(card, false, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DemonicHordes.java b/Mage.Sets/src/mage/cards/d/DemonicHordes.java index 18b9c39cee5..7aa21b5c2db 100644 --- a/Mage.Sets/src/mage/cards/d/DemonicHordes.java +++ b/Mage.Sets/src/mage/cards/d/DemonicHordes.java @@ -86,11 +86,11 @@ class DemonicHordesEffect extends OneShotEffect { } if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } - demonicHordes.tap(game); + demonicHordes.tap(source, game); Target choiceOpponent = new TargetOpponent(); choiceOpponent.setNotTarget(true); FilterLandPermanent filterLand = new FilterLandPermanent(); @@ -103,7 +103,7 @@ class DemonicHordesEffect extends OneShotEffect { if (opponent.chooseTarget(Outcome.Sacrifice, chosenLand, source, game)) { Permanent land = game.getPermanent(chosenLand.getFirstTarget()); if (land != null) { - land.sacrifice(source.getSourceId(), game); + land.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DemonlordBelzenlok.java b/Mage.Sets/src/mage/cards/d/DemonlordBelzenlok.java index 39c97445def..17144820bcc 100644 --- a/Mage.Sets/src/mage/cards/d/DemonlordBelzenlok.java +++ b/Mage.Sets/src/mage/cards/d/DemonlordBelzenlok.java @@ -85,7 +85,7 @@ class DemonlordBelzenlokEffect extends OneShotEffect { } } } - controller.damage(addedToHand, source.getSourceId(), game); + controller.damage(addedToHand, source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/d/Denied.java b/Mage.Sets/src/mage/cards/d/Denied.java index b8d60aec7af..996eb44dc04 100644 --- a/Mage.Sets/src/mage/cards/d/Denied.java +++ b/Mage.Sets/src/mage/cards/d/Denied.java @@ -63,7 +63,7 @@ class DeniedEffect extends OneShotEffect { player.revealCards("Denied!", player.getHand(), game, true); for (Card card : player.getHand().getCards(game)) { if (card != null && CardUtil.haveSameNames(card, cardName, game)) { - game.getStack().counter(targetSpell.getId(), source.getSourceId(), game); + game.getStack().counter(targetSpell.getId(), source, game); break; } } diff --git a/Mage.Sets/src/mage/cards/d/DenyingWind.java b/Mage.Sets/src/mage/cards/d/DenyingWind.java index 9830baaae63..ac7e7e1947b 100644 --- a/Mage.Sets/src/mage/cards/d/DenyingWind.java +++ b/Mage.Sets/src/mage/cards/d/DenyingWind.java @@ -68,7 +68,7 @@ class DenyingWindEffect extends OneShotEffect { for (UUID targetId : targets) { Card card = player.getLibrary().remove(targetId, game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, null, source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/d/DepalaPilotExemplar.java b/Mage.Sets/src/mage/cards/d/DepalaPilotExemplar.java index acdc3e57507..17f740d38f1 100644 --- a/Mage.Sets/src/mage/cards/d/DepalaPilotExemplar.java +++ b/Mage.Sets/src/mage/cards/d/DepalaPilotExemplar.java @@ -88,7 +88,7 @@ class DepalaPilotExemplarEffect extends OneShotEffect { ManaCosts cost = new ManaCostsImpl<>("{X}"); int xValue = controller.announceXMana(0, Integer.MAX_VALUE, "Choose the amount of mana to pay", game, source); cost.add(new GenericManaCost(xValue)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false) && xValue > 0) { + if (cost.pay(source, game, source, source.getControllerId(), false) && xValue > 0) { new RevealLibraryPutIntoHandEffect(xValue, filter, Zone.LIBRARY, false).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/d/DereviEmpyrialTactician.java b/Mage.Sets/src/mage/cards/d/DereviEmpyrialTactician.java index 859edb0f641..6b65516ac8a 100644 --- a/Mage.Sets/src/mage/cards/d/DereviEmpyrialTactician.java +++ b/Mage.Sets/src/mage/cards/d/DereviEmpyrialTactician.java @@ -75,8 +75,8 @@ class DereviEmpyrialTacticianTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD - || event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java b/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java index 7c0697f34bd..329da5dccfd 100644 --- a/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java +++ b/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java @@ -75,7 +75,7 @@ class DescendantOfMasumaroEffect extends OneShotEffect { } Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetOpponent != null && !targetOpponent.getHand().isEmpty()) { - sourcePermanent.removeCounters(CounterType.P1P1.getName(), targetOpponent.getHand().size(), game); + sourcePermanent.removeCounters(CounterType.P1P1.getName(), targetOpponent.getHand().size(), source, game); game.informPlayers(controller.getLogName() + " removes " + targetOpponent.getHand().size() + " +1/+1 counters from " + sourcePermanent.getLogName()); } return true; diff --git a/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java b/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java index da95405944b..ae2ee3aea91 100644 --- a/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java +++ b/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java @@ -112,7 +112,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + player.moveCardToExileWithInfo(permanent, null, "", source, game, Zone.BATTLEFIELD, true); } } } else if (game.getState().getZone(objectId) == Zone.HAND) { @@ -120,7 +120,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { if (card != null) { Player player = game.getPlayer(card.getOwnerId()); if (player != null) { - player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true); + player.moveCardToExileWithInfo(card, null, "", source, game, Zone.HAND, true); } } } @@ -149,7 +149,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { filter.add(Predicates.not(Predicates.or(uuidPredicates))); target = new TargetControlledPermanent(0, 1, filter, true); - if (target.canChoose(player.getId(), game) + if (target.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.Exile, target, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { if (!selectedObjects.contains(targetId)) { @@ -174,7 +174,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { uuidPredicates.add(new CardIdPredicate(uuid)); } filterInHand.add(Predicates.not(Predicates.or(uuidPredicates))); - if (targetInHand.canChoose(player.getId(), game) && + if (targetInHand.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.Exile, player.getHand(), targetInHand, game)) { Card card = player.getHand().get(targetInHand.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/d/DescentOfTheDragons.java b/Mage.Sets/src/mage/cards/d/DescentOfTheDragons.java index 52ebc06776e..dd514840470 100644 --- a/Mage.Sets/src/mage/cards/d/DescentOfTheDragons.java +++ b/Mage.Sets/src/mage/cards/d/DescentOfTheDragons.java @@ -68,7 +68,7 @@ class DescentOfTheDragonsEffect extends OneShotEffect { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { UUID controllerOfTargetId = permanent.getControllerId(); - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { int count = playersWithTargets.getOrDefault(controllerOfTargetId, 0); playersWithTargets.put(controllerOfTargetId, count + 1); @@ -78,7 +78,7 @@ class DescentOfTheDragonsEffect extends OneShotEffect { } DragonToken dragonToken = new DragonToken(); for (Map.Entry amountTokensPerPlayer : playersWithTargets.entrySet()) { - dragonToken.putOntoBattlefield(amountTokensPerPlayer.getValue(), game, source.getSourceId(), amountTokensPerPlayer.getKey()); + dragonToken.putOntoBattlefield(amountTokensPerPlayer.getValue(), game, source, amountTokensPerPlayer.getKey()); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DesecratedEarth.java b/Mage.Sets/src/mage/cards/d/DesecratedEarth.java index 0ffa9945980..ff857f98cb1 100644 --- a/Mage.Sets/src/mage/cards/d/DesecratedEarth.java +++ b/Mage.Sets/src/mage/cards/d/DesecratedEarth.java @@ -62,7 +62,7 @@ class DesecratedEarthEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.discard(1, false, source, game); + player.discard(1, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DesecrationDemon.java b/Mage.Sets/src/mage/cards/d/DesecrationDemon.java index 6ae3b03d1a4..4b158d47ee4 100644 --- a/Mage.Sets/src/mage/cards/d/DesecrationDemon.java +++ b/Mage.Sets/src/mage/cards/d/DesecrationDemon.java @@ -73,15 +73,15 @@ class DesecrationDemonEffect extends OneShotEffect { filter.add(CardType.CREATURE.getPredicate()); filter.add(TargetController.YOU.getControllerPredicate()); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false); - if (target.canChoose(opponent.getId(), game)) { + if (target.canChoose(source.getSourceId(), opponent.getId(), game)) { if (opponent.chooseUse(Outcome.AIDontUseIt, "Sacrifice a creature to tap " + descrationDemon.getLogName() + "and put a +1/+1 counter on it?", source, game)) { opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); game.informPlayers(opponent.getLogName() + " sacrifices " + permanent.getLogName() + " to tap " + descrationDemon.getLogName() + ". A +1/+1 counter was put on it"); - descrationDemon.tap(game); + descrationDemon.tap(source, game); descrationDemon.addCounters(CounterType.P1P1.createInstance(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/d/Desolation.java b/Mage.Sets/src/mage/cards/d/Desolation.java index 55447a30abe..7679588484c 100644 --- a/Mage.Sets/src/mage/cards/d/Desolation.java +++ b/Mage.Sets/src/mage/cards/d/Desolation.java @@ -71,13 +71,13 @@ class DesolationEffect extends OneShotEffect { filter.add(CardType.LAND.getPredicate()); filter.add(new ControllerIdPredicate(playerId)); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); if (filterPlains.match(permanent, game)) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } } } @@ -112,7 +112,7 @@ class DesolationWatcher extends Watcher { && !game.inCheckPlayableState()) { // Ignored - see GameEvent.TAPPED_FOR_MANA UUID playerId = event.getPlayerId(); if (playerId != null) { - Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); // need only info about permanent if (permanent != null && permanent.isLand()) { tappedForManaThisTurnPlayers.add(playerId); } diff --git a/Mage.Sets/src/mage/cards/d/DesolationTwin.java b/Mage.Sets/src/mage/cards/d/DesolationTwin.java index 9a2baad2d5f..d8a118a3eeb 100644 --- a/Mage.Sets/src/mage/cards/d/DesolationTwin.java +++ b/Mage.Sets/src/mage/cards/d/DesolationTwin.java @@ -54,7 +54,7 @@ class DesolationTwinOnCastAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DesperateRavings.java b/Mage.Sets/src/mage/cards/d/DesperateRavings.java index bcafe7eb9f5..42c65847079 100644 --- a/Mage.Sets/src/mage/cards/d/DesperateRavings.java +++ b/Mage.Sets/src/mage/cards/d/DesperateRavings.java @@ -62,10 +62,10 @@ class DesperateRavingsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); Cards hand = player.getHand(); Card card = hand.getRandom(game); - player.discard(card, source, game); + player.discard(card, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/DestructiveRevelry.java b/Mage.Sets/src/mage/cards/d/DestructiveRevelry.java index 1a53f9bc703..a43131cf2a3 100644 --- a/Mage.Sets/src/mage/cards/d/DestructiveRevelry.java +++ b/Mage.Sets/src/mage/cards/d/DestructiveRevelry.java @@ -59,10 +59,10 @@ class DestructiveRevelryEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); Player permController = game.getPlayer(permanent.getControllerId()); if (permController != null) { - permController.damage(2, source.getSourceId(), game); + permController.damage(2, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DetentionSphere.java b/Mage.Sets/src/mage/cards/d/DetentionSphere.java index c7a99d41a55..a25a84eea67 100644 --- a/Mage.Sets/src/mage/cards/d/DetentionSphere.java +++ b/Mage.Sets/src/mage/cards/d/DetentionSphere.java @@ -81,12 +81,12 @@ class DetentionSphereEntersEffect extends OneShotEffect { if (sourceObject != null && exileId != null && targetPermanent != null && controller != null) { if (CardUtil.haveEmptyName(targetPermanent)) { // face down creature - controller.moveCardToExileWithInfo(targetPermanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(targetPermanent, exileId, sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true); } else { String name = targetPermanent.getName(); for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (permanent != null && CardUtil.haveSameNames(permanent, name, game)) { - controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true); } } } diff --git a/Mage.Sets/src/mage/cards/d/Detritivore.java b/Mage.Sets/src/mage/cards/d/Detritivore.java index 4eb96e2ad7b..0545ba5f487 100644 --- a/Mage.Sets/src/mage/cards/d/Detritivore.java +++ b/Mage.Sets/src/mage/cards/d/Detritivore.java @@ -80,7 +80,7 @@ class DetritivoreTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DeusOfCalamity.java b/Mage.Sets/src/mage/cards/d/DeusOfCalamity.java index cf2fe152f5d..bfb5bcd3810 100644 --- a/Mage.Sets/src/mage/cards/d/DeusOfCalamity.java +++ b/Mage.Sets/src/mage/cards/d/DeusOfCalamity.java @@ -66,7 +66,7 @@ class DeusOfCalamityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DevastatingSummons.java b/Mage.Sets/src/mage/cards/d/DevastatingSummons.java index c5521add77c..f08dd4eed20 100644 --- a/Mage.Sets/src/mage/cards/d/DevastatingSummons.java +++ b/Mage.Sets/src/mage/cards/d/DevastatingSummons.java @@ -58,7 +58,7 @@ class DevastatingSummonsEffect extends OneShotEffect { token.getPower().modifyBaseValue(GetXValue.instance.calculate(game, source, this)); token.getToughness().modifyBaseValue(GetXValue.instance.calculate(game, source, this)); - token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(2, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/d/DevourFlesh.java b/Mage.Sets/src/mage/cards/d/DevourFlesh.java index c8b64b60045..976fac2d95f 100644 --- a/Mage.Sets/src/mage/cards/d/DevourFlesh.java +++ b/Mage.Sets/src/mage/cards/d/DevourFlesh.java @@ -66,13 +66,13 @@ class DevourFleshSacrificeEffect extends OneShotEffect { int realCount = game.getBattlefield().countAll(filter, player.getId(), game); if (realCount > 0) { Target target = new TargetControlledPermanent(1, 1, filter, true); - while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { int gainLife = permanent.getToughness().getValue(); - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); game.getState().processAction(game); player.gainLife(gainLife, game, source); } else { diff --git a/Mage.Sets/src/mage/cards/d/DevourInShadow.java b/Mage.Sets/src/mage/cards/d/DevourInShadow.java index db3c330200b..0ed3abe92ef 100644 --- a/Mage.Sets/src/mage/cards/d/DevourInShadow.java +++ b/Mage.Sets/src/mage/cards/d/DevourInShadow.java @@ -63,7 +63,7 @@ class DevourInShadowEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent target = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (player != null && target != null) { - player.loseLife(target.getToughness().getValue(), game, false); + player.loseLife(target.getToughness().getValue(), game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/DevouringGreed.java b/Mage.Sets/src/mage/cards/d/DevouringGreed.java index fe89bdca48c..f11f6c38fb4 100644 --- a/Mage.Sets/src/mage/cards/d/DevouringGreed.java +++ b/Mage.Sets/src/mage/cards/d/DevouringGreed.java @@ -81,7 +81,7 @@ class DevouringGreedEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); Player sourcePlayer = game.getPlayer(source.getControllerId()); if (targetPlayer != null && sourcePlayer != null) { - targetPlayer.loseLife(amount, game, false); + targetPlayer.loseLife(amount, game, source, false); sourcePlayer.gainLife(amount, game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/d/DevouringHellion.java b/Mage.Sets/src/mage/cards/d/DevouringHellion.java index 3cd85e186d4..fe3be168fad 100644 --- a/Mage.Sets/src/mage/cards/d/DevouringHellion.java +++ b/Mage.Sets/src/mage/cards/d/DevouringHellion.java @@ -87,7 +87,7 @@ class DevouringHellionEffect extends OneShotEffect { int xValue = 0; for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { xValue++; } } diff --git a/Mage.Sets/src/mage/cards/d/DevoutInvocation.java b/Mage.Sets/src/mage/cards/d/DevoutInvocation.java index ea6d47b2c79..143b7d4c5ad 100644 --- a/Mage.Sets/src/mage/cards/d/DevoutInvocation.java +++ b/Mage.Sets/src/mage/cards/d/DevoutInvocation.java @@ -66,16 +66,16 @@ class DevoutInvocationEffect extends OneShotEffect { if (controller != null) { int tappedAmount = 0; TargetPermanent target = new TargetPermanent(0, 1, filter, false); - while (true && controller.canRespond()) { + while (controller.canRespond()) { target.clearChosen(); - if (target.canChoose(source.getControllerId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { - game.getPermanent(creature).tap(game); + game.getPermanent(creature).tap(source, game); tappedAmount++; } } else { @@ -87,7 +87,7 @@ class DevoutInvocationEffect extends OneShotEffect { } if (tappedAmount > 0) { AngelToken angelToken = new AngelToken(); - angelToken.putOntoBattlefield(tappedAmount, game, source.getSourceId(), source.getControllerId()); + angelToken.putOntoBattlefield(tappedAmount, game, source, source.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DiabolicRevelation.java b/Mage.Sets/src/mage/cards/d/DiabolicRevelation.java index 40b7ec33796..e114c09ffbd 100644 --- a/Mage.Sets/src/mage/cards/d/DiabolicRevelation.java +++ b/Mage.Sets/src/mage/cards/d/DiabolicRevelation.java @@ -70,7 +70,7 @@ class DiabolicRevelationEffect extends OneShotEffect { for (UUID cardId : target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/d/DiabolicServitude.java b/Mage.Sets/src/mage/cards/d/DiabolicServitude.java index c67080b15f2..c5029eac900 100644 --- a/Mage.Sets/src/mage/cards/d/DiabolicServitude.java +++ b/Mage.Sets/src/mage/cards/d/DiabolicServitude.java @@ -106,7 +106,7 @@ class DiabolicServitudeCreatureDiesTriggeredAbility extends TriggeredAbilityImpl @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java b/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java index cc3b7dea5f6..b79ddd7ceec 100644 --- a/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java +++ b/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java @@ -71,12 +71,12 @@ class DiaochanArtfulBeautyDestroyEffect extends OneShotEffect { if (controller != null) { Permanent firstTarget = game.getPermanent(source.getFirstTarget()); if (firstTarget != null) { - firstTarget.destroy(source.getSourceId(), game, false); + firstTarget.destroy(source, game, false); } Permanent secondTarget = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (secondTarget != null) { - secondTarget.destroy(source.getSourceId(), game, false); + secondTarget.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DictateOfKruphix.java b/Mage.Sets/src/mage/cards/d/DictateOfKruphix.java index e3b66c570dc..f38d06deeee 100644 --- a/Mage.Sets/src/mage/cards/d/DictateOfKruphix.java +++ b/Mage.Sets/src/mage/cards/d/DictateOfKruphix.java @@ -57,7 +57,7 @@ class DictateOfKruphixAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_STEP_PRE; + return event.getType() == GameEvent.EventType.DRAW_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DictateOfTheTwinGods.java b/Mage.Sets/src/mage/cards/d/DictateOfTheTwinGods.java index 3746bd2b6f4..20111b82a37 100644 --- a/Mage.Sets/src/mage/cards/d/DictateOfTheTwinGods.java +++ b/Mage.Sets/src/mage/cards/d/DictateOfTheTwinGods.java @@ -87,16 +87,16 @@ class DictateOfTheTwinGodsEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { DamageEvent damageEvent = (DamageEvent) event; - if (damageEvent.getType() == EventType.DAMAGE_PLAYER) { + if (damageEvent.getType() == GameEvent.EventType.DAMAGE_PLAYER) { Player targetPlayer = game.getPlayer(event.getTargetId()); if (targetPlayer != null) { - targetPlayer.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), damageEvent.getAmount()), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + targetPlayer.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), damageEvent.getAmount()), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); return true; } } else { Permanent targetPermanent = game.getPermanent(event.getTargetId()); if (targetPermanent != null) { - targetPermanent.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), damageEvent.getAmount()), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + targetPermanent.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), damageEvent.getAmount()), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DieYoung.java b/Mage.Sets/src/mage/cards/d/DieYoung.java index 198b5fd8a3f..73db6423369 100644 --- a/Mage.Sets/src/mage/cards/d/DieYoung.java +++ b/Mage.Sets/src/mage/cards/d/DieYoung.java @@ -70,7 +70,7 @@ class DieYoungEffect extends OneShotEffect { int numberToPayed = controller.getAmount(0, max, "How many energy counters do you like to pay? (maximum = " + max + ')', game); if (numberToPayed > 0) { Cost cost = new PayEnergyCost(numberToPayed); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (cost.pay(source, game, source, source.getControllerId(), true)) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { numberToPayed *= -1; diff --git a/Mage.Sets/src/mage/cards/d/DiffusionSliver.java b/Mage.Sets/src/mage/cards/d/DiffusionSliver.java index 07fe7b000ca..80fced50b9f 100644 --- a/Mage.Sets/src/mage/cards/d/DiffusionSliver.java +++ b/Mage.Sets/src/mage/cards/d/DiffusionSliver.java @@ -65,7 +65,7 @@ class DiffusionSliverTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java b/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java index 16f99d9ca78..e40fb37c111 100644 --- a/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java +++ b/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java @@ -152,20 +152,13 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Card card = game.getCard(getTargetPointer().getFirst(game, source)); - if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); - return true; - } - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DimensionalBreach.java b/Mage.Sets/src/mage/cards/d/DimensionalBreach.java index 51defb36128..4d262ff5cfa 100644 --- a/Mage.Sets/src/mage/cards/d/DimensionalBreach.java +++ b/Mage.Sets/src/mage/cards/d/DimensionalBreach.java @@ -73,7 +73,7 @@ class DimensionalBreachExileEffect extends OneShotEffect { UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), 0); if (exileId != null) { game.getBattlefield().getAllActivePermanents().forEach((permanent) -> { - permanent.moveToExile(exileId, sourceObject.getName(), source.getSourceId(), game); + permanent.moveToExile(exileId, sourceObject.getName(), source, game); }); return true; } diff --git a/Mage.Sets/src/mage/cards/d/DimensionalInfiltrator.java b/Mage.Sets/src/mage/cards/d/DimensionalInfiltrator.java index bdbe57cb934..5be3977e260 100644 --- a/Mage.Sets/src/mage/cards/d/DimensionalInfiltrator.java +++ b/Mage.Sets/src/mage/cards/d/DimensionalInfiltrator.java @@ -88,7 +88,7 @@ class DimensionalInfiltratorEffect extends OneShotEffect { if (opponent.getLibrary().hasCards()) { Card card = opponent.getLibrary().getFromTop(game); if (card != null) { - card.moveToExile(null, "Dimensional Infiltrator", source.getSourceId(), game); + card.moveToExile(null, "Dimensional Infiltrator", source, game); if (card.isLand()) { if (controller.chooseUse(Outcome.Neutral, "Return " + sourceObject.getIdName() + " to its owner's hand?", source, game)) { new ReturnToHandSourceEffect(true).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/d/DiminishingReturns.java b/Mage.Sets/src/mage/cards/d/DiminishingReturns.java index 35bf7086353..0932e6967bd 100644 --- a/Mage.Sets/src/mage/cards/d/DiminishingReturns.java +++ b/Mage.Sets/src/mage/cards/d/DiminishingReturns.java @@ -57,8 +57,8 @@ class DiminishingReturnsEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(player.getAmount(0, 7, "How many cards to draw (up to 7)?", game), - source.getSourceId(), game); + int amount = player.getAmount(0, 7, "How many cards to draw (up to 7)?", game); + player.drawCards(amount, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DimirCutpurse.java b/Mage.Sets/src/mage/cards/d/DimirCutpurse.java index 07f119e1db9..17c3ace3ac3 100644 --- a/Mage.Sets/src/mage/cards/d/DimirCutpurse.java +++ b/Mage.Sets/src/mage/cards/d/DimirCutpurse.java @@ -56,10 +56,10 @@ class DimirCutpurseEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (damagedPlayer != null) { - damagedPlayer.discard(1, false,source, game); + damagedPlayer.discard(1, false, false, source, game); } if (you != null) { - you.drawCards(1, source.getSourceId(), game); + you.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DinOfTheFireherd.java b/Mage.Sets/src/mage/cards/d/DinOfTheFireherd.java index 16a9c07aebf..9bb10c6d662 100644 --- a/Mage.Sets/src/mage/cards/d/DinOfTheFireherd.java +++ b/Mage.Sets/src/mage/cards/d/DinOfTheFireherd.java @@ -73,7 +73,7 @@ class DinOfTheFireherdEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { boolean applied; Token token = new DinOfTheFireherdToken(); - applied = token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + applied = token.putOntoBattlefield(1, game, source, source.getControllerId()); int blackCreaturesControllerControls = game.getBattlefield().countAll(blackCreatureFilter, source.getControllerId(), game); int redCreaturesControllerControls = game.getBattlefield().countAll(redCreatureFilter, source.getControllerId(), game); diff --git a/Mage.Sets/src/mage/cards/d/DingusEgg.java b/Mage.Sets/src/mage/cards/d/DingusEgg.java index cb2bed2f3be..6bbc2342f1b 100644 --- a/Mage.Sets/src/mage/cards/d/DingusEgg.java +++ b/Mage.Sets/src/mage/cards/d/DingusEgg.java @@ -50,7 +50,7 @@ class DingusEggTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DingusStaff.java b/Mage.Sets/src/mage/cards/d/DingusStaff.java index 90e63d3803a..587f4584320 100644 --- a/Mage.Sets/src/mage/cards/d/DingusStaff.java +++ b/Mage.Sets/src/mage/cards/d/DingusStaff.java @@ -58,7 +58,7 @@ class DingusStaffEffect extends OneShotEffect { if (permanent != null) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { - controller.damage(2, source.getSourceId(), game); + controller.damage(2, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DinrovaHorror.java b/Mage.Sets/src/mage/cards/d/DinrovaHorror.java index 639b15ba4d6..399519295c5 100644 --- a/Mage.Sets/src/mage/cards/d/DinrovaHorror.java +++ b/Mage.Sets/src/mage/cards/d/DinrovaHorror.java @@ -70,7 +70,7 @@ class DinrovaHorrorEffect extends OneShotEffect { Player controller = game.getPlayer(target.getControllerId()); if (controller != null) { controller.moveCards(target, Zone.HAND, source, game); - controller.discard(1, false, source, game); + controller.discard(1, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DireFleetDaredevil.java b/Mage.Sets/src/mage/cards/d/DireFleetDaredevil.java index 928949628fe..3e1188e7013 100644 --- a/Mage.Sets/src/mage/cards/d/DireFleetDaredevil.java +++ b/Mage.Sets/src/mage/cards/d/DireFleetDaredevil.java @@ -136,7 +136,7 @@ class DireFleetDaredevilReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DireFleetRavager.java b/Mage.Sets/src/mage/cards/d/DireFleetRavager.java index e1a43727803..15001e0ca83 100644 --- a/Mage.Sets/src/mage/cards/d/DireFleetRavager.java +++ b/Mage.Sets/src/mage/cards/d/DireFleetRavager.java @@ -75,7 +75,7 @@ class DireFleetRavagerEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int lifeToLose = (int) Math.ceil(player.getLife() / 3.0); - player.loseLife(lifeToLose, game, false); + player.loseLife(lifeToLose, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DireTactics.java b/Mage.Sets/src/mage/cards/d/DireTactics.java index b441c376e5c..3934659afb4 100644 --- a/Mage.Sets/src/mage/cards/d/DireTactics.java +++ b/Mage.Sets/src/mage/cards/d/DireTactics.java @@ -68,7 +68,7 @@ class DireTacticsEffect extends OneShotEffect { int toughness = permanent.getToughness().getValue(); player.moveCards(permanent, Zone.EXILED, source, game); if (game.getBattlefield().countAll(filter, player.getId(), game) < 1) { - player.loseLife(toughness, game, false); + player.loseLife(toughness, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DiregrafCaptain.java b/Mage.Sets/src/mage/cards/d/DiregrafCaptain.java index 52ee1b1f960..4daff80f5c5 100644 --- a/Mage.Sets/src/mage/cards/d/DiregrafCaptain.java +++ b/Mage.Sets/src/mage/cards/d/DiregrafCaptain.java @@ -79,7 +79,7 @@ class DiregrafCaptainTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java b/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java index fb402a7a6cc..776e18cb395 100644 --- a/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java +++ b/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java @@ -52,7 +52,7 @@ class DirtcowlWurmTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/d/Disarm.java b/Mage.Sets/src/mage/cards/d/Disarm.java index fb7703d919f..7bbf565192a 100644 --- a/Mage.Sets/src/mage/cards/d/Disarm.java +++ b/Mage.Sets/src/mage/cards/d/Disarm.java @@ -67,7 +67,7 @@ public final class Disarm extends CardImpl { equipmentFilter.add(SubType.EQUIPMENT.getPredicate()); for (Permanent equipment : game.getBattlefield().getAllActivePermanents(equipmentFilter, game)) { - creature.removeAttachment(equipment.getId(), game); + creature.removeAttachment(equipment.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DisasterRadius.java b/Mage.Sets/src/mage/cards/d/DisasterRadius.java index bdcc37c2207..78bddf139ea 100644 --- a/Mage.Sets/src/mage/cards/d/DisasterRadius.java +++ b/Mage.Sets/src/mage/cards/d/DisasterRadius.java @@ -68,7 +68,7 @@ class DisasterRadiusEffect extends OneShotEffect { int damage = cost.convertedManaCosts; for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != null) { - creature.damage(damage, source.getSourceId(), game, false, false); + creature.damage(damage, source.getSourceId(), source, game, false, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java b/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java index 67fd8e63d38..9ef156524cb 100644 --- a/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java +++ b/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java @@ -72,10 +72,10 @@ class DiscipleOfBolasEffect extends OneShotEffect { controller.chooseTarget(outcome, target, source, game); Permanent sacrificed = game.getPermanent(target.getFirstTarget()); if (sacrificed != null) { - sacrificed.sacrifice(source.getSourceId(), game); + sacrificed.sacrifice(source, game); int power = sacrificed.getPower().getValue(); controller.gainLife(power, game, source); - controller.drawCards(power, source.getSourceId(), game); + controller.drawCards(power, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DiscipleOfDeceit.java b/Mage.Sets/src/mage/cards/d/DiscipleOfDeceit.java index 51f1c84f641..cb162ead2fb 100644 --- a/Mage.Sets/src/mage/cards/d/DiscipleOfDeceit.java +++ b/Mage.Sets/src/mage/cards/d/DiscipleOfDeceit.java @@ -77,9 +77,9 @@ class DiscipleOfDeceitEffect extends OneShotEffect { if (player != null && mageObject != null) { Cost cost = new DiscardTargetCost(new TargetCardInHand(new FilterNonlandCard())); String message = "Discard a nonland card to search your library?"; - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) + if (cost.canPay(source, source, source.getControllerId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { Card card = game.getCard(cost.getTargets().getFirstTarget()); if (card == null) { return false; diff --git a/Mage.Sets/src/mage/cards/d/DiscipleOfPhenax.java b/Mage.Sets/src/mage/cards/d/DiscipleOfPhenax.java index 57d0d567fa9..75c5cf16586 100644 --- a/Mage.Sets/src/mage/cards/d/DiscipleOfPhenax.java +++ b/Mage.Sets/src/mage/cards/d/DiscipleOfPhenax.java @@ -82,7 +82,7 @@ class DiscipleOfPhenaxEffect extends OneShotEffect { FilterCard filter = new FilterCard("card in target player's hand"); TargetCard chosenCards = new TargetCard(amount, amount, Zone.HAND, filter); chosenCards.setNotTarget(true); - if (chosenCards.canChoose(targetPlayer.getId(), game) + if (chosenCards.canChoose(source.getSourceId(), targetPlayer.getId(), game) && targetPlayer.choose(Outcome.Discard, targetPlayer.getHand(), chosenCards, game)) { if (!chosenCards.getTargets().isEmpty()) { List targets = chosenCards.getTargets(); @@ -109,7 +109,7 @@ class DiscipleOfPhenaxEffect extends OneShotEffect { yourChoice.setNotTarget(true); if (you.choose(Outcome.Benefit, revealedCards, yourChoice, game)) { Card card = targetPlayer.getHand().get(yourChoice.getFirstTarget(), game); - return targetPlayer.discard(card, source, game); + return targetPlayer.discard(card, false, source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/d/DiscordantDirge.java b/Mage.Sets/src/mage/cards/d/DiscordantDirge.java index cc5d30ea2a0..e9a8f6928d0 100644 --- a/Mage.Sets/src/mage/cards/d/DiscordantDirge.java +++ b/Mage.Sets/src/mage/cards/d/DiscordantDirge.java @@ -86,7 +86,7 @@ class DiscordantDirgeEffect extends OneShotEffect { if (!controller.choose(Outcome.Benefit, targetOpponent.getHand(), target, game)) { return false; } - targetOpponent.discard(new CardsImpl(target.getTargets()), source, game); + targetOpponent.discard(new CardsImpl(target.getTargets()), false, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/d/DiseasedVermin.java b/Mage.Sets/src/mage/cards/d/DiseasedVermin.java index e40712175ce..efc31859241 100644 --- a/Mage.Sets/src/mage/cards/d/DiseasedVermin.java +++ b/Mage.Sets/src/mage/cards/d/DiseasedVermin.java @@ -98,14 +98,14 @@ class DiseasedVerminEffect extends OneShotEffect { if (sourcePermanent != null && controller != null) { TargetPlayer targetOpponent = new TargetPlayer(1, 1, false, filter); - if (targetOpponent.canChoose(controller.getId(), game) + if (targetOpponent.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(Outcome.Damage, targetOpponent, source.getSourceId(), game)) { Player opponent = game.getPlayer(targetOpponent.getFirstTarget()); if (opponent != null && sourcePermanent.getCounters(game).getCount(CounterType.INFECTION) > 0) { opponent.damage( sourcePermanent.getCounters(game).getCount(CounterType.INFECTION), - source.getSourceId(), game, false, true); + source.getSourceId(), source, game, false, true); return true; } } @@ -143,7 +143,7 @@ class DiseasedVerminWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId() == sourceId) { damagedPlayers.add(event.getTargetId()); } diff --git a/Mage.Sets/src/mage/cards/d/DismalFailure.java b/Mage.Sets/src/mage/cards/d/DismalFailure.java index 0a3f917c4e5..f7a7fc127ed 100644 --- a/Mage.Sets/src/mage/cards/d/DismalFailure.java +++ b/Mage.Sets/src/mage/cards/d/DismalFailure.java @@ -61,11 +61,11 @@ class DismalFailureEffect extends OneShotEffect { controller = game.getPlayer(game.getControllerId(targetId)); } if (targetId != null - && game.getStack().counter(targetId, source.getSourceId(), game)) { + && game.getStack().counter(targetId, source, game)) { countered = true; } if (controller != null) { - controller.discard(1, false, source, game); + controller.discard(1, false, false, source, game); } return countered; } diff --git a/Mage.Sets/src/mage/cards/d/Dismantle.java b/Mage.Sets/src/mage/cards/d/Dismantle.java index c4e889c8fb8..308c062835a 100644 --- a/Mage.Sets/src/mage/cards/d/Dismantle.java +++ b/Mage.Sets/src/mage/cards/d/Dismantle.java @@ -69,10 +69,10 @@ class DismantleEffect extends OneShotEffect { if (permanent != null) { int counterCount = 0; counterCount = permanent.getCounters(game).values().stream().map((counter) -> counter.getCount()).reduce(counterCount, Integer::sum); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (counterCount > 0) { Target target = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent("an artifact you control"), true); - if (target.canChoose(controller.getId(), game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game)) { controller.chooseTarget(Outcome.Benefit, target, source, game); Permanent artifact = game.getPermanent(target.getFirstTarget()); Counter counter; diff --git a/Mage.Sets/src/mage/cards/d/Disorder.java b/Mage.Sets/src/mage/cards/d/Disorder.java index 7bf1665289c..80eba013057 100644 --- a/Mage.Sets/src/mage/cards/d/Disorder.java +++ b/Mage.Sets/src/mage/cards/d/Disorder.java @@ -74,7 +74,7 @@ class DisorderEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(player.getId())); filter.add(new ColorPredicate(ObjectColor.WHITE)); if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DispersalShield.java b/Mage.Sets/src/mage/cards/d/DispersalShield.java index 56d2ccc93d3..9a8771c047d 100644 --- a/Mage.Sets/src/mage/cards/d/DispersalShield.java +++ b/Mage.Sets/src/mage/cards/d/DispersalShield.java @@ -60,7 +60,7 @@ class DispersalShieldEffect extends OneShotEffect { DynamicValue amount = new HighestConvertedManaCostValue(); Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (spell != null && spell.getConvertedManaCost() <= amount.calculate(game, source, this)) { - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/DisplacementWave.java b/Mage.Sets/src/mage/cards/d/DisplacementWave.java index fd55d170c38..5573c1c41fe 100644 --- a/Mage.Sets/src/mage/cards/d/DisplacementWave.java +++ b/Mage.Sets/src/mage/cards/d/DisplacementWave.java @@ -56,7 +56,7 @@ class DisplacementWaveEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (!permanent.isLand() && permanent.getConvertedManaCost() <= source.getManaCostsToPay().getX()) { - permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true); + permanent.moveToZone(Zone.HAND, source, game, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java b/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java index 982a15498d3..02b671ecc16 100644 --- a/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java +++ b/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java @@ -88,7 +88,7 @@ class DisplayOfDominanceEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGET; + return event.getType() == GameEvent.EventType.TARGET; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DisruptingShoal.java b/Mage.Sets/src/mage/cards/d/DisruptingShoal.java index 0c60f8b5ab3..762ba902b80 100644 --- a/Mage.Sets/src/mage/cards/d/DisruptingShoal.java +++ b/Mage.Sets/src/mage/cards/d/DisruptingShoal.java @@ -74,7 +74,7 @@ class DisruptingShoalCounterTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (spell != null && isConvertedManaCostEqual(source, spell.getConvertedManaCost())) { - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/DisruptionAura.java b/Mage.Sets/src/mage/cards/d/DisruptionAura.java index fae734884c5..551916d2948 100644 --- a/Mage.Sets/src/mage/cards/d/DisruptionAura.java +++ b/Mage.Sets/src/mage/cards/d/DisruptionAura.java @@ -75,11 +75,11 @@ class DisruptionAuraEffect extends OneShotEffect { Cost cost = permanent.getManaCost().copy(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/DissipationField.java b/Mage.Sets/src/mage/cards/d/DissipationField.java index 8cd6e746df8..a09d384eed3 100644 --- a/Mage.Sets/src/mage/cards/d/DissipationField.java +++ b/Mage.Sets/src/mage/cards/d/DissipationField.java @@ -54,7 +54,7 @@ class DissipationFieldAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DistantMemories.java b/Mage.Sets/src/mage/cards/d/DistantMemories.java index 3833a540a9d..ab0f742909b 100644 --- a/Mage.Sets/src/mage/cards/d/DistantMemories.java +++ b/Mage.Sets/src/mage/cards/d/DistantMemories.java @@ -89,7 +89,7 @@ class DistantMemoriesEffect extends OneShotEffect { if (putInHand) { controller.moveCards(card, Zone.HAND, source, game); } else { - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DistendedMindbender.java b/Mage.Sets/src/mage/cards/d/DistendedMindbender.java index 8cd33715a31..27674f082d0 100644 --- a/Mage.Sets/src/mage/cards/d/DistendedMindbender.java +++ b/Mage.Sets/src/mage/cards/d/DistendedMindbender.java @@ -100,7 +100,7 @@ class DistendedMindbenderEffect extends OneShotEffect { if (controller.chooseTarget(Outcome.Benefit, opponent.getHand(), targetFourOrGreater, source, game)) { toDiscard.addAll(targetFourOrGreater.getTargets()); } - opponent.discard(toDiscard, source, game); + opponent.discard(toDiscard, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DistortionStrike.java b/Mage.Sets/src/mage/cards/d/DistortionStrike.java index 044aee42564..6f624a34b33 100644 --- a/Mage.Sets/src/mage/cards/d/DistortionStrike.java +++ b/Mage.Sets/src/mage/cards/d/DistortionStrike.java @@ -1,4 +1,3 @@ - package mage.cards.d; import java.util.UUID; @@ -21,13 +20,13 @@ public final class DistortionStrike extends CardImpl { public DistortionStrike(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{U}"); - // Target creature gets +1/+0 until end of turn and can't be blocked this turn. this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new BoostTargetEffect(1, 0, Duration.EndOfTurn)); Effect effect = new CantBeBlockedTargetEffect(); effect.setText("and can't be blocked this turn"); this.getSpellAbility().addEffect(effect); + // Rebound this.addAbility(new ReboundAbility()); } diff --git a/Mage.Sets/src/mage/cards/d/Divert.java b/Mage.Sets/src/mage/cards/d/Divert.java index 0950a5a2ea3..dd0dd924de3 100644 --- a/Mage.Sets/src/mage/cards/d/Divert.java +++ b/Mage.Sets/src/mage/cards/d/Divert.java @@ -62,8 +62,7 @@ class DivertEffect extends OneShotEffect { if (spell != null) { Player player = game.getPlayer(spell.getControllerId()); if (player != null) { - if (!cost.pay(source, game, spell.getControllerId(), - spell.getControllerId(), false, null)) { + if (!cost.pay(source, game, source, spell.getControllerId(), false, null)) { return spell.chooseNewTargets(game, source.getControllerId(), true, true, null); } } diff --git a/Mage.Sets/src/mage/cards/d/DivineDeflection.java b/Mage.Sets/src/mage/cards/d/DivineDeflection.java index bcaa963f825..bc474aaddda 100644 --- a/Mage.Sets/src/mage/cards/d/DivineDeflection.java +++ b/Mage.Sets/src/mage/cards/d/DivineDeflection.java @@ -98,12 +98,12 @@ class DivineDeflectionPreventDamageTargetEffect extends PreventionEffectImpl { Permanent permanent = game.getPermanent(dealDamageTo); if (permanent != null) { game.informPlayers("Dealing " + prevented + " to " + permanent.getName() + " instead"); - permanent.damage(prevented, source.getSourceId(), game, false, true); + permanent.damage(prevented, source.getSourceId(), source, game, false, true); } Player player = game.getPlayer(dealDamageTo); if (player != null) { game.informPlayers("Dealing " + prevented + " to " + player.getLogName() + " instead"); - player.damage(prevented, source.getSourceId(), game); + player.damage(prevented, source.getSourceId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/d/DivineIntervention.java b/Mage.Sets/src/mage/cards/d/DivineIntervention.java index 9f92b3e98e8..07342817bb9 100644 --- a/Mage.Sets/src/mage/cards/d/DivineIntervention.java +++ b/Mage.Sets/src/mage/cards/d/DivineIntervention.java @@ -71,7 +71,7 @@ public final class DivineIntervention extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DivineReckoning.java b/Mage.Sets/src/mage/cards/d/DivineReckoning.java index 84a80a1cccf..f8c47a02954 100644 --- a/Mage.Sets/src/mage/cards/d/DivineReckoning.java +++ b/Mage.Sets/src/mage/cards/d/DivineReckoning.java @@ -68,8 +68,8 @@ class DivineReckoningEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true); - if (target.canChoose(player.getId(), game)) { - while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); @@ -82,7 +82,7 @@ class DivineReckoningEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), source.getSourceId(), game)) { if (!chosen.contains(permanent)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DivinerSpirit.java b/Mage.Sets/src/mage/cards/d/DivinerSpirit.java index 0796e310999..3b64098a2d4 100644 --- a/Mage.Sets/src/mage/cards/d/DivinerSpirit.java +++ b/Mage.Sets/src/mage/cards/d/DivinerSpirit.java @@ -64,8 +64,8 @@ class DivinerSpiritEffect extends OneShotEffect { if (sourceController != null && damagedPlayer != null) { int amount = (Integer) getValue("damage"); if (amount > 0) { - sourceController.drawCards(amount, source.getSourceId(), game); - damagedPlayer.drawCards(amount, source.getSourceId(), game); + sourceController.drawCards(amount, source, game); + damagedPlayer.drawCards(amount, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DivinersLockbox.java b/Mage.Sets/src/mage/cards/d/DivinersLockbox.java index ce8c46dbd8e..908abf91cd7 100644 --- a/Mage.Sets/src/mage/cards/d/DivinersLockbox.java +++ b/Mage.Sets/src/mage/cards/d/DivinersLockbox.java @@ -84,7 +84,7 @@ class DivinersLockboxEffect extends OneShotEffect { player.revealCards(source, new CardsImpl(card), game); if (choice.getChoice().equals(card.getName())) { sacEffect.apply(game, source); - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DoOrDie.java b/Mage.Sets/src/mage/cards/d/DoOrDie.java index bcb84adb1e3..15a94c89d5a 100644 --- a/Mage.Sets/src/mage/cards/d/DoOrDie.java +++ b/Mage.Sets/src/mage/cards/d/DoOrDie.java @@ -99,7 +99,7 @@ class DoOrDieEffect extends OneShotEffect { private void destroyPermanents(List pile, Game game, Ability source) { for (Permanent permanent : pile) { if (permanent != null) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/d/DongZhouTheTyrant.java b/Mage.Sets/src/mage/cards/d/DongZhouTheTyrant.java index 187a0fd88ae..c3243551c82 100644 --- a/Mage.Sets/src/mage/cards/d/DongZhouTheTyrant.java +++ b/Mage.Sets/src/mage/cards/d/DongZhouTheTyrant.java @@ -68,7 +68,7 @@ class DongZhouTheTyrantEffect extends OneShotEffect { int amount = creature.getPower().getValue(); Player controller = game.getPlayer(creature.getControllerId()); if (controller != null) { - controller.damage(amount, creature.getId(), game); + controller.damage(amount, creature.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DoomForetold.java b/Mage.Sets/src/mage/cards/d/DoomForetold.java index 97b9126f8e8..294e46acda8 100644 --- a/Mage.Sets/src/mage/cards/d/DoomForetold.java +++ b/Mage.Sets/src/mage/cards/d/DoomForetold.java @@ -89,14 +89,14 @@ class DoomForetoldEffect extends OneShotEffect { target.setNotTarget(true); if (player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { return true; } } } - player.discard(1, false, source, game); - player.loseLife(2, game, false); - controller.drawCards(1, source.getSourceId(), game); + player.discard(1, false, false, source, game); + player.loseLife(2, game, source, false); + controller.drawCards(1, source, game); controller.gainLife(2, game, source); effect1.apply(game, source); effect2.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/d/Doomgape.java b/Mage.Sets/src/mage/cards/d/Doomgape.java index 32b2582091f..86995ba8ca8 100644 --- a/Mage.Sets/src/mage/cards/d/Doomgape.java +++ b/Mage.Sets/src/mage/cards/d/Doomgape.java @@ -77,7 +77,7 @@ class DoomgapeEffect extends OneShotEffect { if (controller.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent creature = game.getPermanent(target.getFirstTarget()); if (creature != null) { - if (creature.sacrifice(source.getSourceId(), game)) { + if (creature.sacrifice(source, game)) { controller.gainLife(creature.getToughness().getValue(), game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java b/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java index 77f778213c5..e3918d6c0c9 100644 --- a/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java +++ b/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java @@ -66,7 +66,7 @@ class AddCounterAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/d/Dovescape.java b/Mage.Sets/src/mage/cards/d/Dovescape.java index e3917d0af7a..1edf2d37997 100644 --- a/Mage.Sets/src/mage/cards/d/Dovescape.java +++ b/Mage.Sets/src/mage/cards/d/Dovescape.java @@ -70,10 +70,10 @@ class DovescapeEffect extends OneShotEffect { if (spell != null) { spellCMC = spell.getConvertedManaCost(); spellControllerID = spell.getControllerId(); - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } Token token = new DovescapeToken(); - token.putOntoBattlefield(spellCMC, game, source.getSourceId(), spellControllerID); + token.putOntoBattlefield(spellCMC, game, source, spellControllerID); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DovinBaan.java b/Mage.Sets/src/mage/cards/d/DovinBaan.java index 670251eca77..c8887426bef 100644 --- a/Mage.Sets/src/mage/cards/d/DovinBaan.java +++ b/Mage.Sets/src/mage/cards/d/DovinBaan.java @@ -89,7 +89,7 @@ class DovinBaanCantActivateAbilitiesEffect extends ContinuousRuleModifyingEffect @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATE_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; } @Override diff --git a/Mage.Sets/src/mage/cards/d/Draco.java b/Mage.Sets/src/mage/cards/d/Draco.java index 736a234e7ab..fa7a8d5a48b 100644 --- a/Mage.Sets/src/mage/cards/d/Draco.java +++ b/Mage.Sets/src/mage/cards/d/Draco.java @@ -101,11 +101,11 @@ class DracoSacrificeUnlessPaysEffect extends OneShotEffect { int count = Math.max(0, MAX_DOMAIN_VALUE - domainValueReduction); if (player.chooseUse(Outcome.Benefit, "Pay {" + count + "}? Or " + permanent.getName() + " will be sacrificed.", source, game)) { Cost cost = ManaUtil.createManaCost(count, false); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source, source.getControllerId(), false)) { return true; } } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/DraconicRoar.java b/Mage.Sets/src/mage/cards/d/DraconicRoar.java index b020519c616..502598f4359 100644 --- a/Mage.Sets/src/mage/cards/d/DraconicRoar.java +++ b/Mage.Sets/src/mage/cards/d/DraconicRoar.java @@ -96,7 +96,7 @@ class DraconicRoarEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/Dracoplasm.java b/Mage.Sets/src/mage/cards/d/Dracoplasm.java index 974da8aa9d5..5bd5ebbd05a 100644 --- a/Mage.Sets/src/mage/cards/d/Dracoplasm.java +++ b/Mage.Sets/src/mage/cards/d/Dracoplasm.java @@ -105,7 +105,7 @@ class DracoplasmEffect extends ReplacementEffectImpl { int toughness = 0; for (UUID targetId : target.getTargets()) { Permanent targetCreature = game.getPermanent(targetId); - if (targetCreature != null && targetCreature.sacrifice(source.getSourceId(), game)) { + if (targetCreature != null && targetCreature.sacrifice(source, game)) { power = CardUtil.addWithOverflowCheck(power, targetCreature.getPower().getValue()); toughness = CardUtil.addWithOverflowCheck(toughness, targetCreature.getToughness().getValue()); } diff --git a/Mage.Sets/src/mage/cards/d/DrafnasRestoration.java b/Mage.Sets/src/mage/cards/d/DrafnasRestoration.java index 83b5bb36b0c..e736ce213b0 100644 --- a/Mage.Sets/src/mage/cards/d/DrafnasRestoration.java +++ b/Mage.Sets/src/mage/cards/d/DrafnasRestoration.java @@ -13,6 +13,7 @@ import mage.constants.Outcome; import mage.filter.common.FilterArtifactCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.TargetEvent; import mage.game.stack.StackObject; import mage.players.Player; import mage.target.TargetPlayer; @@ -67,7 +68,7 @@ class DrafnasRestorationTarget extends TargetCardInGraveyard { Player targetPlayer = game.getPlayer(((StackObject) object).getStackAbility().getFirstTarget()); if (targetPlayer != null) { for (Card card : targetPlayer.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) { - if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets.add(card.getId()); } } diff --git a/Mage.Sets/src/mage/cards/d/DragonAppeasement.java b/Mage.Sets/src/mage/cards/d/DragonAppeasement.java index 5b6e44a030b..7f61a0d8161 100644 --- a/Mage.Sets/src/mage/cards/d/DragonAppeasement.java +++ b/Mage.Sets/src/mage/cards/d/DragonAppeasement.java @@ -59,7 +59,7 @@ class DragonAppeasementTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DragonBreath.java b/Mage.Sets/src/mage/cards/d/DragonBreath.java index 61bedce888f..166c351b47c 100644 --- a/Mage.Sets/src/mage/cards/d/DragonBreath.java +++ b/Mage.Sets/src/mage/cards/d/DragonBreath.java @@ -91,7 +91,7 @@ class DragonBreathEffect extends OneShotEffect { if (sourceCard != null && permanent != null && controller != null) { game.getState().setValue("attachTo:" + sourceCard.getId(), permanent); if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) { - permanent.addAttachment(sourceCard.getId(), game); + permanent.addAttachment(sourceCard.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DragonFangs.java b/Mage.Sets/src/mage/cards/d/DragonFangs.java index 40a2bf67127..1c014260766 100644 --- a/Mage.Sets/src/mage/cards/d/DragonFangs.java +++ b/Mage.Sets/src/mage/cards/d/DragonFangs.java @@ -87,7 +87,7 @@ class DragonFangsEffect extends OneShotEffect { if (sourceCard != null && permanent != null && controller != null) { game.getState().setValue("attachTo:" + sourceCard.getId(), permanent); if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) { - permanent.addAttachment(sourceCard.getId(), game); + permanent.addAttachment(sourceCard.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DragonScales.java b/Mage.Sets/src/mage/cards/d/DragonScales.java index 5b24597f3aa..54050fd1431 100644 --- a/Mage.Sets/src/mage/cards/d/DragonScales.java +++ b/Mage.Sets/src/mage/cards/d/DragonScales.java @@ -87,7 +87,7 @@ class DragonScalesEffect extends OneShotEffect { if (sourceCard != null && permanent != null && controller != null) { game.getState().setValue("attachTo:" + sourceCard.getId(), permanent); if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) { - permanent.addAttachment(sourceCard.getId(), game); + permanent.addAttachment(sourceCard.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DragonShadow.java b/Mage.Sets/src/mage/cards/d/DragonShadow.java index 622240100f1..1a7bed4efa3 100644 --- a/Mage.Sets/src/mage/cards/d/DragonShadow.java +++ b/Mage.Sets/src/mage/cards/d/DragonShadow.java @@ -87,7 +87,7 @@ class DragonShadowEffect extends OneShotEffect { if (sourceCard != null && permanent != null && controller != null) { game.getState().setValue("attachTo:" + sourceCard.getId(), permanent); if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) { - permanent.addAttachment(sourceCard.getId(), game); + permanent.addAttachment(sourceCard.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DragonTempest.java b/Mage.Sets/src/mage/cards/d/DragonTempest.java index c2b1998436a..bdde0142fc0 100644 --- a/Mage.Sets/src/mage/cards/d/DragonTempest.java +++ b/Mage.Sets/src/mage/cards/d/DragonTempest.java @@ -94,11 +94,11 @@ class DragonTempestDamageEffect extends OneShotEffect { if (amount > 0) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(amount, damageSource.getId(), game, false, true); + targetCreature.damage(amount, damageSource.getId(), source, game, false, true); } else { Player player = game.getPlayer(source.getTargets().getFirstTarget()); if (player != null) { - player.damage(amount, damageSource.getId(), game); + player.damage(amount, damageSource.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DragonWings.java b/Mage.Sets/src/mage/cards/d/DragonWings.java index c5f2389ad2b..568222957d1 100644 --- a/Mage.Sets/src/mage/cards/d/DragonWings.java +++ b/Mage.Sets/src/mage/cards/d/DragonWings.java @@ -89,7 +89,7 @@ class DragonWingsEffect extends OneShotEffect { if (sourceCard != null && permanent != null && controller != null) { game.getState().setValue("attachTo:" + sourceCard.getId(), permanent); if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) { - permanent.addAttachment(sourceCard.getId(), game); + permanent.addAttachment(sourceCard.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DrainLife.java b/Mage.Sets/src/mage/cards/d/DrainLife.java index 5f19cc16d3d..9ce3a1d5568 100644 --- a/Mage.Sets/src/mage/cards/d/DrainLife.java +++ b/Mage.Sets/src/mage/cards/d/DrainLife.java @@ -87,14 +87,14 @@ class DrainLifeEffect extends OneShotEffect { } else { return false; } - permanent.damage(amount, source.getSourceId(), game); + permanent.damage(amount, source.getSourceId(), source, game); } else { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player == null) { return false; } lifetogain = Math.min(player.getLife(), lifetogain); - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { diff --git a/Mage.Sets/src/mage/cards/d/DrainPower.java b/Mage.Sets/src/mage/cards/d/DrainPower.java index e22c3f803d4..c57ec3236c1 100644 --- a/Mage.Sets/src/mage/cards/d/DrainPower.java +++ b/Mage.Sets/src/mage/cards/d/DrainPower.java @@ -114,7 +114,7 @@ class DrainPowerEffect extends OneShotEffect { FilterLandPermanent filter2 = new FilterLandPermanent("land you control to tap for mana (remaining: " + permList.size() + ')'); filter2.add(new PermanentInListPredicate(permList)); target = new TargetPermanent(1, 1, filter2, true); - while (!target.isChosen() && target.canChoose(targetPlayer.getId(), game) && targetPlayer.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), targetPlayer.getId(), game) && targetPlayer.canRespond()) { targetPlayer.chooseTarget(Outcome.Neutral, target, source, game); } permanent = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/d/DrakeFamiliar.java b/Mage.Sets/src/mage/cards/d/DrakeFamiliar.java index 040bed91884..57a8027efcc 100644 --- a/Mage.Sets/src/mage/cards/d/DrakeFamiliar.java +++ b/Mage.Sets/src/mage/cards/d/DrakeFamiliar.java @@ -69,12 +69,12 @@ class DrakeFamiliarEffect extends OneShotEffect { if (controller != null) { boolean targetChosen = false; TargetPermanent target = new TargetPermanent(1, 1, StaticFilters.FILTER_ENCHANTMENT_PERMANENT, true); - if (target.canChoose(controller.getId(), game) && controller.chooseUse(outcome, "Return an enchantment to its owner's hand?", source, game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseUse(outcome, "Return an enchantment to its owner's hand?", source, game)) { controller.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { targetChosen = true; - permanent.moveToZone(Zone.HAND, this.getId(), game, false); + permanent.moveToZone(Zone.HAND, source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/d/DrakusethMawOfFlames.java b/Mage.Sets/src/mage/cards/d/DrakusethMawOfFlames.java index 33999e3fcec..6b33b83dc75 100644 --- a/Mage.Sets/src/mage/cards/d/DrakusethMawOfFlames.java +++ b/Mage.Sets/src/mage/cards/d/DrakusethMawOfFlames.java @@ -93,11 +93,11 @@ class DrakusethMawOfFlamesEffect extends OneShotEffect { private static void damage(int damage, UUID targetId, Game game, Ability source) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(damage, source.getSourceId(), game, false, true); + permanent.damage(damage, source.getSourceId(), source, game, false, true); } Player player = game.getPlayer(targetId); if (player != null) { - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DrasticRevelation.java b/Mage.Sets/src/mage/cards/d/DrasticRevelation.java index df6a334e9ae..aa127273149 100644 --- a/Mage.Sets/src/mage/cards/d/DrasticRevelation.java +++ b/Mage.Sets/src/mage/cards/d/DrasticRevelation.java @@ -50,9 +50,9 @@ class DrasticRevelationEffect extends OneShotEffect { if (you == null) { return false; } - you.discard(you.getHand(), source, game); - you.drawCards(7, source.getSourceId(), game); - you.discard(3, true, source, game); + you.discard(you.getHand(), false, source, game); + you.drawCards(7, source, game); + you.discard(3, true, false, source, game); return false; } diff --git a/Mage.Sets/src/mage/cards/d/Dread.java b/Mage.Sets/src/mage/cards/d/Dread.java index 681ec902e3d..41995a23551 100644 --- a/Mage.Sets/src/mage/cards/d/Dread.java +++ b/Mage.Sets/src/mage/cards/d/Dread.java @@ -70,7 +70,7 @@ class DreadTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DreadDefiler.java b/Mage.Sets/src/mage/cards/d/DreadDefiler.java index 4cbe309af50..746cd043583 100644 --- a/Mage.Sets/src/mage/cards/d/DreadDefiler.java +++ b/Mage.Sets/src/mage/cards/d/DreadDefiler.java @@ -86,7 +86,7 @@ class DreadDefilerEffect extends OneShotEffect { if (amount > 0) { Player targetOpponent = game.getPlayer(source.getFirstTarget()); if (targetOpponent != null) { - targetOpponent.loseLife(amount, game, false); + targetOpponent.loseLife(amount, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DreadSummons.java b/Mage.Sets/src/mage/cards/d/DreadSummons.java index 8a2812efbfa..dc1f3d6fbbf 100644 --- a/Mage.Sets/src/mage/cards/d/DreadSummons.java +++ b/Mage.Sets/src/mage/cards/d/DreadSummons.java @@ -75,7 +75,7 @@ class DreadSummonsEffect extends OneShotEffect { .count(); } if (creatureCount > 0) { - token.putOntoBattlefield(creatureCount, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(creatureCount, game, source, source.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DreadWight.java b/Mage.Sets/src/mage/cards/d/DreadWight.java index 0483bcaebe5..8af19a8f423 100644 --- a/Mage.Sets/src/mage/cards/d/DreadWight.java +++ b/Mage.Sets/src/mage/cards/d/DreadWight.java @@ -82,7 +82,7 @@ class DreadWightTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return (event.getType() == EventType.BLOCKER_DECLARED); + return (event.getType() == GameEvent.EventType.BLOCKER_DECLARED); } @Override @@ -129,7 +129,7 @@ class DreadWightEffect extends OneShotEffect { effect.setTargetPointer(new FixedTarget(permanent, game)); effect.apply(game, source); // tap permanent - permanent.tap(game); + permanent.tap(source, game); // does not untap while paralyzation counter is on it ContinuousRuleModifyingEffect effect2 = new DreadWightDoNotUntapEffect( Duration.WhileOnBattlefield, diff --git a/Mage.Sets/src/mage/cards/d/DreadhordeArcanist.java b/Mage.Sets/src/mage/cards/d/DreadhordeArcanist.java index 4808f83bfc6..0df75782b32 100644 --- a/Mage.Sets/src/mage/cards/d/DreadhordeArcanist.java +++ b/Mage.Sets/src/mage/cards/d/DreadhordeArcanist.java @@ -141,15 +141,7 @@ class DreadhordeArcanistReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - Card card = game.getCard(this.cardId); - if (controller != null && card != null) { - controller.moveCardToExileWithInfo( - card, null, "", source.getSourceId(), - game, Zone.STACK, true - ); - return true; - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } diff --git a/Mage.Sets/src/mage/cards/d/DreamCache.java b/Mage.Sets/src/mage/cards/d/DreamCache.java index f971d3826f8..a6047eefd14 100644 --- a/Mage.Sets/src/mage/cards/d/DreamCache.java +++ b/Mage.Sets/src/mage/cards/d/DreamCache.java @@ -58,7 +58,7 @@ class DreamCacheEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); boolean putOnTop = controller.chooseUse(Outcome.Neutral, "Put cards on top?", source, game); TargetCardInHand target = new TargetCardInHand(2, 2, new FilterCard()); controller.chooseTarget(Outcome.Detriment, target, source, game); diff --git a/Mage.Sets/src/mage/cards/d/DreamFracture.java b/Mage.Sets/src/mage/cards/d/DreamFracture.java index 2148a395a31..b1d9b9790f4 100644 --- a/Mage.Sets/src/mage/cards/d/DreamFracture.java +++ b/Mage.Sets/src/mage/cards/d/DreamFracture.java @@ -66,11 +66,11 @@ class DreamFractureEffect extends OneShotEffect { controller = game.getPlayer(game.getControllerId(targetId)); } if (targetId != null - && game.getStack().counter(targetId, source.getSourceId(), game)) { + && game.getStack().counter(targetId, source, game)) { countered = true; } if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return countered; } diff --git a/Mage.Sets/src/mage/cards/d/DreamPillager.java b/Mage.Sets/src/mage/cards/d/DreamPillager.java index 67869fe5110..4e7ac704ad2 100644 --- a/Mage.Sets/src/mage/cards/d/DreamPillager.java +++ b/Mage.Sets/src/mage/cards/d/DreamPillager.java @@ -69,7 +69,7 @@ class DreamPillagerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DreamSalvage.java b/Mage.Sets/src/mage/cards/d/DreamSalvage.java index 397ef520cba..6971326145f 100644 --- a/Mage.Sets/src/mage/cards/d/DreamSalvage.java +++ b/Mage.Sets/src/mage/cards/d/DreamSalvage.java @@ -96,7 +96,7 @@ class DreamSalvageEffect extends OneShotEffect { && controller != null && watcher != null && watcher.getAmountCardsDiscarded(targetOpponent.getId()) > 0) { - controller.drawCards(watcher.getAmountCardsDiscarded(targetOpponent.getId()), source.getSourceId(), game); + controller.drawCards(watcher.getAmountCardsDiscarded(targetOpponent.getId()), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/DreamTides.java b/Mage.Sets/src/mage/cards/d/DreamTides.java index e6d60bf0fe1..810d9fd0aec 100644 --- a/Mage.Sets/src/mage/cards/d/DreamTides.java +++ b/Mage.Sets/src/mage/cards/d/DreamTides.java @@ -85,7 +85,7 @@ class DreamTidesEffect extends OneShotEffect { Cost cost = ManaUtil.createManaCost(2, false); Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source, player.getId(), false)) { tappedCreature.untap(game); } } diff --git a/Mage.Sets/src/mage/cards/d/Dreamstealer.java b/Mage.Sets/src/mage/cards/d/Dreamstealer.java index 46d846a33fa..b4da8db0e7c 100644 --- a/Mage.Sets/src/mage/cards/d/Dreamstealer.java +++ b/Mage.Sets/src/mage/cards/d/Dreamstealer.java @@ -73,7 +73,7 @@ class DreamstealerDiscardEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { int damage = (Integer) getValue("damage"); - targetPlayer.discard(damage, false, source, game); + targetPlayer.discard(damage, false, false, source, game); game.informPlayers(targetPlayer.getLogName() + "discards " + damage + " card(s)"); return true; } diff --git a/Mage.Sets/src/mage/cards/d/DrogskolReaver.java b/Mage.Sets/src/mage/cards/d/DrogskolReaver.java index 38195184ea4..c6f767b1045 100644 --- a/Mage.Sets/src/mage/cards/d/DrogskolReaver.java +++ b/Mage.Sets/src/mage/cards/d/DrogskolReaver.java @@ -64,7 +64,7 @@ class DrogskolReaverAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DroolingOgre.java b/Mage.Sets/src/mage/cards/d/DroolingOgre.java index 4f51629d6ff..3b39b11ca58 100644 --- a/Mage.Sets/src/mage/cards/d/DroolingOgre.java +++ b/Mage.Sets/src/mage/cards/d/DroolingOgre.java @@ -96,7 +96,7 @@ public final class DroolingOgre extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DropOfHoney.java b/Mage.Sets/src/mage/cards/d/DropOfHoney.java index 8f69d770203..53077122ead 100644 --- a/Mage.Sets/src/mage/cards/d/DropOfHoney.java +++ b/Mage.Sets/src/mage/cards/d/DropOfHoney.java @@ -97,7 +97,7 @@ class DropOfHoneyEffect extends OneShotEffect { } if (permanentToDestroy != null) { game.informPlayers(sourcePermanent.getName() + " chosen creature: " + permanentToDestroy.getName()); - return permanentToDestroy.destroy(source.getSourceId(), game, true); + return permanentToDestroy.destroy(source, game, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DruidicSatchel.java b/Mage.Sets/src/mage/cards/d/DruidicSatchel.java index 18251b3da2a..b1afbf09c07 100644 --- a/Mage.Sets/src/mage/cards/d/DruidicSatchel.java +++ b/Mage.Sets/src/mage/cards/d/DruidicSatchel.java @@ -60,7 +60,7 @@ class DruidicSatchelEffect extends OneShotEffect { if (card != null) { controller.revealCards(source, new CardsImpl(card), game); if (card.isCreature()) { - new SaprolingToken().putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + new SaprolingToken().putOntoBattlefield(1, game, source, source.getControllerId()); } if (card.isLand()) { controller.moveCards(card, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/d/Drumhunter.java b/Mage.Sets/src/mage/cards/d/Drumhunter.java index cdcd936a617..9e042693888 100644 --- a/Mage.Sets/src/mage/cards/d/Drumhunter.java +++ b/Mage.Sets/src/mage/cards/d/Drumhunter.java @@ -72,7 +72,7 @@ class DrumHunterTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DryadMilitant.java b/Mage.Sets/src/mage/cards/d/DryadMilitant.java index b22b40caebe..1f28d5394cd 100644 --- a/Mage.Sets/src/mage/cards/d/DryadMilitant.java +++ b/Mage.Sets/src/mage/cards/d/DryadMilitant.java @@ -70,13 +70,7 @@ class DryadMilitantReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Card card = game.getCard(event.getTargetId()); - if (card != null) { - return controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, game.getState().getZone(card.getId()), true); - } - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } diff --git a/Mage.Sets/src/mage/cards/d/DualNature.java b/Mage.Sets/src/mage/cards/d/DualNature.java index 7842ff9c649..263ca0f5745 100644 --- a/Mage.Sets/src/mage/cards/d/DualNature.java +++ b/Mage.Sets/src/mage/cards/d/DualNature.java @@ -195,7 +195,7 @@ class DualNatureExileEffect extends OneShotEffect { for (UUID tokenId : tokensCreated) { Permanent token = game.getPermanent(tokenId); if (token != null) { - token.destroy(source.getSourceId(), game, true); + token.destroy(source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/d/DueRespect.java b/Mage.Sets/src/mage/cards/d/DueRespect.java index e4458c1ffbf..901e3cde79c 100644 --- a/Mage.Sets/src/mage/cards/d/DueRespect.java +++ b/Mage.Sets/src/mage/cards/d/DueRespect.java @@ -60,7 +60,7 @@ class DueRespectEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/DuelistsHeritage.java b/Mage.Sets/src/mage/cards/d/DuelistsHeritage.java index b7c1e3cbe67..42a6f9413cb 100644 --- a/Mage.Sets/src/mage/cards/d/DuelistsHeritage.java +++ b/Mage.Sets/src/mage/cards/d/DuelistsHeritage.java @@ -65,7 +65,7 @@ class DuelistsHeritageTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/d/Duneblast.java b/Mage.Sets/src/mage/cards/d/Duneblast.java index 7bd4342cac2..8c0c3a85028 100644 --- a/Mage.Sets/src/mage/cards/d/Duneblast.java +++ b/Mage.Sets/src/mage/cards/d/Duneblast.java @@ -70,7 +70,7 @@ class DuneblastEffect extends OneShotEffect { } for(Permanent creature: game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), source.getSourceId(), game)) { if (!Objects.equals(creature, creatureToKeep)) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DungeonGeists.java b/Mage.Sets/src/mage/cards/d/DungeonGeists.java index 34ae3ae5269..17bc7fdc0fa 100644 --- a/Mage.Sets/src/mage/cards/d/DungeonGeists.java +++ b/Mage.Sets/src/mage/cards/d/DungeonGeists.java @@ -79,7 +79,9 @@ class DungeonGeistsEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UNTAP || event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL; + return event.getType() == GameEvent.EventType.UNTAP + || event.getType() == GameEvent.EventType.ZONE_CHANGE + || event.getType() == GameEvent.EventType.LOST_CONTROL; } @Override @@ -135,7 +137,9 @@ class DungeonGeistsWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST_CONTROL && event.getPlayerId().equals(controllerId) && event.getTargetId().equals(sourceId)) { + if (event.getType() == GameEvent.EventType.LOST_CONTROL + && event.getPlayerId().equals(controllerId) + && event.getTargetId().equals(sourceId)) { condition = true; game.replaceEvent(event); return; diff --git a/Mage.Sets/src/mage/cards/d/Duplicant.java b/Mage.Sets/src/mage/cards/d/Duplicant.java index 0915c8c8da3..2b0b104f57c 100644 --- a/Mage.Sets/src/mage/cards/d/Duplicant.java +++ b/Mage.Sets/src/mage/cards/d/Duplicant.java @@ -78,7 +78,7 @@ class DuplicantExileTargetEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); MageObject sourceObject = source.getSourceObject(game); if (permanent != null && sourceObject instanceof Permanent) { - if (permanent.moveToExile(null, null, source.getSourceId(), game) + if (permanent.moveToExile(null, null, source, game) && ((Permanent) sourceObject).imprint(permanent.getId(), game)) { ((Permanent) sourceObject).addInfo("imprint", "[Imprinted card - " + permanent.getName() + ']', game); } diff --git a/Mage.Sets/src/mage/cards/d/Duplicity.java b/Mage.Sets/src/mage/cards/d/Duplicity.java index 5a7efde378b..d6d1332f842 100644 --- a/Mage.Sets/src/mage/cards/d/Duplicity.java +++ b/Mage.Sets/src/mage/cards/d/Duplicity.java @@ -166,11 +166,11 @@ class LoseControlDuplicity extends DelayedTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.LOST_CONTROL && event.getPlayerId().equals(controllerId) - && event.getSourceId().equals(getSourceId())) { + && event.getTargetId().equals(this.getSourceId())) { return true; } if (event.getType() == GameEvent.EventType.ZONE_CHANGE - && event.getTargetId().equals(getSourceId()) + && event.getTargetId().equals(this.getSourceId()) && ((ZoneChangeEvent) event).getToZone() != Zone.BATTLEFIELD) { return true; } diff --git a/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java b/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java index fa6cb5bfe7e..ee5176e90e1 100644 --- a/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java +++ b/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java @@ -77,8 +77,8 @@ class DurkwoodTrackerEffect extends OneShotEffect { if (targeted == null) { return false; } - targeted.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); - permanent.damage(targeted.getPower().getValue(), targeted.getId(), game, false, true); + targeted.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); + permanent.damage(targeted.getPower().getValue(), targeted.getId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DuskmantleGuildmage.java b/Mage.Sets/src/mage/cards/d/DuskmantleGuildmage.java index ccb9f8cec3c..898a2966b6b 100644 --- a/Mage.Sets/src/mage/cards/d/DuskmantleGuildmage.java +++ b/Mage.Sets/src/mage/cards/d/DuskmantleGuildmage.java @@ -75,7 +75,7 @@ class CardPutIntoOpponentGraveThisTurn extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java b/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java index 5196f14bb62..81183f559e4 100644 --- a/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java +++ b/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java @@ -75,7 +75,7 @@ class DuskmantleSeerEffect extends OneShotEffect { Card card = player.getLibrary().getFromTop(game); if (card != null) { player.revealCards(source, ": Revealed by " + player.getName(), new CardsImpl(card), game); - player.loseLife(card.getConvertedManaCost(), game, false); + player.loseLife(card.getConvertedManaCost(), game, source, false); player.moveCards(card, Zone.HAND, source, game); } } diff --git a/Mage.Sets/src/mage/cards/d/DustOfMoments.java b/Mage.Sets/src/mage/cards/d/DustOfMoments.java index d5534c63a0b..1c920f26628 100644 --- a/Mage.Sets/src/mage/cards/d/DustOfMoments.java +++ b/Mage.Sets/src/mage/cards/d/DustOfMoments.java @@ -112,7 +112,7 @@ public final class DustOfMoments extends CardImpl { final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); final Counter modifiedCounter = new Counter(counterName, countersToRemove); - card.removeCounters(modifiedCounter, game); + card.removeCounters(modifiedCounter, source, game); } else { card.addCounters(counter, source, game); } @@ -137,7 +137,7 @@ public final class DustOfMoments extends CardImpl { final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); final Counter modifiedCounter = new Counter(counterName, countersToRemove); - card.removeCounters(modifiedCounter, game); + card.removeCounters(modifiedCounter, source, game); } else { card.addCounters(counter, source, game); } diff --git a/Mage.Sets/src/mage/cards/d/DwarvenDriller.java b/Mage.Sets/src/mage/cards/d/DwarvenDriller.java index 517a9938abb..8b91adb9c34 100644 --- a/Mage.Sets/src/mage/cards/d/DwarvenDriller.java +++ b/Mage.Sets/src/mage/cards/d/DwarvenDriller.java @@ -70,9 +70,9 @@ class DwarvenDrillerEffect extends OneShotEffect { if (player != null) { String message = "Have Dwarven Driller do 2 damage to you?"; if (player.chooseUse(Outcome.Damage, message, source, game)) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } else { - permanent.destroy(source.getId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DwarvenScorcher.java b/Mage.Sets/src/mage/cards/d/DwarvenScorcher.java index 3f73d9449e7..2c8f2019ec2 100644 --- a/Mage.Sets/src/mage/cards/d/DwarvenScorcher.java +++ b/Mage.Sets/src/mage/cards/d/DwarvenScorcher.java @@ -69,8 +69,8 @@ class DwarvenScorcherEffect extends OneShotEffect { } Player player = game.getPlayer(permanent.getControllerId()); if (player != null && player.chooseUse(outcome, "Have this spell deal 2 damage to you?", source, game)) { - return player.damage(2, source.getSourceId(), game) > 0; + return player.damage(2, source.getSourceId(), source, game) > 0; } - return permanent.damage(1, source.getSourceId(), game) > 0; + return permanent.damage(1, source.getSourceId(), source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/d/DwarvenShrine.java b/Mage.Sets/src/mage/cards/d/DwarvenShrine.java index 33acbe2d655..41386863bf0 100644 --- a/Mage.Sets/src/mage/cards/d/DwarvenShrine.java +++ b/Mage.Sets/src/mage/cards/d/DwarvenShrine.java @@ -59,7 +59,7 @@ class DwarvenShrineTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -103,7 +103,7 @@ class DwarvenShrineEffect extends OneShotEffect { count += player.getGraveyard().count(filterCardName, game); } } - controller.damage(count * 2, mageObject.getId(), game); + controller.damage(count * 2, mageObject.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/e/EMPBlast.java b/Mage.Sets/src/mage/cards/e/EMPBlast.java index 6e689faba73..0705cf85563 100644 --- a/Mage.Sets/src/mage/cards/e/EMPBlast.java +++ b/Mage.Sets/src/mage/cards/e/EMPBlast.java @@ -60,7 +60,7 @@ class EMPBlastEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent artifact : game.getBattlefield().getActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), source.getSourceId(), game)) { - artifact.tap(game); + artifact.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/Earthbind.java b/Mage.Sets/src/mage/cards/e/Earthbind.java index 3ce4f287a51..8aa0f112de8 100644 --- a/Mage.Sets/src/mage/cards/e/Earthbind.java +++ b/Mage.Sets/src/mage/cards/e/Earthbind.java @@ -79,7 +79,7 @@ class EarthbindEffect extends OneShotEffect { Permanent enchanted = game.getPermanent(attachment.getAttachedTo()); if (enchanted != null) { if (enchanted.getAbilities().contains(FlyingAbility.getInstance())) { - enchanted.damage(2, source.getSourceId(), game, false, true); + enchanted.damage(2, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EarwigSquad.java b/Mage.Sets/src/mage/cards/e/EarwigSquad.java index d132407b99e..0288327ed3d 100644 --- a/Mage.Sets/src/mage/cards/e/EarwigSquad.java +++ b/Mage.Sets/src/mage/cards/e/EarwigSquad.java @@ -86,7 +86,7 @@ class EarwigSquadEffect extends OneShotEffect { for (UUID targetId : targets) { Card card = opponent.getLibrary().remove(targetId, game); if (card != null) { - player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + player.moveCardToExileWithInfo(card, null, null, source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/e/EatenBySpiders.java b/Mage.Sets/src/mage/cards/e/EatenBySpiders.java index 16b2bc4a586..2a88785f76c 100644 --- a/Mage.Sets/src/mage/cards/e/EatenBySpiders.java +++ b/Mage.Sets/src/mage/cards/e/EatenBySpiders.java @@ -74,11 +74,11 @@ class EatenBySpidersEffect extends OneShotEffect { for (UUID attachmentId : attachments) { Permanent attachment = game.getPermanent(attachmentId); if (attachment.hasSubtype(SubType.EQUIPMENT, game)) { - attachment.destroy(source.getSourceId(), game, false); + attachment.destroy(source, game, false); } } - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/e/EaterOfTheDead.java b/Mage.Sets/src/mage/cards/e/EaterOfTheDead.java index f70c7d8dd34..28af513c7c1 100644 --- a/Mage.Sets/src/mage/cards/e/EaterOfTheDead.java +++ b/Mage.Sets/src/mage/cards/e/EaterOfTheDead.java @@ -62,7 +62,7 @@ class EaterOfTheDeadEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Card card = game.getCard(source.getFirstTarget()); if (sourcePermanent != null && sourcePermanent.isTapped() && card != null) { - card.moveToExile(null, "Eater of the Dead", source.getSourceId(), game); + card.moveToExile(null, "Eater of the Dead", source, game); sourcePermanent.untap(game); } return false; diff --git a/Mage.Sets/src/mage/cards/e/EbonyOwlNetsuke.java b/Mage.Sets/src/mage/cards/e/EbonyOwlNetsuke.java index 4a9dc522342..4445cf72c37 100644 --- a/Mage.Sets/src/mage/cards/e/EbonyOwlNetsuke.java +++ b/Mage.Sets/src/mage/cards/e/EbonyOwlNetsuke.java @@ -54,7 +54,7 @@ class EbonyOwlNetsukeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EchoingCalm.java b/Mage.Sets/src/mage/cards/e/EchoingCalm.java index 681ad75a60a..d8d63f7b903 100644 --- a/Mage.Sets/src/mage/cards/e/EchoingCalm.java +++ b/Mage.Sets/src/mage/cards/e/EchoingCalm.java @@ -58,11 +58,11 @@ class EchoingCalmEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (!CardUtil.haveEmptyName(permanent)) { // in case of face down enchantment creature for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (!perm.getId().equals(permanent.getId()) && CardUtil.haveSameNames(perm, permanent) && perm.isEnchantment()) { - perm.destroy(source.getSourceId(), game, false); + perm.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/e/EchoingRuin.java b/Mage.Sets/src/mage/cards/e/EchoingRuin.java index c740314fb50..40d699a3453 100644 --- a/Mage.Sets/src/mage/cards/e/EchoingRuin.java +++ b/Mage.Sets/src/mage/cards/e/EchoingRuin.java @@ -64,11 +64,11 @@ class EchoingRuinEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (!CardUtil.haveEmptyName(permanent)) { // in case of face down artifact creature for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (!perm.getId().equals(permanent.getId()) && CardUtil.haveSameNames(perm, permanent) && perm.isArtifact()) { - perm.destroy(source.getSourceId(), game, false); + perm.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/e/EdricSpymasterOfTrest.java b/Mage.Sets/src/mage/cards/e/EdricSpymasterOfTrest.java index 57e194e74fc..fe901c17e1b 100644 --- a/Mage.Sets/src/mage/cards/e/EdricSpymasterOfTrest.java +++ b/Mage.Sets/src/mage/cards/e/EdricSpymasterOfTrest.java @@ -63,7 +63,7 @@ class EdricSpymasterOfTrestTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EerieUltimatum.java b/Mage.Sets/src/mage/cards/e/EerieUltimatum.java index 2e851e7cb53..40fcf5ec534 100644 --- a/Mage.Sets/src/mage/cards/e/EerieUltimatum.java +++ b/Mage.Sets/src/mage/cards/e/EerieUltimatum.java @@ -93,8 +93,8 @@ class EerieUltimatumTarget extends TargetCardInYourGraveyard { } @Override - public Set possibleTargets(UUID sourceId, UUID playerId, Game game) { - Set possibleTargets = super.possibleTargets(sourceId, playerId, game); + public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { + Set possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set names = this.getTargets() .stream() .map(game::getCard) diff --git a/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java b/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java index 0f71859daea..2760d776684 100644 --- a/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java +++ b/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java @@ -86,10 +86,10 @@ class EfreetWeaponmasterAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TURNEDFACEUP && event.getTargetId().equals(this.getSourceId())) { + if (event.getType() == GameEvent.EventType.TURNEDFACEUP && event.getTargetId().equals(this.getSourceId())) { return true; } - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) { Permanent sourcePermanent = game.getPermanent(getSourceId()); if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; diff --git a/Mage.Sets/src/mage/cards/e/EidolonOfTheGreatRevel.java b/Mage.Sets/src/mage/cards/e/EidolonOfTheGreatRevel.java index e11ef555852..fcbf5ea73d1 100644 --- a/Mage.Sets/src/mage/cards/e/EidolonOfTheGreatRevel.java +++ b/Mage.Sets/src/mage/cards/e/EidolonOfTheGreatRevel.java @@ -65,7 +65,7 @@ class EidolonOfTheGreatRevelTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/e/ElbrusTheBindingBlade.java b/Mage.Sets/src/mage/cards/e/ElbrusTheBindingBlade.java index 7c88a09f721..b6775d35ae7 100644 --- a/Mage.Sets/src/mage/cards/e/ElbrusTheBindingBlade.java +++ b/Mage.Sets/src/mage/cards/e/ElbrusTheBindingBlade.java @@ -69,7 +69,7 @@ class ElbrusTheBindingBladeEffect extends OneShotEffect { if (equipment != null && equipment.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(equipment.getAttachedTo()); if (attachedTo != null) { - attachedTo.removeAttachment(equipment.getId(), game); + attachedTo.removeAttachment(equipment.getId(), source, game); equipment.transform(game); game.informPlayers(equipment.getName() + " transforms into " + equipment.getSecondCardFace().getName()); diff --git a/Mage.Sets/src/mage/cards/e/ElderSpawn.java b/Mage.Sets/src/mage/cards/e/ElderSpawn.java index 58bac1b7490..9c5e5faac6b 100644 --- a/Mage.Sets/src/mage/cards/e/ElderSpawn.java +++ b/Mage.Sets/src/mage/cards/e/ElderSpawn.java @@ -85,10 +85,10 @@ class ElderSpawnEffect extends OneShotEffect { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); SacrificeTargetCost cost = new SacrificeTargetCost(target); if (!controller.chooseUse(Outcome.AIDontUseIt, "Do you wish to sacrifice an Island?", source, game) - || !cost.canPay(source, source.getSourceId(), source.getControllerId(), game) - || !cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { - sourcePermanent.sacrifice(source.getSourceId(), game); - controller.damage(6, sourcePermanent.getId(), game); + || !cost.canPay(source, source, source.getControllerId(), game) + || !cost.pay(source, game, source, source.getControllerId(), true)) { + sourcePermanent.sacrifice(source, game); + controller.damage(6, sourcePermanent.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EldraziMonument.java b/Mage.Sets/src/mage/cards/e/EldraziMonument.java index e909c195b4c..2ce3be566c7 100644 --- a/Mage.Sets/src/mage/cards/e/EldraziMonument.java +++ b/Mage.Sets/src/mage/cards/e/EldraziMonument.java @@ -78,16 +78,16 @@ class EldraziMonumentEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { TargetControlledPermanent target = new TargetControlledCreaturePermanent(); Player player = game.getPlayer(source.getControllerId()); - if (target.canChoose(source.getControllerId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { player.choose(this.outcome, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } return false; diff --git a/Mage.Sets/src/mage/cards/e/Electropotence.java b/Mage.Sets/src/mage/cards/e/Electropotence.java index daed57257c4..bc8ca0188ce 100644 --- a/Mage.Sets/src/mage/cards/e/Electropotence.java +++ b/Mage.Sets/src/mage/cards/e/Electropotence.java @@ -56,7 +56,7 @@ class ElectropotenceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -105,16 +105,16 @@ class ElectropotenceEffect extends OneShotEffect { if (controller.chooseUse(Outcome.Damage, "Pay {2}{R} to do the damage?", source, game)) { // if (controller.chooseUse(Outcome.Damage, "Pay {2}{R}? If you do, " + creature.getName() + " deals damage equal to its power to any target.", game)) { ManaCosts manaCosts = new ManaCostsImpl("{2}{R}"); - if (manaCosts.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { + if (manaCosts.pay(source, game, source, controller.getId(), false, null)) { int amount = creature.getPower().getValue(); UUID target = source.getTargets().getFirstTarget(); Permanent targetCreature = game.getPermanent(target); if (targetCreature != null) { - targetCreature.damage(amount, creature.getId(), game, false, true); + targetCreature.damage(amount, creature.getId(), source, game, false, true); } else { Player player = game.getPlayer(target); if (player != null) { - player.damage(amount, creature.getId(), game); + player.damage(amount, creature.getId(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/e/ElectrostaticBolt.java b/Mage.Sets/src/mage/cards/e/ElectrostaticBolt.java index f1a161c2d6a..3514533e043 100644 --- a/Mage.Sets/src/mage/cards/e/ElectrostaticBolt.java +++ b/Mage.Sets/src/mage/cards/e/ElectrostaticBolt.java @@ -49,8 +49,8 @@ class ElectrostaticBoltDamageValue implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { - Permanent targetPermanent = game.getPermanent(source.getFirstTarget()); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Permanent targetPermanent = game.getPermanent(sourceAbility.getFirstTarget()); if(targetPermanent != null) { if(filter.match(targetPermanent, game)) { return 4; diff --git a/Mage.Sets/src/mage/cards/e/Electryte.java b/Mage.Sets/src/mage/cards/e/Electryte.java index 6fa756cb171..dd7f4f857a4 100644 --- a/Mage.Sets/src/mage/cards/e/Electryte.java +++ b/Mage.Sets/src/mage/cards/e/Electryte.java @@ -93,7 +93,7 @@ class ElectryteEffect extends OneShotEffect { int amount = thisCreature.getPower().getValue(); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EligethCrossroadsAugur.java b/Mage.Sets/src/mage/cards/e/EligethCrossroadsAugur.java index 37ef12d0252..95672a89543 100644 --- a/Mage.Sets/src/mage/cards/e/EligethCrossroadsAugur.java +++ b/Mage.Sets/src/mage/cards/e/EligethCrossroadsAugur.java @@ -80,7 +80,7 @@ class EligethCrossroadsAugurReplacementEffect extends ReplacementEffectImpl { if (player == null) { return false; } - player.drawCards(event.getAmount(), event.getSourceId(), game); + player.drawCards(event.getAmount(), source, game); // original event is not a draw event, so skip it in params return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/e/EliteArcanist.java b/Mage.Sets/src/mage/cards/e/EliteArcanist.java index a0beef69e25..1b7b87c6eba 100644 --- a/Mage.Sets/src/mage/cards/e/EliteArcanist.java +++ b/Mage.Sets/src/mage/cards/e/EliteArcanist.java @@ -107,7 +107,7 @@ class EliteArcanistImprintEffect extends OneShotEffect { && player.choose(Outcome.Benefit, player.getHand(), target, game)) { Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - card.moveToExile(source.getSourceId(), "Elite Arcanist", source.getSourceId(), game); + card.moveToExile(source.getSourceId(), "Elite Arcanist", source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); diff --git a/Mage.Sets/src/mage/cards/e/ElixirOfImmortality.java b/Mage.Sets/src/mage/cards/e/ElixirOfImmortality.java index 4922aa8c884..f38761ec41e 100644 --- a/Mage.Sets/src/mage/cards/e/ElixirOfImmortality.java +++ b/Mage.Sets/src/mage/cards/e/ElixirOfImmortality.java @@ -60,10 +60,10 @@ class ElixerOfImmortalityEffect extends OneShotEffect { if (player != null) { player.gainLife(5, game, source); if (permanent != null) { - player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + player.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, true, true); } for (Card card: player.getGraveyard().getCards(game)) { - player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + player.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/e/ElspethTirel.java b/Mage.Sets/src/mage/cards/e/ElspethTirel.java index ed76463bb32..4c349376f17 100644 --- a/Mage.Sets/src/mage/cards/e/ElspethTirel.java +++ b/Mage.Sets/src/mage/cards/e/ElspethTirel.java @@ -91,7 +91,7 @@ class ElspethTirelThirdEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (!perm.getId().equals(source.getSourceId()) && !(perm instanceof PermanentToken) && !(perm.isLand())) { - perm.destroy(source.getSourceId(), game, false); + perm.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/e/ElvishGuidance.java b/Mage.Sets/src/mage/cards/e/ElvishGuidance.java index 6f8fabb5b33..b12318fb617 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishGuidance.java +++ b/Mage.Sets/src/mage/cards/e/ElvishGuidance.java @@ -80,7 +80,11 @@ class ElvishGuidanceTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + return enchantedLand != null && enchantedLand.isLand(); + } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/e/ElvishImpersonators.java b/Mage.Sets/src/mage/cards/e/ElvishImpersonators.java index 484db9ede3a..54a4ba63d4c 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishImpersonators.java +++ b/Mage.Sets/src/mage/cards/e/ElvishImpersonators.java @@ -63,8 +63,8 @@ class ElvishImpersonatorsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int firstRoll = controller.rollDice(game, 6); - int secondRoll = controller.rollDice(game, 6); + int firstRoll = controller.rollDice(source, game, 6); + int secondRoll = controller.rollDice(source, game, 6); game.addEffect(new SetPowerToughnessSourceEffect(firstRoll, secondRoll, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); return true; } diff --git a/Mage.Sets/src/mage/cards/e/ElvishSpiritGuide.java b/Mage.Sets/src/mage/cards/e/ElvishSpiritGuide.java index fb17703a71e..401225fee2a 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishSpiritGuide.java +++ b/Mage.Sets/src/mage/cards/e/ElvishSpiritGuide.java @@ -57,19 +57,19 @@ class ExileSourceFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Card card = game.getCard(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Card card = game.getCard(source.getSourceId()); Player player = game.getPlayer(controllerId); - if (player != null && player.getHand().contains(sourceId) && card != null) { - paid = card.moveToExile(ability.getSourceId(), "from Hand", ability.getSourceId(), game); + if (player != null && player.getHand().contains(source.getSourceId()) && card != null) { + paid = card.moveToExile(ability.getSourceId(), "from Hand", source, game); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); - if (player != null && player.getHand().contains(sourceId)) { + if (player != null && player.getHand().contains(source.getSourceId())) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/e/EmberGale.java b/Mage.Sets/src/mage/cards/e/EmberGale.java index 7bf5fe1b94c..6006d5b0e26 100644 --- a/Mage.Sets/src/mage/cards/e/EmberGale.java +++ b/Mage.Sets/src/mage/cards/e/EmberGale.java @@ -78,7 +78,7 @@ class EmberGaleEffect extends OneShotEffect { new ColorPredicate(ObjectColor.BLUE))); filter2.add(CardType.CREATURE.getPredicate()); for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter2, targetPlayer.getId(), game)) { - creature.damage(1, source.getSourceId(), game, false, true); + creature.damage(1, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/Embersmith.java b/Mage.Sets/src/mage/cards/e/Embersmith.java index 31a73cb4fa4..bf89217826d 100644 --- a/Mage.Sets/src/mage/cards/e/Embersmith.java +++ b/Mage.Sets/src/mage/cards/e/Embersmith.java @@ -60,15 +60,15 @@ class EmbersmithEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Cost cost = ManaUtil.createManaCost(1, false); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(1, source.getSourceId(), game, false, true); + permanent.damage(1, source.getSourceId(), source, game, false, true); return true; } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(1, source.getSourceId(), game); + player.damage(1, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/e/EmberwildeCaliph.java b/Mage.Sets/src/mage/cards/e/EmberwildeCaliph.java index fe2e9d1f882..22657cd86ad 100644 --- a/Mage.Sets/src/mage/cards/e/EmberwildeCaliph.java +++ b/Mage.Sets/src/mage/cards/e/EmberwildeCaliph.java @@ -115,7 +115,7 @@ class EmberwildeCaliphEffect extends OneShotEffect { if (controller != null) { int amount = (Integer) getValue("damage"); if (amount > 0) { - controller.loseLife(amount, game, false); + controller.loseLife(amount, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EmberwildeCaptain.java b/Mage.Sets/src/mage/cards/e/EmberwildeCaptain.java index a1c9f4ad4d3..d16941b8b24 100644 --- a/Mage.Sets/src/mage/cards/e/EmberwildeCaptain.java +++ b/Mage.Sets/src/mage/cards/e/EmberwildeCaptain.java @@ -102,6 +102,6 @@ class EmberwildeCaptainEffect extends OneShotEffect { if (player == null || player.getHand().size() < 1) { return false; } - return player.damage(player.getHand().size(), source.getSourceId(), game) > 0; + return player.damage(player.getHand().size(), source.getSourceId(), source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java b/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java index 19879c3dca7..73cefee75ef 100644 --- a/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java +++ b/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java @@ -80,7 +80,7 @@ class EmberwildeDjinnEffect extends OneShotEffect { } Cost cost = new OrCost(new ManaCostsImpl("{R}{R}"), new PayLifeCost(2), "{R}{R} or 2 life"); if (player.chooseUse(Outcome.GainControl, "Gain control of " + sourceObject.getLogName() + "?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source, player.getId(), false)) { ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, false, player.getId()); effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/e/EmeriaTheSkyRuin.java b/Mage.Sets/src/mage/cards/e/EmeriaTheSkyRuin.java index aadd23c6393..5f3ab7a4cd5 100644 --- a/Mage.Sets/src/mage/cards/e/EmeriaTheSkyRuin.java +++ b/Mage.Sets/src/mage/cards/e/EmeriaTheSkyRuin.java @@ -70,7 +70,7 @@ class EmeriaTheSkyRuinTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EmpyrialArchangel.java b/Mage.Sets/src/mage/cards/e/EmpyrialArchangel.java index d5448874526..b5c8faa603c 100644 --- a/Mage.Sets/src/mage/cards/e/EmpyrialArchangel.java +++ b/Mage.Sets/src/mage/cards/e/EmpyrialArchangel.java @@ -62,9 +62,9 @@ class EmpyrialArchangelEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; - Permanent p = game.getPermanent(source.getSourceId()); - if (p != null) { - p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + permanent.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EmrakulsEvangel.java b/Mage.Sets/src/mage/cards/e/EmrakulsEvangel.java index 0ab6e19089e..03278f85aa7 100644 --- a/Mage.Sets/src/mage/cards/e/EmrakulsEvangel.java +++ b/Mage.Sets/src/mage/cards/e/EmrakulsEvangel.java @@ -76,17 +76,17 @@ class EmrakulsEvangelCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent selfPermanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent selfPermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(controllerId); if (selfPermanent != null && player != null) { - paid = selfPermanent.sacrifice(sourceId, game); // sacrifice self + paid = selfPermanent.sacrifice(source, game); // sacrifice self Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true); player.chooseTarget(Outcome.Sacrifice, target, ability, game); for (UUID permanentId : target.getTargets()) { Permanent otherPermanent = game.getPermanent(permanentId); if (otherPermanent != null) { - if (otherPermanent.sacrifice(sourceId, game)) { + if (otherPermanent.sacrifice(source, game)) { numSacrificed++; } } @@ -100,10 +100,9 @@ class EmrakulsEvangelCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); - - return permanent != null && game.getPlayer(controllerId).canPaySacrificeCost(permanent, sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); + return permanent != null && game.getPlayer(controllerId).canPaySacrificeCost(permanent, source, controllerId, game); } @Override @@ -140,7 +139,7 @@ class EmrakulsEvangelEffect extends OneShotEffect { } if (tokensToCreate > 0) { EldraziHorrorToken token = new EldraziHorrorToken(); - token.putOntoBattlefield(tokensToCreate, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(tokensToCreate, game, source, source.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EnchantersBane.java b/Mage.Sets/src/mage/cards/e/EnchantersBane.java index b1fc39da9cd..0f4cbaf8eb3 100644 --- a/Mage.Sets/src/mage/cards/e/EnchantersBane.java +++ b/Mage.Sets/src/mage/cards/e/EnchantersBane.java @@ -70,9 +70,9 @@ class EnchantersBaneEffect extends OneShotEffect { return false; } if (player.chooseUse(Outcome.GainLife, "Sacrifice " + permanent.getLogName() + "?", source, game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } else { - player.damage(permanent.getConvertedManaCost(), permanent.getId(), game); + player.damage(permanent.getConvertedManaCost(), permanent.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EnchantmentAlteration.java b/Mage.Sets/src/mage/cards/e/EnchantmentAlteration.java index 7a53b0138fd..93afda62b97 100644 --- a/Mage.Sets/src/mage/cards/e/EnchantmentAlteration.java +++ b/Mage.Sets/src/mage/cards/e/EnchantmentAlteration.java @@ -131,9 +131,9 @@ class EnchantmentAlterationEffect extends OneShotEffect { Target auraTarget = aura.getSpellAbility().getTargets().get(0); if (!auraTarget.canTarget(permanentToBeAttachedTo.getId(), game)) { game.informPlayers(aura.getLogName() + " was not attched to " + permanentToBeAttachedTo.getLogName() + " because it's no legal target for the aura"); - } else if (oldPermanent.removeAttachment(aura.getId(), game)) { + } else if (oldPermanent.removeAttachment(aura.getId(), source, game)) { game.informPlayers(aura.getLogName() + " was unattached from " + oldPermanent.getLogName() + " and attached to " + permanentToBeAttachedTo.getLogName()); - permanentToBeAttachedTo.addAttachment(aura.getId(), game); + permanentToBeAttachedTo.addAttachment(aura.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/e/EndHostilities.java b/Mage.Sets/src/mage/cards/e/EndHostilities.java index af4eb727317..bbbc6636345 100644 --- a/Mage.Sets/src/mage/cards/e/EndHostilities.java +++ b/Mage.Sets/src/mage/cards/e/EndHostilities.java @@ -71,7 +71,7 @@ class EndHostilitiesEffect extends OneShotEffect { } } for (Permanent permanent : toDestroy){ - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EndlessHorizons.java b/Mage.Sets/src/mage/cards/e/EndlessHorizons.java index 7f598e80c6a..c01af2c8af7 100644 --- a/Mage.Sets/src/mage/cards/e/EndlessHorizons.java +++ b/Mage.Sets/src/mage/cards/e/EndlessHorizons.java @@ -79,7 +79,7 @@ class EndlessHorizonsEffect extends SearchEffect { for (UUID cardId : target.getTargets()) { Card card = you.getLibrary().getCard(cardId, game); if (card != null) { - card.moveToExile(exileZone, "Endless Horizons", source.getSourceId(), game); + card.moveToExile(exileZone, "Endless Horizons", source, game); } } } diff --git a/Mage.Sets/src/mage/cards/e/EnduringRenewal.java b/Mage.Sets/src/mage/cards/e/EnduringRenewal.java index 3782aca73df..e9021a296fa 100644 --- a/Mage.Sets/src/mage/cards/e/EnduringRenewal.java +++ b/Mage.Sets/src/mage/cards/e/EnduringRenewal.java @@ -87,7 +87,7 @@ class EnduringRenewalReplacementEffect extends ReplacementEffectImpl { controller.moveCards(card, Zone.GRAVEYARD, source, game); } else { // This is still replacing the draw, so we still return true - controller.drawCards(1, source.getSourceId(), game, event.getAppliedEffects()); + controller.drawCards(1, source, game, event); } return true; } @@ -156,7 +156,7 @@ class EnduringRenewalEffect extends OneShotEffect { if (creature != null) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - creature.moveToZone(Zone.HAND, source.getSourceId(), game, false); + creature.moveToZone(Zone.HAND, source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EnergyField.java b/Mage.Sets/src/mage/cards/e/EnergyField.java index 1b5fb3d65cf..7488ac5ee28 100644 --- a/Mage.Sets/src/mage/cards/e/EnergyField.java +++ b/Mage.Sets/src/mage/cards/e/EnergyField.java @@ -15,6 +15,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import java.util.Objects; import java.util.UUID; @@ -59,12 +60,12 @@ class EnergyFieldEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); game.informPlayers("Damage has been prevented: " + damage); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/e/EnergyTap.java b/Mage.Sets/src/mage/cards/e/EnergyTap.java index 0b8e57fcd82..59c83babac1 100644 --- a/Mage.Sets/src/mage/cards/e/EnergyTap.java +++ b/Mage.Sets/src/mage/cards/e/EnergyTap.java @@ -72,7 +72,7 @@ class EnergyTapEffect extends OneShotEffect { boolean applied = false; Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { - applied = targetCreature.tap(game); + applied = targetCreature.tap(source, game); if (applied) { player.getManaPool().addMana(new Mana(0, 0, 0, 0, 0, 0, 0, targetCreature.getConvertedManaCost()), game, source); } diff --git a/Mage.Sets/src/mage/cards/e/EnergyVortex.java b/Mage.Sets/src/mage/cards/e/EnergyVortex.java index 620bd4f6e92..986f4a45ac3 100644 --- a/Mage.Sets/src/mage/cards/e/EnergyVortex.java +++ b/Mage.Sets/src/mage/cards/e/EnergyVortex.java @@ -103,9 +103,9 @@ class EnergyVortexEffect extends OneShotEffect { } int counters = permanent.getCounters(game).getCount(CounterType.VORTEX); Cost cost = ManaUtil.createManaCost(counters, false); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source, player.getId(), false)) { return true; } - return player.damage(3, source.getSourceId(), game) > 0; + return player.damage(3, source.getSourceId(), source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/e/EngineeredExplosives.java b/Mage.Sets/src/mage/cards/e/EngineeredExplosives.java index 936d8387677..d187e3042b5 100644 --- a/Mage.Sets/src/mage/cards/e/EngineeredExplosives.java +++ b/Mage.Sets/src/mage/cards/e/EngineeredExplosives.java @@ -74,7 +74,7 @@ class EngineeredExplosivesEffect extends OneShotEffect { int count = ((Permanent)engineeredExplosives).getCounters(game).getCount(CounterType.CHARGE); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if(permanent.getConvertedManaCost() == count){ - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/e/EnhancedSurveillance.java b/Mage.Sets/src/mage/cards/e/EnhancedSurveillance.java index 2e0b263015b..b23bd81eafd 100644 --- a/Mage.Sets/src/mage/cards/e/EnhancedSurveillance.java +++ b/Mage.Sets/src/mage/cards/e/EnhancedSurveillance.java @@ -103,7 +103,7 @@ class EnhancedSurveillanceShuffleEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Card card : controller.getGraveyard().getCards(game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java b/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java index cfc5ec283e6..632b928c33b 100644 --- a/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java +++ b/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java @@ -77,7 +77,7 @@ class EnigmaSphinxTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EnigmaticIncarnation.java b/Mage.Sets/src/mage/cards/e/EnigmaticIncarnation.java index d08212116be..04ef30ed867 100644 --- a/Mage.Sets/src/mage/cards/e/EnigmaticIncarnation.java +++ b/Mage.Sets/src/mage/cards/e/EnigmaticIncarnation.java @@ -89,7 +89,7 @@ class EnigmaticIncarnationEffect extends OneShotEffect { } game.getState().processAction(game); int cmc = permanent.getConvertedManaCost(); - if (!permanent.sacrifice(source.getSourceId(), game)) { + if (!permanent.sacrifice(source, game)) { return false; } FilterCard filterCard = new FilterCreatureCard("creature card with converted mana cost " + (cmc + 1)); diff --git a/Mage.Sets/src/mage/cards/e/Enslave.java b/Mage.Sets/src/mage/cards/e/Enslave.java index 042808dd418..c9710b92b7b 100644 --- a/Mage.Sets/src/mage/cards/e/Enslave.java +++ b/Mage.Sets/src/mage/cards/e/Enslave.java @@ -71,7 +71,7 @@ class EnslaveEffect extends OneShotEffect { if (attached != null) { Player owner = game.getPlayer(attached.getOwnerId()); if (owner != null) { - owner.damage(1, attached.getId(), game); + owner.damage(1, attached.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/e/EnslavedHorror.java b/Mage.Sets/src/mage/cards/e/EnslavedHorror.java index 8ca19138895..84d53b22dd4 100644 --- a/Mage.Sets/src/mage/cards/e/EnslavedHorror.java +++ b/Mage.Sets/src/mage/cards/e/EnslavedHorror.java @@ -78,7 +78,7 @@ class EnslavedHorrorEffect extends OneShotEffect { filterCreatureCard.add(new OwnerIdPredicate(playerId)); TargetCardInGraveyard target = new TargetCardInGraveyard(0, 1, filterCreatureCard); target.setNotTarget(true); - if (target.canChoose(playerId, game) + if (target.canChoose(source.getSourceId(), playerId, game) && player.chooseTarget(outcome, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/e/EntanglingTrap.java b/Mage.Sets/src/mage/cards/e/EntanglingTrap.java index a80629f9699..83e0729453f 100644 --- a/Mage.Sets/src/mage/cards/e/EntanglingTrap.java +++ b/Mage.Sets/src/mage/cards/e/EntanglingTrap.java @@ -68,7 +68,7 @@ class EntanglingTrapTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.CLASHED; + return event.getType() == GameEvent.EventType.CLASHED; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EnterTheGodEternals.java b/Mage.Sets/src/mage/cards/e/EnterTheGodEternals.java index 352c2812c8f..4ac5d3bd534 100644 --- a/Mage.Sets/src/mage/cards/e/EnterTheGodEternals.java +++ b/Mage.Sets/src/mage/cards/e/EnterTheGodEternals.java @@ -66,7 +66,7 @@ class EnterTheGodEternalsEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - controller.gainLife(permanent.damage(4, source.getSourceId(), game), game, source); + controller.gainLife(permanent.damage(4, source.getSourceId(), source, game), game, source); continue; } Player player = game.getPlayer(targetId); diff --git a/Mage.Sets/src/mage/cards/e/EntomberExarch.java b/Mage.Sets/src/mage/cards/e/EntomberExarch.java index f424b55ff6c..b44b5e8cd2c 100644 --- a/Mage.Sets/src/mage/cards/e/EntomberExarch.java +++ b/Mage.Sets/src/mage/cards/e/EntomberExarch.java @@ -76,7 +76,7 @@ class EntomberExarchEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_A_NON_CREATURE); if (you.choose(Outcome.Benefit, player.getHand(), target, game)) { Card card = player.getHand().get(target.getFirstTarget(), game); - return player.discard(card, source, game); + return player.discard(card, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/e/EntrailsFeaster.java b/Mage.Sets/src/mage/cards/e/EntrailsFeaster.java index 90b8131918f..da44cccf936 100644 --- a/Mage.Sets/src/mage/cards/e/EntrailsFeaster.java +++ b/Mage.Sets/src/mage/cards/e/EntrailsFeaster.java @@ -81,10 +81,10 @@ class EntrailsFeasterEffect extends OneShotEffect { } } } else if (sourceObject != null) { - sourceObject.tap(game); + sourceObject.tap(source, game); } } else if (sourceObject != null) { - sourceObject.tap(game); + sourceObject.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EntrapmentManeuver.java b/Mage.Sets/src/mage/cards/e/EntrapmentManeuver.java index 846af092c69..e15f97c9a80 100644 --- a/Mage.Sets/src/mage/cards/e/EntrapmentManeuver.java +++ b/Mage.Sets/src/mage/cards/e/EntrapmentManeuver.java @@ -70,13 +70,13 @@ class EntrapmentManeuverSacrificeEffect extends OneShotEffect { int realCount = game.getBattlefield().countAll(filter, player.getId(), game); if (realCount > 0) { Target target = new TargetControlledPermanent(1, 1, filter, true); - while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { int amount = permanent.getToughness().getValue(); - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); new CreateTokenEffect(new SoldierToken(), amount).apply(game, source); } else{ return false; diff --git a/Mage.Sets/src/mage/cards/e/EonHub.java b/Mage.Sets/src/mage/cards/e/EonHub.java index fbdd5d1acb8..0b9486bacbc 100644 --- a/Mage.Sets/src/mage/cards/e/EonHub.java +++ b/Mage.Sets/src/mage/cards/e/EonHub.java @@ -62,7 +62,7 @@ class SkipUpkeepStepEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP; + return event.getType() == GameEvent.EventType.UPKEEP_STEP; } @Override diff --git a/Mage.Sets/src/mage/cards/e/Epicenter.java b/Mage.Sets/src/mage/cards/e/Epicenter.java index 72b49d644ae..36947cf9718 100644 --- a/Mage.Sets/src/mage/cards/e/Epicenter.java +++ b/Mage.Sets/src/mage/cards/e/Epicenter.java @@ -70,7 +70,7 @@ class EpicenterEffect extends OneShotEffect { while (permanents.hasNext()) { Permanent p = permanents.next(); if (p.isLand()) { - p.sacrifice(source.getSourceId(), game); + p.sacrifice(source, game); } } diff --git a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java index e1b8c901edf..0237ce7f687 100644 --- a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java +++ b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java @@ -124,7 +124,7 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect { if (i < pile1CardsIds.size()) { sb.append(", "); } - card.moveToZone(pile1Zone, source.getSourceId(), game, false); + card.moveToZone(pile1Zone, source, game, false); } } game.informPlayers(sb.toString()); @@ -139,7 +139,7 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect { if (i < pile2CardsIds.size()) { sb.append(", "); } - card.moveToZone(pile2Zone, source.getSourceId(), game, false); + card.moveToZone(pile2Zone, source, game, false); } } game.informPlayers(sb.toString()); diff --git a/Mage.Sets/src/mage/cards/e/Epochrasite.java b/Mage.Sets/src/mage/cards/e/Epochrasite.java index f0c0c3cdd09..75e4564324c 100644 --- a/Mage.Sets/src/mage/cards/e/Epochrasite.java +++ b/Mage.Sets/src/mage/cards/e/Epochrasite.java @@ -82,7 +82,7 @@ class EpochrasiteEffect extends OneShotEffect { if (controller != null && card != null) { if (game.getState().getZone(card.getId()) == Zone.GRAVEYARD) { UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); - controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source, game, Zone.GRAVEYARD, true); card.addCounters(CounterType.TIME.createInstance(3), source, game); game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source); } diff --git a/Mage.Sets/src/mage/cards/e/ErayoSoratamiAscendant.java b/Mage.Sets/src/mage/cards/e/ErayoSoratamiAscendant.java index 6841c7760f4..eff730b9aed 100644 --- a/Mage.Sets/src/mage/cards/e/ErayoSoratamiAscendant.java +++ b/Mage.Sets/src/mage/cards/e/ErayoSoratamiAscendant.java @@ -73,7 +73,7 @@ class ErayoSoratamiAscendantTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -128,7 +128,7 @@ class ErayosEssenceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/e/ErdwalIlluminator.java b/Mage.Sets/src/mage/cards/e/ErdwalIlluminator.java index bca010845b8..93e3058cc13 100644 --- a/Mage.Sets/src/mage/cards/e/ErdwalIlluminator.java +++ b/Mage.Sets/src/mage/cards/e/ErdwalIlluminator.java @@ -61,7 +61,7 @@ class ErdwalIlluminatorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.INVESTIGATED; + return event.getType() == GameEvent.EventType.INVESTIGATED; } @Override @@ -91,7 +91,7 @@ class InvestigatedWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.INVESTIGATED) { + if (event.getType() == GameEvent.EventType.INVESTIGATED) { timesInvestigated.put(event.getPlayerId(), getTimesInvestigated(event.getPlayerId()) + 1); } diff --git a/Mage.Sets/src/mage/cards/e/ErraticExplosion.java b/Mage.Sets/src/mage/cards/e/ErraticExplosion.java index 0476b314d67..031e3d73b20 100644 --- a/Mage.Sets/src/mage/cards/e/ErraticExplosion.java +++ b/Mage.Sets/src/mage/cards/e/ErraticExplosion.java @@ -72,11 +72,11 @@ class ErraticExplosionEffect extends OneShotEffect { if (nonLandCard != null) { Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(nonLandCard.getConvertedManaCost(), source.getSourceId(), game, false, true); + targetCreature.damage(nonLandCard.getConvertedManaCost(), source.getSourceId(), source, game, false, true); } else { Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(nonLandCard.getConvertedManaCost(), source.getSourceId(), game); + targetPlayer.damage(nonLandCard.getConvertedManaCost(), source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/e/ErraticPortal.java b/Mage.Sets/src/mage/cards/e/ErraticPortal.java index 6a5e2b96539..4e8c1bdf6a8 100644 --- a/Mage.Sets/src/mage/cards/e/ErraticPortal.java +++ b/Mage.Sets/src/mage/cards/e/ErraticPortal.java @@ -75,7 +75,7 @@ class ErraticPortalEffect extends OneShotEffect { if (player != null) { cost.clearPaid(); if (player.chooseUse(Outcome.Benefit, "Pay {1}? (Otherwise " + targetCreature.getLogName() +" will be returned to its owner's hand)", source, game)) { - cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false, null); + cost.pay(source, game, source, targetCreature.getControllerId(), false, null); } if (!cost.isPaid()) { controller.moveCards(targetCreature, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/e/EscapePod.java b/Mage.Sets/src/mage/cards/e/EscapePod.java index 445a28959ce..f31193fb895 100644 --- a/Mage.Sets/src/mage/cards/e/EscapePod.java +++ b/Mage.Sets/src/mage/cards/e/EscapePod.java @@ -58,7 +58,7 @@ class EscapePodEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); MageObject sourceObject = game.getObject(source.getSourceId()); if (permanent != null && sourceObject != null) { - if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source, game)) { Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect(); effect.setText("Return that card to the battlefield under your control at the beginning of the next end step"); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game)); diff --git a/Mage.Sets/src/mage/cards/e/EssenceBacklash.java b/Mage.Sets/src/mage/cards/e/EssenceBacklash.java index 50410118aa6..6988508498c 100644 --- a/Mage.Sets/src/mage/cards/e/EssenceBacklash.java +++ b/Mage.Sets/src/mage/cards/e/EssenceBacklash.java @@ -60,9 +60,9 @@ class EssenceBacklashEffect extends OneShotEffect { if (spell != null) { Player spellController = game.getPlayer(spell.getControllerId()); - result = game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + result = game.getStack().counter(source.getFirstTarget(), source, game); if (spellController != null) { - spellController.damage(spell.getPower().getValue(), source.getSourceId(), game); + spellController.damage(spell.getPower().getValue(), source.getSourceId(), source, game); } } return result; diff --git a/Mage.Sets/src/mage/cards/e/EssenceFilter.java b/Mage.Sets/src/mage/cards/e/EssenceFilter.java index 9fbc297cb8b..9fcfd7cde9d 100644 --- a/Mage.Sets/src/mage/cards/e/EssenceFilter.java +++ b/Mage.Sets/src/mage/cards/e/EssenceFilter.java @@ -67,11 +67,11 @@ class EssenceFilterEffect extends OneShotEffect { if (controller != null) { if (controller.chooseUse(outcome, "Destroy all enchantments? (otherwise all nonwhite enchantments are destroyed)", source, game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterEnchantmentPermanent(), controller.getId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } else { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, controller.getId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/e/EssenceHarvest.java b/Mage.Sets/src/mage/cards/e/EssenceHarvest.java index 797058f9742..56474bf5de1 100644 --- a/Mage.Sets/src/mage/cards/e/EssenceHarvest.java +++ b/Mage.Sets/src/mage/cards/e/EssenceHarvest.java @@ -71,7 +71,7 @@ class EssenceHarvestEffect extends OneShotEffect { } if (amount > 0) { - targetPlayer.loseLife(amount, game, false); + targetPlayer.loseLife(amount, game, source, false); controller.gainLife(amount, game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/e/EssenceLeak.java b/Mage.Sets/src/mage/cards/e/EssenceLeak.java index de8fa2ea548..cc9ec12bcd8 100644 --- a/Mage.Sets/src/mage/cards/e/EssenceLeak.java +++ b/Mage.Sets/src/mage/cards/e/EssenceLeak.java @@ -82,11 +82,11 @@ class EssenceLeakEffect extends OneShotEffect { Cost cost = permanent.getManaCost().copy(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/e/EssenceOfTheWild.java b/Mage.Sets/src/mage/cards/e/EssenceOfTheWild.java index c2dab424d6a..fc111ea06c5 100644 --- a/Mage.Sets/src/mage/cards/e/EssenceOfTheWild.java +++ b/Mage.Sets/src/mage/cards/e/EssenceOfTheWild.java @@ -53,7 +53,7 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EssenceSliver.java b/Mage.Sets/src/mage/cards/e/EssenceSliver.java index 99a87899989..2b06d95d904 100644 --- a/Mage.Sets/src/mage/cards/e/EssenceSliver.java +++ b/Mage.Sets/src/mage/cards/e/EssenceSliver.java @@ -65,9 +65,9 @@ class DealsDamageAllTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EssenceVortex.java b/Mage.Sets/src/mage/cards/e/EssenceVortex.java index 72256d73941..29dc5cda4b5 100644 --- a/Mage.Sets/src/mage/cards/e/EssenceVortex.java +++ b/Mage.Sets/src/mage/cards/e/EssenceVortex.java @@ -61,9 +61,9 @@ class EssenceVortexEffect extends OneShotEffect { return false; } Cost cost = new PayLifeCost(permanent.getToughness().getValue()); - if (cost.pay(source, game, source.getSourceId(), permanent.getControllerId(), true)) { + if (cost.pay(source, game, source, permanent.getControllerId(), true)) { return true; } - return permanent.destroy(source.getSourceId(), game, true); + return permanent.destroy(source, game, true); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/e/EstridTheMasked.java b/Mage.Sets/src/mage/cards/e/EstridTheMasked.java index 68ccc77bc97..380f92adf32 100644 --- a/Mage.Sets/src/mage/cards/e/EstridTheMasked.java +++ b/Mage.Sets/src/mage/cards/e/EstridTheMasked.java @@ -108,7 +108,6 @@ class EstridTheMaskedTokenEffect extends OneShotEffect { } token.getAbilities().get(0).getTargets().get(0).add(source.getFirstTarget(), game); token.getAbilities().get(0).getEffects().get(0).apply(game, token.getAbilities().get(0)); - // token.attachTo(source.getFirstTarget(), game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EstridsInvocation.java b/Mage.Sets/src/mage/cards/e/EstridsInvocation.java index 37406898aaf..938d29dcc8d 100644 --- a/Mage.Sets/src/mage/cards/e/EstridsInvocation.java +++ b/Mage.Sets/src/mage/cards/e/EstridsInvocation.java @@ -95,10 +95,10 @@ class EstridsInvocationEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Estrid's Invocation", source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), "Estrid's Invocation", source, game)) { Card card = game.getExile().getCard(source.getSourceId(), game); if (card != null) { - return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + return card.moveToZone(Zone.BATTLEFIELD, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/e/EternalScourge.java b/Mage.Sets/src/mage/cards/e/EternalScourge.java index b226e01a859..3526b808f61 100644 --- a/Mage.Sets/src/mage/cards/e/EternalScourge.java +++ b/Mage.Sets/src/mage/cards/e/EternalScourge.java @@ -96,7 +96,7 @@ class EternalScourgeAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EunuchsIntrigues.java b/Mage.Sets/src/mage/cards/e/EunuchsIntrigues.java index bb021d44efc..19598faff9a 100644 --- a/Mage.Sets/src/mage/cards/e/EunuchsIntrigues.java +++ b/Mage.Sets/src/mage/cards/e/EunuchsIntrigues.java @@ -68,7 +68,7 @@ class EunuchsIntriguesEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(player.getId())); Target target = new TargetPermanent(1, 1, filter, true); if (target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) { player.chooseTarget(Outcome.DestroyPermanent, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/e/EverlastingTorment.java b/Mage.Sets/src/mage/cards/e/EverlastingTorment.java index 19a1887a6ad..c2023295b1d 100644 --- a/Mage.Sets/src/mage/cards/e/EverlastingTorment.java +++ b/Mage.Sets/src/mage/cards/e/EverlastingTorment.java @@ -87,7 +87,7 @@ class DamageDealtAsIfSourceHadWitherEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } diff --git a/Mage.Sets/src/mage/cards/e/Evershrike.java b/Mage.Sets/src/mage/cards/e/Evershrike.java index 73c577c5e67..5775f41d795 100644 --- a/Mage.Sets/src/mage/cards/e/Evershrike.java +++ b/Mage.Sets/src/mage/cards/e/Evershrike.java @@ -74,7 +74,7 @@ class EvershrikeEffect extends OneShotEffect { Card evershrikeCard = game.getCard(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && evershrikeCard != null) { - if (evershrikeCard.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false)) { + if (evershrikeCard.moveToZone(Zone.BATTLEFIELD, source, game, false)) { int xAmount = source.getManaCostsToPay().getX() + 1; Permanent evershrikePermanent = game.getPermanent(source.getSourceId()); if (evershrikePermanent == null) { @@ -94,7 +94,7 @@ class EvershrikeEffect extends OneShotEffect { if (aura != null) { game.getState().setValue("attachTo:" + aura.getId(), evershrikePermanent); if (controller.moveCards(aura, Zone.BATTLEFIELD, source, game)) { - evershrikePermanent.addAttachment(aura.getId(), game); + evershrikePermanent.addAttachment(aura.getId(), source, game); } exileSource = false; } diff --git a/Mage.Sets/src/mage/cards/e/Excavation.java b/Mage.Sets/src/mage/cards/e/Excavation.java index 4f140eaa1f1..0ded156aa2d 100644 --- a/Mage.Sets/src/mage/cards/e/Excavation.java +++ b/Mage.Sets/src/mage/cards/e/Excavation.java @@ -67,7 +67,7 @@ class ExcavationEffect extends OneShotEffect { if (source instanceof ActivatedAbilityImpl) { Player activator = game.getPlayer(((ActivatedAbilityImpl) source).getActivatorId()); if (activator != null) { - activator.drawCards(1, source.getSourceId(), game); + activator.drawCards(1, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java index d65d82bd0c5..70ef58e764c 100644 --- a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java +++ b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java @@ -72,7 +72,7 @@ class ExclusionRitualImprintEffect extends OneShotEffect { Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && sourcePermanent != null && targetPermanent != null) { - controller.moveCardToExileWithInfo(targetPermanent, getId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(targetPermanent, getId(), sourcePermanent.getIdName(), source, game, Zone.BATTLEFIELD, true); sourcePermanent.imprint(targetPermanent.getId(), game); } return true; diff --git a/Mage.Sets/src/mage/cards/e/Exhume.java b/Mage.Sets/src/mage/cards/e/Exhume.java index 4eefcf01572..3cbe0d69362 100644 --- a/Mage.Sets/src/mage/cards/e/Exhume.java +++ b/Mage.Sets/src/mage/cards/e/Exhume.java @@ -68,7 +68,7 @@ class ExhumeEffect extends OneShotEffect { filterCreatureCard.add(new OwnerIdPredicate(playerId)); TargetCardInGraveyard target = new TargetCardInGraveyard(filterCreatureCard); target.setNotTarget(true); - if (target.canChoose(playerId, game) + if (target.canChoose(source.getSourceId(), playerId, game) && player.chooseTarget(outcome, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/e/ExpansionExplosion.java b/Mage.Sets/src/mage/cards/e/ExpansionExplosion.java index e59b36cf07f..ea59e7fb4f2 100644 --- a/Mage.Sets/src/mage/cards/e/ExpansionExplosion.java +++ b/Mage.Sets/src/mage/cards/e/ExpansionExplosion.java @@ -86,7 +86,7 @@ class ExplosionEffect extends OneShotEffect { effect.apply(game, source); Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (player != null) { - player.drawCards(xValue, source.getSourceId(), game); + player.drawCards(xValue, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/ExperimentalOverload.java b/Mage.Sets/src/mage/cards/e/ExperimentalOverload.java index 4361081e011..76321ab38a8 100644 --- a/Mage.Sets/src/mage/cards/e/ExperimentalOverload.java +++ b/Mage.Sets/src/mage/cards/e/ExperimentalOverload.java @@ -65,7 +65,7 @@ class ExperimentalOverloadEffect extends OneShotEffect { return false; } int spellCount = player.getGraveyard().count(StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game); - new WeirdToken2(spellCount).putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + new WeirdToken2(spellCount).putOntoBattlefield(1, game, source, source.getControllerId()); if (spellCount < 1) { return true; } diff --git a/Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java b/Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java index 8fb94b9dfff..6d3226856fc 100644 --- a/Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java +++ b/Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java @@ -65,7 +65,7 @@ class ExplosionOfRichesEffect extends OneShotEffect { && !player.chooseUse(outcome, "Draw a card?", source, game)) { continue; } - if (player.drawCards(1, source.getSourceId(), game) >= 1) { + if (player.drawCards(1, source, game) >= 1) { continue; } ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/e/ExplosiveRevelation.java b/Mage.Sets/src/mage/cards/e/ExplosiveRevelation.java index 76139cd5219..1bf2493ddf7 100644 --- a/Mage.Sets/src/mage/cards/e/ExplosiveRevelation.java +++ b/Mage.Sets/src/mage/cards/e/ExplosiveRevelation.java @@ -81,11 +81,11 @@ class ExplosiveRevelationEffect extends OneShotEffect { for (UUID targetId : targetPointer.getTargets(game, source)) { Permanent targetedCreature = game.getPermanent(targetId); if (targetedCreature != null) { - targetedCreature.damage(damage, source.getSourceId(), game, false, true); + targetedCreature.damage(damage, source.getSourceId(), source, game, false, true); } else { Player targetedPlayer = game.getPlayer(targetId); if (targetedPlayer != null) { - targetedPlayer.damage(damage, source.getSourceId(), game); + targetedPlayer.damage(damage, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/e/Expropriate.java b/Mage.Sets/src/mage/cards/e/Expropriate.java index fa905b2c294..2bcd00c6390 100644 --- a/Mage.Sets/src/mage/cards/e/Expropriate.java +++ b/Mage.Sets/src/mage/cards/e/Expropriate.java @@ -175,7 +175,7 @@ class ExpropriateControlEffect extends ContinuousEffectImpl { if (permanent == null || controllerId == null) { this.discard(); } else { - permanent.changeControllerId(controllerId, game); + permanent.changeControllerId(controllerId, game, source); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/ExquisiteBlood.java b/Mage.Sets/src/mage/cards/e/ExquisiteBlood.java index ad46e645520..973e792372e 100644 --- a/Mage.Sets/src/mage/cards/e/ExquisiteBlood.java +++ b/Mage.Sets/src/mage/cards/e/ExquisiteBlood.java @@ -53,7 +53,7 @@ class ExquisiteBloodTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_LIFE; + return event.getType() == GameEvent.EventType.LOST_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/e/Exsanguinate.java b/Mage.Sets/src/mage/cards/e/Exsanguinate.java index 14b7c2a3e18..579f4fc3ede 100644 --- a/Mage.Sets/src/mage/cards/e/Exsanguinate.java +++ b/Mage.Sets/src/mage/cards/e/Exsanguinate.java @@ -48,7 +48,7 @@ class ExsanguinateEffect extends OneShotEffect { int totalLostLife = 0; int loseLife = source.getManaCostsToPay().getX(); for (UUID opponentId : game.getOpponents(source.getControllerId())) { - totalLostLife += game.getPlayer(opponentId).loseLife(loseLife, game, false); + totalLostLife += game.getPlayer(opponentId).loseLife(loseLife, game, source, false); } if (totalLostLife > 0) { game.getPlayer(source.getControllerId()).gainLife(totalLostLife, game, source); diff --git a/Mage.Sets/src/mage/cards/e/Extinction.java b/Mage.Sets/src/mage/cards/e/Extinction.java index b1a5161d525..e08d2c49422 100644 --- a/Mage.Sets/src/mage/cards/e/Extinction.java +++ b/Mage.Sets/src/mage/cards/e/Extinction.java @@ -62,7 +62,7 @@ class ExtinctionEffect extends OneShotEffect { FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent(); filterCreaturePermanent.add(SubType.byDescription(typeChoice.getChoice()).getPredicate()); for (Permanent creature : game.getBattlefield().getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) { - creature.destroy(source.getSourceId(), game, true); + creature.destroy(source, game, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/Extirpate.java b/Mage.Sets/src/mage/cards/e/Extirpate.java index ae5b3d676cb..e56bd313b22 100644 --- a/Mage.Sets/src/mage/cards/e/Extirpate.java +++ b/Mage.Sets/src/mage/cards/e/Extirpate.java @@ -98,7 +98,7 @@ class ExtirpateEffect extends OneShotEffect { // search cards in graveyard for (Card checkCard : owner.getGraveyard().getCards(game)) { if (checkCard.getName().equals(chosenCard.getName())) { - controller.moveCardToExileWithInfo(checkCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(checkCard, null, "", source, game, Zone.GRAVEYARD, true); } } @@ -111,7 +111,7 @@ class ExtirpateEffect extends OneShotEffect { for (UUID targetId : targets) { Card targetCard = owner.getHand().get(targetId, game); if (targetCard != null) { - controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(targetCard, null, "", source, game, Zone.HAND, true); } } } @@ -124,7 +124,7 @@ class ExtirpateEffect extends OneShotEffect { for (UUID targetId : targets) { Card targetCard = owner.getLibrary().getCard(targetId, game); if (targetCard != null) { - controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(targetCard, null, "", source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/e/Extortion.java b/Mage.Sets/src/mage/cards/e/Extortion.java index 86c210dc310..45257f02b65 100644 --- a/Mage.Sets/src/mage/cards/e/Extortion.java +++ b/Mage.Sets/src/mage/cards/e/Extortion.java @@ -61,7 +61,7 @@ class ExtortionEffect extends OneShotEffect { TargetCard target = new TargetCardInHand(0, 2, StaticFilters.FILTER_CARD_CARDS); target.setNotTarget(true); you.choose(Outcome.Discard, targetPlayer.getHand(), target, game); - targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); + targetPlayer.discard(new CardsImpl(target.getTargets()), false, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/e/Extract.java b/Mage.Sets/src/mage/cards/e/Extract.java index cb116053217..a78a7c24a3c 100644 --- a/Mage.Sets/src/mage/cards/e/Extract.java +++ b/Mage.Sets/src/mage/cards/e/Extract.java @@ -69,7 +69,7 @@ class ExtractEffect extends OneShotEffect { if (player.searchLibrary(target, source, game, targetPlayer.getId())) { Card card = targetPlayer.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { - player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + player.moveCardToExileWithInfo(card, null, null, source, game, Zone.LIBRARY, true); } } targetPlayer.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java b/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java index 23639b23b66..4ec9411660b 100644 --- a/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java +++ b/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java @@ -80,7 +80,7 @@ class ExtraplanarLensImprintEffect extends OneShotEffect { if (controller != null) { Permanent targetLand = game.getPermanent(source.getFirstTarget()); if (targetLand != null) { - targetLand.moveToExile(null, extraplanarLens.getName() + " (Imprint)", source.getSourceId(), game); + targetLand.moveToExile(null, extraplanarLens.getName() + " (Imprint)", source, game); extraplanarLens.imprint(targetLand.getId(), game); extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + ']'), game); } @@ -113,7 +113,7 @@ class ExtraplanarLensTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent landTappedForMana = game.getPermanentOrLKIBattlefield(event.getSourceId()); + Permanent landTappedForMana = game.getPermanentOrLKIBattlefield(event.getSourceId()); // need only info about permanent Permanent extraplanarLens = game.getPermanent(getSourceId()); if (extraplanarLens != null && landTappedForMana != null diff --git a/Mage.Sets/src/mage/cards/e/ExuberantFirestoker.java b/Mage.Sets/src/mage/cards/e/ExuberantFirestoker.java index c94fe6af191..7add94a8b6b 100644 --- a/Mage.Sets/src/mage/cards/e/ExuberantFirestoker.java +++ b/Mage.Sets/src/mage/cards/e/ExuberantFirestoker.java @@ -73,7 +73,7 @@ class ExuberantFirestokerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EyeForAnEye.java b/Mage.Sets/src/mage/cards/e/EyeForAnEye.java index 15a8ad86f61..e028793f18b 100644 --- a/Mage.Sets/src/mage/cards/e/EyeForAnEye.java +++ b/Mage.Sets/src/mage/cards/e/EyeForAnEye.java @@ -78,12 +78,12 @@ class EyeForAnEyeEffect extends ReplacementEffectImpl { Player controller = game.getPlayer(source.getControllerId()); DamageEvent damageEvent = (DamageEvent) event; if (controller != null) { - controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); UUID sourceControllerId = game.getControllerId(damageEvent.getSourceId()); if (sourceControllerId != null) { Player sourceController = game.getPlayer(sourceControllerId); if (sourceController != null) { - sourceController.damage(damageEvent.getAmount(), source.getSourceId(), game); + sourceController.damage(damageEvent.getAmount(), source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/e/EyeOfSingularity.java b/Mage.Sets/src/mage/cards/e/EyeOfSingularity.java index 160ee560dfa..c50992abf24 100644 --- a/Mage.Sets/src/mage/cards/e/EyeOfSingularity.java +++ b/Mage.Sets/src/mage/cards/e/EyeOfSingularity.java @@ -91,7 +91,7 @@ class EyeOfSingularityETBEffect extends OneShotEffect { for (UUID id : toDestroy.keySet()) { Permanent permanent = game.getPermanent(id); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; @@ -115,7 +115,7 @@ class EyeOfSingularityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -176,7 +176,7 @@ class EyeOfSingularityTriggeredEffect extends OneShotEffect { for (UUID id : toDestroy.keySet()) { Permanent permanent = game.getPermanent(id); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java index 2fd5fa352fc..a5a13dce519 100644 --- a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java +++ b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java @@ -62,7 +62,7 @@ class EyeOfTheStormAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EzurisArchers.java b/Mage.Sets/src/mage/cards/e/EzurisArchers.java index 1e21c8acdaf..7d0267bf013 100644 --- a/Mage.Sets/src/mage/cards/e/EzurisArchers.java +++ b/Mage.Sets/src/mage/cards/e/EzurisArchers.java @@ -59,7 +59,7 @@ class BlocksCreatureWithFlyingTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EzurisPredation.java b/Mage.Sets/src/mage/cards/e/EzurisPredation.java index 12f004e6fa5..0eb3002f37d 100644 --- a/Mage.Sets/src/mage/cards/e/EzurisPredation.java +++ b/Mage.Sets/src/mage/cards/e/EzurisPredation.java @@ -91,6 +91,7 @@ class EzurisPredationEffect extends OneShotEffect { } Permanent opponentCreature = creaturesOfOpponents.iterator().next(); creaturesOfOpponents.remove(opponentCreature); + // can be multiple tokens, so must be used custom BATCH_FIGHT event token.fight(opponentCreature, source, game, false); morSet.add(new MageObjectReference(token, game)); morSet.add(new MageObjectReference(opponentCreature, game)); @@ -99,7 +100,7 @@ class EzurisPredationEffect extends OneShotEffect { } String data = UUID.randomUUID().toString(); game.getState().setValue("batchFight_" + data, morSet); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BATCH_FIGHT, getId(), getId(), source.getControllerId(), data, 0)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BATCH_FIGHT, getId(), source, source.getControllerId(), data, 0)); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java b/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java index 5ff4423135e..f2f26c2c8c4 100644 --- a/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java +++ b/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java @@ -76,12 +76,12 @@ class FaadiyahSeerEffect extends OneShotEffect { // Gatherer ruling (2007-02-01) // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, // even if the draw is replaced by another draw (such as with Enduring Renewal). - if (controller.drawCards(1, source.getSourceId(), game) != 1) { + if (controller.drawCards(1, source, game) != 1) { return true; } controller.revealCards(source, new CardsImpl(card), game); if (!card.isLand()) { - controller.discard(card, source, game); + controller.discard(card, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FacesOfThePast.java b/Mage.Sets/src/mage/cards/f/FacesOfThePast.java index 77fde7971c0..da1f73b3dd7 100644 --- a/Mage.Sets/src/mage/cards/f/FacesOfThePast.java +++ b/Mage.Sets/src/mage/cards/f/FacesOfThePast.java @@ -63,7 +63,7 @@ class FacesOfThePastEffect extends OneShotEffect { if (controller.chooseUse(outcome, "Tap all untapped creatures that share a creature type with " + targetPermanent.getLogName() + "? (Otherwise, untaps all tapped)", source, game)) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) { if (!permanent.isTapped() && targetPermanent.shareCreatureTypes(permanent, game)) { - permanent.tap(game); + permanent.tap(source, game); } } } else { diff --git a/Mage.Sets/src/mage/cards/f/FactOrFiction.java b/Mage.Sets/src/mage/cards/f/FactOrFiction.java index cfb2a3158c9..60bf090c986 100644 --- a/Mage.Sets/src/mage/cards/f/FactOrFiction.java +++ b/Mage.Sets/src/mage/cards/f/FactOrFiction.java @@ -110,7 +110,7 @@ class FactOrFictionEffect extends OneShotEffect { if (i < pile1.size()) { sb.append(", "); } - card.moveToZone(pile1Zone, source.getSourceId(), game, false); + card.moveToZone(pile1Zone, source, game, false); } game.informPlayers(sb.toString()); @@ -122,7 +122,7 @@ class FactOrFictionEffect extends OneShotEffect { if (i < pile2.size()) { sb.append(", "); } - card.moveToZone(pile2Zone, source.getSourceId(), game, false); + card.moveToZone(pile2Zone, source, game, false); } game.informPlayers(sb.toString()); } diff --git a/Mage.Sets/src/mage/cards/f/FadeAway.java b/Mage.Sets/src/mage/cards/f/FadeAway.java index 199b8b4af41..159740c88f6 100644 --- a/Mage.Sets/src/mage/cards/f/FadeAway.java +++ b/Mage.Sets/src/mage/cards/f/FadeAway.java @@ -68,7 +68,7 @@ class FadeAwayEffect extends OneShotEffect { ManaCostsImpl cost = new ManaCostsImpl(); cost.add(new GenericManaCost(payAmount)); cost.clearPaid(); - if (cost.payOrRollback(source, game, source.getSourceId(), playerId)) { + if (cost.payOrRollback(source, game, source, playerId)) { paid = true; } } @@ -85,7 +85,7 @@ class FadeAwayEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/f/FaerieImpostor.java b/Mage.Sets/src/mage/cards/f/FaerieImpostor.java index f744e080133..da9fc8e6a7e 100644 --- a/Mage.Sets/src/mage/cards/f/FaerieImpostor.java +++ b/Mage.Sets/src/mage/cards/f/FaerieImpostor.java @@ -76,12 +76,12 @@ class FaerieImpostorEffect extends OneShotEffect { if (controller != null) { boolean targetChosen = false; TargetPermanent target = new TargetPermanent(1, 1, filter, true); - if (target.canChoose(controller.getId(), game) && controller.chooseUse(outcome, "Return another creature you control to its owner's hand?", source, game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseUse(outcome, "Return another creature you control to its owner's hand?", source, game)) { controller.chooseTarget(Outcome.ReturnToHand, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { targetChosen = true; - permanent.moveToZone(Zone.HAND, this.getId(), game, false); + permanent.moveToZone(Zone.HAND, source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/f/FailureComply.java b/Mage.Sets/src/mage/cards/f/FailureComply.java index c08eac0b826..ac7786ecf41 100644 --- a/Mage.Sets/src/mage/cards/f/FailureComply.java +++ b/Mage.Sets/src/mage/cards/f/FailureComply.java @@ -82,7 +82,7 @@ class ComplyCantCastEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL_LATE; + return event.getType() == GameEvent.EventType.CAST_SPELL_LATE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FaithsReward.java b/Mage.Sets/src/mage/cards/f/FaithsReward.java index 32b993daf10..0ff0a99c954 100644 --- a/Mage.Sets/src/mage/cards/f/FaithsReward.java +++ b/Mage.Sets/src/mage/cards/f/FaithsReward.java @@ -62,7 +62,7 @@ class FaithsRewardEffect extends OneShotEffect { for (UUID id : watcher.getCards()) { Card c = game.getCard(id); if (c != null && c.isOwnedBy(source.getControllerId()) && game.getState().getZone(id) == Zone.GRAVEYARD) { - c.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + c.moveToZone(Zone.BATTLEFIELD, source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/FalkenrathNoble.java b/Mage.Sets/src/mage/cards/f/FalkenrathNoble.java index 35cc7bbde12..4b0754b11af 100644 --- a/Mage.Sets/src/mage/cards/f/FalkenrathNoble.java +++ b/Mage.Sets/src/mage/cards/f/FalkenrathNoble.java @@ -65,7 +65,7 @@ class FalkenrathNobleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java b/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java index 26ffbaf606b..d69b5d100da 100644 --- a/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java +++ b/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java @@ -82,7 +82,7 @@ class FallOfTheHammerDamageEffect extends OneShotEffect { int damage = ownCreature.getPower().getValue(); Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (targetCreature != null) { - targetCreature.damage(damage, ownCreature.getId(), game, false, true); + targetCreature.damage(damage, ownCreature.getId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FalseCure.java b/Mage.Sets/src/mage/cards/f/FalseCure.java index d156f4ff4e1..f82ae331f07 100644 --- a/Mage.Sets/src/mage/cards/f/FalseCure.java +++ b/Mage.Sets/src/mage/cards/f/FalseCure.java @@ -56,7 +56,7 @@ class FalseCureTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FalseOrders.java b/Mage.Sets/src/mage/cards/f/FalseOrders.java index c1658256f75..e574c8ffd5a 100644 --- a/Mage.Sets/src/mage/cards/f/FalseOrders.java +++ b/Mage.Sets/src/mage/cards/f/FalseOrders.java @@ -19,6 +19,7 @@ import mage.filter.predicate.permanent.PermanentInListPredicate; import mage.game.Controllable; import mage.game.Game; import mage.game.combat.CombatGroup; +import mage.game.events.BlockerDeclaredEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -139,7 +140,7 @@ class FalseOrdersUnblockEffect extends OneShotEffect { filter.add(new PermanentInListPredicate(list)); TargetAttackingCreature target = new TargetAttackingCreature(1, 1, filter, true); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } else { @@ -158,25 +159,25 @@ class FalseOrdersUnblockEffect extends OneShotEffect { chosenGroup.addBlockerToGroup(permanent.getId(), controller.getId(), game); game.getCombat().addBlockingGroup(permanent.getId(), chosenPermanent.getId(), controller.getId(), game); // 702.21h if (notYetBlocked) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, chosenPermanent.getId(), null)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, chosenPermanent.getId(), source, null)); Set morSet = new HashSet<>(); morSet.add(new MageObjectReference(chosenPermanent, game)); for (UUID bandedId : chosenPermanent.getBandedCards()) { CombatGroup bandedGroup = game.getCombat().findGroup(bandedId); if (bandedGroup != null && chosenGroup.getBlockers().size() == 1) { morSet.add(new MageObjectReference(bandedId, game)); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, bandedId, null)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, bandedId, source, null)); } } String key = UUID.randomUUID().toString(); game.getState().setValue("becameBlocked_" + key, morSet); game.fireEvent(GameEvent.getEvent( GameEvent.EventType.BATCH_BLOCK_NONCOMBAT, - source.getSourceId(), source.getSourceId(), + source.getSourceId(), source, source.getControllerId(), key, 0) ); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BLOCKER_DECLARED, chosenPermanent.getId(), permanent.getId(), permanent.getControllerId())); + game.fireEvent(new BlockerDeclaredEvent(chosenPermanent.getId(), permanent.getId(), permanent.getControllerId())); } CombatGroup blockGroup = findBlockingGroup(permanent, game); // a new blockingGroup is formed, so it's necessary to find it again if (blockGroup != null) { diff --git a/Mage.Sets/src/mage/cards/f/Fastbond.java b/Mage.Sets/src/mage/cards/f/Fastbond.java index 6ea9528caa9..8736d4b83ae 100644 --- a/Mage.Sets/src/mage/cards/f/Fastbond.java +++ b/Mage.Sets/src/mage/cards/f/Fastbond.java @@ -53,7 +53,7 @@ class PlayALandTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FatalLore.java b/Mage.Sets/src/mage/cards/f/FatalLore.java index e551a767b3a..38c132fe7c5 100644 --- a/Mage.Sets/src/mage/cards/f/FatalLore.java +++ b/Mage.Sets/src/mage/cards/f/FatalLore.java @@ -67,12 +67,12 @@ class FatalLoreEffect extends OneShotEffect { if (controller != null && chosenOpponent != null) { if (chosenOpponent.chooseUse(Outcome.Neutral, "If you choose Yes, the controller draws three cards. If no, the controller gets to destroy up to two target creatures that you control and you get to draw up to 3 cards. Those creatures can't be regenerated.", source, game)) { - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); } else { FilterCreaturePermanent filter = new FilterCreaturePermanent("chosen opponent's creature"); filter.add(new ControllerIdPredicate(chosenOpponent.getId())); TargetCreaturePermanent target = new TargetCreaturePermanent(0, 2, filter, false); - if (target.canChoose(controller.getId(), game) + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(Outcome.DestroyPermanent, target, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { Effect destroyCreature = new DestroyTargetEffect(true); diff --git a/Mage.Sets/src/mage/cards/f/FatalPush.java b/Mage.Sets/src/mage/cards/f/FatalPush.java index 417e00268d2..f17858c7a84 100644 --- a/Mage.Sets/src/mage/cards/f/FatalPush.java +++ b/Mage.Sets/src/mage/cards/f/FatalPush.java @@ -66,7 +66,7 @@ class FatalPushEffect extends OneShotEffect { int cmc = targetCreature.getConvertedManaCost(); if (cmc <= 2 || (RevoltCondition.instance.apply(game, source) && cmc <= 4)) { - targetCreature.destroy(source.getSourceId(), game, false); + targetCreature.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/FateTransfer.java b/Mage.Sets/src/mage/cards/f/FateTransfer.java index 794e619b6c6..0a132acf06f 100644 --- a/Mage.Sets/src/mage/cards/f/FateTransfer.java +++ b/Mage.Sets/src/mage/cards/f/FateTransfer.java @@ -76,7 +76,7 @@ class FateTransferEffect extends OneShotEffect { && creatureToMoveCountersTo != null) { Permanent copyCreature = creatureToMoveCountersFrom.copy(); for (Counter counter : copyCreature.getCounters(game).values()) { - creatureToMoveCountersFrom.removeCounters(counter, game); + creatureToMoveCountersFrom.removeCounters(counter, source, game); creatureToMoveCountersTo.addCounters(counter, source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/f/FathomFleetSwordjack.java b/Mage.Sets/src/mage/cards/f/FathomFleetSwordjack.java index 34fb61b2d5d..19d57116cae 100644 --- a/Mage.Sets/src/mage/cards/f/FathomFleetSwordjack.java +++ b/Mage.Sets/src/mage/cards/f/FathomFleetSwordjack.java @@ -71,7 +71,7 @@ class FathomFleetSwordjackEffect extends OneShotEffect { ); return artifactCount > 0 && game.damagePlayerOrPlaneswalker( game.getCombat().getDefenderId(source.getSourceId()), artifactCount, - source.getSourceId(), game, false, true + source.getSourceId(), source, game, false, true ) > 0; } } diff --git a/Mage.Sets/src/mage/cards/f/FathomMage.java b/Mage.Sets/src/mage/cards/f/FathomMage.java index b0ece2265e7..06891023033 100644 --- a/Mage.Sets/src/mage/cards/f/FathomMage.java +++ b/Mage.Sets/src/mage/cards/f/FathomMage.java @@ -59,7 +59,7 @@ class FathomMageTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_ADDED; + return event.getType() == GameEvent.EventType.COUNTER_ADDED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FaultLine.java b/Mage.Sets/src/mage/cards/f/FaultLine.java index 42b5ca5d624..fca2433326c 100644 --- a/Mage.Sets/src/mage/cards/f/FaultLine.java +++ b/Mage.Sets/src/mage/cards/f/FaultLine.java @@ -64,12 +64,12 @@ class FaultLineEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = source.getManaCostsToPay().getX(); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FeastOfWorms.java b/Mage.Sets/src/mage/cards/f/FeastOfWorms.java index 8f39eeed4cb..1a2f718ae3e 100644 --- a/Mage.Sets/src/mage/cards/f/FeastOfWorms.java +++ b/Mage.Sets/src/mage/cards/f/FeastOfWorms.java @@ -77,11 +77,11 @@ class FeastOfWormsEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(targetPlayer.getId())); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false); - if (target.canChoose(targetPlayer.getId(), game)) { + if (target.canChoose(source.getSourceId(), targetPlayer.getId(), game)) { targetPlayer.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent land = game.getPermanent(target.getFirstTarget()); if (land != null) { - land.sacrifice(source.getSourceId(), game); + land.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/Fecundity.java b/Mage.Sets/src/mage/cards/f/Fecundity.java index e59f570461e..d9600a72232 100644 --- a/Mage.Sets/src/mage/cards/f/Fecundity.java +++ b/Mage.Sets/src/mage/cards/f/Fecundity.java @@ -61,7 +61,7 @@ class FecundityEffect extends OneShotEffect { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { if (controller.chooseUse(outcome, "Draw a card?", source, game)) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FeedThePack.java b/Mage.Sets/src/mage/cards/f/FeedThePack.java index 181022e5ef0..8168da7606c 100644 --- a/Mage.Sets/src/mage/cards/f/FeedThePack.java +++ b/Mage.Sets/src/mage/cards/f/FeedThePack.java @@ -71,10 +71,10 @@ class FeedThePackEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { int toughness = permanent.getToughness().getValue(); WolfToken token = new WolfToken(); - token.putOntoBattlefield(toughness, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(toughness, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FeedTheSwarm.java b/Mage.Sets/src/mage/cards/f/FeedTheSwarm.java index 0c34ff1c7b0..a80c755b83a 100644 --- a/Mage.Sets/src/mage/cards/f/FeedTheSwarm.java +++ b/Mage.Sets/src/mage/cards/f/FeedTheSwarm.java @@ -74,8 +74,8 @@ class FeedTheSwarmEffect extends OneShotEffect { if (permanent == null || player == null) { return false; } - player.loseLife(permanent.getConvertedManaCost(), game, false); - permanent.destroy(source.getSourceId(), game, false); + player.loseLife(permanent.getConvertedManaCost(), game, source, false); + permanent.destroy(source, game, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/Feint.java b/Mage.Sets/src/mage/cards/f/Feint.java index bccd33ddceb..f15b88e58d9 100644 --- a/Mage.Sets/src/mage/cards/f/Feint.java +++ b/Mage.Sets/src/mage/cards/f/Feint.java @@ -70,7 +70,7 @@ class FeintEffect extends OneShotEffect { for (UUID blockerId : combatGroup.getBlockers()) { Permanent blocker = game.getPermanent(blockerId); if (blocker != null) { - blocker.tap(game); + blocker.tap(source, game); PreventionEffect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true); effect.setTargetPointer(new FixedTarget(blocker.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/f/FeldonsCane.java b/Mage.Sets/src/mage/cards/f/FeldonsCane.java index 18ffbb30a5b..9be9d33f9bb 100644 --- a/Mage.Sets/src/mage/cards/f/FeldonsCane.java +++ b/Mage.Sets/src/mage/cards/f/FeldonsCane.java @@ -62,7 +62,7 @@ class FeldonsCaneEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Card card: controller.getGraveyard().getCards(game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/f/FelineSovereign.java b/Mage.Sets/src/mage/cards/f/FelineSovereign.java index 09b0b87730b..fd36e314f13 100644 --- a/Mage.Sets/src/mage/cards/f/FelineSovereign.java +++ b/Mage.Sets/src/mage/cards/f/FelineSovereign.java @@ -96,14 +96,14 @@ class FelineSovereignTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.COMBAT_DAMAGE_STEP_PRIORITY - || event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRIORITY + || event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; Permanent p = game.getPermanent(event.getSourceId()); if (damageEvent.isCombatDamage() && p != null && p.isControlledBy(this.getControllerId()) && @@ -117,8 +117,8 @@ class FelineSovereignTriggeredAbility extends TriggeredAbilityImpl { return true; } } - if (event.getType() == EventType.COMBAT_DAMAGE_STEP_PRIORITY || - (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(getSourceId()))) { + if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRIORITY || + (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(getSourceId()))) { damagedPlayerIds.clear(); } return false; diff --git a/Mage.Sets/src/mage/cards/f/FellShepherd.java b/Mage.Sets/src/mage/cards/f/FellShepherd.java index d194211d725..f2ffbb0a8e1 100644 --- a/Mage.Sets/src/mage/cards/f/FellShepherd.java +++ b/Mage.Sets/src/mage/cards/f/FellShepherd.java @@ -75,7 +75,7 @@ class FellShepherdWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (card != null && ((Card) card).isOwnedBy(this.controllerId) && card.isCreature()) { creatureIds.add(card.getId()); @@ -115,7 +115,7 @@ class FellShepherdEffect extends OneShotEffect { if (game.getState().getZone(creatureId) == Zone.GRAVEYARD) { Card card = game.getCard(creatureId); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); sb.append(' ').append(card.getName()); } } diff --git a/Mage.Sets/src/mage/cards/f/FellTheMighty.java b/Mage.Sets/src/mage/cards/f/FellTheMighty.java index ac6085360ba..3e9bfbe8179 100644 --- a/Mage.Sets/src/mage/cards/f/FellTheMighty.java +++ b/Mage.Sets/src/mage/cards/f/FellTheMighty.java @@ -62,7 +62,7 @@ class FellTheMightyEffect extends OneShotEffect { if (controller != null && targetCreature != null) { for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), source.getSourceId(), game)) { if (permanent.getPower().getValue() > targetCreature.getPower().getValue()) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/FertileGround.java b/Mage.Sets/src/mage/cards/f/FertileGround.java index 708bd5d9c05..fade3453eaa 100644 --- a/Mage.Sets/src/mage/cards/f/FertileGround.java +++ b/Mage.Sets/src/mage/cards/f/FertileGround.java @@ -37,6 +37,7 @@ public final class FertileGround extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); + // Whenever enchanted land is tapped for mana, its controller adds one mana of any color. this.addAbility(new FertileGroundTriggeredAbility()); } @@ -63,16 +64,16 @@ class FertileGroundTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); - if (enchanted != null) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchanted.getControllerId())); + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + if (enchantedLand != null && enchantedLand.isLand()) { + getEffects().get(0).setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FertileImagination.java b/Mage.Sets/src/mage/cards/f/FertileImagination.java index f25b42bef30..d9113750307 100644 --- a/Mage.Sets/src/mage/cards/f/FertileImagination.java +++ b/Mage.Sets/src/mage/cards/f/FertileImagination.java @@ -115,7 +115,7 @@ class FertileImaginationEffect extends OneShotEffect { } } game.informPlayers(sourceObject.getLogName() + " creates " + (tokensToMake == 0 ? "no" : "" + tokensToMake) + " 1/1 green Saproling creature tokens."); - saprolingToken.putOntoBattlefield(tokensToMake, game, source.getId(), source.getControllerId()); + saprolingToken.putOntoBattlefield(tokensToMake, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FesteringWound.java b/Mage.Sets/src/mage/cards/f/FesteringWound.java index d5446ec7d7d..883236e6a5d 100644 --- a/Mage.Sets/src/mage/cards/f/FesteringWound.java +++ b/Mage.Sets/src/mage/cards/f/FesteringWound.java @@ -73,7 +73,7 @@ class FesteringWoundEffect extends OneShotEffect { UUID id = this.getTargetPointer().getFirst(game, source); Player player = game.getPlayer(id); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/Fettergeist.java b/Mage.Sets/src/mage/cards/f/Fettergeist.java index e56116acd5c..414647c030c 100644 --- a/Mage.Sets/src/mage/cards/f/Fettergeist.java +++ b/Mage.Sets/src/mage/cards/f/Fettergeist.java @@ -77,11 +77,11 @@ class FettergeistUnlessPaysEffect extends OneShotEffect { int count = amount.calculate(game, source, this); if (player.chooseUse(Outcome.Benefit, "Pay {" + count + "}? Or " + permanent.getName() + " will be sacrificed.", source, game)) { Cost cost = ManaUtil.createManaCost(count, false); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source, source.getControllerId(), false)) { return true; } } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FeveredVisions.java b/Mage.Sets/src/mage/cards/f/FeveredVisions.java index 9b100ce1fca..52421e3e2e5 100644 --- a/Mage.Sets/src/mage/cards/f/FeveredVisions.java +++ b/Mage.Sets/src/mage/cards/f/FeveredVisions.java @@ -54,10 +54,10 @@ class FeveredVisionsEffect extends OneShotEffect { UUID activePlayerId = game.getActivePlayerId(); Player player = game.getPlayer(activePlayerId); if (controller != null && player != null) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); Set opponents = game.getOpponents(source.getControllerId()); if (opponents.contains(player.getId()) && player.getHand().size() > 3) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FickleEfreet.java b/Mage.Sets/src/mage/cards/f/FickleEfreet.java index 4e67afe38fa..dce82a7a220 100644 --- a/Mage.Sets/src/mage/cards/f/FickleEfreet.java +++ b/Mage.Sets/src/mage/cards/f/FickleEfreet.java @@ -75,7 +75,7 @@ class FickleEfreetChangeControlEffect extends OneShotEffect { if (sourcePermanent != null) { Target target = new TargetOpponent(true); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } @@ -120,7 +120,7 @@ class FickleEfreetGainControlEffect extends ContinuousEffectImpl { permanent = game.getPermanent(targetPointer.getFirst(game, source)); } if (permanent != null) { - return permanent.changeControllerId(controller, game); + return permanent.changeControllerId(controller, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/f/FieryBombardment.java b/Mage.Sets/src/mage/cards/f/FieryBombardment.java index e206de3669f..169db9ccf4c 100644 --- a/Mage.Sets/src/mage/cards/f/FieryBombardment.java +++ b/Mage.Sets/src/mage/cards/f/FieryBombardment.java @@ -82,11 +82,11 @@ class FieryBombardmentEffect extends OneShotEffect { if (damage > 0) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); } else { Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.damage(damage, source.getSourceId(), game, false, true); + creature.damage(damage, source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/f/FieryGambit.java b/Mage.Sets/src/mage/cards/f/FieryGambit.java index 748885ddadb..91ee5f88909 100644 --- a/Mage.Sets/src/mage/cards/f/FieryGambit.java +++ b/Mage.Sets/src/mage/cards/f/FieryGambit.java @@ -80,13 +80,13 @@ class FieryGambitEffect extends OneShotEffect { if (controllerStopped) { Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.damage(3, source.getSourceId(), game, false, true); + creature.damage(3, source.getSourceId(), source, game, false, true); } if (flipsWon > 1) { new DamagePlayersEffect(6, TargetController.OPPONENT).apply(game, source); } if (flipsWon > 2) { - controller.drawCards(9, source.getSourceId(), game); + controller.drawCards(9, source, game); new UntapAllLandsControllerEffect().apply(game, source); } } else { diff --git a/Mage.Sets/src/mage/cards/f/FiligreeFracture.java b/Mage.Sets/src/mage/cards/f/FiligreeFracture.java index 98eb2eb6ed7..a825f6b94dd 100644 --- a/Mage.Sets/src/mage/cards/f/FiligreeFracture.java +++ b/Mage.Sets/src/mage/cards/f/FiligreeFracture.java @@ -60,10 +60,10 @@ class FiligreeFractureEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (player != null && permanent != null) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); game.getState().processAction(game); if (permanent.getColor(game).isBlack() || permanent.getColor(game).isBlue()) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FilthyCur.java b/Mage.Sets/src/mage/cards/f/FilthyCur.java index e47525388a8..5135917d614 100644 --- a/Mage.Sets/src/mage/cards/f/FilthyCur.java +++ b/Mage.Sets/src/mage/cards/f/FilthyCur.java @@ -60,7 +60,7 @@ class DealtDamageLoseLifeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FinalPunishment.java b/Mage.Sets/src/mage/cards/f/FinalPunishment.java index d9a81a7b62d..cf5921f018c 100644 --- a/Mage.Sets/src/mage/cards/f/FinalPunishment.java +++ b/Mage.Sets/src/mage/cards/f/FinalPunishment.java @@ -43,11 +43,11 @@ public final class FinalPunishment extends CardImpl { class FinalPunishmentAmount implements DynamicValue { @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class); if(watcher != null) { - return watcher.getAmountOfDamageReceivedThisTurn(source.getFirstTarget()); + return watcher.getAmountOfDamageReceivedThisTurn(sourceAbility.getFirstTarget()); } return 0; } diff --git a/Mage.Sets/src/mage/cards/f/FinaleOfPromise.java b/Mage.Sets/src/mage/cards/f/FinaleOfPromise.java index 16ce007ed70..00186b99442 100644 --- a/Mage.Sets/src/mage/cards/f/FinaleOfPromise.java +++ b/Mage.Sets/src/mage/cards/f/FinaleOfPromise.java @@ -192,7 +192,7 @@ class FinaleOfPromiseReplacementEffect extends ReplacementEffectImpl { if (controller != null) { Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); return true; } } @@ -201,7 +201,7 @@ class FinaleOfPromiseReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FinaleOfRevelation.java b/Mage.Sets/src/mage/cards/f/FinaleOfRevelation.java index ff1251cdeef..30fb5dc41e9 100644 --- a/Mage.Sets/src/mage/cards/f/FinaleOfRevelation.java +++ b/Mage.Sets/src/mage/cards/f/FinaleOfRevelation.java @@ -66,11 +66,11 @@ class FinaleOfRevelationEffect extends OneShotEffect { int xValue = source.getManaCostsToPay().getX(); if (xValue < 10) { - player.drawCards(xValue, source.getSourceId(), game); + player.drawCards(xValue, source, game); } else { player.putCardsOnTopOfLibrary(player.getGraveyard(), game, source, false); player.shuffleLibrary(source, game); - player.drawCards(xValue, source.getSourceId(), game); + player.drawCards(xValue, source, game); new UntapLandsEffect(5).apply(game, source); game.addEffect(new MaximumHandSizeControllerEffect( Integer.MAX_VALUE, Duration.EndOfGame, diff --git a/Mage.Sets/src/mage/cards/f/FinestHour.java b/Mage.Sets/src/mage/cards/f/FinestHour.java index 2163788f4bc..42d1c70cb5c 100644 --- a/Mage.Sets/src/mage/cards/f/FinestHour.java +++ b/Mage.Sets/src/mage/cards/f/FinestHour.java @@ -69,7 +69,7 @@ class FinestHourAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FireProphecy.java b/Mage.Sets/src/mage/cards/f/FireProphecy.java index 8801cd8059e..39271caee10 100644 --- a/Mage.Sets/src/mage/cards/f/FireProphecy.java +++ b/Mage.Sets/src/mage/cards/f/FireProphecy.java @@ -74,7 +74,7 @@ class FireProphecyEffect extends OneShotEffect { return false; } if (player.putCardsOnBottomOfLibrary(card, game, source, false)) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/Fireball.java b/Mage.Sets/src/mage/cards/f/Fireball.java index 314db59f661..9392dbe666c 100644 --- a/Mage.Sets/src/mage/cards/f/Fireball.java +++ b/Mage.Sets/src/mage/cards/f/Fireball.java @@ -73,11 +73,11 @@ class FireballEffect extends OneShotEffect { for (UUID targetId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(damagePer, source.getSourceId(), game, false, true); + permanent.damage(damagePer, source.getSourceId(), source, game, false, true); } else { Player player = game.getPlayer(targetId); if (player != null) { - player.damage(damagePer, source.getSourceId(), game); + player.damage(damagePer, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/f/FiredrinkerSatyr.java b/Mage.Sets/src/mage/cards/f/FiredrinkerSatyr.java index 4e2e4583c0d..d1187a20bb3 100644 --- a/Mage.Sets/src/mage/cards/f/FiredrinkerSatyr.java +++ b/Mage.Sets/src/mage/cards/f/FiredrinkerSatyr.java @@ -72,7 +72,7 @@ class FiredrinkerSatyrDealDamageEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FiremindsForesight.java b/Mage.Sets/src/mage/cards/f/FiremindsForesight.java index c3cfd5d6400..b228c72b179 100644 --- a/Mage.Sets/src/mage/cards/f/FiremindsForesight.java +++ b/Mage.Sets/src/mage/cards/f/FiremindsForesight.java @@ -82,7 +82,7 @@ class FiremindsForesightSearchEffect extends OneShotEffect { for (UUID cardId: target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); if (card != null){ - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); game.informPlayers(sourceCard.getName()+": " + player.getLogName() + " chose " + card.getName() ); cardsInLibrary.remove(card); cardToReveal.add(card); diff --git a/Mage.Sets/src/mage/cards/f/Firestorm.java b/Mage.Sets/src/mage/cards/f/Firestorm.java index 39338f6e864..96aa77725da 100644 --- a/Mage.Sets/src/mage/cards/f/Firestorm.java +++ b/Mage.Sets/src/mage/cards/f/Firestorm.java @@ -77,11 +77,11 @@ class FirestormEffect extends OneShotEffect { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(targetId); if (creature != null) { - creature.damage(amount, source.getSourceId(), game, false, true); + creature.damage(amount, source.getSourceId(), source, game, false, true); } else { Player player = game.getPlayer(targetId); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/f/FiveAlarmFire.java b/Mage.Sets/src/mage/cards/f/FiveAlarmFire.java index ec34951ca20..de7c73e38ae 100644 --- a/Mage.Sets/src/mage/cards/f/FiveAlarmFire.java +++ b/Mage.Sets/src/mage/cards/f/FiveAlarmFire.java @@ -78,17 +78,17 @@ class FiveAlarmFireTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER - || event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER - || event.getType() == EventType.DAMAGED_PLAYER) { + if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { if (((DamagedEvent) event).isCombatDamage() && !triggeringCreatures.contains(event.getSourceId())) { Permanent permanent = game.getPermanent(event.getSourceId()); if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) { @@ -98,7 +98,7 @@ class FiveAlarmFireTriggeredAbility extends TriggeredAbilityImpl { } } // reset the remembered creatures for every combat damage step - if (event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE) { + if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE) { triggeringCreatures.clear(); } return false; diff --git a/Mage.Sets/src/mage/cards/f/FlameBurst.java b/Mage.Sets/src/mage/cards/f/FlameBurst.java index d13e9d6a10e..cdf034fb28b 100644 --- a/Mage.Sets/src/mage/cards/f/FlameBurst.java +++ b/Mage.Sets/src/mage/cards/f/FlameBurst.java @@ -72,8 +72,8 @@ class FlameBurstCount extends CardsInAllGraveyardsCount { } @Override - public int calculate(Game game, Ability source, Effect effect) { - return super.calculate(game, source, effect) + 2; + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return super.calculate(game, sourceAbility, effect) + 2; } } diff --git a/Mage.Sets/src/mage/cards/f/FlameKinWarScout.java b/Mage.Sets/src/mage/cards/f/FlameKinWarScout.java index 73580ab86c0..0d2d903c25d 100644 --- a/Mage.Sets/src/mage/cards/f/FlameKinWarScout.java +++ b/Mage.Sets/src/mage/cards/f/FlameKinWarScout.java @@ -75,7 +75,7 @@ class FlameKinWarScourEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { Effect effect = new DamageTargetEffect(4).setText("{this} deals 4 damage to it"); effect.setTargetPointer(this.getTargetPointer()); return effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/f/FlameSpill.java b/Mage.Sets/src/mage/cards/f/FlameSpill.java index 50707d477dc..6c3a159d454 100644 --- a/Mage.Sets/src/mage/cards/f/FlameSpill.java +++ b/Mage.Sets/src/mage/cards/f/FlameSpill.java @@ -69,10 +69,10 @@ class FlameSpillEffect extends OneShotEffect { lethal = Math.min(lethal, 1); } lethal = Math.min(lethal, 4); - permanent.damage(lethal, source.getSourceId(), game); + permanent.damage(lethal, source.getSourceId(), source, game); Player player = game.getPlayer(permanent.getControllerId()); if (player != null && lethal < 4) { - player.damage(4 - lethal, source.getSourceId(), game); + player.damage(4 - lethal, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FlameblastDragon.java b/Mage.Sets/src/mage/cards/f/FlameblastDragon.java index fc4557b4d7d..20579e0d61a 100644 --- a/Mage.Sets/src/mage/cards/f/FlameblastDragon.java +++ b/Mage.Sets/src/mage/cards/f/FlameblastDragon.java @@ -70,15 +70,15 @@ class FlameblastDragonEffect extends OneShotEffect { if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "? If you do, Flameblast Dragon deals X damage to any target", source, game)) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(costX, source.getSourceId(), game, false, true); + permanent.damage(costX, source.getSourceId(), source, game, false, true); return true; } Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { - targetPlayer.damage(costX, source.getSourceId(), game); + targetPlayer.damage(costX, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/Flamebreak.java b/Mage.Sets/src/mage/cards/f/Flamebreak.java index 78091a868d4..075bd6363c1 100644 --- a/Mage.Sets/src/mage/cards/f/Flamebreak.java +++ b/Mage.Sets/src/mage/cards/f/Flamebreak.java @@ -75,7 +75,7 @@ class FlamebreakCantRegenerateEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.REGENERATE) { + if (event.getType() == GameEvent.EventType.REGENERATE) { DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId()); if (watcher != null) { return watcher.wasDamaged(event.getTargetId(), game); diff --git a/Mage.Sets/src/mage/cards/f/FlamesOfTheRazeBoar.java b/Mage.Sets/src/mage/cards/f/FlamesOfTheRazeBoar.java index 35f5be6fd21..83a19a92eba 100644 --- a/Mage.Sets/src/mage/cards/f/FlamesOfTheRazeBoar.java +++ b/Mage.Sets/src/mage/cards/f/FlamesOfTheRazeBoar.java @@ -68,7 +68,7 @@ class FlamesOfTheRazeBoarEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.damage(4, source.getSourceId(), game); + permanent.damage(4, source.getSourceId(), source, game); if (!FerociousCondition.instance.apply(game, source)) { return true; } diff --git a/Mage.Sets/src/mage/cards/f/FlamespeakerAdept.java b/Mage.Sets/src/mage/cards/f/FlamespeakerAdept.java index 53ce27461e2..829ba2fbb1f 100644 --- a/Mage.Sets/src/mage/cards/f/FlamespeakerAdept.java +++ b/Mage.Sets/src/mage/cards/f/FlamespeakerAdept.java @@ -62,7 +62,7 @@ class ScryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SCRIED; + return event.getType() == GameEvent.EventType.SCRIED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/Flash.java b/Mage.Sets/src/mage/cards/f/Flash.java index 7d0628f1f7e..449a442bf18 100644 --- a/Mage.Sets/src/mage/cards/f/Flash.java +++ b/Mage.Sets/src/mage/cards/f/Flash.java @@ -74,14 +74,14 @@ class FlashEffect extends OneShotEffect { ManaCosts reducedCost = ManaCosts.removeVariableManaCost(CardUtil.reduceCost(card.getManaCost(), 2)); if (controller.chooseUse(Outcome.Benefit, String.valueOf("Pay " + reducedCost.getText()) + Character.toString('?'), source, game)) { reducedCost.clearPaid(); - if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (reducedCost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/f/FlashConscription.java b/Mage.Sets/src/mage/cards/f/FlashConscription.java index ec60a4b850d..801033c6de3 100644 --- a/Mage.Sets/src/mage/cards/f/FlashConscription.java +++ b/Mage.Sets/src/mage/cards/f/FlashConscription.java @@ -72,9 +72,9 @@ class FlashConscriptionTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FlashFoliage.java b/Mage.Sets/src/mage/cards/f/FlashFoliage.java index 1767bb73fe6..98334099189 100644 --- a/Mage.Sets/src/mage/cards/f/FlashFoliage.java +++ b/Mage.Sets/src/mage/cards/f/FlashFoliage.java @@ -73,7 +73,7 @@ class FlashFoliageEffect extends OneShotEffect { if (controller != null) { Token token = new SaprolingToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); Permanent attackingCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (attackingCreature != null && game.getState().getCombat() != null) { // Possible ruling (see Aetherplasm) diff --git a/Mage.Sets/src/mage/cards/f/FlayedNim.java b/Mage.Sets/src/mage/cards/f/FlayedNim.java index 65febe01783..cc06e7c3df7 100644 --- a/Mage.Sets/src/mage/cards/f/FlayedNim.java +++ b/Mage.Sets/src/mage/cards/f/FlayedNim.java @@ -75,7 +75,7 @@ class FlayedNimEffect extends OneShotEffect { return false; } int damage = (int) this.getValue("damage"); - player.loseLife(damage, game, false); + player.loseLife(damage, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java b/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java index c25c1cc6fbf..f4040720e87 100644 --- a/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java +++ b/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java @@ -64,7 +64,7 @@ class FlayerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -120,12 +120,12 @@ class FlayerEffect extends OneShotEffect { UUID target = source.getTargets().getFirstTarget(); Permanent targetCreature = game.getPermanent(target); if (targetCreature != null) { - targetCreature.damage(amount, creature.getId(), game, false, true); + targetCreature.damage(amount, creature.getId(), source, game, false, true); return true; } Player player = game.getPlayer(target); if (player != null) { - player.damage(amount, creature.getId(), game); + player.damage(amount, creature.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FlayingTendrils.java b/Mage.Sets/src/mage/cards/f/FlayingTendrils.java index 98c6a1934af..618c1d4318c 100644 --- a/Mage.Sets/src/mage/cards/f/FlayingTendrils.java +++ b/Mage.Sets/src/mage/cards/f/FlayingTendrils.java @@ -73,7 +73,7 @@ class FlayingTendrilsReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FleetingMemories.java b/Mage.Sets/src/mage/cards/f/FleetingMemories.java index ca59ae051cf..052c96b2397 100644 --- a/Mage.Sets/src/mage/cards/f/FleetingMemories.java +++ b/Mage.Sets/src/mage/cards/f/FleetingMemories.java @@ -70,7 +70,7 @@ class FleetingMemoriesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FleshAllergy.java b/Mage.Sets/src/mage/cards/f/FleshAllergy.java index 9134edaaf4f..757c53ee31d 100644 --- a/Mage.Sets/src/mage/cards/f/FleshAllergy.java +++ b/Mage.Sets/src/mage/cards/f/FleshAllergy.java @@ -62,7 +62,7 @@ class FleshAllergyWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (card != null && card.isCreature()) { creaturesDiedThisTurn++; @@ -107,7 +107,7 @@ class FleshAllergyEffect extends OneShotEffect { if (player != null) { int amount = watcher.getCreaturesDiedThisTurn(); if (amount > 0) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FleshBlood.java b/Mage.Sets/src/mage/cards/f/FleshBlood.java index 87a841f2bd3..cfa947ac66c 100644 --- a/Mage.Sets/src/mage/cards/f/FleshBlood.java +++ b/Mage.Sets/src/mage/cards/f/FleshBlood.java @@ -68,7 +68,7 @@ class FleshEffect extends OneShotEffect { Card targetCard = game.getCard(source.getFirstTarget()); if (targetCard != null) { int power = targetCard.getPower().getValue(); - targetCard.moveToExile(null, null, source.getSourceId(), game); + targetCard.moveToExile(null, null, source, game); if (power > 0) { Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (targetCreature != null) { @@ -107,12 +107,12 @@ class BloodEffect extends OneShotEffect { Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (sourcePermanent != null && targetCreature != null) { - targetCreature.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true); + targetCreature.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), source, game, false, true); return true; } Player targetPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (sourcePermanent != null && targetPlayer != null) { - targetPlayer.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game); + targetPlayer.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FleshReaver.java b/Mage.Sets/src/mage/cards/f/FleshReaver.java index a702ab8cfe0..75d054cc2b0 100644 --- a/Mage.Sets/src/mage/cards/f/FleshReaver.java +++ b/Mage.Sets/src/mage/cards/f/FleshReaver.java @@ -112,7 +112,7 @@ class FleshReaverEffect extends OneShotEffect { } int damageToDeal = (Integer) getValue("damage"); if (damageToDeal > 0) { - controller.damage(damageToDeal, source.getSourceId(), game); + controller.damage(damageToDeal, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/Flickerform.java b/Mage.Sets/src/mage/cards/f/Flickerform.java index 5f800a0b6a7..32ecccd6a3d 100644 --- a/Mage.Sets/src/mage/cards/f/Flickerform.java +++ b/Mage.Sets/src/mage/cards/f/Flickerform.java @@ -94,11 +94,11 @@ class FlickerformEffect extends OneShotEffect { Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo()); if (enchantedCreature != null) { UUID exileZoneId = UUID.randomUUID(); - enchantedCreature.moveToExile(exileZoneId, enchantment.getName(), source.getSourceId(), game); + enchantedCreature.moveToExile(exileZoneId, enchantment.getName(), source, game); for (UUID attachementId : enchantedCreature.getAttachments()) { Permanent attachment = game.getPermanent(attachementId); if (attachment != null && filter.match(attachment, game)) { - attachment.moveToExile(exileZoneId, enchantment.getName(), source.getSourceId(), game); + attachment.moveToExile(exileZoneId, enchantment.getName(), source, game); } } if (!(enchantedCreature instanceof Token)) { @@ -185,7 +185,7 @@ class FlickerformReturnEffect extends OneShotEffect { controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game); for (Card card : toBattlefieldAttached) { if (game.getState().getZone(card.getId()) == Zone.BATTLEFIELD) { - newPermanent.addAttachment(card.getId(), game); + newPermanent.addAttachment(card.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java b/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java index 51b22dc2dfe..e4cde43d95b 100644 --- a/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java +++ b/Mage.Sets/src/mage/cards/f/FlickeringSpirit.java @@ -68,10 +68,10 @@ class FlickeringSpiritEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Flickering Spirit", source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), "Flickering Spirit", source, game)) { Card card = game.getExile().getCard(source.getSourceId(), game); if (card != null) { - return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + return card.moveToZone(Zone.BATTLEFIELD, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/f/Flickerwisp.java b/Mage.Sets/src/mage/cards/f/Flickerwisp.java index c67632972dc..36ef9e8d01d 100644 --- a/Mage.Sets/src/mage/cards/f/Flickerwisp.java +++ b/Mage.Sets/src/mage/cards/f/Flickerwisp.java @@ -78,7 +78,7 @@ class FlickerwispEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null && sourcePermanent != null) { - if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source, game, Zone.BATTLEFIELD, true)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step"); diff --git a/Mage.Sets/src/mage/cards/f/FlourishingDefenses.java b/Mage.Sets/src/mage/cards/f/FlourishingDefenses.java index ba39c5b34c8..8ae32bf5a74 100644 --- a/Mage.Sets/src/mage/cards/f/FlourishingDefenses.java +++ b/Mage.Sets/src/mage/cards/f/FlourishingDefenses.java @@ -56,7 +56,7 @@ class FlourishingDefensesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_ADDED; + return event.getType() == GameEvent.EventType.COUNTER_ADDED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/Flux.java b/Mage.Sets/src/mage/cards/f/Flux.java index 21be11d74db..bdc9cdf03fb 100644 --- a/Mage.Sets/src/mage/cards/f/Flux.java +++ b/Mage.Sets/src/mage/cards/f/Flux.java @@ -60,8 +60,8 @@ class FluxEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int numToDiscard = player.getAmount(0, player.getHand().size(), "Discard how many cards?", game); - player.discard(numToDiscard, false, source, game); - player.drawCards(numToDiscard, source.getSourceId(), game); + player.discard(numToDiscard, false, false, source, game); + player.drawCards(numToDiscard, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/FoeRazerRegent.java b/Mage.Sets/src/mage/cards/f/FoeRazerRegent.java index a6375acc09e..188274190ab 100644 --- a/Mage.Sets/src/mage/cards/f/FoeRazerRegent.java +++ b/Mage.Sets/src/mage/cards/f/FoeRazerRegent.java @@ -76,12 +76,12 @@ class FoeRazerRegentTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.FIGHTED_PERMANENT; + return event.getType() == GameEvent.EventType.FIGHTED_PERMANENT; } @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); if (permanent != null && permanent.isControlledBy(getControllerId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent, game)); @@ -114,7 +114,7 @@ class FoeRazerRegentDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FoldIntoAether.java b/Mage.Sets/src/mage/cards/f/FoldIntoAether.java index bff45dca282..c7a7c7a30e1 100644 --- a/Mage.Sets/src/mage/cards/f/FoldIntoAether.java +++ b/Mage.Sets/src/mage/cards/f/FoldIntoAether.java @@ -64,7 +64,7 @@ class FoldIntoAetherEffect extends OneShotEffect { if (stackObject != null) { spellController = game.getPlayer(stackObject.getControllerId()); } - if (game.getStack().counter(targetId, source.getSourceId(), game)) { + if (game.getStack().counter(targetId, source, game)) { TargetCardInHand target = new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE); if (spellController != null && target.canChoose(source.getSourceId(), spellController.getId(), game) diff --git a/Mage.Sets/src/mage/cards/f/FontOfAgonies.java b/Mage.Sets/src/mage/cards/f/FontOfAgonies.java index 4abcc4eb09a..3bcc74095fd 100644 --- a/Mage.Sets/src/mage/cards/f/FontOfAgonies.java +++ b/Mage.Sets/src/mage/cards/f/FontOfAgonies.java @@ -70,7 +70,9 @@ class FontOfAgoniesTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(controllerId) && event.getAmount() > 0) { this.getEffects().clear(); - this.addEffect(new AddCountersSourceEffect(CounterType.BLOOD.createInstance(event.getAmount()))); + if (event.getAmount() > 0) { + this.addEffect(new AddCountersSourceEffect(CounterType.BLOOD.createInstance(event.getAmount()))); + } return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FontOfMythos.java b/Mage.Sets/src/mage/cards/f/FontOfMythos.java index ca0d199b4d2..83f66e1331c 100644 --- a/Mage.Sets/src/mage/cards/f/FontOfMythos.java +++ b/Mage.Sets/src/mage/cards/f/FontOfMythos.java @@ -52,7 +52,7 @@ class FontOfMythosAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_STEP_PRE; + return event.getType() == GameEvent.EventType.DRAW_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/ForbiddenCrypt.java b/Mage.Sets/src/mage/cards/f/ForbiddenCrypt.java index 3f1471760d6..b6b80d51611 100644 --- a/Mage.Sets/src/mage/cards/f/ForbiddenCrypt.java +++ b/Mage.Sets/src/mage/cards/f/ForbiddenCrypt.java @@ -89,7 +89,7 @@ class ForbiddenCryptDrawCardReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } @Override @@ -122,27 +122,13 @@ class ForbiddenCryptPutIntoYourGraveyardReplacementEffect extends ReplacementEff @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - if (permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } else { - Card card = game.getCard(event.getTargetId()); - if (card != null) { - return controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } - return false; - } - return true; + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/ForbiddenOrchard.java b/Mage.Sets/src/mage/cards/f/ForbiddenOrchard.java index 65895bb145e..970cd7d492f 100644 --- a/Mage.Sets/src/mage/cards/f/ForbiddenOrchard.java +++ b/Mage.Sets/src/mage/cards/f/ForbiddenOrchard.java @@ -86,7 +86,10 @@ class ForbiddenOrchardTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getSourceId().equals(getSourceId()) && !game.inCheckPlayableState(); + if (game.inCheckPlayableState()) { // Ignored - see GameEvent.TAPPED_FOR_MANA + return false; + } + return event.getSourceId().equals(getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/cards/f/ForceBubble.java b/Mage.Sets/src/mage/cards/f/ForceBubble.java index 585a21668ad..b300dc09117 100644 --- a/Mage.Sets/src/mage/cards/f/ForceBubble.java +++ b/Mage.Sets/src/mage/cards/f/ForceBubble.java @@ -73,7 +73,7 @@ class ForceBubbleReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/f/ForceChoke.java b/Mage.Sets/src/mage/cards/f/ForceChoke.java index 19ef0d8e542..8027260414e 100644 --- a/Mage.Sets/src/mage/cards/f/ForceChoke.java +++ b/Mage.Sets/src/mage/cards/f/ForceChoke.java @@ -69,13 +69,13 @@ class ForceChokeEffect extends OneShotEffect { Player objectController = game.getPlayer(stackObject.getControllerId()); if (player != null) { Cost cost = new PayLifeCost(stackObject.getConvertedManaCost()); - if (cost.canPay(source, source.getSourceId(), objectController.getId(), game) + if (cost.canPay(source, source, objectController.getId(), game) && objectController.chooseUse(Outcome.LoseLife, "Pay " + stackObject.getConvertedManaCost() + " life?", source, game) - && cost.pay(source, game, source.getSourceId(), objectController.getId(), false, null)) { + && cost.pay(source, game, source, objectController.getId(), false, null)) { objectController.moveCards((Card) stackObject, Zone.HAND, source, game); } else { - game.getStack().counter(stackObject.getId(), source.getSourceId(), game); + game.getStack().counter(stackObject.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/ForceDrain.java b/Mage.Sets/src/mage/cards/f/ForceDrain.java index aa7893390ab..6d400277ec0 100644 --- a/Mage.Sets/src/mage/cards/f/ForceDrain.java +++ b/Mage.Sets/src/mage/cards/f/ForceDrain.java @@ -62,13 +62,13 @@ class ForceDrainEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.damage(2, source.getId(), game, false, true); + permanent.damage(2, source.getId(), source, game, false, true); return true; } Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player != null) { - if (player.damage(2, source.getId(), game) > 0) { + if (player.damage(2, source.getId(), source, game) > 0) { controller.gainLife(2, game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/f/ForceOfNature.java b/Mage.Sets/src/mage/cards/f/ForceOfNature.java index 79c0fef32bf..a780b073422 100644 --- a/Mage.Sets/src/mage/cards/f/ForceOfNature.java +++ b/Mage.Sets/src/mage/cards/f/ForceOfNature.java @@ -70,8 +70,8 @@ class ForceOfNatureEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("{G}{G}{G}{G}"); String message = "Would you like to pay {G}{G}{G}{G} to prevent taking 8 damage from {this}?"; if (!(controller.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) { - controller.damage(8, source.getSourceId(), game); + && cost.pay(source, game, source, controller.getId(), false, null))) { + controller.damage(8, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/ForceOfRage.java b/Mage.Sets/src/mage/cards/f/ForceOfRage.java index 2dfd8cbccf9..e22c44d0322 100644 --- a/Mage.Sets/src/mage/cards/f/ForceOfRage.java +++ b/Mage.Sets/src/mage/cards/f/ForceOfRage.java @@ -82,7 +82,7 @@ class ForceOfRageEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Token token = new AkoumStonewakerElementalToken(); - token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(2, game, source, source.getControllerId()); List permanentList = new ArrayList(); for (UUID permId : token.getLastAddedTokenIds()) { permanentList.add(game.getPermanent(permId)); diff --git a/Mage.Sets/src/mage/cards/f/ForcedMarch.java b/Mage.Sets/src/mage/cards/f/ForcedMarch.java index 52c9fc782da..0559c203b3e 100644 --- a/Mage.Sets/src/mage/cards/f/ForcedMarch.java +++ b/Mage.Sets/src/mage/cards/f/ForcedMarch.java @@ -63,7 +63,7 @@ class ForcedMarchEffect extends OneShotEffect { source.getSourceId(), game)) { if (permanent.getConvertedManaCost() <= source.getManaCostsToPay().getX()) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/Forcefield.java b/Mage.Sets/src/mage/cards/f/Forcefield.java index 9534b45eb50..7a1c8e3de2a 100644 --- a/Mage.Sets/src/mage/cards/f/Forcefield.java +++ b/Mage.Sets/src/mage/cards/f/Forcefield.java @@ -115,7 +115,7 @@ class ForcefieldPreventionEffect extends PreventionEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/f/Foreshadow.java b/Mage.Sets/src/mage/cards/f/Foreshadow.java index 2ac311b6f3d..a73a4578b1e 100644 --- a/Mage.Sets/src/mage/cards/f/Foreshadow.java +++ b/Mage.Sets/src/mage/cards/f/Foreshadow.java @@ -72,7 +72,7 @@ class ForeshadowEffect extends OneShotEffect { } for (Card card : targetPlayer.millCards(1, source, game).getCards(game)) { if (CardUtil.haveSameNames(card, cardName, game)) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); break; } } diff --git a/Mage.Sets/src/mage/cards/f/Foresight.java b/Mage.Sets/src/mage/cards/f/Foresight.java index 15f1bb3a7dd..87dc3ffb352 100644 --- a/Mage.Sets/src/mage/cards/f/Foresight.java +++ b/Mage.Sets/src/mage/cards/f/Foresight.java @@ -67,7 +67,7 @@ class ForesightEffect extends SearchEffect { for (UUID targetId : getTargets()) { Card card = player.getLibrary().getCard(targetId, game); if (card != null) { - card.moveToExile(null, null, targetId, game); + card.moveToExile(null, null, source, game); } } player.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/f/Forget.java b/Mage.Sets/src/mage/cards/f/Forget.java index 43b8b685ea5..b1703aaecd4 100644 --- a/Mage.Sets/src/mage/cards/f/Forget.java +++ b/Mage.Sets/src/mage/cards/f/Forget.java @@ -57,7 +57,7 @@ class ForgetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { - targetPlayer.drawCards(targetPlayer.discard(2, false, source, game).size(), source.getSourceId(), game); + targetPlayer.drawCards(targetPlayer.discard(2, false, false, source, game).size(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java index 17c36972bfc..4b4a68a9541 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java @@ -130,7 +130,7 @@ public final class ForgottenAncient extends CardImpl { //Move all the counters for each chosen creature for (CounterMovement cm : counterMovements) { - sourcePermanent.removeCounters(CounterType.P1P1.createInstance(cm.counters), game); + sourcePermanent.removeCounters(CounterType.P1P1.createInstance(cm.counters), source, game); game.getPermanent(cm.target).addCounters(CounterType.P1P1.createInstance(cm.counters), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/f/ForgottenCreation.java b/Mage.Sets/src/mage/cards/f/ForgottenCreation.java index fd93164daf9..4592eece913 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenCreation.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenCreation.java @@ -66,8 +66,8 @@ class ForgottenCreationEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int cardsInHand = controller.getHand().size(); - controller.discard(cardsInHand, false, source, game); - controller.drawCards(cardsInHand, source.getSourceId(), game); + controller.discard(cardsInHand, false, false, source, game); + controller.drawCards(cardsInHand, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/ForgottenLore.java b/Mage.Sets/src/mage/cards/f/ForgottenLore.java index 8798d3f7555..a95151c30c3 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenLore.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenLore.java @@ -72,7 +72,7 @@ class ForgottenLoreEffect extends OneShotEffect { do { chosenCard = new TargetCardInGraveyard(filter); chosenCard.setNotTarget(true); - if (chosenCard.canChoose(opponent.getId(), game)) { + if (chosenCard.canChoose(source.getSourceId(), opponent.getId(), game)) { opponent.chooseTarget(Outcome.ReturnToHand, chosenCard, source, game); card = game.getCard(chosenCard.getFirstTarget()); if (card != null) { @@ -84,9 +84,9 @@ class ForgottenLoreEffect extends OneShotEffect { } if (!done) { - if (cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) { + if (cost.canPay(source, source, you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) { cost.clearPaid(); - if (!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { + if (!cost.pay(source, game, source, you.getId(), false, null)) { done = true; } } else { diff --git a/Mage.Sets/src/mage/cards/f/Fork.java b/Mage.Sets/src/mage/cards/f/Fork.java index 3c18033485e..a26b2efd293 100644 --- a/Mage.Sets/src/mage/cards/f/Fork.java +++ b/Mage.Sets/src/mage/cards/f/Fork.java @@ -10,6 +10,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.filter.StaticFilters; import mage.game.Game; +import mage.game.events.CopiedStackObjectEvent; import mage.game.events.GameEvent; import mage.game.stack.Spell; import mage.players.Player; @@ -63,7 +64,7 @@ class ForkEffect extends OneShotEffect { copy.getColor(game).setRed(true); game.getStack().push(copy); copy.chooseNewTargets(game, controller.getId()); - game.fireEvent(new GameEvent(GameEvent.EventType.COPIED_STACKOBJECT, copy.getId(), spell.getId(), source.getControllerId())); + game.fireEvent(new CopiedStackObjectEvent(spell, copy, source.getControllerId())); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FormOfTheDinosaur.java b/Mage.Sets/src/mage/cards/f/FormOfTheDinosaur.java index c226ad0eb99..1dc0b06c1ab 100644 --- a/Mage.Sets/src/mage/cards/f/FormOfTheDinosaur.java +++ b/Mage.Sets/src/mage/cards/f/FormOfTheDinosaur.java @@ -66,8 +66,8 @@ class FormOfTheDinosaurEffect extends OneShotEffect { if (controller != null) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(15, source.getSourceId(), game, false, true); - controller.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game); + targetCreature.damage(15, source.getSourceId(), source, game, false, true); + controller.damage(targetCreature.getPower().getValue(), targetCreature.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/ForsakenWastes.java b/Mage.Sets/src/mage/cards/f/ForsakenWastes.java index 6fb1308f391..3d4d6a08493 100644 --- a/Mage.Sets/src/mage/cards/f/ForsakenWastes.java +++ b/Mage.Sets/src/mage/cards/f/ForsakenWastes.java @@ -67,7 +67,7 @@ class ForsakenWastesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FortunateFew.java b/Mage.Sets/src/mage/cards/f/FortunateFew.java index 2a47202d4c6..351d5ec37d5 100644 --- a/Mage.Sets/src/mage/cards/f/FortunateFew.java +++ b/Mage.Sets/src/mage/cards/f/FortunateFew.java @@ -87,7 +87,7 @@ class FortunateFewEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) { if (!chosenCards.containsKey(permanent)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/FoulTongueShriek.java b/Mage.Sets/src/mage/cards/f/FoulTongueShriek.java index 725a760e578..66c9ffaa73a 100644 --- a/Mage.Sets/src/mage/cards/f/FoulTongueShriek.java +++ b/Mage.Sets/src/mage/cards/f/FoulTongueShriek.java @@ -61,7 +61,7 @@ class FoulTongueShriekEffect extends OneShotEffect { if (controller != null && targetOpponent != null) { int amount = new AttackingCreatureCount(StaticFilters.FILTER_PERMANENT_CREATURES_CONTROLLED).calculate(game, source, this); if (amount > 0) { - targetOpponent.loseLife(amount, game, false); + targetOpponent.loseLife(amount, game, source, false); controller.gainLife(amount, game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/f/FracturedIdentity.java b/Mage.Sets/src/mage/cards/f/FracturedIdentity.java index 773929ed528..12399e4b367 100644 --- a/Mage.Sets/src/mage/cards/f/FracturedIdentity.java +++ b/Mage.Sets/src/mage/cards/f/FracturedIdentity.java @@ -61,7 +61,7 @@ class FracturedIdentityEffect extends OneShotEffect { return false; } - permanent.moveToExile(null, null, source.getSourceId(), game); + permanent.moveToExile(null, null, source, game); UUID controllerId = permanent.getControllerId(); for (UUID opponentId : game.getOpponents(controllerId)) { CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(opponentId, null, false); diff --git a/Mage.Sets/src/mage/cards/f/FracturedLoyalty.java b/Mage.Sets/src/mage/cards/f/FracturedLoyalty.java index 8a61d5bde11..6af01b09f0a 100644 --- a/Mage.Sets/src/mage/cards/f/FracturedLoyalty.java +++ b/Mage.Sets/src/mage/cards/f/FracturedLoyalty.java @@ -111,7 +111,7 @@ public final class FracturedLoyalty extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FracturingGust.java b/Mage.Sets/src/mage/cards/f/FracturingGust.java index 4da56870aef..39b65216003 100644 --- a/Mage.Sets/src/mage/cards/f/FracturingGust.java +++ b/Mage.Sets/src/mage/cards/f/FracturingGust.java @@ -63,7 +63,7 @@ class FracturingGustDestroyEffect extends OneShotEffect { if (controller != null) { int destroyedPermanents = 0; for (Permanent permanent: game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { ++destroyedPermanents; } } diff --git a/Mage.Sets/src/mage/cards/f/FrayingOmnipotence.java b/Mage.Sets/src/mage/cards/f/FrayingOmnipotence.java index 6afdf6a92f5..ab4485f7545 100644 --- a/Mage.Sets/src/mage/cards/f/FrayingOmnipotence.java +++ b/Mage.Sets/src/mage/cards/f/FrayingOmnipotence.java @@ -69,7 +69,7 @@ class FrayingOmnipotenceEffect extends OneShotEffect { continue; } int lifeToLose = (int) Math.ceil(player.getLife() / 2.0); - player.loseLife(lifeToLose, game, false); + player.loseLife(lifeToLose, game, source, false); } // then discards half of the cards in their hand, for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { @@ -79,7 +79,7 @@ class FrayingOmnipotenceEffect extends OneShotEffect { } int cardsToDiscard = (int) Math.ceil(player.getHand().size() / 2.0); if (cardsToDiscard > 0) { - player.discard(cardsToDiscard, false, source, game); + player.discard(cardsToDiscard, false, false, source, game); } } // then sacrifices half of the creatures they control, @@ -98,7 +98,7 @@ class FrayingOmnipotenceEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/f/FrayingSanity.java b/Mage.Sets/src/mage/cards/f/FrayingSanity.java index c718c331d89..8549bf53359 100644 --- a/Mage.Sets/src/mage/cards/f/FrayingSanity.java +++ b/Mage.Sets/src/mage/cards/f/FrayingSanity.java @@ -70,7 +70,7 @@ class FrayingSanityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FreeForAll.java b/Mage.Sets/src/mage/cards/f/FreeForAll.java index 631cc6bcd9f..33e8a57ad3f 100644 --- a/Mage.Sets/src/mage/cards/f/FreeForAll.java +++ b/Mage.Sets/src/mage/cards/f/FreeForAll.java @@ -73,7 +73,7 @@ class FreeForAllExileAllEffect extends OneShotEffect { List permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { Card card = game.getCard(permanent.getId()); - permanent.moveToExile(source.getSourceId(), "Free-for-All", source.getSourceId(), game); + permanent.moveToExile(source.getSourceId(), "Free-for-All", source, game); if (card != null) { card.setFaceDown(true, game); } diff --git a/Mage.Sets/src/mage/cards/f/FreeRangeChicken.java b/Mage.Sets/src/mage/cards/f/FreeRangeChicken.java index 2c49c722dac..fb56e2cfd65 100644 --- a/Mage.Sets/src/mage/cards/f/FreeRangeChicken.java +++ b/Mage.Sets/src/mage/cards/f/FreeRangeChicken.java @@ -64,8 +64,8 @@ class FreeRangeChickenEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int firstRoll = controller.rollDice(game, 6); - int secondRoll = controller.rollDice(game, 6); + int firstRoll = controller.rollDice(source, game, 6); + int secondRoll = controller.rollDice(source, game, 6); if (firstRoll == secondRoll) { game.addEffect(new BoostSourceEffect(firstRoll, firstRoll, Duration.EndOfTurn), source); } @@ -75,7 +75,7 @@ class FreeRangeChickenEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { if (watcher.rolledThisTurn(sourcePermanent.getId(), totalRoll)) { - sourcePermanent.sacrifice(source.getSourceId(), game); + sourcePermanent.sacrifice(source, game); } else { watcher.addRoll(sourcePermanent.getId(), totalRoll); } diff --git a/Mage.Sets/src/mage/cards/f/FreneticEfreet.java b/Mage.Sets/src/mage/cards/f/FreneticEfreet.java index e5d37014a01..5d00e595a0c 100644 --- a/Mage.Sets/src/mage/cards/f/FreneticEfreet.java +++ b/Mage.Sets/src/mage/cards/f/FreneticEfreet.java @@ -76,7 +76,7 @@ class FreneticEfreetEffect extends OneShotEffect { if (flip) { return permanent.phaseOut(game); } else { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FreneticSliver.java b/Mage.Sets/src/mage/cards/f/FreneticSliver.java index e054ecb968f..31ecd4752fc 100644 --- a/Mage.Sets/src/mage/cards/f/FreneticSliver.java +++ b/Mage.Sets/src/mage/cards/f/FreneticSliver.java @@ -79,7 +79,7 @@ class FreneticSliverEffect extends OneShotEffect { if (player.flipCoin(source, game, true)) { return new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true).apply(game, source); } else { - return perm.sacrifice(source.getSourceId(), game); + return perm.sacrifice(source, game); } } diff --git a/Mage.Sets/src/mage/cards/f/FrenziedFugue.java b/Mage.Sets/src/mage/cards/f/FrenziedFugue.java index e5e5b410ed9..a346e2f2956 100644 --- a/Mage.Sets/src/mage/cards/f/FrenziedFugue.java +++ b/Mage.Sets/src/mage/cards/f/FrenziedFugue.java @@ -68,14 +68,14 @@ class FrenziedFugueTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD || event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override public boolean checkTrigger(GameEvent event, Game game) { this.getEffects().clear(); boolean result; - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { result = event.getTargetId().equals(this.getSourceId()); } else { result = event.getPlayerId().equals(this.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/f/FrenzySliver.java b/Mage.Sets/src/mage/cards/f/FrenzySliver.java index cd6dd8ce279..e24aa4423ad 100644 --- a/Mage.Sets/src/mage/cards/f/FrenzySliver.java +++ b/Mage.Sets/src/mage/cards/f/FrenzySliver.java @@ -75,7 +75,7 @@ class FrenzyAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java b/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java index 1db467c4846..17ee773a0f4 100644 --- a/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java +++ b/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java @@ -70,7 +70,7 @@ class FreyalisesWindsReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanentUntapping = game.getPermanent(event.getTargetId()); if (permanentUntapping != null) { - permanentUntapping.removeCounters(CounterType.WIND.createInstance(), game); + permanentUntapping.removeCounters(CounterType.WIND.createInstance(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FriendlyFire.java b/Mage.Sets/src/mage/cards/f/FriendlyFire.java index 76156eafe68..b5e46688821 100644 --- a/Mage.Sets/src/mage/cards/f/FriendlyFire.java +++ b/Mage.Sets/src/mage/cards/f/FriendlyFire.java @@ -68,8 +68,8 @@ class FriendlyFireEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controllerOfTargetCreature.revealCards(sourceObject.getName(), cards, game); int damage = card.getConvertedManaCost(); - targetCreature.damage(damage, source.getSourceId(), game, false, true); - controllerOfTargetCreature.damage(damage, source.getSourceId(), game); + targetCreature.damage(damage, source.getSourceId(), source, game, false, true); + controllerOfTargetCreature.damage(damage, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FrightfulDelusion.java b/Mage.Sets/src/mage/cards/f/FrightfulDelusion.java index d43ce5d902e..d290b6a56ab 100644 --- a/Mage.Sets/src/mage/cards/f/FrightfulDelusion.java +++ b/Mage.Sets/src/mage/cards/f/FrightfulDelusion.java @@ -64,12 +64,9 @@ class FrightfulDelusionEffect extends OneShotEffect { Player player = game.getPlayer(spell.getControllerId()); if (player != null) { cost.clearPaid(); - game.getPlayer(spell.getControllerId()).discard( - 1, false, source, game); - if (!cost.pay(source, game, spell.getControllerId(), - spell.getControllerId(), false, null)) { - return game.getStack().counter(source.getFirstTarget(), - source.getSourceId(), game); + game.getPlayer(spell.getControllerId()).discard(1, false, false, source, game); + if (!cost.pay(source, game, source, spell.getControllerId(), false, null)) { + return game.getStack().counter(source.getFirstTarget(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/f/FromTheAshes.java b/Mage.Sets/src/mage/cards/f/FromTheAshes.java index 8dd0b42910b..0a502170a5e 100644 --- a/Mage.Sets/src/mage/cards/f/FromTheAshes.java +++ b/Mage.Sets/src/mage/cards/f/FromTheAshes.java @@ -71,7 +71,7 @@ class FromTheAshesEffect extends OneShotEffect { int amount = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) { amount++; - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } playerAmount.put(playerId, amount); } diff --git a/Mage.Sets/src/mage/cards/f/FrostTitan.java b/Mage.Sets/src/mage/cards/f/FrostTitan.java index 6af21e881a8..bdf65ff0bbd 100644 --- a/Mage.Sets/src/mage/cards/f/FrostTitan.java +++ b/Mage.Sets/src/mage/cards/f/FrostTitan.java @@ -72,7 +72,7 @@ class FrostTitanAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FrozenAether.java b/Mage.Sets/src/mage/cards/f/FrozenAether.java index 5f84c09b0f0..e2ce50382aa 100644 --- a/Mage.Sets/src/mage/cards/f/FrozenAether.java +++ b/Mage.Sets/src/mage/cards/f/FrozenAether.java @@ -62,7 +62,7 @@ class FrozenAetherTapEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FruitOfTheFirstTree.java b/Mage.Sets/src/mage/cards/f/FruitOfTheFirstTree.java index 6a9c0c6af87..43434d66c17 100644 --- a/Mage.Sets/src/mage/cards/f/FruitOfTheFirstTree.java +++ b/Mage.Sets/src/mage/cards/f/FruitOfTheFirstTree.java @@ -71,7 +71,7 @@ class FruitOfTheFirstTreeEffect extends OneShotEffect { Permanent creature = (Permanent) getValue("attachedTo"); if (controller != null && creature != null) { controller.gainLife(creature.getToughness().getValue(), game, source); - controller.drawCards(creature.getToughness().getValue(), source.getSourceId(), game); + controller.drawCards(creature.getToughness().getValue(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FruitcakeElemental.java b/Mage.Sets/src/mage/cards/f/FruitcakeElemental.java index 5c755046e2b..ffa433f9163 100644 --- a/Mage.Sets/src/mage/cards/f/FruitcakeElemental.java +++ b/Mage.Sets/src/mage/cards/f/FruitcakeElemental.java @@ -112,7 +112,7 @@ class FruitcakeElementalControlSourceEffect extends ContinuousEffectImpl { Player player = game.getPlayer(source.getFirstTarget()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && player != null) { - permanent.changeControllerId(player.getId(), game); + permanent.changeControllerId(player.getId(), game, source); } else { // no valid target exists, effect can be discarded discard(); diff --git a/Mage.Sets/src/mage/cards/f/FulfillContract.java b/Mage.Sets/src/mage/cards/f/FulfillContract.java index 4caa4dbdb9d..4be9167a736 100644 --- a/Mage.Sets/src/mage/cards/f/FulfillContract.java +++ b/Mage.Sets/src/mage/cards/f/FulfillContract.java @@ -75,7 +75,7 @@ class FulfillContractEffect extends OneShotEffect { Permanent permanentToDestroy = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent permanentToPutCounter = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (controller != null) { - if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(), game, false)) { + if (permanentToDestroy != null && permanentToDestroy.destroy(source, game, false)) { if (permanentToPutCounter != null) { permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(), source, game); } diff --git a/Mage.Sets/src/mage/cards/f/FulgentDistraction.java b/Mage.Sets/src/mage/cards/f/FulgentDistraction.java index 1ee3c502991..4396eebfe5c 100644 --- a/Mage.Sets/src/mage/cards/f/FulgentDistraction.java +++ b/Mage.Sets/src/mage/cards/f/FulgentDistraction.java @@ -70,11 +70,11 @@ class FulgentDistractionEffect extends OneShotEffect { } if ( isEquipment ) { - creature.removeAttachment(equipmentId, game); + creature.removeAttachment(equipmentId, source, game); } } - creature.tap(game); + creature.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/Fumble.java b/Mage.Sets/src/mage/cards/f/Fumble.java index cddbed62612..33ef9e604c6 100644 --- a/Mage.Sets/src/mage/cards/f/Fumble.java +++ b/Mage.Sets/src/mage/cards/f/Fumble.java @@ -97,7 +97,7 @@ class FumbleEffect extends OneShotEffect { effect.setTargetPointer(new FixedTarget(attachment, game)); game.addEffect(effect, source); if (newCreature != null) { - attachment.attachTo(newCreature.getId(), game); + attachment.attachTo(newCreature.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/f/Fumigate.java b/Mage.Sets/src/mage/cards/f/Fumigate.java index b74ef2339e4..0e12812e898 100644 --- a/Mage.Sets/src/mage/cards/f/Fumigate.java +++ b/Mage.Sets/src/mage/cards/f/Fumigate.java @@ -58,7 +58,7 @@ class FumigateEffect extends OneShotEffect { if (controller != null) { int destroyedCreature = 0; for (Permanent creature : game.getState().getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game)) { - if (creature.destroy(source.getSourceId(), game, false)) { + if (creature.destroy(source, game, false)) { destroyedCreature++; } } diff --git a/Mage.Sets/src/mage/cards/f/FuneralPyre.java b/Mage.Sets/src/mage/cards/f/FuneralPyre.java index 79c01fe8bc6..2e3da19b424 100644 --- a/Mage.Sets/src/mage/cards/f/FuneralPyre.java +++ b/Mage.Sets/src/mage/cards/f/FuneralPyre.java @@ -63,11 +63,11 @@ class FuneralPyreEffect extends OneShotEffect { Card exiledCard = game.getCard(source.getTargets().getFirstTarget()); if (exiledCard != null) { UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), 0); - if (exiledCard.moveToExile(exileId, "Funeral Pyre", source.getSourceId(), game)) { + if (exiledCard.moveToExile(exileId, "Funeral Pyre", source, game)) { Player owner = game.getPlayer(exiledCard.getOwnerId()); if (owner != null) { Token token = new SpiritWhiteToken(); - return token.putOntoBattlefield(1, game, source.getSourceId(), owner.getId()); + return token.putOntoBattlefield(1, game, source, owner.getId()); } } } diff --git a/Mage.Sets/src/mage/cards/f/FungalBehemoth.java b/Mage.Sets/src/mage/cards/f/FungalBehemoth.java index 7210bb93c70..cf7f27fa486 100644 --- a/Mage.Sets/src/mage/cards/f/FungalBehemoth.java +++ b/Mage.Sets/src/mage/cards/f/FungalBehemoth.java @@ -77,7 +77,7 @@ class FungalBehemothTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FurnaceCelebration.java b/Mage.Sets/src/mage/cards/f/FurnaceCelebration.java index 9e71fe55b45..b8da9e94b8e 100644 --- a/Mage.Sets/src/mage/cards/f/FurnaceCelebration.java +++ b/Mage.Sets/src/mage/cards/f/FurnaceCelebration.java @@ -56,7 +56,7 @@ class FurnaceCelebrationAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FuryCharm.java b/Mage.Sets/src/mage/cards/f/FuryCharm.java index 2c9ef3a7c1b..61a4becb5ac 100644 --- a/Mage.Sets/src/mage/cards/f/FuryCharm.java +++ b/Mage.Sets/src/mage/cards/f/FuryCharm.java @@ -94,12 +94,12 @@ class FuryCharmRemoveCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.removeCounters(CounterType.TIME.getName(), 2, game); + permanent.removeCounters(CounterType.TIME.getName(), 2, source, game); return true; } Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); if (card != null) { - card.removeCounters(CounterType.TIME.getName(), 2, game); + card.removeCounters(CounterType.TIME.getName(), 2, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GOTOJAIL.java b/Mage.Sets/src/mage/cards/g/GOTOJAIL.java index 2bfe95c33da..4ac0aafdc14 100644 --- a/Mage.Sets/src/mage/cards/g/GOTOJAIL.java +++ b/Mage.Sets/src/mage/cards/g/GOTOJAIL.java @@ -112,7 +112,7 @@ class GoToJailTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -153,10 +153,10 @@ class GoToJailUpkeepEffect extends OneShotEffect { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - int thisRoll = opponent.rollDice(game, 6); - int thatRoll = opponent.rollDice(game, 6); + int thisRoll = opponent.rollDice(source, game, 6); + int thatRoll = opponent.rollDice(source, game, 6); if (thisRoll == thatRoll) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/g/GahijiHonoredOne.java b/Mage.Sets/src/mage/cards/g/GahijiHonoredOne.java index 3f8f8604c5a..3278081c015 100644 --- a/Mage.Sets/src/mage/cards/g/GahijiHonoredOne.java +++ b/Mage.Sets/src/mage/cards/g/GahijiHonoredOne.java @@ -66,7 +66,7 @@ class GahijiHonoredOneTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GalepowderMage.java b/Mage.Sets/src/mage/cards/g/GalepowderMage.java index 5353fc095f1..47f330defad 100644 --- a/Mage.Sets/src/mage/cards/g/GalepowderMage.java +++ b/Mage.Sets/src/mage/cards/g/GalepowderMage.java @@ -88,7 +88,7 @@ class GalepowderMageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { UUID exileId = UUID.randomUUID(); - if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true)) { Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null) { Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); diff --git a/Mage.Sets/src/mage/cards/g/GallopingLizrog.java b/Mage.Sets/src/mage/cards/g/GallopingLizrog.java index 34362d524e8..99f2c870f16 100644 --- a/Mage.Sets/src/mage/cards/g/GallopingLizrog.java +++ b/Mage.Sets/src/mage/cards/g/GallopingLizrog.java @@ -77,7 +77,7 @@ class GallopingLizrogEffect extends OneShotEffect { = new RemoveVariableCountersTargetCost(StaticFilters.FILTER_CONTROLLED_CREATURE, CounterType.P1P1); int toPay = variableCost.announceXValue(source, game); Cost cost = variableCost.getFixedCostsFromAnnouncedValue(toPay); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } return new AddCountersSourceEffect( diff --git a/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java b/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java index a6734cc9f81..e3414a67609 100644 --- a/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java +++ b/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java @@ -80,7 +80,7 @@ class GallowsAtWillowHillEffect extends OneShotEffect { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { Player controller = game.getPlayer(permanent.getControllerId()); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (controller != null) { CreateTokenTargetEffect effect = new CreateTokenTargetEffect(new SpiritWhiteToken()); effect.setTargetPointer(new FixedTarget(controller.getId())); diff --git a/Mage.Sets/src/mage/cards/g/GalvanicBombardment.java b/Mage.Sets/src/mage/cards/g/GalvanicBombardment.java index 4d44c642c4d..f924f699048 100644 --- a/Mage.Sets/src/mage/cards/g/GalvanicBombardment.java +++ b/Mage.Sets/src/mage/cards/g/GalvanicBombardment.java @@ -60,11 +60,11 @@ class GalvanicBombardmentCardsInControllerGraveyardCount implements DynamicValue } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; - Player controller = game.getPlayer(source.getControllerId()); + Player controller = game.getPlayer(sourceAbility.getControllerId()); if (controller != null) { - amount += controller.getGraveyard().count(filter, source.getSourceId(), source.getControllerId(), game); + amount += controller.getGraveyard().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); } return amount + 2; } diff --git a/Mage.Sets/src/mage/cards/g/GameOfChaos.java b/Mage.Sets/src/mage/cards/g/GameOfChaos.java index 53010b05fa4..f098915c390 100644 --- a/Mage.Sets/src/mage/cards/g/GameOfChaos.java +++ b/Mage.Sets/src/mage/cards/g/GameOfChaos.java @@ -99,7 +99,7 @@ class GameOfChaosEffect extends OneShotEffect { private void handleLifeChangesFromFlip(Game game, Player playerGainingLife, Player playerLosingLife, int lifeAmount, Ability source) { playerGainingLife.gainLife(lifeAmount, game, source); - playerLosingLife.loseLife(lifeAmount, game, false); + playerLosingLife.loseLife(lifeAmount, game, source, false); } private boolean cannotContinueFlipping(Player you, Player opponent) { diff --git a/Mage.Sets/src/mage/cards/g/GarbageElementalC.java b/Mage.Sets/src/mage/cards/g/GarbageElementalC.java index e1be2e44bc1..ebf853683a9 100644 --- a/Mage.Sets/src/mage/cards/g/GarbageElementalC.java +++ b/Mage.Sets/src/mage/cards/g/GarbageElementalC.java @@ -71,11 +71,11 @@ class GarbageElementalCEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int thisRoll = controller.rollDice(game, 6); - int thatRoll = controller.rollDice(game, 6); + int thisRoll = controller.rollDice(source, game, 6); + int thatRoll = controller.rollDice(source, game, 6); Token token = new GoblinToken(); - return token.putOntoBattlefield(Math.abs(thatRoll - thisRoll), game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(Math.abs(thatRoll - thisRoll), game, source, source.getControllerId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GarbageElementalD.java b/Mage.Sets/src/mage/cards/g/GarbageElementalD.java index b0076f79d4b..9eae2804d64 100644 --- a/Mage.Sets/src/mage/cards/g/GarbageElementalD.java +++ b/Mage.Sets/src/mage/cards/g/GarbageElementalD.java @@ -72,8 +72,8 @@ class GarbageElementalDEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Player opponent = game.getPlayer(source.getFirstTarget()); if (controller != null && opponent != null) { - int damage = controller.rollDice(game, 6); - return game.damagePlayerOrPlaneswalker(opponent.getId(), damage, source.getId(), game, false, true) > 0; + int damage = controller.rollDice(source, game, 6); + return game.damagePlayerOrPlaneswalker(opponent.getId(), damage, source.getId(), source, game, false, true) > 0; } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GargantuanGorilla.java b/Mage.Sets/src/mage/cards/g/GargantuanGorilla.java index 868a6f42228..94e57aa3ab3 100644 --- a/Mage.Sets/src/mage/cards/g/GargantuanGorilla.java +++ b/Mage.Sets/src/mage/cards/g/GargantuanGorilla.java @@ -89,10 +89,10 @@ class GargantuanGorillaSacrificeEffect extends OneShotEffect { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); SacrificeTargetCost cost = new SacrificeTargetCost(target); if (!controller.chooseUse(Outcome.Benefit, "Do you wish to sacrifice a Forest?", source, game) - || !cost.canPay(source, source.getSourceId(), source.getControllerId(), game) - || !cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { - sourcePermanent.sacrifice(source.getSourceId(), game); - controller.damage(7, sourcePermanent.getId(), game); + || !cost.canPay(source, source, source.getControllerId(), game) + || !cost.pay(source, game, source, source.getControllerId(), true)) { + sourcePermanent.sacrifice(source, game); + controller.damage(7, sourcePermanent.getId(), source, game); } else if (cost.isPaid()) { for (Permanent permanent : cost.getPermanents()) { if (filterSnow.match(permanent, game)) { @@ -127,8 +127,8 @@ class GargantuanGorillaFightEffect extends OneShotEffect { // 20110930 - 701.10 if (creature1 != null && sourcePermanent != null) { if (creature1.isCreature() && sourcePermanent.isCreature()) { - sourcePermanent.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true); - creature1.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true); + sourcePermanent.damage(creature1.getPower().getValue(), creature1.getId(), source, game, false, true); + creature1.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GarrukPrimalHunter.java b/Mage.Sets/src/mage/cards/g/GarrukPrimalHunter.java index 872225567b6..b3f60f46064 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukPrimalHunter.java +++ b/Mage.Sets/src/mage/cards/g/GarrukPrimalHunter.java @@ -80,7 +80,7 @@ class GarrukPrimalHunterEffect extends OneShotEffect { amount = p.getPower().getValue(); } } - player.drawCards(amount, source.getSourceId(), game); + player.drawCards(amount, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GarrukRelentless.java b/Mage.Sets/src/mage/cards/g/GarrukRelentless.java index 53c06b35184..e5f9f080c92 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukRelentless.java +++ b/Mage.Sets/src/mage/cards/g/GarrukRelentless.java @@ -103,11 +103,11 @@ class GarrukRelentlessDamageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { int damage = permanent.getPower().getValue(); - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); if (damage > 0) { Permanent garruk = game.getPermanent(source.getSourceId()); if (garruk != null) { - garruk.damage(damage, permanent.getId(), game, false, true); + garruk.damage(damage, permanent.getId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java index 8a0cb276cdf..97fe6f1794b 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java +++ b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java @@ -126,15 +126,15 @@ class GarrukTheVeilCursedEffect extends OneShotEffect { // sacrifice a creature Target target = new TargetControlledPermanent(1, 1, filterCreature, false); boolean sacrificed = false; - if (target.canChoose(controller.getId(), game)) { - while (controller.canRespond() && !target.isChosen() && target.canChoose(controller.getId(), game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game)) { + while (controller.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game)) { controller.chooseTarget(Outcome.Sacrifice, target, source, game); } for (int idx = 0; idx < target.getTargets().size(); idx++) { Permanent permanent = game.getPermanent(target.getTargets().get(idx)); if (permanent != null) { - sacrificed |= permanent.sacrifice(source.getSourceId(), game); + sacrificed |= permanent.sacrifice(source, game); } } } @@ -147,7 +147,7 @@ class GarrukTheVeilCursedEffect extends OneShotEffect { for (UUID cardId : targetInLibrary.getTargets()) { Card card = controller.getLibrary().remove(cardId, game); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); cards.add(card); } } diff --git a/Mage.Sets/src/mage/cards/g/GarzasAssassin.java b/Mage.Sets/src/mage/cards/g/GarzasAssassin.java index 3136ddf356f..345f57b775a 100644 --- a/Mage.Sets/src/mage/cards/g/GarzasAssassin.java +++ b/Mage.Sets/src/mage/cards/g/GarzasAssassin.java @@ -20,8 +20,10 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; +import mage.game.events.GameEvent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; +import mage.util.CardUtil; /** * @@ -72,25 +74,26 @@ class GarzasAssassinCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); return controller != null && (controller.getLife() < 1 || controller.canPayLifeCost(ability)); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); - if (controller != null) { - int currentLife = controller.getLife(); - int lifeToPay = (currentLife + currentLife % 2) / 2; // Divide by two and round up. - if (lifeToPay < 0) { - this.paid = true; - } else { - this.paid = (controller.loseLife(lifeToPay, game, false) == lifeToPay); - } - return this.paid; + if (controller == null) { + return false; } - return false; + + int currentLife = controller.getLife(); + int lifeToPay = Math.max(0, (currentLife + currentLife % 2) / 2); // Divide by two and round up. + if (lifeToPay <= 0) { + this.paid = true; + } else { + this.paid = CardUtil.tryPayLife(lifeToPay, controller, source, game); + } + return this.paid; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GauntletOfPower.java b/Mage.Sets/src/mage/cards/g/GauntletOfPower.java index ac0956d58e7..6d2ce308815 100644 --- a/Mage.Sets/src/mage/cards/g/GauntletOfPower.java +++ b/Mage.Sets/src/mage/cards/g/GauntletOfPower.java @@ -114,7 +114,7 @@ class GauntletOfPowerTapForManaAllTriggeredAbility extends TriggeredManaAbility @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GazeOfAdamaro.java b/Mage.Sets/src/mage/cards/g/GazeOfAdamaro.java index f5a732c6605..35fb700c3da 100644 --- a/Mage.Sets/src/mage/cards/g/GazeOfAdamaro.java +++ b/Mage.Sets/src/mage/cards/g/GazeOfAdamaro.java @@ -58,7 +58,7 @@ class GazeOfAdamaroEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(targetPlayer.getHand().size(), source.getSourceId(), game); + targetPlayer.damage(targetPlayer.getHand().size(), source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GazeOfGranite.java b/Mage.Sets/src/mage/cards/g/GazeOfGranite.java index 883352a9ca6..8edde7aa5d5 100644 --- a/Mage.Sets/src/mage/cards/g/GazeOfGranite.java +++ b/Mage.Sets/src/mage/cards/g/GazeOfGranite.java @@ -63,7 +63,7 @@ class GazeOfGraniteEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (!permanent.isLand() && permanent.getConvertedManaCost() <= source.getManaCostsToPay().getX()) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GazeOfPain.java b/Mage.Sets/src/mage/cards/g/GazeOfPain.java index d442ab3c870..842dbab080e 100644 --- a/Mage.Sets/src/mage/cards/g/GazeOfPain.java +++ b/Mage.Sets/src/mage/cards/g/GazeOfPain.java @@ -124,7 +124,7 @@ class GazeOfPainEffect extends OneShotEffect { && attacker != null) { if (controller.chooseUse(outcome, "Do you wish to deal damage equal to " + attacker.getName() + "'s power to a target creature?", source, game)) { TargetCreaturePermanent target = new TargetCreaturePermanent(); - if (target.canChoose(controller.getId(), game) + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(Outcome.Detriment, target, source.getSourceId(), game)) { Effect effect = new DamageTargetEffect(attacker.getPower().getValue()); effect.setTargetPointer(new FixedTarget(target.getFirstTarget())); diff --git a/Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java b/Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java index c2889337d5c..5f88a67731b 100644 --- a/Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java +++ b/Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java @@ -109,7 +109,7 @@ class GazeOfTheGorgonEffect extends OneShotEffect { } } for (Permanent creature : toDestroy) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GeistSnatch.java b/Mage.Sets/src/mage/cards/g/GeistSnatch.java index 53171139bec..dbc2ad050ef 100644 --- a/Mage.Sets/src/mage/cards/g/GeistSnatch.java +++ b/Mage.Sets/src/mage/cards/g/GeistSnatch.java @@ -56,9 +56,9 @@ class GeistSnatchCounterTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); Token token = new SpiritBlueToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GelatinousGenesis.java b/Mage.Sets/src/mage/cards/g/GelatinousGenesis.java index c43771d9df4..2c76f1b623f 100644 --- a/Mage.Sets/src/mage/cards/g/GelatinousGenesis.java +++ b/Mage.Sets/src/mage/cards/g/GelatinousGenesis.java @@ -53,7 +53,7 @@ class GelatinousGenesisEffect extends OneShotEffect { OozeToken oozeToken = new OozeToken(); oozeToken.getPower().modifyBaseValue(count); oozeToken.getToughness().modifyBaseValue(count); - oozeToken.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId()); + oozeToken.putOntoBattlefield(count, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/g/GeminiEngine.java b/Mage.Sets/src/mage/cards/g/GeminiEngine.java index a1ea20c4dff..7f7818b1066 100644 --- a/Mage.Sets/src/mage/cards/g/GeminiEngine.java +++ b/Mage.Sets/src/mage/cards/g/GeminiEngine.java @@ -77,7 +77,7 @@ class GeminiEngineCreateTokenEffect extends OneShotEffect { } else { token = new GeminiEngineTwinToken(0, 0); } - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, true); + token.putOntoBattlefield(1, game, source, source.getControllerId(), false, true); for (UUID tokenId : token.getLastAddedTokenIds()) { Permanent tokenPerm = game.getPermanent(tokenId); if (tokenPerm != null) { diff --git a/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java b/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java index ee2b7c14662..6ab2e4980bb 100644 --- a/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java +++ b/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java @@ -132,8 +132,8 @@ class GemstoneCavernsEffect extends OneShotEffect { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { Cost cost = new ExileFromHandCost(new TargetCardInHand()); - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) { - result = cost.pay(source, game, source.getSourceId(), source.getControllerId(), true, null); + if (cost.canPay(source, source, source.getControllerId(), game)) { + result = cost.pay(source, game, source, source.getControllerId(), true, null); } } } diff --git a/Mage.Sets/src/mage/cards/g/GeneralsEnforcer.java b/Mage.Sets/src/mage/cards/g/GeneralsEnforcer.java index 130990fd902..736afab6b8d 100644 --- a/Mage.Sets/src/mage/cards/g/GeneralsEnforcer.java +++ b/Mage.Sets/src/mage/cards/g/GeneralsEnforcer.java @@ -89,7 +89,7 @@ class GeneralsEnforcerEffect extends OneShotEffect { } boolean isCreature = card.isCreature(); if (player.moveCards(card, Zone.EXILED, source, game) && isCreature) { - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GenerousGift.java b/Mage.Sets/src/mage/cards/g/GenerousGift.java index b1ba9ac7a72..52ee004c88a 100644 --- a/Mage.Sets/src/mage/cards/g/GenerousGift.java +++ b/Mage.Sets/src/mage/cards/g/GenerousGift.java @@ -63,7 +63,7 @@ class GenerousGiftEffect extends OneShotEffect { return false; } Player player = game.getPlayer(permanent.getControllerId()); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (player == null) { return false; } diff --git a/Mage.Sets/src/mage/cards/g/GenesisChamber.java b/Mage.Sets/src/mage/cards/g/GenesisChamber.java index aa1cccb0b90..de830012cce 100644 --- a/Mage.Sets/src/mage/cards/g/GenesisChamber.java +++ b/Mage.Sets/src/mage/cards/g/GenesisChamber.java @@ -94,7 +94,7 @@ class GenesisChamberEffect extends OneShotEffect { Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (permanent != null) { MyrToken token = new MyrToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); + token.putOntoBattlefield(1, game, source, permanent.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GeodeGolem.java b/Mage.Sets/src/mage/cards/g/GeodeGolem.java index f4f5bd8bd40..27647e42f88 100644 --- a/Mage.Sets/src/mage/cards/g/GeodeGolem.java +++ b/Mage.Sets/src/mage/cards/g/GeodeGolem.java @@ -113,7 +113,7 @@ class GeodeGolemEffect extends OneShotEffect { // CAST: as spell or as land if (cost == null - || cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { + || cost.pay(source, game, source, controller.getId(), false, null)) { if (commander.getSpellAbility() != null) { game.getState().setValue("PlayFromNotOwnHandZone" + commander.getId(), Boolean.TRUE); Boolean commanderWasCast = controller.cast(controller.chooseAbilityForCast(commander, game, true), diff --git a/Mage.Sets/src/mage/cards/g/GerrardsVerdict.java b/Mage.Sets/src/mage/cards/g/GerrardsVerdict.java index 303368a0e81..0ced4069dcf 100644 --- a/Mage.Sets/src/mage/cards/g/GerrardsVerdict.java +++ b/Mage.Sets/src/mage/cards/g/GerrardsVerdict.java @@ -60,7 +60,7 @@ class GerrardsVerdictEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (controller != null && targetPlayer != null) { - controller.gainLife(targetPlayer.discard(2, false, source, game).count(new FilterLandCard(), game) * 3, game, source); + controller.gainLife(targetPlayer.discard(2, false, false, source, game).count(new FilterLandCard(), game) * 3, game, source); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GhastlyConscription.java b/Mage.Sets/src/mage/cards/g/GhastlyConscription.java index bee1b65f554..e1faf99df74 100644 --- a/Mage.Sets/src/mage/cards/g/GhastlyConscription.java +++ b/Mage.Sets/src/mage/cards/g/GhastlyConscription.java @@ -68,7 +68,7 @@ class GhastlyConscriptionEffect extends OneShotEffect { List cardsToManifest = new ArrayList<>(); for (Card card : targetPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game)) { cardsToManifest.add(card); - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); } if (cardsToManifest.isEmpty()) { return true; diff --git a/Mage.Sets/src/mage/cards/g/GhastlyDemise.java b/Mage.Sets/src/mage/cards/g/GhastlyDemise.java index d1ed05e7416..5c422c3c1fe 100644 --- a/Mage.Sets/src/mage/cards/g/GhastlyDemise.java +++ b/Mage.Sets/src/mage/cards/g/GhastlyDemise.java @@ -76,7 +76,7 @@ class GhastlyDemiseEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null && permanent.getToughness().getValue() <= game.getPlayer(source.getControllerId()).getGraveyard().size()) { - permanent.destroy(source.getSourceId(), game, noRegen); + permanent.destroy(source, game, noRegen); affectedTargets++; } } @@ -85,7 +85,7 @@ class GhastlyDemiseEffect extends OneShotEffect { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null && permanent.getToughness().getValue() <= game.getPlayer(source.getControllerId()).getGraveyard().size()) { - permanent.destroy(source.getSourceId(), game, noRegen); + permanent.destroy(source, game, noRegen); affectedTargets++; } } diff --git a/Mage.Sets/src/mage/cards/g/GhastlyDiscovery.java b/Mage.Sets/src/mage/cards/g/GhastlyDiscovery.java index c831e3c0e30..9d54dd395b3 100644 --- a/Mage.Sets/src/mage/cards/g/GhastlyDiscovery.java +++ b/Mage.Sets/src/mage/cards/g/GhastlyDiscovery.java @@ -58,8 +58,8 @@ class GhastlyDiscoveryEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(2, source.getSourceId(), game); - controller.discard(1, false, source, game); + controller.drawCards(2, source, game); + controller.discard(1, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GhostsOfTheInnocent.java b/Mage.Sets/src/mage/cards/g/GhostsOfTheInnocent.java index 46c1c582f2e..f5bea61a16b 100644 --- a/Mage.Sets/src/mage/cards/g/GhostsOfTheInnocent.java +++ b/Mage.Sets/src/mage/cards/g/GhostsOfTheInnocent.java @@ -13,6 +13,7 @@ import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import java.util.UUID; @@ -60,9 +61,9 @@ class GhostsOfTheInnocentPreventDamageEffect extends ReplacementEffectImpl imple @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE - || event.getType() == EventType.DAMAGE_PLAYER - || event.getType() == EventType.DAMAGE_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE + || event.getType() == GameEvent.EventType.DAMAGE_PLAYER + || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER; } @Override @@ -78,10 +79,10 @@ class GhostsOfTheInnocentPreventDamageEffect extends ReplacementEffectImpl imple @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { int amount = (int) Math.ceil(event.getAmount() / 2.0); - GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source.getControllerId(), amount, ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), amount, ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { event.setAmount(event.getAmount() - amount); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, event.getTargetId(), source.getSourceId(), source.getControllerId(), amount)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), amount)); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/Ghoulraiser.java b/Mage.Sets/src/mage/cards/g/Ghoulraiser.java index 4e39980c85d..8c4087e84c2 100644 --- a/Mage.Sets/src/mage/cards/g/Ghoulraiser.java +++ b/Mage.Sets/src/mage/cards/g/Ghoulraiser.java @@ -70,7 +70,7 @@ class GhoulraiserEffect extends OneShotEffect { Card[] cards = player.getGraveyard().getCards(filter, game).toArray(new Card[0]); if (cards.length > 0) { Card card = cards[RandomUtil.nextInt(cards.length)]; - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); game.informPlayers(card.getName() + "returned to the hand of" + player.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/g/GiantAlbatross.java b/Mage.Sets/src/mage/cards/g/GiantAlbatross.java index ceaa56f5b1f..097f307879d 100644 --- a/Mage.Sets/src/mage/cards/g/GiantAlbatross.java +++ b/Mage.Sets/src/mage/cards/g/GiantAlbatross.java @@ -83,11 +83,11 @@ class GiantAlbatrossEffect extends OneShotEffect { for (Permanent creature : creatures) { if (sourcePermanent.getDealtDamageByThisTurn().contains(new MageObjectReference(creature.getId(), game))) { final StringBuilder sb = new StringBuilder("Pay 2 life? (Otherwise ").append(creature.getName()).append(" will be destroyed)"); - if (cost.canPay(source, creature.getControllerId(), creature.getControllerId(), game) && player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { - cost.pay(source, game, creature.getControllerId(), creature.getControllerId(), true, null); + if (cost.canPay(source, source, creature.getControllerId(), game) && player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { + cost.pay(source, game, source, creature.getControllerId(), true, null); } if (!cost.isPaid()) { - creature.destroy(source.getSourceId(), game, true); + creature.destroy(source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/g/GibberingDescent.java b/Mage.Sets/src/mage/cards/g/GibberingDescent.java index 289d30a01f1..23cca63d0a3 100644 --- a/Mage.Sets/src/mage/cards/g/GibberingDescent.java +++ b/Mage.Sets/src/mage/cards/g/GibberingDescent.java @@ -76,7 +76,7 @@ class GibberingDescentSkipUpkeepEffect extends ContinuousRuleModifyingEffectImpl @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP; + return event.getType() == GameEvent.EventType.UPKEEP_STEP; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GideonChampionOfJustice.java b/Mage.Sets/src/mage/cards/g/GideonChampionOfJustice.java index 2b479ffe998..d30ddfc0c13 100644 --- a/Mage.Sets/src/mage/cards/g/GideonChampionOfJustice.java +++ b/Mage.Sets/src/mage/cards/g/GideonChampionOfJustice.java @@ -89,7 +89,7 @@ class GideonExileAllOtherPermanentsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (!permanent.getId().equals(source.getSourceId())) { - permanent.moveToExile(null, null, source.getSourceId(), game); + permanent.moveToExile(null, null, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GideonsIntervention.java b/Mage.Sets/src/mage/cards/g/GideonsIntervention.java index c186aa86285..ecd8ba62fe6 100644 --- a/Mage.Sets/src/mage/cards/g/GideonsIntervention.java +++ b/Mage.Sets/src/mage/cards/g/GideonsIntervention.java @@ -19,6 +19,7 @@ import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.util.CardUtil; @@ -82,7 +83,7 @@ class GideonsInterventionCantCastEffect extends ContinuousRuleModifyingEffectImp @Override public boolean checksEventType(GameEvent event, Game game) { - return (event.getType() == EventType.CAST_SPELL_LATE || event.getType() == EventType.CAST_SPELL); + return (event.getType() == GameEvent.EventType.CAST_SPELL_LATE || event.getType() == GameEvent.EventType.CAST_SPELL); } @Override @@ -119,12 +120,12 @@ class GideonsInterventionPreventAllDamageEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); game.informPlayers("Damage has been prevented: " + damage); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GideonsSacrifice.java b/Mage.Sets/src/mage/cards/g/GideonsSacrifice.java index e3757be28c3..d52bedde4e3 100644 --- a/Mage.Sets/src/mage/cards/g/GideonsSacrifice.java +++ b/Mage.Sets/src/mage/cards/g/GideonsSacrifice.java @@ -162,7 +162,7 @@ class GideonsSacrificeEffectReplacementEffect extends ReplacementEffectImpl { game.informPlayers(message.toString()); // Redirect damage permanent.damage( - damageEvent.getAmount(), damageEvent.getSourceId(), game, + damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects() ); return true; diff --git a/Mage.Sets/src/mage/cards/g/GiftOfDoom.java b/Mage.Sets/src/mage/cards/g/GiftOfDoom.java index d1b821203cb..ee063f9baae 100644 --- a/Mage.Sets/src/mage/cards/g/GiftOfDoom.java +++ b/Mage.Sets/src/mage/cards/g/GiftOfDoom.java @@ -130,12 +130,12 @@ class GiftOfDoomEffect extends OneShotEffect { target.setNotTarget(true); if (player.choose(outcome, target, source.getSourceId(), game) && game.getPermanent(target.getFirstTarget()) != null - && !game.getPermanent(target.getFirstTarget()).cantBeAttachedBy(giftOfDoom, game, false)) { + && !game.getPermanent(target.getFirstTarget()).cantBeAttachedBy(giftOfDoom, source, game, false)) { game.getState().setValue("attachTo:" + giftOfDoom.getId(), target.getFirstTarget()); - game.getPermanent(target.getFirstTarget()).addAttachment(giftOfDoom.getId(), game); + game.getPermanent(target.getFirstTarget()).addAttachment(giftOfDoom.getId(), source, game); return true; } - player.moveCardToGraveyardWithInfo(giftOfDoom, source.getId(), game, Zone.BATTLEFIELD); //no legal target + player.moveCardToGraveyardWithInfo(giftOfDoom, source, game, Zone.BATTLEFIELD); //no legal target return false; } } diff --git a/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java b/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java index 7f193777e06..681ee714e2e 100644 --- a/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java +++ b/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java @@ -117,7 +117,7 @@ class GiftOfImmortalityReturnEnchantmentEffect extends OneShotEffect { if (controller != null && creature != null) { game.getState().setValue("attachTo:" + aura.getId(), creature); controller.moveCards(aura, Zone.BATTLEFIELD, source, game); - return creature.addAttachment(aura.getId(), game); + return creature.addAttachment(aura.getId(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/g/GiftOfTheGargantuan.java b/Mage.Sets/src/mage/cards/g/GiftOfTheGargantuan.java index 36c20bb3c47..1706e63b1e9 100644 --- a/Mage.Sets/src/mage/cards/g/GiftOfTheGargantuan.java +++ b/Mage.Sets/src/mage/cards/g/GiftOfTheGargantuan.java @@ -63,22 +63,22 @@ class GiftOfTheGargantuanEffect extends OneShotEffect { player.lookAtCards(source, null, cards, game); Cards revealedCards = new CardsImpl(); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCreatureCard("creature card to reveal and put into your hand")); - if (target.canChoose(source.getControllerId(), game) + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && player.choose(Outcome.DrawCard, cards, target, game)) { Card card = cards.get(target.getFirstTarget(), game); if (card != null) { cards.remove(card); - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); revealedCards.add(card); } } target = new TargetCard(Zone.LIBRARY, new FilterLandCard("land card to reveal and put into your hand")); - if (target.canChoose(source.getControllerId(), game) + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && player.choose(Outcome.DrawCard, cards, target, game)) { Card card = cards.get(target.getFirstTarget(), game); if (card != null) { cards.remove(card); - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); revealedCards.add(card); } } diff --git a/Mage.Sets/src/mage/cards/g/GildedDrake.java b/Mage.Sets/src/mage/cards/g/GildedDrake.java index 8f067ba7ff1..b14ed9d0460 100644 --- a/Mage.Sets/src/mage/cards/g/GildedDrake.java +++ b/Mage.Sets/src/mage/cards/g/GildedDrake.java @@ -93,7 +93,7 @@ class GildedDrakeEffect extends OneShotEffect { return true; } } - sourceObject.sacrifice(source.getSourceId(), game); + sourceObject.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GiveTake.java b/Mage.Sets/src/mage/cards/g/GiveTake.java index d27da367c50..f5b8becf102 100644 --- a/Mage.Sets/src/mage/cards/g/GiveTake.java +++ b/Mage.Sets/src/mage/cards/g/GiveTake.java @@ -69,10 +69,10 @@ class TakeEffect extends OneShotEffect { if (creature != null) { int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1); if (numberCounters > 0) { - creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game); + creature.removeCounters(CounterType.P1P1.getName(), numberCounters, source, game); Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(numberCounters, source.getSourceId(), game); + controller.drawCards(numberCounters, source, game); } else { throw new UnsupportedOperationException("Controller missing"); } diff --git a/Mage.Sets/src/mage/cards/g/GlacialGrasp.java b/Mage.Sets/src/mage/cards/g/GlacialGrasp.java index b4f5a154be3..200dba1e92b 100644 --- a/Mage.Sets/src/mage/cards/g/GlacialGrasp.java +++ b/Mage.Sets/src/mage/cards/g/GlacialGrasp.java @@ -64,7 +64,7 @@ class GlacialGraspEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.tap(game); + permanent.tap(source, game); game.addEffect(new DontUntapInControllersNextUntapStepTargetEffect(), source); Player player = game.getPlayer(permanent.getControllerId()); if (player == null) { diff --git a/Mage.Sets/src/mage/cards/g/GladehartCavalry.java b/Mage.Sets/src/mage/cards/g/GladehartCavalry.java index df612eb6e01..378085f83ea 100644 --- a/Mage.Sets/src/mage/cards/g/GladehartCavalry.java +++ b/Mage.Sets/src/mage/cards/g/GladehartCavalry.java @@ -65,7 +65,7 @@ class GladehartCavalryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GlamerSpinners.java b/Mage.Sets/src/mage/cards/g/GlamerSpinners.java index 3719b3f3e69..061a3486be6 100644 --- a/Mage.Sets/src/mage/cards/g/GlamerSpinners.java +++ b/Mage.Sets/src/mage/cards/g/GlamerSpinners.java @@ -117,7 +117,7 @@ class GlamerSpinnersEffect extends OneShotEffect { // Check for protection MageObject auraObject = game.getObject(auraId); if (auraObject != null) { - if (permanentToAttachAuras.cantBeAttachedBy(auraObject, game, true)) { + if (permanentToAttachAuras.cantBeAttachedBy(auraObject, source, game, true)) { passed = false; } } @@ -129,8 +129,8 @@ class GlamerSpinnersEffect extends OneShotEffect { for (UUID auraId : aurasToAttach) { Permanent auraToAttachToPermanent = game.getPermanent(auraId); - targetPermanent.removeAttachment(auraToAttachToPermanent.getId(), game); - permanentToAttachAuras.addAttachment(auraToAttachToPermanent.getId(), game); + targetPermanent.removeAttachment(auraToAttachToPermanent.getId(), source, game); + permanentToAttachAuras.addAttachment(auraToAttachToPermanent.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/Glarecaster.java b/Mage.Sets/src/mage/cards/g/Glarecaster.java index 5bd153095c2..81e7e3d865f 100644 --- a/Mage.Sets/src/mage/cards/g/Glarecaster.java +++ b/Mage.Sets/src/mage/cards/g/Glarecaster.java @@ -87,7 +87,7 @@ class GlarecasterEffect extends RedirectionEffect { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE || event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GlimpseOfNature.java b/Mage.Sets/src/mage/cards/g/GlimpseOfNature.java index bd3cac90411..27d2f82c4a5 100644 --- a/Mage.Sets/src/mage/cards/g/GlimpseOfNature.java +++ b/Mage.Sets/src/mage/cards/g/GlimpseOfNature.java @@ -48,7 +48,7 @@ class GlimpseOfNatureTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GlintEyeNephilim.java b/Mage.Sets/src/mage/cards/g/GlintEyeNephilim.java index f20c884b5d1..e33732ebf72 100644 --- a/Mage.Sets/src/mage/cards/g/GlintEyeNephilim.java +++ b/Mage.Sets/src/mage/cards/g/GlintEyeNephilim.java @@ -74,7 +74,7 @@ class GlintEyeNephilimEffect extends OneShotEffect { if (amount > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(amount, source.getSourceId(), game); + controller.drawCards(amount, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GlintHawk.java b/Mage.Sets/src/mage/cards/g/GlintHawk.java index 49d835033cf..f9863caa1d0 100644 --- a/Mage.Sets/src/mage/cards/g/GlintHawk.java +++ b/Mage.Sets/src/mage/cards/g/GlintHawk.java @@ -74,12 +74,12 @@ class GlintHawkEffect extends OneShotEffect { if (controller != null) { boolean targetChosen = false; TargetPermanent target = new TargetPermanent(1, 1, filter, true); - if (target.canChoose(controller.getId(), game) && controller.chooseUse(outcome, "Return an artifact you control to its owner's hand?", source, game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseUse(outcome, "Return an artifact you control to its owner's hand?", source, game)) { controller.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { targetChosen = true; - permanent.moveToZone(Zone.HAND, this.getId(), game, false); + permanent.moveToZone(Zone.HAND, source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/g/GlissaSunseeker.java b/Mage.Sets/src/mage/cards/g/GlissaSunseeker.java index 55cae5edd22..a90d3294651 100644 --- a/Mage.Sets/src/mage/cards/g/GlissaSunseeker.java +++ b/Mage.Sets/src/mage/cards/g/GlissaSunseeker.java @@ -85,7 +85,7 @@ class GlissaSunseekerEffect extends OneShotEffect { int colorlessMana = pool.getColorless(); int manaPoolTotal = blackMana + whiteMana + blueMana + greenMana + redMana + colorlessMana; if (permanent.getConvertedManaCost() == manaPoolTotal) { - return permanent.destroy(source.getSourceId(), game, false); + return permanent.destroy(source, game, false); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GlissaTheTraitor.java b/Mage.Sets/src/mage/cards/g/GlissaTheTraitor.java index b8dbbbc696d..30cd49b5b11 100644 --- a/Mage.Sets/src/mage/cards/g/GlissaTheTraitor.java +++ b/Mage.Sets/src/mage/cards/g/GlissaTheTraitor.java @@ -78,7 +78,7 @@ class GlissaTheTraitorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GlobalRuin.java b/Mage.Sets/src/mage/cards/g/GlobalRuin.java index c734ff3c272..148fb3a9a0b 100644 --- a/Mage.Sets/src/mage/cards/g/GlobalRuin.java +++ b/Mage.Sets/src/mage/cards/g/GlobalRuin.java @@ -63,7 +63,6 @@ class GlobalRuinDestroyLandEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Set lands = new HashSet<>(); - for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if(player != null) { @@ -71,7 +70,7 @@ class GlobalRuinDestroyLandEffect extends OneShotEffect { FilterControlledLandPermanent filter = new FilterControlledLandPermanent(landName + " you control"); filter.add(landName.getPredicate()); Target target = new TargetControlledPermanent(1, 1, filter, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(outcome, target, source, game); lands.add(target.getFirstTarget()); } @@ -80,7 +79,7 @@ class GlobalRuinDestroyLandEffect extends OneShotEffect { } for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_LAND, game)) { if (!lands.contains(permanent.getId())) { - permanent.sacrifice(permanent.getId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GloomSower.java b/Mage.Sets/src/mage/cards/g/GloomSower.java index 29db3f13c6a..35690426a07 100644 --- a/Mage.Sets/src/mage/cards/g/GloomSower.java +++ b/Mage.Sets/src/mage/cards/g/GloomSower.java @@ -75,7 +75,7 @@ class GloomSowerEffect extends OneShotEffect { return false; } - player.loseLife(2, game, false); + player.loseLife(2, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GloomSurgeon.java b/Mage.Sets/src/mage/cards/g/GloomSurgeon.java index cad1dd17230..031c0d52e5d 100644 --- a/Mage.Sets/src/mage/cards/g/GloomSurgeon.java +++ b/Mage.Sets/src/mage/cards/g/GloomSurgeon.java @@ -8,10 +8,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.game.Game; -import mage.game.events.DamageCreatureEvent; -import mage.game.events.DamageEvent; -import mage.game.events.GameEvent; -import mage.game.events.PreventDamageEvent; +import mage.game.events.*; import mage.players.Player; import java.util.UUID; @@ -55,10 +52,10 @@ class GloomSurgeonEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int preventedDamage = event.getAmount(); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), preventedDamage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), preventedDamage)); Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.moveCards(player.getLibrary().getTopCards(game, preventedDamage), Zone.EXILED, source, game); diff --git a/Mage.Sets/src/mage/cards/g/Gloomlance.java b/Mage.Sets/src/mage/cards/g/Gloomlance.java index dc16a349130..363d2530127 100644 --- a/Mage.Sets/src/mage/cards/g/Gloomlance.java +++ b/Mage.Sets/src/mage/cards/g/Gloomlance.java @@ -59,12 +59,12 @@ class GloomlanceEffect extends OneShotEffect { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { Player targetController = game.getPlayer(targetCreature.getControllerId()); - targetCreature.destroy(source.getSourceId(), game, false); + targetCreature.destroy(source, game, false); Permanent destroyedCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (destroyedCreature.getColor(game).isGreen() || destroyedCreature.getColor(game).isWhite()) { if(targetController != null) { - targetController.discard(1, false, source, game); + targetController.discard(1, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GloomwidowsFeast.java b/Mage.Sets/src/mage/cards/g/GloomwidowsFeast.java index e6622535df5..7529b1a2068 100644 --- a/Mage.Sets/src/mage/cards/g/GloomwidowsFeast.java +++ b/Mage.Sets/src/mage/cards/g/GloomwidowsFeast.java @@ -70,12 +70,12 @@ class GloomwidowsFeastEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null) { - targetCreature.destroy(source.getSourceId(), game, false); + targetCreature.destroy(source, game, false); Permanent destroyedCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (destroyedCreature.getColor(game).isBlue() || destroyedCreature.getColor(game).isBlack()) { SpiderToken token = new SpiderToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GlyphOfDoom.java b/Mage.Sets/src/mage/cards/g/GlyphOfDoom.java index a2f16c838d8..b7500d828a8 100644 --- a/Mage.Sets/src/mage/cards/g/GlyphOfDoom.java +++ b/Mage.Sets/src/mage/cards/g/GlyphOfDoom.java @@ -116,7 +116,7 @@ class GlyphOfDoomEffect extends OneShotEffect { } } for (Permanent creature : toDestroy) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GlyphOfLife.java b/Mage.Sets/src/mage/cards/g/GlyphOfLife.java index 133c9332941..17ac4cd5b2f 100644 --- a/Mage.Sets/src/mage/cards/g/GlyphOfLife.java +++ b/Mage.Sets/src/mage/cards/g/GlyphOfLife.java @@ -70,7 +70,7 @@ class GlyphOfLifeTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GlyphOfReincarnation.java b/Mage.Sets/src/mage/cards/g/GlyphOfReincarnation.java index 410741c12b5..219208f3370 100644 --- a/Mage.Sets/src/mage/cards/g/GlyphOfReincarnation.java +++ b/Mage.Sets/src/mage/cards/g/GlyphOfReincarnation.java @@ -88,7 +88,7 @@ class GlyphOfReincarnationEffect extends OneShotEffect { for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { if (!creature.getId().equals(targetWall.getId())) { if (watcher.creatureHasBlockedAttacker(new MageObjectReference(creature, game), new MageObjectReference(targetWall, game), game)) { - if (creature.destroy(source.getSourceId(), game, true) + if (creature.destroy(source, game, true) && game.getState().getZone(creature.getId()) == Zone.GRAVEYARD) { // If a commander is replaced to command zone, the creature does not die Player permController = game.getPlayer(creature.getControllerId()); if (permController != null) { diff --git a/Mage.Sets/src/mage/cards/g/GoblinArchaeologist.java b/Mage.Sets/src/mage/cards/g/GoblinArchaeologist.java index 5b04f0b8fe5..7c9d71d347d 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinArchaeologist.java +++ b/Mage.Sets/src/mage/cards/g/GoblinArchaeologist.java @@ -76,10 +76,10 @@ class GoblinArchaeologistEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { if (!player.flipCoin(source, game, true)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); }else{ Permanent targetArtifact = game.getPermanent(source.getFirstTarget()); - targetArtifact.destroy(source.getSourceId(), game, true); + targetArtifact.destroy(source, game, true); permanent.untap(game); } return true; diff --git a/Mage.Sets/src/mage/cards/g/GoblinArtisans.java b/Mage.Sets/src/mage/cards/g/GoblinArtisans.java index 1e95ff9b777..0442a1723c3 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinArtisans.java +++ b/Mage.Sets/src/mage/cards/g/GoblinArtisans.java @@ -79,7 +79,7 @@ class GoblinArtisansEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.flipCoin(source, game, true)) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } else { List artifacts = game.getBattlefield().getActivePermanents(new FilterControlledArtifactPermanent(), source.getControllerId(), game); if (artifacts.isEmpty()) {//Don't even bother if there is no artifact to 'counter'/sacrifice @@ -108,7 +108,7 @@ class GoblinArtisansEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.BATTLEFIELD, new FilterCard()); controller.choose(Outcome.Sacrifice, cards, target, game); - game.getPermanent(target.getFirstTarget()).sacrifice(source.getSourceId(), game); + game.getPermanent(target.getFirstTarget()).sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GoblinAssassin.java b/Mage.Sets/src/mage/cards/g/GoblinAssassin.java index 2c32aada9b6..4c84b403a93 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinAssassin.java +++ b/Mage.Sets/src/mage/cards/g/GoblinAssassin.java @@ -69,7 +69,7 @@ class GoblinAssassinTriggeredEffect extends OneShotEffect { if (player != null && !player.flipCoin(source, game, false)) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -78,7 +78,7 @@ class GoblinAssassinTriggeredEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GoblinBangchuckers.java b/Mage.Sets/src/mage/cards/g/GoblinBangchuckers.java index 35dd1da2e58..058eb0d65a1 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinBangchuckers.java +++ b/Mage.Sets/src/mage/cards/g/GoblinBangchuckers.java @@ -65,18 +65,18 @@ class GoblinBangchuckersEffect extends OneShotEffect { if (controller.flipCoin(source, game, true)) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); return true; } Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); return true; } } else { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GoblinBowlingTeam.java b/Mage.Sets/src/mage/cards/g/GoblinBowlingTeam.java index 663449e3ae8..3c442308d7b 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinBowlingTeam.java +++ b/Mage.Sets/src/mage/cards/g/GoblinBowlingTeam.java @@ -91,16 +91,16 @@ class GoblinBowlingTeamEffect extends ReplacementEffectImpl { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { DamageEvent damageEvent = (DamageEvent) event; - if (damageEvent.getType() == EventType.DAMAGE_PLAYER) { + if (damageEvent.getType() == GameEvent.EventType.DAMAGE_PLAYER) { Player targetPlayer = game.getPlayer(event.getTargetId()); if (targetPlayer != null) { - targetPlayer.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), controller.rollDice(game, 6)), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + targetPlayer.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), controller.rollDice(source, game, 6)), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); return true; } } else { Permanent targetPermanent = game.getPermanent(event.getTargetId()); if (targetPermanent != null) { - targetPermanent.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), controller.rollDice(game, 6)), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + targetPermanent.damage(CardUtil.addWithOverflowCheck(damageEvent.getAmount(), controller.rollDice(source, game, 6)), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GoblinCadets.java b/Mage.Sets/src/mage/cards/g/GoblinCadets.java index 318f94c7f2e..f69c3baf4d9 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinCadets.java +++ b/Mage.Sets/src/mage/cards/g/GoblinCadets.java @@ -63,7 +63,7 @@ class GoblinCadetsChangeControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java b/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java index e8d175ed61c..4af30625381 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java +++ b/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java @@ -95,11 +95,11 @@ class GoblinCharbelcherEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(damage, source.getSourceId(), game, false, true); + permanent.damage(damage, source.getSourceId(), source, game, false, true); } else { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(damage, source.getSourceId(), game); + targetPlayer.damage(damage, source.getSourceId(), source, game); } } controller.putCardsOnBottomOfLibrary(cards, game, source, true); diff --git a/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java b/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java index dfd2f655d49..1b3e991e50a 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java +++ b/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java @@ -130,12 +130,7 @@ class GoblinDarkDwellersReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - Card card = game.getCard(this.cardId); - if (controller != null && card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); - return true; - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } diff --git a/Mage.Sets/src/mage/cards/g/GoblinFestival.java b/Mage.Sets/src/mage/cards/g/GoblinFestival.java index e8e202928f3..17cac07560e 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinFestival.java +++ b/Mage.Sets/src/mage/cards/g/GoblinFestival.java @@ -72,7 +72,7 @@ class GoblinFestivalChangeControlEffect extends OneShotEffect { if (sourcePermanent != null) { Target target = new TargetOpponent(true); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } @@ -117,7 +117,7 @@ class GoblinFestivalGainControlEffect extends ContinuousEffectImpl { permanent = game.getPermanent(targetPointer.getFirst(game, source)); } if (permanent != null) { - return permanent.changeControllerId(controller, game); + return permanent.changeControllerId(controller, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GoblinGame.java b/Mage.Sets/src/mage/cards/g/GoblinGame.java index 837223505c9..230cd2b861d 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinGame.java +++ b/Mage.Sets/src/mage/cards/g/GoblinGame.java @@ -79,7 +79,7 @@ class GoblinGameEffect extends OneShotEffect { for (Player player : game.getPlayers().values()) { if (player != null) { game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player)); - player.loseLife(numberChosen.get(player), game, false); + player.loseLife(numberChosen.get(player), game, source, false); } } for (Player player : game.getPlayers().values()) { @@ -88,7 +88,7 @@ class GoblinGameEffect extends OneShotEffect { game.informPlayers(player.getLogName() + " chose the lowest number"); Integer amount = (int) Math.ceil(player.getLife() / 2f); if (amount > 0) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/g/GoblinGuide.java b/Mage.Sets/src/mage/cards/g/GoblinGuide.java index 836177e58dc..aa48419d91e 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinGuide.java +++ b/Mage.Sets/src/mage/cards/g/GoblinGuide.java @@ -72,7 +72,7 @@ class GoblinGuideTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GoblinKaboomist.java b/Mage.Sets/src/mage/cards/g/GoblinKaboomist.java index 2df939fa0da..5b4b13da448 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinKaboomist.java +++ b/Mage.Sets/src/mage/cards/g/GoblinKaboomist.java @@ -73,7 +73,7 @@ class GoblinKaboomistFlipCoinEffect extends OneShotEffect { if (!player.flipCoin(source, game, true)) { String message = permanent.getLogName() + " deals 2 damage to itself"; game.informPlayers(message); - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GoblinLyre.java b/Mage.Sets/src/mage/cards/g/GoblinLyre.java index c73453bfbe8..d3c919963a5 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinLyre.java +++ b/Mage.Sets/src/mage/cards/g/GoblinLyre.java @@ -66,11 +66,11 @@ class GoblinLyreEffect extends OneShotEffect { if (controller.flipCoin(source, game, true)) { int damage = CreaturesYouControlCount.instance.calculate(game, source, this); if (opponent != null) { - return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), game, false, true) > 0; + return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), source, game, false, true) > 0; } } else { int damage = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), opponent.getId(), game).size(); - return controller.damage(damage, source.getSourceId(), game) > 0; + return controller.damage(damage, source.getSourceId(), source, game) > 0; } } return false; diff --git a/Mage.Sets/src/mage/cards/g/GoblinPsychopath.java b/Mage.Sets/src/mage/cards/g/GoblinPsychopath.java index ac0d1cfa8e5..16b41178903 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinPsychopath.java +++ b/Mage.Sets/src/mage/cards/g/GoblinPsychopath.java @@ -98,7 +98,7 @@ class GoblinPsychopathEffect extends ReplacementEffectImpl { return false; } // TODO: make this redirect damage from all blockers - controller.damage(event.getAmount(), source.getSourceId(), game); + controller.damage(event.getAmount(), source.getSourceId(), source, game); String sourceLogName = game.getObject(source.getSourceId()).getLogName() + ": "; game.informPlayers(sourceLogName + "Redirected " + event.getAmount() + " damage to " + controller.getLogName()); this.discard(); diff --git a/Mage.Sets/src/mage/cards/g/GoblinRockSled.java b/Mage.Sets/src/mage/cards/g/GoblinRockSled.java index 35ab2426fc2..d936c6d6bd7 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinRockSled.java +++ b/Mage.Sets/src/mage/cards/g/GoblinRockSled.java @@ -86,7 +86,7 @@ class DontUntapIfAttackedLastTurnSourceEffect extends ContinuousRuleModifyingEff @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GoblinSpymaster.java b/Mage.Sets/src/mage/cards/g/GoblinSpymaster.java index b9f470ee3ab..a30c20d8090 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinSpymaster.java +++ b/Mage.Sets/src/mage/cards/g/GoblinSpymaster.java @@ -68,7 +68,7 @@ class SpyMasterGoblinCreateTokenEffect extends OneShotEffect { if (player != null) { Token token = new SpyMasterGoblinToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), player.getId()); + token.putOntoBattlefield(1, game, source, player.getId()); } return true; diff --git a/Mage.Sets/src/mage/cards/g/GoblinTinkerer.java b/Mage.Sets/src/mage/cards/g/GoblinTinkerer.java index 98604a8c2e4..7c4e126d594 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinTinkerer.java +++ b/Mage.Sets/src/mage/cards/g/GoblinTinkerer.java @@ -76,7 +76,7 @@ class GoblinTinkererDamageEffect extends OneShotEffect { Permanent sourceObject = game.getPermanent(source.getSourceId()); int damage = targetArtifact.getConvertedManaCost(); if (sourceObject != null && damage > 0) { - sourceObject.damage(damage, targetArtifact.getId(), game, false, true); + sourceObject.damage(damage, targetArtifact.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GoblinTutor.java b/Mage.Sets/src/mage/cards/g/GoblinTutor.java index 9a01d83b644..18848a28789 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinTutor.java +++ b/Mage.Sets/src/mage/cards/g/GoblinTutor.java @@ -66,7 +66,7 @@ class GoblinTutorEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); Effect effect = null; // 2 - A card named Goblin Tutor diff --git a/Mage.Sets/src/mage/cards/g/GoblinVandal.java b/Mage.Sets/src/mage/cards/g/GoblinVandal.java index 97a0f111cb8..dd1b0e7fae6 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinVandal.java +++ b/Mage.Sets/src/mage/cards/g/GoblinVandal.java @@ -78,7 +78,7 @@ class GoblinVandalTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GoblinWarCry.java b/Mage.Sets/src/mage/cards/g/GoblinWarCry.java index 57cec6bf6df..594eb2a3f61 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinWarCry.java +++ b/Mage.Sets/src/mage/cards/g/GoblinWarCry.java @@ -68,7 +68,7 @@ class GoblinWarCryEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(player.getId())); Target target = new TargetPermanent(1, 1, filter, true); if (target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) { player.chooseTarget(Outcome.DestroyPermanent, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/g/GoblinWelder.java b/Mage.Sets/src/mage/cards/g/GoblinWelder.java index 8df331165b3..5e2e4b83ce1 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinWelder.java +++ b/Mage.Sets/src/mage/cards/g/GoblinWelder.java @@ -76,7 +76,7 @@ public final class GoblinWelder extends CardImpl { && card.isArtifact() && currentZone == Zone.GRAVEYARD && card.isOwnedBy(artifact.getControllerId())) { - boolean sacrifice = artifact.sacrifice(source.getSourceId(), game); + boolean sacrifice = artifact.sacrifice(source, game); boolean putOnBF = owner.moveCards(card, Zone.BATTLEFIELD, source, game); if (sacrifice || putOnBF) { return true; diff --git a/Mage.Sets/src/mage/cards/g/GodEternalBontu.java b/Mage.Sets/src/mage/cards/g/GodEternalBontu.java index b52d00e9b78..e34a96cad2b 100644 --- a/Mage.Sets/src/mage/cards/g/GodEternalBontu.java +++ b/Mage.Sets/src/mage/cards/g/GodEternalBontu.java @@ -92,10 +92,10 @@ class GodEternalBontuEffect extends OneShotEffect { int counter = 0; for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { counter++; } } - return player.drawCards(counter, source.getSourceId(), game) > 0; + return player.drawCards(counter, source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/g/GodEternalKefnet.java b/Mage.Sets/src/mage/cards/g/GodEternalKefnet.java index 9e67a2ee035..40f42fa2cf9 100644 --- a/Mage.Sets/src/mage/cards/g/GodEternalKefnet.java +++ b/Mage.Sets/src/mage/cards/g/GodEternalKefnet.java @@ -97,7 +97,7 @@ class GodEternalKefnetDrawCardReplacementEffect extends ReplacementEffectImpl { Card blueprint = topCard.copy(); blueprint.addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceEffect(2))); Card copiedCard = game.copyCard(blueprint, source, source.getControllerId()); - you.moveCardToHandWithInfo(copiedCard, source.getSourceId(), game, true); // The copy is created in and cast from your hand. + you.moveCardToHandWithInfo(copiedCard, source, game, true); // The copy is created in and cast from your hand. you.cast(copiedCard.getSpellAbility(), game, false, new ApprovingObject(source, game)); } @@ -107,7 +107,7 @@ class GodEternalKefnetDrawCardReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } String getAppliedMark(Game game, Ability source) { diff --git a/Mage.Sets/src/mage/cards/g/GodPharaohsGift.java b/Mage.Sets/src/mage/cards/g/GodPharaohsGift.java index df45a74c2c3..27d38f46938 100644 --- a/Mage.Sets/src/mage/cards/g/GodPharaohsGift.java +++ b/Mage.Sets/src/mage/cards/g/GodPharaohsGift.java @@ -81,7 +81,7 @@ class GodPharaohsGiftEffect extends OneShotEffect { && controller.choose(Outcome.PutCreatureInPlay, target, source.getId(), game)) { Card cardChosen = game.getCard(target.getFirstTarget()); if (cardChosen != null - && cardChosen.moveToExile(exileId, sourceObject.getIdName(), source.getSourceId(), game)) { + && cardChosen.moveToExile(exileId, sourceObject.getIdName(), source, game)) { EmptyToken token = new EmptyToken(); CardUtil.copyTo(token).from(cardChosen); token.removePTCDA(); @@ -90,7 +90,7 @@ class GodPharaohsGiftEffect extends OneShotEffect { token.getColor(game).setColor(ObjectColor.BLACK); token.removeAllCreatureTypes(game); token.addSubType(game, SubType.ZOMBIE); - if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) { + if (token.putOntoBattlefield(1, game, source, source.getControllerId())) { Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken()); if (tokenPermanent != null) { ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); diff --git a/Mage.Sets/src/mage/cards/g/Godsend.java b/Mage.Sets/src/mage/cards/g/Godsend.java index 0ccda6a3390..6c89838e256 100644 --- a/Mage.Sets/src/mage/cards/g/Godsend.java +++ b/Mage.Sets/src/mage/cards/g/Godsend.java @@ -80,7 +80,7 @@ class GodsendTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override @@ -158,7 +158,7 @@ class GodsendExileEffect extends OneShotEffect { if (creature != null && controller != null && sourcePermanent != null) { UUID exileId = CardUtil.getCardExileZoneId(game, source); controller.moveCardToExileWithInfo(creature, exileId, - sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ')', source.getSourceId(), game, Zone.BATTLEFIELD, true); + sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ')', source, game, Zone.BATTLEFIELD, true); } return false; @@ -192,7 +192,7 @@ class GodsendRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.CAST_SPELL && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { + if (event.getType() == GameEvent.EventType.CAST_SPELL && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { MageObject object = game.getObject(event.getSourceId()); if (object != null) { ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)); diff --git a/Mage.Sets/src/mage/cards/g/Godtoucher.java b/Mage.Sets/src/mage/cards/g/Godtoucher.java index 3fcb348b950..94319b3063b 100644 --- a/Mage.Sets/src/mage/cards/g/Godtoucher.java +++ b/Mage.Sets/src/mage/cards/g/Godtoucher.java @@ -12,9 +12,7 @@ import mage.constants.*; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; -import mage.game.events.DamageEvent; -import mage.game.events.GameEvent; -import mage.game.events.PreventDamageEvent; +import mage.game.events.*; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; @@ -38,6 +36,7 @@ public final class Godtoucher extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); + // {1}{W}, {T}: Prevent all damage that would be dealt to target creature with power 5 or greater this turn. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GodtoucherEffect(Duration.EndOfTurn), new ManaCostsImpl("{1}{W}")); @@ -77,13 +76,21 @@ class GodtoucherEffect extends PreventionEffectImpl { return true; } + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (!this.used && super.applies(event, source, game)) { + return source.getTargets().getFirstTarget().equals(event.getTargetId()); + } + return false; + } + @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GoldenGuardian.java b/Mage.Sets/src/mage/cards/g/GoldenGuardian.java index 3ec9d69dd6e..d7e6d46b20f 100644 --- a/Mage.Sets/src/mage/cards/g/GoldenGuardian.java +++ b/Mage.Sets/src/mage/cards/g/GoldenGuardian.java @@ -120,7 +120,7 @@ class GoldenGuardianDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GoldnightCastigator.java b/Mage.Sets/src/mage/cards/g/GoldnightCastigator.java index fc8d0adeeec..517c2b659f3 100644 --- a/Mage.Sets/src/mage/cards/g/GoldnightCastigator.java +++ b/Mage.Sets/src/mage/cards/g/GoldnightCastigator.java @@ -73,8 +73,8 @@ class GoldnightCastigatorDoubleDamageEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE || - event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE || + event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } diff --git a/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java b/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java index e64712a1201..0ae33d6b2ba 100644 --- a/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java +++ b/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java @@ -58,9 +58,9 @@ class GolemSkinGauntletsAttachedCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Permanent equipment = game.getPermanent(source.getSourceId()); + Permanent equipment = game.getPermanent(sourceAbility.getSourceId()); if (equipment != null) { Permanent permanent = game.getPermanent(equipment.getAttachedTo()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/g/GolemsHeart.java b/Mage.Sets/src/mage/cards/g/GolemsHeart.java index b4732d1e3e5..c1ad133fd0e 100644 --- a/Mage.Sets/src/mage/cards/g/GolemsHeart.java +++ b/Mage.Sets/src/mage/cards/g/GolemsHeart.java @@ -54,7 +54,7 @@ class GolemsHeartAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GolgothianSylex.java b/Mage.Sets/src/mage/cards/g/GolgothianSylex.java index 1bf1c09124d..e2cf6db0782 100644 --- a/Mage.Sets/src/mage/cards/g/GolgothianSylex.java +++ b/Mage.Sets/src/mage/cards/g/GolgothianSylex.java @@ -73,7 +73,7 @@ class GolgothianSylexEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/Gomazoa.java b/Mage.Sets/src/mage/cards/g/Gomazoa.java index d402f5ae662..56ab72218d7 100644 --- a/Mage.Sets/src/mage/cards/g/Gomazoa.java +++ b/Mage.Sets/src/mage/cards/g/Gomazoa.java @@ -78,11 +78,10 @@ class GomazoaEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - List creaturesBlocked; List players = new ArrayList<>(); Permanent gomazoa = game.getPermanent(source.getSourceId()); if (gomazoa != null) { - controller.moveCardToLibraryWithInfo(gomazoa, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + controller.moveCardToLibraryWithInfo(gomazoa, source, game, Zone.BATTLEFIELD, true, true); players.add(gomazoa.getOwnerId()); } @@ -94,7 +93,7 @@ class GomazoaEffect extends OneShotEffect { players.add(blockedByGomazoa.getOwnerId()); Player owner = game.getPlayer(blockedByGomazoa.getOwnerId()); if (owner != null) { - owner.moveCardToLibraryWithInfo(blockedByGomazoa, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + owner.moveCardToLibraryWithInfo(blockedByGomazoa, source, game, Zone.BATTLEFIELD, true, true); } } } diff --git a/Mage.Sets/src/mage/cards/g/GontisMachinations.java b/Mage.Sets/src/mage/cards/g/GontisMachinations.java index 7222bdb4833..1a15a43c43f 100644 --- a/Mage.Sets/src/mage/cards/g/GontisMachinations.java +++ b/Mage.Sets/src/mage/cards/g/GontisMachinations.java @@ -74,7 +74,7 @@ class GontisMachinationsTriggeredAbility extends TriggeredAbilityImpl { GontisMachinationsFirstLostLifeThisTurnWatcher watcher = game.getState().getWatcher(GontisMachinationsFirstLostLifeThisTurnWatcher.class); if (watcher != null - && watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) { + && watcher.timesLostLifeThisTurn(event.getPlayerId()) < 2) { return true; } } @@ -104,9 +104,9 @@ class GontisMachinationsFirstLostLifeThisTurnWatcher extends Watcher { public void watch(GameEvent event, Game game) { switch (event.getType()) { case LOST_LIFE: - int timesLifeLost = playersLostLife.getOrDefault(event.getTargetId(), 0); + int timesLifeLost = playersLostLife.getOrDefault(event.getPlayerId(), 0); timesLifeLost++; - playersLostLife.put(event.getTargetId(), timesLifeLost); + playersLostLife.put(event.getPlayerId(), timesLifeLost); } } @@ -141,7 +141,7 @@ class GontisMachinationsEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - totalLostLife += game.getPlayer(opponentId).loseLife(3, game, false); + totalLostLife += game.getPlayer(opponentId).loseLife(3, game, source, false); } } game.getPlayer(source.getControllerId()).gainLife(totalLostLife, game, source); diff --git a/Mage.Sets/src/mage/cards/g/GorMuldrakAmphinologist.java b/Mage.Sets/src/mage/cards/g/GorMuldrakAmphinologist.java index 23162f84293..1b270a1fc13 100644 --- a/Mage.Sets/src/mage/cards/g/GorMuldrakAmphinologist.java +++ b/Mage.Sets/src/mage/cards/g/GorMuldrakAmphinologist.java @@ -99,7 +99,7 @@ class GorMuldrakAmphinologistEffect extends OneShotEffect { if (entry.getValue() > minValue) { continue; } - token.putOntoBattlefield(1, game, source.getSourceId(), entry.getKey()); + token.putOntoBattlefield(1, game, source, entry.getKey()); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GrabTheReins.java b/Mage.Sets/src/mage/cards/g/GrabTheReins.java index f2d1b52e3df..36807876210 100644 --- a/Mage.Sets/src/mage/cards/g/GrabTheReins.java +++ b/Mage.Sets/src/mage/cards/g/GrabTheReins.java @@ -91,18 +91,18 @@ class GrabTheReinsEffect extends OneShotEffect { player.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent creatureToSacrifice = game.getPermanent(target.getTargets().get(0)); int amount = creatureToSacrifice.getPower().getValue(); - if (!creatureToSacrifice.sacrifice(creatureToSacrifice.getId(), game)) { + if (!creatureToSacrifice.sacrifice(source, game)) { return false; } if (amount > 0) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); return true; } player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } } else { diff --git a/Mage.Sets/src/mage/cards/g/GracefulReprieve.java b/Mage.Sets/src/mage/cards/g/GracefulReprieve.java index 99abc60e6bd..1fe343df125 100644 --- a/Mage.Sets/src/mage/cards/g/GracefulReprieve.java +++ b/Mage.Sets/src/mage/cards/g/GracefulReprieve.java @@ -86,7 +86,7 @@ class GracefulReprieveDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GrafMole.java b/Mage.Sets/src/mage/cards/g/GrafMole.java index 152044b3458..34382b792b5 100644 --- a/Mage.Sets/src/mage/cards/g/GrafMole.java +++ b/Mage.Sets/src/mage/cards/g/GrafMole.java @@ -59,7 +59,7 @@ class GrafMoleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java b/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java index 33696bd6ef7..e414e6b35c7 100644 --- a/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java +++ b/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java @@ -96,8 +96,7 @@ class GrakmawSkyclaveRavagerEffect extends OneShotEffect { if (permanent != null) { counters = permanent.getCounters(game).getCount(CounterType.P1P1); } - return new GrakmawSkyclaveRavagerHydraToken(counters).putOntoBattlefield( - 1, game, source.getSourceId(), source.getControllerId() - ); + return new GrakmawSkyclaveRavagerHydraToken(counters) + .putOntoBattlefield(1, game, source, source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/g/GrandMoffTarkin.java b/Mage.Sets/src/mage/cards/g/GrandMoffTarkin.java index a14a1d58dd4..698be23cbfa 100644 --- a/Mage.Sets/src/mage/cards/g/GrandMoffTarkin.java +++ b/Mage.Sets/src/mage/cards/g/GrandMoffTarkin.java @@ -71,7 +71,7 @@ class GrandMoffTarkinTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -133,17 +133,17 @@ class GrandMoffTarkinEffect extends OneShotEffect { } if (player.getLife() > 2 && player.chooseUse(Outcome.Neutral, "Pay 2 life? If you don't, " + targetCreature.getName() + " will be destroyed", source, game)) { - player.loseLife(2, game, false); + player.loseLife(2, game, source, false); game.informPlayers(player.getLogName() + " pays 2 life to prevent " + targetCreature.getName() + " being destroyed"); Player sourceController = game.getPlayer(source.getControllerId()); if (sourceController != null) { - sourceController.drawCards(1, source.getSourceId(), game); + sourceController.drawCards(1, source, game); } return true; } - targetCreature.destroy(source.getSourceId(), game, false); + targetCreature.destroy(source, game, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GraveBetrayal.java b/Mage.Sets/src/mage/cards/g/GraveBetrayal.java index 21ad036129f..76c3c4996b5 100644 --- a/Mage.Sets/src/mage/cards/g/GraveBetrayal.java +++ b/Mage.Sets/src/mage/cards/g/GraveBetrayal.java @@ -67,7 +67,7 @@ class GraveBetrayalTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GraveExchange.java b/Mage.Sets/src/mage/cards/g/GraveExchange.java index 07cc700228e..76d55a0b6c1 100644 --- a/Mage.Sets/src/mage/cards/g/GraveExchange.java +++ b/Mage.Sets/src/mage/cards/g/GraveExchange.java @@ -70,10 +70,10 @@ class GraveExchangeEffect extends OneShotEffect { } Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent()); - if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/g/GravePact.java b/Mage.Sets/src/mage/cards/g/GravePact.java index c2dd2f4ee53..9c1498cd9fd 100644 --- a/Mage.Sets/src/mage/cards/g/GravePact.java +++ b/Mage.Sets/src/mage/cards/g/GravePact.java @@ -61,7 +61,7 @@ class GravePactTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -108,7 +108,7 @@ class GravePactEffect extends OneShotEffect { if (player != null && !playerId.equals(source.getControllerId())) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -117,7 +117,7 @@ class GravePactEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GravePeril.java b/Mage.Sets/src/mage/cards/g/GravePeril.java index f1c5b29de3b..992f5928a25 100644 --- a/Mage.Sets/src/mage/cards/g/GravePeril.java +++ b/Mage.Sets/src/mage/cards/g/GravePeril.java @@ -68,7 +68,7 @@ class GravePerilEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { Effect effect = new DestroyTargetEffect(); effect.setTargetPointer(this.getTargetPointer()); return effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/g/GravebaneZombie.java b/Mage.Sets/src/mage/cards/g/GravebaneZombie.java index 6717c313779..f42788013c1 100644 --- a/Mage.Sets/src/mage/cards/g/GravebaneZombie.java +++ b/Mage.Sets/src/mage/cards/g/GravebaneZombie.java @@ -70,7 +70,7 @@ class GravebaneZombieEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GravebladeMarauder.java b/Mage.Sets/src/mage/cards/g/GravebladeMarauder.java index 1c901e6206e..2c10192da66 100644 --- a/Mage.Sets/src/mage/cards/g/GravebladeMarauder.java +++ b/Mage.Sets/src/mage/cards/g/GravebladeMarauder.java @@ -66,7 +66,7 @@ class GravebladeMarauderEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (targetPlayer != null && controller != null) { - targetPlayer.loseLife(controller.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game), game, false); + targetPlayer.loseLife(controller.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game), game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/Gravestorm.java b/Mage.Sets/src/mage/cards/g/Gravestorm.java index 3dead51265b..1277bf694fc 100644 --- a/Mage.Sets/src/mage/cards/g/Gravestorm.java +++ b/Mage.Sets/src/mage/cards/g/Gravestorm.java @@ -73,13 +73,13 @@ class GravestormEffect extends OneShotEffect { if (opponentChoosesExile && targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - opponentExilesACard = targetPlayer.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + opponentExilesACard = targetPlayer.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); } } if (!opponentExilesACard) { if (you.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) { - you.drawCards(1, source.getSourceId(), game); + you.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GraveyardShovel.java b/Mage.Sets/src/mage/cards/g/GraveyardShovel.java index 9e348846c11..5724ed3debe 100644 --- a/Mage.Sets/src/mage/cards/g/GraveyardShovel.java +++ b/Mage.Sets/src/mage/cards/g/GraveyardShovel.java @@ -69,7 +69,7 @@ class GraveyardShovelEffect extends OneShotEffect { if (targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); if (card.isCreature()) { controller.gainLife(2, game, source); } diff --git a/Mage.Sets/src/mage/cards/g/GraviticPunch.java b/Mage.Sets/src/mage/cards/g/GraviticPunch.java index ee8559365b1..b17bdaa2473 100644 --- a/Mage.Sets/src/mage/cards/g/GraviticPunch.java +++ b/Mage.Sets/src/mage/cards/g/GraviticPunch.java @@ -67,7 +67,7 @@ class GraviticPunchEffect extends OneShotEffect { if (player == null || controlledCreature == null) { return false; } - player.damage(controlledCreature.getPower().getValue(), controlledCreature.getId(), game); + player.damage(controlledCreature.getPower().getValue(), controlledCreature.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GravityWell.java b/Mage.Sets/src/mage/cards/g/GravityWell.java index 0efefec9103..2bd529ef83a 100644 --- a/Mage.Sets/src/mage/cards/g/GravityWell.java +++ b/Mage.Sets/src/mage/cards/g/GravityWell.java @@ -51,7 +51,7 @@ class GravityWellTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GrayMerchantOfAsphodel.java b/Mage.Sets/src/mage/cards/g/GrayMerchantOfAsphodel.java index c00f37401d6..c98ffb311d9 100644 --- a/Mage.Sets/src/mage/cards/g/GrayMerchantOfAsphodel.java +++ b/Mage.Sets/src/mage/cards/g/GrayMerchantOfAsphodel.java @@ -78,7 +78,7 @@ class GrayMerchantOfAsphodelEffect extends OneShotEffect { .stream() .map(game::getPlayer) .filter(Objects::nonNull) - .mapToInt(opponent -> opponent.loseLife(lifeLost, game, false)) + .mapToInt(opponent -> opponent.loseLife(lifeLost, game, source, false)) .sum(); return controller.gainLife(totalLifeLost, game, source) > 0; } diff --git a/Mage.Sets/src/mage/cards/g/GreatbowDoyen.java b/Mage.Sets/src/mage/cards/g/GreatbowDoyen.java index 03a0a38b20b..4b04cf0f2ff 100644 --- a/Mage.Sets/src/mage/cards/g/GreatbowDoyen.java +++ b/Mage.Sets/src/mage/cards/g/GreatbowDoyen.java @@ -72,7 +72,7 @@ class GreatbowDoyenTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -126,7 +126,7 @@ class GreatbowDoyenEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(controllerId); if (player != null) { - player.damage(damageAmount, sourceOfDamage, game); + player.damage(damageAmount, sourceOfDamage, source, game); game.informPlayers(permanent.getName() + " deals " + damageAmount + " damage to " + player.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/g/GreenbeltRampager.java b/Mage.Sets/src/mage/cards/g/GreenbeltRampager.java index a8d0f713890..c6ddebbad17 100644 --- a/Mage.Sets/src/mage/cards/g/GreenbeltRampager.java +++ b/Mage.Sets/src/mage/cards/g/GreenbeltRampager.java @@ -61,11 +61,11 @@ public final class GreenbeltRampager extends CardImpl { return false; } - if (!new PayEnergyCost(2).pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!new PayEnergyCost(2).pay(source, game, source, source.getControllerId(), true)) { Permanent sourceObject = source.getSourcePermanentIfItStillExists(game); if (sourceObject != null) { controller.moveCards(sourceObject, Zone.HAND, source, game); - controller.addCounters(CounterType.ENERGY.createInstance(), game); + controller.addCounters(CounterType.ENERGY.createInstance(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GreenhiltTrainee.java b/Mage.Sets/src/mage/cards/g/GreenhiltTrainee.java index e278c91048b..61276ca121e 100644 --- a/Mage.Sets/src/mage/cards/g/GreenhiltTrainee.java +++ b/Mage.Sets/src/mage/cards/g/GreenhiltTrainee.java @@ -65,8 +65,8 @@ class GreenhiltTraineeCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { if (permanent.getPower().getValue() >= 4) { return true; @@ -76,7 +76,7 @@ class GreenhiltTraineeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/cards/g/GremlinMine.java b/Mage.Sets/src/mage/cards/g/GremlinMine.java index 5c804ff8413..b2bc751a5e9 100644 --- a/Mage.Sets/src/mage/cards/g/GremlinMine.java +++ b/Mage.Sets/src/mage/cards/g/GremlinMine.java @@ -90,7 +90,7 @@ class GremlinMineEffect extends OneShotEffect { choice.getChoices().add(i.toString()); } if (player.choose(Outcome.Detriment, choice, game)) { - permanent.removeCounters(CounterType.CHARGE.getName(), Integer.parseInt(choice.getChoice()), game); + permanent.removeCounters(CounterType.CHARGE.getName(), Integer.parseInt(choice.getChoice()), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GrenzoHavocRaiser.java b/Mage.Sets/src/mage/cards/g/GrenzoHavocRaiser.java index 6a84b2badcb..acd06c0b46f 100644 --- a/Mage.Sets/src/mage/cards/g/GrenzoHavocRaiser.java +++ b/Mage.Sets/src/mage/cards/g/GrenzoHavocRaiser.java @@ -152,7 +152,7 @@ class GrenzoHavocRaiserEffect extends OneShotEffect { Card card = damagedPlayer.getLibrary().getFromTop(game); if (card != null && sourceObject != null) { // move card to exile - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.LIBRARY, true); // Add effects only if the card has a spellAbility (e.g. not for lands). if (card.getSpellAbility() != null) { // allow to cast the card diff --git a/Mage.Sets/src/mage/cards/g/GrenzosRuffians.java b/Mage.Sets/src/mage/cards/g/GrenzosRuffians.java index 35ab9843c99..ed14e9e7036 100644 --- a/Mage.Sets/src/mage/cards/g/GrenzosRuffians.java +++ b/Mage.Sets/src/mage/cards/g/GrenzosRuffians.java @@ -72,7 +72,7 @@ class GrenzosRuffiansEffect extends OneShotEffect { if (!Objects.equals(playerId, damagedOpponent)) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - int dealtDamage = opponent.damage(amount, source.getSourceId(), game); + int dealtDamage = opponent.damage(amount, source.getSourceId(), source, game); game.informPlayers(object.getLogName() + " deals " + dealtDamage + " damage to " + opponent.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/g/GrevenPredatorCaptain.java b/Mage.Sets/src/mage/cards/g/GrevenPredatorCaptain.java index 78b90478741..97572ef20d9 100644 --- a/Mage.Sets/src/mage/cards/g/GrevenPredatorCaptain.java +++ b/Mage.Sets/src/mage/cards/g/GrevenPredatorCaptain.java @@ -121,11 +121,11 @@ class GrevenPredatorCaptainEffect extends OneShotEffect { } int power = permanent.getPower().getValue(); int toughness = permanent.getToughness().getValue(); - if (!permanent.sacrifice(source.getSourceId(), game)) { + if (!permanent.sacrifice(source, game)) { return false; } - player.drawCards(power, source.getSourceId(), game); - player.loseLife(toughness, game, false); + player.drawCards(power, source, game); + player.loseLife(toughness, game, source, false); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/g/GriftersBlade.java b/Mage.Sets/src/mage/cards/g/GriftersBlade.java index 8c8ef6e2b59..06dde79000b 100644 --- a/Mage.Sets/src/mage/cards/g/GriftersBlade.java +++ b/Mage.Sets/src/mage/cards/g/GriftersBlade.java @@ -83,7 +83,7 @@ class GriftersBladeChooseCreatureEffect extends OneShotEffect { if (controller.choose(this.outcome, target, source.getSourceId(), game)) { Permanent attachToCreature = game.getPermanent(target.getFirstTarget()); if (attachToCreature != null) { - attachToCreature.addAttachment(mageObject.getId(), game); + attachToCreature.addAttachment(mageObject.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GrimContest.java b/Mage.Sets/src/mage/cards/g/GrimContest.java index 686b2c2cc81..5c3abfacb25 100644 --- a/Mage.Sets/src/mage/cards/g/GrimContest.java +++ b/Mage.Sets/src/mage/cards/g/GrimContest.java @@ -71,9 +71,9 @@ class GrimContestEffect extends OneShotEffect { Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature1 != null && creature2 != null) { if (creature1.isCreature() && creature2.isCreature()) { - creature1.damage(creature2.getToughness().getValue(), creature2.getId(), game, false, true); + creature1.damage(creature2.getToughness().getValue(), creature2.getId(), source, game, false, true); game.informPlayers(creature2.getLogName() + " deals " + creature2.getToughness().getValue() + " damage to " + creature1.getLogName()); - creature2.damage(creature1.getToughness().getValue(), creature1.getId(), game, false, true); + creature2.damage(creature1.getToughness().getValue(), creature1.getId(), source, game, false, true); game.informPlayers(creature1.getLogName() + " deals " + creature1.getToughness().getValue() + " damage to " + creature2.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/g/GrimReminder.java b/Mage.Sets/src/mage/cards/g/GrimReminder.java index e864a5d2fbb..422e9b12d59 100644 --- a/Mage.Sets/src/mage/cards/g/GrimReminder.java +++ b/Mage.Sets/src/mage/cards/g/GrimReminder.java @@ -98,7 +98,7 @@ class GrimReminderEffect extends OneShotEffect { for (UUID playerId : watcher.getPlayersCastSpell(cardName)) { Player player = game.getPlayer(playerId); if (player != null) { - player.loseLife(6, game, false); + player.loseLife(6, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java b/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java index e8edb7bb583..e972f1b325a 100644 --- a/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java +++ b/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java @@ -81,7 +81,7 @@ class GrimgrinCorpseBornAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GrimoireThief.java b/Mage.Sets/src/mage/cards/g/GrimoireThief.java index b9d10b886ff..3a176cde47f 100644 --- a/Mage.Sets/src/mage/cards/g/GrimoireThief.java +++ b/Mage.Sets/src/mage/cards/g/GrimoireThief.java @@ -213,7 +213,7 @@ class GrimoireThiefCounterspellEffect extends OneShotEffect { if (CardUtil.haveSameNames(stackObject, name1, game) || CardUtil.haveSameNames(stackObject, name2, game)) { Spell spell = (Spell) stackObject; - game.getStack().counter(stackObject.getId(), source.getSourceId(), game); + game.getStack().counter(stackObject.getId(), source, game); game.informPlayers(sourceObject.getLogName() + ": spell " + spell.getIdName() + " was countered."); } } diff --git a/Mage.Sets/src/mage/cards/g/GrinningTotem.java b/Mage.Sets/src/mage/cards/g/GrinningTotem.java index 041dc39da5d..cb9f903b0a0 100644 --- a/Mage.Sets/src/mage/cards/g/GrinningTotem.java +++ b/Mage.Sets/src/mage/cards/g/GrinningTotem.java @@ -85,7 +85,7 @@ class GrinningTotemSearchAndExileEffect extends OneShotEffect { Card card = targetOpponent.getLibrary().remove(targetCard.getFirstTarget(), game); if (card != null) { UUID exileZoneId = CardUtil.getCardExileZoneId(game, source); - you.moveCardToExileWithInfo(card, exileZoneId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + you.moveCardToExileWithInfo(card, exileZoneId, sourceObject.getIdName(), source, game, Zone.LIBRARY, true); ContinuousEffect effect = new GrinningTotemMayPlayEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); @@ -172,7 +172,7 @@ class GrinningTotemDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GripOfChaos.java b/Mage.Sets/src/mage/cards/g/GripOfChaos.java index 158782a7f8e..779cf5daab7 100644 --- a/Mage.Sets/src/mage/cards/g/GripOfChaos.java +++ b/Mage.Sets/src/mage/cards/g/GripOfChaos.java @@ -56,10 +56,10 @@ class GripOfChaosTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST - || event.getType() == EventType.ACTIVATED_ABILITY - || event.getType() == EventType.TRIGGERED_ABILITY - || event.getType() == EventType.COPIED_STACKOBJECT; + return event.getType() == GameEvent.EventType.SPELL_CAST + || event.getType() == GameEvent.EventType.ACTIVATED_ABILITY + || event.getType() == GameEvent.EventType.TRIGGERED_ABILITY + || event.getType() == GameEvent.EventType.COPIED_STACKOBJECT; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GripOfPhyresis.java b/Mage.Sets/src/mage/cards/g/GripOfPhyresis.java index 89bf5fe5126..aeeb0a53e19 100644 --- a/Mage.Sets/src/mage/cards/g/GripOfPhyresis.java +++ b/Mage.Sets/src/mage/cards/g/GripOfPhyresis.java @@ -72,7 +72,7 @@ class GripOfPhyresisEffect extends CreateTokenEffect { if (super.apply(game, source)) { Permanent germ = game.getPermanent(this.getLastAddedTokenId()); if (germ != null) { - germ.addAttachment(equipment.getId(), game); + germ.addAttachment(equipment.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java b/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java index 0d56901a0ab..56bdc5976bf 100644 --- a/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java +++ b/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java @@ -158,7 +158,7 @@ class GrothamaAllDevouringDrawCardsEffect extends OneShotEffect { if (player != null) { int toDraw = damageMap.getOrDefault(player.getId(), 0); if (toDraw > 0) { - player.drawCards(toDraw, source.getSourceId(), game); + player.drawCards(toDraw, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/g/GroundPounder.java b/Mage.Sets/src/mage/cards/g/GroundPounder.java index c2dd5852596..41942f9f8c6 100644 --- a/Mage.Sets/src/mage/cards/g/GroundPounder.java +++ b/Mage.Sets/src/mage/cards/g/GroundPounder.java @@ -75,7 +75,7 @@ class GroundPounderEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); game.addEffect(new BoostSourceEffect(amount, amount, Duration.EndOfTurn), source); return true; } diff --git a/Mage.Sets/src/mage/cards/g/GrovetenderDruids.java b/Mage.Sets/src/mage/cards/g/GrovetenderDruids.java index e1d291d7e06..18283b9431c 100644 --- a/Mage.Sets/src/mage/cards/g/GrovetenderDruids.java +++ b/Mage.Sets/src/mage/cards/g/GrovetenderDruids.java @@ -69,7 +69,7 @@ class GrovetenderDruidsEffect extends OneShotEffect { if (player != null) { if (player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {1}?", source, game)) { Cost cost = new ManaCostsImpl("{1}"); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { new CreateTokenEffect(new GrovetenderDruidsPlantToken()).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/g/GrowthSpurt.java b/Mage.Sets/src/mage/cards/g/GrowthSpurt.java index 54c8f2ec5fb..773b69c56b9 100644 --- a/Mage.Sets/src/mage/cards/g/GrowthSpurt.java +++ b/Mage.Sets/src/mage/cards/g/GrowthSpurt.java @@ -56,7 +56,7 @@ class GrowthSpurtEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int result = controller.rollDice(game, 6); + int result = controller.rollDice(source, game, 6); Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { ContinuousEffect effect = new BoostTargetEffect(result, result, Duration.EndOfTurn); diff --git a/Mage.Sets/src/mage/cards/g/GruesomeDiscovery.java b/Mage.Sets/src/mage/cards/g/GruesomeDiscovery.java index 9d33d69e3c8..7c3a9bde9d6 100644 --- a/Mage.Sets/src/mage/cards/g/GruesomeDiscovery.java +++ b/Mage.Sets/src/mage/cards/g/GruesomeDiscovery.java @@ -72,11 +72,11 @@ class GruesomeDiscoveryEffect extends OneShotEffect { } targetPlayer.revealCards(source, targetPlayer.getHand(), game); if (targetPlayer.getHand().size() <= 2) { - targetPlayer.discard(2, false, source, game); + targetPlayer.discard(2, false, false, source, game); } TargetCard target = new TargetCardInHand(2, StaticFilters.FILTER_CARD_CARDS); player.choose(Outcome.Discard, targetPlayer.getHand(), target, game); - targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); + targetPlayer.discard(new CardsImpl(target.getTargets()), false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GruesomeEncore.java b/Mage.Sets/src/mage/cards/g/GruesomeEncore.java index 5b414174b64..598d9f54dbb 100644 --- a/Mage.Sets/src/mage/cards/g/GruesomeEncore.java +++ b/Mage.Sets/src/mage/cards/g/GruesomeEncore.java @@ -117,7 +117,7 @@ class GruesomeEncoreReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Card card = game.getCard(source.getFirstTarget()); if (card != null) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GruulRagebeast.java b/Mage.Sets/src/mage/cards/g/GruulRagebeast.java index 85ee8f37d04..dc808090cf0 100644 --- a/Mage.Sets/src/mage/cards/g/GruulRagebeast.java +++ b/Mage.Sets/src/mage/cards/g/GruulRagebeast.java @@ -64,7 +64,7 @@ class GruulRagebeastTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GryffsBoon.java b/Mage.Sets/src/mage/cards/g/GryffsBoon.java index be813550968..2cfd0179fbd 100644 --- a/Mage.Sets/src/mage/cards/g/GryffsBoon.java +++ b/Mage.Sets/src/mage/cards/g/GryffsBoon.java @@ -80,10 +80,10 @@ class GryffsBoonEffect extends OneShotEffect { if (aura != null && controller != null && game.getState().getZone(aura.getId()) == Zone.GRAVEYARD) { Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (!targetPermanent.cantBeAttachedBy(aura, game, false)) { + if (!targetPermanent.cantBeAttachedBy(aura, source, game, false)) { game.getState().setValue("attachTo:" + aura.getId(), targetPermanent); controller.moveCards(aura, Zone.BATTLEFIELD, source, game); - return targetPermanent.addAttachment(aura.getId(), game); + return targetPermanent.addAttachment(aura.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/g/GuardianAngel.java b/Mage.Sets/src/mage/cards/g/GuardianAngel.java index b1fd2173835..14e8f4e2c76 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianAngel.java +++ b/Mage.Sets/src/mage/cards/g/GuardianAngel.java @@ -132,7 +132,7 @@ class GuardianAngelDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.CLEANUP_STEP_PRE; + return event.getType() == GameEvent.EventType.CLEANUP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GuardianBeast.java b/Mage.Sets/src/mage/cards/g/GuardianBeast.java index 3bca6e2f4a7..fc288527d11 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianBeast.java +++ b/Mage.Sets/src/mage/cards/g/GuardianBeast.java @@ -113,9 +113,9 @@ class GuardianBeastConditionalEffect extends ContinuousRuleModifyingEffectImpl { } StackObject spell = game.getStack().getStackObject(event.getSourceId()); - if (event.getType() == EventType.GAIN_CONTROL - || ((event.getType() == EventType.ATTACH - || event.getType() == EventType.TARGET) + if (event.getType() == GameEvent.EventType.GAIN_CONTROL + || ((event.getType() == GameEvent.EventType.ATTACH + || event.getType() == GameEvent.EventType.TARGET) && spell != null && spell.isEnchantment() && spell.hasSubtype(SubType.AURA, game))) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_ARTIFACTS_NON_CREATURE, source.getControllerId(), game)) { if (perm != null && Objects.equals(perm.getId(), targetPermanent.getId()) && !perm.isCreature()) { diff --git a/Mage.Sets/src/mage/cards/g/GuardianOfTheAges.java b/Mage.Sets/src/mage/cards/g/GuardianOfTheAges.java index 90038a630bd..515a9b44f21 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianOfTheAges.java +++ b/Mage.Sets/src/mage/cards/g/GuardianOfTheAges.java @@ -63,7 +63,7 @@ class GuardianOfTheAgesTriggerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GuardianProject.java b/Mage.Sets/src/mage/cards/g/GuardianProject.java index d4b791f4fd1..a1473a84479 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianProject.java +++ b/Mage.Sets/src/mage/cards/g/GuardianProject.java @@ -144,7 +144,7 @@ class GuardianProjectEffect extends OneShotEffect { if (GuardianProjectTriggeredAbility.checkCondition( mor.getPermanentOrLKIBattlefield(game), source.getControllerId(), game) ) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GuildSummit.java b/Mage.Sets/src/mage/cards/g/GuildSummit.java index e6ef9058de8..636ecae7635 100644 --- a/Mage.Sets/src/mage/cards/g/GuildSummit.java +++ b/Mage.Sets/src/mage/cards/g/GuildSummit.java @@ -82,17 +82,17 @@ class GuildSummitEffect extends OneShotEffect { int tappedAmount = 0; Player you = game.getPlayer(source.getControllerId()); TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { for (UUID creatureId : target.getTargets()) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { - creature.tap(game); + creature.tap(source, game); tappedAmount++; } } } if (tappedAmount > 0) { - you.drawCards(tappedAmount, source.getSourceId(), game); + you.drawCards(tappedAmount, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GuildmagesForum.java b/Mage.Sets/src/mage/cards/g/GuildmagesForum.java index c2ad5d97657..8a6a2825155 100644 --- a/Mage.Sets/src/mage/cards/g/GuildmagesForum.java +++ b/Mage.Sets/src/mage/cards/g/GuildmagesForum.java @@ -64,7 +64,7 @@ class GuildmagesForumWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.MANA_PAID) { + if (event.getType() == GameEvent.EventType.MANA_PAID) { MageObject target = game.getObject(event.getTargetId()); if (event.getSourceId() != null && event.getSourceId().equals(this.getSourceId()) diff --git a/Mage.Sets/src/mage/cards/g/Guile.java b/Mage.Sets/src/mage/cards/g/Guile.java index 16f669b335c..7962f183449 100644 --- a/Mage.Sets/src/mage/cards/g/Guile.java +++ b/Mage.Sets/src/mage/cards/g/Guile.java @@ -102,7 +102,7 @@ class GuileReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER; + return event.getType() == GameEvent.EventType.COUNTER; } @Override diff --git a/Mage.Sets/src/mage/cards/g/Gurzigost.java b/Mage.Sets/src/mage/cards/g/Gurzigost.java index 07504b0e1af..cff888dd7fb 100644 --- a/Mage.Sets/src/mage/cards/g/Gurzigost.java +++ b/Mage.Sets/src/mage/cards/g/Gurzigost.java @@ -74,16 +74,16 @@ class GurzigostCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Removal, controllerId, source.getSourceId(), game)) { for (UUID targetId: targets.get(0).getTargets()) { Card card = game.getCard(targetId); if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) { return false; } - paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true); + paid |= controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, false, true); } } @@ -92,8 +92,8 @@ class GurzigostCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/g/GusthasScepter.java b/Mage.Sets/src/mage/cards/g/GusthasScepter.java index 15ba3346327..c8a64b173bd 100644 --- a/Mage.Sets/src/mage/cards/g/GusthasScepter.java +++ b/Mage.Sets/src/mage/cards/g/GusthasScepter.java @@ -84,7 +84,7 @@ class GusthasScepterExileEffect extends OneShotEffect { UUID exileId = source.getSourceId(); if (card.moveToExile(exileId, sourceObject.getIdName(), - source.getSourceId(), + source, game)) { card.setFaceDown(true, game); game.addEffect(new GusthasScepterLookAtCardEffect(card.getId()), source); diff --git a/Mage.Sets/src/mage/cards/g/GutterGrime.java b/Mage.Sets/src/mage/cards/g/GutterGrime.java index beacf87f741..1487a93421d 100644 --- a/Mage.Sets/src/mage/cards/g/GutterGrime.java +++ b/Mage.Sets/src/mage/cards/g/GutterGrime.java @@ -62,7 +62,7 @@ class GutterGrimeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -102,7 +102,7 @@ class GutterGrimeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { GutterGrimeToken token = new GutterGrimeToken(source.getSourceId()); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java b/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java index cf5bce56f85..b0fe8f98d08 100644 --- a/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java +++ b/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java @@ -72,7 +72,7 @@ class GwafaHazidProfiteerEffect1 extends OneShotEffect { Player controller = game.getPlayer(targetCreature.getControllerId()); targetCreature.addCounters(CounterType.BRIBERY.createInstance(), source, game); if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java b/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java index 56042d82f9c..321234456a7 100644 --- a/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java +++ b/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java @@ -116,7 +116,7 @@ class HakimLoreweaverEffect extends OneShotEffect { if (target != null) { game.getState().setValue("attachTo:" + targetAuraCard.getId(), hakimLoreweaver); controller.moveCards(targetAuraCard, Zone.BATTLEFIELD, source, game); - return hakimLoreweaver.addAttachment(targetAuraCard.getId(), game); + return hakimLoreweaver.addAttachment(targetAuraCard.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/h/HalanaKessigRanger.java b/Mage.Sets/src/mage/cards/h/HalanaKessigRanger.java index fa9cf2e1495..cc30148ae3d 100644 --- a/Mage.Sets/src/mage/cards/h/HalanaKessigRanger.java +++ b/Mage.Sets/src/mage/cards/h/HalanaKessigRanger.java @@ -114,7 +114,7 @@ class HalanaKessigRangerDamageEffect extends OneShotEffect { if (permanent1 == null || !permanent1.isCreature() || permanent2 == null) { return false; } - permanent2.damage(permanent1.getPower().getValue(), permanent1.getId(), game); + permanent2.damage(permanent1.getPower().getValue(), permanent1.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java b/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java index 71dd6834adf..1eec632a696 100644 --- a/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java +++ b/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java @@ -72,7 +72,7 @@ class HallOfTheBanditLordWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.MANA_PAID) { + if (event.getType() == GameEvent.EventType.MANA_PAID) { MageObject target = game.getObject(event.getTargetId()); if (event.getSourceId() != null && event.getSourceId().equals(this.getSourceId()) @@ -83,12 +83,12 @@ class HallOfTheBanditLordWatcher extends Watcher { } } } - if (event.getType() == EventType.COUNTERED) { + if (event.getType() == GameEvent.EventType.COUNTERED) { if (creatures.contains(event.getTargetId())) { creatures.remove(event.getSourceId()); } } - if (event.getType() == EventType.ZONE_CHANGE) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { if (creatures.contains(event.getSourceId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; // spell was e.g. exiled and goes again to stack, so previous cast has not resolved. @@ -97,7 +97,7 @@ class HallOfTheBanditLordWatcher extends Watcher { } } } - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { if (creatures.contains(event.getSourceId())) { ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom); effect.setTargetPointer(new FixedTarget(event.getSourceId())); diff --git a/Mage.Sets/src/mage/cards/h/HallowedBurial.java b/Mage.Sets/src/mage/cards/h/HallowedBurial.java index f65e37b9d68..a910302af95 100644 --- a/Mage.Sets/src/mage/cards/h/HallowedBurial.java +++ b/Mage.Sets/src/mage/cards/h/HallowedBurial.java @@ -59,7 +59,7 @@ class HallowedBurialEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), source.getSourceId(), game)) { - controller.moveCardToLibraryWithInfo(creature, source.getSourceId(), game, Zone.BATTLEFIELD, false, true); + controller.moveCardToLibraryWithInfo(creature, source, game, Zone.BATTLEFIELD, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java b/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java index 4de43f8c52b..bcab11690f2 100644 --- a/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java +++ b/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java @@ -64,7 +64,7 @@ class HamletbackGoliathTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HammerHelper.java b/Mage.Sets/src/mage/cards/h/HammerHelper.java index 297b74c5da9..91ab70d28b6 100644 --- a/Mage.Sets/src/mage/cards/h/HammerHelper.java +++ b/Mage.Sets/src/mage/cards/h/HammerHelper.java @@ -67,7 +67,7 @@ class HammerHelperEffect extends OneShotEffect { source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId())); game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn), source); targetCreature.untap(game); - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); game.addEffect(new BoostTargetEffect(amount, 0, Duration.EndOfTurn), source); game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source); return true; diff --git a/Mage.Sets/src/mage/cards/h/HammerJammer.java b/Mage.Sets/src/mage/cards/h/HammerJammer.java index 2df68e455b7..1a0a581cdbd 100644 --- a/Mage.Sets/src/mage/cards/h/HammerJammer.java +++ b/Mage.Sets/src/mage/cards/h/HammerJammer.java @@ -70,7 +70,7 @@ class HammerJammerEntersEffect extends EntersBattlefieldWithXCountersEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); List appliedEffects = (ArrayList) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects); return super.apply(game, source); @@ -144,7 +144,7 @@ class HammerJammerEffect extends OneShotEffect { if (controller != null && permanent != null) { if (getValue("rolled") != null) { int amount = (Integer) getValue("rolled"); - permanent.removeCounters(CounterType.P1P1.createInstance(permanent.getCounters(game).getCount(CounterType.P1P1)), game); + permanent.removeCounters(CounterType.P1P1.createInstance(permanent.getCounters(game).getCount(CounterType.P1P1)), source, game); permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HammerMage.java b/Mage.Sets/src/mage/cards/h/HammerMage.java index ba08938ddb2..8cae3f97bce 100644 --- a/Mage.Sets/src/mage/cards/h/HammerMage.java +++ b/Mage.Sets/src/mage/cards/h/HammerMage.java @@ -72,7 +72,7 @@ class HammerMageEffect extends OneShotEffect { FilterArtifactPermanent filter = new FilterArtifactPermanent(); filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, source.getManaCostsToPay().getX() + 1)); for(Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java b/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java index 44e9f58776f..e698a063309 100644 --- a/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java +++ b/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java @@ -84,7 +84,7 @@ class HammerOfNazahnEffect extends OneShotEffect { Permanent equipment = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent targetCreature = game.getPermanent(source.getTargets().getFirstTarget()); if (equipment != null && targetCreature != null) { - targetCreature.addAttachment(equipment.getId(), game); + targetCreature.addAttachment(equipment.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HammerOfRuin.java b/Mage.Sets/src/mage/cards/h/HammerOfRuin.java index e87d8f6645a..2a47a8e0a28 100644 --- a/Mage.Sets/src/mage/cards/h/HammerOfRuin.java +++ b/Mage.Sets/src/mage/cards/h/HammerOfRuin.java @@ -70,7 +70,7 @@ class HammerOfRuinTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/h/Hankyu.java b/Mage.Sets/src/mage/cards/h/Hankyu.java index e8ef8c1307e..aaf117959ef 100644 --- a/Mage.Sets/src/mage/cards/h/Hankyu.java +++ b/Mage.Sets/src/mage/cards/h/Hankyu.java @@ -116,11 +116,11 @@ class HankyuDealsDamageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damageAmount, source.getSourceId(), game, false, true); + permanent.damage(damageAmount, source.getSourceId(), source, game, false, true); } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(damageAmount, source.getSourceId(), game); + player.damage(damageAmount, source.getSourceId(), source, game); } } return true; @@ -149,17 +149,17 @@ class HankyuCountersSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Permanent equipment = game.getPermanent(this.effectGivingEquipmentId); if (equipment != null) { this.removedCounters = equipment.getCounters(game).getCount(CounterType.AIM); if (this.removedCounters > 0) { - equipment.removeCounters("aim", this.removedCounters, game); + equipment.removeCounters("aim", this.removedCounters, source, game); } } this.paid = true; diff --git a/Mage.Sets/src/mage/cards/h/HaphazardBombardment.java b/Mage.Sets/src/mage/cards/h/HaphazardBombardment.java index f17492e5c73..bdd9b797643 100644 --- a/Mage.Sets/src/mage/cards/h/HaphazardBombardment.java +++ b/Mage.Sets/src/mage/cards/h/HaphazardBombardment.java @@ -131,7 +131,7 @@ class HaphazardBombardmentEndOfTurnEffect extends OneShotEffect { if (!permanents.isEmpty()) { Permanent permanent = permanents.get(RandomUtil.nextInt(permanents.size())); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HappilyEverAfter.java b/Mage.Sets/src/mage/cards/h/HappilyEverAfter.java index 84eabf80733..4b542b5a4b2 100644 --- a/Mage.Sets/src/mage/cards/h/HappilyEverAfter.java +++ b/Mage.Sets/src/mage/cards/h/HappilyEverAfter.java @@ -78,7 +78,7 @@ class HappilyEverAfterEffect extends OneShotEffect { .filter(Objects::nonNull) .forEachOrdered(player -> { player.gainLife(5, game, source); - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); }); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HarborGuardian.java b/Mage.Sets/src/mage/cards/h/HarborGuardian.java index 6e0553058a7..0dde78a7919 100644 --- a/Mage.Sets/src/mage/cards/h/HarborGuardian.java +++ b/Mage.Sets/src/mage/cards/h/HarborGuardian.java @@ -67,7 +67,7 @@ class HarborGuardianEffect extends OneShotEffect { Player defender = game.getPlayer(defenderId); if (defender != null) { if (defender.chooseUse(outcome, "Draw a card?", source, game)) { - defender.drawCards(1, source.getSourceId(), game); + defender.drawCards(1, source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/h/HardenedScales.java b/Mage.Sets/src/mage/cards/h/HardenedScales.java index 8d4390296f9..ccc9f5ada0a 100644 --- a/Mage.Sets/src/mage/cards/h/HardenedScales.java +++ b/Mage.Sets/src/mage/cards/h/HardenedScales.java @@ -59,7 +59,7 @@ class HardenedScalesEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ADD_COUNTERS; + return event.getType() == GameEvent.EventType.ADD_COUNTERS; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HarmlessOffering.java b/Mage.Sets/src/mage/cards/h/HarmlessOffering.java index fff22e39470..c4c99563f1c 100644 --- a/Mage.Sets/src/mage/cards/h/HarmlessOffering.java +++ b/Mage.Sets/src/mage/cards/h/HarmlessOffering.java @@ -64,7 +64,7 @@ class HarmlessOfferingEffect extends ContinuousEffectImpl { Player controller = game.getPlayer(controllerId); Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (controller != null && permanent != null) { - permanent.changeControllerId(controllerId, game); + permanent.changeControllerId(controllerId, game, source); } else { this.discard(); } diff --git a/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java b/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java index ea689c32e1f..ad3b4ba74b8 100644 --- a/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java +++ b/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java @@ -68,14 +68,14 @@ class HarmonyOfNatureEffect extends OneShotEffect { TargetPermanent target = new TargetPermanent(0, 1, filter, false); while (true) { target.clearChosen(); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { - game.getPermanent(creature).tap(game); + game.getPermanent(creature).tap(source, game); tappedAmount++; } } else { diff --git a/Mage.Sets/src/mage/cards/h/HarnessedLightning.java b/Mage.Sets/src/mage/cards/h/HarnessedLightning.java index e7d192007f8..f9c138f9da7 100644 --- a/Mage.Sets/src/mage/cards/h/HarnessedLightning.java +++ b/Mage.Sets/src/mage/cards/h/HarnessedLightning.java @@ -65,10 +65,10 @@ class HarnessedLightningEffect extends OneShotEffect { int numberToPay = controller.getAmount(0, controller.getCounters().getCount(CounterType.ENERGY), "How many {E} do you like to pay?", game); if (numberToPay > 0) { Cost cost = new PayEnergyCost(numberToPay); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (cost.pay(source, game, source, source.getControllerId(), true)) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(numberToPay, source.getSourceId(), game, false, true); + targetCreature.damage(numberToPay, source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/h/HarshJustice.java b/Mage.Sets/src/mage/cards/h/HarshJustice.java index ab48a8d72a7..3db94df7295 100644 --- a/Mage.Sets/src/mage/cards/h/HarshJustice.java +++ b/Mage.Sets/src/mage/cards/h/HarshJustice.java @@ -76,7 +76,7 @@ class HarshJusticeTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -129,7 +129,7 @@ class HarshJusticeEffect extends OneShotEffect { Player controller = game.getPlayer(targetObject.getControllerId()); if (controller != null) { game.informPlayers(sourceObject.getLogName() + ": " + targetObject.getLogName() + " deals " + damage + " damage to " + controller.getLogName()); - controller.damage(damage, sourceId, game); + controller.damage(damage, sourceId, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/h/HarshMentor.java b/Mage.Sets/src/mage/cards/h/HarshMentor.java index 16471d1c81c..61c71b41050 100644 --- a/Mage.Sets/src/mage/cards/h/HarshMentor.java +++ b/Mage.Sets/src/mage/cards/h/HarshMentor.java @@ -64,7 +64,7 @@ class HarshMentorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATED_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HarvestMage.java b/Mage.Sets/src/mage/cards/h/HarvestMage.java index c5adf943841..8dd0e8e0bde 100644 --- a/Mage.Sets/src/mage/cards/h/HarvestMage.java +++ b/Mage.Sets/src/mage/cards/h/HarvestMage.java @@ -95,15 +95,14 @@ class HarvestMageReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); - if (mageObject != null && mageObject.isLand()) { - Permanent land = game.getPermanent(event.getSourceId()); - return land != null && filter.match(land, game); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null && permanent.isLand()) { + return filter.match(permanent, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/h/HasranOgress.java b/Mage.Sets/src/mage/cards/h/HasranOgress.java index 8f284e00bd5..b632355ee78 100644 --- a/Mage.Sets/src/mage/cards/h/HasranOgress.java +++ b/Mage.Sets/src/mage/cards/h/HasranOgress.java @@ -64,8 +64,8 @@ class HasranOgressEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("{2}"); String message = "Would you like to pay {2} to prevent taking 3 damage from Hasran Ogress?"; if (!(controller.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) { - controller.damage(3, source.getSourceId(), game); + && cost.pay(source, game, source, controller.getId(), false, null))) { + controller.damage(3, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HatchetBully.java b/Mage.Sets/src/mage/cards/h/HatchetBully.java index 5cb7b8624b9..fa0d43afa6b 100644 --- a/Mage.Sets/src/mage/cards/h/HatchetBully.java +++ b/Mage.Sets/src/mage/cards/h/HatchetBully.java @@ -70,12 +70,12 @@ class HatchetBullyCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget()); if (permanent != null) { permanent.addCounters(CounterType.M1M1.createInstance(), ability, game); @@ -110,11 +110,11 @@ class HatchetBullyEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HauntedAngel.java b/Mage.Sets/src/mage/cards/h/HauntedAngel.java index ff9fe07823f..256b906dafd 100644 --- a/Mage.Sets/src/mage/cards/h/HauntedAngel.java +++ b/Mage.Sets/src/mage/cards/h/HauntedAngel.java @@ -69,7 +69,7 @@ class HauntedAngelEffect extends OneShotEffect { HauntedAngelToken token = new HauntedAngelToken(); for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) { if (!playerId.equals(controllerId)) { - token.putOntoBattlefield(1, game, source.getSourceId(), playerId); + token.putOntoBattlefield(1, game, source, playerId); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HauntedFengraf.java b/Mage.Sets/src/mage/cards/h/HauntedFengraf.java index 527fa63fa86..4c2cb0cda60 100644 --- a/Mage.Sets/src/mage/cards/h/HauntedFengraf.java +++ b/Mage.Sets/src/mage/cards/h/HauntedFengraf.java @@ -70,7 +70,7 @@ class HauntedFengrafEffect extends OneShotEffect { Card[] cards = player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).toArray(new Card[0]); if (cards.length > 0) { Card card = cards[RandomUtil.nextInt(cards.length)]; - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); game.informPlayers(card.getName() + " returned to the hand of " + player.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HauntingEchoes.java b/Mage.Sets/src/mage/cards/h/HauntingEchoes.java index 6be5cde65a8..1eba54ae365 100644 --- a/Mage.Sets/src/mage/cards/h/HauntingEchoes.java +++ b/Mage.Sets/src/mage/cards/h/HauntingEchoes.java @@ -59,7 +59,7 @@ class HauntingEchoesEffect extends OneShotEffect { if (targetPlayer != null && player != null) { for (Card card : targetPlayer.getGraveyard().getCards(game)) { if (!StaticFilters.FILTER_CARD_BASIC_LAND.match(card, game)) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); String nameToSearch = CardUtil.getCardNameForSameNameSearch(card); FilterCard filterCard = new FilterCard("cards named " + nameToSearch); @@ -73,7 +73,7 @@ class HauntingEchoesEffect extends OneShotEffect { for (UUID cardId : targets) { Card libraryCard = game.getCard(cardId); if (libraryCard != null) { - libraryCard.moveToExile(null, "", source.getSourceId(), game); + libraryCard.moveToExile(null, "", source, game); } } } diff --git a/Mage.Sets/src/mage/cards/h/HavengulLich.java b/Mage.Sets/src/mage/cards/h/HavengulLich.java index 907b601ec21..2e2d8e02807 100644 --- a/Mage.Sets/src/mage/cards/h/HavengulLich.java +++ b/Mage.Sets/src/mage/cards/h/HavengulLich.java @@ -143,7 +143,7 @@ class HavengulLichDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HavengulSkaab.java b/Mage.Sets/src/mage/cards/h/HavengulSkaab.java index 7cd46a2b7c0..5ed25e7d096 100644 --- a/Mage.Sets/src/mage/cards/h/HavengulSkaab.java +++ b/Mage.Sets/src/mage/cards/h/HavengulSkaab.java @@ -63,7 +63,7 @@ class HavengulSkaabAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HazeFrog.java b/Mage.Sets/src/mage/cards/h/HazeFrog.java index 27c439dfcc1..e86ad5cf24c 100644 --- a/Mage.Sets/src/mage/cards/h/HazeFrog.java +++ b/Mage.Sets/src/mage/cards/h/HazeFrog.java @@ -14,6 +14,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import java.util.UUID; @@ -70,7 +71,7 @@ class HazeFrogEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); Permanent permanent = game.getPermanent(event.getSourceId()); @@ -81,7 +82,7 @@ class HazeFrogEffect extends PreventionEffectImpl { message.insert(0, "Damage").append(" has been prevented: ").append(damage); event.setAmount(0); game.informPlayers(message.toString()); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/h/HeartOfBogardan.java b/Mage.Sets/src/mage/cards/h/HeartOfBogardan.java index 27cab590891..7317cd0f65c 100644 --- a/Mage.Sets/src/mage/cards/h/HeartOfBogardan.java +++ b/Mage.Sets/src/mage/cards/h/HeartOfBogardan.java @@ -64,7 +64,7 @@ class HeartOfBogardanTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DIDNT_PAY_CUMULATIVE_UPKEEP; + return event.getType() == GameEvent.EventType.DIDNT_PAY_CUMULATIVE_UPKEEP; } @Override @@ -101,9 +101,9 @@ class HeartOfBogardanEffect extends OneShotEffect { if (player != null && sourcePermanent != null) { int damage = sourcePermanent.getCounters(game).getCount(CounterType.AGE) * 2 - 2; if (damage > 0) { - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); for (Permanent perm : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) { - perm.damage(damage, source.getSourceId(), game, false, true); + perm.damage(damage, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java index 37285093728..d0d9182e43c 100644 --- a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java +++ b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java @@ -81,24 +81,24 @@ class HeartOfKiranAlternateCrewCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; Target target = new TargetControlledPermanent(1, 1, filter, true); - if (target.choose(Outcome.Benefit, controllerId, sourceId, game)) { + if (target.choose(Outcome.Benefit, controllerId, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); int originalLoyalty = permanent.getCounters(game).getCount(counterTypeToRemove); - GameEvent event = new GameEvent(GameEvent.EventType.CREW_VEHICLE, target.getFirstTarget(), sourceId, controllerId); + GameEvent event = new GameEvent(GameEvent.EventType.CREW_VEHICLE, target.getFirstTarget(), source, controllerId); if (!game.replaceEvent(event)) { - permanent.removeCounters(counterTypeToRemove.createInstance(), game); + permanent.removeCounters(counterTypeToRemove.createInstance(), source, game); } paid = permanent.getCounters(game).getCount(counterTypeToRemove) < originalLoyalty; if (paid) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, target.getFirstTarget(), sourceId, controllerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, target.getFirstTarget(), source, controllerId)); } } @@ -106,7 +106,7 @@ class HeartOfKiranAlternateCrewCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return !game.getBattlefield().getAllActivePermanents(filter, game).isEmpty(); } diff --git a/Mage.Sets/src/mage/cards/h/HeartOfLight.java b/Mage.Sets/src/mage/cards/h/HeartOfLight.java index 1522a9fd0f3..70327cac585 100644 --- a/Mage.Sets/src/mage/cards/h/HeartOfLight.java +++ b/Mage.Sets/src/mage/cards/h/HeartOfLight.java @@ -12,6 +12,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -72,11 +73,11 @@ class HeartOfLightEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java b/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java index 371e4e83e30..0adb9947c01 100644 --- a/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java +++ b/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java @@ -86,7 +86,7 @@ class HeartPiercerManticoreSacrificeEffect extends OneShotEffect { return false; } int power = toSacrifice.getPower().getValue(); - if (!toSacrifice.sacrifice(source.getSourceId(), game)) { + if (!toSacrifice.sacrifice(source, game)) { return false; } ReflexiveTriggeredAbility trigger = new ReflexiveTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/h/HeartlessAct.java b/Mage.Sets/src/mage/cards/h/HeartlessAct.java index 3e6504137f9..756e690cf84 100644 --- a/Mage.Sets/src/mage/cards/h/HeartlessAct.java +++ b/Mage.Sets/src/mage/cards/h/HeartlessAct.java @@ -87,13 +87,13 @@ class HeartlessActEffect extends OneShotEffect { for (String counterName : counterNames) { if (controller.chooseUse(Outcome.Neutral, "Do you want to remove " + counterName + " counters?", source, game)) { if (permanent.getCounters(game).get(counterName).getCount() == 1 || (toRemove - removed == 1)) { - permanent.removeCounters(counterName, 1, game); + permanent.removeCounters(counterName, 1, source, game); removed++; } else { int amount = controller.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game); if (amount > 0) { removed += amount; - permanent.removeCounters(counterName, amount, game); + permanent.removeCounters(counterName, amount, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/h/HeartlessHidetsugu.java b/Mage.Sets/src/mage/cards/h/HeartlessHidetsugu.java index 71b7fbbe004..31183df14a1 100644 --- a/Mage.Sets/src/mage/cards/h/HeartlessHidetsugu.java +++ b/Mage.Sets/src/mage/cards/h/HeartlessHidetsugu.java @@ -66,7 +66,7 @@ class HeartlessHidetsuguDamageEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int damage = player.getLife() / 2; - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/Heartmender.java b/Mage.Sets/src/mage/cards/h/Heartmender.java index 7e1249294ae..2de1b554d7b 100644 --- a/Mage.Sets/src/mage/cards/h/Heartmender.java +++ b/Mage.Sets/src/mage/cards/h/Heartmender.java @@ -74,7 +74,7 @@ class HeartmenderEffect extends OneShotEffect { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != null && creature.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { - creature.removeCounters(counter.getName(), counter.getCount(), game); + creature.removeCounters(counter.getName(), counter.getCount(), source, game); game.informPlayers("Removed " + counter.getCount() + ' ' + counter.getName() + " counter from " + creature.getName()); applied = true; diff --git a/Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java b/Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java index 11447206c64..fac3e14f2f5 100644 --- a/Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java +++ b/Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java @@ -56,8 +56,8 @@ class HeartwarmingRedemptionEffect extends OneShotEffect { if (player == null) { return false; } - int discarded = player.discard(player.getHand().size(), false, source, game).size(); - player.drawCards(discarded + 1, source.getSourceId(), game); + int discarded = player.discard(player.getHand().size(), false, false, source, game).size(); + player.drawCards(discarded + 1, source, game); player.gainLife(player.getHand().size(), game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HeartwoodStoryteller.java b/Mage.Sets/src/mage/cards/h/HeartwoodStoryteller.java index 090d335f580..a3c0df256a1 100644 --- a/Mage.Sets/src/mage/cards/h/HeartwoodStoryteller.java +++ b/Mage.Sets/src/mage/cards/h/HeartwoodStoryteller.java @@ -63,7 +63,7 @@ class HeartwoodStorytellerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -106,7 +106,7 @@ class HeartwoodStorytellerEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { if (player.chooseUse(outcome, "Draw a card?", source, game)) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/h/HeatStroke.java b/Mage.Sets/src/mage/cards/h/HeatStroke.java index 3d21cc7a5b6..9ef5d2d4f2a 100644 --- a/Mage.Sets/src/mage/cards/h/HeatStroke.java +++ b/Mage.Sets/src/mage/cards/h/HeatStroke.java @@ -74,7 +74,7 @@ class HeatStrokeEffect extends OneShotEffect { for (MageObjectReference mor : toDestroy) { Permanent permanent = mor.getPermanent(game); if (permanent != null && permanent.isCreature() && inROI.contains(permanent)){ - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); toRet = true; } } diff --git a/Mage.Sets/src/mage/cards/h/HeavenlyBlademaster.java b/Mage.Sets/src/mage/cards/h/HeavenlyBlademaster.java index 78a86b68d55..b84c15df66c 100644 --- a/Mage.Sets/src/mage/cards/h/HeavenlyBlademaster.java +++ b/Mage.Sets/src/mage/cards/h/HeavenlyBlademaster.java @@ -116,16 +116,16 @@ class HeavenlyBlademasterEffect extends OneShotEffect { ).filter( attachment -> attachment != null ).forEachOrdered((attachment) -> { - if (!sourcePermanent.cantBeAttachedBy(attachment, game, true)) { + if (!sourcePermanent.cantBeAttachedBy(attachment, source, game, true)) { if (attachment.getAttachedTo() != sourcePermanent.getId()) { if (attachment.getAttachedTo() != null) { Permanent fromPermanent = game.getPermanent(attachment.getAttachedTo()); if (fromPermanent != null) { - fromPermanent.removeAttachment(attachment.getId(), game); + fromPermanent.removeAttachment(attachment.getId(), source, game); } } } - sourcePermanent.addAttachment(attachment.getId(), game); + sourcePermanent.addAttachment(attachment.getId(), source, game); game.informPlayers(attachment.getLogName() + " was attached to " + sourcePermanent.getLogName()); } }); diff --git a/Mage.Sets/src/mage/cards/h/HeavyArbalest.java b/Mage.Sets/src/mage/cards/h/HeavyArbalest.java index daa9132ec11..59bb526a1cd 100644 --- a/Mage.Sets/src/mage/cards/h/HeavyArbalest.java +++ b/Mage.Sets/src/mage/cards/h/HeavyArbalest.java @@ -81,7 +81,7 @@ class HeavyArbalestEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HedonistsTrove.java b/Mage.Sets/src/mage/cards/h/HedonistsTrove.java index bc2f842486a..e4c7a45703a 100644 --- a/Mage.Sets/src/mage/cards/h/HedonistsTrove.java +++ b/Mage.Sets/src/mage/cards/h/HedonistsTrove.java @@ -76,7 +76,7 @@ class HedonistsTroveExileEffect extends OneShotEffect { for (UUID cardId : graveyard) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.GRAVEYARD, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HedronBlade.java b/Mage.Sets/src/mage/cards/h/HedronBlade.java index 41df7e6add5..4d6d1456cc6 100644 --- a/Mage.Sets/src/mage/cards/h/HedronBlade.java +++ b/Mage.Sets/src/mage/cards/h/HedronBlade.java @@ -72,7 +72,7 @@ class HedronBladeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HeirloomBlade.java b/Mage.Sets/src/mage/cards/h/HeirloomBlade.java index 7a87d4de458..6bc6d926334 100644 --- a/Mage.Sets/src/mage/cards/h/HeirloomBlade.java +++ b/Mage.Sets/src/mage/cards/h/HeirloomBlade.java @@ -83,7 +83,7 @@ class HeirloomBladeEffect extends OneShotEffect { for (Card card : controller.getLibrary().getCards(game)) { revealed.add(card); if (card != null && card.isCreature() && equipped.shareCreatureTypes(card, game)) { - controller.moveCardToHandWithInfo(card, source.getSourceId(), game, true); + controller.moveCardToHandWithInfo(card, source, game, true); break; } else { otherCards.add(card); diff --git a/Mage.Sets/src/mage/cards/h/HeliodsPunishment.java b/Mage.Sets/src/mage/cards/h/HeliodsPunishment.java index eaf577e9b40..443d6d0cfe4 100644 --- a/Mage.Sets/src/mage/cards/h/HeliodsPunishment.java +++ b/Mage.Sets/src/mage/cards/h/HeliodsPunishment.java @@ -117,13 +117,13 @@ class HeliodsPunishmentEffect extends OneShotEffect { Permanent sourceEnchantment = game.getPermanent(this.sourceEnchantmentId); if (sourceEnchantment != null) { if (sourceEnchantment.getCounters(game).getCount(CounterType.TASK) > 0) { - sourceEnchantment.removeCounters(CounterType.TASK.createInstance(1), game); + sourceEnchantment.removeCounters(CounterType.TASK.createInstance(1), source, game); if (!game.isSimulation()) { game.informPlayers("Removed a task counter from " + sourceEnchantment.getLogName()); } } if (sourceEnchantment.getCounters(game).getCount(CounterType.TASK) == 0) { - sourceEnchantment.destroy(source.getSourceId(), game, false); + sourceEnchantment.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HellcarverDemon.java b/Mage.Sets/src/mage/cards/h/HellcarverDemon.java index 91b8406e33e..4676eb90a3e 100644 --- a/Mage.Sets/src/mage/cards/h/HellcarverDemon.java +++ b/Mage.Sets/src/mage/cards/h/HellcarverDemon.java @@ -72,12 +72,12 @@ class HellcarverDemonEffect extends OneShotEffect { if (controller != null && sourceObject != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { if (!Objects.equals(permanent, sourceObject)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } if (!controller.getHand().isEmpty()) { int cardsInHand = controller.getHand().size(); - controller.discard(cardsInHand, false, source, game); + controller.discard(cardsInHand, false, false, source, game); } // move cards from library to exile Set currentExiledCards = new HashSet<>(); diff --git a/Mage.Sets/src/mage/cards/h/Helldozer.java b/Mage.Sets/src/mage/cards/h/Helldozer.java index b1f5860b863..735bb6d4404 100644 --- a/Mage.Sets/src/mage/cards/h/Helldozer.java +++ b/Mage.Sets/src/mage/cards/h/Helldozer.java @@ -74,7 +74,7 @@ class HelldozerEffect extends OneShotEffect { Permanent landTarget = game.getPermanent(source.getFirstTarget()); if (landTarget != null) { boolean wasNonBasic = !landTarget.isBasic(); - landTarget.destroy(source.getSourceId(), game, false); + landTarget.destroy(source, game, false); if (wasNonBasic && helldozer != null) { return helldozer.untap(game); diff --git a/Mage.Sets/src/mage/cards/h/Hellfire.java b/Mage.Sets/src/mage/cards/h/Hellfire.java index b12ebf4b684..e19ec17e727 100644 --- a/Mage.Sets/src/mage/cards/h/Hellfire.java +++ b/Mage.Sets/src/mage/cards/h/Hellfire.java @@ -65,7 +65,7 @@ class HellfireEffect extends OneShotEffect { FilterCreaturePermanent filter = new FilterCreaturePermanent("all nonblack creatures"); filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); for (Permanent creature : game.getState().getBattlefield().getActivePermanents(filter, controller.getId(), game)) { - if (creature.destroy(source.getSourceId(), game, false) + if (creature.destroy(source, game, false) && game.getState().getZone(creature.getId()) == Zone.GRAVEYARD) { // If a commander is replaced to command zone, the creature does not die) { destroyedCreature++; } diff --git a/Mage.Sets/src/mage/cards/h/HellholeRats.java b/Mage.Sets/src/mage/cards/h/HellholeRats.java index c7efd16e3ae..01d69d9efe7 100644 --- a/Mage.Sets/src/mage/cards/h/HellholeRats.java +++ b/Mage.Sets/src/mage/cards/h/HellholeRats.java @@ -70,12 +70,12 @@ class HellholeRatsEffect extends OneShotEffect { int damage = 0; Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - Cards cards = targetPlayer.discard(1, false, source, game); + Cards cards = targetPlayer.discard(1, false, false, source, game); if (!cards.isEmpty()) { for (Card card : cards.getCards(game)) { damage = card.getConvertedManaCost(); } - targetPlayer.damage(damage, source.getSourceId(), game); + targetPlayer.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HellionEruption.java b/Mage.Sets/src/mage/cards/h/HellionEruption.java index 8ec6fefa116..03b27d08c5a 100644 --- a/Mage.Sets/src/mage/cards/h/HellionEruption.java +++ b/Mage.Sets/src/mage/cards/h/HellionEruption.java @@ -57,9 +57,9 @@ class HellionEruptionEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } - (new HellionToken()).putOntoBattlefield(permanents.size(), game, source.getSourceId(), source.getControllerId()); + (new HellionToken()).putOntoBattlefield(permanents.size(), game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HellkiteCharger.java b/Mage.Sets/src/mage/cards/h/HellkiteCharger.java index d541ad662b1..8c2519db602 100644 --- a/Mage.Sets/src/mage/cards/h/HellkiteCharger.java +++ b/Mage.Sets/src/mage/cards/h/HellkiteCharger.java @@ -72,7 +72,7 @@ class HellkiteChargerEffect extends OneShotEffect { ManaCosts cost = new ManaCostsImpl("{5}{R}{R}"); if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { new UntapAllControllerEffect(new FilterAttackingCreature(),"").apply(game, source); game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false)); return true; diff --git a/Mage.Sets/src/mage/cards/h/HellkiteTyrant.java b/Mage.Sets/src/mage/cards/h/HellkiteTyrant.java index 4bdf2470abe..63d61c17ddc 100644 --- a/Mage.Sets/src/mage/cards/h/HellkiteTyrant.java +++ b/Mage.Sets/src/mage/cards/h/HellkiteTyrant.java @@ -131,7 +131,7 @@ class HellkiteTyrantControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null && controllerId != null) { - return permanent.changeControllerId(controllerId, game); + return permanent.changeControllerId(controllerId, game, source); } // Permanent is no longer on the battlefield, the effect can be discarded. discard(); diff --git a/Mage.Sets/src/mage/cards/h/Hellrider.java b/Mage.Sets/src/mage/cards/h/Hellrider.java index 91ebfa5e2d7..f15e4bfdd0d 100644 --- a/Mage.Sets/src/mage/cards/h/Hellrider.java +++ b/Mage.Sets/src/mage/cards/h/Hellrider.java @@ -62,7 +62,7 @@ class HellriderTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HelmOfKaldra.java b/Mage.Sets/src/mage/cards/h/HelmOfKaldra.java index a23276b276f..ad37cca1304 100644 --- a/Mage.Sets/src/mage/cards/h/HelmOfKaldra.java +++ b/Mage.Sets/src/mage/cards/h/HelmOfKaldra.java @@ -117,17 +117,17 @@ class HelmOfKaldraEffect extends OneShotEffect { if (kaldra != null) { // Attach helm to the token for (Permanent kaldrasHelm : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterHelm, source.getControllerId(), game)) { - kaldra.addAttachment(kaldrasHelm.getId(), game); + kaldra.addAttachment(kaldrasHelm.getId(), source, game); break; } // Attach shield to the token for (Permanent kaldrasShield : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterShield, source.getControllerId(), game)) { - kaldra.addAttachment(kaldrasShield.getId(), game); + kaldra.addAttachment(kaldrasShield.getId(), source, game); break; } // Attach sword to the token for (Permanent kaldrasSword : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterSword, source.getControllerId(), game)) { - kaldra.addAttachment(kaldrasSword.getId(), game); + kaldra.addAttachment(kaldrasSword.getId(), source, game); break; } diff --git a/Mage.Sets/src/mage/cards/h/HelmOfObedience.java b/Mage.Sets/src/mage/cards/h/HelmOfObedience.java index 6eb4fc5cc6e..30281ca6e87 100644 --- a/Mage.Sets/src/mage/cards/h/HelmOfObedience.java +++ b/Mage.Sets/src/mage/cards/h/HelmOfObedience.java @@ -96,7 +96,7 @@ class HelmOfObedienceEffect extends OneShotEffect { if (!creatures.isEmpty()) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } break; } diff --git a/Mage.Sets/src/mage/cards/h/HeraldOfLeshrac.java b/Mage.Sets/src/mage/cards/h/HeraldOfLeshrac.java index bd411af8e5c..9545ca7f1e8 100644 --- a/Mage.Sets/src/mage/cards/h/HeraldOfLeshrac.java +++ b/Mage.Sets/src/mage/cards/h/HeraldOfLeshrac.java @@ -91,9 +91,9 @@ class HeraldOfLeshracCumulativeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Target target = new TargetPermanent(filter); - if (target.choose(Outcome.GainControl, controllerId, sourceId, game)) { + if (target.choose(Outcome.GainControl, controllerId, source.getSourceId(), game)) { ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame); effect.setTargetPointer(new FixedTarget(target.getFirstTarget())); game.addEffect(effect, ability); @@ -104,7 +104,7 @@ class HeraldOfLeshracCumulativeCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return game.getBattlefield().contains(filter, controllerId, game, 1); } diff --git a/Mage.Sets/src/mage/cards/h/HereticsPunishment.java b/Mage.Sets/src/mage/cards/h/HereticsPunishment.java index 87439fa4df6..0528f0f898a 100644 --- a/Mage.Sets/src/mage/cards/h/HereticsPunishment.java +++ b/Mage.Sets/src/mage/cards/h/HereticsPunishment.java @@ -68,12 +68,12 @@ class HereticsPunishmentEffect extends OneShotEffect { .orElse(0); Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(maxCost, source.getSourceId(), game, false, true); + permanent.damage(maxCost, source.getSourceId(), source, game, false, true); return true; } Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(maxCost, source.getSourceId(), game); + targetPlayer.damage(maxCost, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/h/HeroOfLeinaTower.java b/Mage.Sets/src/mage/cards/h/HeroOfLeinaTower.java index 0d20317053e..7c9de9fbaf3 100644 --- a/Mage.Sets/src/mage/cards/h/HeroOfLeinaTower.java +++ b/Mage.Sets/src/mage/cards/h/HeroOfLeinaTower.java @@ -72,7 +72,7 @@ class HeroOfLeinaTowerEffect extends OneShotEffect { if (you != null && you.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) { int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { return new AddCountersSourceEffect(CounterType.P1P1.createInstance(costX), true).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/h/Heroism.java b/Mage.Sets/src/mage/cards/h/Heroism.java index fd867fc8619..3e549dfd3dd 100644 --- a/Mage.Sets/src/mage/cards/h/Heroism.java +++ b/Mage.Sets/src/mage/cards/h/Heroism.java @@ -91,7 +91,7 @@ class HeroismEffect extends OneShotEffect { String message = "Pay " + cost.getText() + "? If you don't, " + permanent.getLogName() + "'s combat damage will be prevented this turn."; if (player != null) { if (player.chooseUse(Outcome.Neutral, message, source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(player.getLogName() + " paid " + cost.getText() + " for " + permanent.getLogName()); } else { diff --git a/Mage.Sets/src/mage/cards/h/HexParasite.java b/Mage.Sets/src/mage/cards/h/HexParasite.java index d886e94b859..2f406c6b746 100644 --- a/Mage.Sets/src/mage/cards/h/HexParasite.java +++ b/Mage.Sets/src/mage/cards/h/HexParasite.java @@ -73,13 +73,13 @@ class HexParasiteEffect extends OneShotEffect { for (String counterName : counterNames) { if (controller.chooseUse(Outcome.Neutral, "Do you want to remove " + counterName + " counters?", source, game)) { if (permanent.getCounters(game).get(counterName).getCount() == 1 || (toRemove - removed == 1)) { - permanent.removeCounters(counterName, 1, game); + permanent.removeCounters(counterName, 1, source, game); removed++; } else { int amount = controller.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game); if (amount > 0) { removed += amount; - permanent.removeCounters(counterName, amount, game); + permanent.removeCounters(counterName, amount, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/h/HibernationsEnd.java b/Mage.Sets/src/mage/cards/h/HibernationsEnd.java index 949924d3948..17552681639 100644 --- a/Mage.Sets/src/mage/cards/h/HibernationsEnd.java +++ b/Mage.Sets/src/mage/cards/h/HibernationsEnd.java @@ -1,6 +1,7 @@ package mage.cards.h; +import java.util.Objects; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -65,12 +66,12 @@ class HibernationsEndAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.PAID_CUMULATIVE_UPKEEP; + return event.getType() == GameEvent.EventType.PAID_CUMULATIVE_UPKEEP; } @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getSourceId() != null && event.getSourceId().equals(this.getSourceId()); + return event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/cards/h/HiddenStrings.java b/Mage.Sets/src/mage/cards/h/HiddenStrings.java index f4f9fcc463a..eadd5fba1e7 100644 --- a/Mage.Sets/src/mage/cards/h/HiddenStrings.java +++ b/Mage.Sets/src/mage/cards/h/HiddenStrings.java @@ -76,7 +76,7 @@ class HiddenStringsEffect extends OneShotEffect { } } else { if (player.chooseUse(Outcome.Tap, "Tap " + permanent.getName() + '?', source, game)) { - permanent.tap(game); + permanent.tap(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/h/HideSeek.java b/Mage.Sets/src/mage/cards/h/HideSeek.java index 89ccbd290b7..3d2d01b89af 100644 --- a/Mage.Sets/src/mage/cards/h/HideSeek.java +++ b/Mage.Sets/src/mage/cards/h/HideSeek.java @@ -78,7 +78,7 @@ class SeekEffect extends OneShotEffect { UUID targetId = target.getFirstTarget(); Card card = opponent.getLibrary().remove(targetId, game); if (card != null) { - player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + player.moveCardToExileWithInfo(card, null, null, source, game, Zone.LIBRARY, true); int cmc = card.getConvertedManaCost(); if (cmc > 0) { player.gainLife(cmc, game, source); diff --git a/Mage.Sets/src/mage/cards/h/HidetsugusSecondRite.java b/Mage.Sets/src/mage/cards/h/HidetsugusSecondRite.java index c9aa09e14e6..850c3fdd1e8 100644 --- a/Mage.Sets/src/mage/cards/h/HidetsugusSecondRite.java +++ b/Mage.Sets/src/mage/cards/h/HidetsugusSecondRite.java @@ -57,7 +57,7 @@ class HidetsugusSecondRiteEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { if (targetPlayer.getLife() == 10) { - targetPlayer.damage(10, source.getSourceId(), game); + targetPlayer.damage(10, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HighPriestOfPenance.java b/Mage.Sets/src/mage/cards/h/HighPriestOfPenance.java index 0cc988f870c..18da0272e75 100644 --- a/Mage.Sets/src/mage/cards/h/HighPriestOfPenance.java +++ b/Mage.Sets/src/mage/cards/h/HighPriestOfPenance.java @@ -60,7 +60,7 @@ class HighPriestOfPenanceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HighTide.java b/Mage.Sets/src/mage/cards/h/HighTide.java index 110db4d260e..b8248f0bcd0 100644 --- a/Mage.Sets/src/mage/cards/h/HighTide.java +++ b/Mage.Sets/src/mage/cards/h/HighTide.java @@ -63,12 +63,12 @@ class HighTideTriggeredAbility extends DelayedTriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent land = game.getPermanent(event.getTargetId()); + Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); if (land != null && filter.match(land, game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(land.getControllerId())); diff --git a/Mage.Sets/src/mage/cards/h/HighcliffFelidar.java b/Mage.Sets/src/mage/cards/h/HighcliffFelidar.java index f637e82547e..50873c7db5b 100644 --- a/Mage.Sets/src/mage/cards/h/HighcliffFelidar.java +++ b/Mage.Sets/src/mage/cards/h/HighcliffFelidar.java @@ -109,7 +109,7 @@ class HighcliffFelidarEffect extends OneShotEffect { toDestroy.stream() .map(game::getPermanent) .filter(Objects::nonNull) - .forEachOrdered(permanent -> permanent.destroy(source.getSourceId(), game, false)); + .forEachOrdered(permanent -> permanent.destroy(source, game, false)); return true; } } diff --git a/Mage.Sets/src/mage/cards/h/HintOfInsanity.java b/Mage.Sets/src/mage/cards/h/HintOfInsanity.java index d41189a633a..5054c06ac09 100644 --- a/Mage.Sets/src/mage/cards/h/HintOfInsanity.java +++ b/Mage.Sets/src/mage/cards/h/HintOfInsanity.java @@ -80,7 +80,7 @@ class HintOfInsanityEffect extends OneShotEffect { .filter(card -> nameCounts.getOrDefault(card.getName(), 0) > 1) .collect(Collectors.toSet()) ); - player.discard(cards, source, game); + player.discard(cards, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/h/HisokaMinamoSensei.java b/Mage.Sets/src/mage/cards/h/HisokaMinamoSensei.java index c137a7de62d..36908409cc2 100644 --- a/Mage.Sets/src/mage/cards/h/HisokaMinamoSensei.java +++ b/Mage.Sets/src/mage/cards/h/HisokaMinamoSensei.java @@ -72,8 +72,8 @@ class HisokaMinamoSenseiDiscardTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.Discard, controllerId, source.getSourceId(), game)) { Player player = game.getPlayer(controllerId); if(player != null) { for (UUID targetId : targets.get(0).getTargets()) { @@ -81,7 +81,7 @@ class HisokaMinamoSenseiDiscardTargetCost extends CostImpl { if (card == null) { return false; } - paid |= player.discard(card, null, game); + paid |= player.discard(card, true, source, game); } } @@ -90,8 +90,8 @@ class HisokaMinamoSenseiDiscardTargetCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override @@ -121,7 +121,7 @@ class HisokaMinamoSenseiCounterEffect extends OneShotEffect { if (spell != null) { HisokaMinamoSenseiDiscardTargetCost cost = (HisokaMinamoSenseiDiscardTargetCost) source.getCosts().get(0); if (cost != null && cost.getDiscardedCard().getConvertedManaCost() == spell.getConvertedManaCost()) { - return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game); + return game.getStack().counter(targetPointer.getFirst(game, source), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/h/HitRun.java b/Mage.Sets/src/mage/cards/h/HitRun.java index 9f6f37ab64b..8c860313b89 100644 --- a/Mage.Sets/src/mage/cards/h/HitRun.java +++ b/Mage.Sets/src/mage/cards/h/HitRun.java @@ -77,14 +77,14 @@ class HitEffect extends OneShotEffect { CardType.CREATURE.getPredicate())); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); - if (target.canChoose(targetPlayer.getId(), game)) { + if (target.canChoose(source.getSourceId(), targetPlayer.getId(), game)) { targetPlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); int damage = permanent.getConvertedManaCost(); if (damage > 0) { - targetPlayer.damage(damage, source.getSourceId(), game); + targetPlayer.damage(damage, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/h/HoardersGreed.java b/Mage.Sets/src/mage/cards/h/HoardersGreed.java index 0c14b533c2e..a3bd83ffc9b 100644 --- a/Mage.Sets/src/mage/cards/h/HoardersGreed.java +++ b/Mage.Sets/src/mage/cards/h/HoardersGreed.java @@ -57,8 +57,8 @@ class HoardersGreedEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { do { - controller.loseLife(2, game, false); - controller.drawCards(2, source.getSourceId(), game); + controller.loseLife(2, game, source, false); + controller.drawCards(2, source, game); } while (controller.canRespond() && ClashEffect.getInstance().apply(game, source)); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HoardingDragon.java b/Mage.Sets/src/mage/cards/h/HoardingDragon.java index 1a42bc8d5fa..648f4c61cf0 100644 --- a/Mage.Sets/src/mage/cards/h/HoardingDragon.java +++ b/Mage.Sets/src/mage/cards/h/HoardingDragon.java @@ -83,7 +83,7 @@ class HoardingDragonEffect extends OneShotEffect { if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/h/HollowSpecter.java b/Mage.Sets/src/mage/cards/h/HollowSpecter.java index b350bafe86a..ab2bf6cb0ba 100644 --- a/Mage.Sets/src/mage/cards/h/HollowSpecter.java +++ b/Mage.Sets/src/mage/cards/h/HollowSpecter.java @@ -107,7 +107,7 @@ class HollowSpecterEffect extends OneShotEffect { card = revealedCards.getRandom(game); } - targetPlayer.discard(card, source, game); + targetPlayer.discard(card, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/h/HollowbornBarghest.java b/Mage.Sets/src/mage/cards/h/HollowbornBarghest.java index 3e8991c95ee..c613983f4b2 100644 --- a/Mage.Sets/src/mage/cards/h/HollowbornBarghest.java +++ b/Mage.Sets/src/mage/cards/h/HollowbornBarghest.java @@ -82,7 +82,7 @@ class HollowbornBarghestEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - game.getPlayer(opponentId).loseLife(2, game, false); + game.getPlayer(opponentId).loseLife(2, game, source, false); } } return true; @@ -112,7 +112,7 @@ class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId()); } diff --git a/Mage.Sets/src/mage/cards/h/HolyJusticiar.java b/Mage.Sets/src/mage/cards/h/HolyJusticiar.java index a86fefcdab8..0e7d0a22e0e 100644 --- a/Mage.Sets/src/mage/cards/h/HolyJusticiar.java +++ b/Mage.Sets/src/mage/cards/h/HolyJusticiar.java @@ -66,10 +66,10 @@ class HolyJusticiarEffect extends OneShotEffect { Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { if (creature.hasSubtype(SubType.ZOMBIE, game)) { - creature.tap(game); - creature.moveToExile(source.getSourceId(), creature.getName(), source.getSourceId(), game); + creature.tap(source, game); + creature.moveToExile(source.getSourceId(), creature.getName(), source, game); } else { - creature.tap(game); + creature.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HomewardPath.java b/Mage.Sets/src/mage/cards/h/HomewardPath.java index 623a5f533a0..7501e4bb7df 100644 --- a/Mage.Sets/src/mage/cards/h/HomewardPath.java +++ b/Mage.Sets/src/mage/cards/h/HomewardPath.java @@ -90,7 +90,7 @@ class HomewardPathControlEffect extends ContinuousEffectImpl { Permanent creature = it.next().getPermanent(game); if (creature != null) { if (!creature.isControlledBy(creature.getOwnerId())) { - creature.changeControllerId(creature.getOwnerId(), game); + creature.changeControllerId(creature.getOwnerId(), game, source); } } else { it.remove(); diff --git a/Mage.Sets/src/mage/cards/h/HomicidalBrute.java b/Mage.Sets/src/mage/cards/h/HomicidalBrute.java index 3725db394c5..146790c855a 100644 --- a/Mage.Sets/src/mage/cards/h/HomicidalBrute.java +++ b/Mage.Sets/src/mage/cards/h/HomicidalBrute.java @@ -67,7 +67,7 @@ class HomicidalBruteTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HomingLightning.java b/Mage.Sets/src/mage/cards/h/HomingLightning.java index 9e73c445f26..a3f2256ffdf 100644 --- a/Mage.Sets/src/mage/cards/h/HomingLightning.java +++ b/Mage.Sets/src/mage/cards/h/HomingLightning.java @@ -65,7 +65,7 @@ class HomingLightningEffect extends OneShotEffect { } for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != null) { - creature.damage(4, source.getSourceId(), game, false, true); + creature.damage(4, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HonorTheFallen.java b/Mage.Sets/src/mage/cards/h/HonorTheFallen.java index afffbdb2eca..6966be7e439 100644 --- a/Mage.Sets/src/mage/cards/h/HonorTheFallen.java +++ b/Mage.Sets/src/mage/cards/h/HonorTheFallen.java @@ -60,7 +60,7 @@ class HonorTheFallenEffect extends OneShotEffect { if (player != null) { for (Card card : player.getGraveyard().getCards(game)) { if (StaticFilters.FILTER_CARD_CREATURE.match(card, source.getSourceId(), controller.getId(), game)) { - if (card.moveToExile(null, "", source.getSourceId(), game)) { + if (card.moveToExile(null, "", source, game)) { exiledCards++; } } diff --git a/Mage.Sets/src/mage/cards/h/HonorablePassage.java b/Mage.Sets/src/mage/cards/h/HonorablePassage.java index 93bd4984ff3..112f161c527 100644 --- a/Mage.Sets/src/mage/cards/h/HonorablePassage.java +++ b/Mage.Sets/src/mage/cards/h/HonorablePassage.java @@ -65,7 +65,7 @@ class HonorablePassageEffect extends PreventNextDamageFromChosenSourceToTargetEf if (sourceControllerId != null) { Player sourceController = game.getPlayer(sourceControllerId); if (sourceController != null) { - sourceController.damage(damage, source.getSourceId(), game); + sourceController.damage(damage, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index 0143975285d..22aa96d5b40 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -144,7 +144,7 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) { MageObjectReference damager = new MageObjectReference(event.getSourceId(), game); Set players; if (combatDamagedPlayers.containsKey(damager)) { diff --git a/Mage.Sets/src/mage/cards/h/HornOfGreed.java b/Mage.Sets/src/mage/cards/h/HornOfGreed.java index 59795a72f8d..d96fa94ecb0 100644 --- a/Mage.Sets/src/mage/cards/h/HornOfGreed.java +++ b/Mage.Sets/src/mage/cards/h/HornOfGreed.java @@ -53,7 +53,7 @@ class HornOfGreedAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HornOfPlenty.java b/Mage.Sets/src/mage/cards/h/HornOfPlenty.java index fb2b603d9be..a229a788c47 100644 --- a/Mage.Sets/src/mage/cards/h/HornOfPlenty.java +++ b/Mage.Sets/src/mage/cards/h/HornOfPlenty.java @@ -65,7 +65,7 @@ class HornOfPlentyEffect extends OneShotEffect { if (caster != null) { if (caster.chooseUse(Outcome.DrawCard, "Pay {1} to draw a card at the beginning of the next end step?", source, game)) { Cost cost = new ManaCostsImpl("{1}"); - if (cost.pay(source, game, source.getSourceId(), caster.getId(), false, null)) { + if (cost.pay(source, game, source, caster.getId(), false, null)) { Effect effect = new DrawCardTargetEffect(1); effect.setTargetPointer(new FixedTarget(caster.getId())); game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect, TargetController.ANY), source); diff --git a/Mage.Sets/src/mage/cards/h/HornetCannon.java b/Mage.Sets/src/mage/cards/h/HornetCannon.java index c9f35f20232..595066ae567 100644 --- a/Mage.Sets/src/mage/cards/h/HornetCannon.java +++ b/Mage.Sets/src/mage/cards/h/HornetCannon.java @@ -64,7 +64,7 @@ class HornetCannonEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Token hornetToken = new HornetToken(); - hornetToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + hornetToken.putOntoBattlefield(1, game, source, source.getControllerId()); for (UUID tokenId : hornetToken.getLastAddedTokenIds()) { Permanent tokenPermanent = game.getPermanent(tokenId); if (tokenPermanent != null) { diff --git a/Mage.Sets/src/mage/cards/h/HorobiDeathsWail.java b/Mage.Sets/src/mage/cards/h/HorobiDeathsWail.java index 6f8e9acade9..c299ebf742d 100644 --- a/Mage.Sets/src/mage/cards/h/HorobiDeathsWail.java +++ b/Mage.Sets/src/mage/cards/h/HorobiDeathsWail.java @@ -68,7 +68,7 @@ class HorobiDeathsWailAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HostageTaker.java b/Mage.Sets/src/mage/cards/h/HostageTaker.java index df269b88dd1..315984d792a 100644 --- a/Mage.Sets/src/mage/cards/h/HostageTaker.java +++ b/Mage.Sets/src/mage/cards/h/HostageTaker.java @@ -91,7 +91,7 @@ class HostageTakerExileEffect extends OneShotEffect { } // move card to exile UUID exileId = CardUtil.getCardExileZoneId(game, source); - controller.moveCardToExileWithInfo(card, exileId, permanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(card, exileId, permanent.getIdName(), source, game, Zone.BATTLEFIELD, true); // allow to cast the card and you may spend mana as though it were mana of any color to cast it CardUtil.makeCardPlayableAndSpendManaAsAnyColor(game, source, card, Duration.Custom); return true; diff --git a/Mage.Sets/src/mage/cards/h/HotSoup.java b/Mage.Sets/src/mage/cards/h/HotSoup.java index b161aaaa06a..a20d2e3ccc2 100644 --- a/Mage.Sets/src/mage/cards/h/HotSoup.java +++ b/Mage.Sets/src/mage/cards/h/HotSoup.java @@ -69,7 +69,7 @@ class HotSoupTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HotheadedGiant.java b/Mage.Sets/src/mage/cards/h/HotheadedGiant.java index deb65034b7c..338b4be51fa 100644 --- a/Mage.Sets/src/mage/cards/h/HotheadedGiant.java +++ b/Mage.Sets/src/mage/cards/h/HotheadedGiant.java @@ -90,7 +90,7 @@ class HotHeadedGiantWatcher extends Watcher { if (condition == true) { //no need to check - condition has already occured return; } - if (event.getType() == EventType.SPELL_CAST + if (event.getType() == GameEvent.EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) { diff --git a/Mage.Sets/src/mage/cards/h/HourOfEternity.java b/Mage.Sets/src/mage/cards/h/HourOfEternity.java index dea482bda90..2fbe11f63a1 100644 --- a/Mage.Sets/src/mage/cards/h/HourOfEternity.java +++ b/Mage.Sets/src/mage/cards/h/HourOfEternity.java @@ -99,7 +99,7 @@ class HourOfEternityEffect extends OneShotEffect { token.getColor(game).setColor(ObjectColor.BLACK); token.removeAllCreatureTypes(game); token.addSubType(game, SubType.ZOMBIE); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HourOfNeed.java b/Mage.Sets/src/mage/cards/h/HourOfNeed.java index 89baaebb510..305064863b3 100644 --- a/Mage.Sets/src/mage/cards/h/HourOfNeed.java +++ b/Mage.Sets/src/mage/cards/h/HourOfNeed.java @@ -66,9 +66,9 @@ class HourOfNeedExileEffect extends OneShotEffect { for (UUID creatureId : getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { - controller.moveCardToExileWithInfo(creature, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(creature, null, null, source, game, Zone.BATTLEFIELD, true); Token token = new HourOfNeedSphinxToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), creature.getControllerId()); + token.putOntoBattlefield(1, game, source, creature.getControllerId()); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HowlingMine.java b/Mage.Sets/src/mage/cards/h/HowlingMine.java index 93507b967e9..4509e6ddd71 100644 --- a/Mage.Sets/src/mage/cards/h/HowlingMine.java +++ b/Mage.Sets/src/mage/cards/h/HowlingMine.java @@ -52,7 +52,7 @@ class HowlingMineAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_STEP_PRE; + return event.getType() == GameEvent.EventType.DRAW_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HuatliWarriorPoet.java b/Mage.Sets/src/mage/cards/h/HuatliWarriorPoet.java index 8dd5a9ea47d..9f436f45bd7 100644 --- a/Mage.Sets/src/mage/cards/h/HuatliWarriorPoet.java +++ b/Mage.Sets/src/mage/cards/h/HuatliWarriorPoet.java @@ -84,7 +84,7 @@ class HuatliWarriorPoetDamageEffect extends OneShotEffect { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); - if (permanent != null && permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), game, false, true) > 0) { + if (permanent != null && permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), source, game, false, true) > 0) { ContinuousEffect effect = new CantBlockTargetEffect(Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/h/Hullbreacher.java b/Mage.Sets/src/mage/cards/h/Hullbreacher.java index c85da2e267a..b78037d8053 100644 --- a/Mage.Sets/src/mage/cards/h/Hullbreacher.java +++ b/Mage.Sets/src/mage/cards/h/Hullbreacher.java @@ -71,7 +71,7 @@ class HullbreacherReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - new TreasureToken().putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + new TreasureToken().putOntoBattlefield(1, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HumbleDefector.java b/Mage.Sets/src/mage/cards/h/HumbleDefector.java index 89488a79660..6377c6d6410 100644 --- a/Mage.Sets/src/mage/cards/h/HumbleDefector.java +++ b/Mage.Sets/src/mage/cards/h/HumbleDefector.java @@ -69,7 +69,7 @@ class HumbleDefectorEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(2, source.getSourceId(), game); + controller.drawCards(2, source, game); } Permanent humbleDefector = (Permanent) source.getSourceObjectIfItStillExists(game); Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); @@ -103,7 +103,7 @@ class HumbleDefectorControlSourceEffect extends ContinuousEffectImpl { Player targetOpponent = game.getPlayer(source.getFirstTarget()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && targetOpponent != null) { - permanent.changeControllerId(targetOpponent.getId(), game); + permanent.changeControllerId(targetOpponent.getId(), game, source); } else { // no valid target exists, effect can be discarded discard(); diff --git a/Mage.Sets/src/mage/cards/h/HungryFlames.java b/Mage.Sets/src/mage/cards/h/HungryFlames.java index b6276bdb5c4..ae1b5b6206a 100644 --- a/Mage.Sets/src/mage/cards/h/HungryFlames.java +++ b/Mage.Sets/src/mage/cards/h/HungryFlames.java @@ -54,11 +54,11 @@ public final class HungryFlames extends CardImpl { Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); } if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java b/Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java index 3e70736636d..13f72b20170 100644 --- a/Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java +++ b/Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java @@ -74,11 +74,11 @@ class HungryHungryHeiferEffect extends OneShotEffect { if (controller.chooseUse(outcome, "Remove a counter from a permanent you control?", source, game)) { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); RemoveCounterCost cost = new RemoveCounterCost(target); - if (cost.pay(null, game, source.getSourceId(), controller.getId(), true)) { + if (cost.pay(null, game, source, controller.getId(), true)) { return true; } } - sourceObject.sacrifice(source.getSourceId(), game); + sourceObject.sacrifice(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/h/HuntersInsight.java b/Mage.Sets/src/mage/cards/h/HuntersInsight.java index d2dbeda1de1..87315f363c0 100644 --- a/Mage.Sets/src/mage/cards/h/HuntersInsight.java +++ b/Mage.Sets/src/mage/cards/h/HuntersInsight.java @@ -91,8 +91,8 @@ class HuntersInsightTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HuntersProwess.java b/Mage.Sets/src/mage/cards/h/HuntersProwess.java index 8fcbe40d413..d38ed95a63a 100644 --- a/Mage.Sets/src/mage/cards/h/HuntersProwess.java +++ b/Mage.Sets/src/mage/cards/h/HuntersProwess.java @@ -73,7 +73,7 @@ class HuntersProwessDrawEffect extends OneShotEffect { if (controller != null) { int damage = (Integer) this.getValue("damage"); if (damage > 0) { - controller.drawCards(damage, source.getSourceId(), game); + controller.drawCards(damage, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HydraOmnivore.java b/Mage.Sets/src/mage/cards/h/HydraOmnivore.java index f7616a521d8..1fea68182de 100644 --- a/Mage.Sets/src/mage/cards/h/HydraOmnivore.java +++ b/Mage.Sets/src/mage/cards/h/HydraOmnivore.java @@ -68,7 +68,7 @@ class HydraOmnivoreEffect extends OneShotEffect { if (!Objects.equals(playerId, damagedOpponent)) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - int dealtDamage = opponent.damage(amount, source.getSourceId(), game); + int dealtDamage = opponent.damage(amount, source.getSourceId(), source, game); game.informPlayers(object.getLogName() + " deals " + dealtDamage + " damage to " + opponent.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/h/Hydradoodle.java b/Mage.Sets/src/mage/cards/h/Hydradoodle.java index d39d1a41e72..651d4f3ec54 100644 --- a/Mage.Sets/src/mage/cards/h/Hydradoodle.java +++ b/Mage.Sets/src/mage/cards/h/Hydradoodle.java @@ -93,7 +93,7 @@ class HydradoodleEffect extends OneShotEffect { if (amount > 0) { int total = 0; for (int roll = 0; roll < amount; roll++) { - int thisRoll = controller.rollDice(game, 6); + int thisRoll = controller.rollDice(source, game, 6); total += thisRoll; } diff --git a/Mage.Sets/src/mage/cards/h/Hydroblast.java b/Mage.Sets/src/mage/cards/h/Hydroblast.java index 53da9f524dd..b45cc8479ee 100644 --- a/Mage.Sets/src/mage/cards/h/Hydroblast.java +++ b/Mage.Sets/src/mage/cards/h/Hydroblast.java @@ -63,7 +63,7 @@ class HydroblastCounterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { if (game.getStack().getSpell(source.getFirstTarget()).getColor(game).isRed()) { - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); } return true; } @@ -93,7 +93,7 @@ class HydroblastDestroyEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget()); if (permanent != null && permanent.getColor(game).isRed()) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HydroidKrasis.java b/Mage.Sets/src/mage/cards/h/HydroidKrasis.java index 41e5cc9507d..a8b9024938e 100644 --- a/Mage.Sets/src/mage/cards/h/HydroidKrasis.java +++ b/Mage.Sets/src/mage/cards/h/HydroidKrasis.java @@ -86,7 +86,7 @@ class HydroidKrasisEffect extends OneShotEffect { return false; } int halfCost = Math.floorDiv(((SpellAbility) obj).getManaCostsToPay().getX(), 2); - player.drawCards(halfCost, source.getSourceId(), game); + player.drawCards(halfCost, source, game); player.gainLife(halfCost, game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/h/Hypnox.java b/Mage.Sets/src/mage/cards/h/Hypnox.java index a9fd9855655..fc909fc21cb 100644 --- a/Mage.Sets/src/mage/cards/h/Hypnox.java +++ b/Mage.Sets/src/mage/cards/h/Hypnox.java @@ -77,7 +77,7 @@ class HypnoxExileEffect extends OneShotEffect { for (UUID cid : player.getHand().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(source.getSourceId(), "Hypnox", source.getSourceId(), game); + c.moveToExile(source.getSourceId(), "Hypnox", source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/IbHalfheartGoblinTactician.java b/Mage.Sets/src/mage/cards/i/IbHalfheartGoblinTactician.java index 707c6c009c8..79c62c8603f 100644 --- a/Mage.Sets/src/mage/cards/i/IbHalfheartGoblinTactician.java +++ b/Mage.Sets/src/mage/cards/i/IbHalfheartGoblinTactician.java @@ -98,11 +98,11 @@ class IbHalfheartGoblinTacticianEffect extends OneShotEffect { blockingCreatures.addAll(combatGroup.getBlockers()); } } - if (blockedCreature.sacrifice(source.getSourceId(), game)) { + if (blockedCreature.sacrifice(source, game)) { for (UUID blockerId : blockingCreatures) { Permanent blockingCreature = game.getPermanent(blockerId); if (blockingCreature != null) { - blockingCreature.damage(4, blockedCreature.getId(), game, false, true); + blockingCreature.damage(4, blockedCreature.getId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/IceCauldron.java b/Mage.Sets/src/mage/cards/i/IceCauldron.java index c9fadca7a51..fe742380568 100644 --- a/Mage.Sets/src/mage/cards/i/IceCauldron.java +++ b/Mage.Sets/src/mage/cards/i/IceCauldron.java @@ -102,7 +102,7 @@ class IceCauldronExileEffect extends OneShotEffect { chosenCard = controller.getHand().get(target.getFirstTarget(), game); } if (chosenCard != null) { - controller.moveCardToExileWithInfo(chosenCard, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(chosenCard, source.getSourceId(), sourcePermanent.getIdName(), source, game, Zone.HAND, true); AsThoughEffect effect = new IceCauldronCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(chosenCard.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/i/IceCave.java b/Mage.Sets/src/mage/cards/i/IceCave.java index 998a8b53141..067bdb29ac8 100644 --- a/Mage.Sets/src/mage/cards/i/IceCave.java +++ b/Mage.Sets/src/mage/cards/i/IceCave.java @@ -71,11 +71,11 @@ class IceCaveEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && !player.equals(spellController)) { cost.clearPaid(); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(outcome, "Pay " + cost.getText() + " to counter " + spell.getIdName() + '?', source, game)) { - if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) { + if (cost.pay(source, game, source, playerId, false, null)) { game.informPlayers(player.getLogName() + " pays" + cost.getText() + " to counter " + spell.getIdName() + '.'); - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); break; } } diff --git a/Mage.Sets/src/mage/cards/i/IcefallRegent.java b/Mage.Sets/src/mage/cards/i/IcefallRegent.java index 582882559a8..8783cb54edc 100644 --- a/Mage.Sets/src/mage/cards/i/IcefallRegent.java +++ b/Mage.Sets/src/mage/cards/i/IcefallRegent.java @@ -137,7 +137,9 @@ class IcefallRegentWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST_CONTROL && event.getPlayerId().equals(controllerId) && event.getTargetId().equals(sourceId)) { + if (event.getType() == GameEvent.EventType.LOST_CONTROL + && event.getPlayerId().equals(controllerId) + && event.getTargetId().equals(sourceId)) { condition = true; game.replaceEvent(event); return; diff --git a/Mage.Sets/src/mage/cards/i/Icequake.java b/Mage.Sets/src/mage/cards/i/Icequake.java index d14b68b7803..66d473c96ed 100644 --- a/Mage.Sets/src/mage/cards/i/Icequake.java +++ b/Mage.Sets/src/mage/cards/i/Icequake.java @@ -62,9 +62,9 @@ class IcequakeEffect extends OneShotEffect { if (permanent != null) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (permanent.isSnow()) { - controller.damage(1, source.getSourceId(), game); + controller.damage(1, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IchneumonDruid.java b/Mage.Sets/src/mage/cards/i/IchneumonDruid.java index 6ac8a968063..4de0681e613 100644 --- a/Mage.Sets/src/mage/cards/i/IchneumonDruid.java +++ b/Mage.Sets/src/mage/cards/i/IchneumonDruid.java @@ -66,7 +66,7 @@ class IchneumonDruidAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -102,7 +102,7 @@ class IchneumonDruidWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST) { + if (event.getType() == GameEvent.EventType.SPELL_CAST) { UUID playerId = event.getPlayerId(); Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.isInstant()) { diff --git a/Mage.Sets/src/mage/cards/i/IchorRats.java b/Mage.Sets/src/mage/cards/i/IchorRats.java index d0c0af9b14a..eb8596ced33 100644 --- a/Mage.Sets/src/mage/cards/i/IchorRats.java +++ b/Mage.Sets/src/mage/cards/i/IchorRats.java @@ -59,7 +59,7 @@ class IchorRatsEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.addCounters(CounterType.POISON.createInstance(), game); + player.addCounters(CounterType.POISON.createInstance(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/IdentityCrisis.java b/Mage.Sets/src/mage/cards/i/IdentityCrisis.java index b0937580069..27b113c432f 100644 --- a/Mage.Sets/src/mage/cards/i/IdentityCrisis.java +++ b/Mage.Sets/src/mage/cards/i/IdentityCrisis.java @@ -56,13 +56,13 @@ class IdentityCrisisEffect extends OneShotEffect { for (UUID cid : player.getHand().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(null, null, source.getSourceId(), game); + c.moveToExile(null, null, source, game); } } for (UUID cid : player.getGraveyard().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(null, null, source.getSourceId(), game); + c.moveToExile(null, null, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/IdentityThief.java b/Mage.Sets/src/mage/cards/i/IdentityThief.java index 7b005f57604..58208f9531a 100644 --- a/Mage.Sets/src/mage/cards/i/IdentityThief.java +++ b/Mage.Sets/src/mage/cards/i/IdentityThief.java @@ -74,7 +74,7 @@ class IdentityThiefAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/i/IgniteMemories.java b/Mage.Sets/src/mage/cards/i/IgniteMemories.java index 3bf82988617..f2218f23bc5 100644 --- a/Mage.Sets/src/mage/cards/i/IgniteMemories.java +++ b/Mage.Sets/src/mage/cards/i/IgniteMemories.java @@ -60,7 +60,7 @@ class IgniteMemoriesEffect extends OneShotEffect { if (card != null) { revealed.add(card); controller.revealCards(sourceObject.getIdName(), revealed, game); - controller.damage(card.getConvertedManaCost(), source.getSourceId(), game); + controller.damage(card.getConvertedManaCost(), source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/i/IkraShidiqiTheUsurper.java b/Mage.Sets/src/mage/cards/i/IkraShidiqiTheUsurper.java index f4065c73964..9d18a1c9166 100644 --- a/Mage.Sets/src/mage/cards/i/IkraShidiqiTheUsurper.java +++ b/Mage.Sets/src/mage/cards/i/IkraShidiqiTheUsurper.java @@ -71,7 +71,7 @@ class IkraShidiqiTheUsurperTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/i/IllicitAuction.java b/Mage.Sets/src/mage/cards/i/IllicitAuction.java index 3791eac67b9..95f261c8e4d 100644 --- a/Mage.Sets/src/mage/cards/i/IllicitAuction.java +++ b/Mage.Sets/src/mage/cards/i/IllicitAuction.java @@ -103,7 +103,7 @@ class IllicitAuctionEffect extends GainControlTargetEffect { } game.informPlayers(winner.getLogName() + " won the auction with a bid of " + highBid + " life" + (highBid > 1 ? "s" : "")); - winner.loseLife(highBid, game, false); + winner.loseLife(highBid, game, source, false); super.controllingPlayerId = winner.getId(); } super.init(source, game); diff --git a/Mage.Sets/src/mage/cards/i/Illumination.java b/Mage.Sets/src/mage/cards/i/Illumination.java index a1233741aa5..c572e1ddbf9 100644 --- a/Mage.Sets/src/mage/cards/i/Illumination.java +++ b/Mage.Sets/src/mage/cards/i/Illumination.java @@ -76,7 +76,7 @@ class IlluminationEffect extends OneShotEffect { controller = game.getPlayer(game.getControllerId(targetId)); } if (targetId != null - && game.getStack().counter(targetId, source.getSourceId(), game)) { + && game.getStack().counter(targetId, source, game)) { countered = true; } if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/i/IllusionistsBracers.java b/Mage.Sets/src/mage/cards/i/IllusionistsBracers.java index 6b98993ed81..954f0dca6a7 100644 --- a/Mage.Sets/src/mage/cards/i/IllusionistsBracers.java +++ b/Mage.Sets/src/mage/cards/i/IllusionistsBracers.java @@ -65,7 +65,7 @@ class IllusionistsBracersTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATED_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; } @Override diff --git a/Mage.Sets/src/mage/cards/i/IllusoryAmbusher.java b/Mage.Sets/src/mage/cards/i/IllusoryAmbusher.java index 1b6e2b315af..e3e798971e0 100644 --- a/Mage.Sets/src/mage/cards/i/IllusoryAmbusher.java +++ b/Mage.Sets/src/mage/cards/i/IllusoryAmbusher.java @@ -67,7 +67,7 @@ class IllusoryAmbusherDealtDamageEffect extends OneShotEffect { if (player != null) { int amount = (Integer) getValue("damage"); if (amount > 0) { - player.drawCards(amount, source.getSourceId(), game); + player.drawCards(amount, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IllusoryGains.java b/Mage.Sets/src/mage/cards/i/IllusoryGains.java index 7ec59369722..1ac6def1103 100644 --- a/Mage.Sets/src/mage/cards/i/IllusoryGains.java +++ b/Mage.Sets/src/mage/cards/i/IllusoryGains.java @@ -86,8 +86,8 @@ class IllusoryGainsEffect extends OneShotEffect { if (oldCreature == null) { return false; } - if (oldCreature.removeAttachment(illusoryGains.getId(), game)) { - return opponentCreature.addAttachment(illusoryGains.getId(), game); + if (oldCreature.removeAttachment(illusoryGains.getId(), source, game)) { + return opponentCreature.addAttachment(illusoryGains.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/i/Immerwolf.java b/Mage.Sets/src/mage/cards/i/Immerwolf.java index efc6e0254c9..41c6b578e81 100644 --- a/Mage.Sets/src/mage/cards/i/Immerwolf.java +++ b/Mage.Sets/src/mage/cards/i/Immerwolf.java @@ -82,7 +82,7 @@ class ImmerwolfEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TRANSFORM; + return event.getType() == GameEvent.EventType.TRANSFORM; } @Override diff --git a/Mage.Sets/src/mage/cards/i/ImmortalCoil.java b/Mage.Sets/src/mage/cards/i/ImmortalCoil.java index 6c52b2592ab..b7b021dbc32 100644 --- a/Mage.Sets/src/mage/cards/i/ImmortalCoil.java +++ b/Mage.Sets/src/mage/cards/i/ImmortalCoil.java @@ -22,6 +22,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; @@ -134,7 +135,7 @@ class PreventAllDamageToControllerEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); Player player = game.getPlayer(source.getControllerId()); @@ -144,13 +145,13 @@ class PreventAllDamageToControllerEffect extends PreventionEffectImpl { for (UUID targetId : target.getTargets()) { Card card = player.getGraveyard().get(targetId, game); if (card != null) { - card.moveToZone(Zone.EXILED, source.getSourceId(), game, false); + card.moveToZone(Zone.EXILED, source, game, false); } } } } event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } @@ -159,7 +160,6 @@ class PreventAllDamageToControllerEffect extends PreventionEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { return event.getTargetId().equals(source.getControllerId()); - } return false; } diff --git a/Mage.Sets/src/mage/cards/i/ImmortalServitude.java b/Mage.Sets/src/mage/cards/i/ImmortalServitude.java index 448f825cf6c..380b0dcc2c6 100644 --- a/Mage.Sets/src/mage/cards/i/ImmortalServitude.java +++ b/Mage.Sets/src/mage/cards/i/ImmortalServitude.java @@ -60,7 +60,7 @@ class ImmortalServitudeEffect extends OneShotEffect { Set cards = you.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game); for (Card card : cards) { if (card != null && card.getConvertedManaCost() == count) { - card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + card.moveToZone(Zone.BATTLEFIELD, source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/ImpelledGiant.java b/Mage.Sets/src/mage/cards/i/ImpelledGiant.java index d32858d4708..bba84642625 100644 --- a/Mage.Sets/src/mage/cards/i/ImpelledGiant.java +++ b/Mage.Sets/src/mage/cards/i/ImpelledGiant.java @@ -83,14 +83,14 @@ class ImpelledGiantCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (target.choose(Outcome.Tap, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (target.choose(Outcome.Tap, controllerId, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } - paid |= permanent.tap(game); + paid |= permanent.tap(source, game); for (Effect effect : ability.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent, game)); } @@ -100,8 +100,8 @@ class ImpelledGiantCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/i/ImperialEdict.java b/Mage.Sets/src/mage/cards/i/ImperialEdict.java index 5c18c393236..87cef078168 100644 --- a/Mage.Sets/src/mage/cards/i/ImperialEdict.java +++ b/Mage.Sets/src/mage/cards/i/ImperialEdict.java @@ -67,12 +67,12 @@ class ImperialEdictEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(player.getId())); Target target = new TargetPermanent(1, 1, filter, true); if (target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) { player.chooseTarget(Outcome.DestroyPermanent, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/ImposingSovereign.java b/Mage.Sets/src/mage/cards/i/ImposingSovereign.java index 9a38f667039..b9431f74177 100644 --- a/Mage.Sets/src/mage/cards/i/ImposingSovereign.java +++ b/Mage.Sets/src/mage/cards/i/ImposingSovereign.java @@ -56,7 +56,7 @@ class ImposingSovereignEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { - target.tap(game); + target.tap(source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/i/Imprison.java b/Mage.Sets/src/mage/cards/i/Imprison.java index b507ab20c40..34f280f16f9 100644 --- a/Mage.Sets/src/mage/cards/i/Imprison.java +++ b/Mage.Sets/src/mage/cards/i/Imprison.java @@ -84,7 +84,7 @@ class ImprisonTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATED_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; } @Override @@ -137,7 +137,7 @@ class ImprisonUnblockEffect extends OneShotEffect { if (permanent.isCreature()) { // Tap the creature - permanent.tap(game); + permanent.tap(source, game); // Remove it from combat Effect effect = new RemoveFromCombatTargetEffect(); diff --git a/Mage.Sets/src/mage/cards/i/ImpsMischief.java b/Mage.Sets/src/mage/cards/i/ImpsMischief.java index 79927d322e1..076e6e49bd0 100644 --- a/Mage.Sets/src/mage/cards/i/ImpsMischief.java +++ b/Mage.Sets/src/mage/cards/i/ImpsMischief.java @@ -72,7 +72,7 @@ class ImpsMischiefLoseLifeEffect extends OneShotEffect { if (spell != null) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.loseLife(spell.getConvertedManaCost(), game, false); + player.loseLife(spell.getConvertedManaCost(), game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/i/ImpulsiveWager.java b/Mage.Sets/src/mage/cards/i/ImpulsiveWager.java index 7c2cf13d446..36ba70dd09f 100644 --- a/Mage.Sets/src/mage/cards/i/ImpulsiveWager.java +++ b/Mage.Sets/src/mage/cards/i/ImpulsiveWager.java @@ -68,7 +68,7 @@ class ImpulsiveWagerEffect extends OneShotEffect { effect.setTargetPointer(getTargetPointer()); effect.apply(game, source); } else { - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); } } diff --git a/Mage.Sets/src/mage/cards/i/InTheEyeOfChaos.java b/Mage.Sets/src/mage/cards/i/InTheEyeOfChaos.java index a34160adbc4..311a51371a0 100644 --- a/Mage.Sets/src/mage/cards/i/InTheEyeOfChaos.java +++ b/Mage.Sets/src/mage/cards/i/InTheEyeOfChaos.java @@ -68,8 +68,8 @@ class InTheEyeOfChaosEffect extends OneShotEffect { Player player = game.getPlayer(spell.getControllerId()); if (player != null) { Cost cost = ManaUtil.createManaCost(spell.getConvertedManaCost(), true); - if (!cost.pay(source, game, source.getSourceId(), player.getId(), false)) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + if (!cost.pay(source, game, source, player.getId(), false)) { + game.getStack().counter(spell.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IncendiaryCommand.java b/Mage.Sets/src/mage/cards/i/IncendiaryCommand.java index d5f4a165a05..20a56cd75a7 100644 --- a/Mage.Sets/src/mage/cards/i/IncendiaryCommand.java +++ b/Mage.Sets/src/mage/cards/i/IncendiaryCommand.java @@ -86,7 +86,7 @@ class IncendiaryCommandDrawEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int cardsInHand = player.getHand().size(); - player.discard(cardsInHand, false, source, game); + player.discard(cardsInHand, false, false, source, game); if (cardsInHand > 0) { cardsToDraw.put(playerId, cardsInHand); } @@ -95,7 +95,7 @@ class IncendiaryCommandDrawEffect extends OneShotEffect { for (Map.Entry toDrawByPlayer : cardsToDraw.entrySet()) { Player player = game.getPlayer(toDrawByPlayer.getKey()); if (player != null) { - player.drawCards(toDrawByPlayer.getValue(), source.getSourceId(), game); + player.drawCards(toDrawByPlayer.getValue(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/Incinerate.java b/Mage.Sets/src/mage/cards/i/Incinerate.java index bf0a47ca757..64d2cf3dc18 100644 --- a/Mage.Sets/src/mage/cards/i/Incinerate.java +++ b/Mage.Sets/src/mage/cards/i/Incinerate.java @@ -65,7 +65,7 @@ class IncinerateEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.REGENERATE; + return event.getType() == GameEvent.EventType.REGENERATE; } @Override diff --git a/Mage.Sets/src/mage/cards/i/InciteRebellion.java b/Mage.Sets/src/mage/cards/i/InciteRebellion.java index d62dbd95100..80d57524f11 100644 --- a/Mage.Sets/src/mage/cards/i/InciteRebellion.java +++ b/Mage.Sets/src/mage/cards/i/InciteRebellion.java @@ -63,9 +63,9 @@ class InciteRebellionEffect extends OneShotEffect { if (player != null) { int count = game.getBattlefield().countAll(filter, playerId, game); if (count > 0) { - player.damage(count, source.getSourceId(), game); + player.damage(count, source.getSourceId(), source, game); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) { - permanent.damage(count, source.getSourceId(), game); + permanent.damage(count, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java b/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java index 7a9ccd4a2c8..797ecb5e0dd 100644 --- a/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java +++ b/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java @@ -79,7 +79,7 @@ class IncreasingAmbitionEffect extends SearchEffect { for (UUID cardId: target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/i/IncreasingDevotion.java b/Mage.Sets/src/mage/cards/i/IncreasingDevotion.java index 2c211667979..e8943c32ee5 100644 --- a/Mage.Sets/src/mage/cards/i/IncreasingDevotion.java +++ b/Mage.Sets/src/mage/cards/i/IncreasingDevotion.java @@ -63,7 +63,7 @@ class IncreasingDevotionEffect extends OneShotEffect { if (spell.getFromZone() == Zone.GRAVEYARD) { amount = 10; } - token.putOntoBattlefield(amount, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(amount, game, source, source.getControllerId()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/i/IncubationIncongruity.java b/Mage.Sets/src/mage/cards/i/IncubationIncongruity.java index 18b1348157b..3d035fe3e61 100644 --- a/Mage.Sets/src/mage/cards/i/IncubationIncongruity.java +++ b/Mage.Sets/src/mage/cards/i/IncubationIncongruity.java @@ -77,7 +77,7 @@ class IncongruityEffect extends OneShotEffect { Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); // must use LKI if (permanent != null) { FrogLizardToken token = new FrogLizardToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); + token.putOntoBattlefield(1, game, source, permanent.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IncursionSpecialist.java b/Mage.Sets/src/mage/cards/i/IncursionSpecialist.java index 77df46b955f..07185fe0036 100644 --- a/Mage.Sets/src/mage/cards/i/IncursionSpecialist.java +++ b/Mage.Sets/src/mage/cards/i/IncursionSpecialist.java @@ -63,7 +63,7 @@ class IncursionTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java b/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java index f35e446d981..a6b33a14b7a 100644 --- a/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java +++ b/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java @@ -91,7 +91,7 @@ class IndomitableCreativityEffect extends OneShotEffect { for (UUID targetId : getTargetPointer().getTargets(game, source)) { Permanent target = game.getPermanent(targetId); if (target != null) { - if (target.destroy(source.getSourceId(), game, false)) { + if (target.destroy(source, game, false)) { destroyedPermanents.add(target); } } diff --git a/Mage.Sets/src/mage/cards/i/InduceParanoia.java b/Mage.Sets/src/mage/cards/i/InduceParanoia.java index cf51c005e1e..0f877474371 100644 --- a/Mage.Sets/src/mage/cards/i/InduceParanoia.java +++ b/Mage.Sets/src/mage/cards/i/InduceParanoia.java @@ -66,7 +66,7 @@ class InduceParanoiaEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source)); if (spell != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); int spellCMC = spell.getConvertedManaCost(); Player player = game.getPlayer(spell.getControllerId()); if (player != null) { diff --git a/Mage.Sets/src/mage/cards/i/InducedAmnesia.java b/Mage.Sets/src/mage/cards/i/InducedAmnesia.java index 9f2e5d158b0..da2fcbd670c 100644 --- a/Mage.Sets/src/mage/cards/i/InducedAmnesia.java +++ b/Mage.Sets/src/mage/cards/i/InducedAmnesia.java @@ -72,12 +72,12 @@ class InducedAmnesiaExileEffect extends OneShotEffect { if (numberOfCards > 0) { UUID exileId = CardUtil.getCardExileZoneId(game, source); for (Card card : targetPlayer.getHand().getCards(game)) { - card.moveToExile(exileId, sourcePermanent.getName(), source.getSourceId(), game); + card.moveToExile(exileId, sourcePermanent.getName(), source, game); card.setFaceDown(true, game); } game.informPlayers(sourcePermanent.getLogName() + ": " + targetPlayer.getLogName() + " exiles their hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ? "s" : "") + ')'); game.getState().processAction(game); - targetPlayer.drawCards(numberOfCards, source.getSourceId(), game); + targetPlayer.drawCards(numberOfCards, source, game); } return true; } @@ -112,7 +112,7 @@ class InducedAmnesiaReturnEffect extends OneShotEffect { if (exileZone != null) { for (Card card : exileZone.getCards(game)) { numberOfCards++; - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); card.setFaceDown(false, game); } } diff --git a/Mage.Sets/src/mage/cards/i/IndulgentTormentor.java b/Mage.Sets/src/mage/cards/i/IndulgentTormentor.java index 824bb44abe9..3c07db582c2 100644 --- a/Mage.Sets/src/mage/cards/i/IndulgentTormentor.java +++ b/Mage.Sets/src/mage/cards/i/IndulgentTormentor.java @@ -75,20 +75,20 @@ class IndulgentTormentorEffect extends OneShotEffect { Player opponent = game.getPlayer(source.getFirstTarget()); if (opponent != null) { Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)); - if (cost.canPay(source, source.getSourceId(), opponent.getId(), game) + if (cost.canPay(source, source, opponent.getId(), game) && opponent.chooseUse(outcome, "Sacrifice a creature to prevent the card draw?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { + if (cost.pay(source, game, source, opponent.getId(), false, null)) { return true; } } cost = new PayLifeCost(3); - if (cost.canPay(source, source.getSourceId(), opponent.getId(), game) + if (cost.canPay(source, source, opponent.getId(), game) && opponent.chooseUse(outcome, "Pay 3 life to prevent the card draw?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { + if (cost.pay(source, game, source, opponent.getId(), false, null)) { return true; } } - game.getPlayer(source.getControllerId()).drawCards(1, source.getSourceId(), game); + game.getPlayer(source.getControllerId()).drawCards(1, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/i/InfectiousHorror.java b/Mage.Sets/src/mage/cards/i/InfectiousHorror.java index ab3a4209898..672191ea39b 100644 --- a/Mage.Sets/src/mage/cards/i/InfectiousHorror.java +++ b/Mage.Sets/src/mage/cards/i/InfectiousHorror.java @@ -57,7 +57,7 @@ class InfectiousHorrorEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.loseLife(2, game, false); + opponent.loseLife(2, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/InfernalDarkness.java b/Mage.Sets/src/mage/cards/i/InfernalDarkness.java index eae4f1c6dee..f76e49556a9 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalDarkness.java +++ b/Mage.Sets/src/mage/cards/i/InfernalDarkness.java @@ -67,7 +67,7 @@ class InfernalDarknessCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player == null) { @@ -77,10 +77,10 @@ class InfernalDarknessCost extends CostImpl { paid = false; manaCost.clearPaid(); - if (manaCost.pay(ability, game, player.getId(), player.getId(), false) + if (manaCost.pay(ability, game, source, player.getId(), false) && player.canPayLifeCost(ability) && player.getLife() >= 1 - && lifeCost.pay(ability, game, player.getId(), player.getId(), false)) { + && lifeCost.pay(ability, game, source, player.getId(), false)) { paid = true; } @@ -88,7 +88,7 @@ class InfernalDarknessCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); if (player != null && player.canPayLifeCost(ability) @@ -135,12 +135,12 @@ class InfernalDarknessReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); + MageObject mageObject = game.getPermanentOrLKIBattlefield(event.getSourceId()); return mageObject != null && mageObject.isLand(); } } diff --git a/Mage.Sets/src/mage/cards/i/InfernalDenizen.java b/Mage.Sets/src/mage/cards/i/InfernalDenizen.java index d5005c10b5c..7b1b3574b01 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalDenizen.java +++ b/Mage.Sets/src/mage/cards/i/InfernalDenizen.java @@ -106,10 +106,10 @@ class InfernalDenizenEffect extends OneShotEffect { effect.apply(game, source); if (!canSac) { if (creature != null) { - creature.tap(game); + creature.tap(source, game); } TargetOpponent targetOpp = new TargetOpponent(true); - if (targetOpp.canChoose(player.getId(), game) + if (targetOpp.canChoose(source.getSourceId(), player.getId(), game) && targetOpp.choose(Outcome.Detriment, player.getId(), source.getSourceId(), game)) { Player opponent = game.getPlayer(targetOpp.getFirstTarget()); if (opponent != null) { @@ -117,7 +117,7 @@ class InfernalDenizenEffect extends OneShotEffect { filter2.add(new ControllerIdPredicate(player.getId())); TargetCreaturePermanent targetCreature = new TargetCreaturePermanent(1, 1, filter2, true); targetCreature.setTargetController(opponent.getId()); - if (targetCreature.canChoose(id, game) + if (targetCreature.canChoose(source.getSourceId(), id, game) && opponent.chooseUse(Outcome.GainControl, "Gain control of a creature?", source, game) && opponent.chooseTarget(Outcome.GainControl, targetCreature, source, game)) { ConditionalContinuousEffect giveEffect = new ConditionalContinuousEffect( diff --git a/Mage.Sets/src/mage/cards/i/InfernalGenesis.java b/Mage.Sets/src/mage/cards/i/InfernalGenesis.java index 2fac7913476..98437d4340f 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalGenesis.java +++ b/Mage.Sets/src/mage/cards/i/InfernalGenesis.java @@ -65,7 +65,7 @@ class InfernalGenesisEffect extends OneShotEffect { .mapToInt(MageObject::getConvertedManaCost) .sum(); if (totalCMC > 0) { - token.putOntoBattlefield(totalCMC, game, source.getSourceId(), player.getId()); + token.putOntoBattlefield(totalCMC, game, source, player.getId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/InfernalHarvest.java b/Mage.Sets/src/mage/cards/i/InfernalHarvest.java index 74f128ab3ef..2e46cd95214 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalHarvest.java +++ b/Mage.Sets/src/mage/cards/i/InfernalHarvest.java @@ -95,17 +95,17 @@ class InfernalHarvestVariableCost extends VariableCostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return game.getBattlefield().countAll(filter, controllerId, game) >= xValue; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (!this.canPay(ability, sourceId, controllerId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (!this.canPay(ability, source, controllerId, game)) { return false; } Player player = game.getPlayer(controllerId); - if (player == null || !targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { + if (player == null || !targets.choose(Outcome.ReturnToHand, controllerId, source.getSourceId(), game)) { return false; } return paid = player.moveCards( diff --git a/Mage.Sets/src/mage/cards/i/InfernalKirin.java b/Mage.Sets/src/mage/cards/i/InfernalKirin.java index eedc3483ba4..a2c770de072 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalKirin.java +++ b/Mage.Sets/src/mage/cards/i/InfernalKirin.java @@ -89,7 +89,7 @@ class InfernalKirinEffect extends OneShotEffect { targetPlayer.revealCards(source, targetPlayer.getHand(), game); Cards cards = targetPlayer.getHand().copy(); cards.removeIf(uuid -> game.getCard(uuid).getConvertedManaCost() != cmc); - targetPlayer.discard(cards, source, game); + targetPlayer.discard(cards, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/i/InfernalOffering.java b/Mage.Sets/src/mage/cards/i/InfernalOffering.java index 3a829371a8d..b15c7aef5ab 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalOffering.java +++ b/Mage.Sets/src/mage/cards/i/InfernalOffering.java @@ -90,7 +90,7 @@ class InfernalOfferingSacrificeEffect extends OneShotEffect { for (Entry entry : toSacrifice.entrySet()) { Permanent permanent = game.getPermanent(entry.getValue()); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { toDraw.add(entry.getKey()); } } @@ -99,7 +99,7 @@ class InfernalOfferingSacrificeEffect extends OneShotEffect { for (UUID playerId : toDraw) { Player playerToDraw = game.getPlayer(playerId); if (playerToDraw != null) { - playerToDraw.drawCards(2, source.getSourceId(), game); + playerToDraw.drawCards(2, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/InfernalReckoning.java b/Mage.Sets/src/mage/cards/i/InfernalReckoning.java index b7c90635ba5..982e969a5a5 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalReckoning.java +++ b/Mage.Sets/src/mage/cards/i/InfernalReckoning.java @@ -68,7 +68,7 @@ class InfernalJudgmentEffect extends OneShotEffect { return false; } int creaturePower = permanent.getPower().getValue(); - permanent.moveToExile(null, null, source.getSourceId(), game); + permanent.moveToExile(null, null, source, game); game.getState().processAction(game); player.gainLife(creaturePower, game, source); return true; diff --git a/Mage.Sets/src/mage/cards/i/InfernalSpawnOfEvil.java b/Mage.Sets/src/mage/cards/i/InfernalSpawnOfEvil.java index c346be1d1a0..5e1f7a9c33d 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalSpawnOfEvil.java +++ b/Mage.Sets/src/mage/cards/i/InfernalSpawnOfEvil.java @@ -83,12 +83,12 @@ class SayCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller == null) { return false; diff --git a/Mage.Sets/src/mage/cards/i/InfiltrationLens.java b/Mage.Sets/src/mage/cards/i/InfiltrationLens.java index 5b7456216ee..069f11b5134 100644 --- a/Mage.Sets/src/mage/cards/i/InfiltrationLens.java +++ b/Mage.Sets/src/mage/cards/i/InfiltrationLens.java @@ -57,7 +57,7 @@ class EquippedBecomesBlockedTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/i/InfiniteAuthority.java b/Mage.Sets/src/mage/cards/i/InfiniteAuthority.java index b5155d9a87c..81169f1d14c 100644 --- a/Mage.Sets/src/mage/cards/i/InfiniteAuthority.java +++ b/Mage.Sets/src/mage/cards/i/InfiniteAuthority.java @@ -129,7 +129,7 @@ class InfiniteAuthorityEffect extends OneShotEffect { if (enchantedCreature != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance())); delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(enchantedCreature, game)); game.addDelayedTriggeredAbility(delayedAbility, source); diff --git a/Mage.Sets/src/mage/cards/i/Inhumaniac.java b/Mage.Sets/src/mage/cards/i/Inhumaniac.java index e7ae91e038c..439d088c486 100644 --- a/Mage.Sets/src/mage/cards/i/Inhumaniac.java +++ b/Mage.Sets/src/mage/cards/i/Inhumaniac.java @@ -64,7 +64,7 @@ class InhumaniacEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); if (amount >= 3 && amount <= 4) { permanent.addCounters(CounterType.P1P1.createInstance(1), source, game); } else if (amount >= 5) { @@ -72,7 +72,7 @@ class InhumaniacEffect extends OneShotEffect { } else if (amount == 1) { int numToRemove = permanent.getCounters(game).getCount(CounterType.P1P1); if (numToRemove > 0) { - permanent.removeCounters(CounterType.P1P1.getName(), numToRemove, game); + permanent.removeCounters(CounterType.P1P1.getName(), numToRemove, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java b/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java index b4203df87c0..be119b355f7 100644 --- a/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java +++ b/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java @@ -66,7 +66,7 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/i/InnerStruggle.java b/Mage.Sets/src/mage/cards/i/InnerStruggle.java index 153ea93a5da..a66b0aa7eac 100644 --- a/Mage.Sets/src/mage/cards/i/InnerStruggle.java +++ b/Mage.Sets/src/mage/cards/i/InnerStruggle.java @@ -60,7 +60,7 @@ class InnerStruggleEffect extends OneShotEffect { if (controller != null) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game, false, true); + targetCreature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/Inquisition.java b/Mage.Sets/src/mage/cards/i/Inquisition.java index 1e697e6908d..88bdce6b71b 100644 --- a/Mage.Sets/src/mage/cards/i/Inquisition.java +++ b/Mage.Sets/src/mage/cards/i/Inquisition.java @@ -72,7 +72,7 @@ class InquisitionEffect extends OneShotEffect { } } if (cardsFound > 0) { - targetPlayer.damage(cardsFound, source.getSourceId(), game); + targetPlayer.damage(cardsFound, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/InquisitorsSnare.java b/Mage.Sets/src/mage/cards/i/InquisitorsSnare.java index 2b0526e4f59..86c1669cfe0 100644 --- a/Mage.Sets/src/mage/cards/i/InquisitorsSnare.java +++ b/Mage.Sets/src/mage/cards/i/InquisitorsSnare.java @@ -69,7 +69,7 @@ class InquisitorsSnareEffect extends OneShotEffect { filter.add(new PermanentIdPredicate(targetCreature.getId())); game.addEffect(new PreventAllDamageByAllPermanentsEffect(filter, Duration.EndOfTurn, false), source); if (targetCreature.getColor(game).isBlack() || targetCreature.getColor(game).isRed()) { - return targetCreature.destroy(source.getSourceId(), game, false); + return targetCreature.destroy(source, game, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java b/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java index 8553533dedc..e15116f9871 100644 --- a/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java +++ b/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java @@ -81,8 +81,8 @@ class InscriptionOfInsightEffect extends OneShotEffect { return false; } - return new CustomIllusionToken(player.getHand().size()).putOntoBattlefield( - 1, game, source.getSourceId(), source.getFirstTarget() + return new CustomIllusionToken(player.getHand().size()) + .putOntoBattlefield(1, game, source, source.getFirstTarget() ); } } diff --git a/Mage.Sets/src/mage/cards/i/InsidiousDreams.java b/Mage.Sets/src/mage/cards/i/InsidiousDreams.java index bdd0e664000..0248b670dc9 100644 --- a/Mage.Sets/src/mage/cards/i/InsidiousDreams.java +++ b/Mage.Sets/src/mage/cards/i/InsidiousDreams.java @@ -92,7 +92,7 @@ class InsidiousDreamsEffect extends OneShotEffect { Card card = chosen.get(targetToLib.getFirstTarget(), game); if (card != null) { chosen.remove(card); - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, true, false); } targetToLib.clearChosen(); @@ -100,7 +100,7 @@ class InsidiousDreamsEffect extends OneShotEffect { if (chosen.size() == 1) { Card card = chosen.get(chosen.iterator().next(), game); - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, true, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/i/InspiredUltimatum.java b/Mage.Sets/src/mage/cards/i/InspiredUltimatum.java index d49fbd5cb23..832a6d74d0d 100644 --- a/Mage.Sets/src/mage/cards/i/InspiredUltimatum.java +++ b/Mage.Sets/src/mage/cards/i/InspiredUltimatum.java @@ -61,11 +61,11 @@ class InspiredUltimatumEffect extends OneShotEffect { } game.damagePlayerOrPlaneswalker( source.getTargets().get(1).getFirstTarget(), 5, - source.getSourceId(), game, false, true + source.getSourceId(), source, game, false, true ); player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(5, source.getSourceId(), game); + player.drawCards(5, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/InsultInjury.java b/Mage.Sets/src/mage/cards/i/InsultInjury.java index 3ae41e1abf5..0808f17d014 100644 --- a/Mage.Sets/src/mage/cards/i/InsultInjury.java +++ b/Mage.Sets/src/mage/cards/i/InsultInjury.java @@ -111,11 +111,11 @@ class InjuryEffect extends OneShotEffect { Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); } if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/i/IntellectualOffering.java b/Mage.Sets/src/mage/cards/i/IntellectualOffering.java index a97e9376458..9ddc11686ef 100644 --- a/Mage.Sets/src/mage/cards/i/IntellectualOffering.java +++ b/Mage.Sets/src/mage/cards/i/IntellectualOffering.java @@ -64,10 +64,10 @@ class IntellectualOfferingDrawEffect extends OneShotEffect { if (player != null) { Target target = new TargetOpponent(true); target.choose(Outcome.DrawCard, source.getControllerId(), source.getSourceId(), game); - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); Player opponent = game.getPlayer(target.getFirstTarget()); if (opponent != null) { - opponent.drawCards(3, source.getSourceId(), game); + opponent.drawCards(3, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/i/Interdict.java b/Mage.Sets/src/mage/cards/i/Interdict.java index 6f81bc53b50..604902e13d4 100644 --- a/Mage.Sets/src/mage/cards/i/Interdict.java +++ b/Mage.Sets/src/mage/cards/i/Interdict.java @@ -93,7 +93,7 @@ class InterdictCounterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget()); - if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) { + if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source, game)) { Permanent sourcePermanent = stackObject.getStackAbility().getSourcePermanentIfItStillExists(game); if (sourcePermanent != null) { InterdictCantActivateEffect effect = new InterdictCantActivateEffect(); diff --git a/Mage.Sets/src/mage/cards/i/InterpretTheSigns.java b/Mage.Sets/src/mage/cards/i/InterpretTheSigns.java index 92d716a6a3c..f36a1bb94b4 100644 --- a/Mage.Sets/src/mage/cards/i/InterpretTheSigns.java +++ b/Mage.Sets/src/mage/cards/i/InterpretTheSigns.java @@ -63,7 +63,7 @@ class InterpretTheSignsEffect extends OneShotEffect { return true; } controller.revealCards(source, new CardsImpl(card), game); - controller.drawCards(card.getConvertedManaCost(), source.getSourceId(), game); + controller.drawCards(card.getConvertedManaCost(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/i/Interrogation.java b/Mage.Sets/src/mage/cards/i/Interrogation.java index 0d74de0131e..6d9c59b9f0f 100644 --- a/Mage.Sets/src/mage/cards/i/Interrogation.java +++ b/Mage.Sets/src/mage/cards/i/Interrogation.java @@ -61,10 +61,10 @@ class InterrogationEffect extends OneShotEffect { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { Cost cost = new PayLifeCost(3); - if (!cost.canPay(source, source.getSourceId(), player.getId(), game) + if (!cost.canPay(source, source, player.getId(), game) || !player.chooseUse(Outcome.LoseLife, "Pay 3 life?", source, game) - || !cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { - player.discardOne(false, source, game); + || !cost.pay(source, game, source, player.getId(), false, null)) { + player.discardOne(false, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IntoTheMawOfHell.java b/Mage.Sets/src/mage/cards/i/IntoTheMawOfHell.java index a52d7d6a55b..ab86849348c 100644 --- a/Mage.Sets/src/mage/cards/i/IntoTheMawOfHell.java +++ b/Mage.Sets/src/mage/cards/i/IntoTheMawOfHell.java @@ -61,7 +61,7 @@ class IntoTheMawOfHellEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.damage(13, source.getSourceId(), game, false, true); + permanent.damage(13, source.getSourceId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/i/InvaderParasite.java b/Mage.Sets/src/mage/cards/i/InvaderParasite.java index ae7b192b738..740836d33f2 100644 --- a/Mage.Sets/src/mage/cards/i/InvaderParasite.java +++ b/Mage.Sets/src/mage/cards/i/InvaderParasite.java @@ -70,7 +70,7 @@ class InvaderParasiteImprintEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); if (sourcePermanent != null && targetPermanent != null) { - targetPermanent.moveToExile(getId(), "Invader Parasite (Imprint)", source.getSourceId(), game); + targetPermanent.moveToExile(getId(), "Invader Parasite (Imprint)", source, game); sourcePermanent.imprint(targetPermanent.getId(), game); } return true; @@ -99,7 +99,7 @@ class InvaderParasiteTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/i/InvasionPlans.java b/Mage.Sets/src/mage/cards/i/InvasionPlans.java index 4c7682aec5f..2acaf846912 100644 --- a/Mage.Sets/src/mage/cards/i/InvasionPlans.java +++ b/Mage.Sets/src/mage/cards/i/InvasionPlans.java @@ -71,7 +71,7 @@ class InvasionPlansEffect extends ContinuousRuleModifyingEffectImpl { if (blockController != null) { // temporary workaround for AI bugging out while choosing blockers if (blockController.isHuman()) { - game.getCombat().selectBlockers(blockController, game); + game.getCombat().selectBlockers(blockController, source, game); return event.getPlayerId().equals(game.getCombat().getAttackingPlayerId()); } } diff --git a/Mage.Sets/src/mage/cards/i/InvasiveSurgery.java b/Mage.Sets/src/mage/cards/i/InvasiveSurgery.java index 5c2db995f5c..2db9ec149f1 100644 --- a/Mage.Sets/src/mage/cards/i/InvasiveSurgery.java +++ b/Mage.Sets/src/mage/cards/i/InvasiveSurgery.java @@ -81,7 +81,7 @@ class InvasiveSurgeryEffect extends SearchTargetGraveyardHandLibraryForCardNameA cardName = targetObject.getName(); } spellController = stackObject.getControllerId(); - game.getStack().counter(objectId, source.getSourceId(), game); + game.getStack().counter(objectId, source, game); } } diff --git a/Mage.Sets/src/mage/cards/i/InventorsFair.java b/Mage.Sets/src/mage/cards/i/InventorsFair.java index 502f184803b..57305753a2d 100644 --- a/Mage.Sets/src/mage/cards/i/InventorsFair.java +++ b/Mage.Sets/src/mage/cards/i/InventorsFair.java @@ -87,7 +87,7 @@ class InventorsFairAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/i/InverterOfTruth.java b/Mage.Sets/src/mage/cards/i/InverterOfTruth.java index f0d37e555d7..21b609b7113 100644 --- a/Mage.Sets/src/mage/cards/i/InverterOfTruth.java +++ b/Mage.Sets/src/mage/cards/i/InverterOfTruth.java @@ -69,12 +69,12 @@ class ExileLibraryEffect extends OneShotEffect { int count = controller.getLibrary().size(); if (count > 0) { for (Card cardToExile: controller.getLibrary().getCards(game)) { - cardToExile.moveToExile(null, "", source.getSourceId(), game); + cardToExile.moveToExile(null, "", source, game); cardToExile.setFaceDown(true, game); } } for (Card cardToLibrary: controller.getGraveyard().getCards(game)) { - controller.moveCardToLibraryWithInfo(cardToLibrary, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(cardToLibrary, source, game, Zone.GRAVEYARD, true, true); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/i/InvincibleHymn.java b/Mage.Sets/src/mage/cards/i/InvincibleHymn.java index fa090fbac4f..c7f4465f15a 100644 --- a/Mage.Sets/src/mage/cards/i/InvincibleHymn.java +++ b/Mage.Sets/src/mage/cards/i/InvincibleHymn.java @@ -62,7 +62,7 @@ class InvincibleHymnEffect extends OneShotEffect { player.gainLife(newValue - oldValue, game, source); } if (oldValue - newValue > 0) { - player.loseLife(oldValue - newValue, game, false); + player.loseLife(oldValue - newValue, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/InvokePrejudice.java b/Mage.Sets/src/mage/cards/i/InvokePrejudice.java index 16ce09aa5aa..1a4e48da63f 100644 --- a/Mage.Sets/src/mage/cards/i/InvokePrejudice.java +++ b/Mage.Sets/src/mage/cards/i/InvokePrejudice.java @@ -60,7 +60,7 @@ class InvokePrejudiceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/i/Ionize.java b/Mage.Sets/src/mage/cards/i/Ionize.java index 15bd2d88dde..5f33dd3c0ed 100644 --- a/Mage.Sets/src/mage/cards/i/Ionize.java +++ b/Mage.Sets/src/mage/cards/i/Ionize.java @@ -60,9 +60,9 @@ class IonizeEffect extends OneShotEffect { if (spell != null) { Player spellController = game.getPlayer(spell.getControllerId()); - result = game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + result = game.getStack().counter(source.getFirstTarget(), source, game); if (spellController != null) { - spellController.damage(2, source.getSourceId(), game); + spellController.damage(2, source.getSourceId(), source, game); } } return result; diff --git a/Mage.Sets/src/mage/cards/i/IridescentDrake.java b/Mage.Sets/src/mage/cards/i/IridescentDrake.java index f817337242d..139eed9a418 100644 --- a/Mage.Sets/src/mage/cards/i/IridescentDrake.java +++ b/Mage.Sets/src/mage/cards/i/IridescentDrake.java @@ -90,7 +90,7 @@ class IridescentDrakeEffect extends OneShotEffect { if (target != null) { game.getState().setValue("attachTo:" + targetAuraCard.getId(), permanent); controller.moveCards(targetAuraCard, Zone.BATTLEFIELD, source, game); - return permanent.addAttachment(targetAuraCard.getId(), game); + return permanent.addAttachment(targetAuraCard.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/i/IronMaiden.java b/Mage.Sets/src/mage/cards/i/IronMaiden.java index bd65d71d5b8..b493919fc02 100644 --- a/Mage.Sets/src/mage/cards/i/IronMaiden.java +++ b/Mage.Sets/src/mage/cards/i/IronMaiden.java @@ -54,7 +54,7 @@ class IronMaidenEffect extends OneShotEffect { if (player != null) { int amount = player.getHand().size() - 4; if (amount > 0) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/i/IronStar.java b/Mage.Sets/src/mage/cards/i/IronStar.java index 6c75f3ea55b..a4499908764 100644 --- a/Mage.Sets/src/mage/cards/i/IronStar.java +++ b/Mage.Sets/src/mage/cards/i/IronStar.java @@ -55,7 +55,7 @@ class IronStarAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/i/IsarethTheAwakener.java b/Mage.Sets/src/mage/cards/i/IsarethTheAwakener.java index ced07404f12..d6b45bece8f 100644 --- a/Mage.Sets/src/mage/cards/i/IsarethTheAwakener.java +++ b/Mage.Sets/src/mage/cards/i/IsarethTheAwakener.java @@ -89,7 +89,7 @@ class IsarethTheAwakenerCreateReflexiveTriggerEffect extends OneShotEffect { } int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (!cost.pay(source, game, source, source.getControllerId(), false, null)) { return false; } ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/i/IsolationCell.java b/Mage.Sets/src/mage/cards/i/IsolationCell.java index 0dd7e6e0e8e..f11981ca196 100644 --- a/Mage.Sets/src/mage/cards/i/IsolationCell.java +++ b/Mage.Sets/src/mage/cards/i/IsolationCell.java @@ -100,8 +100,8 @@ class IsolationCellEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { Cost cost = ManaUtil.createManaCost(2, false); - if (!cost.pay(source, game, player.getId(), player.getId(), false)) { - player.loseLife(2, game, false); + if (!cost.pay(source, game, source, player.getId(), false)) { + player.loseLife(2, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IvoryCup.java b/Mage.Sets/src/mage/cards/i/IvoryCup.java index 3021df83b7a..8e6de987141 100644 --- a/Mage.Sets/src/mage/cards/i/IvoryCup.java +++ b/Mage.Sets/src/mage/cards/i/IvoryCup.java @@ -55,7 +55,7 @@ class IvoryCupAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/i/IvySeer.java b/Mage.Sets/src/mage/cards/i/IvySeer.java index 0ac2d1288b1..b8fa94cbdff 100644 --- a/Mage.Sets/src/mage/cards/i/IvySeer.java +++ b/Mage.Sets/src/mage/cards/i/IvySeer.java @@ -79,7 +79,7 @@ class IvySeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/i/IzzetKeyrune.java b/Mage.Sets/src/mage/cards/i/IzzetKeyrune.java index 028df9bfd5c..52e65579160 100644 --- a/Mage.Sets/src/mage/cards/i/IzzetKeyrune.java +++ b/Mage.Sets/src/mage/cards/i/IzzetKeyrune.java @@ -70,8 +70,8 @@ public final class IzzetKeyrune extends CardImpl { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.chooseUse(Outcome.DrawCard, "Do you wish to draw a card? If you do, discard a card.", source, game)) { - if (player.drawCards(1, source.getSourceId(), game) > 0) { - player.discard(1, false, source, game); + if (player.drawCards(1, source, game) > 0) { + player.discard(1, false, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IzzetStaticaster.java b/Mage.Sets/src/mage/cards/i/IzzetStaticaster.java index 84f9257a7fa..7b208c135ba 100644 --- a/Mage.Sets/src/mage/cards/i/IzzetStaticaster.java +++ b/Mage.Sets/src/mage/cards/i/IzzetStaticaster.java @@ -85,7 +85,7 @@ class IzzetStaticasterDamageEffect extends OneShotEffect { filter.add(new NamePredicate(targetPermanent.getName())); } for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.damage(1, source.getSourceId(), game, false, true); + permanent.damage(1, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java b/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java index ee213e36829..fefd16760ae 100644 --- a/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java +++ b/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java @@ -106,7 +106,7 @@ class JaceArchitectOfThoughtDelayedTriggeredAbility extends DelayedTriggeredAbil @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/j/JaceMemoryAdept.java b/Mage.Sets/src/mage/cards/j/JaceMemoryAdept.java index ffc521f1a4d..7ab80933413 100644 --- a/Mage.Sets/src/mage/cards/j/JaceMemoryAdept.java +++ b/Mage.Sets/src/mage/cards/j/JaceMemoryAdept.java @@ -73,7 +73,7 @@ class JaceMemoryAdeptEffect extends DrawCardTargetEffect { for (UUID target : targetPointer.getTargets(game, source)) { Player player = game.getPlayer(target); if (player != null) { - player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game); + player.drawCards(amount.calculate(game, source, this), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java b/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java index d5cf845b87b..7d2bacda1d3 100644 --- a/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java +++ b/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java @@ -120,7 +120,7 @@ class JaceMirrorMageDrawEffect extends OneShotEffect { // Gatherer ruling (2007-02-01) // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, // even if the draw is replaced by another draw (such as with Enduring Renewal). - if (controller.drawCards(1, source.getSourceId(), game) != 1) { + if (controller.drawCards(1, source, game) != 1) { return true; } controller.revealCards(source, new CardsImpl(card), game); @@ -131,7 +131,7 @@ class JaceMirrorMageDrawEffect extends OneShotEffect { if (permanent == null) { return true; } - permanent.removeCounters(CounterType.LOYALTY.createInstance(card.getConvertedManaCost()), game); + permanent.removeCounters(CounterType.LOYALTY.createInstance(card.getConvertedManaCost()), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/j/JaceTheMindSculptor.java b/Mage.Sets/src/mage/cards/j/JaceTheMindSculptor.java index 0476ec9d8a2..73d5e2848d2 100644 --- a/Mage.Sets/src/mage/cards/j/JaceTheMindSculptor.java +++ b/Mage.Sets/src/mage/cards/j/JaceTheMindSculptor.java @@ -93,7 +93,7 @@ class JaceTheMindSculptorEffect1 extends OneShotEffect { Cards cards = new CardsImpl(card); controller.lookAtCards("Jace, the Mind Sculptor", cards, game); if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", source, game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, false, false); } else { game.informPlayers(controller.getLogName() + " puts the card back on top of the library."); } diff --git a/Mage.Sets/src/mage/cards/j/JaceWielderOfMysteries.java b/Mage.Sets/src/mage/cards/j/JaceWielderOfMysteries.java index ddfcc1a16eb..dcb6ec7f37a 100644 --- a/Mage.Sets/src/mage/cards/j/JaceWielderOfMysteries.java +++ b/Mage.Sets/src/mage/cards/j/JaceWielderOfMysteries.java @@ -127,7 +127,7 @@ class JaceWielderOfMysteriesEffect extends OneShotEffect { if (player == null) { return false; } - player.drawCards(7, source.getSourceId(), game); + player.drawCards(7, source, game); if (!player.getLibrary().hasCards()) { player.won(game); } diff --git a/Mage.Sets/src/mage/cards/j/JacesArchivist.java b/Mage.Sets/src/mage/cards/j/JacesArchivist.java index 3cb16b5b21e..6930aec6b19 100644 --- a/Mage.Sets/src/mage/cards/j/JacesArchivist.java +++ b/Mage.Sets/src/mage/cards/j/JacesArchivist.java @@ -67,7 +67,7 @@ class JacesArchivistEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - Cards discardedCards = player.discard(player.getHand().size(), false, source, game); + Cards discardedCards = player.discard(player.getHand().size(), false, false, source, game); if (discardedCards.size() > maxDiscarded) { maxDiscarded = discardedCards.size(); } @@ -77,7 +77,7 @@ class JacesArchivistEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(maxDiscarded, source.getSourceId(), game); + player.drawCards(maxDiscarded, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/j/JacesDefeat.java b/Mage.Sets/src/mage/cards/j/JacesDefeat.java index 0d0d142f958..d1a677e228d 100644 --- a/Mage.Sets/src/mage/cards/j/JacesDefeat.java +++ b/Mage.Sets/src/mage/cards/j/JacesDefeat.java @@ -78,7 +78,7 @@ class JacesDefeatEffect extends OneShotEffect { for (UUID targetId : getTargetPointer().getTargets(game, source) ) { Spell spell = game.getStack().getSpell(targetId); if (spell != null) { - game.getStack().counter(targetId, source.getSourceId(), game); + game.getStack().counter(targetId, source, game); Player controller = game.getPlayer(source.getControllerId()); // If it was a Jace planeswalker, you may discard a card. If you do, draw a card if (filter.match(spell, game) && controller != null) { diff --git a/Mage.Sets/src/mage/cards/j/JackInTheMox.java b/Mage.Sets/src/mage/cards/j/JackInTheMox.java index bc34977b972..37d14cc0a83 100644 --- a/Mage.Sets/src/mage/cards/j/JackInTheMox.java +++ b/Mage.Sets/src/mage/cards/j/JackInTheMox.java @@ -77,11 +77,11 @@ class JackInTheMoxManaEffect extends ManaEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); switch (amount) { case 1: - permanent.sacrifice(source.getSourceId(), game); - controller.loseLife(5, game, false); + permanent.sacrifice(source, game); + controller.loseLife(5, game, source, false); break; case 2: mana.add(Mana.WhiteMana(1)); diff --git a/Mage.Sets/src/mage/cards/j/JackalPup.java b/Mage.Sets/src/mage/cards/j/JackalPup.java index 80b501499e3..306dd249939 100644 --- a/Mage.Sets/src/mage/cards/j/JackalPup.java +++ b/Mage.Sets/src/mage/cards/j/JackalPup.java @@ -61,7 +61,7 @@ class JackalPupEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { - you.damage((Integer) this.getValue("damage"), source.getSourceId(), game); + you.damage((Integer) this.getValue("damage"), source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/j/JaddiLifestrider.java b/Mage.Sets/src/mage/cards/j/JaddiLifestrider.java index 6c38cd8e8c6..1faae99c524 100644 --- a/Mage.Sets/src/mage/cards/j/JaddiLifestrider.java +++ b/Mage.Sets/src/mage/cards/j/JaddiLifestrider.java @@ -69,11 +69,11 @@ class JaddiLifestriderEffect extends OneShotEffect { int tappedAmount = 0; Player you = game.getPlayer(source.getControllerId()); TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { for (UUID creatureId : target.getTargets()) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { - creature.tap(game); + creature.tap(source, game); tappedAmount++; } } diff --git a/Mage.Sets/src/mage/cards/j/JadeMonolith.java b/Mage.Sets/src/mage/cards/j/JadeMonolith.java index 91cec8c1ba7..c2aa1b33da1 100644 --- a/Mage.Sets/src/mage/cards/j/JadeMonolith.java +++ b/Mage.Sets/src/mage/cards/j/JadeMonolith.java @@ -80,7 +80,7 @@ class JadeMonolithRedirectionEffect extends ReplacementEffectImpl { MageObject sourceObject = game.getObject(source.getSourceId()); DamageEvent damageEvent = (DamageEvent) event; if (controller != null && targetCreature != null && sourceObject != null) { - controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); StringBuilder sb = new StringBuilder(sourceObject.getLogName()); sb.append(": ").append(damageEvent.getAmount()).append(" damage redirected from ").append(targetCreature.getLogName()); sb.append(" to ").append(controller.getLogName()); @@ -93,7 +93,7 @@ class JadeMonolithRedirectionEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/j/JadedResponse.java b/Mage.Sets/src/mage/cards/j/JadedResponse.java index 9f35fb200ab..8094cf9e565 100644 --- a/Mage.Sets/src/mage/cards/j/JadedResponse.java +++ b/Mage.Sets/src/mage/cards/j/JadedResponse.java @@ -64,6 +64,6 @@ class JadedResponseEffect extends OneShotEffect { ).stream() .map(permanent -> permanent.getColor(game)) .anyMatch(stackObject.getColor(game)::shares); - return matches && game.getStack().counter(stackObject.getId(), source.getSourceId(), game); + return matches && game.getStack().counter(stackObject.getId(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/j/JaggedPoppet.java b/Mage.Sets/src/mage/cards/j/JaggedPoppet.java index 680247f1537..b0f662e02f3 100644 --- a/Mage.Sets/src/mage/cards/j/JaggedPoppet.java +++ b/Mage.Sets/src/mage/cards/j/JaggedPoppet.java @@ -76,7 +76,7 @@ class JaggedPoppetDealsDamageEffect extends OneShotEffect { if (amount > 0) { //Call the player discard function discarding cards equal to damage - player.discard(amount, false, source, game); + player.discard(amount, false, false, source, game); } return true; } @@ -111,7 +111,7 @@ class JaggedPoppetDealtDamageEffect extends OneShotEffect { if (amount > 0) { //Call the player discard function discarding cards equal to damage - player.discard(amount, false, source, game); + player.discard(amount, false, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/j/JalumGrifter.java b/Mage.Sets/src/mage/cards/j/JalumGrifter.java index 170fcb2cd06..c1ba9277671 100644 --- a/Mage.Sets/src/mage/cards/j/JalumGrifter.java +++ b/Mage.Sets/src/mage/cards/j/JalumGrifter.java @@ -95,7 +95,7 @@ class JalumGrifterEffect extends OneShotEffect { Target target = new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent(), true); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } @@ -125,12 +125,12 @@ class JalumGrifterEffect extends OneShotEffect { if (card.getId().equals(sourceCard.getId())) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - sourcePermanent.sacrifice(source.getSourceId(), game); + sourcePermanent.sacrifice(source, game); } } else { Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/j/JandorsRing.java b/Mage.Sets/src/mage/cards/j/JandorsRing.java index 13bfcd8a202..610402cc4b9 100644 --- a/Mage.Sets/src/mage/cards/j/JandorsRing.java +++ b/Mage.Sets/src/mage/cards/j/JandorsRing.java @@ -81,7 +81,7 @@ class JandorsRingEffect extends OneShotEffect { if (effect.apply(game, source)) {//Conditional was already checked, card should be in hand, but if for some weird reason it fails, the card won't be drawn, although the cost will already be paid Player controller = game.getPlayer(source.getControllerId()); if(controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/j/JangoFett.java b/Mage.Sets/src/mage/cards/j/JangoFett.java index aee28b4d525..f449f365c8a 100644 --- a/Mage.Sets/src/mage/cards/j/JangoFett.java +++ b/Mage.Sets/src/mage/cards/j/JangoFett.java @@ -81,7 +81,7 @@ class JangoFettTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/j/JarJarBinks.java b/Mage.Sets/src/mage/cards/j/JarJarBinks.java index d9fb62510e6..e6c942989ef 100644 --- a/Mage.Sets/src/mage/cards/j/JarJarBinks.java +++ b/Mage.Sets/src/mage/cards/j/JarJarBinks.java @@ -109,7 +109,7 @@ class JarJarBinksGainControlSourceEffect extends ContinuousEffectImpl { UUID targetOpponent = getTargetPointer().getFirst(game, source); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && targetOpponent != null) { - permanent.changeControllerId(targetOpponent, game); + permanent.changeControllerId(targetOpponent, game, source); } else { // no valid target exists, effect can be discarded discard(); @@ -164,7 +164,7 @@ class JarJarBinksTapEffect extends OneShotEffect { } if (permanentToTap != null) { game.informPlayers(sourcePermanent.getName() + " chosen creature: " + permanentToTap.getName()); - return permanentToTap.tap(game); + return permanentToTap.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/j/JasmineSeer.java b/Mage.Sets/src/mage/cards/j/JasmineSeer.java index ac55a63b3f6..bfb3e33b958 100644 --- a/Mage.Sets/src/mage/cards/j/JasmineSeer.java +++ b/Mage.Sets/src/mage/cards/j/JasmineSeer.java @@ -76,7 +76,7 @@ class JasmineSeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/j/JayaBallard.java b/Mage.Sets/src/mage/cards/j/JayaBallard.java index 6b0e37e0755..a54ba31460e 100644 --- a/Mage.Sets/src/mage/cards/j/JayaBallard.java +++ b/Mage.Sets/src/mage/cards/j/JayaBallard.java @@ -80,8 +80,8 @@ class JayaBallardDiscardDrawEffect extends OneShotEffect { } TargetDiscard target = new TargetDiscard(0, 3, new FilterCard(), controller.getId()); target.choose(outcome, controller.getId(), source.getSourceId(), game); - int count = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); - controller.drawCards(count, source.getSourceId(), game); + int count = controller.discard(new CardsImpl(target.getTargets()), false, source, game).size(); + controller.drawCards(count, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java b/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java index 7fb9ad232ca..28b2a8527d5 100644 --- a/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java +++ b/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java @@ -102,7 +102,7 @@ class CantRegenerateEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.REGENERATE) { + if (event.getType() == GameEvent.EventType.REGENERATE) { DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId()); if (watcher != null) { return watcher.wasDamaged(event.getTargetId(), game); diff --git a/Mage.Sets/src/mage/cards/j/JediTraining.java b/Mage.Sets/src/mage/cards/j/JediTraining.java index 7541618dcf0..90efa00bbb8 100644 --- a/Mage.Sets/src/mage/cards/j/JediTraining.java +++ b/Mage.Sets/src/mage/cards/j/JediTraining.java @@ -67,7 +67,7 @@ class JediTrainingTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.MEDITATED; + return event.getType() == GameEvent.EventType.MEDITATED; } @Override diff --git a/Mage.Sets/src/mage/cards/j/JestersCap.java b/Mage.Sets/src/mage/cards/j/JestersCap.java index 3a7c5223fb8..c1a7afa4202 100644 --- a/Mage.Sets/src/mage/cards/j/JestersCap.java +++ b/Mage.Sets/src/mage/cards/j/JestersCap.java @@ -74,7 +74,7 @@ class JestersCapEffect extends OneShotEffect { for (UUID cardId : target.getTargets()) { final Card targetCard = game.getCard(cardId); if (targetCard != null) { - applied |= player.moveCardToExileWithInfo(targetCard, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + applied |= player.moveCardToExileWithInfo(targetCard, null, null, source, game, Zone.LIBRARY, true); } } targetPlayer.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/j/JestersScepter.java b/Mage.Sets/src/mage/cards/j/JestersScepter.java index e476ccee0ac..b766d920843 100644 --- a/Mage.Sets/src/mage/cards/j/JestersScepter.java +++ b/Mage.Sets/src/mage/cards/j/JestersScepter.java @@ -83,7 +83,7 @@ class JestersScepterEffect extends OneShotEffect { if (targetedPlayer.getLibrary().hasCards()) { Set cardsToExile = targetedPlayer.getLibrary().getTopCards(game, 5); for (Card card : cardsToExile) { - if (card.moveToExile(CardUtil.getCardExileZoneId(game, source), sourceObject.getName(), source.getSourceId(), game)) { + if (card.moveToExile(CardUtil.getCardExileZoneId(game, source), sourceObject.getName(), source, game)) { card.setFaceDown(true, game); } } @@ -150,7 +150,7 @@ class JestersScepterCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { TargetCardInExile target = new TargetCardInExile(new FilterCard(), CardUtil.getCardExileZoneId(game, ability)); @@ -160,15 +160,15 @@ class JestersScepterCost extends CostImpl { && controller.choose(Outcome.Benefit, cards, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - if (controller.moveCardToGraveyardWithInfo(card, sourceId, game, Zone.EXILED)) { + if (controller.moveCardToGraveyardWithInfo(card, source, game, Zone.EXILED)) { if (card instanceof SplitCard) { - game.getState().setValue(sourceId + "_nameOfExiledCardPayment", ((SplitCard) card).getLeftHalfCard().getName()); - game.getState().setValue(sourceId + "_nameOfExiledCardPayment2", ((SplitCard) card).getRightHalfCard().getName()); + game.getState().setValue(source.getSourceId() + "_nameOfExiledCardPayment", ((SplitCard) card).getLeftHalfCard().getName()); + game.getState().setValue(source.getSourceId() + "_nameOfExiledCardPayment2", ((SplitCard) card).getRightHalfCard().getName()); } else if (card instanceof ModalDoubleFacesCard) { - game.getState().setValue(sourceId + "_nameOfExiledCardPayment", ((ModalDoubleFacesCard) card).getLeftHalfCard().getName()); - game.getState().setValue(sourceId + "_nameOfExiledCardPayment2", ((ModalDoubleFacesCard) card).getRightHalfCard().getName()); + game.getState().setValue(source.getSourceId() + "_nameOfExiledCardPayment", ((ModalDoubleFacesCard) card).getLeftHalfCard().getName()); + game.getState().setValue(source.getSourceId() + "_nameOfExiledCardPayment2", ((ModalDoubleFacesCard) card).getRightHalfCard().getName()); } else { - game.getState().setValue(sourceId + "_nameOfExiledCardPayment", card.getName()); + game.getState().setValue(source.getSourceId() + "_nameOfExiledCardPayment", card.getName()); } paid = true; } @@ -179,7 +179,7 @@ class JestersScepterCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); return player != null; } @@ -209,7 +209,7 @@ class JestersScepterCounterEffect extends OneShotEffect { String nameOfExiledCardPayment2 = (String) game.getState().getValue(source.getSourceId() + "_nameOfExiledCardPayment2"); if (CardUtil.haveSameNames(spell.getCard(), nameOfExiledCardPayment, game) || CardUtil.haveSameNames(spell.getCard(), nameOfExiledCardPayment2, game)) { - return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game); + return game.getStack().counter(targetPointer.getFirst(game, source), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/j/JettingGlasskite.java b/Mage.Sets/src/mage/cards/j/JettingGlasskite.java index 072813d8057..28712ee5d09 100644 --- a/Mage.Sets/src/mage/cards/j/JettingGlasskite.java +++ b/Mage.Sets/src/mage/cards/j/JettingGlasskite.java @@ -68,7 +68,7 @@ class JettingGlasskiteAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java b/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java index 12bf2eba4e2..41a687e8f73 100644 --- a/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java +++ b/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java @@ -91,7 +91,7 @@ class JhoiraOfTheGhituSuspendEffect extends OneShotEffect { boolean hasSuspend = card.getAbilities(game).containsClass(SuspendAbility.class); UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); - if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.HAND, true)) { + if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source, game, Zone.HAND, true)) { card.addCounters(CounterType.TIME.createInstance(4), source, game); if (!hasSuspend) { game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source); diff --git a/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java b/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java index a4cc96705b5..191348e7ee5 100644 --- a/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java +++ b/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java @@ -82,7 +82,7 @@ class JhoirasTimebugEffect extends OneShotEffect { permanent.addCounters(CounterType.TIME.createInstance(), source, game); } else { - permanent.removeCounters(CounterType.TIME.createInstance(), game); + permanent.removeCounters(CounterType.TIME.createInstance(), source, game); } } else { @@ -92,7 +92,7 @@ class JhoirasTimebugEffect extends OneShotEffect { card.addCounters(CounterType.TIME.createInstance(), source, game); } else { - card.removeCounters(CounterType.TIME.createInstance(), game); + card.removeCounters(CounterType.TIME.createInstance(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/j/JinxedChoker.java b/Mage.Sets/src/mage/cards/j/JinxedChoker.java index d5a58b1e0a5..0cca282f75c 100644 --- a/Mage.Sets/src/mage/cards/j/JinxedChoker.java +++ b/Mage.Sets/src/mage/cards/j/JinxedChoker.java @@ -82,7 +82,7 @@ class JinxedChokerChangeControllerEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/j/JinxedIdol.java b/Mage.Sets/src/mage/cards/j/JinxedIdol.java index b0389152dfb..fd71c7a4183 100644 --- a/Mage.Sets/src/mage/cards/j/JinxedIdol.java +++ b/Mage.Sets/src/mage/cards/j/JinxedIdol.java @@ -68,7 +68,7 @@ class JinxedIdolEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = source.getSourcePermanentIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/j/JinxedRing.java b/Mage.Sets/src/mage/cards/j/JinxedRing.java index ead7bf52e4a..30bbd4efb61 100644 --- a/Mage.Sets/src/mage/cards/j/JinxedRing.java +++ b/Mage.Sets/src/mage/cards/j/JinxedRing.java @@ -80,7 +80,7 @@ class JinxedRingEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/j/Jokulmorder.java b/Mage.Sets/src/mage/cards/j/Jokulmorder.java index 121acc632a3..a0d7d0119e0 100644 --- a/Mage.Sets/src/mage/cards/j/Jokulmorder.java +++ b/Mage.Sets/src/mage/cards/j/Jokulmorder.java @@ -77,7 +77,7 @@ class JokulmorderTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/j/JoriEnRuinDiver.java b/Mage.Sets/src/mage/cards/j/JoriEnRuinDiver.java index dd11de050fa..016fc244009 100644 --- a/Mage.Sets/src/mage/cards/j/JoriEnRuinDiver.java +++ b/Mage.Sets/src/mage/cards/j/JoriEnRuinDiver.java @@ -61,7 +61,7 @@ class JoriEnTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/j/JotunGrunt.java b/Mage.Sets/src/mage/cards/j/JotunGrunt.java index fcce0c37ff2..9a0b6b938a7 100644 --- a/Mage.Sets/src/mage/cards/j/JotunGrunt.java +++ b/Mage.Sets/src/mage/cards/j/JotunGrunt.java @@ -59,16 +59,16 @@ class JotunGruntCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Removal, controllerId, source.getSourceId(), game)) { for (UUID targetId: targets.get(0).getTargets()) { Card card = game.getCard(targetId); if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) { return false; } - paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true); + paid |= controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, false, true); } } @@ -77,8 +77,8 @@ class JotunGruntCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/j/JourneyForTheElixir.java b/Mage.Sets/src/mage/cards/j/JourneyForTheElixir.java index e795c20827a..2041bd6fdea 100644 --- a/Mage.Sets/src/mage/cards/j/JourneyForTheElixir.java +++ b/Mage.Sets/src/mage/cards/j/JourneyForTheElixir.java @@ -178,8 +178,8 @@ class JourneyForTheElixirGraveyardTarget extends TargetCardInYourGraveyard { } @Override - public Set possibleTargets(UUID sourceId, UUID playerId, Game game) { - Set possibleTargets = super.possibleTargets(sourceId, playerId, game); + public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { + Set possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Cards alreadyTargeted = new CardsImpl(this.getTargets()); alreadyTargeted.addAll(cards); boolean hasBasic = alreadyTargeted diff --git a/Mage.Sets/src/mage/cards/j/JovensFerrets.java b/Mage.Sets/src/mage/cards/j/JovensFerrets.java index 1ddb7280bcb..a858a7adf9b 100644 --- a/Mage.Sets/src/mage/cards/j/JovensFerrets.java +++ b/Mage.Sets/src/mage/cards/j/JovensFerrets.java @@ -90,7 +90,7 @@ class JovensFerretsEffect extends OneShotEffect { } } for (Permanent creature : toTap) { - creature.tap(game); + creature.tap(source, game); DontUntapInControllersNextUntapStepTargetEffect effect = new DontUntapInControllersNextUntapStepTargetEffect(); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/j/JovialEvil.java b/Mage.Sets/src/mage/cards/j/JovialEvil.java index 5e9d61be64d..4a7f4e4d126 100644 --- a/Mage.Sets/src/mage/cards/j/JovialEvil.java +++ b/Mage.Sets/src/mage/cards/j/JovialEvil.java @@ -65,7 +65,7 @@ class JovialEvilEffect extends OneShotEffect { amount++; } if (amount > 0) { - opponent.damage(amount * 2, source.getSourceId(), game); + opponent.damage(amount * 2, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/j/JudgeUnworthy.java b/Mage.Sets/src/mage/cards/j/JudgeUnworthy.java index 694e6f7a42f..722daf3232c 100644 --- a/Mage.Sets/src/mage/cards/j/JudgeUnworthy.java +++ b/Mage.Sets/src/mage/cards/j/JudgeUnworthy.java @@ -70,7 +70,7 @@ class JudgeUnworthyEffect extends OneShotEffect { controller.revealCards(sourceCard.getName(), new CardsImpl(card), game); Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(card.getConvertedManaCost(), source.getSourceId(), game, false, true); + targetCreature.damage(card.getConvertedManaCost(), source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/j/JumboImp.java b/Mage.Sets/src/mage/cards/j/JumboImp.java index 22819a065e6..59d75dfbb6f 100644 --- a/Mage.Sets/src/mage/cards/j/JumboImp.java +++ b/Mage.Sets/src/mage/cards/j/JumboImp.java @@ -78,7 +78,7 @@ class JumboImpEffect extends EntersBattlefieldWithXCountersEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); List appliedEffects = (ArrayList) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects); return super.apply(game, source); @@ -114,7 +114,7 @@ class JumboImpAddCountersEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); return true; } @@ -143,8 +143,8 @@ class JumboImpRemoveCountersEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); - permanent.removeCounters(CounterType.P1P1.createInstance(amount), game); + int amount = controller.rollDice(source, game, 6); + permanent.removeCounters(CounterType.P1P1.createInstance(amount), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/j/Justice.java b/Mage.Sets/src/mage/cards/j/Justice.java index 1c9e6bcb49d..8107adb0223 100644 --- a/Mage.Sets/src/mage/cards/j/Justice.java +++ b/Mage.Sets/src/mage/cards/j/Justice.java @@ -67,9 +67,9 @@ class JusticeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override @@ -114,7 +114,7 @@ class JusticeEffect extends OneShotEffect { if (damageAmount != null && targetId != null) { Player player = game.getPlayer(targetId); if (player != null) { - player.damage(damageAmount, targetId, game); + player.damage(damageAmount, targetId, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/j/JusticeStrike.java b/Mage.Sets/src/mage/cards/j/JusticeStrike.java index f992cd7c4a2..788326c7dc0 100644 --- a/Mage.Sets/src/mage/cards/j/JusticeStrike.java +++ b/Mage.Sets/src/mage/cards/j/JusticeStrike.java @@ -57,6 +57,6 @@ class JusticeStrikeEffect extends OneShotEffect { if (permanent == null) { return false; } - return permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true) > 0; + return permanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true) > 0; } } diff --git a/Mage.Sets/src/mage/cards/j/Juxtapose.java b/Mage.Sets/src/mage/cards/j/Juxtapose.java index 912883598a0..7057466146e 100644 --- a/Mage.Sets/src/mage/cards/j/Juxtapose.java +++ b/Mage.Sets/src/mage/cards/j/Juxtapose.java @@ -94,8 +94,8 @@ class JuxtaposeEffect extends ContinuousEffectImpl { this.lockedControllers.put(permanent2.getId(), permanent1.getControllerId()); this.zoneChangeCounter.put(permanent2.getId(), permanent2.getZoneChangeCounter(game)); - permanent1.changeControllerId(targetPlayer.getId(), game); - permanent2.changeControllerId(you.getId(), game); + permanent1.changeControllerId(targetPlayer.getId(), game, source); + permanent2.changeControllerId(you.getId(), game, source); MageObject sourceObject = game.getCard(source.getSourceId()); game.informPlayers((sourceObject != null ? sourceObject.getLogName() : "") + ": " + you.getLogName() + " and " + targetPlayer.getLogName() + " exchange control of " + permanent1.getLogName() + @@ -117,7 +117,7 @@ class JuxtaposeEffect extends ContinuousEffectImpl { toDelete.add(entry.getKey()); continue; } - permanent.changeControllerId(lockedControllers.get(permanent.getId()), game); + permanent.changeControllerId(lockedControllers.get(permanent.getId()), game, source); } if (!toDelete.isEmpty()) { for (UUID uuid : toDelete) { diff --git a/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java b/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java index e9d90de7c4f..f6d60845ac0 100644 --- a/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java +++ b/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java @@ -65,7 +65,7 @@ class KaaliaOfTheVastAttacksAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override @@ -120,7 +120,7 @@ class KaaliaOfTheVastEffect extends OneShotEffect { return false; } TargetCardInHand target = new TargetCardInHand(filter); - if (target.canChoose(controller.getId(), game) && target.choose(outcome, controller.getId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game) && target.choose(outcome, controller.getId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { UUID cardId = target.getFirstTarget(); Card card = game.getCard(cardId); diff --git a/Mage.Sets/src/mage/cards/k/KadenasSilencer.java b/Mage.Sets/src/mage/cards/k/KadenasSilencer.java index 8ce416ad839..662044dfb61 100644 --- a/Mage.Sets/src/mage/cards/k/KadenasSilencer.java +++ b/Mage.Sets/src/mage/cards/k/KadenasSilencer.java @@ -69,7 +69,7 @@ class KadenasSilencerEffect extends OneShotEffect { .stream() .filter(stackObject -> stackObject instanceof Ability) .filter(stackObject -> opps.contains(stackObject.getControllerId())) - .forEach(stackObject -> game.getStack().counter(stackObject.getId(), source.getSourceId(), game)); + .forEach(stackObject -> game.getStack().counter(stackObject.getId(), source, game)); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java b/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java index ea114ce099a..1aeb7b54a65 100644 --- a/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java +++ b/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java @@ -70,12 +70,12 @@ class KaervekTheMercilessEffect extends OneShotEffect { int cost = spell.getConvertedManaCost(); Player target = game.getPlayer(source.getFirstTarget()); if (target != null) { - target.damage(cost, source.getSourceId(), game); + target.damage(cost, source.getSourceId(), source, game); return true; } Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null) { - targetCreature.damage(cost, source.getSourceId(), game, false, true); + targetCreature.damage(cost, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/k/KaerveksPurge.java b/Mage.Sets/src/mage/cards/k/KaerveksPurge.java index 4eabe29bd99..62831cc60ea 100644 --- a/Mage.Sets/src/mage/cards/k/KaerveksPurge.java +++ b/Mage.Sets/src/mage/cards/k/KaerveksPurge.java @@ -77,7 +77,7 @@ class KaerveksPurgeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { // Destroy target creature with converted mana cost X. Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (targetCreature != null && targetCreature.destroy(source.getSourceId(), game, false)) { + if (targetCreature != null && targetCreature.destroy(source, game, false)) { game.getState().processAction(game); if (targetCreature.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(targetCreature.getId()) && game.getState().getZone(targetCreature.getId()) != Zone.GRAVEYARD) { @@ -88,7 +88,7 @@ class KaerveksPurgeEffect extends OneShotEffect { Player creatureController = game.getPlayer(targetCreature.getControllerId()); int power = targetCreature.getPower().getValue(); if (creatureController != null) { - creatureController.damage(power, source.getSourceId(), game); + creatureController.damage(power, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/k/KalastriaHighborn.java b/Mage.Sets/src/mage/cards/k/KalastriaHighborn.java index f04e289d068..cfff7c4a42b 100644 --- a/Mage.Sets/src/mage/cards/k/KalastriaHighborn.java +++ b/Mage.Sets/src/mage/cards/k/KalastriaHighborn.java @@ -82,7 +82,7 @@ class LoseGainEffect extends OneShotEffect { you.gainLife(2, game, source); } if (them != null) { - them.loseLife(2, game, false); + them.loseLife(2, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java index 6f54f2debcb..a13aa536d7e 100644 --- a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java +++ b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java @@ -72,7 +72,7 @@ class KalitasDestroyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (permanent != null && permanent.destroy(source.getSourceId(), game, false)) { // if not destroyed it returns false + if (permanent != null && permanent.destroy(source, game, false)) { // if not destroyed it returns false if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId()) && game.getState().getZone(permanent.getId()) != Zone.GRAVEYARD) { // A replacement effect has moved the card to another zone as grvayard diff --git a/Mage.Sets/src/mage/cards/k/KamahlsSummons.java b/Mage.Sets/src/mage/cards/k/KamahlsSummons.java index 7c850062179..20a60574060 100644 --- a/Mage.Sets/src/mage/cards/k/KamahlsSummons.java +++ b/Mage.Sets/src/mage/cards/k/KamahlsSummons.java @@ -81,7 +81,7 @@ class KamahlsSummonsEffect extends OneShotEffect { for (Map.Entry revealedCardsByPlayer : revealedCards.entrySet()) { int value = revealedCardsByPlayer.getValue(); if (value > 0) { - token.putOntoBattlefield(value, game, source.getSourceId(), revealedCardsByPlayer.getKey()); + token.putOntoBattlefield(value, game, source, revealedCardsByPlayer.getKey()); } } return true; diff --git a/Mage.Sets/src/mage/cards/k/KamahlsWill.java b/Mage.Sets/src/mage/cards/k/KamahlsWill.java index 2bdac6cf5c3..251dacffce0 100644 --- a/Mage.Sets/src/mage/cards/k/KamahlsWill.java +++ b/Mage.Sets/src/mage/cards/k/KamahlsWill.java @@ -96,7 +96,7 @@ class KamahlsWillEffect extends OneShotEffect { if (creature == null || creature.getPower().getValue() < 1) { continue; } - permanent.damage(creature.getPower().getValue(), creature.getId(), game); + permanent.damage(creature.getPower().getValue(), creature.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KamiOfTheHonoredDead.java b/Mage.Sets/src/mage/cards/k/KamiOfTheHonoredDead.java index 6c1d13b377e..4babd84f081 100644 --- a/Mage.Sets/src/mage/cards/k/KamiOfTheHonoredDead.java +++ b/Mage.Sets/src/mage/cards/k/KamiOfTheHonoredDead.java @@ -68,7 +68,7 @@ class KamiOfTheHonoredDeadTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/k/Karma.java b/Mage.Sets/src/mage/cards/k/Karma.java index 52ff7f45297..588f43c9bb4 100644 --- a/Mage.Sets/src/mage/cards/k/Karma.java +++ b/Mage.Sets/src/mage/cards/k/Karma.java @@ -67,7 +67,7 @@ class KarmaDamageTargetEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int damage = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game).size(); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/k/KarmicJustice.java b/Mage.Sets/src/mage/cards/k/KarmicJustice.java index 42fc3a9fc66..de9c2895f29 100644 --- a/Mage.Sets/src/mage/cards/k/KarmicJustice.java +++ b/Mage.Sets/src/mage/cards/k/KarmicJustice.java @@ -58,7 +58,7 @@ class KarmicJusticeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DESTROYED_PERMANENT; + return event.getType() == GameEvent.EventType.DESTROYED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KarnLiberated.java b/Mage.Sets/src/mage/cards/k/KarnLiberated.java index 45a6c7b1aa8..85204270085 100644 --- a/Mage.Sets/src/mage/cards/k/KarnLiberated.java +++ b/Mage.Sets/src/mage/cards/k/KarnLiberated.java @@ -151,7 +151,7 @@ class KarnLiberatedDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BEGINNING_PHASE_PRE; + return event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KarnScionOfUrza.java b/Mage.Sets/src/mage/cards/k/KarnScionOfUrza.java index 3bb82c1374b..bb34fbee5b6 100644 --- a/Mage.Sets/src/mage/cards/k/KarnScionOfUrza.java +++ b/Mage.Sets/src/mage/cards/k/KarnScionOfUrza.java @@ -171,7 +171,7 @@ class KarnMinus1Effect extends OneShotEffect { card = game.getCard(target.getFirstTarget()); } if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); Cards revealCard = new CardsImpl(); revealCard.add(card); controller.revealCards("BLAHALJALJDSLAKJD", revealCard, game); diff --git a/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java b/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java index 922fd7146f8..2a49572703b 100644 --- a/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java +++ b/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java @@ -135,7 +135,7 @@ class KarplusanMinotaurCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { controller.flipCoin(ability, game, true); @@ -146,7 +146,7 @@ class KarplusanMinotaurCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { if (!game.getOpponents(controllerId).isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/k/KarrthusTyrantOfJund.java b/Mage.Sets/src/mage/cards/k/KarrthusTyrantOfJund.java index da9d64e41aa..c9b0af3476c 100644 --- a/Mage.Sets/src/mage/cards/k/KarrthusTyrantOfJund.java +++ b/Mage.Sets/src/mage/cards/k/KarrthusTyrantOfJund.java @@ -123,7 +123,7 @@ class KarrthusControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent dragon = game.getPermanent(targetPointer.getFirst(game, source)); if (dragon != null && controllerId != null) { - return dragon.changeControllerId(controllerId, game); + return dragon.changeControllerId(controllerId, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/k/KavuPredator.java b/Mage.Sets/src/mage/cards/k/KavuPredator.java index 5bf6feeb580..d11f13b3537 100644 --- a/Mage.Sets/src/mage/cards/k/KavuPredator.java +++ b/Mage.Sets/src/mage/cards/k/KavuPredator.java @@ -67,7 +67,7 @@ class KavuPredatorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override public boolean checkTrigger(GameEvent event, Game game) { diff --git a/Mage.Sets/src/mage/cards/k/KayaGhostAssassin.java b/Mage.Sets/src/mage/cards/k/KayaGhostAssassin.java index ce729a92a60..d20200b8b4e 100644 --- a/Mage.Sets/src/mage/cards/k/KayaGhostAssassin.java +++ b/Mage.Sets/src/mage/cards/k/KayaGhostAssassin.java @@ -112,7 +112,7 @@ class KayaGhostAssassinEffect extends OneShotEffect { game.addDelayedTriggeredAbility(delayedAbility, source); } } - controller.loseLife(2, game, false); + controller.loseLife(2, game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java b/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java index 54fb78da7ec..dbd1c07d874 100644 --- a/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java +++ b/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java @@ -138,7 +138,7 @@ class KayaOrzhovUsurperDamageEffect extends OneShotEffect { count += 1; } } - player.damage(count, source.getSourceId(), game); + player.damage(count, source.getSourceId(), source, game); controller.gainLife(count, game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/k/KayasWrath.java b/Mage.Sets/src/mage/cards/k/KayasWrath.java index d09c9904cd7..72cbd5bf0d1 100644 --- a/Mage.Sets/src/mage/cards/k/KayasWrath.java +++ b/Mage.Sets/src/mage/cards/k/KayasWrath.java @@ -63,7 +63,7 @@ class KayasWrathEffect extends OneShotEffect { )) { if (permanent != null) { boolean isMine = permanent.isControlledBy(source.getControllerId()); - if (permanent.destroy(source.getSourceId(), game, false) && isMine) { + if (permanent.destroy(source, game, false) && isMine) { counter++; } } diff --git a/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java b/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java index c5061f7826e..394bd6fba04 100644 --- a/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java +++ b/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java @@ -63,7 +63,7 @@ class KazuulTyrantOfTheCliffsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override @@ -104,10 +104,10 @@ class KazuulTyrantOfTheCliffsEffect extends OneShotEffect { return false; } cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), payee.getId(), false, null)) { + if (cost.pay(source, game, source, payee.getId(), false, null)) { return false; } - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(1, game, source, source.getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/cards/k/KazuulsTollCollector.java b/Mage.Sets/src/mage/cards/k/KazuulsTollCollector.java index a1e79f6ba11..26a49ee9587 100644 --- a/Mage.Sets/src/mage/cards/k/KazuulsTollCollector.java +++ b/Mage.Sets/src/mage/cards/k/KazuulsTollCollector.java @@ -74,7 +74,7 @@ class KazuulsTollCollectorEffect extends OneShotEffect { Permanent equipment = game.getPermanent(source.getFirstTarget()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && equipment != null) { - return permanent.addAttachment(equipment.getId(), game); + return permanent.addAttachment(equipment.getId(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/k/KederektParasite.java b/Mage.Sets/src/mage/cards/k/KederektParasite.java index a60a28204e8..d1363ae878c 100644 --- a/Mage.Sets/src/mage/cards/k/KederektParasite.java +++ b/Mage.Sets/src/mage/cards/k/KederektParasite.java @@ -70,7 +70,7 @@ class KederektParasiteTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KedissEmberclawFamiliar.java b/Mage.Sets/src/mage/cards/k/KedissEmberclawFamiliar.java index a5f72617d85..36e52261e72 100644 --- a/Mage.Sets/src/mage/cards/k/KedissEmberclawFamiliar.java +++ b/Mage.Sets/src/mage/cards/k/KedissEmberclawFamiliar.java @@ -92,7 +92,7 @@ class KedissEmberclawFamiliarEffect extends OneShotEffect { if (player == null) { continue; } - player.damage(damage, sourceId, game); + player.damage(damage, sourceId, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java b/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java index 3cd0cb9c9a2..b9eb939f273 100644 --- a/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java +++ b/Mage.Sets/src/mage/cards/k/KeeperOfTheDead.java @@ -189,7 +189,7 @@ class KeeperOfTheDeadEffect extends OneShotEffect { if (opponent != null) { Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/k/KefnetTheMindful.java b/Mage.Sets/src/mage/cards/k/KefnetTheMindful.java index bcc6c9a437c..6bb1c94e5b4 100644 --- a/Mage.Sets/src/mage/cards/k/KefnetTheMindful.java +++ b/Mage.Sets/src/mage/cards/k/KefnetTheMindful.java @@ -115,7 +115,7 @@ class KefnetTheMindfulEffect extends OneShotEffect { filterControlledLand.add(CardType.LAND.getPredicate()); Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); if (controller.chooseUse(Outcome.AIDontUseIt, "Do you want to return a land you control to its owner's hand?", null, "Yes", "No", source, game)) { Effect effect = new ReturnToHandChosenControlledPermanentEffect(filterControlledLand); effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/k/KeldonBattlewagon.java b/Mage.Sets/src/mage/cards/k/KeldonBattlewagon.java index ac7b16a92ec..bbc860c1bc4 100644 --- a/Mage.Sets/src/mage/cards/k/KeldonBattlewagon.java +++ b/Mage.Sets/src/mage/cards/k/KeldonBattlewagon.java @@ -87,14 +87,14 @@ class KeldonBattlewagonCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (target.choose(Outcome.Tap, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (target.choose(Outcome.Tap, controllerId, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } - paid |= permanent.tap(game); + paid |= permanent.tap(source, game); for (Effect effect : ability.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent, game)); } @@ -104,8 +104,8 @@ class KeldonBattlewagonCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/k/KeldonFirebombers.java b/Mage.Sets/src/mage/cards/k/KeldonFirebombers.java index 365c041bc44..dc5da653263 100644 --- a/Mage.Sets/src/mage/cards/k/KeldonFirebombers.java +++ b/Mage.Sets/src/mage/cards/k/KeldonFirebombers.java @@ -90,7 +90,7 @@ class KeldonFirebombersEffect extends OneShotEffect { } } for (Permanent land : landsToSacrifice) { - land.sacrifice(source.getSourceId(), game); + land.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KelsienThePlague.java b/Mage.Sets/src/mage/cards/k/KelsienThePlague.java index a46f223c43a..4de6743041d 100644 --- a/Mage.Sets/src/mage/cards/k/KelsienThePlague.java +++ b/Mage.Sets/src/mage/cards/k/KelsienThePlague.java @@ -121,7 +121,7 @@ class KelsienThePlagueEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.damage(1, source.getSourceId(), game); + permanent.damage(1, source.getSourceId(), source, game); game.addDelayedTriggeredAbility(new KelsienThePlagueDelayedTriggeredAbility(permanent.getId()), source); return true; } diff --git a/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java b/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java index e0c75bf8555..27270c07291 100644 --- a/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java +++ b/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java @@ -80,7 +80,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KessigCagebreakers.java b/Mage.Sets/src/mage/cards/k/KessigCagebreakers.java index 0bfd9735b0b..02d280bbb11 100644 --- a/Mage.Sets/src/mage/cards/k/KessigCagebreakers.java +++ b/Mage.Sets/src/mage/cards/k/KessigCagebreakers.java @@ -66,7 +66,7 @@ class KessigCagebreakersEffect extends OneShotEffect { WolfToken token = new WolfToken(); int count = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game); for (int i = 0; i < count; i++) { - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), true, true); + token.putOntoBattlefield(1, game, source, source.getControllerId(), true, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KhalniGem.java b/Mage.Sets/src/mage/cards/k/KhalniGem.java index 566c59185db..e6e789aca2b 100644 --- a/Mage.Sets/src/mage/cards/k/KhalniGem.java +++ b/Mage.Sets/src/mage/cards/k/KhalniGem.java @@ -71,7 +71,7 @@ class KhalniGemReturnToHandTargetEffect extends OneShotEffect { for ( UUID target : targetPointer.getTargets(game, source) ) { Permanent permanent = game.getPermanent(target); if ( permanent != null ) { - permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true); + permanent.moveToZone(Zone.HAND, source, game, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/k/KheruSpellsnatcher.java b/Mage.Sets/src/mage/cards/k/KheruSpellsnatcher.java index 7a53d2f08e2..5c4bb02b2ac 100644 --- a/Mage.Sets/src/mage/cards/k/KheruSpellsnatcher.java +++ b/Mage.Sets/src/mage/cards/k/KheruSpellsnatcher.java @@ -73,7 +73,7 @@ class KheruSpellsnatcherEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source)); if (stackObject != null && sourceObject != null - && game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game, Zone.EXILED, false, ZoneDetail.NONE)) { + && game.getStack().counter(targetPointer.getFirst(game, source), source, game, Zone.EXILED, false, ZoneDetail.NONE)) { if (!stackObject.isCopy()) { MageObject card = game.getObject(stackObject.getSourceId()); if (card instanceof Card) { diff --git a/Mage.Sets/src/mage/cards/k/KhorvathsFury.java b/Mage.Sets/src/mage/cards/k/KhorvathsFury.java index 6c9471afde9..f04c658dc4c 100644 --- a/Mage.Sets/src/mage/cards/k/KhorvathsFury.java +++ b/Mage.Sets/src/mage/cards/k/KhorvathsFury.java @@ -67,7 +67,7 @@ class KhorvathsFuryEffect extends OneShotEffect { for (Player player : choice.getFriends()) { if (player != null) { int cardsInHand = player.getHand().size(); - player.discard(cardsInHand, false, source, game); + player.discard(cardsInHand, false, false, source, game); if (cardsInHand > 0) { cardsToDraw.put(player.getId(), cardsInHand); } @@ -75,12 +75,12 @@ class KhorvathsFuryEffect extends OneShotEffect { } for (Player player : choice.getFriends()) { if (player != null) { - player.drawCards(cardsToDraw.get(player.getId()) + 1, source.getSourceId(), game); + player.drawCards(cardsToDraw.get(player.getId()) + 1, source, game); } } for (Player player : choice.getFoes()) { if (player != null) { - player.damage(player.getHand().size(), source.getSourceId(), game); + player.damage(player.getHand().size(), source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/k/KikuNightsFlower.java b/Mage.Sets/src/mage/cards/k/KikuNightsFlower.java index 192cda755a3..79672587f5a 100644 --- a/Mage.Sets/src/mage/cards/k/KikuNightsFlower.java +++ b/Mage.Sets/src/mage/cards/k/KikuNightsFlower.java @@ -77,7 +77,7 @@ class KikuNightsFlowerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); + permanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/k/KikusShadow.java b/Mage.Sets/src/mage/cards/k/KikusShadow.java index 97a283669d7..21034b15023 100644 --- a/Mage.Sets/src/mage/cards/k/KikusShadow.java +++ b/Mage.Sets/src/mage/cards/k/KikusShadow.java @@ -60,7 +60,7 @@ class KikusShadowEffect extends OneShotEffect { if (controller != null) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(targetCreature.getPower().getValue(), source.getSourceId(), game, false, true); + targetCreature.damage(targetCreature.getPower().getValue(), source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KillSuitCultist.java b/Mage.Sets/src/mage/cards/k/KillSuitCultist.java index 3e865a998d3..502ad3514bd 100644 --- a/Mage.Sets/src/mage/cards/k/KillSuitCultist.java +++ b/Mage.Sets/src/mage/cards/k/KillSuitCultist.java @@ -72,7 +72,7 @@ class KillSuitCultistEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } @Override @@ -89,7 +89,7 @@ class KillSuitCultistEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if(permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/k/KillingWave.java b/Mage.Sets/src/mage/cards/k/KillingWave.java index cb30af1dd2f..0f3035347e2 100644 --- a/Mage.Sets/src/mage/cards/k/KillingWave.java +++ b/Mage.Sets/src/mage/cards/k/KillingWave.java @@ -93,13 +93,13 @@ class KillingWaveEffect extends OneShotEffect { if (lifePaid > 0) { Player player = game.getPlayer(playerId); if (player != null) { - player.loseLife(lifePaid, game, false); + player.loseLife(lifePaid, game, source, false); } } } for (Permanent creature : sacrifices) { - creature.sacrifice(source.getSourceId(), game); + creature.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/k/KinTreeInvocation.java b/Mage.Sets/src/mage/cards/k/KinTreeInvocation.java index c3799cfacae..fa37efa94c2 100644 --- a/Mage.Sets/src/mage/cards/k/KinTreeInvocation.java +++ b/Mage.Sets/src/mage/cards/k/KinTreeInvocation.java @@ -67,7 +67,7 @@ class KinTreeInvocationCreateTokenEffect extends OneShotEffect { } Token token = new SpiritWarriorToken(value); token.getAbilities().newId(); // neccessary if token has ability like DevourAbility() - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/k/KindleTheCarnage.java b/Mage.Sets/src/mage/cards/k/KindleTheCarnage.java index d1c3af51e27..a2acc425e30 100644 --- a/Mage.Sets/src/mage/cards/k/KindleTheCarnage.java +++ b/Mage.Sets/src/mage/cards/k/KindleTheCarnage.java @@ -62,7 +62,7 @@ class KindleTheCarnageEffect extends OneShotEffect { while (hand != null && hand.size() > 0 && controller.chooseUse(Outcome.AIDontUseIt, "Discard a card randomly from your hand?", source, game)) { - Card discardedCard = controller.discardOne(true, source, game); + Card discardedCard = controller.discardOne(true, false, source, game); if (discardedCard != null) { new DamageAllEffect(discardedCard.getConvertedManaCost(), new FilterCreaturePermanent()).apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/k/KineticAugur.java b/Mage.Sets/src/mage/cards/k/KineticAugur.java index 458110b550d..009a4ce500d 100644 --- a/Mage.Sets/src/mage/cards/k/KineticAugur.java +++ b/Mage.Sets/src/mage/cards/k/KineticAugur.java @@ -82,9 +82,9 @@ class KineticAugurEffect extends OneShotEffect { } TargetDiscard target = new TargetDiscard(0, 2, StaticFilters.FILTER_CARD, player.getId()); player.choose(Outcome.AIDontUseIt, player.getHand(), target, game); - int discarded = player.discard(new CardsImpl(target.getTargets()), source, game).size(); + int discarded = player.discard(new CardsImpl(target.getTargets()), false, source, game).size(); if (discarded > 0) { - player.drawCards(discarded, source.getSourceId(), game); + player.drawCards(discarded, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KinjallisSunwing.java b/Mage.Sets/src/mage/cards/k/KinjallisSunwing.java index 46555b70562..87d019278df 100644 --- a/Mage.Sets/src/mage/cards/k/KinjallisSunwing.java +++ b/Mage.Sets/src/mage/cards/k/KinjallisSunwing.java @@ -64,7 +64,7 @@ class KinjallisSunwingEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { - target.tap(game); + target.tap(source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/k/KiraGreatGlassSpinner.java b/Mage.Sets/src/mage/cards/k/KiraGreatGlassSpinner.java index 246e39bfe4b..f42d90ddae7 100644 --- a/Mage.Sets/src/mage/cards/k/KiraGreatGlassSpinner.java +++ b/Mage.Sets/src/mage/cards/k/KiraGreatGlassSpinner.java @@ -74,7 +74,7 @@ class KiraGreatGlassSpinnerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/k/Kismet.java b/Mage.Sets/src/mage/cards/k/Kismet.java index 576aaf69466..09b00fca42d 100644 --- a/Mage.Sets/src/mage/cards/k/Kismet.java +++ b/Mage.Sets/src/mage/cards/k/Kismet.java @@ -62,7 +62,7 @@ class KismetEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KitesailFreebooter.java b/Mage.Sets/src/mage/cards/k/KitesailFreebooter.java index 247328581ff..d71244cea70 100644 --- a/Mage.Sets/src/mage/cards/k/KitesailFreebooter.java +++ b/Mage.Sets/src/mage/cards/k/KitesailFreebooter.java @@ -97,7 +97,7 @@ class KitesailFreebooterExileEffect extends OneShotEffect { Card card = opponent.getHand().get(target.getFirstTarget(), game); // If source permanent leaves the battlefield before its triggered ability resolves, the target card won't be exiled. if (card != null && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { - controller.moveCardToExileWithInfo(card, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), sourcePermanent.getIdName(), source, game, Zone.HAND, true); } } } diff --git a/Mage.Sets/src/mage/cards/k/KithkinArmor.java b/Mage.Sets/src/mage/cards/k/KithkinArmor.java index d17a312c21b..ababcbe6417 100644 --- a/Mage.Sets/src/mage/cards/k/KithkinArmor.java +++ b/Mage.Sets/src/mage/cards/k/KithkinArmor.java @@ -77,12 +77,12 @@ class KithkinArmorCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { // store attached to information due to getLastInfo being completely fubared game.getState().setValue(ability.getSourceId().toString() + "attachedToPermanent", permanent.getAttachedTo()); - paid = permanent.sacrifice(sourceId, game); + paid = permanent.sacrifice(source, game); if (!paid) { game.getState().setValue(ability.getSourceId().toString() + "attachedToPermanent", null); } @@ -91,10 +91,9 @@ class KithkinArmorCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); - return permanent != null - && game.getPlayer(controllerId).canPaySacrificeCost(permanent, sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); + return permanent != null && game.getPlayer(controllerId).canPaySacrificeCost(permanent, source, controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/k/KitsuneMystic.java b/Mage.Sets/src/mage/cards/k/KitsuneMystic.java index fe59abb96b6..5105776b16b 100644 --- a/Mage.Sets/src/mage/cards/k/KitsuneMystic.java +++ b/Mage.Sets/src/mage/cards/k/KitsuneMystic.java @@ -114,8 +114,8 @@ class AutumnTailEffect extends OneShotEffect { if (oldCreature == null || oldCreature.equals(creature)) { return false; } - if (oldCreature.removeAttachment(aura.getId(), game)) { - return creature.addAttachment(aura.getId(), game); + if (oldCreature.removeAttachment(aura.getId(), source, game)) { + return creature.addAttachment(aura.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/k/KiyomaroFirstToStand.java b/Mage.Sets/src/mage/cards/k/KiyomaroFirstToStand.java index 0349e3bd190..d01efbec41d 100644 --- a/Mage.Sets/src/mage/cards/k/KiyomaroFirstToStand.java +++ b/Mage.Sets/src/mage/cards/k/KiyomaroFirstToStand.java @@ -88,9 +88,9 @@ class KiyomaroFirstToStandDealsDamageTriggeredAbility extends TriggeredAbilityIm @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KjeldoranRoyalGuard.java b/Mage.Sets/src/mage/cards/k/KjeldoranRoyalGuard.java index 420a53422f8..17257b6d78e 100644 --- a/Mage.Sets/src/mage/cards/k/KjeldoranRoyalGuard.java +++ b/Mage.Sets/src/mage/cards/k/KjeldoranRoyalGuard.java @@ -70,9 +70,9 @@ class KjeldoranRoyalGuardEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; - Permanent p = game.getPermanent(source.getSourceId()); - if (p != null) { - p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + permanent.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); } return true; } diff --git a/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java b/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java index 5b36b262321..19b964740a3 100644 --- a/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java +++ b/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java @@ -102,7 +102,7 @@ class KlothysGodOfDestinyEffect extends OneShotEffect { .stream() .map(game::getPlayer) .filter(Objects::nonNull) - .forEach(opponent -> opponent.damage(2, source.getSourceId(), game)); + .forEach(opponent -> opponent.damage(2, source.getSourceId(), source, game)); return true; } } diff --git a/Mage.Sets/src/mage/cards/k/KnacksawClique.java b/Mage.Sets/src/mage/cards/k/KnacksawClique.java index 1b3b4882150..6522fd85dcb 100644 --- a/Mage.Sets/src/mage/cards/k/KnacksawClique.java +++ b/Mage.Sets/src/mage/cards/k/KnacksawClique.java @@ -87,7 +87,7 @@ class KnacksawCliqueEffect extends OneShotEffect { Library library = opponent.getLibrary(); Card card = library.getFromTop(game); if (card != null) { - opponent.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getName(), source.getSourceId(), game, Zone.LIBRARY, true); + opponent.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getName(), source, game, Zone.LIBRARY, true); ContinuousEffect effect = new KnacksawCliqueCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/k/KnollspineDragon.java b/Mage.Sets/src/mage/cards/k/KnollspineDragon.java index 63395447f9d..7deebc48c79 100644 --- a/Mage.Sets/src/mage/cards/k/KnollspineDragon.java +++ b/Mage.Sets/src/mage/cards/k/KnollspineDragon.java @@ -71,7 +71,7 @@ class KnollspineDragonEffect extends OneShotEffect { AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class); if (watcher != null) { int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId()); - controller.drawCards(drawAmount, source.getSourceId(), game); + controller.drawCards(drawAmount, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/k/KnowledgeAndPower.java b/Mage.Sets/src/mage/cards/k/KnowledgeAndPower.java index 31a88dff8af..6caa56ee7c8 100644 --- a/Mage.Sets/src/mage/cards/k/KnowledgeAndPower.java +++ b/Mage.Sets/src/mage/cards/k/KnowledgeAndPower.java @@ -58,7 +58,7 @@ class ScryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SCRIED; + return event.getType() == GameEvent.EventType.SCRIED; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KnowledgePool.java b/Mage.Sets/src/mage/cards/k/KnowledgePool.java index 734a0107b1f..e5bd7941df3 100644 --- a/Mage.Sets/src/mage/cards/k/KnowledgePool.java +++ b/Mage.Sets/src/mage/cards/k/KnowledgePool.java @@ -107,7 +107,7 @@ class KnowledgePoolAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KnowledgeVault.java b/Mage.Sets/src/mage/cards/k/KnowledgeVault.java index 9cb731ba9b8..5ac2c75debc 100644 --- a/Mage.Sets/src/mage/cards/k/KnowledgeVault.java +++ b/Mage.Sets/src/mage/cards/k/KnowledgeVault.java @@ -106,7 +106,7 @@ class KnowledgeVaultReturnEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && controller != null) { - if (sourcePermanent.sacrifice(source.getSourceId(), game)) { + if (sourcePermanent.sacrifice(source, game)) { new DiscardHandControllerEffect().apply(game, source); ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())); if (exileZone != null) { diff --git a/Mage.Sets/src/mage/cards/k/KokushoTheEveningStar.java b/Mage.Sets/src/mage/cards/k/KokushoTheEveningStar.java index c1881be2aa1..2d2a38c61e7 100644 --- a/Mage.Sets/src/mage/cards/k/KokushoTheEveningStar.java +++ b/Mage.Sets/src/mage/cards/k/KokushoTheEveningStar.java @@ -58,7 +58,7 @@ class KokushoTheEveningStarEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int loseLife = 0; for (UUID opponentId : game.getOpponents(source.getControllerId())) { - loseLife += game.getPlayer(opponentId).loseLife(5, game, false); + loseLife += game.getPlayer(opponentId).loseLife(5, game, source, false); } if (loseLife > 0) game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source); diff --git a/Mage.Sets/src/mage/cards/k/KorFirewalker.java b/Mage.Sets/src/mage/cards/k/KorFirewalker.java index 2303f098fea..c6e4fa92138 100644 --- a/Mage.Sets/src/mage/cards/k/KorFirewalker.java +++ b/Mage.Sets/src/mage/cards/k/KorFirewalker.java @@ -66,7 +66,7 @@ class KorFirewalkerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KorOutfitter.java b/Mage.Sets/src/mage/cards/k/KorOutfitter.java index 18b112647d9..51c211783bb 100644 --- a/Mage.Sets/src/mage/cards/k/KorOutfitter.java +++ b/Mage.Sets/src/mage/cards/k/KorOutfitter.java @@ -75,7 +75,7 @@ class EquipEffect extends OneShotEffect { Permanent equipment = game.getPermanent(source.getFirstTarget()); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null && equipment != null) { - return creature.addAttachment(equipment.getId(), game); + return creature.addAttachment(equipment.getId(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java b/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java index fa1649cf911..317bf019e2f 100644 --- a/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java +++ b/Mage.Sets/src/mage/cards/k/KozilekTheGreatDistortion.java @@ -91,7 +91,7 @@ class KozilekDrawEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(7 - controller.getHand().size(), source.getSourceId(), game); + controller.drawCards(7 - controller.getHand().size(), source, game); return true; } return false; @@ -109,7 +109,7 @@ class KozilekDiscardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Spell targetSpell = game.getStack().getSpell(ability.getFirstTarget()); if (targetSpell == null) { return false; @@ -123,13 +123,13 @@ class KozilekDiscardCost extends CostImpl { TargetCardInHand target = new TargetCardInHand(filter); this.getTargets().clear(); this.getTargets().add(target); - if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Discard, controllerId, source.getSourceId(), game)) { for (UUID targetId : targets.get(0).getTargets()) { Card card = player.getHand().get(targetId, game); if (card == null) { return false; } - player.discard(card, ability, game); + player.discard(card, true, source, game); paid = true; } } @@ -143,7 +143,7 @@ class KozilekDiscardCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { if (game.getStack().isEmpty()) { return false; } diff --git a/Mage.Sets/src/mage/cards/k/KrakensEye.java b/Mage.Sets/src/mage/cards/k/KrakensEye.java index 97b7b41937c..06e7dc5a3c7 100644 --- a/Mage.Sets/src/mage/cards/k/KrakensEye.java +++ b/Mage.Sets/src/mage/cards/k/KrakensEye.java @@ -53,7 +53,7 @@ class KrakensEyeAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KraumLudevicsOpus.java b/Mage.Sets/src/mage/cards/k/KraumLudevicsOpus.java index c02cf364faf..d30024971e9 100644 --- a/Mage.Sets/src/mage/cards/k/KraumLudevicsOpus.java +++ b/Mage.Sets/src/mage/cards/k/KraumLudevicsOpus.java @@ -74,7 +74,7 @@ class KraumLudevicsOpusTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KrazyKow.java b/Mage.Sets/src/mage/cards/k/KrazyKow.java index 6b6cb071953..02ecdb87f7e 100644 --- a/Mage.Sets/src/mage/cards/k/KrazyKow.java +++ b/Mage.Sets/src/mage/cards/k/KrazyKow.java @@ -60,7 +60,7 @@ class KrazyKowEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int result = controller.rollDice(game, 6); + int result = controller.rollDice(source, game, 6); if (result == 1) { new SacrificeSourceEffect().apply(game, source); return new DamageEverythingEffect(3).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/k/KrovikanVampire.java b/Mage.Sets/src/mage/cards/k/KrovikanVampire.java index 6457d95ccad..738131078d9 100644 --- a/Mage.Sets/src/mage/cards/k/KrovikanVampire.java +++ b/Mage.Sets/src/mage/cards/k/KrovikanVampire.java @@ -149,7 +149,7 @@ class KrovikanVampireCreaturesDamagedWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_CREATURE + if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && sourceId.equals(event.getSourceId())) { damagedBySource.add(event.getTargetId()); } @@ -211,17 +211,17 @@ class KrovikanVampireDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_CONTROL - || event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.LOST_CONTROL + || event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.LOST_CONTROL - && event.getSourceId().equals(krovikanVampire)) { + if (event.getType() == GameEvent.EventType.LOST_CONTROL + && event.getTargetId().equals(krovikanVampire)) { return true; } - if (event.getType() == EventType.ZONE_CHANGE + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(krovikanVampire)) { return true; } diff --git a/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java b/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java index 0eefea7e58d..74102000d19 100644 --- a/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java +++ b/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java @@ -85,7 +85,7 @@ class KroxaTitanOfDeathsHungerEntersEffect extends OneShotEffect { if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())) { return false; } - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } @@ -127,7 +127,7 @@ class KroxaTitanOfDeathsHungerDiscardEffect extends OneShotEffect { .forEachOrdered(card -> { Player player = game.getPlayer(card.getOwnerId()); if (player == null - || !player.discard(card, source, game) + || !player.discard(card, false, source, game) || card.isLand()) { return; } @@ -138,7 +138,7 @@ class KroxaTitanOfDeathsHungerDiscardEffect extends OneShotEffect { .filter(uuid -> !playerSet.contains(uuid)) .map(game::getPlayer) .filter(Objects::nonNull) - .forEachOrdered(player -> player.loseLife(3, game, false)); + .forEachOrdered(player -> player.loseLife(3, game, source, false)); return true; } } diff --git a/Mage.Sets/src/mage/cards/k/Kudzu.java b/Mage.Sets/src/mage/cards/k/Kudzu.java index 0c8f9cb857a..2eaf74db457 100644 --- a/Mage.Sets/src/mage/cards/k/Kudzu.java +++ b/Mage.Sets/src/mage/cards/k/Kudzu.java @@ -79,7 +79,7 @@ class KudzuEffect extends OneShotEffect { && controller != null) { Player landsController = game.getPlayer(enchantedLand.getControllerId()); if (game.getState().getZone(enchantedLand.getId()) == Zone.BATTLEFIELD) { // if 2 or more Kudzu's were on a land - enchantedLand.destroy(source.getId(), game, false); + enchantedLand.destroy(source, game, false); } if (!game.getBattlefield().getAllActivePermanents(CardType.LAND).isEmpty()) { //lands are available on the battlefield Target target = new TargetLandPermanent(); @@ -92,7 +92,7 @@ class KudzuEffect extends OneShotEffect { if (landChosen != null) { for (Target targetTest : kudzuCard.getSpellAbility().getTargets()) { if (targetTest.getFilter().match(landChosen, game)) { - landChosen.addAttachment(kudzu.getId(), game); + landChosen.addAttachment(kudzu.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/k/KumanosBlessing.java b/Mage.Sets/src/mage/cards/k/KumanosBlessing.java index 196790799e4..0f487d600a4 100644 --- a/Mage.Sets/src/mage/cards/k/KumanosBlessing.java +++ b/Mage.Sets/src/mage/cards/k/KumanosBlessing.java @@ -77,17 +77,13 @@ class KumanosBlessingEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -114,7 +110,7 @@ class DamagedByEnchantedWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_CREATURE) { + if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { Permanent enchantment = game.getPermanent(this.getSourceId()); if (enchantment != null && enchantment.isAttachedTo(event.getSourceId())) { MageObjectReference mor = new MageObjectReference(event.getTargetId(), game); diff --git a/Mage.Sets/src/mage/cards/k/KurkeshOnakkeAncient.java b/Mage.Sets/src/mage/cards/k/KurkeshOnakkeAncient.java index 27be72c1097..f8c6b5ea712 100644 --- a/Mage.Sets/src/mage/cards/k/KurkeshOnakkeAncient.java +++ b/Mage.Sets/src/mage/cards/k/KurkeshOnakkeAncient.java @@ -66,7 +66,7 @@ class KurkeshOnakkeAncientTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATED_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; } @Override @@ -113,7 +113,7 @@ class KurkeshOnakkeAncientEffect extends OneShotEffect { ColoredManaCost cost = new ColoredManaCost(ColoredManaSymbol.R); if (player != null) { if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) { - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source, source.getControllerId(), false)) { StackAbility ability = (StackAbility) getValue("stackAbility"); Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/k/KusariGama.java b/Mage.Sets/src/mage/cards/k/KusariGama.java index 91ac16f2c25..b622644cb3a 100644 --- a/Mage.Sets/src/mage/cards/k/KusariGama.java +++ b/Mage.Sets/src/mage/cards/k/KusariGama.java @@ -79,7 +79,7 @@ class KusariGamaAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -128,7 +128,7 @@ class KusariGamaDamageEffect extends OneShotEffect { if (creature != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, creature.getControllerId(), game)) { if (!permanent.getId().equals(damagedCreatureId)) { - permanent.damage(damage, source.getSourceId(), game, false, true); + permanent.damage(damage, source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/k/KwainItinerantMeddler.java b/Mage.Sets/src/mage/cards/k/KwainItinerantMeddler.java index 4660fca4552..79cf1479ebb 100644 --- a/Mage.Sets/src/mage/cards/k/KwainItinerantMeddler.java +++ b/Mage.Sets/src/mage/cards/k/KwainItinerantMeddler.java @@ -69,7 +69,7 @@ class KwainItinerantMeddlerEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && player.chooseUse(outcome, "Draw a card?", source, game) - && player.drawCards(1, source.getSourceId(), game) > 0) { + && player.drawCards(1, source, game) > 0) { players.add(player); } } diff --git a/Mage.Sets/src/mage/cards/k/KynaiosAndTiroOfMeletis.java b/Mage.Sets/src/mage/cards/k/KynaiosAndTiroOfMeletis.java index df0d477d0f6..ae07e2b6edd 100644 --- a/Mage.Sets/src/mage/cards/k/KynaiosAndTiroOfMeletis.java +++ b/Mage.Sets/src/mage/cards/k/KynaiosAndTiroOfMeletis.java @@ -70,7 +70,7 @@ class KynaiosAndTirosEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); PlayerList playerList = game.getState().getPlayerList().copy(); while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) { @@ -113,7 +113,7 @@ class KynaiosAndTirosEffect extends OneShotEffect { for (UUID playerId : noLandPlayers) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LaboratoryManiac.java b/Mage.Sets/src/mage/cards/l/LaboratoryManiac.java index 7c372edebec..8b62a6ab07c 100644 --- a/Mage.Sets/src/mage/cards/l/LaboratoryManiac.java +++ b/Mage.Sets/src/mage/cards/l/LaboratoryManiac.java @@ -79,7 +79,7 @@ class LaboratoryManiacEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LabyrinthGuardian.java b/Mage.Sets/src/mage/cards/l/LabyrinthGuardian.java index 691561a52f1..7f86f51cced 100644 --- a/Mage.Sets/src/mage/cards/l/LabyrinthGuardian.java +++ b/Mage.Sets/src/mage/cards/l/LabyrinthGuardian.java @@ -68,7 +68,7 @@ class LabyrinthGuardianTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LaccolithGrunt.java b/Mage.Sets/src/mage/cards/l/LaccolithGrunt.java index 6246aad54dd..662d8138610 100644 --- a/Mage.Sets/src/mage/cards/l/LaccolithGrunt.java +++ b/Mage.Sets/src/mage/cards/l/LaccolithGrunt.java @@ -70,7 +70,7 @@ public final class LaccolithGrunt extends CardImpl { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damage, sourcePermanent.getId(), game, false, true); + permanent.damage(damage, sourcePermanent.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LaccolithRig.java b/Mage.Sets/src/mage/cards/l/LaccolithRig.java index 136aed4487a..ec93524e68d 100644 --- a/Mage.Sets/src/mage/cards/l/LaccolithRig.java +++ b/Mage.Sets/src/mage/cards/l/LaccolithRig.java @@ -89,7 +89,7 @@ class LaccolithRigEffect extends OneShotEffect { int damage = ownCreature.getPower().getValue(); Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null) { - targetCreature.damage(damage, ownCreature.getId(), game, false, true); + targetCreature.damage(damage, ownCreature.getId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/l/LaccolithTitan.java b/Mage.Sets/src/mage/cards/l/LaccolithTitan.java index 06a0ab48636..322eb5b36f4 100644 --- a/Mage.Sets/src/mage/cards/l/LaccolithTitan.java +++ b/Mage.Sets/src/mage/cards/l/LaccolithTitan.java @@ -70,7 +70,7 @@ public final class LaccolithTitan extends CardImpl { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damage, sourcePermanent.getId(), game, false, true); + permanent.damage(damage, sourcePermanent.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LaccolithWarrior.java b/Mage.Sets/src/mage/cards/l/LaccolithWarrior.java index 73b760cd511..78b3fb608bd 100644 --- a/Mage.Sets/src/mage/cards/l/LaccolithWarrior.java +++ b/Mage.Sets/src/mage/cards/l/LaccolithWarrior.java @@ -71,7 +71,7 @@ public final class LaccolithWarrior extends CardImpl { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damage, sourcePermanent.getId(), game, false, true); + permanent.damage(damage, sourcePermanent.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LaccolithWhelp.java b/Mage.Sets/src/mage/cards/l/LaccolithWhelp.java index 9fe2c4288e2..c9ab6f2a240 100644 --- a/Mage.Sets/src/mage/cards/l/LaccolithWhelp.java +++ b/Mage.Sets/src/mage/cards/l/LaccolithWhelp.java @@ -70,7 +70,7 @@ public final class LaccolithWhelp extends CardImpl { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damage, sourcePermanent.getId(), game, false, true); + permanent.damage(damage, sourcePermanent.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LairwatchGiant.java b/Mage.Sets/src/mage/cards/l/LairwatchGiant.java index 0302f7eede2..abe8ccc13cd 100644 --- a/Mage.Sets/src/mage/cards/l/LairwatchGiant.java +++ b/Mage.Sets/src/mage/cards/l/LairwatchGiant.java @@ -67,7 +67,7 @@ class LairwatchGiantTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LandEquilibrium.java b/Mage.Sets/src/mage/cards/l/LandEquilibrium.java index 0e2bc1f4feb..46372de93f2 100644 --- a/Mage.Sets/src/mage/cards/l/LandEquilibrium.java +++ b/Mage.Sets/src/mage/cards/l/LandEquilibrium.java @@ -54,7 +54,7 @@ class LandEquilibriumAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LandGrant.java b/Mage.Sets/src/mage/cards/l/LandGrant.java index f4a106566ab..29c2546885d 100644 --- a/Mage.Sets/src/mage/cards/l/LandGrant.java +++ b/Mage.Sets/src/mage/cards/l/LandGrant.java @@ -79,7 +79,7 @@ class LandGrantReavealCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null) { player.revealCards("Land Grant", player.getHand(), game); @@ -89,7 +89,7 @@ class LandGrantReavealCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } diff --git a/Mage.Sets/src/mage/cards/l/Landslide.java b/Mage.Sets/src/mage/cards/l/Landslide.java index 7d1f9648382..54c4f3e6c8a 100644 --- a/Mage.Sets/src/mage/cards/l/Landslide.java +++ b/Mage.Sets/src/mage/cards/l/Landslide.java @@ -72,13 +72,13 @@ class LandslideEffect extends OneShotEffect { int amount = 0; for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { amount++; } } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LaquatussCreativity.java b/Mage.Sets/src/mage/cards/l/LaquatussCreativity.java index ec94e5aef96..42b167dc4f9 100644 --- a/Mage.Sets/src/mage/cards/l/LaquatussCreativity.java +++ b/Mage.Sets/src/mage/cards/l/LaquatussCreativity.java @@ -59,8 +59,8 @@ class LaquatussCreativityEffect extends OneShotEffect { Player player = game.getPlayer(source.getFirstTarget()); if(player != null) { int handCount = player.getHand().count(new FilterCard(), game); - player.drawCards(handCount, source.getSourceId(), game); - player.discard(handCount, false, source, game); + player.drawCards(handCount, source, game); + player.discard(handCount, false, false, source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/l/Larceny.java b/Mage.Sets/src/mage/cards/l/Larceny.java index 297dd135e86..90bc8b2f313 100644 --- a/Mage.Sets/src/mage/cards/l/Larceny.java +++ b/Mage.Sets/src/mage/cards/l/Larceny.java @@ -57,7 +57,7 @@ class LarcenyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LashOut.java b/Mage.Sets/src/mage/cards/l/LashOut.java index ecb8c5b55de..736b5098fd3 100644 --- a/Mage.Sets/src/mage/cards/l/LashOut.java +++ b/Mage.Sets/src/mage/cards/l/LashOut.java @@ -59,11 +59,11 @@ class LashOutEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && creature != null) { - creature.damage(3, source.getSourceId(), game, false, true); + creature.damage(3, source.getSourceId(), source, game, false, true); if (ClashEffect.getInstance().apply(game, source)) { Player creaturesController = game.getPlayer(creature.getControllerId()); if (creaturesController != null) { - creaturesController.damage(3, source.getSourceId(), game); + creaturesController.damage(3, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java b/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java index 7d7a3538ad0..0ba244f5174 100644 --- a/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java +++ b/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java @@ -71,7 +71,7 @@ class LashknifeBarrierEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LastDitchEffort.java b/Mage.Sets/src/mage/cards/l/LastDitchEffort.java index 8c716344f63..210fa783ccf 100644 --- a/Mage.Sets/src/mage/cards/l/LastDitchEffort.java +++ b/Mage.Sets/src/mage/cards/l/LastDitchEffort.java @@ -65,7 +65,7 @@ class LastDitchEffortEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { numSacrificed++; } } @@ -76,10 +76,10 @@ class LastDitchEffortEffect extends OneShotEffect { Permanent permanent = game.getPermanent(uuid); Player opponent = game.getPlayer(uuid); if (permanent != null) { - permanent.damage(damage, source.getSourceId(), game, false, true); + permanent.damage(damage, source.getSourceId(), source, game, false, true); } if (opponent != null) { - opponent.damage(damage, source.getSourceId(), game); + opponent.damage(damage, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LastRites.java b/Mage.Sets/src/mage/cards/l/LastRites.java index 81d3dcb06b9..245ccc571a7 100644 --- a/Mage.Sets/src/mage/cards/l/LastRites.java +++ b/Mage.Sets/src/mage/cards/l/LastRites.java @@ -79,7 +79,7 @@ class LastRitesEffect extends OneShotEffect { 0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CARDS, controller.getId() ); controller.chooseTarget(Outcome.AIDontUseIt, cardsInHand, target, source, game); - int discardCount = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); + int discardCount = controller.discard(new CardsImpl(target.getTargets()), false, source, game).size(); FilterCard filter = new FilterCard((discardCount > 1 ? "" : "a") + " nonland card" + (discardCount > 1 ? "s" : "")); filter.add(Predicates.not(CardType.LAND.getPredicate())); diff --git a/Mage.Sets/src/mage/cards/l/LastStand.java b/Mage.Sets/src/mage/cards/l/LastStand.java index 1c4ca320256..b40ec3cccd4 100644 --- a/Mage.Sets/src/mage/cards/l/LastStand.java +++ b/Mage.Sets/src/mage/cards/l/LastStand.java @@ -80,14 +80,14 @@ class LastStandEffect extends OneShotEffect { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); if (opponent != null) { int swamps = game.getBattlefield().count(filterSwamp, source.getSourceId(), source.getControllerId(), game); - opponent.loseLife(swamps * 2, game, false); + opponent.loseLife(swamps * 2, game, source, false); } // Last Stand deals damage equal to the number of Mountains you control to target creature. Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { int mountains = game.getBattlefield().count(filterMountain, source.getSourceId(), source.getControllerId(), game); if (mountains > 0) { - creature.damage(mountains, source.getSourceId(), game, false, true); + creature.damage(mountains, source.getSourceId(), source, game, false, true); } } // Create a 1/1 green Saproling creature token for each Forest you control. @@ -101,8 +101,8 @@ class LastStandEffect extends OneShotEffect { // Draw a card for each Island you control, then discard that many cards int islands = game.getBattlefield().count(filterIsland, source.getSourceId(), source.getControllerId(), game); if (islands > 0) { - controller.drawCards(islands, source.getSourceId(), game); - controller.discard(islands, false, source, game); + controller.drawCards(islands, source, game); + controller.discard(islands, false, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/l/LatullasOrders.java b/Mage.Sets/src/mage/cards/l/LatullasOrders.java index 067ca95899f..11acb4a7616 100644 --- a/Mage.Sets/src/mage/cards/l/LatullasOrders.java +++ b/Mage.Sets/src/mage/cards/l/LatullasOrders.java @@ -74,7 +74,7 @@ class LatullasOrdersTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LavaBlister.java b/Mage.Sets/src/mage/cards/l/LavaBlister.java index d2d90228ea5..60d6ab4551d 100644 --- a/Mage.Sets/src/mage/cards/l/LavaBlister.java +++ b/Mage.Sets/src/mage/cards/l/LavaBlister.java @@ -60,9 +60,9 @@ class LavaBlisterEffect extends OneShotEffect { if (player != null) { String message = "Have Lava Blister do 6 damage to you?"; if (player.chooseUse(Outcome.Damage, message, source, game)) { - player.damage(6, source.getSourceId(), game); + player.damage(6, source.getSourceId(), source, game); } else { - permanent.destroy(source.getId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LavaRunner.java b/Mage.Sets/src/mage/cards/l/LavaRunner.java index 6fae02b79cd..ca3cd1af2de 100644 --- a/Mage.Sets/src/mage/cards/l/LavaRunner.java +++ b/Mage.Sets/src/mage/cards/l/LavaRunner.java @@ -63,7 +63,7 @@ class LavaRunnerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LavabrinkFloodgates.java b/Mage.Sets/src/mage/cards/l/LavabrinkFloodgates.java index 6dc1f35714e..6df4bf90c82 100644 --- a/Mage.Sets/src/mage/cards/l/LavabrinkFloodgates.java +++ b/Mage.Sets/src/mage/cards/l/LavabrinkFloodgates.java @@ -90,14 +90,14 @@ class LavabrinkFloodgatesEffect extends OneShotEffect { permanent.addCounters(CounterType.DOOM.createInstance(), source, game); break; case "Remove a doom counter": - permanent.removeCounters(CounterType.DOOM.createInstance(), game); + permanent.removeCounters(CounterType.DOOM.createInstance(), source, game); break; case "Do nothing": default: break; } if (permanent.getCounters(game).getCount(CounterType.DOOM) < 3 - || !permanent.sacrifice(source.getSourceId(), game)) { + || !permanent.sacrifice(source, game)) { return true; } game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/l/LavaclawReaches.java b/Mage.Sets/src/mage/cards/l/LavaclawReaches.java index 5fbb00c6e37..17ec98d835e 100644 --- a/Mage.Sets/src/mage/cards/l/LavaclawReaches.java +++ b/Mage.Sets/src/mage/cards/l/LavaclawReaches.java @@ -1,4 +1,3 @@ - package mage.cards.l; import java.util.UUID; @@ -31,9 +30,11 @@ public final class LavaclawReaches extends CardImpl { // Lavaclaw Reaches enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); + // {T}: Add {B} or {R}. this.addAbility(new BlackManaAbility()); this.addAbility(new RedManaAbility()); + // {1}{B}{R}: Until end of turn, Lavaclaw Reaches becomes a 2/2 black and red Elemental creature with ": This creature gets +X/+0 until end of turn." It's still a land. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new LavaclawReachesToken(), "land", Duration.EndOfTurn), new ManaCostsImpl("{1}{B}{R}"))); } diff --git a/Mage.Sets/src/mage/cards/l/Lavalanche.java b/Mage.Sets/src/mage/cards/l/Lavalanche.java index 1d07ef40830..b41c20de698 100644 --- a/Mage.Sets/src/mage/cards/l/Lavalanche.java +++ b/Mage.Sets/src/mage/cards/l/Lavalanche.java @@ -68,13 +68,13 @@ class LavalancheEffect extends OneShotEffect { if (targetPlayer == null) { return false; } - targetPlayer.damage(amount.calculate(game, source, this), source.getSourceId(), game); + targetPlayer.damage(amount.calculate(game, source, this), source.getSourceId(), source, game); FilterPermanent filter = new FilterPermanent("and each creature that player or that planeswalker's controller controls"); filter.add(CardType.CREATURE.getPredicate()); filter.add(new ControllerIdPredicate(targetPlayer.getId())); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LearnFromThePast.java b/Mage.Sets/src/mage/cards/l/LearnFromThePast.java index 1c4b6f96eb5..c9a8514023b 100644 --- a/Mage.Sets/src/mage/cards/l/LearnFromThePast.java +++ b/Mage.Sets/src/mage/cards/l/LearnFromThePast.java @@ -63,7 +63,7 @@ class LearnFromThePastEffect extends OneShotEffect { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { for (Card card: player.getGraveyard().getCards(game)) { - player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + player.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/l/Leashling.java b/Mage.Sets/src/mage/cards/l/Leashling.java index c4dfc5cd1e2..64862e28aae 100644 --- a/Mage.Sets/src/mage/cards/l/Leashling.java +++ b/Mage.Sets/src/mage/cards/l/Leashling.java @@ -70,7 +70,7 @@ class PutCardFromHandOnTopOfLibrary extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { return !controller.getHand().isEmpty(); @@ -79,7 +79,7 @@ class PutCardFromHandOnTopOfLibrary extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { TargetCardInHand target = new TargetCardInHand(); diff --git a/Mage.Sets/src/mage/cards/l/LeaveChance.java b/Mage.Sets/src/mage/cards/l/LeaveChance.java index 00c6923f172..a756848d9a5 100644 --- a/Mage.Sets/src/mage/cards/l/LeaveChance.java +++ b/Mage.Sets/src/mage/cards/l/LeaveChance.java @@ -82,8 +82,8 @@ class ChanceEffect extends OneShotEffect { } TargetCard target = new TargetDiscard(0, controller.getHand().size(), StaticFilters.FILTER_CARD_CARDS, controller.getId()); controller.chooseTarget(outcome, controller.getHand(), target, source, game); - int amount = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); - controller.drawCards(amount, source.getSourceId(), game); + int amount = controller.discard(new CardsImpl(target.getTargets()), false, source, game).size(); + controller.drawCards(amount, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/l/LeaveNoTrace.java b/Mage.Sets/src/mage/cards/l/LeaveNoTrace.java index ae8ce756abd..82824ecea11 100644 --- a/Mage.Sets/src/mage/cards/l/LeaveNoTrace.java +++ b/Mage.Sets/src/mage/cards/l/LeaveNoTrace.java @@ -64,10 +64,10 @@ class LeaveNoTraceEffect extends OneShotEffect { Permanent target = game.getPermanent(targetPointer.getFirst(game, source)); if (target != null) { ObjectColor color = target.getColor(game); - target.destroy(source.getSourceId(), game, false); + target.destroy(source, game, false); for (Permanent p : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (p.getColor(game).shares(color)) { - p.destroy(source.getSourceId(), game, false); + p.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LedevChampion.java b/Mage.Sets/src/mage/cards/l/LedevChampion.java index 10303e8e7d2..cbce2412634 100644 --- a/Mage.Sets/src/mage/cards/l/LedevChampion.java +++ b/Mage.Sets/src/mage/cards/l/LedevChampion.java @@ -80,12 +80,12 @@ class LedevChampionEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int tappedAmount = 0; TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); - if (target.canChoose(source.getControllerId(), game) + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { for (UUID creatureId : target.getTargets()) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { - creature.tap(game); + creature.tap(source, game); tappedAmount++; } } diff --git a/Mage.Sets/src/mage/cards/l/LeechBonder.java b/Mage.Sets/src/mage/cards/l/LeechBonder.java index 7b7b48d3b76..6eebe1c4f09 100644 --- a/Mage.Sets/src/mage/cards/l/LeechBonder.java +++ b/Mage.Sets/src/mage/cards/l/LeechBonder.java @@ -113,7 +113,7 @@ class LeechBonderEffect extends OneShotEffect { CounterType counterType = CounterType.findByName(chosen); if (counterType != null) { Counter counter = counterType.createInstance(); - fromPermanent.removeCounters(counterType.getName(), 1, game); + fromPermanent.removeCounters(counterType.getName(), 1, source, game); toPermanent.addCounters(counter, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/l/Leeches.java b/Mage.Sets/src/mage/cards/l/Leeches.java index fb0c7945d41..9739b3c8900 100644 --- a/Mage.Sets/src/mage/cards/l/Leeches.java +++ b/Mage.Sets/src/mage/cards/l/Leeches.java @@ -63,7 +63,7 @@ class LeechesEffect extends OneShotEffect { int countPoisonCounters = targetPlayer.getCounters().getCount(CounterType.POISON); if (countPoisonCounters > 0) { targetPlayer.removeCounters(CounterType.POISON.getName(), countPoisonCounters, source, game); - targetPlayer.damage(countPoisonCounters, source.getSourceId(), game); + targetPlayer.damage(countPoisonCounters, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LeechriddenSwamp.java b/Mage.Sets/src/mage/cards/l/LeechriddenSwamp.java index a8231f80036..1240f64a437 100644 --- a/Mage.Sets/src/mage/cards/l/LeechriddenSwamp.java +++ b/Mage.Sets/src/mage/cards/l/LeechriddenSwamp.java @@ -87,7 +87,7 @@ class LeechriddenSwampLoseLifeEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(controller.getId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.loseLife(1, game, false); + opponent.loseLife(1, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LegionsInitiative.java b/Mage.Sets/src/mage/cards/l/LegionsInitiative.java index ad9eff62a91..694d0e1f8a1 100644 --- a/Mage.Sets/src/mage/cards/l/LegionsInitiative.java +++ b/Mage.Sets/src/mage/cards/l/LegionsInitiative.java @@ -87,7 +87,7 @@ class LegionsInitiativeExileEffect extends OneShotEffect { boolean creatureExiled = false; for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (creature != null) { - if (creature.moveToExile(source.getSourceId(), "Legion's Initiative", source.getSourceId(), game)) { + if (creature.moveToExile(source.getSourceId(), "Legion's Initiative", source, game)) { creatureExiled = true; } } @@ -130,7 +130,7 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect { for (UUID cardId : exile) { Card card = game.getCard(cardId); if (card != null) { - card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + card.moveToZone(Zone.BATTLEFIELD, source, game, false); Permanent returnedCreature = game.getPermanent(cardId); if (returnedCreature != null) { ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); diff --git a/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java b/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java index 675371692d4..fa3d4dacc02 100644 --- a/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java +++ b/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java @@ -69,6 +69,11 @@ class LeovoldEmissaryOfTrestEffect extends ContinuousRuleModifyingEffectImpl { return event.getType() == GameEvent.EventType.DRAW_CARD; } + @Override + public boolean apply(Game game, Ability source) { + return true; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { CardsAmountDrawnThisTurnWatcher watcher = game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class); diff --git a/Mage.Sets/src/mage/cards/l/LethalSting.java b/Mage.Sets/src/mage/cards/l/LethalSting.java index 74dc5a304ba..c924928f520 100644 --- a/Mage.Sets/src/mage/cards/l/LethalSting.java +++ b/Mage.Sets/src/mage/cards/l/LethalSting.java @@ -57,7 +57,7 @@ class LethalStingCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controllerId, game)) { return permanent != null; } @@ -65,7 +65,7 @@ class LethalStingCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(ability.getControllerId()); if (controller != null) { Target target = new TargetControlledCreaturePermanent(); diff --git a/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java b/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java index 95b42231462..e6c0866bd99 100644 --- a/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java +++ b/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java @@ -67,7 +67,7 @@ class LeylineOfLifeforceEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER; + return event.getType() == GameEvent.EventType.COUNTER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LeylineOfLightning.java b/Mage.Sets/src/mage/cards/l/LeylineOfLightning.java index 649ade746d8..dd9c03dcfef 100644 --- a/Mage.Sets/src/mage/cards/l/LeylineOfLightning.java +++ b/Mage.Sets/src/mage/cards/l/LeylineOfLightning.java @@ -63,7 +63,7 @@ class LeylineOfLightningEffect extends DamageTargetEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { Cost cost = ManaUtil.createManaCost(1, false); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { super.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/l/LeylineOfPunishment.java b/Mage.Sets/src/mage/cards/l/LeylineOfPunishment.java index 80fc6fe4419..fa58fcec553 100644 --- a/Mage.Sets/src/mage/cards/l/LeylineOfPunishment.java +++ b/Mage.Sets/src/mage/cards/l/LeylineOfPunishment.java @@ -64,7 +64,7 @@ class LeylineOfPunishmentEffect2 extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.PREVENT_DAMAGE; + return event.getType() == GameEvent.EventType.PREVENT_DAMAGE; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LeylineOfTheVoid.java b/Mage.Sets/src/mage/cards/l/LeylineOfTheVoid.java index a1b0543e43d..5a004ca2fef 100644 --- a/Mage.Sets/src/mage/cards/l/LeylineOfTheVoid.java +++ b/Mage.Sets/src/mage/cards/l/LeylineOfTheVoid.java @@ -64,26 +64,13 @@ class LeylineOfTheVoidEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - if (permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); - } - } else { - Card card = game.getCard(event.getTargetId()); - if (card != null) { - return controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LeylinePhantom.java b/Mage.Sets/src/mage/cards/l/LeylinePhantom.java index 50f8cb929f4..f02a6eec789 100644 --- a/Mage.Sets/src/mage/cards/l/LeylinePhantom.java +++ b/Mage.Sets/src/mage/cards/l/LeylinePhantom.java @@ -58,7 +58,7 @@ class LeylinePhantomTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE || event.getType() == EventType.DAMAGED_PLANESWALKER || event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LeylineTyrant.java b/Mage.Sets/src/mage/cards/l/LeylineTyrant.java index e9605d006cb..d2c5c948cfb 100644 --- a/Mage.Sets/src/mage/cards/l/LeylineTyrant.java +++ b/Mage.Sets/src/mage/cards/l/LeylineTyrant.java @@ -125,7 +125,7 @@ class LeylineTyrantDamageEffect extends OneShotEffect { } Cost cost = new ManaCostsImpl<>(manaString); cost.clearPaid(); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (!cost.pay(source, game, source, source.getControllerId(), false)) { return false; } ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/l/Liability.java b/Mage.Sets/src/mage/cards/l/Liability.java index 0c1930b7ede..eea68cafb71 100644 --- a/Mage.Sets/src/mage/cards/l/Liability.java +++ b/Mage.Sets/src/mage/cards/l/Liability.java @@ -67,7 +67,7 @@ class LiabilityEffect extends OneShotEffect { if (permanent != null) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { - controller.loseLife(1, game, false); + controller.loseLife(1, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/l/LiarsPendulum.java b/Mage.Sets/src/mage/cards/l/LiarsPendulum.java index 078496adf96..1fbed209213 100644 --- a/Mage.Sets/src/mage/cards/l/LiarsPendulum.java +++ b/Mage.Sets/src/mage/cards/l/LiarsPendulum.java @@ -93,7 +93,7 @@ class LiarsPendulumEffect extends OneShotEffect { if (controller.chooseUse(outcome, "Reveal your hand?", source, game)) { controller.revealCards("hand of " + controller.getName(), controller.getHand(), game); if (!rightGuess) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/Liberate.java b/Mage.Sets/src/mage/cards/l/Liberate.java index bea0f074996..5732859b626 100644 --- a/Mage.Sets/src/mage/cards/l/Liberate.java +++ b/Mage.Sets/src/mage/cards/l/Liberate.java @@ -56,7 +56,7 @@ class LiberateEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); MageObject sourceObject = game.getObject(source.getSourceId()); if (permanent != null && sourceObject != null) { - if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source, game)) { Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step"); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game)); diff --git a/Mage.Sets/src/mage/cards/l/LibraryOfLeng.java b/Mage.Sets/src/mage/cards/l/LibraryOfLeng.java index 181472deff6..add066257ed 100644 --- a/Mage.Sets/src/mage/cards/l/LibraryOfLeng.java +++ b/Mage.Sets/src/mage/cards/l/LibraryOfLeng.java @@ -68,8 +68,8 @@ class LibraryOfLengEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARD_CARD - || event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.DISCARD_CARD + || event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -77,10 +77,10 @@ class LibraryOfLengEffect extends ReplacementEffectImpl { // rules: // You can’t use the Library of Leng ability to place a discarded card on top of your library when you discard a card as a cost, // because costs aren’t effects. (2004-10-04) - if (event.getType() == EventType.DISCARD_CARD && event.getFlag()) { + if (event.getType() == GameEvent.EventType.DISCARD_CARD && event.getFlag()) { return event.getPlayerId().equals(source.getControllerId()); } - if (event.getType() == EventType.ZONE_CHANGE) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { if (event.getTargetId().equals(cardId) && game.getState().getZoneChangeCounter(event.getTargetId()) == zoneChangeCounter) { return ((ZoneChangeEvent) event).getFromZone() == Zone.HAND && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD; } @@ -90,7 +90,7 @@ class LibraryOfLengEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.DISCARD_CARD) { + if (event.getType() == GameEvent.EventType.DISCARD_CARD) { // only save card info Card card = game.getCard(event.getTargetId()); if (card != null) { @@ -99,7 +99,7 @@ class LibraryOfLengEffect extends ReplacementEffectImpl { } return false; } - if (event.getType() == EventType.ZONE_CHANGE) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { Player controller = game.getPlayer(source.getControllerId()); Card card = game.getCard(event.getTargetId()); if (controller != null && card != null) { diff --git a/Mage.Sets/src/mage/cards/l/Lich.java b/Mage.Sets/src/mage/cards/l/Lich.java index 6eee63d51aa..98a6335e734 100644 --- a/Mage.Sets/src/mage/cards/l/Lich.java +++ b/Mage.Sets/src/mage/cards/l/Lich.java @@ -86,14 +86,14 @@ class LichLifeGainReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(event.getPlayerId()); if (controller != null) { - controller.drawCards(event.getAmount(), source.getSourceId(), game); + controller.drawCards(event.getAmount(), source, game); // original event is not a draw event, so skip it in params } return true; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAIN_LIFE; + return event.getType() == GameEvent.EventType.GAIN_LIFE; } @Override @@ -119,7 +119,7 @@ class LichDamageTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -175,7 +175,7 @@ class LichDamageEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LichsMirror.java b/Mage.Sets/src/mage/cards/l/LichsMirror.java index 8c7e4a669f9..2ad3ef55450 100644 --- a/Mage.Sets/src/mage/cards/l/LichsMirror.java +++ b/Mage.Sets/src/mage/cards/l/LichsMirror.java @@ -75,7 +75,7 @@ class LichsMirrorEffect extends ReplacementEffectImpl { } player.shuffleCardsToLibrary(toLib, game, source); game.getState().processAction(game); - player.drawCards(7, source.getSourceId(), game); + player.drawCards(7, source, game); // original event is not a draw event, so skip it in params player.setLife(20, game, source); } return true; // replace the loses event diff --git a/Mage.Sets/src/mage/cards/l/LichsTomb.java b/Mage.Sets/src/mage/cards/l/LichsTomb.java index e87edd1fbcf..4fa48ff0f9c 100644 --- a/Mage.Sets/src/mage/cards/l/LichsTomb.java +++ b/Mage.Sets/src/mage/cards/l/LichsTomb.java @@ -61,7 +61,7 @@ class LichsTombTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_LIFE; + return event.getType() == GameEvent.EventType.LOST_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java b/Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java index dc3267a00d9..215df4b6dcd 100644 --- a/Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java +++ b/Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java @@ -81,7 +81,7 @@ class LiegeOfTheHollowsEffect extends OneShotEffect { : paidMana.entrySet()) { Player player = game.getPlayer(entry.getKey()); if (player != null) { - token.putOntoBattlefield(entry.getValue(), game, source.getSourceId(), player.getId()); + token.putOntoBattlefield(entry.getValue(), game, source, player.getId()); } } game.getState().processAction(game); diff --git a/Mage.Sets/src/mage/cards/l/LiegeOfThePit.java b/Mage.Sets/src/mage/cards/l/LiegeOfThePit.java index 4fc137814cb..ce609635e1f 100644 --- a/Mage.Sets/src/mage/cards/l/LiegeOfThePit.java +++ b/Mage.Sets/src/mage/cards/l/LiegeOfThePit.java @@ -88,11 +88,11 @@ class LiegeOfThePitEffect extends OneShotEffect { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } else { - player.damage(7, source.getSourceId(), game); + player.damage(7, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java b/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java index dfaa32d75a4..4359397ae83 100644 --- a/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java +++ b/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java @@ -71,7 +71,7 @@ class LiegeOfTheTangleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LifeDeath.java b/Mage.Sets/src/mage/cards/l/LifeDeath.java index 05a6cd90abf..411eec2dfd3 100644 --- a/Mage.Sets/src/mage/cards/l/LifeDeath.java +++ b/Mage.Sets/src/mage/cards/l/LifeDeath.java @@ -79,7 +79,7 @@ class DeathEffect extends OneShotEffect { if (game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) { controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game); } - controller.loseLife(creatureCard.getConvertedManaCost(), game, false); + controller.loseLife(creatureCard.getConvertedManaCost(), game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LifebloodHydra.java b/Mage.Sets/src/mage/cards/l/LifebloodHydra.java index 7a772125413..1ec26f7ce56 100644 --- a/Mage.Sets/src/mage/cards/l/LifebloodHydra.java +++ b/Mage.Sets/src/mage/cards/l/LifebloodHydra.java @@ -76,7 +76,7 @@ class LifebloodHydraEffect extends OneShotEffect { Permanent diedPermanent = (Permanent) getValue("permanentLeftBattlefield"); if (diedPermanent != null) { controller.gainLife(diedPermanent.getPower().getValue(), game, source); - controller.drawCards(diedPermanent.getPower().getValue(), source.getSourceId(), game); + controller.drawCards(diedPermanent.getPower().getValue(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LifesFinale.java b/Mage.Sets/src/mage/cards/l/LifesFinale.java index 181dedf212c..5b142d8647f 100644 --- a/Mage.Sets/src/mage/cards/l/LifesFinale.java +++ b/Mage.Sets/src/mage/cards/l/LifesFinale.java @@ -63,7 +63,7 @@ class LifesFinaleEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), game); for (Permanent permanent : permanents) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } Player opponent = game.getPlayer(source.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/l/LifesLegacy.java b/Mage.Sets/src/mage/cards/l/LifesLegacy.java index bb093b9b0e8..140a76f3222 100644 --- a/Mage.Sets/src/mage/cards/l/LifesLegacy.java +++ b/Mage.Sets/src/mage/cards/l/LifesLegacy.java @@ -66,7 +66,7 @@ class LifesLegacyEffect extends OneShotEffect { } } if (power > 0) { - controller.drawCards(power, source.getSourceId(), game); + controller.drawCards(power, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/Lifesmith.java b/Mage.Sets/src/mage/cards/l/Lifesmith.java index 86768347b6c..45425a6e2e8 100644 --- a/Mage.Sets/src/mage/cards/l/Lifesmith.java +++ b/Mage.Sets/src/mage/cards/l/Lifesmith.java @@ -56,7 +56,7 @@ class LifesmithEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Cost cost = ManaUtil.createManaCost(1, false); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(3, game, source); diff --git a/Mage.Sets/src/mage/cards/l/LightmineField.java b/Mage.Sets/src/mage/cards/l/LightmineField.java index 04a5e0b2b58..ff95445d052 100644 --- a/Mage.Sets/src/mage/cards/l/LightmineField.java +++ b/Mage.Sets/src/mage/cards/l/LightmineField.java @@ -61,7 +61,7 @@ class LightmineFieldTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override @@ -111,7 +111,7 @@ class LightmineFieldEffect extends OneShotEffect { MageObjectReference attacker = it.next(); Permanent creature = attacker.getPermanent(game); if (creature != null) { - creature.damage(damage, source.getSourceId(), game, false, true); + creature.damage(damage, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LightningCoils.java b/Mage.Sets/src/mage/cards/l/LightningCoils.java index fbc516c5b5d..7a499f98a3e 100644 --- a/Mage.Sets/src/mage/cards/l/LightningCoils.java +++ b/Mage.Sets/src/mage/cards/l/LightningCoils.java @@ -78,7 +78,7 @@ class LightningCoilsEffect extends OneShotEffect { int counters = p.getCounters(game).getCount(CounterType.CHARGE); if (counters >= 5) { // remove all the counters and create that many tokens - p.removeCounters(CounterType.CHARGE.getName(), p.getCounters(game).getCount(CounterType.CHARGE), game); + p.removeCounters(CounterType.CHARGE.getName(), p.getCounters(game).getCount(CounterType.CHARGE), source, game); CreateTokenEffect effect = new CreateTokenEffect(new ElementalTokenWithHaste(), counters); effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/l/LightningDart.java b/Mage.Sets/src/mage/cards/l/LightningDart.java index dd3b9464e03..6996281b276 100644 --- a/Mage.Sets/src/mage/cards/l/LightningDart.java +++ b/Mage.Sets/src/mage/cards/l/LightningDart.java @@ -61,7 +61,7 @@ public final class LightningDart extends CardImpl { if (color.isWhite() || color.isBlue()) { damage = 4; } - permanent.damage(damage, source.getId(), game, false, false); + permanent.damage(damage, source.getId(), source, game, false, false); } return false; diff --git a/Mage.Sets/src/mage/cards/l/LightningReaver.java b/Mage.Sets/src/mage/cards/l/LightningReaver.java index 855ead32bad..764448cfd72 100644 --- a/Mage.Sets/src/mage/cards/l/LightningReaver.java +++ b/Mage.Sets/src/mage/cards/l/LightningReaver.java @@ -74,7 +74,7 @@ class DamageOpponentsEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LightningRunner.java b/Mage.Sets/src/mage/cards/l/LightningRunner.java index e85f3992f04..c4c3c39b6ee 100644 --- a/Mage.Sets/src/mage/cards/l/LightningRunner.java +++ b/Mage.Sets/src/mage/cards/l/LightningRunner.java @@ -81,7 +81,7 @@ class LightningRunnerEffect extends OneShotEffect { "Pay {E}{E}{E}{E}{E}{E}{E}{E} to use this? ", "Untap all creatures you control and after this phase, there is an additional combat phase.", "Yes", "No", source, game) - && cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + && cost.pay(source, game, source, source.getControllerId(), true)) { new UntapAllControllerEffect(new FilterControlledCreaturePermanent()).apply(game, source); new AdditionalCombatPhaseEffect().apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/l/LightwielderPaladin.java b/Mage.Sets/src/mage/cards/l/LightwielderPaladin.java index a7fffb3ca74..11e742a53fc 100644 --- a/Mage.Sets/src/mage/cards/l/LightwielderPaladin.java +++ b/Mage.Sets/src/mage/cards/l/LightwielderPaladin.java @@ -68,7 +68,7 @@ class LightwielderPaladinTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LilianaDeathMage.java b/Mage.Sets/src/mage/cards/l/LilianaDeathMage.java index 0e1d8341ce4..4c7d3bb390e 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaDeathMage.java +++ b/Mage.Sets/src/mage/cards/l/LilianaDeathMage.java @@ -114,7 +114,7 @@ class LilianaDeathMageUltimateEffect extends OneShotEffect { Player opponent = game.getPlayer(source.getFirstTarget()); if (opponent != null) { int amount = opponent.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game); - opponent.loseLife(amount * 2, game, false); + opponent.loseLife(amount * 2, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LilianaDreadhordeGeneral.java b/Mage.Sets/src/mage/cards/l/LilianaDreadhordeGeneral.java index 5b77db31f2a..a3aae6bee5a 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaDreadhordeGeneral.java +++ b/Mage.Sets/src/mage/cards/l/LilianaDreadhordeGeneral.java @@ -109,7 +109,7 @@ class LilianaDreadhordeGeneralEffect extends OneShotEffect { } for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (keepFilter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LilianaOfTheVeil.java b/Mage.Sets/src/mage/cards/l/LilianaOfTheVeil.java index 88d49d3ec96..0bfab14b8ee 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaOfTheVeil.java +++ b/Mage.Sets/src/mage/cards/l/LilianaOfTheVeil.java @@ -118,7 +118,7 @@ class LilianaOfTheVeilEffect extends OneShotEffect { private void sacrificePermanents(List pile, Game game, Ability source) { for (Permanent permanent : pile) { if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/l/LilianaWakerOfTheDead.java b/Mage.Sets/src/mage/cards/l/LilianaWakerOfTheDead.java index 56a80487022..81087aab8eb 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaWakerOfTheDead.java +++ b/Mage.Sets/src/mage/cards/l/LilianaWakerOfTheDead.java @@ -109,9 +109,9 @@ class LilianaWakerOfTheDeadDiscardEffect extends OneShotEffect { if (player == null) { continue; } - int amountDiscarded = player.discard(cardsToDiscard.get(playerId), source, game).size(); + int amountDiscarded = player.discard(cardsToDiscard.get(playerId), false, source, game).size(); if (controller.hasOpponent(playerId, game) && amountDiscarded == 0) { - player.loseLife(3, game, false); + player.loseLife(3, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LilianasDefeat.java b/Mage.Sets/src/mage/cards/l/LilianasDefeat.java index 02bedc3b11f..6779aeee008 100644 --- a/Mage.Sets/src/mage/cards/l/LilianasDefeat.java +++ b/Mage.Sets/src/mage/cards/l/LilianasDefeat.java @@ -66,12 +66,12 @@ class LilianasDefeatEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (player != null && permanent != null) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); game.getState().processAction(game); if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.LILIANA, game)) { Player permanentController = game.getPlayer(permanent.getControllerId()); if (permanentController != null) { - permanentController.loseLife(3, game, false); + permanentController.loseLife(3, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LilianasIndignation.java b/Mage.Sets/src/mage/cards/l/LilianasIndignation.java index 3456d56f29f..b86ec5916f4 100644 --- a/Mage.Sets/src/mage/cards/l/LilianasIndignation.java +++ b/Mage.Sets/src/mage/cards/l/LilianasIndignation.java @@ -76,7 +76,7 @@ class LilianasIndignationEffect extends OneShotEffect { if (creatures > 0) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { - targetPlayer.loseLife(creatures, game, false); + targetPlayer.loseLife(creatures, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LimDulsHex.java b/Mage.Sets/src/mage/cards/l/LimDulsHex.java index fcb84afacbf..598f5e40cce 100644 --- a/Mage.Sets/src/mage/cards/l/LimDulsHex.java +++ b/Mage.Sets/src/mage/cards/l/LimDulsHex.java @@ -64,9 +64,9 @@ class LimDulsHexEffect extends OneShotEffect { OrCost costToPay = new OrCost(new ManaCostsImpl("{B}"), new ManaCostsImpl("{3}"), "{B} or {3}"); costToPay.clearPaid(); String message = "Would you like to pay " + costToPay.getText() + " to prevent 1 damage from " + sourcePermanent.getLogName() + "?"; - if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, source.getSourceId(), player.getId(), false, null))) { + if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, source, player.getId(), false, null))) { game.informPlayers(player.getLogName() + " chooses not to pay " + costToPay.getText() + " to prevent 1 damage from " + sourcePermanent.getLogName()); - player.damage(1, sourcePermanent.getId(), game); + player.damage(1, sourcePermanent.getId(), source, game); } else { game.informPlayers(player.getLogName() + " chooses to pay " + costToPay.getText() + " to prevent 1 damage from " + sourcePermanent.getLogName()); } diff --git a/Mage.Sets/src/mage/cards/l/LimDulsVault.java b/Mage.Sets/src/mage/cards/l/LimDulsVault.java index 41319e0dec1..4a6c0c96e8c 100644 --- a/Mage.Sets/src/mage/cards/l/LimDulsVault.java +++ b/Mage.Sets/src/mage/cards/l/LimDulsVault.java @@ -67,7 +67,7 @@ class LimDulsVaultEffect extends OneShotEffect { doAgain = player.chooseUse(outcome, "Pay 1 life and look at the next 5 cards?", source, game); if (doAgain) { - player.loseLife(1, game, false); + player.loseLife(1, game, source, false); player.putCardsOnBottomOfLibrary(cards, game, source, true); } else { player.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/l/LimitedResources.java b/Mage.Sets/src/mage/cards/l/LimitedResources.java index 5d27acdf1c5..becbea6eed4 100644 --- a/Mage.Sets/src/mage/cards/l/LimitedResources.java +++ b/Mage.Sets/src/mage/cards/l/LimitedResources.java @@ -82,7 +82,7 @@ class LimitedResourcesEffect extends OneShotEffect { target.setRequired(true); player.chooseTarget(outcome.Benefit, target, source, game); game.getBattlefield().getAllActivePermanents(new FilterControlledLandPermanent(), playerId, game).stream().filter((land) -> (!target.getTargets().contains(land.getId()))).forEachOrdered((land) -> { - land.sacrifice(source.getSourceId(), game); + land.sacrifice(source, game); }); } }); diff --git a/Mage.Sets/src/mage/cards/l/LiquidFire.java b/Mage.Sets/src/mage/cards/l/LiquidFire.java index 59bd62d9023..afefc07765d 100644 --- a/Mage.Sets/src/mage/cards/l/LiquidFire.java +++ b/Mage.Sets/src/mage/cards/l/LiquidFire.java @@ -64,10 +64,10 @@ public final class LiquidFire extends CardImpl { int creatureDamage = choiceValue.calculate(game, source, this); int playerDamage = 5 - creatureDamage; if (target != null) { - target.damage(creatureDamage, source.getSourceId(), game); + target.damage(creatureDamage, source.getSourceId(), source, game); Player controller = game.getPlayer(target.getControllerId()); if (controller != null) { - controller.damage(playerDamage, source.getSourceId(), game); + controller.damage(playerDamage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LivewireLash.java b/Mage.Sets/src/mage/cards/l/LivewireLash.java index 7013e77e086..a70633c63ac 100644 --- a/Mage.Sets/src/mage/cards/l/LivewireLash.java +++ b/Mage.Sets/src/mage/cards/l/LivewireLash.java @@ -66,7 +66,7 @@ class LivewireLashAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LivingArtifact.java b/Mage.Sets/src/mage/cards/l/LivingArtifact.java index df0a4ce70ad..825324c53e0 100644 --- a/Mage.Sets/src/mage/cards/l/LivingArtifact.java +++ b/Mage.Sets/src/mage/cards/l/LivingArtifact.java @@ -80,7 +80,7 @@ class LivingArtifactTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LivingInferno.java b/Mage.Sets/src/mage/cards/l/LivingInferno.java index 50e31e74718..025baa764fe 100644 --- a/Mage.Sets/src/mage/cards/l/LivingInferno.java +++ b/Mage.Sets/src/mage/cards/l/LivingInferno.java @@ -89,14 +89,14 @@ class LivingInfernoEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target); if (permanent != null) { permanents.add(permanent); - permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), game, false, true); + permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), source, game, false, true); } } // Each of those creatures deals damage equal to its power to Living Inferno Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sourceCreature != null) { for (Permanent permanent : permanents) { - sourceCreature.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); + sourceCreature.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LivingLore.java b/Mage.Sets/src/mage/cards/l/LivingLore.java index 8d945dd089a..8c96ba2c7cc 100644 --- a/Mage.Sets/src/mage/cards/l/LivingLore.java +++ b/Mage.Sets/src/mage/cards/l/LivingLore.java @@ -170,7 +170,7 @@ class LivingLoreSacrificeEffect extends OneShotEffect { if (permanent != null && mageObject != null && new MageObjectReference(permanent, game).refersTo(mageObject, game)) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); if (exileId != null) { diff --git a/Mage.Sets/src/mage/cards/l/LlanowarSentinel.java b/Mage.Sets/src/mage/cards/l/LlanowarSentinel.java index 0959a24b179..b169decf400 100644 --- a/Mage.Sets/src/mage/cards/l/LlanowarSentinel.java +++ b/Mage.Sets/src/mage/cards/l/LlanowarSentinel.java @@ -68,7 +68,7 @@ class LlanowarSentinelEffect extends OneShotEffect { if(player != null) { if(player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {1}{G}?", source, game)) { Cost cost = new ManaCostsImpl("{1}{G}"); - if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if(cost.pay(source, game, source, source.getControllerId(), false, null)) { FilterCard filter = new FilterCard("card named Llanowar Sentinel"); filter.add(new NamePredicate("Llanowar Sentinel")); new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter), false, true).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/l/LobeLobber.java b/Mage.Sets/src/mage/cards/l/LobeLobber.java index 1291d059453..e376e2225de 100644 --- a/Mage.Sets/src/mage/cards/l/LobeLobber.java +++ b/Mage.Sets/src/mage/cards/l/LobeLobber.java @@ -72,8 +72,8 @@ class LobeLobberEffect extends OneShotEffect { Player player = game.getPlayer(source.getFirstTarget()); if (controller != null && equipment != null && player != null) { - player.damage(1, source.getSourceId(), game); - int amount = controller.rollDice(game, 6); + player.damage(1, source.getSourceId(), source, game); + int amount = controller.rollDice(source, game, 6); if (amount >= 5) { new UntapSourceEffect().apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/l/LoneRevenant.java b/Mage.Sets/src/mage/cards/l/LoneRevenant.java index 23122d69372..83858bdd86e 100644 --- a/Mage.Sets/src/mage/cards/l/LoneRevenant.java +++ b/Mage.Sets/src/mage/cards/l/LoneRevenant.java @@ -68,7 +68,7 @@ class LoneRevenantTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LongRoadHome.java b/Mage.Sets/src/mage/cards/l/LongRoadHome.java index 0df41345bf4..6b9380ec704 100644 --- a/Mage.Sets/src/mage/cards/l/LongRoadHome.java +++ b/Mage.Sets/src/mage/cards/l/LongRoadHome.java @@ -66,7 +66,7 @@ class LongRoadHomeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Long Road Home", source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), "Long Road Home", source, game)) { ExileZone exile = game.getExile().getExileZone(source.getSourceId()); // only if permanent is in exile (tokens would be stop to exist) if (exile != null && !exile.isEmpty()) { @@ -147,12 +147,12 @@ class LongRoadHomeEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { return event.getTargetId().equals(objectToReturn.getSourceId()); } return false; diff --git a/Mage.Sets/src/mage/cards/l/LonghornFirebeast.java b/Mage.Sets/src/mage/cards/l/LonghornFirebeast.java index 766f8efbab2..89160b06896 100644 --- a/Mage.Sets/src/mage/cards/l/LonghornFirebeast.java +++ b/Mage.Sets/src/mage/cards/l/LonghornFirebeast.java @@ -63,8 +63,8 @@ class LonghornFirebeastEffect extends OneShotEffect { Player opponent = game.getPlayer(opponentUuid); if (opponent != null && opponent.chooseUse(Outcome.LoseLife, "Make " + permanent.getLogName() + " deal 5 damage to you?", source, game)) { game.informPlayers(opponent.getLogName() + " has chosen to receive 5 damage from " + permanent.getLogName()); - opponent.damage(5, permanent.getId(), game); - permanent.sacrifice(source.getSourceId(), game); + opponent.damage(5, permanent.getId(), source, game); + permanent.sacrifice(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/l/LordOfShatterskullPass.java b/Mage.Sets/src/mage/cards/l/LordOfShatterskullPass.java index b0fb70c7a27..28fdc9227a7 100644 --- a/Mage.Sets/src/mage/cards/l/LordOfShatterskullPass.java +++ b/Mage.Sets/src/mage/cards/l/LordOfShatterskullPass.java @@ -88,7 +88,7 @@ class LordOfShatterskullPassEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(defenderId)); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.damage(6, source.getSourceId(), game, false, true); + permanent.damage(6, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LordOfThePit.java b/Mage.Sets/src/mage/cards/l/LordOfThePit.java index 3db78560776..119710c9a26 100644 --- a/Mage.Sets/src/mage/cards/l/LordOfThePit.java +++ b/Mage.Sets/src/mage/cards/l/LordOfThePit.java @@ -84,11 +84,11 @@ class LordOfThePitEffect extends OneShotEffect { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } else { - player.damage(7, source.getSourceId(), game); + player.damage(7, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LordWindgrace.java b/Mage.Sets/src/mage/cards/l/LordWindgrace.java index 9e4fcc1a9bb..4f849694ed2 100644 --- a/Mage.Sets/src/mage/cards/l/LordWindgrace.java +++ b/Mage.Sets/src/mage/cards/l/LordWindgrace.java @@ -101,11 +101,11 @@ class LordWindgraceEffect extends OneShotEffect { if (player == null) { return false; } - Card card = player.discardOne(false, source, game); + Card card = player.discardOne(false, false, source, game); if (card == null || !card.isLand()) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } else { - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LostInTheMist.java b/Mage.Sets/src/mage/cards/l/LostInTheMist.java index 0b2e5925700..304a1066950 100644 --- a/Mage.Sets/src/mage/cards/l/LostInTheMist.java +++ b/Mage.Sets/src/mage/cards/l/LostInTheMist.java @@ -62,7 +62,7 @@ class LostInTheMistEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - return permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + return permanent.moveToZone(Zone.HAND, source, game, false); } return false; } diff --git a/Mage.Sets/src/mage/cards/l/LostInTheWoods.java b/Mage.Sets/src/mage/cards/l/LostInTheWoods.java index 05f3076189c..9dc09356805 100644 --- a/Mage.Sets/src/mage/cards/l/LostInTheWoods.java +++ b/Mage.Sets/src/mage/cards/l/LostInTheWoods.java @@ -67,7 +67,7 @@ class LostInTheWoodsEffect extends OneShotEffect { permanent.removeFromCombat(game); } } - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LostLegacy.java b/Mage.Sets/src/mage/cards/l/LostLegacy.java index a8bd230b498..366f299acc3 100644 --- a/Mage.Sets/src/mage/cards/l/LostLegacy.java +++ b/Mage.Sets/src/mage/cards/l/LostLegacy.java @@ -61,7 +61,7 @@ class LostLegacyEffect extends SearchTargetGraveyardHandLibraryForCardNameAndExi boolean result = super.applySearchAndExile(game, source, cardName, targetPointer.getFirst(game, source)); int cardsExiled = cardsInHandBefore - targetPlayer.getHand().count(filter, game); if (cardsExiled > 0) { - targetPlayer.drawCards(cardsExiled, source.getSourceId(), game); + targetPlayer.drawCards(cardsExiled, source, game); } return result; } diff --git a/Mage.Sets/src/mage/cards/l/LoxodonGatekeeper.java b/Mage.Sets/src/mage/cards/l/LoxodonGatekeeper.java index 4c7be3026fd..f85c9f41a65 100644 --- a/Mage.Sets/src/mage/cards/l/LoxodonGatekeeper.java +++ b/Mage.Sets/src/mage/cards/l/LoxodonGatekeeper.java @@ -70,7 +70,7 @@ class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LoxodonPeacekeeper.java b/Mage.Sets/src/mage/cards/l/LoxodonPeacekeeper.java index 9cbb72b6bbc..cd855087bf8 100644 --- a/Mage.Sets/src/mage/cards/l/LoxodonPeacekeeper.java +++ b/Mage.Sets/src/mage/cards/l/LoxodonPeacekeeper.java @@ -106,7 +106,7 @@ class LoxodonPeacekeeperEffect extends OneShotEffect { } TargetPlayer target = new TargetPlayer(1, 1, true, filter); if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } } else { diff --git a/Mage.Sets/src/mage/cards/l/Lucille.java b/Mage.Sets/src/mage/cards/l/Lucille.java index c9009ef503c..f13b8637d62 100644 --- a/Mage.Sets/src/mage/cards/l/Lucille.java +++ b/Mage.Sets/src/mage/cards/l/Lucille.java @@ -83,14 +83,13 @@ class LucilleEffect extends OneShotEffect { } TargetPermanent target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); - if (!target.canChoose(player.getId(), game)) { + if (!target.canChoose(source.getSourceId(), player.getId(), game)) { return false; } player.choose(outcome, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); - return permanent.sacrifice(source.getSourceId(), game) - && new WalkerToken().putOntoBattlefield( - 1, game, source.getSourceId(), source.getControllerId() + return permanent.sacrifice(source, game) + && new WalkerToken().putOntoBattlefield(1, game, source, source.getControllerId() ); } } diff --git a/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java b/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java index 4fc4cd12e24..bfced8e5b2f 100644 --- a/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java +++ b/Mage.Sets/src/mage/cards/l/LudevicNecroAlchemist.java @@ -103,7 +103,7 @@ class LudevicNecroAlchemistEffect extends OneShotEffect { Player player = game.getPlayer(game.getActivePlayerId()); if (player != null && player.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LudevicsTestSubject.java b/Mage.Sets/src/mage/cards/l/LudevicsTestSubject.java index d6884df7a7d..2e46ce6347e 100644 --- a/Mage.Sets/src/mage/cards/l/LudevicsTestSubject.java +++ b/Mage.Sets/src/mage/cards/l/LudevicsTestSubject.java @@ -71,7 +71,7 @@ class LudevicsTestSubjectEffect extends OneShotEffect { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { if (p.getCounters(game).getCount(CounterType.HATCHLING) >= 5) { - p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters(game).getCount(CounterType.HATCHLING), game); + p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters(game).getCount(CounterType.HATCHLING), source, game); TransformSourceEffect effect = new TransformSourceEffect(true); return effect.apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/l/LukeSkywalker.java b/Mage.Sets/src/mage/cards/l/LukeSkywalker.java index 7a9b3220f31..bbda40466e0 100644 --- a/Mage.Sets/src/mage/cards/l/LukeSkywalker.java +++ b/Mage.Sets/src/mage/cards/l/LukeSkywalker.java @@ -76,7 +76,7 @@ class LukeSkywalkerCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { return (permanent.getCounters(game).getCount(CounterType.P1P1)) > 0; @@ -85,11 +85,11 @@ class LukeSkywalkerCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { int countersCount = permanent.getCounters(game).getCount(CounterType.P1P1); - permanent.removeCounters(CounterType.P1P1.createInstance(countersCount), game); + permanent.removeCounters(CounterType.P1P1.createInstance(countersCount), source, game); this.paid = true; return true; } diff --git a/Mage.Sets/src/mage/cards/l/LukkaCoppercoatOutcast.java b/Mage.Sets/src/mage/cards/l/LukkaCoppercoatOutcast.java index df191e48276..2eeb8485535 100644 --- a/Mage.Sets/src/mage/cards/l/LukkaCoppercoatOutcast.java +++ b/Mage.Sets/src/mage/cards/l/LukkaCoppercoatOutcast.java @@ -197,7 +197,7 @@ class LukkaCoppercoatOutcastDamageEffect extends OneShotEffect { .collect(Collectors.toList()); for (Permanent permanent : controlledCreatures) { for (Player opponent : opponentList) { - opponent.damage(permanent.getPower().getValue(), permanent.getId(), game); + opponent.damage(permanent.getPower().getValue(), permanent.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LumengridAugur.java b/Mage.Sets/src/mage/cards/l/LumengridAugur.java index 3139e17f5d0..3ac30c591cb 100644 --- a/Mage.Sets/src/mage/cards/l/LumengridAugur.java +++ b/Mage.Sets/src/mage/cards/l/LumengridAugur.java @@ -71,8 +71,8 @@ class LumengridAugurEffect extends OneShotEffect { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (player != null) { - player.drawCards(1, source.getSourceId(), game); - Card discardedCard = player.discardOne(false, source, game); + player.drawCards(1, source, game); + Card discardedCard = player.discardOne(false, false, source, game); if (discardedCard != null && discardedCard.isArtifact()) { if (sourcePermanent != null) { sourcePermanent.untap(game); diff --git a/Mage.Sets/src/mage/cards/l/LuminarchAscension.java b/Mage.Sets/src/mage/cards/l/LuminarchAscension.java index e0382cabbbb..796e29f013b 100644 --- a/Mage.Sets/src/mage/cards/l/LuminarchAscension.java +++ b/Mage.Sets/src/mage/cards/l/LuminarchAscension.java @@ -70,7 +70,7 @@ class LuminarchAscensionTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override @@ -97,12 +97,12 @@ class SourceHasCountersCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return (game.getPermanent(sourceId).getCounters(game).getCount(counterType) >= counters); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return (game.getPermanent(source.getSourceId()).getCounters(game).getCount(counterType) >= counters); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/cards/l/LuminatePrimordial.java b/Mage.Sets/src/mage/cards/l/LuminatePrimordial.java index e35a5c6b043..6d6ae4527ef 100644 --- a/Mage.Sets/src/mage/cards/l/LuminatePrimordial.java +++ b/Mage.Sets/src/mage/cards/l/LuminatePrimordial.java @@ -96,7 +96,7 @@ class LuminatePrimordialEffect extends OneShotEffect { if (targetCreature != null && !targetCreature.isControlledBy(source.getControllerId())) { int amountLife = targetCreature.getPower().getValue(); Player controller = game.getPlayer(targetCreature.getControllerId()); - targetCreature.moveToExile(null, null, source.getSourceId(), game); + targetCreature.moveToExile(null, null, source, game); if (controller != null && amountLife != 0) { controller.gainLife(amountLife, game, source); } diff --git a/Mage.Sets/src/mage/cards/l/LurkingEvil.java b/Mage.Sets/src/mage/cards/l/LurkingEvil.java index 39ef1dce6a7..1fdc0045222 100644 --- a/Mage.Sets/src/mage/cards/l/LurkingEvil.java +++ b/Mage.Sets/src/mage/cards/l/LurkingEvil.java @@ -17,8 +17,10 @@ import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.GameEvent; import mage.game.permanent.token.TokenImpl; import mage.players.Player; +import mage.util.CardUtil; /** * @@ -56,25 +58,26 @@ class LurkingEvilCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); return controller != null && (controller.getLife() < 1 || controller.canPayLifeCost(ability)); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); - if (controller != null) { - int currentLife = controller.getLife(); - int lifeToPay = (currentLife + currentLife % 2) / 2; // Divide by two and round up. - if (lifeToPay < 0) { - this.paid = true; - } else { - this.paid = (controller.loseLife(lifeToPay, game, false) == lifeToPay); - } - return this.paid; + if (controller == null) { + return false; } - return false; + + int currentLife = controller.getLife(); + int lifeToPay = Math.max(0, (currentLife + currentLife % 2) / 2); // Divide by two and round up. + if (lifeToPay <= 0) { + this.paid = true; + } else { + this.paid = CardUtil.tryPayLife(lifeToPay, controller, source, game); + } + return this.paid; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java b/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java index 4a3e9d28ea7..842640c8497 100644 --- a/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java +++ b/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java @@ -65,7 +65,7 @@ class MadScienceFairManaEffect extends ManaEffect { if (game != null) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); if (amount <= 3) { return Mana.ColorlessMana(1); } else { diff --git a/Mage.Sets/src/mage/cards/m/MadcapExperiment.java b/Mage.Sets/src/mage/cards/m/MadcapExperiment.java index 1c4673454ca..5c9ec36a7b9 100644 --- a/Mage.Sets/src/mage/cards/m/MadcapExperiment.java +++ b/Mage.Sets/src/mage/cards/m/MadcapExperiment.java @@ -72,7 +72,7 @@ class MadcapExperimentEffect extends OneShotEffect { int damage = toReveal.size(); toReveal.remove(toBattlefield); controller.putCardsOnBottomOfLibrary(toReveal, game, source, false); - controller.damage(damage, source.getSourceId(), game); + controller.damage(damage, source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/m/MaddeningImp.java b/Mage.Sets/src/mage/cards/m/MaddeningImp.java index c23a0df4b0a..03fc4df857a 100644 --- a/Mage.Sets/src/mage/cards/m/MaddeningImp.java +++ b/Mage.Sets/src/mage/cards/m/MaddeningImp.java @@ -163,7 +163,7 @@ class MaddeningImpDelayedDestroyEffect extends OneShotEffect { continue; } // Destroy the rest. - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MageRingResponder.java b/Mage.Sets/src/mage/cards/m/MageRingResponder.java index 5e5504767ef..c2b58984ea3 100644 --- a/Mage.Sets/src/mage/cards/m/MageRingResponder.java +++ b/Mage.Sets/src/mage/cards/m/MageRingResponder.java @@ -66,7 +66,7 @@ class MageRingResponderAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MageSlayer.java b/Mage.Sets/src/mage/cards/m/MageSlayer.java index 537e414882c..9d69c1c68ec 100644 --- a/Mage.Sets/src/mage/cards/m/MageSlayer.java +++ b/Mage.Sets/src/mage/cards/m/MageSlayer.java @@ -68,7 +68,7 @@ class MageSlayerEffect extends OneShotEffect { if (power > 0 && defenderId != null) { UUID sourceId = (UUID) this.getValue("sourceId"); if (sourceId != null) { - game.damagePlayerOrPlaneswalker(defenderId, power, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(defenderId, power, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MagebaneArmor.java b/Mage.Sets/src/mage/cards/m/MagebaneArmor.java index 794fc2f3c4e..0dbbf1cb5c4 100644 --- a/Mage.Sets/src/mage/cards/m/MagebaneArmor.java +++ b/Mage.Sets/src/mage/cards/m/MagebaneArmor.java @@ -16,6 +16,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import java.util.UUID; @@ -94,11 +95,11 @@ class MagebaneArmorPreventionEffect extends PreventionEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null && equipment.getAttachedTo() != null) { - GameEvent preventEvent = new PreventDamageEvent(equipment.getAttachedTo(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, equipment.getAttachedTo(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MagesContest.java b/Mage.Sets/src/mage/cards/m/MagesContest.java index c095a5da5be..d5ed5ae4a74 100644 --- a/Mage.Sets/src/mage/cards/m/MagesContest.java +++ b/Mage.Sets/src/mage/cards/m/MagesContest.java @@ -90,9 +90,9 @@ class MagesContestEffect extends OneShotEffect { } } while (!Objects.equals(currentPlayer, winner)); game.informPlayers(winner.getLogName() + " has won the contest with a high bid of " + highBid + " life"); - winner.loseLife(highBid, game, false); + winner.loseLife(highBid, game, source, false); if (winner == you) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/Magmasaur.java b/Mage.Sets/src/mage/cards/m/Magmasaur.java index ddd78fc6d85..4dc947180f7 100644 --- a/Mage.Sets/src/mage/cards/m/Magmasaur.java +++ b/Mage.Sets/src/mage/cards/m/Magmasaur.java @@ -84,10 +84,10 @@ class MagmasaurEffect extends OneShotEffect { Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game); if (sourceObject != null && controller != null) { if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + '?', source, game)) { - sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); + sourceObject.removeCounters(CounterType.P1P1.getName(), 1, source, game); } else { int counters = sourceObject.getCounters(game).getCount(CounterType.P1P1); - sourceObject.sacrifice(source.getSourceId(), game); + sourceObject.sacrifice(source, game); new DamageEverythingEffect(counters, filter).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/m/MagneticMine.java b/Mage.Sets/src/mage/cards/m/MagneticMine.java index 36dad78e355..310f53ca1f7 100644 --- a/Mage.Sets/src/mage/cards/m/MagneticMine.java +++ b/Mage.Sets/src/mage/cards/m/MagneticMine.java @@ -52,7 +52,7 @@ class MagneticMineTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MagneticMountain.java b/Mage.Sets/src/mage/cards/m/MagneticMountain.java index b386dc1bcef..8dae4c9d1b0 100644 --- a/Mage.Sets/src/mage/cards/m/MagneticMountain.java +++ b/Mage.Sets/src/mage/cards/m/MagneticMountain.java @@ -90,7 +90,7 @@ class MagneticMountainEffect extends OneShotEffect { if (player.choose(Outcome.Untap, tappedCreatureTarget, source.getSourceId(), game)) { Cost cost = ManaUtil.createManaCost(4, false); Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); - if (tappedCreature != null && cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (tappedCreature != null && cost.pay(source, game, source, player.getId(), false)) { tappedCreature.untap(game); } else { break; diff --git a/Mage.Sets/src/mage/cards/m/MagneticTheft.java b/Mage.Sets/src/mage/cards/m/MagneticTheft.java index 8cd7699b2f8..0603db82a5c 100644 --- a/Mage.Sets/src/mage/cards/m/MagneticTheft.java +++ b/Mage.Sets/src/mage/cards/m/MagneticTheft.java @@ -68,7 +68,7 @@ class EquipEffect extends OneShotEffect { Permanent equipment = game.getPermanent(source.getFirstTarget()); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null && equipment != null) { - return creature.addAttachment(equipment.getId(), game); + return creature.addAttachment(equipment.getId(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheArena.java b/Mage.Sets/src/mage/cards/m/MagusOfTheArena.java index f15ba6fcbbd..8f1a0ab7229 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheArena.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheArena.java @@ -72,11 +72,11 @@ class MagusOfTheArenaEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { - creature.tap(game); + creature.tap(source, game); } creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { - creature.tap(game); + creature.tap(source, game); } return new FightTargetsEffect().apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java b/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java index df052031749..30db73c6096 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java @@ -72,7 +72,7 @@ class MagusoftheJarEffect extends OneShotEffect { for (UUID cardId : handCards) { Card card = handCards.get(cardId, game); if (card != null) { - card.moveToExile(getId(), "Magus of the Jar", source.getSourceId(), game); + card.moveToExile(getId(), "Magus of the Jar", source, game); card.setFaceDown(true, game); cards.add(card); } @@ -83,7 +83,7 @@ class MagusoftheJarEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(7, source.getSourceId(), game); + player.drawCards(7, source, game); } } //Delayed ability @@ -124,13 +124,13 @@ class MagusoftheJarDelayedEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.discard(player.getHand().size(), false, source, game); + player.discard(player.getHand().size(), false, false, source, game); } } //Return to hand for (Iterator it = cards.getCards(game).iterator(); it.hasNext(); ) { Card card = it.next(); - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java b/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java index 3fd5ef28094..9f06b808549 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java @@ -79,12 +79,12 @@ class MagusOfTheScrollEffect extends OneShotEffect { if (CardUtil.haveSameNames(card, cardName, game)) { Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); if (creature != null) { - creature.damage(2, source.getSourceId(), game, false, true); + creature.damage(2, source.getSourceId(), source, game, false, true); return true; } Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheUnseen.java b/Mage.Sets/src/mage/cards/m/MagusOfTheUnseen.java index 737301cf1c7..8141e518251 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheUnseen.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheUnseen.java @@ -83,13 +83,13 @@ class MagusOfTheUnseenDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_CONTROL; + return event.getType() == GameEvent.EventType.LOST_CONTROL; } @Override public boolean checkTrigger(GameEvent event, Game game) { return event.getPlayerId().equals(controllerId) - && event.getSourceId().equals(this.getEffects().get(0).getTargetPointer().getFirst(game, this)); + && event.getTargetId().equals(this.getEffects().get(0).getTargetPointer().getFirst(game, this)); } @Override diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheWill.java b/Mage.Sets/src/mage/cards/m/MagusOfTheWill.java index e56c7ef98e5..986818f2196 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheWill.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheWill.java @@ -110,22 +110,8 @@ class MagusOfTheWillReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - if (permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } else { - Card card = game.getCard(event.getTargetId()); - if (card != null) { - return controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } - return false; - } - return true; + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java b/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java index 6ee72aaad51..929faea8aab 100644 --- a/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java +++ b/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java @@ -73,7 +73,7 @@ class RemoveCounterMaintenanceHangarEffect extends OneShotEffect { if (controller != null) { for (Card card : controller.getGraveyard().getCards(game)) { if (card.getCounters(game).getCount("repair") > 0) { - card.removeCounters("repair", 1, game); + card.removeCounters("repair", 1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MakeAWish.java b/Mage.Sets/src/mage/cards/m/MakeAWish.java index 166d14d6af3..7aff0e5a0f2 100644 --- a/Mage.Sets/src/mage/cards/m/MakeAWish.java +++ b/Mage.Sets/src/mage/cards/m/MakeAWish.java @@ -61,7 +61,7 @@ class MakeAWishEffect extends OneShotEffect { for (int i = 0; i < 2 && !cards.isEmpty(); i++) { Card card = cards.getRandom(game); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); cards.remove(card); game.informPlayers(card.getName() + " returned to the hand of " + player.getLogName()); } else { diff --git a/Mage.Sets/src/mage/cards/m/MalakirBloodwitch.java b/Mage.Sets/src/mage/cards/m/MalakirBloodwitch.java index e4c4715d7d9..bf9b26ac0ea 100644 --- a/Mage.Sets/src/mage/cards/m/MalakirBloodwitch.java +++ b/Mage.Sets/src/mage/cards/m/MalakirBloodwitch.java @@ -80,7 +80,7 @@ class MalakirBloodwitchEffect extends OneShotEffect { for (UUID opponentUuid : opponents) { Player opponent = game.getPlayer(opponentUuid); if (opponent != null) { - total += opponent.loseLife(amount, game, false); + total += opponent.loseLife(amount, game, source, false); } } if (total > 0) { diff --git a/Mage.Sets/src/mage/cards/m/MalignantGrowth.java b/Mage.Sets/src/mage/cards/m/MalignantGrowth.java index 3172d1c94e0..54e8f93bebb 100644 --- a/Mage.Sets/src/mage/cards/m/MalignantGrowth.java +++ b/Mage.Sets/src/mage/cards/m/MalignantGrowth.java @@ -80,6 +80,6 @@ class MalignantGrowthEffect extends OneShotEffect { if (counters == 0) { return true; } - return player.damage(player.drawCards(counters, source.getSourceId(), game), source.getSourceId(), game) > 0; + return player.damage(player.drawCards(counters, source, game), source.getSourceId(), source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/m/ManaBreach.java b/Mage.Sets/src/mage/cards/m/ManaBreach.java index af49af7e04b..3491917faeb 100644 --- a/Mage.Sets/src/mage/cards/m/ManaBreach.java +++ b/Mage.Sets/src/mage/cards/m/ManaBreach.java @@ -58,7 +58,7 @@ class ManaBreachEffect extends OneShotEffect { TargetLandPermanent toBounce = new TargetLandPermanent(1, 1, filter, true); if(player.chooseTarget(Outcome.ReturnToHand, toBounce, source, game)) { Permanent land = game.getPermanent(toBounce.getTargets().get(0)); - land.moveToZone(Zone.HAND, source.getSourceId(), game, false); + land.moveToZone(Zone.HAND, source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/ManaCache.java b/Mage.Sets/src/mage/cards/m/ManaCache.java index 9a163a4ed5a..c966390350d 100644 --- a/Mage.Sets/src/mage/cards/m/ManaCache.java +++ b/Mage.Sets/src/mage/cards/m/ManaCache.java @@ -104,7 +104,7 @@ class ManaCacheManaAbility extends ActivatedManaAbilityImpl { } Player player = game.getPlayer(playerId); if (player != null && playerId.equals(game.getActivePlayerId()) && game.getStep().getType().isBefore(PhaseStep.END_TURN)) { - if (costs.canPay(this, sourceId, playerId, game)) { + if (costs.canPay(this, this, playerId, game)) { this.setControllerId(playerId); return ActivationStatus.getTrue(this, game); } diff --git a/Mage.Sets/src/mage/cards/m/ManaClash.java b/Mage.Sets/src/mage/cards/m/ManaClash.java index 1232a402f80..9459c342af9 100644 --- a/Mage.Sets/src/mage/cards/m/ManaClash.java +++ b/Mage.Sets/src/mage/cards/m/ManaClash.java @@ -67,10 +67,10 @@ class ManaClashEffect extends OneShotEffect { bothHeads = true; } if (!controllerFlip) { - controller.damage(1, source.getSourceId(), game); + controller.damage(1, source.getSourceId(), source, game); } if (!opponentFlip) { - targetOpponent.damage(1, source.getSourceId(), game); + targetOpponent.damage(1, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/ManaCrypt.java b/Mage.Sets/src/mage/cards/m/ManaCrypt.java index 70afe947fef..f7ec5dad6d9 100644 --- a/Mage.Sets/src/mage/cards/m/ManaCrypt.java +++ b/Mage.Sets/src/mage/cards/m/ManaCrypt.java @@ -58,7 +58,7 @@ class ManaCryptEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { if (!player.flipCoin(source, game, true)) { - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/ManaDrain.java b/Mage.Sets/src/mage/cards/m/ManaDrain.java index 94ee8c5b476..f33a95cd105 100644 --- a/Mage.Sets/src/mage/cards/m/ManaDrain.java +++ b/Mage.Sets/src/mage/cards/m/ManaDrain.java @@ -63,7 +63,7 @@ class ManaDrainCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); if (spell != null) { - game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game); + game.getStack().counter(getTargetPointer().getFirst(game, source), source, game); // mana gets added also if counter is not successful int cmc = spell.getConvertedManaCost(); Effect effect = new AddManaToManaPoolTargetControllerEffect(Mana.ColorlessMana(cmc), "your"); diff --git a/Mage.Sets/src/mage/cards/m/ManaMaze.java b/Mage.Sets/src/mage/cards/m/ManaMaze.java index bcdb38d061e..fa38101f84c 100644 --- a/Mage.Sets/src/mage/cards/m/ManaMaze.java +++ b/Mage.Sets/src/mage/cards/m/ManaMaze.java @@ -92,7 +92,7 @@ class LastSpellCastWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST) { + if (event.getType() == GameEvent.EventType.SPELL_CAST) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell == null) { MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.STACK); diff --git a/Mage.Sets/src/mage/cards/m/ManaSeism.java b/Mage.Sets/src/mage/cards/m/ManaSeism.java index 4e903d9dd16..07e80cc5f21 100644 --- a/Mage.Sets/src/mage/cards/m/ManaSeism.java +++ b/Mage.Sets/src/mage/cards/m/ManaSeism.java @@ -68,7 +68,7 @@ class ManaSeismEffect extends OneShotEffect { for(UUID uuid : sacrificeLand.getTargets()){ Permanent land = game.getPermanent(uuid); if(land != null){ - land.sacrifice(source.getSourceId(), game); + land.sacrifice(source, game); amount++; } } diff --git a/Mage.Sets/src/mage/cards/m/ManaSeverance.java b/Mage.Sets/src/mage/cards/m/ManaSeverance.java index 673b7f2e3a6..b08b5d68a18 100644 --- a/Mage.Sets/src/mage/cards/m/ManaSeverance.java +++ b/Mage.Sets/src/mage/cards/m/ManaSeverance.java @@ -69,7 +69,7 @@ class ManaSeveranceEffect extends SearchEffect { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/m/ManaVortex.java b/Mage.Sets/src/mage/cards/m/ManaVortex.java index efb49fa3d8f..dbae6d107cd 100644 --- a/Mage.Sets/src/mage/cards/m/ManaVortex.java +++ b/Mage.Sets/src/mage/cards/m/ManaVortex.java @@ -84,12 +84,12 @@ class CounterSourceEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if(controller != null && controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + '?', source, game)){ SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent())); - if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){ + if(cost.pay(source, game, source, source.getControllerId(), false, null)){ game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + '.'); return true; } else { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/ManaWeb.java b/Mage.Sets/src/mage/cards/m/ManaWeb.java index 701e2b8c9c4..61f0f2475a5 100644 --- a/Mage.Sets/src/mage/cards/m/ManaWeb.java +++ b/Mage.Sets/src/mage/cards/m/ManaWeb.java @@ -57,7 +57,7 @@ class ManaWebTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override @@ -66,8 +66,7 @@ class ManaWebTriggeredAbility extends TriggeredAbilityImpl { return false; } if (game.getOpponents(controllerId).contains(event.getPlayerId())) { - Permanent permanent = game.getPermanent(event.getSourceId()); - + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); if (permanent != null && permanent.isLand()) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); return true; @@ -116,7 +115,7 @@ class ManaWebeffect extends OneShotEffect { Set manaTypes = AnyColorLandsProduceManaAbility.getManaTypesFromPermanent(opponentPermanent, game); for (ManaType manaType : manaTypes) { if (manaTypesSource.contains(manaType)) { - tappedLands = opponentPermanent.tap(game) || tappedLands; + tappedLands = opponentPermanent.tap(source, game) || tappedLands; break; } } diff --git a/Mage.Sets/src/mage/cards/m/Manabond.java b/Mage.Sets/src/mage/cards/m/Manabond.java index 7c3295b175b..56351294980 100644 --- a/Mage.Sets/src/mage/cards/m/Manabond.java +++ b/Mage.Sets/src/mage/cards/m/Manabond.java @@ -67,7 +67,7 @@ class ManabondEffect extends OneShotEffect { } controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, false, false, true, null); - controller.discard(controller.getHand().size(), false, source, game); + controller.discard(controller.getHand().size(), false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/Manaplasm.java b/Mage.Sets/src/mage/cards/m/Manaplasm.java index 26e23737080..034ecc26a3e 100644 --- a/Mage.Sets/src/mage/cards/m/Manaplasm.java +++ b/Mage.Sets/src/mage/cards/m/Manaplasm.java @@ -61,7 +61,7 @@ class ManaplasmAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MangarasTome.java b/Mage.Sets/src/mage/cards/m/MangarasTome.java index 024d541d46c..6a7ac40e3d4 100644 --- a/Mage.Sets/src/mage/cards/m/MangarasTome.java +++ b/Mage.Sets/src/mage/cards/m/MangarasTome.java @@ -117,7 +117,7 @@ class MangarasTomeReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/m/ManipulateFate.java b/Mage.Sets/src/mage/cards/m/ManipulateFate.java index 2883532f69e..a9d15bedb68 100644 --- a/Mage.Sets/src/mage/cards/m/ManipulateFate.java +++ b/Mage.Sets/src/mage/cards/m/ManipulateFate.java @@ -64,12 +64,12 @@ class ManipulateFateEffect extends SearchEffect { for (UUID targetId : getTargets()) { Card card = player.getLibrary().getCard(targetId, game); if (card != null) { - card.moveToExile(null, null, targetId, game); + card.moveToExile(null, null, source, game); } } } player.shuffleLibrary(source, game); - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java b/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java index 7167294fbf9..ddf1974c019 100644 --- a/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java +++ b/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java @@ -98,7 +98,7 @@ class MaralenOfTheMornsongEffect2 extends OneShotEffect { UUID activePlayerId = game.getActivePlayerId(); Player player = game.getPlayer(activePlayerId); if (player != null) { - player.loseLife(3, game, false); + player.loseLife(3, game, source, false); TargetCardInLibrary target = new TargetCardInLibrary(); if (player.searchLibrary(target, source, game)) { player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/m/MarathWillOfTheWild.java b/Mage.Sets/src/mage/cards/m/MarathWillOfTheWild.java index 52ff9d7c810..07d5fa5eb44 100644 --- a/Mage.Sets/src/mage/cards/m/MarathWillOfTheWild.java +++ b/Mage.Sets/src/mage/cards/m/MarathWillOfTheWild.java @@ -135,7 +135,7 @@ class MarathWillOfTheWildCreateTokenEffect extends OneShotEffect { Token token = new MarathWillOfTheWildElementalToken(); token.getPower().modifyBaseValue(amount); token.getToughness().modifyBaseValue(amount); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } return false; @@ -154,8 +154,8 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } @@ -163,11 +163,11 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { int amount = ManacostVariableValue.instance.calculate(game, ability, null); - Permanent permanent = game.getPermanent(sourceId); + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) >= amount) { - permanent.removeCounters(CounterType.P1P1.getName(), amount, game); + permanent.removeCounters(CounterType.P1P1.getName(), amount, source, game); this.paid = true; } return paid; diff --git a/Mage.Sets/src/mage/cards/m/MaraudingRaptor.java b/Mage.Sets/src/mage/cards/m/MaraudingRaptor.java index 0a44e1e8f1e..7d28ae3ecbd 100644 --- a/Mage.Sets/src/mage/cards/m/MaraudingRaptor.java +++ b/Mage.Sets/src/mage/cards/m/MaraudingRaptor.java @@ -83,7 +83,7 @@ class MaraudingRaptorEffect extends OneShotEffect { if (permanent == null) { return false; } - if (permanent.damage(2, source.getSourceId(), game) > 0 && permanent.hasSubtype(SubType.DINOSAUR, game)) { + if (permanent.damage(2, source.getSourceId(), source, game) > 0 && permanent.hasSubtype(SubType.DINOSAUR, game)) { game.addEffect(new BoostSourceEffect(2, 0, Duration.EndOfTurn), source); } return true; diff --git a/Mage.Sets/src/mage/cards/m/MarchOfSouls.java b/Mage.Sets/src/mage/cards/m/MarchOfSouls.java index 803b8b85b90..4b0e574a5d7 100644 --- a/Mage.Sets/src/mage/cards/m/MarchOfSouls.java +++ b/Mage.Sets/src/mage/cards/m/MarchOfSouls.java @@ -62,13 +62,13 @@ class MarchOfSoulsEffect extends OneShotEffect { source.getControllerId(), source.getSourceId(), game )) { UUID controllerId = p.getControllerId(); - if (p.destroy(source.getSourceId(), game, true)) { + if (p.destroy(source, game, true)) { playersWithCreatures.put(controllerId, playersWithCreatures.getOrDefault(controllerId, 0) + 1); } } SpiritWhiteToken token = new SpiritWhiteToken(); for (Map.Entry destroyedCreaturePerPlayer : playersWithCreatures.entrySet()) { - token.putOntoBattlefield(destroyedCreaturePerPlayer.getValue(), game, source.getSourceId(), destroyedCreaturePerPlayer.getKey()); + token.putOntoBattlefield(destroyedCreaturePerPlayer.getValue(), game, source, destroyedCreaturePerPlayer.getKey()); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MarchOfTheDroids.java b/Mage.Sets/src/mage/cards/m/MarchOfTheDroids.java index 5e31a472b5b..604c2ca9bd8 100644 --- a/Mage.Sets/src/mage/cards/m/MarchOfTheDroids.java +++ b/Mage.Sets/src/mage/cards/m/MarchOfTheDroids.java @@ -73,7 +73,7 @@ class MarchOfTheDroidsEffect extends OneShotEffect { int number = card.getCounters(game).getCount(CounterType.REPAIR); if (number > 0) { cardsToReturn.add(card); - card.removeCounters(CounterType.REPAIR.createInstance(number), game); + card.removeCounters(CounterType.REPAIR.createInstance(number), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/m/MarchesaTheBlackRose.java b/Mage.Sets/src/mage/cards/m/MarchesaTheBlackRose.java index 1dc83d372b5..d7f1bcca72c 100644 --- a/Mage.Sets/src/mage/cards/m/MarchesaTheBlackRose.java +++ b/Mage.Sets/src/mage/cards/m/MarchesaTheBlackRose.java @@ -80,7 +80,7 @@ class MarchesaTheBlackRoseTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MarkOfSakiko.java b/Mage.Sets/src/mage/cards/m/MarkOfSakiko.java index e0465716bdd..0e5ade73fb1 100644 --- a/Mage.Sets/src/mage/cards/m/MarkOfSakiko.java +++ b/Mage.Sets/src/mage/cards/m/MarkOfSakiko.java @@ -77,7 +77,7 @@ class MarkOfSakikoTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MarketFestival.java b/Mage.Sets/src/mage/cards/m/MarketFestival.java index 8d4ebf59fe9..9324e6d6c3a 100644 --- a/Mage.Sets/src/mage/cards/m/MarketFestival.java +++ b/Mage.Sets/src/mage/cards/m/MarketFestival.java @@ -72,13 +72,17 @@ class MarketFestivalTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - return enchantment != null && enchantment.isAttachedTo(event.getSourceId()); + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + return enchantedLand != null && enchantedLand.isLand(); + } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java b/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java index 6380d6d05f8..6367a08ad8b 100644 --- a/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java +++ b/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java @@ -68,14 +68,14 @@ class MarshalingTheTroopsEffect extends OneShotEffect { TargetPermanent target = new TargetPermanent(0, 1, filter, false); while (true) { target.clearChosen(); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { - game.getPermanent(creature).tap(game); + game.getPermanent(creature).tap(source, game); tappedAmount++; } } else { diff --git a/Mage.Sets/src/mage/cards/m/MartialCoup.java b/Mage.Sets/src/mage/cards/m/MartialCoup.java index e7455f33e4b..3723fa53b87 100644 --- a/Mage.Sets/src/mage/cards/m/MartialCoup.java +++ b/Mage.Sets/src/mage/cards/m/MartialCoup.java @@ -58,12 +58,12 @@ class MartialCoupEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int amount = source.getManaCostsToPay().getX(); - token.putOntoBattlefield(amount, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(amount, game, source, source.getControllerId()); List tokens = token.getLastAddedTokenIds(); if (amount > 4) { for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), game)) { if (!tokens.contains(permanent.getId())) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/m/MartyrsBond.java b/Mage.Sets/src/mage/cards/m/MartyrsBond.java index 31d5a450f5c..f09cc19d562 100644 --- a/Mage.Sets/src/mage/cards/m/MartyrsBond.java +++ b/Mage.Sets/src/mage/cards/m/MartyrsBond.java @@ -65,7 +65,7 @@ class MartyrsBondTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -136,7 +136,7 @@ class MartyrsBondEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && !playerId.equals(controller.getId())) { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); - if (target.canChoose(playerId, game)) { + if (target.canChoose(source.getSourceId(), playerId, game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.add(target.getFirstTarget()); } @@ -147,7 +147,7 @@ class MartyrsBondEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); saccedPermaents = true; } } diff --git a/Mage.Sets/src/mage/cards/m/MartyrsCry.java b/Mage.Sets/src/mage/cards/m/MartyrsCry.java index 01b553475c0..442be3b3e43 100644 --- a/Mage.Sets/src/mage/cards/m/MartyrsCry.java +++ b/Mage.Sets/src/mage/cards/m/MartyrsCry.java @@ -59,7 +59,7 @@ class MartyrsCryEffect extends OneShotEffect { Map playerCrtCount = new HashMap<>(); for (Iterator it = game.getBattlefield().getActivePermanents(source.getControllerId(), game).iterator(); it.hasNext();) { Permanent perm = it.next(); - if (perm != null && perm.isCreature() && perm.getColor(game).isWhite() && perm.moveToExile(null, null, source.getSourceId(), game)) { + if (perm != null && perm.isCreature() && perm.getColor(game).isWhite() && perm.moveToExile(null, null, source, game)) { playerCrtCount.putIfAbsent(perm.getControllerId(), 0); playerCrtCount.compute(perm.getControllerId(), (p, amount) -> amount + 1); } @@ -67,7 +67,7 @@ class MartyrsCryEffect extends OneShotEffect { for (UUID playerId : game.getPlayerList().toList()) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(playerCrtCount.getOrDefault(playerId, 0), source.getSourceId(), game); + player.drawCards(playerCrtCount.getOrDefault(playerId, 0), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MaskOfImmolation.java b/Mage.Sets/src/mage/cards/m/MaskOfImmolation.java index 60cb9da3b83..f6322863fb7 100644 --- a/Mage.Sets/src/mage/cards/m/MaskOfImmolation.java +++ b/Mage.Sets/src/mage/cards/m/MaskOfImmolation.java @@ -77,7 +77,7 @@ class MaskOfImmolationEffect extends CreateTokenEffect { if (p == null) { return false; } - p.addAttachment(source.getSourceId(), game); + p.addAttachment(source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/m/MassacreWurm.java b/Mage.Sets/src/mage/cards/m/MassacreWurm.java index 48d3342c7a1..39a2adb294b 100644 --- a/Mage.Sets/src/mage/cards/m/MassacreWurm.java +++ b/Mage.Sets/src/mage/cards/m/MassacreWurm.java @@ -64,7 +64,7 @@ class MassacreWurmTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MasterBiomancer.java b/Mage.Sets/src/mage/cards/m/MasterBiomancer.java index b810e3965cf..ac2e67f454e 100644 --- a/Mage.Sets/src/mage/cards/m/MasterBiomancer.java +++ b/Mage.Sets/src/mage/cards/m/MasterBiomancer.java @@ -63,7 +63,7 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MasterOfCruelties.java b/Mage.Sets/src/mage/cards/m/MasterOfCruelties.java index 9cbcef247c5..ee5e903bd1a 100644 --- a/Mage.Sets/src/mage/cards/m/MasterOfCruelties.java +++ b/Mage.Sets/src/mage/cards/m/MasterOfCruelties.java @@ -78,7 +78,7 @@ class MasterOfCrueltiesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MasterOfTheWildHunt.java b/Mage.Sets/src/mage/cards/m/MasterOfTheWildHunt.java index 6d4fb505041..03bb3aa297a 100644 --- a/Mage.Sets/src/mage/cards/m/MasterOfTheWildHunt.java +++ b/Mage.Sets/src/mage/cards/m/MasterOfTheWildHunt.java @@ -90,13 +90,13 @@ class MasterOfTheWildHuntEffect extends OneShotEffect { Permanent target = game.getPermanent(source.getFirstTarget()); if (target != null && game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { - permanent.tap(game); - target.damage(permanent.getToughness().getValue(), permanent.getId(), game); + permanent.tap(source, game); + target.damage(permanent.getToughness().getValue(), permanent.getId(), source, game); wolves.add(permanent.getId()); } Player player = game.getPlayer(target.getControllerId()); if (player != null) { - player.assignDamage(target.getPower().getValue(), wolves, "Wolf", target.getId(), game); + player.assignDamage(target.getPower().getValue(), wolves, "Wolf", target.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MasterWarcraft.java b/Mage.Sets/src/mage/cards/m/MasterWarcraft.java index a436ebd0b85..759466181da 100644 --- a/Mage.Sets/src/mage/cards/m/MasterWarcraft.java +++ b/Mage.Sets/src/mage/cards/m/MasterWarcraft.java @@ -235,7 +235,7 @@ class MasterWarcraftChooseBlockersEffect extends ContinuousRuleModifyingEffectIm watcher.copyCountApply = watcher.copyCount; Player blockController = game.getPlayer(source.getControllerId()); if (blockController != null) { - game.getCombat().selectBlockers(blockController, game); + game.getCombat().selectBlockers(blockController, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MaulfistRevolutionary.java b/Mage.Sets/src/mage/cards/m/MaulfistRevolutionary.java index d3f0bbc95c9..b5d4e5ae7b0 100644 --- a/Mage.Sets/src/mage/cards/m/MaulfistRevolutionary.java +++ b/Mage.Sets/src/mage/cards/m/MaulfistRevolutionary.java @@ -81,7 +81,7 @@ class MaulfistRevolutionaryEffect extends OneShotEffect { } else { counterToAdd = new Counter(counter.getName()); } - player.addCounters(counterToAdd, game); + player.addCounters(counterToAdd, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MazirekKraulDeathPriest.java b/Mage.Sets/src/mage/cards/m/MazirekKraulDeathPriest.java index 11f851ae3e7..5f1f67bffc0 100644 --- a/Mage.Sets/src/mage/cards/m/MazirekKraulDeathPriest.java +++ b/Mage.Sets/src/mage/cards/m/MazirekKraulDeathPriest.java @@ -63,7 +63,7 @@ class PlayerSacrificesPermanentTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java b/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java index b4725877aaf..03a1ea58b6f 100644 --- a/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java +++ b/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java @@ -89,7 +89,7 @@ class MeanderingTowershellEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { - controller.moveCardToExileWithInfo(sourcePermanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(sourcePermanent, null, "", source, game, Zone.BATTLEFIELD, true); game.addDelayedTriggeredAbility(new AtBeginningNextDeclareAttackersStepNextTurnDelayedTriggeredAbility(), source); return true; } diff --git a/Mage.Sets/src/mage/cards/m/MeasureOfWickedness.java b/Mage.Sets/src/mage/cards/m/MeasureOfWickedness.java index 95f11a6f764..97fb814d189 100644 --- a/Mage.Sets/src/mage/cards/m/MeasureOfWickedness.java +++ b/Mage.Sets/src/mage/cards/m/MeasureOfWickedness.java @@ -87,7 +87,7 @@ class MeasureOfWickednessControlSourceEffect extends ContinuousEffectImpl { Player targetOpponent = game.getPlayer(source.getFirstTarget()); Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null && targetOpponent != null) { - permanent.changeControllerId(targetOpponent.getId(), game); + permanent.changeControllerId(targetOpponent.getId(), game, source); } else { // no valid target exists, effect can be discarded discard(); diff --git a/Mage.Sets/src/mage/cards/m/MechanizedProduction.java b/Mage.Sets/src/mage/cards/m/MechanizedProduction.java index 1ed9da08de1..54979929254 100644 --- a/Mage.Sets/src/mage/cards/m/MechanizedProduction.java +++ b/Mage.Sets/src/mage/cards/m/MechanizedProduction.java @@ -82,7 +82,7 @@ class MechanizedProductionEffect extends OneShotEffect { if (enchantedArtifact != null) { EmptyToken token = new EmptyToken(); CardUtil.copyTo(token).from(enchantedArtifact); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); } Map countNames = new HashMap<>(); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), game)) { diff --git a/Mage.Sets/src/mage/cards/m/MeddlingMage.java b/Mage.Sets/src/mage/cards/m/MeddlingMage.java index cd912639bc9..8b017da3888 100644 --- a/Mage.Sets/src/mage/cards/m/MeddlingMage.java +++ b/Mage.Sets/src/mage/cards/m/MeddlingMage.java @@ -79,7 +79,7 @@ class MeddlingMageReplacementEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL_LATE; + return event.getType() == GameEvent.EventType.CAST_SPELL_LATE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/Meglonoth.java b/Mage.Sets/src/mage/cards/m/Meglonoth.java index e3c97e2fdb8..c927f4e7b87 100644 --- a/Mage.Sets/src/mage/cards/m/Meglonoth.java +++ b/Mage.Sets/src/mage/cards/m/Meglonoth.java @@ -70,7 +70,7 @@ class MeglonothEffect extends OneShotEffect { Permanent meglonoth = game.getPermanent(source.getSourceId()); Permanent blocked = game.getPermanent(targetPointer.getFirst(game, source)); if (blocked != null && meglonoth != null) { - game.getPlayer(blocked.getControllerId()).damage(meglonoth.getPower().getValue(), source.getSourceId(), game); + game.getPlayer(blocked.getControllerId()).damage(meglonoth.getPower().getValue(), source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/Melee.java b/Mage.Sets/src/mage/cards/m/Melee.java index 20ef8d91fa7..e07a53db2a1 100644 --- a/Mage.Sets/src/mage/cards/m/Melee.java +++ b/Mage.Sets/src/mage/cards/m/Melee.java @@ -133,7 +133,7 @@ class MeleeChooseBlockersEffect extends ContinuousRuleModifyingEffectImpl { watcher.copyCountApply = watcher.copyCount; Player blockController = game.getPlayer(source.getControllerId()); if (blockController != null) { - game.getCombat().selectBlockers(blockController, game); + game.getCombat().selectBlockers(blockController, source, game); return true; } this.discard(); diff --git a/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java b/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java index bf9dff2fd81..4175ccf42c9 100644 --- a/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java +++ b/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java @@ -83,7 +83,7 @@ class MelekIzzetParagonTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MeliraSylvokOutcast.java b/Mage.Sets/src/mage/cards/m/MeliraSylvokOutcast.java index 7565cfdca9d..52ffdcf2045 100644 --- a/Mage.Sets/src/mage/cards/m/MeliraSylvokOutcast.java +++ b/Mage.Sets/src/mage/cards/m/MeliraSylvokOutcast.java @@ -77,7 +77,7 @@ class MeliraSylvokOutcastEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ADD_COUNTERS; + return event.getType() == GameEvent.EventType.ADD_COUNTERS; } @Override @@ -110,7 +110,7 @@ class MeliraSylvokOutcastEffect2 extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ADD_COUNTERS; + return event.getType() == GameEvent.EventType.ADD_COUNTERS; } @Override diff --git a/Mage.Sets/src/mage/cards/m/Meltdown.java b/Mage.Sets/src/mage/cards/m/Meltdown.java index 43f1e2ec5f9..63d6479f8d0 100644 --- a/Mage.Sets/src/mage/cards/m/Meltdown.java +++ b/Mage.Sets/src/mage/cards/m/Meltdown.java @@ -55,7 +55,7 @@ class MeltdownEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (permanent != null && permanent.isArtifact() && permanent.getConvertedManaCost() <= source.getManaCostsToPay().getX()) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MemoryErosion.java b/Mage.Sets/src/mage/cards/m/MemoryErosion.java index 5aa6273b58d..83538d4a3f2 100644 --- a/Mage.Sets/src/mage/cards/m/MemoryErosion.java +++ b/Mage.Sets/src/mage/cards/m/MemoryErosion.java @@ -53,7 +53,7 @@ class SpellCastTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MemoryJar.java b/Mage.Sets/src/mage/cards/m/MemoryJar.java index d1709a4b197..3ce8cd106c2 100644 --- a/Mage.Sets/src/mage/cards/m/MemoryJar.java +++ b/Mage.Sets/src/mage/cards/m/MemoryJar.java @@ -68,7 +68,7 @@ class MemoryJarEffect extends OneShotEffect { for (UUID cardId : handCards) { Card card = handCards.get(cardId, game); if (card != null) { - card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game); + card.moveToExile(getId(), "Memory Jar", source, game); card.setFaceDown(true, game); cards.add(card); } @@ -79,7 +79,7 @@ class MemoryJarEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(7, source.getSourceId(), game); + player.drawCards(7, source, game); } } //Delayed ability @@ -120,13 +120,13 @@ class MemoryJarDelayedEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.discard(player.getHand().size(), false, source, game); + player.discard(player.getHand().size(), false, false, source, game); } } //Return to hand for (Iterator it = cards.getCards(game).iterator(); it.hasNext(); ) { Card card = it.next(); - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); } return true; } @@ -152,7 +152,7 @@ class MemoryJarDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MenacingOgre.java b/Mage.Sets/src/mage/cards/m/MenacingOgre.java index 4ef35e15ee9..ca1b946370a 100644 --- a/Mage.Sets/src/mage/cards/m/MenacingOgre.java +++ b/Mage.Sets/src/mage/cards/m/MenacingOgre.java @@ -96,7 +96,7 @@ class MenacingOgreEffect extends OneShotEffect { if (player != null) { game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player)); if (numberChosen.get(player) >= highestNumber) { - player.loseLife(highestNumber, game, false); + player.loseLife(highestNumber, game, source, false); if (player.getId().equals(source.getControllerId()) && menacingOgre != null) { menacingOgre.addCounters(CounterType.P1P1.createInstance(2), source, game); diff --git a/Mage.Sets/src/mage/cards/m/MercadianLift.java b/Mage.Sets/src/mage/cards/m/MercadianLift.java index d982a26caed..8b84910a79e 100644 --- a/Mage.Sets/src/mage/cards/m/MercadianLift.java +++ b/Mage.Sets/src/mage/cards/m/MercadianLift.java @@ -85,7 +85,7 @@ class MercadianLiftEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, numberOfCounters)); filter.setMessage("creature card with converted mana cost " + numberOfCounters); TargetCardInHand target = new TargetCardInHand(filter); - if (target.canChoose(controller.getId(), game) + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseUse(Outcome.PutCardInPlay, "Put " + filter.getMessage() + " from your hand onto the battlefield?", source, game) && controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { target.setRequired(false); diff --git a/Mage.Sets/src/mage/cards/m/MercyKilling.java b/Mage.Sets/src/mage/cards/m/MercyKilling.java index 57d825141dc..42ecaabe0a0 100644 --- a/Mage.Sets/src/mage/cards/m/MercyKilling.java +++ b/Mage.Sets/src/mage/cards/m/MercyKilling.java @@ -59,7 +59,7 @@ class MercyKillingTokenEffect extends OneShotEffect { Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (permanent != null) { int power = permanent.getPower().getValue(); - return new MercyKillingToken().putOntoBattlefield(power, game, source.getSourceId(), permanent.getControllerId()); + return new MercyKillingToken().putOntoBattlefield(power, game, source, permanent.getControllerId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/m/MerenOfClanNelToth.java b/Mage.Sets/src/mage/cards/m/MerenOfClanNelToth.java index ca3045c93f3..ebcceeb5fec 100644 --- a/Mage.Sets/src/mage/cards/m/MerenOfClanNelToth.java +++ b/Mage.Sets/src/mage/cards/m/MerenOfClanNelToth.java @@ -95,7 +95,7 @@ class MerenOfClanNelTothEffect extends OneShotEffect { targetZone = Zone.BATTLEFIELD; text = " put onto battlefield for "; } - card.moveToZone(targetZone, source.getSourceId(), game, false); + card.moveToZone(targetZone, source, game, false); game.informPlayers("Meren of Clan Nel Toth: " + card.getName() + text + player.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java b/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java index 7e20fbf9282..8ff0a6da092 100644 --- a/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java +++ b/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java @@ -106,8 +106,8 @@ class MeriekeRiBeritDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE - || event.getType() == EventType.UNTAPPED; + return event.getType() == GameEvent.EventType.ZONE_CHANGE + || event.getType() == GameEvent.EventType.UNTAPPED; } @Override @@ -119,7 +119,7 @@ class MeriekeRiBeritDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId() != null) { - if (event.getType() == EventType.ZONE_CHANGE + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(getSourceId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; return zEvent.getFromZone() == Zone.BATTLEFIELD; diff --git a/Mage.Sets/src/mage/cards/m/Merseine.java b/Mage.Sets/src/mage/cards/m/Merseine.java index 43fb78e408e..3bb87b41a3d 100644 --- a/Mage.Sets/src/mage/cards/m/Merseine.java +++ b/Mage.Sets/src/mage/cards/m/Merseine.java @@ -115,24 +115,24 @@ class MerseineCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent sourcePermanent = game.getBattlefield().getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent sourcePermanent = game.getBattlefield().getPermanent(source.getSourceId()); if (sourcePermanent != null) { Permanent attachedTo = game.getPermanent(sourcePermanent.getAttachedTo()); if (attachedTo != null) { - return attachedTo.getManaCost().canPay(ability, sourceId, controllerId, game); + return attachedTo.getManaCost().canPay(ability, source, controllerId, game); } } return false; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent sourcePermanent = game.getBattlefield().getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent sourcePermanent = game.getBattlefield().getPermanent(source.getSourceId()); if (sourcePermanent != null) { Permanent attachedTo = game.getPermanent(sourcePermanent.getAttachedTo()); if (attachedTo != null) { - paid = attachedTo.getManaCost().pay(ability, game, sourceId, controllerId, noMana); + paid = attachedTo.getManaCost().pay(ability, game, source, controllerId, noMana); } } return paid; diff --git a/Mage.Sets/src/mage/cards/m/MesmericOrb.java b/Mage.Sets/src/mage/cards/m/MesmericOrb.java index b9389614cfa..dd1ff8d6278 100644 --- a/Mage.Sets/src/mage/cards/m/MesmericOrb.java +++ b/Mage.Sets/src/mage/cards/m/MesmericOrb.java @@ -54,7 +54,7 @@ class MesmericOrbTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAPPED; + return event.getType() == GameEvent.EventType.UNTAPPED; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java b/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java index 5288f951286..25abc38dada 100644 --- a/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java +++ b/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java @@ -103,7 +103,7 @@ class MetzaliTowerOfTriumphEffect extends OneShotEffect { if (!available.isEmpty()) { Permanent permanent = available.get(RandomUtil.nextInt(available.size())); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MidnightClock.java b/Mage.Sets/src/mage/cards/m/MidnightClock.java index 662a0773641..46201106b12 100644 --- a/Mage.Sets/src/mage/cards/m/MidnightClock.java +++ b/Mage.Sets/src/mage/cards/m/MidnightClock.java @@ -135,7 +135,7 @@ class MidnightClockEffect extends OneShotEffect { cards.addAll(player.getGraveyard()); player.putCardsOnTopOfLibrary(cards, game, source, false); player.shuffleLibrary(source, game); - player.drawCards(7, source.getSourceId(), game); + player.drawCards(7, source, game); return effect.apply(game, source); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/m/MidnightRitual.java b/Mage.Sets/src/mage/cards/m/MidnightRitual.java index 08ccd0518a6..49b1f127e57 100644 --- a/Mage.Sets/src/mage/cards/m/MidnightRitual.java +++ b/Mage.Sets/src/mage/cards/m/MidnightRitual.java @@ -77,7 +77,7 @@ class MidnightRitualEffect extends OneShotEffect { Cards cardsToExile = new CardsImpl(getTargetPointer().getTargets(game, source)); controller.moveCards(cardsToExile, Zone.EXILED, source, game); if (!cardsToExile.isEmpty()) { - new ZombieToken().putOntoBattlefield(cardsToExile.size(), game, source.getSourceId(), controller.getId()); + new ZombieToken().putOntoBattlefield(cardsToExile.size(), game, source, controller.getId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MijaeDjinn.java b/Mage.Sets/src/mage/cards/m/MijaeDjinn.java index 6ec0f9b8d1d..cc5f2b51581 100644 --- a/Mage.Sets/src/mage/cards/m/MijaeDjinn.java +++ b/Mage.Sets/src/mage/cards/m/MijaeDjinn.java @@ -61,7 +61,7 @@ class MijaeDjinnEffect extends OneShotEffect { return true; } else { creature.removeFromCombat(game); - creature.tap(game); + creature.tap(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MilitiasPride.java b/Mage.Sets/src/mage/cards/m/MilitiasPride.java index 5d413d911c0..966b82c770a 100644 --- a/Mage.Sets/src/mage/cards/m/MilitiasPride.java +++ b/Mage.Sets/src/mage/cards/m/MilitiasPride.java @@ -57,7 +57,7 @@ class MilitiasPrideTriggerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MimicVat.java b/Mage.Sets/src/mage/cards/m/MimicVat.java index f0ae7a737cf..e4abd32824c 100644 --- a/Mage.Sets/src/mage/cards/m/MimicVat.java +++ b/Mage.Sets/src/mage/cards/m/MimicVat.java @@ -73,7 +73,7 @@ class MimicVatTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MimingSlime.java b/Mage.Sets/src/mage/cards/m/MimingSlime.java index 19687adf020..99b987e5bfe 100644 --- a/Mage.Sets/src/mage/cards/m/MimingSlime.java +++ b/Mage.Sets/src/mage/cards/m/MimingSlime.java @@ -69,7 +69,7 @@ class MimingSlimeEffect extends OneShotEffect { OozeToken oozeToken = new OozeToken(); oozeToken.getPower().modifyBaseValue(amount); oozeToken.getToughness().modifyBaseValue(amount); - oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + oozeToken.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MinamosMeddling.java b/Mage.Sets/src/mage/cards/m/MinamosMeddling.java index 11887b5046f..f7a479c444b 100644 --- a/Mage.Sets/src/mage/cards/m/MinamosMeddling.java +++ b/Mage.Sets/src/mage/cards/m/MinamosMeddling.java @@ -65,7 +65,7 @@ class MinamosMeddlingCounterTargetEffect extends OneShotEffect { if (spell == null) { continue; } - game.getStack().counter(targetId, source.getSourceId(), game); + game.getStack().counter(targetId, source, game); Player spellController = game.getPlayer(spell.getControllerId()); if (spellController == null) { continue; @@ -82,7 +82,7 @@ class MinamosMeddlingCounterTargetEffect extends OneShotEffect { } } if (!cardsToDiscard.isEmpty()) { - spellController.discard(cardsToDiscard, source, game); + spellController.discard(cardsToDiscard, false, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MindBomb.java b/Mage.Sets/src/mage/cards/m/MindBomb.java index 4fa1119c70c..4319c3ee588 100644 --- a/Mage.Sets/src/mage/cards/m/MindBomb.java +++ b/Mage.Sets/src/mage/cards/m/MindBomb.java @@ -85,7 +85,7 @@ class MindBombEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { Cards cardsPlayer = cardsToDiscard.get(playerId); - cardsToDiscard.put(playerId, player.discard(cardsPlayer, source, game)); + cardsToDiscard.put(playerId, player.discard(cardsPlayer, false, source, game)); } } @@ -97,7 +97,7 @@ class MindBombEffect extends OneShotEffect { } Cards cardsPlayer = cardsToDiscard.get(playerId); if (cardsPlayer != null) { - player.damage(3 - cardsPlayer.size(), source.getId(), game); + player.damage(3 - cardsPlayer.size(), source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MindExtraction.java b/Mage.Sets/src/mage/cards/m/MindExtraction.java index 7a377321463..69fd54fef0c 100644 --- a/Mage.Sets/src/mage/cards/m/MindExtraction.java +++ b/Mage.Sets/src/mage/cards/m/MindExtraction.java @@ -99,7 +99,7 @@ class MindExtractionEffect extends OneShotEffect { .stream() .filter(card -> card.getColor(game).shares(color)) .forEach(toDiscard::add); - player.discard(toDiscard, source, game); + player.discard(toDiscard, false, source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/m/MindMaggots.java b/Mage.Sets/src/mage/cards/m/MindMaggots.java index c68088cb883..b6b2528fbbd 100644 --- a/Mage.Sets/src/mage/cards/m/MindMaggots.java +++ b/Mage.Sets/src/mage/cards/m/MindMaggots.java @@ -72,7 +72,7 @@ class MindMaggotsEffect extends OneShotEffect { } TargetCard target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURE, controller.getId()); controller.choose(outcome, controller.getHand(), target, game); - int counters = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); + int counters = controller.discard(new CardsImpl(target.getTargets()), false, source, game).size(); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null || counters < 1) { return true; diff --git a/Mage.Sets/src/mage/cards/m/MindWarp.java b/Mage.Sets/src/mage/cards/m/MindWarp.java index e67eddd1c41..ecf88172c4b 100644 --- a/Mage.Sets/src/mage/cards/m/MindWarp.java +++ b/Mage.Sets/src/mage/cards/m/MindWarp.java @@ -60,7 +60,7 @@ class MindWarpEffect extends OneShotEffect { int amountToDiscard = source.getManaCostsToPay().getX(); TargetCard target = new TargetCardInHand(amountToDiscard, StaticFilters.FILTER_CARD_CARDS); you.choose(outcome, targetPlayer.getHand(), target, game); - targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); + targetPlayer.discard(new CardsImpl(target.getTargets()), false, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/m/MindWhip.java b/Mage.Sets/src/mage/cards/m/MindWhip.java index 447b89154a3..12a21330dcd 100644 --- a/Mage.Sets/src/mage/cards/m/MindWhip.java +++ b/Mage.Sets/src/mage/cards/m/MindWhip.java @@ -84,7 +84,7 @@ class MindWhipEffect extends OneShotEffect { Effect effect = new DamageTargetEffect(2); effect.setTargetPointer(new FixedTarget(controllerOfEnchantedCreature.getId())); effect.apply(game, source); - enchantedCreature.tap(game); + enchantedCreature.tap(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MindbladeRender.java b/Mage.Sets/src/mage/cards/m/MindbladeRender.java index f17a4d593cb..2a185c667e2 100644 --- a/Mage.Sets/src/mage/cards/m/MindbladeRender.java +++ b/Mage.Sets/src/mage/cards/m/MindbladeRender.java @@ -82,13 +82,13 @@ class MindbladeRenderTriggeredAbility extends TriggeredAbilityImpl { if (controller == null) { return false; } - Permanent damager = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (damager == null) { + Permanent attacker = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (attacker == null) { return false; } if (((DamagedPlayerEvent) event).isCombatDamage() && controller.hasOpponent(event.getTargetId(), game) - && damager.hasSubtype(SubType.WARRIOR, game) + && attacker.hasSubtype(SubType.WARRIOR, game) && !usedForCombatDamageStep) { usedForCombatDamageStep = true; return true; diff --git a/Mage.Sets/src/mage/cards/m/Mindblaze.java b/Mage.Sets/src/mage/cards/m/Mindblaze.java index 39afe4a1e2b..fdebd61886b 100644 --- a/Mage.Sets/src/mage/cards/m/Mindblaze.java +++ b/Mage.Sets/src/mage/cards/m/Mindblaze.java @@ -93,7 +93,7 @@ class MindblazeEffect extends OneShotEffect { filter.add(new NamePredicate(cardChoice.getChoice())); int count = Integer.parseInt(numberChoice.getChoice()); if (player.getLibrary().count(filter, game) == count) { - player.damage(8, source.getSourceId(), game.copy()); + player.damage(8, source.getSourceId(), source, game); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/m/Mindcrank.java b/Mage.Sets/src/mage/cards/m/Mindcrank.java index f2610c32dc5..54d9ee2d3d3 100644 --- a/Mage.Sets/src/mage/cards/m/Mindcrank.java +++ b/Mage.Sets/src/mage/cards/m/Mindcrank.java @@ -59,7 +59,7 @@ class MindcrankTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_LIFE; + return event.getType() == GameEvent.EventType.LOST_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MindlockOrb.java b/Mage.Sets/src/mage/cards/m/MindlockOrb.java index 7f48df13afb..aa68578eeb2 100644 --- a/Mage.Sets/src/mage/cards/m/MindlockOrb.java +++ b/Mage.Sets/src/mage/cards/m/MindlockOrb.java @@ -58,7 +58,7 @@ class MindlockRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - return event.getType() == EventType.SEARCH_LIBRARY; + return event.getType() == GameEvent.EventType.SEARCH_LIBRARY; } @Override diff --git a/Mage.Sets/src/mage/cards/m/Mindmoil.java b/Mage.Sets/src/mage/cards/m/Mindmoil.java index b4ba0dadc1b..020df4f010e 100644 --- a/Mage.Sets/src/mage/cards/m/Mindmoil.java +++ b/Mage.Sets/src/mage/cards/m/Mindmoil.java @@ -53,7 +53,7 @@ class MindmoilEffect extends OneShotEffect { if (you != null) { int count = you.getHand().size(); you.putCardsOnBottomOfLibrary(you.getHand(), game, source, true); - you.drawCards(count, source.getSourceId(), game); + you.drawCards(count, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/Mindreaver.java b/Mage.Sets/src/mage/cards/m/Mindreaver.java index f2fda1722ed..b4f3af4b636 100644 --- a/Mage.Sets/src/mage/cards/m/Mindreaver.java +++ b/Mage.Sets/src/mage/cards/m/Mindreaver.java @@ -91,7 +91,7 @@ class MindreaverExileEffect extends OneShotEffect { for (int i = 0; i < 3; i++) { Card card = opponent.getLibrary().getFromTop(game); if (card != null) { - card.moveToExile(exileId, sourceObject.getIdName(), source.getSourceId(), game); + card.moveToExile(exileId, sourceObject.getIdName(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/m/MindsAglow.java b/Mage.Sets/src/mage/cards/m/MindsAglow.java index 7614b133e21..7e835754180 100644 --- a/Mage.Sets/src/mage/cards/m/MindsAglow.java +++ b/Mage.Sets/src/mage/cards/m/MindsAglow.java @@ -70,7 +70,7 @@ class MindsAglowEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(xSum, source.getSourceId(), game); + player.drawCards(xSum, source, game); } } diff --git a/Mage.Sets/src/mage/cards/m/Mindsparker.java b/Mage.Sets/src/mage/cards/m/Mindsparker.java index 82b25e6ede5..f7d8bd1a870 100644 --- a/Mage.Sets/src/mage/cards/m/Mindsparker.java +++ b/Mage.Sets/src/mage/cards/m/Mindsparker.java @@ -78,7 +78,7 @@ class MindsparkerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(2, source.getSourceId(), game); + targetPlayer.damage(2, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MindstormCrown.java b/Mage.Sets/src/mage/cards/m/MindstormCrown.java index 533486457d1..dcf7dbef40d 100644 --- a/Mage.Sets/src/mage/cards/m/MindstormCrown.java +++ b/Mage.Sets/src/mage/cards/m/MindstormCrown.java @@ -65,10 +65,10 @@ class MindstormCrownEffect extends OneShotEffect { MindstormCrownWatcher watcher = game.getState().getWatcher(MindstormCrownWatcher.class); if (watcher != null && watcher.getCardsInHandCount() == 0) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } else { if (permanent != null) { - controller.damage(1, permanent.getId(), game); + controller.damage(1, permanent.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/Mindswipe.java b/Mage.Sets/src/mage/cards/m/Mindswipe.java index b555dad5c82..0a9274fc3d9 100644 --- a/Mage.Sets/src/mage/cards/m/Mindswipe.java +++ b/Mage.Sets/src/mage/cards/m/Mindswipe.java @@ -74,7 +74,7 @@ class MindswipeEffect extends OneShotEffect { Player spellController = game.getPlayer(spell.getControllerId()); if (spellController != null) { int damage = ManacostVariableValue.instance.calculate(game, source, this); - spellController.damage(damage, source.getSourceId(), game); + spellController.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MineLayer.java b/Mage.Sets/src/mage/cards/m/MineLayer.java index 3388ac9b71e..3f85a85c070 100644 --- a/Mage.Sets/src/mage/cards/m/MineLayer.java +++ b/Mage.Sets/src/mage/cards/m/MineLayer.java @@ -87,7 +87,7 @@ class RemoveAllMineCountersEffect extends OneShotEffect { if (permanent != null) { int numToRemove = permanent.getCounters(game).getCount(CounterType.MINE); if (numToRemove > 0) { - permanent.removeCounters(CounterType.MINE.getName(), numToRemove, game); + permanent.removeCounters(CounterType.MINE.getName(), numToRemove, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/m/MinionOfLeshrac.java b/Mage.Sets/src/mage/cards/m/MinionOfLeshrac.java index d670508085c..f5230388e55 100644 --- a/Mage.Sets/src/mage/cards/m/MinionOfLeshrac.java +++ b/Mage.Sets/src/mage/cards/m/MinionOfLeshrac.java @@ -90,12 +90,12 @@ class MinionLeshracEffect extends OneShotEffect { TargetControlledPermanent target = new TargetControlledPermanent(filterCreature); SacrificeTargetCost cost = new SacrificeTargetCost(target); if (controller.chooseUse(Outcome.AIDontUseIt, "Do you wish to sacrifice another creature to prevent the 5 damage to you?", source, game) - && cost.canPay(source, source.getSourceId(), source.getControllerId(), game) - && cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + && cost.canPay(source, source, source.getControllerId(), game) + && cost.pay(source, game, source, source.getControllerId(), true)) { return true; } - if (controller.damage(5, minionLeshrac.getId(), game) > 0) { - minionLeshrac.tap(game); + if (controller.damage(5, minionLeshrac.getId(), source, game) > 0) { + minionLeshrac.tap(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java index bf506fabc6d..62580bbdbfc 100644 --- a/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java +++ b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java @@ -77,7 +77,7 @@ class MinionOfTheWastesEffect extends OneShotEffect { } int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game); Cost cost = new PayLifeCost(payAmount); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } Card sourceCard = game.getCard(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/m/MinionsMurmurs.java b/Mage.Sets/src/mage/cards/m/MinionsMurmurs.java index ae171e9a0e5..48b8f4bc463 100644 --- a/Mage.Sets/src/mage/cards/m/MinionsMurmurs.java +++ b/Mage.Sets/src/mage/cards/m/MinionsMurmurs.java @@ -56,8 +56,8 @@ public final class MinionsMurmurs extends CardImpl { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int creaturesControlled = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game); - controller.drawCards(creaturesControlled, source.getSourceId(), game); - controller.loseLife(creaturesControlled, game, false); + controller.drawCards(creaturesControlled, source, game); + controller.loseLife(creaturesControlled, game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/Mirari.java b/Mage.Sets/src/mage/cards/m/Mirari.java index 14216e75c58..b18147d074b 100644 --- a/Mage.Sets/src/mage/cards/m/Mirari.java +++ b/Mage.Sets/src/mage/cards/m/Mirari.java @@ -70,7 +70,7 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MirrorStrike.java b/Mage.Sets/src/mage/cards/m/MirrorStrike.java index f9e3a6efb5c..c97f1c9d7f6 100644 --- a/Mage.Sets/src/mage/cards/m/MirrorStrike.java +++ b/Mage.Sets/src/mage/cards/m/MirrorStrike.java @@ -84,7 +84,7 @@ class MirrorStrikeEffect extends ReplacementEffectImpl { if (targetPermanent != null) { Player targetsController = game.getPlayer(targetPermanent.getControllerId()); if (targetsController != null) { - targetsController.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + targetsController.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MirrorwingDragon.java b/Mage.Sets/src/mage/cards/m/MirrorwingDragon.java index 72b2f41ddea..07f11409ea8 100644 --- a/Mage.Sets/src/mage/cards/m/MirrorwingDragon.java +++ b/Mage.Sets/src/mage/cards/m/MirrorwingDragon.java @@ -70,7 +70,7 @@ class MirrorwingDragonCopyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/m/Mise.java b/Mage.Sets/src/mage/cards/m/Mise.java index b09b753876f..f7e3182af87 100644 --- a/Mage.Sets/src/mage/cards/m/Mise.java +++ b/Mage.Sets/src/mage/cards/m/Mise.java @@ -59,7 +59,7 @@ class MiseEffect extends OneShotEffect { if (card != null) { player.revealCards("Mise", cards, game, true); if (CardUtil.haveSameNames(card, cardName, game)) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/Misfortune.java b/Mage.Sets/src/mage/cards/m/Misfortune.java index b2ebd15c9f5..4823ac906e5 100644 --- a/Mage.Sets/src/mage/cards/m/Misfortune.java +++ b/Mage.Sets/src/mage/cards/m/Misfortune.java @@ -79,7 +79,7 @@ class MisfortuneEffect extends OneShotEffect { Effect putM1M1CounterOnEachOpponentCreature = new AddCountersAllEffect( CounterType.M1M1.createInstance(), filterOpponentCreatures); putM1M1CounterOnEachOpponentCreature.apply(game, source); - chosenOpponent.damage(4, source.getSourceId(), game); + chosenOpponent.damage(4, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MisfortunesGain.java b/Mage.Sets/src/mage/cards/m/MisfortunesGain.java index 5ff4d97d0ba..b91b38691c1 100644 --- a/Mage.Sets/src/mage/cards/m/MisfortunesGain.java +++ b/Mage.Sets/src/mage/cards/m/MisfortunesGain.java @@ -58,7 +58,7 @@ class MisfortunesGainEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && target != null) { - target.destroy(source.getSourceId(), game, false); + target.destroy(source, game, false); Player owner = game.getPlayer(target.getOwnerId()); if (owner != null) { owner.gainLife(4, game, source); diff --git a/Mage.Sets/src/mage/cards/m/MishraArtificerProdigy.java b/Mage.Sets/src/mage/cards/m/MishraArtificerProdigy.java index a801c5a83d5..3bdc641d85c 100644 --- a/Mage.Sets/src/mage/cards/m/MishraArtificerProdigy.java +++ b/Mage.Sets/src/mage/cards/m/MishraArtificerProdigy.java @@ -70,7 +70,7 @@ class MishraArtificerProdigyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MishrasWarMachine.java b/Mage.Sets/src/mage/cards/m/MishrasWarMachine.java index f40c0743fb1..a1b27612b69 100644 --- a/Mage.Sets/src/mage/cards/m/MishrasWarMachine.java +++ b/Mage.Sets/src/mage/cards/m/MishrasWarMachine.java @@ -67,12 +67,12 @@ class MishrasWarMachineEffect extends OneShotEffect { && sourcePermanent != null) { DiscardCardCost cost = new DiscardCardCost(); if (controller.chooseUse(Outcome.Benefit, "Do you wish to discard a card to prevent the 3 damage to you?", source, game) - && cost.canPay(source, source.getSourceId(), source.getControllerId(), game) - && cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + && cost.canPay(source, source, source.getControllerId(), game) + && cost.pay(source, game, source, source.getControllerId(), true)) { return true; } - if (controller.damage(3, sourcePermanent.getId(), game) > 0) { - sourcePermanent.tap(game); + if (controller.damage(3, sourcePermanent.getId(), source, game) > 0) { + sourcePermanent.tap(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MissDemeanor.java b/Mage.Sets/src/mage/cards/m/MissDemeanor.java index e262d64ff87..79068d8f447 100644 --- a/Mage.Sets/src/mage/cards/m/MissDemeanor.java +++ b/Mage.Sets/src/mage/cards/m/MissDemeanor.java @@ -78,7 +78,7 @@ class MissDemeanorEffect extends OneShotEffect { // TODO(Ketsuban): this could probably stand to be randomly chosen from a pool of compliments game.informPlayers(controller.getLogName() + ": That's a well-built deck and you pilot it well, " + activePlayerName + "."); } else { - sourceObject.sacrifice(source.getSourceId(), game); + sourceObject.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MistbladeShinobi.java b/Mage.Sets/src/mage/cards/m/MistbladeShinobi.java index af47244be44..c6bee77404d 100644 --- a/Mage.Sets/src/mage/cards/m/MistbladeShinobi.java +++ b/Mage.Sets/src/mage/cards/m/MistbladeShinobi.java @@ -69,7 +69,7 @@ class MistbladeShinobiTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MobRule.java b/Mage.Sets/src/mage/cards/m/MobRule.java index 65c22263939..e8e3f20b33c 100644 --- a/Mage.Sets/src/mage/cards/m/MobRule.java +++ b/Mage.Sets/src/mage/cards/m/MobRule.java @@ -124,7 +124,7 @@ class MobRuleControlAllEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); if (creature != null && controllerId != null) { - return creature.changeControllerId(controllerId, game); + return creature.changeControllerId(controllerId, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/m/MoggAssassin.java b/Mage.Sets/src/mage/cards/m/MoggAssassin.java index 8f8f2a93526..71b9f3ef67d 100644 --- a/Mage.Sets/src/mage/cards/m/MoggAssassin.java +++ b/Mage.Sets/src/mage/cards/m/MoggAssassin.java @@ -112,12 +112,12 @@ class MoggAssassinEffect extends OneShotEffect { Permanent opponentsPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (controller.flipCoin(source, game, true)) { if (chosenPermanent != null) { - chosenPermanent.destroy(source.getSourceId(), game, false); + chosenPermanent.destroy(source, game, false); return true; } } else { if (opponentsPermanent != null) { - opponentsPermanent.destroy(source.getSourceId(), game, false); + opponentsPermanent.destroy(source, game, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MoggInfestation.java b/Mage.Sets/src/mage/cards/m/MoggInfestation.java index e0a05836ef8..dc162828684 100644 --- a/Mage.Sets/src/mage/cards/m/MoggInfestation.java +++ b/Mage.Sets/src/mage/cards/m/MoggInfestation.java @@ -64,7 +64,7 @@ class MoggInfestationEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && getTargetPointer().getFirst(game, source) != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, getTargetPointer().getFirst(game, source), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) { // If a commander is replaced to command zone, the creature does not die Effect effect = new CreateTokenTargetEffect(new GoblinToken(), 2); effect.setTargetPointer(getTargetPointer()); diff --git a/Mage.Sets/src/mage/cards/m/MoggManiac.java b/Mage.Sets/src/mage/cards/m/MoggManiac.java index e4963b660fc..aa9b107edb1 100644 --- a/Mage.Sets/src/mage/cards/m/MoggManiac.java +++ b/Mage.Sets/src/mage/cards/m/MoggManiac.java @@ -62,7 +62,7 @@ class MoggManiacDealDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = (Integer) getValue("damage"); if (amount > 0) { - game.damagePlayerOrPlaneswalker(targetPointer.getFirst(game, source), amount, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(targetPointer.getFirst(game, source), amount, source.getSourceId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java index 6000bc55214..3911453757e 100644 --- a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java +++ b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java @@ -81,18 +81,18 @@ class MogisGodOfSlaughterEffect extends OneShotEffect { return false; } if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, game.getActivePlayerId(), game) == 0) { - return player.damage(2, source.getSourceId(), game) > 0; + return player.damage(2, source.getSourceId(), source, game) > 0; } TargetPermanent target = new TargetControlledCreaturePermanent(1); target.setNotTarget(true); - if (target.canChoose(player.getId(), game) + if (target.canChoose(source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, "Sacrifice a creature to prevent 2 damage?", source, game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { return true; } } - return player.damage(2, source.getSourceId(), game) > 0; + return player.damage(2, source.getSourceId(), source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/m/MolderBeast.java b/Mage.Sets/src/mage/cards/m/MolderBeast.java index b598f362f2a..26b54e1f45c 100644 --- a/Mage.Sets/src/mage/cards/m/MolderBeast.java +++ b/Mage.Sets/src/mage/cards/m/MolderBeast.java @@ -56,7 +56,7 @@ class MolderBeastTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MoltenBirth.java b/Mage.Sets/src/mage/cards/m/MoltenBirth.java index 6fbee1801cb..fa10f8153ae 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenBirth.java +++ b/Mage.Sets/src/mage/cards/m/MoltenBirth.java @@ -58,11 +58,11 @@ class MoltenBirthEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { MoltenBirthElementalToken token = new MoltenBirthElementalToken(); - token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(2, game, source, source.getControllerId()); if (controller.flipCoin(source, game, true)) { Card molten = game.getCard(source.getSourceId()); if (molten != null) { - molten.moveToZone(Zone.HAND, source.getSourceId(), game, true); + molten.moveToZone(Zone.HAND, source, game, true); game.informPlayers(controller.getLogName() + " won the flip. " + molten.getLogName() + " is returned to " + controller.getLogName() + "'s hand."); } } diff --git a/Mage.Sets/src/mage/cards/m/MoltenDisaster.java b/Mage.Sets/src/mage/cards/m/MoltenDisaster.java index d8da46e057b..fc308557eb5 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenDisaster.java +++ b/Mage.Sets/src/mage/cards/m/MoltenDisaster.java @@ -128,12 +128,12 @@ class MoltenDisasterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = source.getManaCostsToPay().getX(); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MoltenHydra.java b/Mage.Sets/src/mage/cards/m/MoltenHydra.java index f78ba40dc35..16fcf351dc2 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenHydra.java +++ b/Mage.Sets/src/mage/cards/m/MoltenHydra.java @@ -62,9 +62,9 @@ enum MoltenHydraDynamicValue implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - for (Cost cost : source.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof RemoveAllCountersSourceCost) { count += ((RemoveAllCountersSourceCost) cost).getRemovedCounters(); } diff --git a/Mage.Sets/src/mage/cards/m/MoltenInfluence.java b/Mage.Sets/src/mage/cards/m/MoltenInfluence.java index eb3d93dc230..08c8b777234 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenInfluence.java +++ b/Mage.Sets/src/mage/cards/m/MoltenInfluence.java @@ -61,10 +61,10 @@ class MoltenInfluenceEffect extends OneShotEffect { Player player = game.getPlayer(spell.getControllerId()); String message = "Have Molten Influence do 4 damage to you?"; if (player != null && player.chooseUse(Outcome.Damage, message, source, game)) { - player.damage(4, source.getSourceId(), game); + player.damage(4, source.getSourceId(), source, game); return true; } else { - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/m/MoltenPsyche.java b/Mage.Sets/src/mage/cards/m/MoltenPsyche.java index 642ff01897a..917b97e07e4 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenPsyche.java +++ b/Mage.Sets/src/mage/cards/m/MoltenPsyche.java @@ -78,7 +78,7 @@ class MoltenPsycheEffect extends OneShotEffect { for (UUID playerId : cardsToDraw.keySet()) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(cardsToDraw.get(playerId), source.getSourceId(), game); + player.drawCards(cardsToDraw.get(playerId), source, game); } } if (MetalcraftCondition.instance.apply(game, source)) { @@ -87,7 +87,7 @@ class MoltenPsycheEffect extends OneShotEffect { if (game.isOpponent(controller, playerId)) { Player player = game.getPlayer(playerId); if (player != null && watcher != null) { - player.damage(watcher.getDraws(playerId), source.getSourceId(), game); + player.damage(watcher.getDraws(playerId), source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/m/MoltenRain.java b/Mage.Sets/src/mage/cards/m/MoltenRain.java index 770a025024a..9c98e55c22b 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenRain.java +++ b/Mage.Sets/src/mage/cards/m/MoltenRain.java @@ -63,7 +63,7 @@ class MoltenRainEffect extends OneShotEffect { if (permanent != null && !permanent.isBasic()) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MoltenTailMasticore.java b/Mage.Sets/src/mage/cards/m/MoltenTailMasticore.java index 8997595b551..781c8b89f11 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenTailMasticore.java +++ b/Mage.Sets/src/mage/cards/m/MoltenTailMasticore.java @@ -76,7 +76,7 @@ class MoltenTailMasticoreAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MomentousFall.java b/Mage.Sets/src/mage/cards/m/MomentousFall.java index 05a94426788..d709fd03e31 100644 --- a/Mage.Sets/src/mage/cards/m/MomentousFall.java +++ b/Mage.Sets/src/mage/cards/m/MomentousFall.java @@ -68,7 +68,7 @@ class MomentousFallEffect extends OneShotEffect { } } if (power > 0) { - controller.drawCards(power, source.getSourceId(), game); + controller.drawCards(power, source, game); } if (toughness > 0) { controller.gainLife(toughness, game, source); diff --git a/Mage.Sets/src/mage/cards/m/Monomania.java b/Mage.Sets/src/mage/cards/m/Monomania.java index 86f4ac069ff..3bc03f33710 100644 --- a/Mage.Sets/src/mage/cards/m/Monomania.java +++ b/Mage.Sets/src/mage/cards/m/Monomania.java @@ -62,7 +62,7 @@ class MonomaniaEffect extends OneShotEffect { player.choose(Outcome.Benefit, player.getHand(), target, game); Cards cards = player.getHand().copy(); cards.removeIf(target.getTargets()::contains); - return !player.discard(cards, source, game).isEmpty(); + return !player.discard(cards, false, source, game).isEmpty(); } @Override diff --git a/Mage.Sets/src/mage/cards/m/Monsoon.java b/Mage.Sets/src/mage/cards/m/Monsoon.java index 26a9e548f7c..501e25aa5bd 100644 --- a/Mage.Sets/src/mage/cards/m/Monsoon.java +++ b/Mage.Sets/src/mage/cards/m/Monsoon.java @@ -67,10 +67,10 @@ class MonsoonEffect extends OneShotEffect { if (player != null) { int damage = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) { - permanent.tap(game); + permanent.tap(source, game); damage++; } - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MoonlightBargain.java b/Mage.Sets/src/mage/cards/m/MoonlightBargain.java index 8ab8313d735..725a208aca2 100644 --- a/Mage.Sets/src/mage/cards/m/MoonlightBargain.java +++ b/Mage.Sets/src/mage/cards/m/MoonlightBargain.java @@ -69,10 +69,10 @@ class MoonlightBargainEffect extends OneShotEffect { Cards toHand = new CardsImpl(); for (Card card : topFive) { PayLifeCost cost = new PayLifeCost(2); - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) { + if (cost.canPay(source, source, source.getControllerId(), game)) { if (controller.chooseUse(outcome, "Put " + card.getIdName() + " into your graveyard unless you pay 2 life", sourceObject.getIdName(), "Pay 2 life and put into hand", "Put into your graveyard", source, game)) { - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source, source.getControllerId(), false)) { toHand.add(card); } else { controller.moveCards(card, Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/cards/m/MoonlightHunt.java b/Mage.Sets/src/mage/cards/m/MoonlightHunt.java index 67aa8308e1d..fefa370eb28 100644 --- a/Mage.Sets/src/mage/cards/m/MoonlightHunt.java +++ b/Mage.Sets/src/mage/cards/m/MoonlightHunt.java @@ -68,7 +68,7 @@ class MoonlightHuntEffect extends OneShotEffect { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && targetCreature != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { - targetCreature.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); + targetCreature.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MorbidBloom.java b/Mage.Sets/src/mage/cards/m/MorbidBloom.java index 96449793248..b902dc87709 100644 --- a/Mage.Sets/src/mage/cards/m/MorbidBloom.java +++ b/Mage.Sets/src/mage/cards/m/MorbidBloom.java @@ -62,10 +62,10 @@ class MorbidBloomEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Card targetCreatureCard = game.getCard(source.getFirstTarget()); if (targetCreatureCard != null) { - targetCreatureCard.moveToExile(null, null, source.getSourceId(), game); + targetCreatureCard.moveToExile(null, null, source, game); int toughness = targetCreatureCard.getToughness().getValue(); SaprolingToken token = new SaprolingToken(); - return token.putOntoBattlefield(toughness, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(toughness, game, source, source.getControllerId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/m/MorgueBurst.java b/Mage.Sets/src/mage/cards/m/MorgueBurst.java index 10c005dc5a0..8805deb7c8a 100644 --- a/Mage.Sets/src/mage/cards/m/MorgueBurst.java +++ b/Mage.Sets/src/mage/cards/m/MorgueBurst.java @@ -67,12 +67,12 @@ class MorgueBurstEffect extends OneShotEffect { int damage = card.getPower().getValue(); Permanent creature = game.getPermanent(source.getTargets().get(1).getTargets().get(0)); if (creature != null) { - creature.damage(damage, source.getSourceId(), game, false, true); + creature.damage(damage, source.getSourceId(), source, game, false, true); return true; } Player targetPlayer = game.getPlayer(source.getTargets().get(1).getTargets().get(0)); if (targetPlayer != null) { - targetPlayer.damage(damage, source.getSourceId(), game); + targetPlayer.damage(damage, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MortalObstinacy.java b/Mage.Sets/src/mage/cards/m/MortalObstinacy.java index 41f87f79e12..949edade7dd 100644 --- a/Mage.Sets/src/mage/cards/m/MortalObstinacy.java +++ b/Mage.Sets/src/mage/cards/m/MortalObstinacy.java @@ -80,7 +80,7 @@ class MortalObstinacyAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MorticianBeetle.java b/Mage.Sets/src/mage/cards/m/MorticianBeetle.java index 47e923876be..cea636018be 100644 --- a/Mage.Sets/src/mage/cards/m/MorticianBeetle.java +++ b/Mage.Sets/src/mage/cards/m/MorticianBeetle.java @@ -56,16 +56,14 @@ class PlayerSacrificesCreatureTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SACRIFICED_PERMANENT) { - MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (mageObject != null && mageObject.isCreature()) { - return true; - } + MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (mageObject != null && mageObject.isCreature()) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java b/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java index 554082e5697..c6917e3f197 100644 --- a/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java +++ b/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java @@ -118,12 +118,12 @@ class MossbridgeTrollCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { int sumPower = 0; - if (targets.choose(Outcome.Tap, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Tap, controllerId, source.getSourceId(), game)) { for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.tap(game)) { + if (permanent != null && permanent.tap(source, game)) { sumPower += permanent.getPower().getValue(); } } @@ -134,10 +134,10 @@ class MossbridgeTrollCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { int sumPower = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controllerId, game)) { - if (!permanent.getId().equals(sourceId)) { + if (!permanent.getId().equals(source.getSourceId())) { sumPower += permanent.getPower().getValue(); } } diff --git a/Mage.Sets/src/mage/cards/m/Mossdog.java b/Mage.Sets/src/mage/cards/m/Mossdog.java index b052767d072..0edf809c013 100644 --- a/Mage.Sets/src/mage/cards/m/Mossdog.java +++ b/Mage.Sets/src/mage/cards/m/Mossdog.java @@ -59,7 +59,7 @@ class MossdogAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MoxDiamond.java b/Mage.Sets/src/mage/cards/m/MoxDiamond.java index 87dea75671b..4b2e89b941a 100644 --- a/Mage.Sets/src/mage/cards/m/MoxDiamond.java +++ b/Mage.Sets/src/mage/cards/m/MoxDiamond.java @@ -73,10 +73,10 @@ class MoxDiamondReplacementEffect extends ReplacementEffectImpl { if (player != null) { TargetCardInHand target = new TargetCardInHand(new FilterLandCard()); Cost cost = new DiscardTargetCost(target); - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) + if (cost.canPay(source, source, source.getControllerId(), game) && player.chooseUse(outcome, "Discard land? (Otherwise Mox Diamond goes to graveyard)", source, game) && player.chooseTarget(Outcome.Discard, target, source, game)) { - player.discard(game.getCard(target.getFirstTarget()), source, game); + player.discard(game.getCard(target.getFirstTarget()), false, source, game); return false; } else { Permanent permanent = game.getPermanentEntering(event.getTargetId()); diff --git a/Mage.Sets/src/mage/cards/m/MtendaLion.java b/Mage.Sets/src/mage/cards/m/MtendaLion.java index cdda0600843..0135a207696 100644 --- a/Mage.Sets/src/mage/cards/m/MtendaLion.java +++ b/Mage.Sets/src/mage/cards/m/MtendaLion.java @@ -69,7 +69,7 @@ class MtendaLionEffect extends OneShotEffect { } Cost cost = new ManaCostsImpl("{U}"); if (!player.chooseUse(outcome, "Pay {U} to prevent damage?", source, game) - || !cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + || !cost.pay(source, game, source, player.getId(), false)) { return false; } game.addEffect(new PreventCombatDamageBySourceEffect(Duration.EndOfTurn), source); diff --git a/Mage.Sets/src/mage/cards/m/MuYanling.java b/Mage.Sets/src/mage/cards/m/MuYanling.java index ea04edb9fbf..5d14fb84dae 100644 --- a/Mage.Sets/src/mage/cards/m/MuYanling.java +++ b/Mage.Sets/src/mage/cards/m/MuYanling.java @@ -81,7 +81,7 @@ class MuYanlingEffect extends OneShotEffect { return false; } for (Permanent creature : game.getBattlefield().getActivePermanents(filter, player.getId(), source.getSourceId(), game)) { - creature.tap(game); + creature.tap(source, game); } return new AddExtraTurnControllerEffect().apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/m/Mudhole.java b/Mage.Sets/src/mage/cards/m/Mudhole.java index 8b931312b8d..5a8013aa928 100644 --- a/Mage.Sets/src/mage/cards/m/Mudhole.java +++ b/Mage.Sets/src/mage/cards/m/Mudhole.java @@ -58,7 +58,7 @@ class MudholeEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { for (Card card : targetPlayer.getGraveyard().getCards(filter, game)) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/Mudslide.java b/Mage.Sets/src/mage/cards/m/Mudslide.java index e100b8b43fb..cc2213f0e71 100644 --- a/Mage.Sets/src/mage/cards/m/Mudslide.java +++ b/Mage.Sets/src/mage/cards/m/Mudslide.java @@ -90,7 +90,7 @@ class MudslideEffect extends OneShotEffect { if (player.choose(Outcome.Untap, tappedCreatureTarget, source.getSourceId(), game)) { Cost cost = ManaUtil.createManaCost(2, false); Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); - if (tappedCreature != null && cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (tappedCreature != null && cost.pay(source, game, source, player.getId(), false)) { tappedCreature.untap(game); } else { break; diff --git a/Mage.Sets/src/mage/cards/m/MultanisDecree.java b/Mage.Sets/src/mage/cards/m/MultanisDecree.java index 1286263e5e5..f876ba0098d 100644 --- a/Mage.Sets/src/mage/cards/m/MultanisDecree.java +++ b/Mage.Sets/src/mage/cards/m/MultanisDecree.java @@ -58,7 +58,7 @@ class MultanisDecreeDestroyEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); int enchantmentsDestoyed = 0; for (Permanent permanent: game.getState().getBattlefield().getActivePermanents(StaticFilters.FILTER_ENCHANTMENT_PERMANENT, source.getControllerId(), source.getSourceId(), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { enchantmentsDestoyed++; } } diff --git a/Mage.Sets/src/mage/cards/m/MurderOfCrows.java b/Mage.Sets/src/mage/cards/m/MurderOfCrows.java index 462a0e926b5..774de41ca9c 100644 --- a/Mage.Sets/src/mage/cards/m/MurderOfCrows.java +++ b/Mage.Sets/src/mage/cards/m/MurderOfCrows.java @@ -63,8 +63,8 @@ class MurderOfCrowsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.chooseUse(Outcome.DrawCard, "Do you wish to draw a card? If you do, discard a card.", source, game)) { - if (player.drawCards(1, source.getSourceId(), game) > 0) { - player.discard(1, false, source, game); + if (player.drawCards(1, source, game) > 0) { + player.discard(1, false, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MurderousBetrayal.java b/Mage.Sets/src/mage/cards/m/MurderousBetrayal.java index 17388b1ab66..8c524cb737c 100644 --- a/Mage.Sets/src/mage/cards/m/MurderousBetrayal.java +++ b/Mage.Sets/src/mage/cards/m/MurderousBetrayal.java @@ -18,8 +18,10 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; +import mage.game.events.GameEvent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; +import mage.util.CardUtil; /** * @@ -65,25 +67,26 @@ class MurderousBetrayalCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); return controller != null && (controller.getLife() < 1 || controller.canPayLifeCost(ability)); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); - if (controller != null) { - int currentLife = controller.getLife(); - int lifeToPay = (currentLife + currentLife % 2) / 2; // Divide by two and round up. - if (lifeToPay < 0) { - this.paid = true; - } else { - this.paid = (controller.loseLife(lifeToPay, game, false) == lifeToPay); - } - return this.paid; + if (controller == null) { + return false; } - return false; + + int currentLife = controller.getLife(); + int lifeToPay = Math.max(0, (currentLife + currentLife % 2) / 2); // Divide by two and round up. + if (lifeToPay <= 0) { + this.paid = true; + } else { + this.paid = CardUtil.tryPayLife(lifeToPay, controller, source, game); + } + return this.paid; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MurderousRedcap.java b/Mage.Sets/src/mage/cards/m/MurderousRedcap.java index 4c6cf51cbb6..e020b75712b 100644 --- a/Mage.Sets/src/mage/cards/m/MurderousRedcap.java +++ b/Mage.Sets/src/mage/cards/m/MurderousRedcap.java @@ -68,12 +68,12 @@ class MurderousRedcapEffect extends OneShotEffect { sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent != null && permanent != null) { - permanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true); + permanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), source, game, false, true); return true; } Player player = game.getPlayer(source.getFirstTarget()); if (sourcePermanent != null && player != null) { - player.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game); + player.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MurderousSpoils.java b/Mage.Sets/src/mage/cards/m/MurderousSpoils.java index a2415c4254f..8c1c7db9052 100644 --- a/Mage.Sets/src/mage/cards/m/MurderousSpoils.java +++ b/Mage.Sets/src/mage/cards/m/MurderousSpoils.java @@ -81,7 +81,7 @@ class MurderousSpoilsEffect extends OneShotEffect { gainControl.setTargetPointer(new FixedTarget(p, game)); game.addEffect(gainControl, source); } - target.destroy(source.getId(), game, true); + target.destroy(source, game, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MuscleBurst.java b/Mage.Sets/src/mage/cards/m/MuscleBurst.java index a30374d9cfd..fb3c86b7dc8 100644 --- a/Mage.Sets/src/mage/cards/m/MuscleBurst.java +++ b/Mage.Sets/src/mage/cards/m/MuscleBurst.java @@ -74,8 +74,8 @@ class MuscleBurstCount extends CardsInAllGraveyardsCount { } @Override - public int calculate(Game game, Ability source, Effect effect) { - return super.calculate(game, source, effect) + 3; + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return super.calculate(game, sourceAbility, effect) + 3; } } diff --git a/Mage.Sets/src/mage/cards/m/Mutiny.java b/Mage.Sets/src/mage/cards/m/Mutiny.java index 7dca473cb15..0c8b25ca474 100644 --- a/Mage.Sets/src/mage/cards/m/Mutiny.java +++ b/Mage.Sets/src/mage/cards/m/Mutiny.java @@ -73,7 +73,7 @@ class MutinyEffect extends OneShotEffect { int damage = firstTarget.getPower().getValue(); Permanent secondTarget = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (damage > 0 && secondTarget != null) { - secondTarget.damage(damage, firstTarget.getId(), game); + secondTarget.damage(damage, firstTarget.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MycoidShepherd.java b/Mage.Sets/src/mage/cards/m/MycoidShepherd.java index ae18362969c..b4a4cb3b878 100644 --- a/Mage.Sets/src/mage/cards/m/MycoidShepherd.java +++ b/Mage.Sets/src/mage/cards/m/MycoidShepherd.java @@ -59,7 +59,7 @@ class MycoidShepherdTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java b/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java index dee0e164577..88e8f922489 100644 --- a/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java +++ b/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java @@ -75,7 +75,7 @@ class MyojinOfNightsReachEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.discard(opponent.getHand(), source, game); + opponent.discard(opponent.getHand(), false, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java b/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java index 23a755af498..bbd6c4c1a22 100644 --- a/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java +++ b/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java @@ -126,14 +126,14 @@ class MyrBattlesphereEffect extends OneShotEffect { TargetPermanent target = new TargetPermanent(0, 1, filter, true); while (controller.canRespond()) { target.clearChosen(); - if (target.canChoose(source.getControllerId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Myr tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { - game.getPermanent(creature).tap(game); + game.getPermanent(creature).tap(source, game); tappedAmount++; } } else { @@ -148,7 +148,7 @@ class MyrBattlesphereEffect extends OneShotEffect { // boost effect game.addEffect(new BoostSourceEffect(tappedAmount, 0, Duration.EndOfTurn), source); // damage to defender - return game.damagePlayerOrPlaneswalker(targetPointer.getFirst(game, source), tappedAmount, myr.getId(), game, false, true) > 0; + return game.damagePlayerOrPlaneswalker(targetPointer.getFirst(game, source), tappedAmount, myr.getId(), source, game, false, true) > 0; } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MyrWelder.java b/Mage.Sets/src/mage/cards/m/MyrWelder.java index 89118307b22..760b7cbb0d9 100644 --- a/Mage.Sets/src/mage/cards/m/MyrWelder.java +++ b/Mage.Sets/src/mage/cards/m/MyrWelder.java @@ -73,7 +73,7 @@ class MyrWelderEffect extends OneShotEffect { Card card = game.getCard(source.getFirstTarget()); Permanent permanent = game.getPermanent(source.getSourceId()); if (card != null && permanent != null) { - card.moveToExile(getId(), "Myr Welder (Imprint)", source.getSourceId(), game); + card.moveToExile(getId(), "Myr Welder (Imprint)", source, game); permanent.imprint(card.getId(), game); return true; } diff --git a/Mage.Sets/src/mage/cards/m/Myrsmith.java b/Mage.Sets/src/mage/cards/m/Myrsmith.java index 01916ebbac8..3e0f4eb7742 100644 --- a/Mage.Sets/src/mage/cards/m/Myrsmith.java +++ b/Mage.Sets/src/mage/cards/m/Myrsmith.java @@ -58,7 +58,7 @@ class MyrsmithEffect extends CreateTokenEffect { @Override public boolean apply(Game game, Ability source) { Cost cost = ManaUtil.createManaCost(1, false); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { super.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/m/MysticGenesis.java b/Mage.Sets/src/mage/cards/m/MysticGenesis.java index 27527c5e803..0ae3ce449ba 100644 --- a/Mage.Sets/src/mage/cards/m/MysticGenesis.java +++ b/Mage.Sets/src/mage/cards/m/MysticGenesis.java @@ -59,7 +59,7 @@ class MysticGenesisEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source)); if (stackObject != null) { - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); return new CreateTokenEffect(new MysticGenesisOozeToken(stackObject.getConvertedManaCost())).apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/cards/m/MysticMeditation.java b/Mage.Sets/src/mage/cards/m/MysticMeditation.java index cd371a97073..37ece0b0d6d 100644 --- a/Mage.Sets/src/mage/cards/m/MysticMeditation.java +++ b/Mage.Sets/src/mage/cards/m/MysticMeditation.java @@ -66,14 +66,14 @@ class MysticMeditationEffect extends OneShotEffect { && controller.getHand().count(filter, game) > 0 && controller.chooseUse(Outcome.Discard, "Do you want to discard a creature card? If you don't, you must discard 2 cards", source, game)) { Cost cost = new DiscardTargetCost(new TargetCardInHand(filter)); - if (cost.canPay(source, source.getSourceId(), controller.getId(), game)) { - if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { + if (cost.canPay(source, source, controller.getId(), game)) { + if (cost.pay(source, game, source, controller.getId(), false, null)) { return true; } } } if (controller != null) { - controller.discard(2, false, source, game); + controller.discard(2, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/m/MysticRemora.java b/Mage.Sets/src/mage/cards/m/MysticRemora.java index ff57096a5d0..43866012bb5 100644 --- a/Mage.Sets/src/mage/cards/m/MysticRemora.java +++ b/Mage.Sets/src/mage/cards/m/MysticRemora.java @@ -120,10 +120,10 @@ class MysticRemoraEffect extends OneShotEffect { Cost cost = ManaUtil.createManaCost(4, false); String message = "Would you like to pay {4} to prevent the opponent to draw a card?"; if (opponent.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { + && cost.pay(source, game, source, opponent.getId(), false, null)) { return true; } - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MystifyingMaze.java b/Mage.Sets/src/mage/cards/m/MystifyingMaze.java index 9af9f85659d..77e182037e5 100644 --- a/Mage.Sets/src/mage/cards/m/MystifyingMaze.java +++ b/Mage.Sets/src/mage/cards/m/MystifyingMaze.java @@ -74,7 +74,7 @@ class MystifyingMazeEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); MageObject sourceObject = source.getSourceObject(game); if (permanent != null && sourceObject != null) { - if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source, game)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(true, false); effect.setText("At the beginning of the next end step, return it to the battlefield tapped under its owner's control"); diff --git a/Mage.Sets/src/mage/cards/m/MythosOfNethroi.java b/Mage.Sets/src/mage/cards/m/MythosOfNethroi.java index 17c951f86ed..1492c08fd99 100644 --- a/Mage.Sets/src/mage/cards/m/MythosOfNethroi.java +++ b/Mage.Sets/src/mage/cards/m/MythosOfNethroi.java @@ -68,6 +68,6 @@ class MythosOfNethroiEffect extends OneShotEffect { if (permanent == null || (!permanent.isCreature() && !condition.apply(game, source))) { return false; } - return permanent.destroy(source.getSourceId(), game, false); + return permanent.destroy(source, game, false); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/m/MythosOfSnapdax.java b/Mage.Sets/src/mage/cards/m/MythosOfSnapdax.java index 49ac10a33b0..30c859a3799 100644 --- a/Mage.Sets/src/mage/cards/m/MythosOfSnapdax.java +++ b/Mage.Sets/src/mage/cards/m/MythosOfSnapdax.java @@ -119,7 +119,7 @@ class MythosOfSnapdaxEffect extends OneShotEffect { if (permanent == null || toKeep.contains(permanent.getId())) { continue; } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NadierAgentOfTheDuskenel.java b/Mage.Sets/src/mage/cards/n/NadierAgentOfTheDuskenel.java index edc279d0016..db050b6726f 100644 --- a/Mage.Sets/src/mage/cards/n/NadierAgentOfTheDuskenel.java +++ b/Mage.Sets/src/mage/cards/n/NadierAgentOfTheDuskenel.java @@ -91,8 +91,7 @@ class NadierAgentOfTheDuskenelEffect extends OneShotEffect { if (!permanent.isCreature() || permanent.getPower().getValue() < 1) { return false; } - return new ElfToken().putOntoBattlefield( - permanent.getPower().getValue(), game, source.getSourceId(), source.getControllerId() + return new ElfToken().putOntoBattlefield(permanent.getPower().getValue(), game, source, source.getControllerId() ); } } diff --git a/Mage.Sets/src/mage/cards/n/NahiriHeirOfTheAncients.java b/Mage.Sets/src/mage/cards/n/NahiriHeirOfTheAncients.java index e789972171b..4a8981a596f 100644 --- a/Mage.Sets/src/mage/cards/n/NahiriHeirOfTheAncients.java +++ b/Mage.Sets/src/mage/cards/n/NahiriHeirOfTheAncients.java @@ -106,7 +106,7 @@ class NahiriHeirOfTheAncientsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Token token = new KorWarriorToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; @@ -140,7 +140,7 @@ class NahiriHeirOfTheAncientsEffect extends OneShotEffect { TargetPermanent target = new TargetPermanent(filter); target.setNotTarget(true); player.choose(outcome, target, source.getSourceId(), game); - tokenCreature.addAttachment(target.getFirstTarget(), game); + tokenCreature.addAttachment(target.getFirstTarget(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java b/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java index 55746eec977..02b2d7b647d 100644 --- a/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java +++ b/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java @@ -95,7 +95,7 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Token token = new KorSoldierToken(); - if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) { + if (token.putOntoBattlefield(1, game, source, source.getControllerId())) { for (UUID tokenId : token.getLastAddedTokenIds()) { Permanent tokenPermanent = game.getPermanent(tokenId); if (tokenPermanent != null) { @@ -108,9 +108,9 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect { if (equipmentPermanent != null) { Permanent attachedTo = game.getPermanent(equipmentPermanent.getAttachedTo()); if (attachedTo != null) { - attachedTo.removeAttachment(equipmentPermanent.getId(), game); + attachedTo.removeAttachment(equipmentPermanent.getId(), source, game); } - tokenPermanent.addAttachment(equipmentPermanent.getId(), game); + tokenPermanent.addAttachment(equipmentPermanent.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NahirisLithoforming.java b/Mage.Sets/src/mage/cards/n/NahirisLithoforming.java index eb897aafaab..778d95f3d55 100644 --- a/Mage.Sets/src/mage/cards/n/NahirisLithoforming.java +++ b/Mage.Sets/src/mage/cards/n/NahirisLithoforming.java @@ -77,11 +77,11 @@ class NahirisLithoformingSacrificeEffect extends OneShotEffect { int counter = 0; for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); - if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + if (permanent != null && permanent.sacrifice(source, game)) { counter++; } } - player.drawCards(counter, source.getSourceId(), game); + player.drawCards(counter, source, game); game.addEffect(new PlayAdditionalLandsControllerEffect( source.getManaCostsToPay().getX(), Duration.EndOfTurn ), source); diff --git a/Mage.Sets/src/mage/cards/n/NakedSingularity.java b/Mage.Sets/src/mage/cards/n/NakedSingularity.java index 5df61514b88..6515348f607 100644 --- a/Mage.Sets/src/mage/cards/n/NakedSingularity.java +++ b/Mage.Sets/src/mage/cards/n/NakedSingularity.java @@ -130,7 +130,7 @@ class NakedSingularityEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanent(event.getSourceId()); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); return permanent != null && (permanent.hasSubtype(SubType.PLAINS, game) || permanent.hasSubtype(SubType.ISLAND, game) diff --git a/Mage.Sets/src/mage/cards/n/NamelessRace.java b/Mage.Sets/src/mage/cards/n/NamelessRace.java index d5ffc3fc4fc..2bca8248e22 100644 --- a/Mage.Sets/src/mage/cards/n/NamelessRace.java +++ b/Mage.Sets/src/mage/cards/n/NamelessRace.java @@ -102,7 +102,7 @@ class NamelessRaceEffect extends OneShotEffect { int maxAmount = Math.min(permanentsInPlay + cardsInGraveyards, controller.getLife()); int payAmount = controller.getAmount(0, maxAmount, "Pay up to " + maxAmount + " life", game); Cost cost = new PayLifeCost(payAmount); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } Card sourceCard = game.getCard(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/n/NantukoCultivator.java b/Mage.Sets/src/mage/cards/n/NantukoCultivator.java index 1372acb7b24..4e7c95305f8 100644 --- a/Mage.Sets/src/mage/cards/n/NantukoCultivator.java +++ b/Mage.Sets/src/mage/cards/n/NantukoCultivator.java @@ -65,7 +65,7 @@ class NantukoCultivatorEffect extends OneShotEffect { } TargetCardInHand toDiscard = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_LAND); player.chooseTarget(Outcome.AIDontUseIt, toDiscard, source, game); - int count = player.discard(new CardsImpl(toDiscard.getTargets()), source, game).size(); + int count = player.discard(new CardsImpl(toDiscard.getTargets()), false, source, game).size(); if (count < 1) { return false; } @@ -73,7 +73,7 @@ class NantukoCultivatorEffect extends OneShotEffect { if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(count), source, game); } - player.drawCards(count, source.getSourceId(), game); + player.drawCards(count, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/n/NantukoShrine.java b/Mage.Sets/src/mage/cards/n/NantukoShrine.java index 87e64e554b9..b0a94d86eff 100644 --- a/Mage.Sets/src/mage/cards/n/NantukoShrine.java +++ b/Mage.Sets/src/mage/cards/n/NantukoShrine.java @@ -74,7 +74,7 @@ class NantukoShrineEffect extends OneShotEffect { } } if (count > 0) { - new SquirrelToken().putOntoBattlefield(count, game, source.getSourceId(), spell.getControllerId()); + new SquirrelToken().putOntoBattlefield(count, game, source, spell.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/Narcolepsy.java b/Mage.Sets/src/mage/cards/n/Narcolepsy.java index 91426baa95c..e5028aff312 100644 --- a/Mage.Sets/src/mage/cards/n/Narcolepsy.java +++ b/Mage.Sets/src/mage/cards/n/Narcolepsy.java @@ -100,7 +100,7 @@ class NarcolepsyEffect extends OneShotEffect { if (narcolepsy != null) { Permanent enchanted = game.getPermanent(narcolepsy.getAttachedTo()); if (enchanted != null) { - enchanted.tap(game); + enchanted.tap(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NarsetOfTheAncientWay.java b/Mage.Sets/src/mage/cards/n/NarsetOfTheAncientWay.java index 1ef622e1c1e..ab7d2d7faf5 100644 --- a/Mage.Sets/src/mage/cards/n/NarsetOfTheAncientWay.java +++ b/Mage.Sets/src/mage/cards/n/NarsetOfTheAncientWay.java @@ -134,11 +134,11 @@ class NarsetOfTheAncientWayDrawEffect extends OneShotEffect { if (player == null) { return false; } - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); if (player.getHand().isEmpty() || !player.chooseUse(Outcome.Discard, "Discard a card?", source, game)) { return false; } - Card card = player.discardOne(false, source, game); + Card card = player.discardOne(false, false, source, game); if (card == null || card.isLand()) { return false; } diff --git a/Mage.Sets/src/mage/cards/n/NaturalBalance.java b/Mage.Sets/src/mage/cards/n/NaturalBalance.java index 7d9b4c35134..c787e8e2702 100644 --- a/Mage.Sets/src/mage/cards/n/NaturalBalance.java +++ b/Mage.Sets/src/mage/cards/n/NaturalBalance.java @@ -74,7 +74,7 @@ public final class NaturalBalance extends CardImpl { if (target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game)) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), player.getId(), game)) { if (!target.getTargets().contains(permanent.getId())) { - permanent.sacrifice(source.getId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NaturesResurgence.java b/Mage.Sets/src/mage/cards/n/NaturesResurgence.java index 2c6eb292f79..1bda94aac4b 100644 --- a/Mage.Sets/src/mage/cards/n/NaturesResurgence.java +++ b/Mage.Sets/src/mage/cards/n/NaturesResurgence.java @@ -63,7 +63,7 @@ class NaturesResurgenceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int amount = player.getGraveyard().count(filter, game); - player.drawCards(amount, source.getSourceId(), game); + player.drawCards(amount, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java index d60245f6bef..0f2d8ec7e4d 100644 --- a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java +++ b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java @@ -113,7 +113,7 @@ class NayaSoulbeastReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NazahnReveredBladesmith.java b/Mage.Sets/src/mage/cards/n/NazahnReveredBladesmith.java index b1ff992d3d2..87f5c8893f7 100644 --- a/Mage.Sets/src/mage/cards/n/NazahnReveredBladesmith.java +++ b/Mage.Sets/src/mage/cards/n/NazahnReveredBladesmith.java @@ -113,7 +113,7 @@ class NazahnTapEffect extends TapTargetEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/n/Nebuchadnezzar.java b/Mage.Sets/src/mage/cards/n/Nebuchadnezzar.java index 7eee5eec448..18307d6fc57 100644 --- a/Mage.Sets/src/mage/cards/n/Nebuchadnezzar.java +++ b/Mage.Sets/src/mage/cards/n/Nebuchadnezzar.java @@ -86,7 +86,7 @@ class NebuchadnezzarEffect extends OneShotEffect { } opponent.revealCards(sourceObject.getIdName(), cards, game); cards.removeIf(uuid -> !cardName.equals(game.getCard(uuid).getName())); - opponent.discard(cards, source, game); + opponent.discard(cards, false, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/n/NecromancersCovenant.java b/Mage.Sets/src/mage/cards/n/NecromancersCovenant.java index c9f7e8c9fdd..ce5b3415598 100644 --- a/Mage.Sets/src/mage/cards/n/NecromancersCovenant.java +++ b/Mage.Sets/src/mage/cards/n/NecromancersCovenant.java @@ -71,12 +71,12 @@ class NecromancersConvenantEffect extends OneShotEffect { } int count = 0; for (Card card : player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game)) { - if (card.moveToExile(source.getSourceId(), "Necromancer Covenant", source.getSourceId(), game)) { + if (card.moveToExile(source.getSourceId(), "Necromancer Covenant", source, game)) { count += 1; } } ZombieToken zombieToken = new ZombieToken(); - if (zombieToken.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId())) { + if (zombieToken.putOntoBattlefield(count, game, source, source.getControllerId())) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/n/NecromancersStockpile.java b/Mage.Sets/src/mage/cards/n/NecromancersStockpile.java index 13f6a4d93af..d53f1326958 100644 --- a/Mage.Sets/src/mage/cards/n/NecromancersStockpile.java +++ b/Mage.Sets/src/mage/cards/n/NecromancersStockpile.java @@ -63,8 +63,8 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.Discard, controllerId, source.getSourceId(), game)) { Player player = game.getPlayer(controllerId); if (player != null) { for (UUID targetId : targets.get(0).getTargets()) { @@ -73,7 +73,7 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl { return false; } isZombieCard = card.hasSubtype(SubType.ZOMBIE, game); - paid |= player.discard(card, null, game); + paid |= player.discard(card, true, source, game); } } @@ -82,8 +82,8 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/n/Necromancy.java b/Mage.Sets/src/mage/cards/n/Necromancy.java index d0522b0c225..6e6d31402d5 100644 --- a/Mage.Sets/src/mage/cards/n/Necromancy.java +++ b/Mage.Sets/src/mage/cards/n/Necromancy.java @@ -89,7 +89,7 @@ class NecromancyReAttachEffect extends OneShotEffect { controller.moveCards(cardInGraveyard, Zone.BATTLEFIELD, source, game); Permanent enchantedCreature = game.getPermanent(cardInGraveyard.getId()); if (enchantedCreature != null) { - enchantedCreature.addAttachment(enchantment.getId(), game); + enchantedCreature.addAttachment(enchantment.getId(), source, game); FilterCreaturePermanent filter = new FilterCreaturePermanent("enchant creature put onto the battlefield with " + enchantment.getIdName()); filter.add(new PermanentIdPredicate(cardInGraveyard.getId())); Target target = new TargetCreaturePermanent(filter); @@ -127,7 +127,7 @@ class NecromancyLeavesBattlefieldTriggeredEffect extends OneShotEffect { if (sourcePermanent.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(sourcePermanent.getAttachedTo()); if (attachedTo != null && attachedTo.getZoneChangeCounter(game) == sourcePermanent.getAttachedToZoneChangeCounter()) { - attachedTo.sacrifice(source.getSourceId(), game); + attachedTo.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/n/NecromanticSelection.java b/Mage.Sets/src/mage/cards/n/NecromanticSelection.java index b178cb4a32b..430a502dcf6 100644 --- a/Mage.Sets/src/mage/cards/n/NecromanticSelection.java +++ b/Mage.Sets/src/mage/cards/n/NecromanticSelection.java @@ -76,7 +76,7 @@ class NecromanticSelectionEffect extends OneShotEffect { if (sourceObject != null && controller != null) { Cards cards = new CardsImpl(); for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) { cards.add(permanent); } diff --git a/Mage.Sets/src/mage/cards/n/Necromentia.java b/Mage.Sets/src/mage/cards/n/Necromentia.java index 888d90311df..a1122165a55 100644 --- a/Mage.Sets/src/mage/cards/n/Necromentia.java +++ b/Mage.Sets/src/mage/cards/n/Necromentia.java @@ -118,7 +118,7 @@ class NecromentiaEffect extends OneShotEffect { if (numberOfCardsExiledFromHand > 0) { game.getState().applyEffects(game); Token zombieToken = new ZombieToken(); - zombieToken.putOntoBattlefield(numberOfCardsExiledFromHand, game, source.getId(), targetPlayer.getId()); + zombieToken.putOntoBattlefield(numberOfCardsExiledFromHand, game, source, targetPlayer.getId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/Necroplasm.java b/Mage.Sets/src/mage/cards/n/Necroplasm.java index 9974d502997..2b16935c326 100644 --- a/Mage.Sets/src/mage/cards/n/Necroplasm.java +++ b/Mage.Sets/src/mage/cards/n/Necroplasm.java @@ -82,7 +82,7 @@ class NecroplasmEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, numCounters)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if(permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/n/NecropolisRegent.java b/Mage.Sets/src/mage/cards/n/NecropolisRegent.java index 5e53ec1011b..259da07b2d3 100644 --- a/Mage.Sets/src/mage/cards/n/NecropolisRegent.java +++ b/Mage.Sets/src/mage/cards/n/NecropolisRegent.java @@ -69,7 +69,7 @@ class NecropolisRegentTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/n/Necropotence.java b/Mage.Sets/src/mage/cards/n/Necropotence.java index 107a5cae8a7..a28ec75c475 100644 --- a/Mage.Sets/src/mage/cards/n/Necropotence.java +++ b/Mage.Sets/src/mage/cards/n/Necropotence.java @@ -74,7 +74,7 @@ class NecropotenceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/n/Necroskitter.java b/Mage.Sets/src/mage/cards/n/Necroskitter.java index 7fcfaea1b95..d422d309899 100644 --- a/Mage.Sets/src/mage/cards/n/Necroskitter.java +++ b/Mage.Sets/src/mage/cards/n/Necroskitter.java @@ -68,7 +68,7 @@ class NecroskitterTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NecroticPlague.java b/Mage.Sets/src/mage/cards/n/NecroticPlague.java index 5bc9c3137a6..2927cca35c3 100644 --- a/Mage.Sets/src/mage/cards/n/NecroticPlague.java +++ b/Mage.Sets/src/mage/cards/n/NecroticPlague.java @@ -112,7 +112,7 @@ class NecroticPlagueEffect extends OneShotEffect { if (sourceEnchantmentCard != null && creature != null) { game.getState().setValue("attachTo:" + sourceEnchantmentCard.getId(), creature); creatureController.moveCards(sourceEnchantmentCard, Zone.BATTLEFIELD, source, game); - return creature.addAttachment(sourceEnchantmentCard.getId(), game); + return creature.addAttachment(sourceEnchantmentCard.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NeedleSpecter.java b/Mage.Sets/src/mage/cards/n/NeedleSpecter.java index 244652f1d3d..57b55de7246 100644 --- a/Mage.Sets/src/mage/cards/n/NeedleSpecter.java +++ b/Mage.Sets/src/mage/cards/n/NeedleSpecter.java @@ -71,7 +71,7 @@ class NeedleSpecterEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { int damage = (Integer)getValue("damage"); - targetPlayer.discard(damage, false, source, game); + targetPlayer.discard(damage, false, false, source, game); game.informPlayers(targetPlayer.getLogName() + "discards " + damage + " card(s)"); return true; } diff --git a/Mage.Sets/src/mage/cards/n/NefariousLich.java b/Mage.Sets/src/mage/cards/n/NefariousLich.java index 7b433356486..a943c41ca73 100644 --- a/Mage.Sets/src/mage/cards/n/NefariousLich.java +++ b/Mage.Sets/src/mage/cards/n/NefariousLich.java @@ -97,7 +97,7 @@ class NefariousLichDamageReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override @@ -130,14 +130,14 @@ class NefariousLichLifeGainReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(event.getPlayerId()); if (controller != null) { - controller.drawCards(event.getAmount(), source.getSourceId(), game); + controller.drawCards(event.getAmount(), source, game); // original event is not a draw event, so skip it in params } return true; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAIN_LIFE; + return event.getType() == GameEvent.EventType.GAIN_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NeganTheColdBlooded.java b/Mage.Sets/src/mage/cards/n/NeganTheColdBlooded.java index cb944693296..8870b7137f1 100644 --- a/Mage.Sets/src/mage/cards/n/NeganTheColdBlooded.java +++ b/Mage.Sets/src/mage/cards/n/NeganTheColdBlooded.java @@ -113,7 +113,7 @@ class NeganTheColdBloodedEffect extends OneShotEffect { if (opponent.equals(creatureId)) { game.informPlayers(opponent.getName() + " chose " + permanent.getIdName()); } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NehebDreadhordeChampion.java b/Mage.Sets/src/mage/cards/n/NehebDreadhordeChampion.java index 535dcff7a90..69a785b7d0d 100644 --- a/Mage.Sets/src/mage/cards/n/NehebDreadhordeChampion.java +++ b/Mage.Sets/src/mage/cards/n/NehebDreadhordeChampion.java @@ -83,13 +83,13 @@ class NehebDreadhordeChampionEffect extends OneShotEffect { if (!player.choose(outcome, target, source.getSourceId(), game)) { return false; } - int counter = player.discard(new CardsImpl(target.getTargets()), source, game).size(); + int counter = player.discard(new CardsImpl(target.getTargets()), false, source, game).size(); Mana mana = new Mana(); if (counter < 1) { return true; } IntStream.range(0, counter).forEach(x -> mana.increaseRed()); - player.drawCards(counter, source.getSourceId(), game); + player.drawCards(counter, source, game); player.getManaPool().addMana(mana, game, source, true); return true; } diff --git a/Mage.Sets/src/mage/cards/n/NessianBoar.java b/Mage.Sets/src/mage/cards/n/NessianBoar.java index 56d6c7b15ac..4ec93d365f8 100644 --- a/Mage.Sets/src/mage/cards/n/NessianBoar.java +++ b/Mage.Sets/src/mage/cards/n/NessianBoar.java @@ -69,6 +69,6 @@ class NessianBoarEffect extends OneShotEffect { return false; } Player player = game.getPlayer(permanent.getControllerId()); - return player != null && player.drawCards(1, source.getSourceId(), game) > 0; + return player != null && player.drawCards(1, source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/n/NestedGhoul.java b/Mage.Sets/src/mage/cards/n/NestedGhoul.java index dd90acbcc1d..550c251535b 100644 --- a/Mage.Sets/src/mage/cards/n/NestedGhoul.java +++ b/Mage.Sets/src/mage/cards/n/NestedGhoul.java @@ -59,7 +59,7 @@ class NestedGhoulTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NestingGrounds.java b/Mage.Sets/src/mage/cards/n/NestingGrounds.java index 5a568efe2d1..8e1d28e7cf1 100644 --- a/Mage.Sets/src/mage/cards/n/NestingGrounds.java +++ b/Mage.Sets/src/mage/cards/n/NestingGrounds.java @@ -106,7 +106,7 @@ class NestingGroundsEffect extends OneShotEffect { CounterType counterType = CounterType.findByName(chosen); if (counterType != null) { Counter counter = counterType.createInstance(); - fromPermanent.removeCounters(counterType.getName(), 1, game); + fromPermanent.removeCounters(counterType.getName(), 1, source, game); toPermanent.addCounters(counter, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/n/NetcasterSpider.java b/Mage.Sets/src/mage/cards/n/NetcasterSpider.java index 9091915fe87..8aace4c39db 100644 --- a/Mage.Sets/src/mage/cards/n/NetcasterSpider.java +++ b/Mage.Sets/src/mage/cards/n/NetcasterSpider.java @@ -59,7 +59,7 @@ class BlocksCreatureWithFlyingTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NetherbornAltar.java b/Mage.Sets/src/mage/cards/n/NetherbornAltar.java index aec050c7ccf..d1fe4997266 100644 --- a/Mage.Sets/src/mage/cards/n/NetherbornAltar.java +++ b/Mage.Sets/src/mage/cards/n/NetherbornAltar.java @@ -89,7 +89,7 @@ class NetherbornAltarEffect extends OneShotEffect { Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (permanent != null) { int counterCount = permanent.getCounters(game).getCount(CounterType.SOUL); - controller.loseLife(3 * counterCount, game, false); + controller.loseLife(3 * counterCount, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NetherbornPhalanx.java b/Mage.Sets/src/mage/cards/n/NetherbornPhalanx.java index 91570504ea8..6d2791ea3b1 100644 --- a/Mage.Sets/src/mage/cards/n/NetherbornPhalanx.java +++ b/Mage.Sets/src/mage/cards/n/NetherbornPhalanx.java @@ -71,7 +71,7 @@ class NetherbornPhalanxEffect extends OneShotEffect { if (count > 0) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - opponent.loseLife(count, game, false); + opponent.loseLife(count, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NettlevineBlight.java b/Mage.Sets/src/mage/cards/n/NettlevineBlight.java index e3cdb3f802b..3f5a83777cd 100644 --- a/Mage.Sets/src/mage/cards/n/NettlevineBlight.java +++ b/Mage.Sets/src/mage/cards/n/NettlevineBlight.java @@ -89,7 +89,7 @@ class NettlevineBlightEffect extends OneShotEffect { Permanent enchantedPermanent = game.getPermanent(nettlevineBlight.getAttachedTo()); if (enchantedPermanent != null) { newController = game.getPlayer(enchantedPermanent.getControllerId()); - enchantedPermanent.sacrifice(source.getSourceId(), game); + enchantedPermanent.sacrifice(source, game); } if (newController != null) { FilterPermanent filter = new FilterPermanent("creature or land permanent you control"); @@ -106,7 +106,7 @@ class NettlevineBlightEffect extends OneShotEffect { Card nettlevineBlightCard = game.getCard(source.getSourceId()); if (nettlevineBlightCard != null) { game.getState().setValue("attachTo:" + nettlevineBlight.getId(), chosenPermanent); - chosenPermanent.addAttachment(nettlevineBlight.getId(), game); + chosenPermanent.addAttachment(nettlevineBlight.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NeverendingTorment.java b/Mage.Sets/src/mage/cards/n/NeverendingTorment.java index 7df007f4fc9..e157ea609ac 100644 --- a/Mage.Sets/src/mage/cards/n/NeverendingTorment.java +++ b/Mage.Sets/src/mage/cards/n/NeverendingTorment.java @@ -69,7 +69,7 @@ class NeverendingTormentEffect extends OneShotEffect { for (UUID cardId : target.getTargets()) { final Card targetCard = game.getCard(cardId); if (targetCard != null) { - applied |= you.moveCardToExileWithInfo(targetCard, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + applied |= you.moveCardToExileWithInfo(targetCard, null, null, source, game, Zone.LIBRARY, true); } } targetPlayer.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/n/Nevermore.java b/Mage.Sets/src/mage/cards/n/Nevermore.java index 36557baebe2..6e957d9d0ca 100644 --- a/Mage.Sets/src/mage/cards/n/Nevermore.java +++ b/Mage.Sets/src/mage/cards/n/Nevermore.java @@ -69,7 +69,7 @@ class NevermoreEffect2 extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.CAST_SPELL) { + if (event.getType() == GameEvent.EventType.CAST_SPELL) { MageObject object = game.getObject(event.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); return CardUtil.haveSameNames(object, cardName, game); diff --git a/Mage.Sets/src/mage/cards/n/NezumiShortfang.java b/Mage.Sets/src/mage/cards/n/NezumiShortfang.java index 48b0f503a02..79bdd35c6b7 100644 --- a/Mage.Sets/src/mage/cards/n/NezumiShortfang.java +++ b/Mage.Sets/src/mage/cards/n/NezumiShortfang.java @@ -104,7 +104,7 @@ class StabwhiskerLoseLifeEffect extends OneShotEffect { if (opponent != null) { int lifeLose = 3 - opponent.getHand().size(); if (lifeLose > 0) { - opponent.loseLife(lifeLose, game, false); + opponent.loseLife(lifeLose, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NicolBolasDragonGod.java b/Mage.Sets/src/mage/cards/n/NicolBolasDragonGod.java index 64dbc70f1ef..dce9352d5a5 100644 --- a/Mage.Sets/src/mage/cards/n/NicolBolasDragonGod.java +++ b/Mage.Sets/src/mage/cards/n/NicolBolasDragonGod.java @@ -129,7 +129,7 @@ class NicolBolasDragonGodPlusOneEffect extends OneShotEffect { if (player == null) { return false; } - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); Set cardsOnBattlefield = new LinkedHashSet<>(); Set cards = new LinkedHashSet<>(); for (UUID opponentId : game.getState().getPlayersInRange(player.getId(), game)) { diff --git a/Mage.Sets/src/mage/cards/n/NicolBolasTheDeceiver.java b/Mage.Sets/src/mage/cards/n/NicolBolasTheDeceiver.java index fa50e526abd..7d333a4dc20 100644 --- a/Mage.Sets/src/mage/cards/n/NicolBolasTheDeceiver.java +++ b/Mage.Sets/src/mage/cards/n/NicolBolasTheDeceiver.java @@ -90,17 +90,17 @@ class NicolBolasTheDeceiverFirstEffect extends OneShotEffect { if (opponent.choose(outcome, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } } if (!opponent.getHand().isEmpty() && opponent.chooseUse(outcome, "Discard a card?", "Otherwise you lose 3 life.", "Discard", "Lose 3 life", source, game)) { - opponent.discardOne(false, source, game); + opponent.discardOne(false, false, source, game); return true; } - opponent.loseLife(3, game, false); + opponent.loseLife(3, game, source, false); } } diff --git a/Mage.Sets/src/mage/cards/n/NightDealings.java b/Mage.Sets/src/mage/cards/n/NightDealings.java index ae7c7011a2c..d491ec32c16 100644 --- a/Mage.Sets/src/mage/cards/n/NightDealings.java +++ b/Mage.Sets/src/mage/cards/n/NightDealings.java @@ -158,7 +158,7 @@ public final class NightDealings extends CardImpl { if (player.searchLibrary(target, source, game)) { Card card = player.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); String name = "Reveal"; Cards cards = new CardsImpl(card); diff --git a/Mage.Sets/src/mage/cards/n/NightTerrors.java b/Mage.Sets/src/mage/cards/n/NightTerrors.java index 78e6c14b637..99eef4cf81a 100644 --- a/Mage.Sets/src/mage/cards/n/NightTerrors.java +++ b/Mage.Sets/src/mage/cards/n/NightTerrors.java @@ -68,7 +68,7 @@ class NightTerrorsEffect extends OneShotEffect { if (player.choose(Outcome.Exile, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); if (card != null) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); } } diff --git a/Mage.Sets/src/mage/cards/n/NightshadeSeer.java b/Mage.Sets/src/mage/cards/n/NightshadeSeer.java index 1c148f177c6..7c7eb14857a 100644 --- a/Mage.Sets/src/mage/cards/n/NightshadeSeer.java +++ b/Mage.Sets/src/mage/cards/n/NightshadeSeer.java @@ -80,7 +80,7 @@ class NightshadeSeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = -1 * cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/n/Nightsnare.java b/Mage.Sets/src/mage/cards/n/Nightsnare.java index e0535648e96..a24d243faa4 100644 --- a/Mage.Sets/src/mage/cards/n/Nightsnare.java +++ b/Mage.Sets/src/mage/cards/n/Nightsnare.java @@ -64,13 +64,13 @@ class NightsnareDiscardEffect extends OneShotEffect { player.revealCards(sourceCard != null ? sourceCard.getIdName() : "Discard", revealedCards, game); // You may choose a nonland card from it. if (!controller.chooseUse(outcome, "Choose a card to discard? (Otherwise " + player.getLogName() + " has to discard 2 cards).", source, game)) { - player.discard(2, false, source, game); + player.discard(2, false, false, source, game); return true; } TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard()); if (controller.choose(Outcome.Benefit, revealedCards, target, game)) { Card card = revealedCards.get(target.getFirstTarget(), game); - player.discard(card, source, game); + player.discard(card, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java index 3e0dac45738..7021b0023bb 100644 --- a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java +++ b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java @@ -85,7 +85,7 @@ class NimDeathmantleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -131,7 +131,7 @@ class NimDeathmantleEffect extends OneShotEffect { if (controller != null && equipment != null) { if (controller.chooseUse(Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source, source.getControllerId(), false)) { UUID target = targetPointer.getFirst(game, source); if (target != null) { Card card = game.getCard(target); @@ -140,7 +140,7 @@ class NimDeathmantleEffect extends OneShotEffect { if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { - permanent.addAttachment(equipment.getId(), game); + permanent.addAttachment(equipment.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NimDevourer.java b/Mage.Sets/src/mage/cards/n/NimDevourer.java index 80c31583b95..6c9ea9d8b20 100644 --- a/Mage.Sets/src/mage/cards/n/NimDevourer.java +++ b/Mage.Sets/src/mage/cards/n/NimDevourer.java @@ -82,10 +82,10 @@ class NimDevourerEffect extends OneShotEffect { if (player != null) { Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent()); - if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NinThePainArtist.java b/Mage.Sets/src/mage/cards/n/NinThePainArtist.java index c21c6fd23e7..45ffacb98c3 100644 --- a/Mage.Sets/src/mage/cards/n/NinThePainArtist.java +++ b/Mage.Sets/src/mage/cards/n/NinThePainArtist.java @@ -72,10 +72,10 @@ class NinThePainArtistEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.damage(source.getManaCostsToPay().getX(), source.getSourceId(), game, false, true); + permanent.damage(source.getManaCostsToPay().getX(), source.getSourceId(), source, game, false, true); Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.drawCards(source.getManaCostsToPay().getX(), source.getSourceId(), game); + player.drawCards(source.getManaCostsToPay().getX(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NineLives.java b/Mage.Sets/src/mage/cards/n/NineLives.java index aa28b276483..9b8d706324d 100644 --- a/Mage.Sets/src/mage/cards/n/NineLives.java +++ b/Mage.Sets/src/mage/cards/n/NineLives.java @@ -18,6 +18,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -73,7 +74,7 @@ class NineLivesPreventionEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); Player player = game.getPlayer(source.getControllerId()); @@ -84,7 +85,7 @@ class NineLivesPreventionEffect extends PreventionEffectImpl { } } event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/n/NirkanaRevenant.java b/Mage.Sets/src/mage/cards/n/NirkanaRevenant.java index 86a5b7734f2..6f75520a22c 100644 --- a/Mage.Sets/src/mage/cards/n/NirkanaRevenant.java +++ b/Mage.Sets/src/mage/cards/n/NirkanaRevenant.java @@ -70,12 +70,12 @@ class NirkanaRevenantTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent land = game.getPermanent(event.getTargetId()); + Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); return land != null && filter.match(land, this.getSourceId(), this.getControllerId(), game); } diff --git a/Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java b/Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java index cc891824f7a..e225bf8c73f 100644 --- a/Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java +++ b/Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java @@ -109,7 +109,7 @@ class NissaWhoShakesTheWorldTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent land = game.getPermanent(event.getTargetId()); + Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); return land != null && filter.match(land, this.getSourceId(), this.getControllerId(), game); } diff --git a/Mage.Sets/src/mage/cards/n/NissasChosen.java b/Mage.Sets/src/mage/cards/n/NissasChosen.java index d29dd45a7ef..3211516d888 100644 --- a/Mage.Sets/src/mage/cards/n/NissasChosen.java +++ b/Mage.Sets/src/mage/cards/n/NissasChosen.java @@ -66,7 +66,7 @@ class NissasChosenEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -85,7 +85,7 @@ class NissasChosenEffect extends ReplacementEffectImpl { Permanent permanent = ((ZoneChangeEvent) event).getTarget(); Player controller = game.getPlayer(source.getControllerId()); if (permanent != null && controller != null) { - controller.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, false, true); + controller.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/n/NissasDefeat.java b/Mage.Sets/src/mage/cards/n/NissasDefeat.java index 09c1c4513b0..4f69db2c204 100644 --- a/Mage.Sets/src/mage/cards/n/NissasDefeat.java +++ b/Mage.Sets/src/mage/cards/n/NissasDefeat.java @@ -79,11 +79,11 @@ class NissasDefeatEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); // If it was a Nissa planeswalker, draw a card if (filter.match(permanent, game) && controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NissasJudgment.java b/Mage.Sets/src/mage/cards/n/NissasJudgment.java index f38eaeec64c..f90e0146b5f 100644 --- a/Mage.Sets/src/mage/cards/n/NissasJudgment.java +++ b/Mage.Sets/src/mage/cards/n/NissasJudgment.java @@ -87,7 +87,7 @@ class NissasJudgmentEffect extends OneShotEffect { if (targetCreature != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterWithCounter, controller.getId(), game)) { if (permanent.getPower().getValue() > 0) { - targetCreature.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); + targetCreature.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/n/NissasRevelation.java b/Mage.Sets/src/mage/cards/n/NissasRevelation.java index 77f0c5cacd8..7edbc3182a3 100644 --- a/Mage.Sets/src/mage/cards/n/NissasRevelation.java +++ b/Mage.Sets/src/mage/cards/n/NissasRevelation.java @@ -69,7 +69,7 @@ class NissasRevelationEffect extends OneShotEffect { cards.add(card); controller.revealCards(sourceObject.getIdName(), cards, game); if (card.isCreature()) { - controller.drawCards(card.getPower().getValue(), source.getSourceId(), game); + controller.drawCards(card.getPower().getValue(), source, game); controller.gainLife(card.getToughness().getValue(), game, source); } } diff --git a/Mage.Sets/src/mage/cards/n/NoMercy.java b/Mage.Sets/src/mage/cards/n/NoMercy.java index 3dd432c7afd..d956db364cf 100644 --- a/Mage.Sets/src/mage/cards/n/NoMercy.java +++ b/Mage.Sets/src/mage/cards/n/NoMercy.java @@ -53,7 +53,7 @@ public final class NoMercy extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NoblePurpose.java b/Mage.Sets/src/mage/cards/n/NoblePurpose.java index 6fce1fb36ff..bc753d4f4d4 100644 --- a/Mage.Sets/src/mage/cards/n/NoblePurpose.java +++ b/Mage.Sets/src/mage/cards/n/NoblePurpose.java @@ -55,9 +55,9 @@ class NoblePurposeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NoeticScales.java b/Mage.Sets/src/mage/cards/n/NoeticScales.java index cd196e1623c..35da43c3c61 100644 --- a/Mage.Sets/src/mage/cards/n/NoeticScales.java +++ b/Mage.Sets/src/mage/cards/n/NoeticScales.java @@ -63,7 +63,7 @@ class NoeticScalesEffect extends OneShotEffect { int numberOfCardsInHand = player.getHand().size(); for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) { if (creature.getPower().getValue() > numberOfCardsInHand) { - if (creature.moveToZone(Zone.HAND, source.getId(), game, false)) { + if (creature.moveToZone(Zone.HAND, source, game, false)) { game.informPlayers(player.getLogName() + " moves " + creature.getLogName() + " from the battlefield to their hand."); } } diff --git a/Mage.Sets/src/mage/cards/n/NogginWhack.java b/Mage.Sets/src/mage/cards/n/NogginWhack.java index f7627b55266..929f19feef7 100644 --- a/Mage.Sets/src/mage/cards/n/NogginWhack.java +++ b/Mage.Sets/src/mage/cards/n/NogginWhack.java @@ -93,7 +93,7 @@ class NogginWhackEffect extends OneShotEffect { if (!revealedCards.isEmpty()) { targetPlayer.revealCards(source, revealedCards, game); controller.chooseTarget(Outcome.Exile, revealedCards, targetInHand, source, game); - targetPlayer.discard(new CardsImpl(targetInHand.getTargets()), source, game); + targetPlayer.discard(new CardsImpl(targetInHand.getTargets()), false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NomadMythmaker.java b/Mage.Sets/src/mage/cards/n/NomadMythmaker.java index fa8cb1daceb..0c88004c8bd 100644 --- a/Mage.Sets/src/mage/cards/n/NomadMythmaker.java +++ b/Mage.Sets/src/mage/cards/n/NomadMythmaker.java @@ -90,10 +90,10 @@ class NomadMythmakerEffect extends OneShotEffect { if (controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null - && !permanent.cantBeAttachedBy(aura, game, false)) { + && !permanent.cantBeAttachedBy(aura, source, game, false)) { game.getState().setValue("attachTo:" + aura.getId(), permanent); controller.moveCards(aura, Zone.BATTLEFIELD, source, game); - return permanent.addAttachment(aura.getId(), game); + return permanent.addAttachment(aura.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/n/NoosegrafMob.java b/Mage.Sets/src/mage/cards/n/NoosegrafMob.java index af4db9106c7..32c4a7cfaf2 100644 --- a/Mage.Sets/src/mage/cards/n/NoosegrafMob.java +++ b/Mage.Sets/src/mage/cards/n/NoosegrafMob.java @@ -71,7 +71,7 @@ class NoosegrafMobEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { - permanent.removeCounters(CounterType.P1P1.createInstance(), game); + permanent.removeCounters(CounterType.P1P1.createInstance(), source, game); Effect effect = new CreateTokenEffect(new ZombieToken()); return effect.apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/n/NorinTheWary.java b/Mage.Sets/src/mage/cards/n/NorinTheWary.java index 11f6fbcdc19..452c0132ab6 100644 --- a/Mage.Sets/src/mage/cards/n/NorinTheWary.java +++ b/Mage.Sets/src/mage/cards/n/NorinTheWary.java @@ -57,8 +57,8 @@ class NorinTheWaryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST - || event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.SPELL_CAST + || event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NotForgotten.java b/Mage.Sets/src/mage/cards/n/NotForgotten.java index e9aa3d1020d..c289f495614 100644 --- a/Mage.Sets/src/mage/cards/n/NotForgotten.java +++ b/Mage.Sets/src/mage/cards/n/NotForgotten.java @@ -64,10 +64,10 @@ class NotForgottenEffect extends OneShotEffect { if (controller != null && targetCard != null) { boolean onTop = controller.chooseUse(outcome, "Put " + targetCard.getName() + " on top of it's owners library (otherwise on bottom)?", source, game); - boolean moved = controller.moveCardToLibraryWithInfo(targetCard, source.getSourceId(), game, Zone.GRAVEYARD, onTop, true); + boolean moved = controller.moveCardToLibraryWithInfo(targetCard, source, game, Zone.GRAVEYARD, onTop, true); if (moved) { Token token = new SpiritWhiteToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false); + token.putOntoBattlefield(1, game, source, source.getControllerId(), false, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NotionThief.java b/Mage.Sets/src/mage/cards/n/NotionThief.java index 697baa67bac..e509837cffd 100644 --- a/Mage.Sets/src/mage/cards/n/NotionThief.java +++ b/Mage.Sets/src/mage/cards/n/NotionThief.java @@ -76,7 +76,7 @@ class NotionThiefReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(1, event.getSourceId(), game, event.getAppliedEffects()); + player.drawCards(1, source, game, event); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NoxiousGearhulk.java b/Mage.Sets/src/mage/cards/n/NoxiousGearhulk.java index c41310dc4dd..e46d9b3ec8d 100644 --- a/Mage.Sets/src/mage/cards/n/NoxiousGearhulk.java +++ b/Mage.Sets/src/mage/cards/n/NoxiousGearhulk.java @@ -78,7 +78,7 @@ class NoxiousGearhulkEffect extends OneShotEffect { Permanent creatureToDestroy = game.getPermanent(getTargetPointer().getFirst(game, source)); if (creatureToDestroy != null && player != null) { if (player.chooseUse(Outcome.DestroyPermanent, "Destroy creature?", source, game)) { - if (creatureToDestroy.destroy(source.getSourceId(), game, false)) { + if (creatureToDestroy.destroy(source, game, false)) { player.gainLife(creatureToDestroy.getToughness().getValue(), game, source); } } diff --git a/Mage.Sets/src/mage/cards/n/NoxiousVapors.java b/Mage.Sets/src/mage/cards/n/NoxiousVapors.java index 1f5fdc483e0..def20a07d17 100644 --- a/Mage.Sets/src/mage/cards/n/NoxiousVapors.java +++ b/Mage.Sets/src/mage/cards/n/NoxiousVapors.java @@ -89,7 +89,7 @@ class NoxiousVaporsEffect extends OneShotEffect { chosenCards.addAll(player.getHand().getCards(StaticFilters.FILTER_CARD_LAND, game)); Cards cards = player.getHand().copy(); cards.removeIf(chosenCards.stream().map(MageItem::getId).collect(Collectors.toSet())::contains); - player.discard(cards, source, game); + player.discard(cards, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NullChamber.java b/Mage.Sets/src/mage/cards/n/NullChamber.java index 501e1a29cd3..bd53e4b405d 100644 --- a/Mage.Sets/src/mage/cards/n/NullChamber.java +++ b/Mage.Sets/src/mage/cards/n/NullChamber.java @@ -144,7 +144,7 @@ class NullChamberReplacementEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL; + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NullProfusion.java b/Mage.Sets/src/mage/cards/n/NullProfusion.java index 263d299c775..6ccf1c22b64 100644 --- a/Mage.Sets/src/mage/cards/n/NullProfusion.java +++ b/Mage.Sets/src/mage/cards/n/NullProfusion.java @@ -72,7 +72,7 @@ class NullProfusionTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST || event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/n/NumaJoragaChieftain.java b/Mage.Sets/src/mage/cards/n/NumaJoragaChieftain.java index 92ee8d9e3be..8577c96f098 100644 --- a/Mage.Sets/src/mage/cards/n/NumaJoragaChieftain.java +++ b/Mage.Sets/src/mage/cards/n/NumaJoragaChieftain.java @@ -84,7 +84,7 @@ class NumaJoragaChieftainEffect extends OneShotEffect { } int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(2 * costX)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (!cost.pay(source, game, source, source.getControllerId(), false, null)) { return false; } ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/n/NumbingDose.java b/Mage.Sets/src/mage/cards/n/NumbingDose.java index aadcc8006bb..78800138142 100644 --- a/Mage.Sets/src/mage/cards/n/NumbingDose.java +++ b/Mage.Sets/src/mage/cards/n/NumbingDose.java @@ -82,7 +82,7 @@ class NumbingDoseTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OKagachiVengefulKami.java b/Mage.Sets/src/mage/cards/o/OKagachiVengefulKami.java index cddf6d47499..351a20aa4dc 100644 --- a/Mage.Sets/src/mage/cards/o/OKagachiVengefulKami.java +++ b/Mage.Sets/src/mage/cards/o/OKagachiVengefulKami.java @@ -74,7 +74,7 @@ class OKagachiVengefulKamiTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OathOfLimDul.java b/Mage.Sets/src/mage/cards/o/OathOfLimDul.java index b3f63dbb3a7..a343fed1d85 100644 --- a/Mage.Sets/src/mage/cards/o/OathOfLimDul.java +++ b/Mage.Sets/src/mage/cards/o/OathOfLimDul.java @@ -69,7 +69,7 @@ class OathOfLimDulTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_LIFE; + return event.getType() == GameEvent.EventType.LOST_LIFE; } @Override @@ -119,7 +119,7 @@ class OathOfLimDulEffect extends OneShotEffect { for (UUID targetPermanentId : target.getTargets()) { Permanent permanent = game.getPermanent(targetPermanentId); if (permanent != null - && permanent.sacrifice(source.getSourceId(), game)) { + && permanent.sacrifice(source, game)) { numberSacrificed += 1; sacrificeDone = true; } @@ -128,8 +128,8 @@ class OathOfLimDulEffect extends OneShotEffect { numberToDiscard = amountDamage - numberSacrificed; Cost cost = new DiscardTargetCost(new TargetCardInHand(numberToDiscard, new FilterCard("card(s) in your hand to discard"))); if (numberToDiscard > 0 - && cost.canPay(source, source.getSourceId(), controller.getId(), game)) { - return cost.pay(source, game, source.getSourceId(), controller.getId(), true); // discard cost paid simultaneously + && cost.canPay(source, source, controller.getId(), game)) { + return cost.pay(source, game, source, controller.getId(), true); // discard cost paid simultaneously } } return sacrificeDone; diff --git a/Mage.Sets/src/mage/cards/o/OathOfMages.java b/Mage.Sets/src/mage/cards/o/OathOfMages.java index 3aa5c46e5cf..0dbe5e03500 100644 --- a/Mage.Sets/src/mage/cards/o/OathOfMages.java +++ b/Mage.Sets/src/mage/cards/o/OathOfMages.java @@ -111,7 +111,7 @@ class OathOfMagesEffect extends OneShotEffect { return false; } if (firstPlayer.chooseUse(Outcome.Benefit, "Deal one damage to " + secondPlayer.getLogName() + "?", source, game)) { - secondPlayer.damage(1, source.getSourceId(), game); + secondPlayer.damage(1, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/o/OathOfScholars.java b/Mage.Sets/src/mage/cards/o/OathOfScholars.java index fb454039a7e..0b7f287ebd7 100644 --- a/Mage.Sets/src/mage/cards/o/OathOfScholars.java +++ b/Mage.Sets/src/mage/cards/o/OathOfScholars.java @@ -106,8 +106,8 @@ class OathOfScholarsEffect extends OneShotEffect { return false; } if (firstPlayer.chooseUse(Outcome.AIDontUseIt, "Discard your hand and draw 3 cards?", source, game)) { - firstPlayer.discard(firstPlayer.getHand().size(), true, source, game); - firstPlayer.drawCards(3, source.getSourceId(), game); + firstPlayer.discard(firstPlayer.getHand().size(), true, false, source, game); + firstPlayer.drawCards(3, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/o/OathkeeperTakenosDaisho.java b/Mage.Sets/src/mage/cards/o/OathkeeperTakenosDaisho.java index 62d95451979..edb1eaf2273 100644 --- a/Mage.Sets/src/mage/cards/o/OathkeeperTakenosDaisho.java +++ b/Mage.Sets/src/mage/cards/o/OathkeeperTakenosDaisho.java @@ -85,7 +85,7 @@ class ExileEquippedEffect extends OneShotEffect { if (equipment != null && equipment.getAttachedTo() != null) { Permanent creature = game.getPermanent(equipment.getAttachedTo()); if (creature != null) { - return creature.moveToExile(null, "", source.getSourceId(), game); + return creature.moveToExile(null, "", source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java b/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java index 77c5200a32c..3524a3431e6 100644 --- a/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java +++ b/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java @@ -78,7 +78,7 @@ class ObNixilisOfTheBlackOathEffect1 extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - loseLife += opponent.loseLife(1, game, false); + loseLife += opponent.loseLife(1, game, source, false); } } controller.gainLife(loseLife, game, source); diff --git a/Mage.Sets/src/mage/cards/o/ObNixilisTheHateTwisted.java b/Mage.Sets/src/mage/cards/o/ObNixilisTheHateTwisted.java index f635e8ea1f0..71d1cbf9ee5 100644 --- a/Mage.Sets/src/mage/cards/o/ObNixilisTheHateTwisted.java +++ b/Mage.Sets/src/mage/cards/o/ObNixilisTheHateTwisted.java @@ -74,12 +74,12 @@ class ObNixilisTheHateTwistedEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); Player player = game.getPlayer(permanent.getControllerId()); if (player == null) { return false; } - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/o/ObNixilisUnshackled.java b/Mage.Sets/src/mage/cards/o/ObNixilisUnshackled.java index 5dc21406737..76f31b08d04 100644 --- a/Mage.Sets/src/mage/cards/o/ObNixilisUnshackled.java +++ b/Mage.Sets/src/mage/cards/o/ObNixilisUnshackled.java @@ -79,7 +79,7 @@ class ObNixilisUnshackledTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LIBRARY_SEARCHED; + return event.getType() == GameEvent.EventType.LIBRARY_SEARCHED; } @Override @@ -121,7 +121,7 @@ class ObNixilisUnshackledEffect extends SacrificeEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { - player.loseLife(10, game, false); + player.loseLife(10, game, source, false); } return super.apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/o/Oblation.java b/Mage.Sets/src/mage/cards/o/Oblation.java index 85af435e691..4e0ca2ac53d 100644 --- a/Mage.Sets/src/mage/cards/o/Oblation.java +++ b/Mage.Sets/src/mage/cards/o/Oblation.java @@ -60,12 +60,12 @@ class OblationEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getOwnerId()); if (player != null) { - player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + player.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, true, true); player.shuffleLibrary(source, game); game.getState().processAction(game); // so effects from creatures that were on the battlefield won't trigger from draw - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/o/OblivionStone.java b/Mage.Sets/src/mage/cards/o/OblivionStone.java index ca2ae17e27a..77a87119ad8 100644 --- a/Mage.Sets/src/mage/cards/o/OblivionStone.java +++ b/Mage.Sets/src/mage/cards/o/OblivionStone.java @@ -64,12 +64,12 @@ class OblivionStoneEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent p : game.getBattlefield().getAllActivePermanents()) { if (!(p.isLand() || p.getCounters(game).containsKey(CounterType.FATE))) { - p.destroy(source.getSourceId(), game, false); + p.destroy(source, game, false); } } for (Permanent p : game.getBattlefield().getAllActivePermanents()) { if (p.getCounters(game).containsKey(CounterType.FATE)) { - p.removeCounters(CounterType.FATE.getName(), p.getCounters(game).getCount(CounterType.FATE), game); + p.removeCounters(CounterType.FATE.getName(), p.getCounters(game).getCount(CounterType.FATE), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/o/ObstinateFamiliar.java b/Mage.Sets/src/mage/cards/o/ObstinateFamiliar.java index d94e9cdfd12..efcbd726116 100644 --- a/Mage.Sets/src/mage/cards/o/ObstinateFamiliar.java +++ b/Mage.Sets/src/mage/cards/o/ObstinateFamiliar.java @@ -66,9 +66,13 @@ class ObstinateFamiliarReplacementEffect extends ReplacementEffectImpl { return true; } -@Override + @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return true; + Player you = game.getPlayer(source.getControllerId()); + if (you != null && you.chooseUse(Outcome.AIDontUseIt, "Would you like to skip drawing a card?", source, game)){ + return true; + } + return false; } @Override @@ -79,11 +83,7 @@ class ObstinateFamiliarReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent archmage = game.getPermanent(source.getSourceId()); - Player you = game.getPlayer(source.getControllerId()); - if (event.getPlayerId().equals(source.getControllerId()) - && archmage != null - && you != null - && you.chooseUse(Outcome.Benefit, "Would you like to skip drawing a card?", source, game)) { + if (archmage != null && event.getPlayerId().equals(source.getControllerId())) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java b/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java index f1700a55cf1..8e3fed3cf79 100644 --- a/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java +++ b/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java @@ -103,7 +103,7 @@ class ObzedatGhostCouncilDelayedTriggeredAbility extends DelayedTriggeredAbility @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OddlyUneven.java b/Mage.Sets/src/mage/cards/o/OddlyUneven.java index 49944a6422a..ff02feea2e9 100644 --- a/Mage.Sets/src/mage/cards/o/OddlyUneven.java +++ b/Mage.Sets/src/mage/cards/o/OddlyUneven.java @@ -72,12 +72,12 @@ class OddOrEvenEffect extends OneShotEffect { String name = creature.getName(); if (name.equalsIgnoreCase("") && this.odd == false) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); } else { int spaces = name.length() - name.replace(" ", "").length(); boolean nameIsOdd = (spaces % 2 == 0); if (this.odd && nameIsOdd || !this.odd && !nameIsOdd) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/o/OddsEnds.java b/Mage.Sets/src/mage/cards/o/OddsEnds.java index efdd05d6e13..be4e8572450 100644 --- a/Mage.Sets/src/mage/cards/o/OddsEnds.java +++ b/Mage.Sets/src/mage/cards/o/OddsEnds.java @@ -67,7 +67,7 @@ class OddsEffect extends OneShotEffect { if (controller != null) { if (controller.flipCoin(source, game, false)) { game.informPlayers("Odds: Spell countered"); - return game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game); + return game.getStack().counter(getTargetPointer().getFirst(game, source), source, game); } else { game.informPlayers("Odds: Spell will be copied"); diff --git a/Mage.Sets/src/mage/cards/o/OdricMasterTactician.java b/Mage.Sets/src/mage/cards/o/OdricMasterTactician.java index 237074dde03..b636d114153 100644 --- a/Mage.Sets/src/mage/cards/o/OdricMasterTactician.java +++ b/Mage.Sets/src/mage/cards/o/OdricMasterTactician.java @@ -145,7 +145,7 @@ class OdricMasterTacticianChooseBlockersEffect extends ContinuousRuleModifyingEf watcher.copyCountApply = watcher.copyCount; Player blockController = game.getPlayer(source.getControllerId()); if (blockController != null) { - game.getCombat().selectBlockers(blockController, game); + game.getCombat().selectBlockers(blockController, source, game); return true; } this.discard(); diff --git a/Mage.Sets/src/mage/cards/o/OgreGeargrabber.java b/Mage.Sets/src/mage/cards/o/OgreGeargrabber.java index 5cdd45d7c33..adfa6520710 100644 --- a/Mage.Sets/src/mage/cards/o/OgreGeargrabber.java +++ b/Mage.Sets/src/mage/cards/o/OgreGeargrabber.java @@ -82,7 +82,7 @@ class OgreGeargrabberEffect1 extends OneShotEffect { if (equipment != null) { Permanent ogre = game.getPermanent(source.getSourceId()); if (ogre != null) { - ogre.addAttachment(equipmentId, game); + ogre.addAttachment(equipmentId, source, game); } } return true; @@ -108,7 +108,7 @@ class OgreGeargrabberDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_CONTROL; + return event.getType() == GameEvent.EventType.LOST_CONTROL; } @Override @@ -149,7 +149,7 @@ class OgreGeargrabberEffect2 extends OneShotEffect { if (equipment != null && equipment.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(equipment.getAttachedTo()); if (attachedTo != null) { - attachedTo.removeAttachment(equipmentId, game); + attachedTo.removeAttachment(equipmentId, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/o/OgreMarauder.java b/Mage.Sets/src/mage/cards/o/OgreMarauder.java index 8586d064948..8dab7e1a232 100644 --- a/Mage.Sets/src/mage/cards/o/OgreMarauder.java +++ b/Mage.Sets/src/mage/cards/o/OgreMarauder.java @@ -73,9 +73,9 @@ class OgreMarauderEffect extends OneShotEffect { Player defender = game.getPlayer(defendingPlayerId); if (defender != null && sourceObject != null) { Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)); - if (cost.canPay(source, source.getSourceId(), defendingPlayerId, game) + if (cost.canPay(source, source, defendingPlayerId, game) && defender.chooseUse(Outcome.LoseAbility, "Sacrifice a creature to prevent that " + sourceObject.getLogName() + " can't be blocked?", source, game)) { - if (!cost.pay(source, game, source.getSourceId(), defendingPlayerId, false, null)) { + if (!cost.pay(source, game, source, defendingPlayerId, false, null)) { // cost was not payed - so source can't be blocked ContinuousEffect effect = new CantBeBlockedSourceEffect(Duration.EndOfTurn); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/o/OjutaiExemplars.java b/Mage.Sets/src/mage/cards/o/OjutaiExemplars.java index 5ec53329804..065576cd6e5 100644 --- a/Mage.Sets/src/mage/cards/o/OjutaiExemplars.java +++ b/Mage.Sets/src/mage/cards/o/OjutaiExemplars.java @@ -97,10 +97,10 @@ class OjutaiExemplarsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent ojutaiExemplars = game.getPermanent(source.getSourceId()); if (ojutaiExemplars != null) { - if (ojutaiExemplars.moveToExile(source.getSourceId(), "Ojutai Exemplars", source.getSourceId(), game)) { + if (ojutaiExemplars.moveToExile(source.getSourceId(), "Ojutai Exemplars", source, game)) { Card card = game.getExile().getCard(source.getSourceId(), game); if (card != null) { - return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, true); + return card.moveToZone(Zone.BATTLEFIELD, source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/o/OmenMachine.java b/Mage.Sets/src/mage/cards/o/OmenMachine.java index 88fe95ae9ec..690bac29898 100644 --- a/Mage.Sets/src/mage/cards/o/OmenMachine.java +++ b/Mage.Sets/src/mage/cards/o/OmenMachine.java @@ -70,7 +70,7 @@ class OmenMachineEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OnceMoreWithFeeling.java b/Mage.Sets/src/mage/cards/o/OnceMoreWithFeeling.java index 797552378e2..70be0bc099a 100644 --- a/Mage.Sets/src/mage/cards/o/OnceMoreWithFeeling.java +++ b/Mage.Sets/src/mage/cards/o/OnceMoreWithFeeling.java @@ -70,7 +70,7 @@ class OnceMoreWithFeelingEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { - permanent.moveToExile(null, "", source.getSourceId(), game); + permanent.moveToExile(null, "", source, game); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); @@ -78,7 +78,7 @@ class OnceMoreWithFeelingEffect extends OneShotEffect { for (UUID cid : player.getGraveyard().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(null, null, source.getSourceId(), game); + c.moveToExile(null, null, source, game); } } player.moveCards(player.getHand(), Zone.LIBRARY, source, game); diff --git a/Mage.Sets/src/mage/cards/o/OnduRising.java b/Mage.Sets/src/mage/cards/o/OnduRising.java index 6a6c2232ce9..1068ca8c547 100644 --- a/Mage.Sets/src/mage/cards/o/OnduRising.java +++ b/Mage.Sets/src/mage/cards/o/OnduRising.java @@ -56,7 +56,7 @@ class OnduRisingTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OonasBlackguard.java b/Mage.Sets/src/mage/cards/o/OonasBlackguard.java index f4e3abb70a1..74029a29c30 100644 --- a/Mage.Sets/src/mage/cards/o/OonasBlackguard.java +++ b/Mage.Sets/src/mage/cards/o/OonasBlackguard.java @@ -68,7 +68,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -120,7 +120,7 @@ class OonasBlackguardTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OozeFlux.java b/Mage.Sets/src/mage/cards/o/OozeFlux.java index ebbbbb0ed18..c70c09211fb 100644 --- a/Mage.Sets/src/mage/cards/o/OozeFlux.java +++ b/Mage.Sets/src/mage/cards/o/OozeFlux.java @@ -77,7 +77,7 @@ class OozeFluxCreateTokenEffect extends OneShotEffect { tokenCopy.getAbilities().newId(); tokenCopy.getPower().modifyBaseValue(xValue); tokenCopy.getToughness().modifyBaseValue(xValue); - tokenCopy.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + tokenCopy.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/o/OozeGarden.java b/Mage.Sets/src/mage/cards/o/OozeGarden.java index be0b4532881..8a0c6aae5b0 100644 --- a/Mage.Sets/src/mage/cards/o/OozeGarden.java +++ b/Mage.Sets/src/mage/cards/o/OozeGarden.java @@ -80,7 +80,7 @@ class OozeGardenCreateTokenEffect extends OneShotEffect { } Token token = new OozeToken(value); token.getAbilities().newId(); // neccessary if token has ability like DevourAbility() - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/o/OpalEyeKondasYojimbo.java b/Mage.Sets/src/mage/cards/o/OpalEyeKondasYojimbo.java index 1dc053cf79c..5c3597411ad 100644 --- a/Mage.Sets/src/mage/cards/o/OpalEyeKondasYojimbo.java +++ b/Mage.Sets/src/mage/cards/o/OpalEyeKondasYojimbo.java @@ -127,7 +127,7 @@ class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl { game.informPlayers(message.toString()); // redirect damage discard(); - sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/o/OpalPalace.java b/Mage.Sets/src/mage/cards/o/OpalPalace.java index 3e0895934b8..710e8a73ef9 100644 --- a/Mage.Sets/src/mage/cards/o/OpalPalace.java +++ b/Mage.Sets/src/mage/cards/o/OpalPalace.java @@ -114,7 +114,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OpalineSliver.java b/Mage.Sets/src/mage/cards/o/OpalineSliver.java index 81239a3e23a..f9c9f7bb3bc 100644 --- a/Mage.Sets/src/mage/cards/o/OpalineSliver.java +++ b/Mage.Sets/src/mage/cards/o/OpalineSliver.java @@ -73,7 +73,7 @@ class OpalineSliverTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OpenSeason.java b/Mage.Sets/src/mage/cards/o/OpenSeason.java index e43e9d4ca5f..94144b59973 100644 --- a/Mage.Sets/src/mage/cards/o/OpenSeason.java +++ b/Mage.Sets/src/mage/cards/o/OpenSeason.java @@ -122,7 +122,7 @@ class OpenSeasonEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { UUID controller = game.getControllerId(source.getFirstTarget()); if (controller != null) { - game.getPlayer(controller).loseLife(2, game, false); + game.getPlayer(controller).loseLife(2, game, source, false); for (UUID playerId : game.getOpponents(controller)) { Player player = game.getPlayer(playerId); if (player != null) { diff --git a/Mage.Sets/src/mage/cards/o/OppressiveWill.java b/Mage.Sets/src/mage/cards/o/OppressiveWill.java index 78203113a9b..3de155cad06 100644 --- a/Mage.Sets/src/mage/cards/o/OppressiveWill.java +++ b/Mage.Sets/src/mage/cards/o/OppressiveWill.java @@ -66,9 +66,9 @@ class SpellSyphonEffect extends OneShotEffect { int amount = controller.getHand().size(); if (amount > 0) { Cost cost = ManaUtil.createManaCost(amount, false); - if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) { + if (!cost.pay(source, game, source, spell.getControllerId(), false)) { game.informPlayers(sourceObject.getLogName() + ": cost wasn't payed - countering target spell."); - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/o/OraclesAttendants.java b/Mage.Sets/src/mage/cards/o/OraclesAttendants.java index 739554d9d0a..b9513db7278 100644 --- a/Mage.Sets/src/mage/cards/o/OraclesAttendants.java +++ b/Mage.Sets/src/mage/cards/o/OraclesAttendants.java @@ -82,7 +82,7 @@ class OraclesAttendantsReplacementEffect extends ReplacementEffectImpl { Permanent permanent = game.getPermanent(source.getSourceId()); DamageCreatureEvent damageEvent = (DamageCreatureEvent) event; if (permanent != null) { - permanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + permanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); return true; } return false; @@ -90,7 +90,7 @@ class OraclesAttendantsReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java b/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java index 9362e0f9094..7672f7838bc 100644 --- a/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java +++ b/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java @@ -136,7 +136,7 @@ class OratorOfOjutaiEffect extends OneShotEffect { if (sourcePermanent != null) { DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = game.getState().getWatcher(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class); if (watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId())) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/o/OrcishSettlers.java b/Mage.Sets/src/mage/cards/o/OrcishSettlers.java index d6382dae91b..c831f73eefe 100644 --- a/Mage.Sets/src/mage/cards/o/OrcishSettlers.java +++ b/Mage.Sets/src/mage/cards/o/OrcishSettlers.java @@ -77,13 +77,13 @@ class OrcishSettlersEffect extends OneShotEffect { TargetLandPermanent target = new TargetLandPermanent(amount); Player controller = game.getPlayer(source.getControllerId()); if (controller != null - && target.canChoose(controller.getId(), game) + && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(Outcome.DestroyPermanent, target, source.getSourceId(), game)) { List targets = target.getTargets(); targets.forEach((landId) -> { Permanent land = game.getPermanent(landId); if (land != null) { - land.destroy(landId, game, false); + land.destroy(source, game, false); } }); return true; diff --git a/Mage.Sets/src/mage/cards/o/OrimsPrayer.java b/Mage.Sets/src/mage/cards/o/OrimsPrayer.java index 68fd83e3200..b047ee24b6d 100644 --- a/Mage.Sets/src/mage/cards/o/OrimsPrayer.java +++ b/Mage.Sets/src/mage/cards/o/OrimsPrayer.java @@ -53,7 +53,7 @@ class OrimsPrayerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OrimsThunder.java b/Mage.Sets/src/mage/cards/o/OrimsThunder.java index a0efbc32e56..280b01c3210 100644 --- a/Mage.Sets/src/mage/cards/o/OrimsThunder.java +++ b/Mage.Sets/src/mage/cards/o/OrimsThunder.java @@ -84,7 +84,7 @@ class OrimsThunderEffect2 extends OneShotEffect { } boolean kicked = KickedCondition.instance.apply(game, source); if (kicked && secondTarget != null) { - secondTarget.damage(damage, source.getSourceId(), game); + secondTarget.damage(damage, source.getSourceId(), source, game); return true; } return false; @@ -111,7 +111,7 @@ class OrimsThunderEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(source.getFirstTarget()); if (target != null) { - return target.destroy(source.getSourceId(), game, false); + return target.destroy(source, game, false); } return false; } diff --git a/Mage.Sets/src/mage/cards/o/OrissSamiteGuardian.java b/Mage.Sets/src/mage/cards/o/OrissSamiteGuardian.java index 7915fb8ccd8..0c673395b5b 100644 --- a/Mage.Sets/src/mage/cards/o/OrissSamiteGuardian.java +++ b/Mage.Sets/src/mage/cards/o/OrissSamiteGuardian.java @@ -109,7 +109,7 @@ class OrissSamiteGuardianCantCastEffect extends ContinuousRuleModifyingEffectImp @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL; + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override diff --git a/Mage.Sets/src/mage/cards/o/OrmosArchiveKeeper.java b/Mage.Sets/src/mage/cards/o/OrmosArchiveKeeper.java index fd311afd68b..7d3c289f362 100644 --- a/Mage.Sets/src/mage/cards/o/OrmosArchiveKeeper.java +++ b/Mage.Sets/src/mage/cards/o/OrmosArchiveKeeper.java @@ -130,8 +130,8 @@ class OrmosArchiveKeeperTarget extends TargetCardInHand { } @Override - public Set possibleTargets(UUID sourceId, UUID playerId, Game game) { - Set possibleTargets = super.possibleTargets(sourceId, playerId, game); + public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { + Set possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set names = this.getTargets() .stream() .map(game::getCard) diff --git a/Mage.Sets/src/mage/cards/o/OrnateKanzashi.java b/Mage.Sets/src/mage/cards/o/OrnateKanzashi.java index 163714d47e0..1a5f80e5b15 100644 --- a/Mage.Sets/src/mage/cards/o/OrnateKanzashi.java +++ b/Mage.Sets/src/mage/cards/o/OrnateKanzashi.java @@ -78,7 +78,7 @@ class OrnateKanzashiEffect extends OneShotEffect { Library library = opponent.getLibrary(); Card card = library.getFromTop(game); if (card != null) { - opponent.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getName(), source.getSourceId(), game, Zone.LIBRARY, true); + opponent.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getName(), source, game, Zone.LIBRARY, true); ContinuousEffect effect = new OrnateKanzashiCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/o/OrzhovCharm.java b/Mage.Sets/src/mage/cards/o/OrzhovCharm.java index ef49630a60a..a4bed569214 100644 --- a/Mage.Sets/src/mage/cards/o/OrzhovCharm.java +++ b/Mage.Sets/src/mage/cards/o/OrzhovCharm.java @@ -94,11 +94,11 @@ class OrzhovCharmReturnToHandEffect extends OneShotEffect { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.isControlledBy(source.getControllerId()) && attachment.hasSubtype(SubType.AURA, game)) { - attachment.moveToZone(Zone.HAND, source.getSourceId(), game, false); + attachment.moveToZone(Zone.HAND, source, game, false); } } if (target.isControlledBy(source.getControllerId())) { - target.moveToZone(Zone.HAND, source.getSourceId(), game, false); + target.moveToZone(Zone.HAND, source, game, false); } return true; } @@ -128,9 +128,9 @@ class OrzhovCharmDestroyAndLoseLifeEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (target != null && controller != null) { int toughness = target.getToughness().getValue(); - target.destroy(source.getSourceId(), game, false); + target.destroy(source, game, false); if (toughness > 0) { - controller.loseLife(toughness, game, false); + controller.loseLife(toughness, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/o/OtherworldAtlas.java b/Mage.Sets/src/mage/cards/o/OtherworldAtlas.java index dfe9041edf2..08bf887666e 100644 --- a/Mage.Sets/src/mage/cards/o/OtherworldAtlas.java +++ b/Mage.Sets/src/mage/cards/o/OtherworldAtlas.java @@ -68,7 +68,7 @@ class OtherworldAtlasDrawEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(amount, source.getSourceId(), game); + player.drawCards(amount, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java b/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java index fb0a3ac4544..fd0a34ebba5 100644 --- a/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java +++ b/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java @@ -68,7 +68,7 @@ class OtherworldlyJourneyEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Otherworldly Journey", source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), "Otherworldly Journey", source, game)) { ExileZone exile = game.getExile().getExileZone(source.getSourceId()); // only if permanent is in exile (tokens would be stop to exist) if (exile != null && !exile.isEmpty()) { @@ -149,7 +149,7 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { return event.getTargetId().equals(objectToReturn.getSourceId()); } return false; diff --git a/Mage.Sets/src/mage/cards/o/OtherworldlyOutburst.java b/Mage.Sets/src/mage/cards/o/OtherworldlyOutburst.java index 14e8ed09270..03be0c4afcb 100644 --- a/Mage.Sets/src/mage/cards/o/OtherworldlyOutburst.java +++ b/Mage.Sets/src/mage/cards/o/OtherworldlyOutburst.java @@ -83,7 +83,7 @@ class OtherworldlyOutburstDelayedTriggeredAbility extends DelayedTriggeredAbilit @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/o/Oubliette.java b/Mage.Sets/src/mage/cards/o/Oubliette.java index f9b9be4ff4b..804776d4734 100644 --- a/Mage.Sets/src/mage/cards/o/Oubliette.java +++ b/Mage.Sets/src/mage/cards/o/Oubliette.java @@ -69,7 +69,7 @@ class OubliettePhaseOutEffect extends OneShotEffect { return false; } MageObjectReference mor = new MageObjectReference(permanent, game); - permanent.tap(game); + permanent.tap(source, game); permanent.phaseOut(game); game.addEffect(new OubliettePhasePreventEffect(mor), source); game.addDelayedTriggeredAbility(new OublietteDelayedTriggeredAbility(mor), source); diff --git a/Mage.Sets/src/mage/cards/o/OupheVandals.java b/Mage.Sets/src/mage/cards/o/OupheVandals.java index 1791f547a8c..6d9e45b727f 100644 --- a/Mage.Sets/src/mage/cards/o/OupheVandals.java +++ b/Mage.Sets/src/mage/cards/o/OupheVandals.java @@ -78,12 +78,12 @@ class OupheVandalsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { UUID targetId = source.getFirstTarget(); StackObject stackObject = game.getStack().getStackObject(targetId); - if (targetId != null && game.getStack().counter(targetId, source.getSourceId(), game)) { + if (targetId != null && game.getStack().counter(targetId, source, game)) { UUID permanentId = stackObject.getSourceId(); if (permanentId != null) { Permanent usedPermanent = game.getPermanent(permanentId); if (usedPermanent != null) { - usedPermanent.destroy(source.getSourceId(), game, false); + usedPermanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/o/Overgrowth.java b/Mage.Sets/src/mage/cards/o/Overgrowth.java index 39d17416692..da03d53755d 100644 --- a/Mage.Sets/src/mage/cards/o/Overgrowth.java +++ b/Mage.Sets/src/mage/cards/o/Overgrowth.java @@ -71,16 +71,16 @@ class OvergrowthTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && enchantment.isAttachedTo(event.getSourceId())) { - Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); - if (enchanted != null) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchanted.getControllerId())); + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + if (enchantedLand != null && enchantedLand.isLand()) { + getEffects().get(0).setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); return true; } } diff --git a/Mage.Sets/src/mage/cards/o/OverlaidTerrain.java b/Mage.Sets/src/mage/cards/o/OverlaidTerrain.java index 4c35c2e9d2d..26e7ff5906d 100644 --- a/Mage.Sets/src/mage/cards/o/OverlaidTerrain.java +++ b/Mage.Sets/src/mage/cards/o/OverlaidTerrain.java @@ -64,7 +64,7 @@ class SacrificeAllLandEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), source.getControllerId(), game)) { - permanent.sacrifice(source.getControllerId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/o/Overload.java b/Mage.Sets/src/mage/cards/o/Overload.java index b205e0f0de7..0e8f43757c0 100644 --- a/Mage.Sets/src/mage/cards/o/Overload.java +++ b/Mage.Sets/src/mage/cards/o/Overload.java @@ -66,7 +66,7 @@ class OverloadEffect extends OneShotEffect { if (targetArtifact != null) { int cmc = targetArtifact.getConvertedManaCost(); if (cmc <= 2 || (KickedCondition.instance.apply(game, source) && cmc <= 5)) { - targetArtifact.destroy(source.getSourceId(), game, false); + targetArtifact.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/o/OverrideCard.java b/Mage.Sets/src/mage/cards/o/OverrideCard.java index 59ad499c0cb..0674b09e400 100644 --- a/Mage.Sets/src/mage/cards/o/OverrideCard.java +++ b/Mage.Sets/src/mage/cards/o/OverrideCard.java @@ -67,9 +67,9 @@ class OverrideEffect extends OneShotEffect { int amount = ArtifactYouControlCount.instance.calculate(game, source, this); if (amount > 0) { Cost cost = ManaUtil.createManaCost(amount, false); - if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) { + if (!cost.pay(source, game, source, spell.getControllerId(), false)) { game.informPlayers(sourceObject.getLogName() + ": cost wasn't payed - countering target spell."); - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/o/OverwhelmingForces.java b/Mage.Sets/src/mage/cards/o/OverwhelmingForces.java index 1b02e738fa7..c8001dc905f 100644 --- a/Mage.Sets/src/mage/cards/o/OverwhelmingForces.java +++ b/Mage.Sets/src/mage/cards/o/OverwhelmingForces.java @@ -61,7 +61,7 @@ class OverwhelmingForcesEffect extends OneShotEffect { if (controller != null && getTargetPointer().getFirst(game, source) != null) { int destroyedCreature = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, getTargetPointer().getFirst(game, source), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { destroyedCreature++; } } diff --git a/Mage.Sets/src/mage/cards/o/OverwhelmingIntellect.java b/Mage.Sets/src/mage/cards/o/OverwhelmingIntellect.java index dbc14c81665..c47806b57cd 100644 --- a/Mage.Sets/src/mage/cards/o/OverwhelmingIntellect.java +++ b/Mage.Sets/src/mage/cards/o/OverwhelmingIntellect.java @@ -60,8 +60,8 @@ class OverwhelmingIntellectEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); if (controller != null && spell != null) { - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); - controller.drawCards(spell.getConvertedManaCost(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); + controller.drawCards(spell.getConvertedManaCost(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/o/Ovinomancer.java b/Mage.Sets/src/mage/cards/o/Ovinomancer.java index 6e13e0f57c2..04533ad1fa8 100644 --- a/Mage.Sets/src/mage/cards/o/Ovinomancer.java +++ b/Mage.Sets/src/mage/cards/o/Ovinomancer.java @@ -90,7 +90,7 @@ class OvinomancerEffect extends OneShotEffect { if (permanent != null) { UUID controllerId = permanent.getControllerId(); if (controllerId != null) { - new SheepToken().putOntoBattlefield(1, game, source.getSourceId(), controllerId); + new SheepToken().putOntoBattlefield(1, game, source, controllerId); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PainSeer.java b/Mage.Sets/src/mage/cards/p/PainSeer.java index f14b4a5bc89..bdac9b9d5d3 100644 --- a/Mage.Sets/src/mage/cards/p/PainSeer.java +++ b/Mage.Sets/src/mage/cards/p/PainSeer.java @@ -72,7 +72,7 @@ class PainSeerEffect extends OneShotEffect { Cards cards = new CardsImpl(card); player.revealCards("Pain Seer", cards, game); if(player.moveCards(card, Zone.HAND, source, game)) { - player.loseLife(card.getConvertedManaCost(), game, false); + player.loseLife(card.getConvertedManaCost(), game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PainfulMemories.java b/Mage.Sets/src/mage/cards/p/PainfulMemories.java index 3c964d043a3..b95db377d98 100644 --- a/Mage.Sets/src/mage/cards/p/PainfulMemories.java +++ b/Mage.Sets/src/mage/cards/p/PainfulMemories.java @@ -69,7 +69,7 @@ class PainfulMemoriesEffect extends OneShotEffect { if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); if (card != null) { - return targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, true); + return targetPlayer.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, true); } } } diff --git a/Mage.Sets/src/mage/cards/p/PainfulQuandary.java b/Mage.Sets/src/mage/cards/p/PainfulQuandary.java index 18b94eb6b86..1cf32840f70 100644 --- a/Mage.Sets/src/mage/cards/p/PainfulQuandary.java +++ b/Mage.Sets/src/mage/cards/p/PainfulQuandary.java @@ -64,12 +64,12 @@ class PainfulQuandryEffect extends OneShotEffect { if (player != null) { boolean paid = false; Cost cost = new DiscardTargetCost(new TargetCardInHand()); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Detriment, "Discard a card (otherwise you lose 5 life)?", source, game)) { - paid = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); + paid = cost.pay(source, game, source, player.getId(), false, null); } if (!paid) { - player.loseLife(5, game, false); + player.loseLife(5, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/Painiac.java b/Mage.Sets/src/mage/cards/p/Painiac.java index c23713f2df2..731e6d95c26 100644 --- a/Mage.Sets/src/mage/cards/p/Painiac.java +++ b/Mage.Sets/src/mage/cards/p/Painiac.java @@ -66,7 +66,7 @@ class PainiacEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); game.addEffect(new BoostSourceEffect(amount, 0, Duration.EndOfTurn), source); return true; } diff --git a/Mage.Sets/src/mage/cards/p/PainsReward.java b/Mage.Sets/src/mage/cards/p/PainsReward.java index 7bc36abbadf..7654542c3d7 100644 --- a/Mage.Sets/src/mage/cards/p/PainsReward.java +++ b/Mage.Sets/src/mage/cards/p/PainsReward.java @@ -80,8 +80,8 @@ class PainsRewardEffect extends OneShotEffect { } game.informPlayers(winner.getLogName() + " won the auction with a bid of " + highBid + " life" + (highBid > 1 ? "s" : "")); - winner.loseLife(highBid, game, false); - winner.drawCards(4, source.getSourceId(), game); + winner.loseLife(highBid, game, source, false); + winner.drawCards(4, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PaleMoon.java b/Mage.Sets/src/mage/cards/p/PaleMoon.java index e9458e8a70e..30e96cac813 100644 --- a/Mage.Sets/src/mage/cards/p/PaleMoon.java +++ b/Mage.Sets/src/mage/cards/p/PaleMoon.java @@ -74,15 +74,14 @@ class PaleMoonReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); - if (mageObject != null && mageObject.isLand()) { - Permanent land = game.getPermanent(event.getSourceId()); - return land != null && filter.match(land, game); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null && permanent.isLand()) { + return filter.match(permanent, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/p/PalisadeGiant.java b/Mage.Sets/src/mage/cards/p/PalisadeGiant.java index f1c808fbe9b..bd9283418a9 100644 --- a/Mage.Sets/src/mage/cards/p/PalisadeGiant.java +++ b/Mage.Sets/src/mage/cards/p/PalisadeGiant.java @@ -124,7 +124,7 @@ class PalisadeGiantReplacementEffect extends ReplacementEffectImpl { } game.informPlayers(message.toString()); // redirect damage - sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/Pandemonium.java b/Mage.Sets/src/mage/cards/p/Pandemonium.java index f835bcdf11c..9c905f05ae8 100644 --- a/Mage.Sets/src/mage/cards/p/Pandemonium.java +++ b/Mage.Sets/src/mage/cards/p/Pandemonium.java @@ -84,11 +84,11 @@ class PandemoniumEffect extends OneShotEffect { if (enteringCreature != null) { Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget()); if (targetPermanent != null) { - targetPermanent.damage(enteringCreature.getPower().getValue(), enteringCreature.getId(), game, false, true); + targetPermanent.damage(enteringCreature.getPower().getValue(), enteringCreature.getId(), source, game, false, true); } else { Player targetPlayer = game.getPlayer(source.getTargets().getFirstTarget()); if (targetPlayer != null) { - targetPlayer.damage(enteringCreature.getPower().getValue(), enteringCreature.getId(), game); + targetPlayer.damage(enteringCreature.getPower().getValue(), enteringCreature.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/Pangosaur.java b/Mage.Sets/src/mage/cards/p/Pangosaur.java index 9ef5d1f35b4..2df040243ac 100644 --- a/Mage.Sets/src/mage/cards/p/Pangosaur.java +++ b/Mage.Sets/src/mage/cards/p/Pangosaur.java @@ -52,7 +52,7 @@ class PangosaurTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Panharmonicon.java b/Mage.Sets/src/mage/cards/p/Panharmonicon.java index 35ee17e6e70..7e464c9afc4 100644 --- a/Mage.Sets/src/mage/cards/p/Panharmonicon.java +++ b/Mage.Sets/src/mage/cards/p/Panharmonicon.java @@ -58,7 +58,7 @@ class PanharmoniconEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.NUMBER_OF_TRIGGERS; + return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS; } @Override @@ -70,7 +70,7 @@ class PanharmoniconEffect extends ReplacementEffectImpl { GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent(); // Only EtB triggers if (sourceEvent != null - && sourceEvent.getType() == EventType.ENTERS_THE_BATTLEFIELD + && sourceEvent.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && sourceEvent instanceof EntersTheBattlefieldEvent) { EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) sourceEvent; // Only for entering artifacts or creatures diff --git a/Mage.Sets/src/mage/cards/p/PanopticMirror.java b/Mage.Sets/src/mage/cards/p/PanopticMirror.java index ad2bc5cca5b..0995b3e990c 100644 --- a/Mage.Sets/src/mage/cards/p/PanopticMirror.java +++ b/Mage.Sets/src/mage/cards/p/PanopticMirror.java @@ -82,7 +82,7 @@ class PanopticMirrorExileEffect extends OneShotEffect { if (player.choose(Outcome.PlayForFree, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - card.moveToExile(CardUtil.getCardExileZoneId(game, source), "Panoptic Mirror", source.getSourceId(), game); + card.moveToExile(CardUtil.getCardExileZoneId(game, source), "Panoptic Mirror", source, game); Permanent PanopticMirror = game.getPermanent(source.getSourceId()); if (PanopticMirror != null) { PanopticMirror.imprint(card.getId(), game); diff --git a/Mage.Sets/src/mage/cards/p/ParadigmShift.java b/Mage.Sets/src/mage/cards/p/ParadigmShift.java index 5ae7c00fb7a..a985fd3776c 100644 --- a/Mage.Sets/src/mage/cards/p/ParadigmShift.java +++ b/Mage.Sets/src/mage/cards/p/ParadigmShift.java @@ -59,7 +59,7 @@ class ExileLibraryEffect extends OneShotEffect { controller.moveCards(cards, Zone.EXILED, source, game); for (Card card: controller.getGraveyard().getCards(game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/p/ParadoxHaze.java b/Mage.Sets/src/mage/cards/p/ParadoxHaze.java index 6262d3d2589..efbc5f3a61a 100644 --- a/Mage.Sets/src/mage/cards/p/ParadoxHaze.java +++ b/Mage.Sets/src/mage/cards/p/ParadoxHaze.java @@ -71,7 +71,7 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/ParadoxicalOutcome.java b/Mage.Sets/src/mage/cards/p/ParadoxicalOutcome.java index 196052208e7..03931844b81 100644 --- a/Mage.Sets/src/mage/cards/p/ParadoxicalOutcome.java +++ b/Mage.Sets/src/mage/cards/p/ParadoxicalOutcome.java @@ -95,9 +95,9 @@ class ParadoxicalOutcomeNumber implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (zoneChangeCounter == 0) { - Card card = game.getCard(source.getSourceId()); + Card card = game.getCard(sourceAbility.getSourceId()); if (card != null) { zoneChangeCounter = card.getZoneChangeCounter(game); if (previousZone) { @@ -106,7 +106,7 @@ class ParadoxicalOutcomeNumber implements DynamicValue { } } int number = 0; - Integer sweepNumber = (Integer) game.getState().getValue("ParadoxicalOutcomeEffect" + source.getSourceId() + zoneChangeCounter); + Integer sweepNumber = (Integer) game.getState().getValue("ParadoxicalOutcomeEffect" + sourceAbility.getSourceId() + zoneChangeCounter); if (sweepNumber != null) { number = sweepNumber; } diff --git a/Mage.Sets/src/mage/cards/p/ParallectricFeedback.java b/Mage.Sets/src/mage/cards/p/ParallectricFeedback.java index ca1a3ab4cbc..10485818cac 100644 --- a/Mage.Sets/src/mage/cards/p/ParallectricFeedback.java +++ b/Mage.Sets/src/mage/cards/p/ParallectricFeedback.java @@ -61,7 +61,7 @@ class ParallectricFeedbackEffect extends OneShotEffect { if (spell != null) { Player spellController = game.getPlayer(spell.getControllerId()); if (spellController != null) { - spellController.damage(spell.getConvertedManaCost(), source.getSourceId(), game); + spellController.damage(spell.getConvertedManaCost(), source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/ParallelThoughts.java b/Mage.Sets/src/mage/cards/p/ParallelThoughts.java index 9569d5cde66..ec7b0f2672d 100644 --- a/Mage.Sets/src/mage/cards/p/ParallelThoughts.java +++ b/Mage.Sets/src/mage/cards/p/ParallelThoughts.java @@ -145,7 +145,7 @@ class ParallelThoughtsReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Paraselene.java b/Mage.Sets/src/mage/cards/p/Paraselene.java index a3f10bd339f..3efb068f6d3 100644 --- a/Mage.Sets/src/mage/cards/p/Paraselene.java +++ b/Mage.Sets/src/mage/cards/p/Paraselene.java @@ -52,7 +52,7 @@ class ParaseleneEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int count = 0; for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_ENCHANTMENT_PERMANENT, source.getControllerId(), source.getSourceId(), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { count++; } } diff --git a/Mage.Sets/src/mage/cards/p/ParasiticImplant.java b/Mage.Sets/src/mage/cards/p/ParasiticImplant.java index 73848ec4fc7..3751b6d2c4e 100644 --- a/Mage.Sets/src/mage/cards/p/ParasiticImplant.java +++ b/Mage.Sets/src/mage/cards/p/ParasiticImplant.java @@ -68,7 +68,7 @@ class ParasiticImplantEffect extends OneShotEffect { if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); if (creature != null) { - return creature.sacrifice(source.getSourceId(), game); + return creature.sacrifice(source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/p/ParasiticStrix.java b/Mage.Sets/src/mage/cards/p/ParasiticStrix.java index 0867bc0ba22..f6f43fbd3a1 100644 --- a/Mage.Sets/src/mage/cards/p/ParasiticStrix.java +++ b/Mage.Sets/src/mage/cards/p/ParasiticStrix.java @@ -68,7 +68,7 @@ class ParasiticStrixTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Pariah.java b/Mage.Sets/src/mage/cards/p/Pariah.java index 355f1c1b432..dd0e21dc630 100644 --- a/Mage.Sets/src/mage/cards/p/Pariah.java +++ b/Mage.Sets/src/mage/cards/p/Pariah.java @@ -65,9 +65,9 @@ public final class Pariah extends CardImpl { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null) { - Permanent p = game.getPermanent(equipment.getAttachedTo()); - if (p != null) { - p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + Permanent permanent = game.getPermanent(equipment.getAttachedTo()); + if (permanent != null) { + permanent.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PariahsShield.java b/Mage.Sets/src/mage/cards/p/PariahsShield.java index 0f55c3edf9d..254a482d67b 100644 --- a/Mage.Sets/src/mage/cards/p/PariahsShield.java +++ b/Mage.Sets/src/mage/cards/p/PariahsShield.java @@ -59,10 +59,10 @@ public final class PariahsShield extends CardImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null) { - Permanent p = game.getPermanent(equipment.getAttachedTo()); - if (p != null) { + Permanent permanent = game.getPermanent(equipment.getAttachedTo()); + if (permanent != null) { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; - p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + permanent.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/Paroxysm.java b/Mage.Sets/src/mage/cards/p/Paroxysm.java index cd9a98a5327..c2272f39b21 100644 --- a/Mage.Sets/src/mage/cards/p/Paroxysm.java +++ b/Mage.Sets/src/mage/cards/p/Paroxysm.java @@ -94,7 +94,7 @@ class ParoxysmEffect extends OneShotEffect { Cards cards = new CardsImpl(revealCardFromTop); controllerOfCreature.revealCards(source, cards, game); if (revealCardFromTop.isLand()) { - creatureAttachedTo.destroy(source.getSourceId(), game, false); + creatureAttachedTo.destroy(source, game, false); } else { ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creatureAttachedTo.getId())); diff --git a/Mage.Sets/src/mage/cards/p/PartingThoughts.java b/Mage.Sets/src/mage/cards/p/PartingThoughts.java index ddca0883aa1..50c0fca6716 100644 --- a/Mage.Sets/src/mage/cards/p/PartingThoughts.java +++ b/Mage.Sets/src/mage/cards/p/PartingThoughts.java @@ -60,14 +60,14 @@ class PartingThoughtsEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); int numberOfCounters = 0; for (Counter counter : permanent.getCounters(game).values()) { numberOfCounters += counter.getCount(); } if (numberOfCounters > 0) { - controller.drawCards(numberOfCounters, source.getSourceId(), game); - controller.loseLife(numberOfCounters, game, false); + controller.drawCards(numberOfCounters, source, game); + controller.loseLife(numberOfCounters, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PathOfPeace.java b/Mage.Sets/src/mage/cards/p/PathOfPeace.java index 718f3283193..1776e6c3daa 100644 --- a/Mage.Sets/src/mage/cards/p/PathOfPeace.java +++ b/Mage.Sets/src/mage/cards/p/PathOfPeace.java @@ -58,7 +58,7 @@ class PathOfPeaceEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && target != null) { - target.destroy(source.getSourceId(), game, false); + target.destroy(source, game, false); Player owner = game.getPlayer(target.getOwnerId()); if (owner != null) { owner.gainLife(4, game, source); diff --git a/Mage.Sets/src/mage/cards/p/PathToExile.java b/Mage.Sets/src/mage/cards/p/PathToExile.java index d4cb6a64acb..81d39ff4793 100644 --- a/Mage.Sets/src/mage/cards/p/PathToExile.java +++ b/Mage.Sets/src/mage/cards/p/PathToExile.java @@ -66,7 +66,7 @@ class PathToExileEffect extends OneShotEffect { if (controller != null && permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); // if the zone change to exile gets replaced does not prevent the target controller to be able to search - controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(permanent, null, "", source, game, Zone.BATTLEFIELD, true); if (player.chooseUse(Outcome.PutCardInPlay, "Search your library for a basic land card?", source, game)) { TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND); if (player.searchLibrary(target, source, game)) { diff --git a/Mage.Sets/src/mage/cards/p/PathwayArrows.java b/Mage.Sets/src/mage/cards/p/PathwayArrows.java index 8dfd9a026bf..a41abc0adcd 100644 --- a/Mage.Sets/src/mage/cards/p/PathwayArrows.java +++ b/Mage.Sets/src/mage/cards/p/PathwayArrows.java @@ -74,9 +74,9 @@ class PathwayArrowsEffect extends OneShotEffect { if (controller != null) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - int damageDealt = targetCreature.damage(1, source.getSourceId(), game, false, true); + int damageDealt = targetCreature.damage(1, source.getSourceId(), source, game, false, true); if (damageDealt > 0 && targetCreature.getColor(game).isColorless()) { - targetCreature.tap(game); + targetCreature.tap(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PatientRebuilding.java b/Mage.Sets/src/mage/cards/p/PatientRebuilding.java index 9f4b2ee7bc4..bf2bf4e5758 100644 --- a/Mage.Sets/src/mage/cards/p/PatientRebuilding.java +++ b/Mage.Sets/src/mage/cards/p/PatientRebuilding.java @@ -76,7 +76,7 @@ class PatientRebuildingEffect extends OneShotEffect { } } if (numberOfLandCards > 0) { - return controller.drawCards(numberOfLandCards, source.getSourceId(), game) > 0; + return controller.drawCards(numberOfLandCards, source, game) > 0; } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PatriciansScorn.java b/Mage.Sets/src/mage/cards/p/PatriciansScorn.java index 55f37ce127e..f2e1ee95360 100644 --- a/Mage.Sets/src/mage/cards/p/PatriciansScorn.java +++ b/Mage.Sets/src/mage/cards/p/PatriciansScorn.java @@ -81,7 +81,7 @@ class PatriciansScornWatcher extends Watcher { if (condition) { //no need to check - condition has already occured return; } - if (event.getType() == EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { + if (event.getType() == GameEvent.EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && filter.match(spell, game)) { condition = true; diff --git a/Mage.Sets/src/mage/cards/p/PatronOfTheNezumi.java b/Mage.Sets/src/mage/cards/p/PatronOfTheNezumi.java index 65dd8a1f14f..18ee1d4ee98 100644 --- a/Mage.Sets/src/mage/cards/p/PatronOfTheNezumi.java +++ b/Mage.Sets/src/mage/cards/p/PatronOfTheNezumi.java @@ -65,7 +65,7 @@ class PatronOfTheNezumiTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PatronOfTheVein.java b/Mage.Sets/src/mage/cards/p/PatronOfTheVein.java index c9617563d22..2a2528fce3a 100644 --- a/Mage.Sets/src/mage/cards/p/PatronOfTheVein.java +++ b/Mage.Sets/src/mage/cards/p/PatronOfTheVein.java @@ -92,7 +92,7 @@ class PatronOfTheVeinCreatureDiesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PeelFromReality.java b/Mage.Sets/src/mage/cards/p/PeelFromReality.java index 766f0e2d6b7..0a426b442f0 100644 --- a/Mage.Sets/src/mage/cards/p/PeelFromReality.java +++ b/Mage.Sets/src/mage/cards/p/PeelFromReality.java @@ -61,11 +61,11 @@ class PeelFromRealityEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - result |= permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + result |= permanent.moveToZone(Zone.HAND, source, game, false); } permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - result |= permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + result |= permanent.moveToZone(Zone.HAND, source, game, false); } return result; diff --git a/Mage.Sets/src/mage/cards/p/PeerIntoTheAbyss.java b/Mage.Sets/src/mage/cards/p/PeerIntoTheAbyss.java index 8db533e2ef2..4ba087049e9 100644 --- a/Mage.Sets/src/mage/cards/p/PeerIntoTheAbyss.java +++ b/Mage.Sets/src/mage/cards/p/PeerIntoTheAbyss.java @@ -58,8 +58,8 @@ class PeerIntoTheAbyssEffect extends OneShotEffect { if (targetPlayer == null) { return false; } - targetPlayer.drawCards((int) Math.ceil(targetPlayer.getLibrary().size() / 2.0), source.getSourceId(), game); - targetPlayer.loseLife((int) Math.ceil(targetPlayer.getLife() / 2.0), game, false); + targetPlayer.drawCards((int) Math.ceil(targetPlayer.getLibrary().size() / 2.0), source, game); + targetPlayer.loseLife((int) Math.ceil(targetPlayer.getLife() / 2.0), game, source, false); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/p/PendantOfProsperity.java b/Mage.Sets/src/mage/cards/p/PendantOfProsperity.java index b6cffe30fa0..315d0890331 100644 --- a/Mage.Sets/src/mage/cards/p/PendantOfProsperity.java +++ b/Mage.Sets/src/mage/cards/p/PendantOfProsperity.java @@ -79,7 +79,7 @@ class PendantOfProsperityEffect extends OneShotEffect { if (player == null) { return false; } - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); if (!player.chooseUse(outcome, "Put a land into play from your hand?", source, game)) { return true; } diff --git a/Mage.Sets/src/mage/cards/p/PendrellFlux.java b/Mage.Sets/src/mage/cards/p/PendrellFlux.java index 796f6de8c33..6a8d3ad1226 100644 --- a/Mage.Sets/src/mage/cards/p/PendrellFlux.java +++ b/Mage.Sets/src/mage/cards/p/PendrellFlux.java @@ -76,11 +76,11 @@ class PendrellFluxEffect extends OneShotEffect { Cost cost = permanent.getManaCost().copy(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PerilousPredicament.java b/Mage.Sets/src/mage/cards/p/PerilousPredicament.java index 0c13ea4f7f5..ffce8f2bdd4 100644 --- a/Mage.Sets/src/mage/cards/p/PerilousPredicament.java +++ b/Mage.Sets/src/mage/cards/p/PerilousPredicament.java @@ -71,14 +71,14 @@ class PerilousPredicamentSacrificeOpponentsEffect extends OneShotEffect { filterNonArtifact.add(new ControllerIdPredicate(player.getId())); if (game.getBattlefield().countAll(filterArtifact, player.getId(), game) > 0) { TargetPermanent target = new TargetPermanent(1, 1, filterArtifact, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } } if (game.getBattlefield().countAll(filterNonArtifact, player.getId(), game) > 0) { TargetPermanent target = new TargetPermanent(1, 1, filterNonArtifact, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -89,7 +89,7 @@ class PerilousPredicamentSacrificeOpponentsEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PerilousResearch.java b/Mage.Sets/src/mage/cards/p/PerilousResearch.java index e9a93a28a06..6ee0362394c 100644 --- a/Mage.Sets/src/mage/cards/p/PerilousResearch.java +++ b/Mage.Sets/src/mage/cards/p/PerilousResearch.java @@ -62,10 +62,10 @@ class PerilousResearchEffect extends OneShotEffect { if (player != null) { Target target = new TargetControlledPermanent(); - if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/p/PerilousVoyage.java b/Mage.Sets/src/mage/cards/p/PerilousVoyage.java index 2fb89445b77..1855d800e90 100644 --- a/Mage.Sets/src/mage/cards/p/PerilousVoyage.java +++ b/Mage.Sets/src/mage/cards/p/PerilousVoyage.java @@ -68,7 +68,7 @@ class PerilousVoyageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { boolean isLittle = permanent.getConvertedManaCost() < 3; - permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true); + permanent.moveToZone(Zone.HAND, source, game, true); if (isLittle && player != null) { player.scry(2, source, game); } diff --git a/Mage.Sets/src/mage/cards/p/PerimeterCaptain.java b/Mage.Sets/src/mage/cards/p/PerimeterCaptain.java index 5034a47c860..7a2218bb9c0 100644 --- a/Mage.Sets/src/mage/cards/p/PerimeterCaptain.java +++ b/Mage.Sets/src/mage/cards/p/PerimeterCaptain.java @@ -60,7 +60,7 @@ class PerimeterCaptainTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PerplexingChimera.java b/Mage.Sets/src/mage/cards/p/PerplexingChimera.java index 02288a484a6..85b1f2c0e73 100644 --- a/Mage.Sets/src/mage/cards/p/PerplexingChimera.java +++ b/Mage.Sets/src/mage/cards/p/PerplexingChimera.java @@ -107,7 +107,7 @@ class PerplexingChimeraTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -191,7 +191,7 @@ class PerplexingChimeraControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return permanent.changeControllerId(this.getTargetPointer().getFirst(game, source), game); + return permanent.changeControllerId(this.getTargetPointer().getFirst(game, source), game, source); } else { discard(); // if card once left the battlefield the effect can be discarded } diff --git a/Mage.Sets/src/mage/cards/p/Persecute.java b/Mage.Sets/src/mage/cards/p/Persecute.java index b5cad0fddb7..de587dec7ab 100644 --- a/Mage.Sets/src/mage/cards/p/Persecute.java +++ b/Mage.Sets/src/mage/cards/p/Persecute.java @@ -71,7 +71,7 @@ class PersecuteEffect extends OneShotEffect { FilterCard filterCard = new FilterCard(); filterCard.add(new ColorPredicate(choice.getColor())); targetPlayer.revealCards(source, targetPlayer.getHand(), game); - targetPlayer.discard(new CardsImpl(targetPlayer.getHand().getCards(filterCard, game)), source, game); + targetPlayer.discard(new CardsImpl(targetPlayer.getHand().getCards(filterCard, game)), false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PersonalIncarnation.java b/Mage.Sets/src/mage/cards/p/PersonalIncarnation.java index c39a4cc0fc8..fc9a08ff60c 100644 --- a/Mage.Sets/src/mage/cards/p/PersonalIncarnation.java +++ b/Mage.Sets/src/mage/cards/p/PersonalIncarnation.java @@ -104,7 +104,7 @@ class PersonalIncarnationLoseHalfLifeEffect extends OneShotEffect { if (player != null) { Integer amount = (int) Math.ceil(player.getLife() / 2f); if (amount > 0) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java b/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java index 56a263d736d..b122815961c 100644 --- a/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java +++ b/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java @@ -12,6 +12,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import java.util.UUID; @@ -51,12 +52,12 @@ class PersonalSanctuaryEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); game.informPlayers("Damage has been prevented: " + damage); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/p/PestilenceDemon.java b/Mage.Sets/src/mage/cards/p/PestilenceDemon.java index 88fefa8fa1f..ba99e5bfe14 100644 --- a/Mage.Sets/src/mage/cards/p/PestilenceDemon.java +++ b/Mage.Sets/src/mage/cards/p/PestilenceDemon.java @@ -60,13 +60,13 @@ class PestilenceDemonEffect extends OneShotEffect { for (UUID permanentId : game.getBattlefield().getAllPermanentIds()) { Permanent p = game.getPermanent(permanentId); if (p != null && p.isCreature()) { - p.damage(1, source.getSourceId(), game, false, true); + p.damage(1, source.getSourceId(), source, game, false, true); } } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player p = game.getPlayer(playerId); if (p != null) { - p.damage(1, source.getSourceId(), game); + p.damage(1, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PestilentHaze.java b/Mage.Sets/src/mage/cards/p/PestilentHaze.java index 424901bd535..13e92c8ff58 100644 --- a/Mage.Sets/src/mage/cards/p/PestilentHaze.java +++ b/Mage.Sets/src/mage/cards/p/PestilentHaze.java @@ -64,7 +64,7 @@ class PestilentHazeEffect extends OneShotEffect { StaticFilters.FILTER_PERMANENT_PLANESWALKER, source.getControllerId(), source.getSourceId(), game ).stream() - .forEach(permanent -> permanent.removeCounters(CounterType.LOYALTY.createInstance(2), game)); + .forEach(permanent -> permanent.removeCounters(CounterType.LOYALTY.createInstance(2), source, game)); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PetalsOfInsight.java b/Mage.Sets/src/mage/cards/p/PetalsOfInsight.java index ab83a8e016f..4def57d6c06 100644 --- a/Mage.Sets/src/mage/cards/p/PetalsOfInsight.java +++ b/Mage.Sets/src/mage/cards/p/PetalsOfInsight.java @@ -71,7 +71,7 @@ class PetalsOfInsightEffect extends OneShotEffect { controller.moveCards(spellCard, Zone.HAND, source, game); } } else { - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/Phantasmagorian.java b/Mage.Sets/src/mage/cards/p/Phantasmagorian.java index cb3b20a234e..6339f9cb30e 100644 --- a/Mage.Sets/src/mage/cards/p/Phantasmagorian.java +++ b/Mage.Sets/src/mage/cards/p/Phantasmagorian.java @@ -76,13 +76,13 @@ class CounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); cost.clearPaid(); if (player != null - && cost.canPay(source, source.getSourceId(), player.getId(), game) + && cost.canPay(source, source, player.getId(), game) && player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + '?', source, game)) { - if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) { + if (cost.pay(source, game, source, playerId, false, null)) { game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/p/PhantasmalMount.java b/Mage.Sets/src/mage/cards/p/PhantasmalMount.java index 9c00008da8c..a5eb8aed96d 100644 --- a/Mage.Sets/src/mage/cards/p/PhantasmalMount.java +++ b/Mage.Sets/src/mage/cards/p/PhantasmalMount.java @@ -132,12 +132,12 @@ class PhantasmalMountDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(creatureId)) { return true; } diff --git a/Mage.Sets/src/mage/cards/p/PhantomWings.java b/Mage.Sets/src/mage/cards/p/PhantomWings.java index b0c9c2654d9..cf7dab41439 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomWings.java +++ b/Mage.Sets/src/mage/cards/p/PhantomWings.java @@ -79,7 +79,7 @@ public final class PhantomWings extends CardImpl { { Permanent enchantedCreature = game.getPermanent(permanent.getAttachedTo()); if (enchantedCreature != null) { - return enchantedCreature.moveToZone(Zone.HAND, source.getSourceId(), game, false); + return enchantedCreature.moveToZone(Zone.HAND, source, game, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java b/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java index eb33899f32b..ee20db3d1fb 100644 --- a/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java +++ b/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java @@ -88,7 +88,7 @@ class PharikaExileEffect extends OneShotEffect { if (tokenController == null) { return false; } - return new PharikaSnakeToken().putOntoBattlefield(1, game, source.getSourceId(), tokenController.getId()); + return new PharikaSnakeToken().putOntoBattlefield(1, game, source, tokenController.getId()); } @Override diff --git a/Mage.Sets/src/mage/cards/p/Phthisis.java b/Mage.Sets/src/mage/cards/p/Phthisis.java index 8d0b3a39199..1e7a5998441 100644 --- a/Mage.Sets/src/mage/cards/p/Phthisis.java +++ b/Mage.Sets/src/mage/cards/p/Phthisis.java @@ -67,9 +67,9 @@ class PhthisisEffect extends OneShotEffect { Player controller = game.getPlayer(creature.getControllerId()); if (controller != null) { int lifeLoss = CardUtil.addWithOverflowCheck(creature.getPower().getValue(), creature.getToughness().getValue()); - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); // the life loss happens also if the creature is indestructible or regenerated (legal targets) - controller.loseLife(lifeLoss, game, false); + controller.loseLife(lifeLoss, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PhylacteryLich.java b/Mage.Sets/src/mage/cards/p/PhylacteryLich.java index a6de78d8374..3f1536bfff2 100644 --- a/Mage.Sets/src/mage/cards/p/PhylacteryLich.java +++ b/Mage.Sets/src/mage/cards/p/PhylacteryLich.java @@ -111,7 +111,7 @@ class PhylacteryLichEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); - if (target.canChoose(source.getControllerId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (player.choose(Outcome.Neutral, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java index aca55a16d5d..d81f71c72d1 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java @@ -74,7 +74,7 @@ class PhyrexianDelverEffect extends OneShotEffect { if (game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) { result = controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game); } - controller.loseLife(creatureCard.getConvertedManaCost(), game, false); + controller.loseLife(creatureCard.getConvertedManaCost(), game, source, false); return result; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianDevourer.java b/Mage.Sets/src/mage/cards/p/PhyrexianDevourer.java index d571280f367..5f0a02bd13f 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianDevourer.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianDevourer.java @@ -134,7 +134,7 @@ class ExileTopCardLibraryCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { card = controller.getLibrary().getFromTop(game); @@ -146,7 +146,7 @@ class ExileTopCardLibraryCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { return controller.getLibrary().hasCards(); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java b/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java index 41900f0ee1f..bdb79a4e19a 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java @@ -69,12 +69,12 @@ class PhyrexianDreadnoughtSacrificeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { int sumPower = 0; - if (targets.choose(Outcome.Sacrifice, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Sacrifice, controllerId, source.getSourceId(), game)) { for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.sacrifice(sourceId, game)) { + if (permanent != null && permanent.sacrifice(source, game)) { sumPower += permanent.getPower().getValue(); } } @@ -85,10 +85,10 @@ class PhyrexianDreadnoughtSacrificeCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { int sumPower = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controllerId, game)) { - if (!permanent.getId().equals(sourceId)) { + if (!permanent.getId().equals(source.getSourceId())) { sumPower += permanent.getPower().getValue(); } } diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianFurnace.java b/Mage.Sets/src/mage/cards/p/PhyrexianFurnace.java index 83c5e59fc63..65f94a385fd 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianFurnace.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianFurnace.java @@ -79,7 +79,7 @@ class PhyrexianFurnaceEffect extends OneShotEffect { break; } if (bottomCard != null) { - return player.moveCardToExileWithInfo(bottomCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + return player.moveCardToExileWithInfo(bottomCard, null, "", source, game, Zone.GRAVEYARD, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java b/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java index 390f8a5ca61..3febf369918 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java @@ -16,6 +16,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import java.util.UUID; @@ -71,11 +72,11 @@ class PhyrexianHydraEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { boolean retValue = false; - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); int damage = event.getAmount(); if (!game.replaceEvent(preventEvent)) { event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); retValue = true; } Permanent permanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianIngester.java b/Mage.Sets/src/mage/cards/p/PhyrexianIngester.java index 0b035db1bd1..50d87641490 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianIngester.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianIngester.java @@ -88,7 +88,7 @@ class PhyrexianIngesterImprintEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent targetPermanent = game.getPermanent(source.getFirstTarget()); if (sourcePermanent != null && targetPermanent != null) { - controller.moveCardToExileWithInfo(targetPermanent, getId(), sourceObject.getIdName() + " (Imprint)", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(targetPermanent, getId(), sourceObject.getIdName() + " (Imprint)", source, game, Zone.BATTLEFIELD, true); sourcePermanent.imprint(targetPermanent.getId(), game); return true; } diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianNegator.java b/Mage.Sets/src/mage/cards/p/PhyrexianNegator.java index 1511c15e121..d829a55dea4 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianNegator.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianNegator.java @@ -63,7 +63,7 @@ class PhyrexianNegatorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianObliterator.java b/Mage.Sets/src/mage/cards/p/PhyrexianObliterator.java index 167ae39f705..f49a9c9a64f 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianObliterator.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianObliterator.java @@ -66,7 +66,7 @@ class PhyrexianObliteratorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianProcessor.java b/Mage.Sets/src/mage/cards/p/PhyrexianProcessor.java index e6a289cbe12..03852614e85 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianProcessor.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianProcessor.java @@ -75,7 +75,7 @@ class PhyrexianProcessorPayLifeEffect extends OneShotEffect { } int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game); Cost cost = new PayLifeCost(payAmount); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } Card sourceCard = game.getCard(source.getSourceId()); @@ -114,7 +114,7 @@ class PhyrexianProcessorCreateTokenEffect extends OneShotEffect { MinionToken token = new MinionToken(); token.getPower().modifyBaseValue(lifePaid); token.getToughness().modifyBaseValue(lifePaid); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianRebirth.java b/Mage.Sets/src/mage/cards/p/PhyrexianRebirth.java index 0cfe6416ee6..70c0c3ddceb 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianRebirth.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianRebirth.java @@ -50,12 +50,12 @@ public final class PhyrexianRebirth extends CardImpl { public boolean apply(Game game, Ability source) { int count = 0; for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) { - count += permanent.destroy(source.getSourceId(), game, false) ? 1 : 0; + count += permanent.destroy(source, game, false) ? 1 : 0; } PhyrexianRebirthHorrorToken horrorToken = new PhyrexianRebirthHorrorToken(); horrorToken.getPower().modifyBaseValue(count); horrorToken.getToughness().modifyBaseValue(count); - horrorToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + horrorToken.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java b/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java index 2ca284b7372..4e8837907db 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java @@ -77,7 +77,7 @@ class PhyrexianRevokerEffect2 extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.ACTIVATE_ABILITY) { + if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { MageObject object = game.getObject(event.getSourceId()); // Can happen for special ability???? if (object != null) { Optional optAbility = object.getAbilities().get(event.getTargetId()); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianTyranny.java b/Mage.Sets/src/mage/cards/p/PhyrexianTyranny.java index 819aa094f1d..1e38af8a266 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianTyranny.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianTyranny.java @@ -58,7 +58,7 @@ class PhyrexianTyrannyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override @@ -98,8 +98,8 @@ class PhyrexianTyrannyEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { Cost cost = ManaUtil.createManaCost(2, false); - if (!cost.pay(source, game, player.getId(), player.getId(), false, null)) { - player.loseLife(2, game, false); + if (!cost.pay(source, game, source, player.getId(), false, null)) { + player.loseLife(2, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianUnlife.java b/Mage.Sets/src/mage/cards/p/PhyrexianUnlife.java index 5dc6a5abe83..81b0d13b76c 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianUnlife.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianUnlife.java @@ -78,7 +78,7 @@ class PhyrexianUnlifeEffect2 extends ReplacementEffectImpl { if (actualDamage > 0) { Player player = game.getPlayer(damageEvent.getPlayerId()); Permanent damageSource = game.getPermanent(damageEvent.getSourceId()); - player.addCounters(CounterType.POISON.createInstance(actualDamage), game); + player.addCounters(CounterType.POISON.createInstance(actualDamage), source, game); if (damageSource != null && damageSource.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) { Player controlPlayer = game.getPlayer(damageSource.getControllerId()); controlPlayer.gainLife(actualDamage, game, source); @@ -90,7 +90,7 @@ class PhyrexianUnlifeEffect2 extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianVatmother.java b/Mage.Sets/src/mage/cards/p/PhyrexianVatmother.java index a138cb64ffe..2fd261af114 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianVatmother.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianVatmother.java @@ -66,7 +66,7 @@ class PoisonControllerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.addCounters(CounterType.POISON.createInstance(), game); + player.addCounters(CounterType.POISON.createInstance(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/Phytohydra.java b/Mage.Sets/src/mage/cards/p/Phytohydra.java index 60617aec62c..a7ae6a28c71 100644 --- a/Mage.Sets/src/mage/cards/p/Phytohydra.java +++ b/Mage.Sets/src/mage/cards/p/Phytohydra.java @@ -66,7 +66,7 @@ class PhytohydraEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PiasRevolution.java b/Mage.Sets/src/mage/cards/p/PiasRevolution.java index fa399106133..01661d9a855 100644 --- a/Mage.Sets/src/mage/cards/p/PiasRevolution.java +++ b/Mage.Sets/src/mage/cards/p/PiasRevolution.java @@ -74,7 +74,7 @@ class PiasRevolutionReturnEffect extends OneShotEffect { if (opponent.chooseUse(outcome, "Have Pia's Revolution deal 3 damage to you to prevent that " + permanent.getIdName() + " returns to " + controller.getName() + "'s hand?", source, game)) { - opponent.damage(3, source.getSourceId(), game); + opponent.damage(3, source.getSourceId(), source, game); } else if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) { controller.moveCards(game.getCard(permanentId), Zone.HAND, source, game); } diff --git a/Mage.Sets/src/mage/cards/p/PickTheBrain.java b/Mage.Sets/src/mage/cards/p/PickTheBrain.java index 4edb943d414..7dc4021bc5b 100644 --- a/Mage.Sets/src/mage/cards/p/PickTheBrain.java +++ b/Mage.Sets/src/mage/cards/p/PickTheBrain.java @@ -70,7 +70,7 @@ class PickTheBrainEffect extends SearchTargetGraveyardHandLibraryForCardNameAndE if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) { Card card = opponent.getHand().get(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.HAND, true); // Check the Delirium condition if (!DeliriumCondition.instance.apply(game, source)) { diff --git a/Mage.Sets/src/mage/cards/p/PilgrimOfJustice.java b/Mage.Sets/src/mage/cards/p/PilgrimOfJustice.java index 728b63f2262..7cbcba3eea7 100644 --- a/Mage.Sets/src/mage/cards/p/PilgrimOfJustice.java +++ b/Mage.Sets/src/mage/cards/p/PilgrimOfJustice.java @@ -17,6 +17,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.target.TargetSource; import java.util.UUID; @@ -91,21 +92,15 @@ class PilgrimOfJusticeEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) { - preventDamage(event, source, target.getFirstTarget(), game); - return true; - } - return false; - } - - private void preventDamage(GameEvent event, Ability source, UUID target, Game game) { - GameEvent preventEvent = new PreventDamageEvent(target, source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); - this.used = true; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, target, source.getSourceId(), source.getControllerId(), damage)); + this.used = true; // one time use + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); + return true; } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PilgrimOfVirtue.java b/Mage.Sets/src/mage/cards/p/PilgrimOfVirtue.java index 6dc3426496c..d31ef405171 100644 --- a/Mage.Sets/src/mage/cards/p/PilgrimOfVirtue.java +++ b/Mage.Sets/src/mage/cards/p/PilgrimOfVirtue.java @@ -17,6 +17,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.target.TargetSource; import java.util.UUID; @@ -91,21 +92,15 @@ class PilgrimOfVirtueEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) { - preventDamage(event, source, target.getFirstTarget(), game); - return true; - } - return false; - } - - private void preventDamage(GameEvent event, Ability source, UUID target, Game game) { - GameEvent preventEvent = new PreventDamageEvent(target, source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); - this.used = true; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, target, source.getSourceId(), source.getControllerId(), damage)); + this.used = true; // one time use + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); + return true; } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PillarTombsOfAku.java b/Mage.Sets/src/mage/cards/p/PillarTombsOfAku.java index c1a353d53bd..319f6032c18 100644 --- a/Mage.Sets/src/mage/cards/p/PillarTombsOfAku.java +++ b/Mage.Sets/src/mage/cards/p/PillarTombsOfAku.java @@ -71,12 +71,12 @@ class PillarTombsOfAkuEffect extends OneShotEffect { } if (activePlayer.chooseUse(Outcome.Sacrifice, "Sacrifice a creature?", source, game)) { Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent()); - if (cost.canPay(source, source.getSourceId(), activePlayer.getId(), game) - && cost.pay(source, game, source.getSourceId(), activePlayer.getId(), true)) { + if (cost.canPay(source, source, activePlayer.getId(), game) + && cost.pay(source, game, source, activePlayer.getId(), true)) { return true; } } - activePlayer.loseLife(5, game, false); + activePlayer.loseLife(5, game, source, false); return new SacrificeSourceEffect().apply(game, source); } } diff --git a/Mage.Sets/src/mage/cards/p/PiousWarrior.java b/Mage.Sets/src/mage/cards/p/PiousWarrior.java index c9663cd2f9d..9cea585930e 100644 --- a/Mage.Sets/src/mage/cards/p/PiousWarrior.java +++ b/Mage.Sets/src/mage/cards/p/PiousWarrior.java @@ -64,7 +64,7 @@ class PiousWarriorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PistusStrike.java b/Mage.Sets/src/mage/cards/p/PistusStrike.java index 7ffe18afc10..4d0996f65ed 100644 --- a/Mage.Sets/src/mage/cards/p/PistusStrike.java +++ b/Mage.Sets/src/mage/cards/p/PistusStrike.java @@ -70,7 +70,7 @@ class PoisonControllerTargetCreatureEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.addCounters(CounterType.POISON.createInstance(), game); + player.addCounters(CounterType.POISON.createInstance(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/Plagiarize.java b/Mage.Sets/src/mage/cards/p/Plagiarize.java index 405be022a26..6d2dcdda79b 100644 --- a/Mage.Sets/src/mage/cards/p/Plagiarize.java +++ b/Mage.Sets/src/mage/cards/p/Plagiarize.java @@ -64,7 +64,7 @@ class PlagiarizeEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(1, event.getSourceId(), game, event.getAppliedEffects()); + player.drawCards(1, source, game, event); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PlagueBoiler.java b/Mage.Sets/src/mage/cards/p/PlagueBoiler.java index 43634896a00..2a99cd99035 100644 --- a/Mage.Sets/src/mage/cards/p/PlagueBoiler.java +++ b/Mage.Sets/src/mage/cards/p/PlagueBoiler.java @@ -101,7 +101,7 @@ class PlagueBoilerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_ADDED; + return event.getType() == GameEvent.EventType.COUNTER_ADDED; } @Override @@ -141,7 +141,7 @@ class PlagueBoilerSacrificeDestroyEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - if (sourcePermanent.sacrifice(source.getSourceId(), game)) { + if (sourcePermanent.sacrifice(source, game)) { return new DestroyAllEffect(new FilterNonlandPermanent()).apply(game, source); } } diff --git a/Mage.Sets/src/mage/cards/p/PlagueFiend.java b/Mage.Sets/src/mage/cards/p/PlagueFiend.java index ee2e0ed1d5d..e8014c9361e 100644 --- a/Mage.Sets/src/mage/cards/p/PlagueFiend.java +++ b/Mage.Sets/src/mage/cards/p/PlagueFiend.java @@ -74,10 +74,10 @@ class PlagueFiendEffect extends OneShotEffect { cost.clearPaid(); final StringBuilder sb = new StringBuilder("Pay {2}? (Otherwise ").append(targetCreature.getName()).append(" will be destroyed)"); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { - cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false, null); + cost.pay(source, game, source, targetCreature.getControllerId(), false, null); } if (!cost.isPaid()) { - targetCreature.destroy(source.getSourceId(), game, false); + targetCreature.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/p/PlagueOfVermin.java b/Mage.Sets/src/mage/cards/p/PlagueOfVermin.java index 59a53a9367d..6b3dd8ca70c 100644 --- a/Mage.Sets/src/mage/cards/p/PlagueOfVermin.java +++ b/Mage.Sets/src/mage/cards/p/PlagueOfVermin.java @@ -80,7 +80,7 @@ class PlagueOfVerminEffect extends OneShotEffect { if (currentPlayer.chooseUse(Outcome.AIDontUseIt, "Pay life?", source, game)) { totalPaidLife = currentPlayer.getAmount(0, controller.getLife(), "Pay how many life?", game); if (totalPaidLife > 0) { - currentPlayer.loseLife(totalPaidLife, game, false); + currentPlayer.loseLife(totalPaidLife, game, source, false); if (payLife.get(currentPlayer.getId()) == null) { payLife.put(currentPlayer.getId(), totalPaidLife); } else { @@ -110,7 +110,7 @@ class PlagueOfVerminEffect extends OneShotEffect { : payLife.entrySet()) { Player player = game.getPlayer(entry.getKey()); if (player != null) { - token.putOntoBattlefield(entry.getValue(), game, source.getSourceId(), player.getId()); + token.putOntoBattlefield(entry.getValue(), game, source, player.getId()); } } diff --git a/Mage.Sets/src/mage/cards/p/PlagueReaver.java b/Mage.Sets/src/mage/cards/p/PlagueReaver.java index bd643295600..1453d09e7cf 100644 --- a/Mage.Sets/src/mage/cards/p/PlagueReaver.java +++ b/Mage.Sets/src/mage/cards/p/PlagueReaver.java @@ -92,7 +92,7 @@ class PlagueReaverSacrificeEffect extends OneShotEffect { if (permanent == null) { continue; } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/Plaguecrafter.java b/Mage.Sets/src/mage/cards/p/Plaguecrafter.java index f176630b163..aa1215b050b 100644 --- a/Mage.Sets/src/mage/cards/p/Plaguecrafter.java +++ b/Mage.Sets/src/mage/cards/p/Plaguecrafter.java @@ -90,7 +90,7 @@ class PlaguecrafterEffect extends OneShotEffect { CardType.PLANESWALKER.getPredicate() )); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { while (!target.isChosen() && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } @@ -103,7 +103,7 @@ class PlaguecrafterEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } diff --git a/Mage.Sets/src/mage/cards/p/PlanarChaos.java b/Mage.Sets/src/mage/cards/p/PlanarChaos.java index 988ca68454e..e8979cece58 100644 --- a/Mage.Sets/src/mage/cards/p/PlanarChaos.java +++ b/Mage.Sets/src/mage/cards/p/PlanarChaos.java @@ -64,7 +64,7 @@ class PlanarChaosUpkeepEffect extends OneShotEffect { if (!player.flipCoin(source, game, true)) { Permanent perm = game.getPermanent(source.getSourceId()); if (perm != null) { - perm.sacrifice(source.getSourceId(), game); + perm.sacrifice(source, game); } return true; } @@ -106,7 +106,7 @@ class PlanarChaosCastAllEffect extends OneShotEffect { if (caster != null) { if (!caster.flipCoin(source, game, true)) { game.informPlayers(sourceObject.getLogName() + ": " + spell.getLogName() + " countered"); - game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game); + game.getStack().counter(getTargetPointer().getFirst(game, source), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java index 5bbcba5d683..2416c673fed 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java @@ -58,7 +58,7 @@ class PlaneswalkersFuryEffect extends OneShotEffect { if (card != null) { revealed.add(card); opponent.revealCards("Planeswalker's Fury", revealed, game); - opponent.damage(card.getConvertedManaCost(), source.getSourceId(), game); + opponent.damage(card.getConvertedManaCost(), source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java index 585eac5656e..2cde315a0ca 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java @@ -76,7 +76,7 @@ class PlaneswalkersMischiefEffect extends OneShotEffect { opponent.revealCards(source, cards, game); if (revealedCard.isInstant() || revealedCard.isSorcery()) { - opponent.moveCardToExileWithInfo(revealedCard, source.getSourceId(), "Planeswalker's Mischief", source.getSourceId(), game, Zone.HAND, true); + opponent.moveCardToExileWithInfo(revealedCard, source.getSourceId(), "Planeswalker's Mischief", source, game, Zone.HAND, true); AsThoughEffect effect = new PlaneswalkersMischiefCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(revealedCard.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/p/PlasmCapture.java b/Mage.Sets/src/mage/cards/p/PlasmCapture.java index 7295088eb83..7eeef09c25e 100644 --- a/Mage.Sets/src/mage/cards/p/PlasmCapture.java +++ b/Mage.Sets/src/mage/cards/p/PlasmCapture.java @@ -60,7 +60,7 @@ class PlasmCaptureCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); if (spell != null) { - game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game); + game.getStack().counter(getTargetPointer().getFirst(game, source), source, game); // mana gets added also if counter is not successful int mana = spell.getConvertedManaCost(); AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility diff --git a/Mage.Sets/src/mage/cards/p/PlatinumAngel.java b/Mage.Sets/src/mage/cards/p/PlatinumAngel.java index c3a5a24f65a..98acec1944f 100644 --- a/Mage.Sets/src/mage/cards/p/PlatinumAngel.java +++ b/Mage.Sets/src/mage/cards/p/PlatinumAngel.java @@ -67,8 +67,8 @@ public final class PlatinumAngel extends CardImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if ((event.getType() == EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) || - (event.getType() == EventType.LOSES && event.getPlayerId().equals(source.getControllerId()))) { + if ((event.getType() == GameEvent.EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) || + (event.getType() == GameEvent.EventType.LOSES && event.getPlayerId().equals(source.getControllerId()))) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PleaForPower.java b/Mage.Sets/src/mage/cards/p/PleaForPower.java index ab14ac97c51..1f9ddf495d6 100644 --- a/Mage.Sets/src/mage/cards/p/PleaForPower.java +++ b/Mage.Sets/src/mage/cards/p/PleaForPower.java @@ -72,7 +72,7 @@ class PleaForPowerEffect extends OneShotEffect { if (timeCount > knowledgeCount) { new AddExtraTurnControllerEffect().apply(game, source); } else { - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PlungeIntoDarkness.java b/Mage.Sets/src/mage/cards/p/PlungeIntoDarkness.java index 869d5153fc5..ba4a214e92b 100644 --- a/Mage.Sets/src/mage/cards/p/PlungeIntoDarkness.java +++ b/Mage.Sets/src/mage/cards/p/PlungeIntoDarkness.java @@ -84,7 +84,7 @@ class PlungeIntoDarknessLifeEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { numSacrificed++; } } @@ -120,7 +120,7 @@ class PlungeIntoDarknessSearchEffect extends OneShotEffect { if (controller != null) { VariableCost cost = new PayVariableLifeCost(); int xValue = cost.announceXValue(source, game); - cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), false, null); + cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source, source.getControllerId(), false, null); Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, xValue)); controller.lookAtCards(source, null, cards, game); diff --git a/Mage.Sets/src/mage/cards/p/PollenbrightWings.java b/Mage.Sets/src/mage/cards/p/PollenbrightWings.java index d9cf2e1cba6..fd55951c7ac 100644 --- a/Mage.Sets/src/mage/cards/p/PollenbrightWings.java +++ b/Mage.Sets/src/mage/cards/p/PollenbrightWings.java @@ -78,7 +78,7 @@ class PollenbrightWingsAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java b/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java index 0fa30f941f0..23b43d33361 100644 --- a/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java +++ b/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java @@ -108,14 +108,14 @@ class PolukranosWorldEaterEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target); if (permanent != null) { permanents.add(permanent); - permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), game, false, true); + permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), source, game, false, true); } } // Each of those creatures deals damage equal to its power to Polukranos Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sourceCreature != null) { for (Permanent permanent : permanents) { - sourceCreature.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); + sourceCreature.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/Pongify.java b/Mage.Sets/src/mage/cards/p/Pongify.java index 891f529542b..16017e1053d 100644 --- a/Mage.Sets/src/mage/cards/p/Pongify.java +++ b/Mage.Sets/src/mage/cards/p/Pongify.java @@ -63,7 +63,7 @@ class PongifyEffect extends OneShotEffect { if (permanent != null) { UUID controllerId = permanent.getControllerId(); if (controllerId != null) { - new PongifyApeToken().putOntoBattlefield(1, game, source.getSourceId(), controllerId); + new PongifyApeToken().putOntoBattlefield(1, game, source, controllerId); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PonybackBrigade.java b/Mage.Sets/src/mage/cards/p/PonybackBrigade.java index 04d3001370a..077fc9fa403 100644 --- a/Mage.Sets/src/mage/cards/p/PonybackBrigade.java +++ b/Mage.Sets/src/mage/cards/p/PonybackBrigade.java @@ -73,10 +73,10 @@ class PonybackBrigadeAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TURNEDFACEUP && event.getTargetId().equals(this.getSourceId())) { + if (event.getType() == GameEvent.EventType.TURNEDFACEUP && event.getTargetId().equals(this.getSourceId())) { return true; } - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())) { Permanent sourcePermanent = game.getPermanent(getSourceId()); if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; diff --git a/Mage.Sets/src/mage/cards/p/PorphyryNodes.java b/Mage.Sets/src/mage/cards/p/PorphyryNodes.java index c1321059a7e..cbd52a0fa64 100644 --- a/Mage.Sets/src/mage/cards/p/PorphyryNodes.java +++ b/Mage.Sets/src/mage/cards/p/PorphyryNodes.java @@ -101,7 +101,7 @@ class PorphyryNodesEffect extends OneShotEffect { } if (permanentToDestroy != null) { game.informPlayers(sourcePermanent.getName() + " chosen creature: " + permanentToDestroy.getName()); - return permanentToDestroy.destroy(source.getSourceId(), game, true); + return permanentToDestroy.destroy(source, game, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/Portcullis.java b/Mage.Sets/src/mage/cards/p/Portcullis.java index e8478e4bbc5..6f6a12309c7 100644 --- a/Mage.Sets/src/mage/cards/p/Portcullis.java +++ b/Mage.Sets/src/mage/cards/p/Portcullis.java @@ -130,7 +130,7 @@ class PortcullisReturnToBattlefieldTriggeredAbility extends DelayedTriggeredAbil @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PossessedPortal.java b/Mage.Sets/src/mage/cards/p/PossessedPortal.java index 87347da971d..1b9fd8d60b5 100644 --- a/Mage.Sets/src/mage/cards/p/PossessedPortal.java +++ b/Mage.Sets/src/mage/cards/p/PossessedPortal.java @@ -101,13 +101,13 @@ class PossessedPortalEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); Cost discardCost = new DiscardCardCost(); - if (player != null && discardCost.canPay(source, source.getSourceId(), playerId, game) + if (player != null && discardCost.canPay(source, source, playerId, game) && player.chooseUse(Outcome.Discard, "Discard a card? (Otherwise sacrifice a permanent)", source, game)) { - discardCost.pay(source, game, source.getSourceId(), playerId, true, null); + discardCost.pay(source, game, source, playerId, true, null); } else { Cost sacrificeCost = new SacrificeTargetCost(new TargetControlledPermanent()); - sacrificeCost.pay(source, game, source.getSourceId(), playerId, true, null); + sacrificeCost.pay(source, game, source, playerId, true, null); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PossessedSkaab.java b/Mage.Sets/src/mage/cards/p/PossessedSkaab.java index acd47e5fb02..1df945abdd3 100644 --- a/Mage.Sets/src/mage/cards/p/PossessedSkaab.java +++ b/Mage.Sets/src/mage/cards/p/PossessedSkaab.java @@ -83,17 +83,13 @@ class PossessedSkaabDiesEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PossibilityStorm.java b/Mage.Sets/src/mage/cards/p/PossibilityStorm.java index 2ccaa9c354d..9c6f3906120 100644 --- a/Mage.Sets/src/mage/cards/p/PossibilityStorm.java +++ b/Mage.Sets/src/mage/cards/p/PossibilityStorm.java @@ -66,7 +66,7 @@ class PossibilityStormTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Poultrygeist.java b/Mage.Sets/src/mage/cards/p/Poultrygeist.java index abcd43019b8..d14a4ca1bbc 100644 --- a/Mage.Sets/src/mage/cards/p/Poultrygeist.java +++ b/Mage.Sets/src/mage/cards/p/Poultrygeist.java @@ -64,11 +64,11 @@ class PoultrygeistEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int result = controller.rollDice(game, 6); + int result = controller.rollDice(source, game, 6); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { if (result == 1) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } else { return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/p/PowderKeg.java b/Mage.Sets/src/mage/cards/p/PowderKeg.java index d67ae2924ab..9761fdcd321 100644 --- a/Mage.Sets/src/mage/cards/p/PowderKeg.java +++ b/Mage.Sets/src/mage/cards/p/PowderKeg.java @@ -73,7 +73,7 @@ class PowderKegEffect extends OneShotEffect { filter.add(Predicates.or(CardType.ARTIFACT.getPredicate(), CardType.CREATURE.getPredicate())); filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, count)); for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - perm.destroy(source.getSourceId(), game, false); + perm.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PowerLeak.java b/Mage.Sets/src/mage/cards/p/PowerLeak.java index 6d313dcf71f..4219848ac15 100644 --- a/Mage.Sets/src/mage/cards/p/PowerLeak.java +++ b/Mage.Sets/src/mage/cards/p/PowerLeak.java @@ -80,7 +80,7 @@ class PowerLeakEffect extends OneShotEffect { if (player.chooseUse(Outcome.Neutral, message, source, game)) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "Choose the amount of mana to pay", game, source); cost.add(new GenericManaCost(xValue)); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(player.getLogName() + " paid {" + xValue + "} for " + permanent.getLogName()); } else { game.informPlayers(player.getLogName() + " didn't pay {X} for " + permanent.getLogName()); @@ -94,7 +94,7 @@ class PowerLeakEffect extends OneShotEffect { effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, source); } - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); effect.discard(); return true; } diff --git a/Mage.Sets/src/mage/cards/p/PowerSink.java b/Mage.Sets/src/mage/cards/p/PowerSink.java index 08e7e1b5c0a..d39b10ada4b 100644 --- a/Mage.Sets/src/mage/cards/p/PowerSink.java +++ b/Mage.Sets/src/mage/cards/p/PowerSink.java @@ -72,7 +72,7 @@ class PowerSinkCounterUnlessPaysEffect extends OneShotEffect { if (amount > 0) { Cost cost = ManaUtil.createManaCost(amount, true); if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " to prevent?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source, player.getId(), false)) { game.informPlayers(sourceObject.getName() + ": additional cost was paid"); return true; } @@ -80,7 +80,7 @@ class PowerSinkCounterUnlessPaysEffect extends OneShotEffect { game.informPlayers(sourceObject.getName() + ": additional cost wasn't paid - countering " + spell.getName()); // Counter target spell unless its controller pays {X} - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); // that player taps all lands with mana abilities they control... List lands = game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), player.getId(), game); @@ -88,7 +88,7 @@ class PowerSinkCounterUnlessPaysEffect extends OneShotEffect { Abilities landAbilities = land.getAbilities(); for (Ability ability : landAbilities) { if (ability instanceof ActivatedManaAbilityImpl) { - land.tap(game); + land.tap(source, game); break; } } diff --git a/Mage.Sets/src/mage/cards/p/PowerSurge.java b/Mage.Sets/src/mage/cards/p/PowerSurge.java index a2acb2a84ba..2a49c4e4718 100644 --- a/Mage.Sets/src/mage/cards/p/PowerSurge.java +++ b/Mage.Sets/src/mage/cards/p/PowerSurge.java @@ -62,7 +62,7 @@ class PowerSurgeDamageEffect extends OneShotEffect { PowerSurgeWatcher watcher = game.getState().getWatcher(PowerSurgeWatcher.class); if (watcher != null) { int damage = watcher.getUntappedLandCount(); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PowerstoneMinefield.java b/Mage.Sets/src/mage/cards/p/PowerstoneMinefield.java index c4fbfadee8f..32df324351f 100644 --- a/Mage.Sets/src/mage/cards/p/PowerstoneMinefield.java +++ b/Mage.Sets/src/mage/cards/p/PowerstoneMinefield.java @@ -53,7 +53,7 @@ class PowerstoneMinefieldTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED || event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Pox.java b/Mage.Sets/src/mage/cards/p/Pox.java index 8bec2346935..cd7269455ad 100644 --- a/Mage.Sets/src/mage/cards/p/Pox.java +++ b/Mage.Sets/src/mage/cards/p/Pox.java @@ -68,7 +68,7 @@ class PoxEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int lifeToLose = (int) Math.ceil(player.getLife() / 3.0); - player.loseLife(lifeToLose, game, false); + player.loseLife(lifeToLose, game, source, false); } } // then discards a third of the cards in their hand, @@ -77,7 +77,7 @@ class PoxEffect extends OneShotEffect { if (player != null) { int cardsToDiscard = (int) Math.ceil(player.getHand().size() / 3.0); if (cardsToDiscard > 0) { - player.discard(cardsToDiscard, false, source, game); + player.discard(cardsToDiscard, false, false, source, game); } } } @@ -93,7 +93,7 @@ class PoxEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } @@ -111,7 +111,7 @@ class PoxEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/p/PraetorsGrasp.java b/Mage.Sets/src/mage/cards/p/PraetorsGrasp.java index 8539ab821a2..6f2f741fe95 100644 --- a/Mage.Sets/src/mage/cards/p/PraetorsGrasp.java +++ b/Mage.Sets/src/mage/cards/p/PraetorsGrasp.java @@ -77,8 +77,7 @@ class PraetorsGraspEffect extends OneShotEffect { && exileId != null) { game.informPlayers(controller.getLogName() + " moves the searched " + "card face down to exile"); - card.moveToExile(exileId, sourceObject.getIdName(), - source.getSourceId(), game); + card.moveToExile(exileId, sourceObject.getIdName(), source, game); card.setFaceDown(true, game); game.addEffect(new PraetorsGraspPlayEffect(card.getId()), source); game.addEffect(new PraetorsGraspRevealEffect(card.getId()), source); diff --git a/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java b/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java index 8ed229abe34..7fdb9d04129 100644 --- a/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java +++ b/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java @@ -58,7 +58,7 @@ class PrecipiceOfMortisEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.NUMBER_OF_TRIGGERS; + return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS; } @Override @@ -69,7 +69,7 @@ class PrecipiceOfMortisEffect extends ReplacementEffectImpl { if (source.isControlledBy(event.getPlayerId())) { GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent(); // enters triggers - if (sourceEvent.getType() == EventType.ENTERS_THE_BATTLEFIELD && sourceEvent instanceof EntersTheBattlefieldEvent) { + if (sourceEvent.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && sourceEvent instanceof EntersTheBattlefieldEvent) { EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) sourceEvent; // Only for entering Jedis if (entersTheBattlefieldEvent.getTarget().hasSubtype(SubType.JEDI, game)) { @@ -80,7 +80,7 @@ class PrecipiceOfMortisEffect extends ReplacementEffectImpl { } } // leaves triggers - if (sourceEvent.getType() == EventType.ZONE_CHANGE && sourceEvent instanceof ZoneChangeEvent) { + if (sourceEvent.getType() == GameEvent.EventType.ZONE_CHANGE && sourceEvent instanceof ZoneChangeEvent) { ZoneChangeEvent leavesTheBattlefieldEvent = (ZoneChangeEvent) sourceEvent; if (leavesTheBattlefieldEvent.getFromZone() == Zone.BATTLEFIELD) { // Only for leaving Jedis diff --git a/Mage.Sets/src/mage/cards/p/Precognition.java b/Mage.Sets/src/mage/cards/p/Precognition.java index 34a82e70a75..ca4acf491fc 100644 --- a/Mage.Sets/src/mage/cards/p/Precognition.java +++ b/Mage.Sets/src/mage/cards/p/Precognition.java @@ -71,7 +71,7 @@ class PrecognitionEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controller.lookAtCards("Precognition", cards, game); if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", source, game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, false, false); } else { game.informPlayers(controller.getLogName() + " puts the card back on top of the library."); } diff --git a/Mage.Sets/src/mage/cards/p/PrecognitivePerception.java b/Mage.Sets/src/mage/cards/p/PrecognitivePerception.java index d6c07ab8a8d..2a9c968cc66 100644 --- a/Mage.Sets/src/mage/cards/p/PrecognitivePerception.java +++ b/Mage.Sets/src/mage/cards/p/PrecognitivePerception.java @@ -62,7 +62,7 @@ class PrecognitivePerceptionEffect extends OneShotEffect { if (AddendumCondition.instance.apply(game, source)) { controller.scry(3, source, game); } - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/p/PrecursorGolem.java b/Mage.Sets/src/mage/cards/p/PrecursorGolem.java index 130321b90dc..4b515974be4 100644 --- a/Mage.Sets/src/mage/cards/p/PrecursorGolem.java +++ b/Mage.Sets/src/mage/cards/p/PrecursorGolem.java @@ -71,7 +71,7 @@ class PrecursorGolemCopyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Predict.java b/Mage.Sets/src/mage/cards/p/Predict.java index d53aa652fd6..e7ab854df33 100644 --- a/Mage.Sets/src/mage/cards/p/Predict.java +++ b/Mage.Sets/src/mage/cards/p/Predict.java @@ -71,7 +71,7 @@ class PredictEffect extends OneShotEffect { break; } } - controller.drawCards(toDraw, source.getSourceId(), game); + controller.drawCards(toDraw, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java b/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java index 421c4d5ca14..f893943cf39 100644 --- a/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java +++ b/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java @@ -70,7 +70,7 @@ class PreeminentCaptainEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); TargetCardInHand target = new TargetCardInHand(filter); - if (controller != null && target.canChoose(controller.getId(), game) + if (controller != null && target.canChoose(source.getSourceId(), controller.getId(), game) && target.choose(outcome, controller.getId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { UUID cardId = target.getFirstTarget(); diff --git a/Mage.Sets/src/mage/cards/p/PresenceOfTheMaster.java b/Mage.Sets/src/mage/cards/p/PresenceOfTheMaster.java index d94239d6ab1..66638418250 100644 --- a/Mage.Sets/src/mage/cards/p/PresenceOfTheMaster.java +++ b/Mage.Sets/src/mage/cards/p/PresenceOfTheMaster.java @@ -97,7 +97,7 @@ class CounterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - return game.getStack().counter(this.getTargetPointer().getFirst(game, source), source.getSourceId(), game); + return game.getStack().counter(this.getTargetPointer().getFirst(game, source), source, game); } } diff --git a/Mage.Sets/src/mage/cards/p/PretendersClaim.java b/Mage.Sets/src/mage/cards/p/PretendersClaim.java index 5d4a4126585..e44e244b5db 100644 --- a/Mage.Sets/src/mage/cards/p/PretendersClaim.java +++ b/Mage.Sets/src/mage/cards/p/PretendersClaim.java @@ -72,7 +72,7 @@ class TapDefendingPlayerLandEffect extends OneShotEffect { if (defendingPlayer != null) { List permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, defendingPlayer.getId(), game); for (Permanent land : permanents) { - land.tap(game); + land.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PriceOfBetrayal.java b/Mage.Sets/src/mage/cards/p/PriceOfBetrayal.java index 2d9fb9c9b9c..9897e9400a9 100644 --- a/Mage.Sets/src/mage/cards/p/PriceOfBetrayal.java +++ b/Mage.Sets/src/mage/cards/p/PriceOfBetrayal.java @@ -84,13 +84,13 @@ class PriceOfBetrayalEffect extends OneShotEffect { for (String counterName : counterNames) { if (controller.chooseUse(Outcome.Neutral, "Do you want to remove " + counterName + " counters?", source, game)) { if (permanent.getCounters(game).get(counterName).getCount() == 1 || (toRemove - removed == 1)) { - permanent.removeCounters(counterName, 1, game); + permanent.removeCounters(counterName, 1, source, game); removed++; } else { int amount = controller.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game); if (amount > 0) { removed += amount; - permanent.removeCounters(counterName, amount, game); + permanent.removeCounters(counterName, amount, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/p/PriceOfGlory.java b/Mage.Sets/src/mage/cards/p/PriceOfGlory.java index fdefba02af0..7c6e6cc020a 100644 --- a/Mage.Sets/src/mage/cards/p/PriceOfGlory.java +++ b/Mage.Sets/src/mage/cards/p/PriceOfGlory.java @@ -52,8 +52,10 @@ class PriceOfGloryAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA - && !game.inCheckPlayableState(); + if (game.inCheckPlayableState()) { + return false; + } + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override @@ -99,7 +101,7 @@ class PriceOfGloryEffect extends OneShotEffect { if (controller != null) { Permanent land = game.getPermanent(getTargetPointer().getFirst(game, source)); if (land != null && !land.isControlledBy(game.getActivePlayerId())) { // intervening if clause has to be checked again - land.destroy(source.getSourceId(), game, false); + land.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PriceOfKnowledge.java b/Mage.Sets/src/mage/cards/p/PriceOfKnowledge.java index 9849ec51f9f..271fad89936 100644 --- a/Mage.Sets/src/mage/cards/p/PriceOfKnowledge.java +++ b/Mage.Sets/src/mage/cards/p/PriceOfKnowledge.java @@ -60,7 +60,7 @@ class PriceOfKnowledgeEffect extends OneShotEffect { if (targetPlayer != null) { int xValue = targetPlayer.getHand().size(); if (xValue > 0) { - targetPlayer.damage(xValue, source.getSourceId(), game); + targetPlayer.damage(xValue, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PriceOfProgress.java b/Mage.Sets/src/mage/cards/p/PriceOfProgress.java index f7e3d07e6ad..340091e4dcb 100644 --- a/Mage.Sets/src/mage/cards/p/PriceOfProgress.java +++ b/Mage.Sets/src/mage/cards/p/PriceOfProgress.java @@ -62,7 +62,7 @@ class PriceOfProgressEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount * 2, source.getSourceId(), game); + player.damage(amount * 2, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/p/PrimalAmulet.java b/Mage.Sets/src/mage/cards/p/PrimalAmulet.java index 390e8f55efc..574517de958 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalAmulet.java +++ b/Mage.Sets/src/mage/cards/p/PrimalAmulet.java @@ -86,7 +86,7 @@ class PrimalAmuletEffect extends OneShotEffect { permanent.addCounters(CounterType.CHARGE.createInstance(), source, game); int counters = permanent.getCounters(game).getCount(CounterType.CHARGE); if (counters > 3 && player.chooseUse(Outcome.Benefit, "Transform this?", source, game)) { - permanent.removeCounters("charge", counters, game); + permanent.removeCounters("charge", counters, source, game); new TransformSourceEffect(true).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/p/PrimalClay.java b/Mage.Sets/src/mage/cards/p/PrimalClay.java index 954a8d6cf90..584565a774d 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalClay.java +++ b/Mage.Sets/src/mage/cards/p/PrimalClay.java @@ -68,7 +68,7 @@ public final class PrimalClay extends CardImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PrimalCocoon.java b/Mage.Sets/src/mage/cards/p/PrimalCocoon.java index ce72ec0c92c..3f212e368b3 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalCocoon.java +++ b/Mage.Sets/src/mage/cards/p/PrimalCocoon.java @@ -70,7 +70,7 @@ class PrimalCocoonAbility1 extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -101,7 +101,7 @@ class PrimalCocoonAbility2 extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED || event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PrimalCommand.java b/Mage.Sets/src/mage/cards/p/PrimalCommand.java index ef4df802f1c..d4e84a71ce4 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalCommand.java +++ b/Mage.Sets/src/mage/cards/p/PrimalCommand.java @@ -93,7 +93,7 @@ class PrimalCommandShuffleGraveyardEffect extends OneShotEffect { Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { for (Card card : player.getGraveyard().getCards(game)) { - player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + player.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/p/PrimalEmpathy.java b/Mage.Sets/src/mage/cards/p/PrimalEmpathy.java index a295e4793b4..79ffdd75766 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalEmpathy.java +++ b/Mage.Sets/src/mage/cards/p/PrimalEmpathy.java @@ -83,7 +83,7 @@ class PrimalEmpathyEffect extends OneShotEffect { .mapToInt(MageInt::getValue) .anyMatch(i -> i >= highestPower); if (flag) { - return player.drawCards(1, source.getSourceId(), game) > 0; + return player.drawCards(1, source, game) > 0; } Target target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); diff --git a/Mage.Sets/src/mage/cards/p/PrimalOrder.java b/Mage.Sets/src/mage/cards/p/PrimalOrder.java index 85d90ac8bc4..0aeab02179a 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalOrder.java +++ b/Mage.Sets/src/mage/cards/p/PrimalOrder.java @@ -60,7 +60,7 @@ class PrimalOrderDamageTargetEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int damage = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game).size(); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PrimalPlasma.java b/Mage.Sets/src/mage/cards/p/PrimalPlasma.java index 7c3f57a5fef..ed86fb6e9eb 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalPlasma.java +++ b/Mage.Sets/src/mage/cards/p/PrimalPlasma.java @@ -69,7 +69,7 @@ public final class PrimalPlasma extends CardImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PrimitiveEtchings.java b/Mage.Sets/src/mage/cards/p/PrimitiveEtchings.java index 630ceaa9e1a..f345237ff05 100644 --- a/Mage.Sets/src/mage/cards/p/PrimitiveEtchings.java +++ b/Mage.Sets/src/mage/cards/p/PrimitiveEtchings.java @@ -59,7 +59,7 @@ class PrimitiveEtchingsAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PrimordialMist.java b/Mage.Sets/src/mage/cards/p/PrimordialMist.java index 891466a29b3..ae6123f0ab3 100644 --- a/Mage.Sets/src/mage/cards/p/PrimordialMist.java +++ b/Mage.Sets/src/mage/cards/p/PrimordialMist.java @@ -83,24 +83,24 @@ class PrimordialMistCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (target.choose(Outcome.Exile, controllerId, sourceId, game)) { - Card card = game.getCard(sourceId); + if (target.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { + Card card = game.getCard(source.getSourceId()); if (card != null) { - Permanent sourcePermanent = game.getPermanent(sourceId); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { Permanent targetPermanent = game.getPermanent(target.getFirstTarget()); Card targetCard = game.getCard(target.getFirstTarget()); if (targetPermanent != null && targetCard != null) { String exileName = sourcePermanent.getIdName() + " "; - controller.moveCardsToExile(targetPermanent, ability, game, true, sourceId, exileName); + controller.moveCardsToExile(targetPermanent, source, game, true, source.getSourceId(), exileName); targetPermanent.setFaceDown(false, game); ContinuousEffect effect = new PrimordialMistCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(targetCard.getId(), targetCard.getZoneChangeCounter(game))); diff --git a/Mage.Sets/src/mage/cards/p/PrimordialOoze.java b/Mage.Sets/src/mage/cards/p/PrimordialOoze.java index 03291433bac..f14f30aac19 100644 --- a/Mage.Sets/src/mage/cards/p/PrimordialOoze.java +++ b/Mage.Sets/src/mage/cards/p/PrimordialOoze.java @@ -71,9 +71,9 @@ class PrimordialOozeEffect extends OneShotEffect { int counter = sourceObject.getCounters(game).getCount(CounterType.P1P1); Cost cost = new ManaCostsImpl<>("{" + counter + '}'); if (!(controller.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " to prevent taking " + counter + " damage from " + sourceObject.getLogName() + "?", source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) { - sourceObject.tap(game); - controller.damage(counter, source.getSourceId(), game); + && cost.pay(source, game, source, controller.getId(), false, null))) { + sourceObject.tap(source, game); + controller.damage(counter, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PrinceOfThralls.java b/Mage.Sets/src/mage/cards/p/PrinceOfThralls.java index 02aabffb076..1ad49d95ac5 100644 --- a/Mage.Sets/src/mage/cards/p/PrinceOfThralls.java +++ b/Mage.Sets/src/mage/cards/p/PrinceOfThralls.java @@ -67,7 +67,7 @@ class PrinceOfThrallsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -120,7 +120,7 @@ class PrinceOfThrallsEffect extends OneShotEffect { PayLifeCost cost = new PayLifeCost(3); if (opponent.chooseUse(Outcome.Neutral, cost.getText() + " or " + card.getLogName() + " comes back into the battlefield under opponents control", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), opponent.getId(), true, null)) { + if (cost.pay(source, game, source, opponent.getId(), true, null)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PrisonTerm.java b/Mage.Sets/src/mage/cards/p/PrisonTerm.java index dd79bea92cb..255152de61e 100644 --- a/Mage.Sets/src/mage/cards/p/PrisonTerm.java +++ b/Mage.Sets/src/mage/cards/p/PrisonTerm.java @@ -87,8 +87,8 @@ class PrisonTermEffect extends OneShotEffect { if (oldCreature == null) { return false; } - if (oldCreature.removeAttachment(prisonTerm.getId(), game)) { - return opponentCreature.addAttachment(prisonTerm.getId(), game); + if (oldCreature.removeAttachment(prisonTerm.getId(), source, game)) { + return opponentCreature.addAttachment(prisonTerm.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/p/ProfaneMemento.java b/Mage.Sets/src/mage/cards/p/ProfaneMemento.java index bc9287d8f7a..9aaae26b6fe 100644 --- a/Mage.Sets/src/mage/cards/p/ProfaneMemento.java +++ b/Mage.Sets/src/mage/cards/p/ProfaneMemento.java @@ -54,7 +54,7 @@ class ProfaneMementoTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java b/Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java index d90d3e5ec8c..30261eef5fc 100644 --- a/Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java +++ b/Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java @@ -76,19 +76,19 @@ class ProfaneTransfusionEffect extends OneShotEffect { if (lifeDifference == 0 || !player1.isLifeTotalCanChange() || !player2.isLifeTotalCanChange()) { - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(1, game, source, source.getControllerId()); } if (lifePlayer1 < lifePlayer2 && (!player1.isCanGainLife() || !player2.isCanLoseLife())) { - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(1, game, source, source.getControllerId()); } if (lifePlayer1 > lifePlayer2 && (!player1.isCanLoseLife() || !player2.isCanGainLife())) { - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(1, game, source, source.getControllerId()); } player1.setLife(lifePlayer2, game, source); player2.setLife(lifePlayer1, game, source); - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(1, game, source, source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/p/Prohibit.java b/Mage.Sets/src/mage/cards/p/Prohibit.java index 07422f4fde9..145b56d9e89 100644 --- a/Mage.Sets/src/mage/cards/p/Prohibit.java +++ b/Mage.Sets/src/mage/cards/p/Prohibit.java @@ -70,7 +70,7 @@ class ProhibitEffect extends OneShotEffect { int cmc = targetSpell.getConvertedManaCost(); if (cmc <= 2 || (KickedCondition.instance.apply(game, source) && cmc <= 4)) { - game.getStack().counter(targetSpell.getId(), source.getSourceId(), game); + game.getStack().counter(targetSpell.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PromiseOfBunrei.java b/Mage.Sets/src/mage/cards/p/PromiseOfBunrei.java index 405a8b896e9..6b28d6a19df 100644 --- a/Mage.Sets/src/mage/cards/p/PromiseOfBunrei.java +++ b/Mage.Sets/src/mage/cards/p/PromiseOfBunrei.java @@ -67,7 +67,7 @@ class PromiseOfBunreiEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { return new CreateTokenEffect(new SpiritToken(), 4).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/p/ProperBurial.java b/Mage.Sets/src/mage/cards/p/ProperBurial.java index 53b6feb9d28..de7a09279c6 100644 --- a/Mage.Sets/src/mage/cards/p/ProperBurial.java +++ b/Mage.Sets/src/mage/cards/p/ProperBurial.java @@ -55,7 +55,7 @@ class ProperBurialTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Prophecy.java b/Mage.Sets/src/mage/cards/p/Prophecy.java index a60f80a8f0b..4fedcbd6bb9 100644 --- a/Mage.Sets/src/mage/cards/p/Prophecy.java +++ b/Mage.Sets/src/mage/cards/p/Prophecy.java @@ -79,7 +79,7 @@ class ProphecyEffect extends OneShotEffect { cards.add(card); targetPlayer.revealCards(sourceObject.getIdName(), cards, game); if (card.isLand()) { - controller.gainLife(1, game, source.getSourceId()); + controller.gainLife(1, game, source); } targetPlayer.shuffleLibrary(source, game); } diff --git a/Mage.Sets/src/mage/cards/p/ProteanHydra.java b/Mage.Sets/src/mage/cards/p/ProteanHydra.java index ad50c030011..c802bb1badd 100644 --- a/Mage.Sets/src/mage/cards/p/ProteanHydra.java +++ b/Mage.Sets/src/mage/cards/p/ProteanHydra.java @@ -71,7 +71,7 @@ public final class ProteanHydra extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override @@ -106,7 +106,7 @@ public final class ProteanHydra extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/ProtectorOfTheCrown.java b/Mage.Sets/src/mage/cards/p/ProtectorOfTheCrown.java index d2ead7df612..37f5104bf9f 100644 --- a/Mage.Sets/src/mage/cards/p/ProtectorOfTheCrown.java +++ b/Mage.Sets/src/mage/cards/p/ProtectorOfTheCrown.java @@ -67,7 +67,7 @@ class ProtectorOfTheCrownEffect extends ReplacementEffectImpl { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + p.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); return true; } return true; diff --git a/Mage.Sets/src/mage/cards/p/ProteusStaff.java b/Mage.Sets/src/mage/cards/p/ProteusStaff.java index 431d83f7502..f09f579acf6 100644 --- a/Mage.Sets/src/mage/cards/p/ProteusStaff.java +++ b/Mage.Sets/src/mage/cards/p/ProteusStaff.java @@ -72,7 +72,7 @@ class ProteusStaffEffect extends OneShotEffect { Player controller = game.getPlayer(permanent.getControllerId()); if (owner != null && controller != null) { // Put target creature on the bottom of its owner's library. - owner.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, false, true); + owner.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, false, true); // That creature's controller reveals cards from the top of their library until they reveal a creature card. Cards cards = new CardsImpl(); @@ -94,7 +94,7 @@ class ProteusStaffEffect extends OneShotEffect { if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); if (card != null) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, false, false); cards.remove(card); } } else { @@ -102,7 +102,7 @@ class ProteusStaffEffect extends OneShotEffect { controller.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, false, false); cards.remove(card); } } diff --git a/Mage.Sets/src/mage/cards/p/PrototypePortal.java b/Mage.Sets/src/mage/cards/p/PrototypePortal.java index 046406a8dab..1085c1a975f 100644 --- a/Mage.Sets/src/mage/cards/p/PrototypePortal.java +++ b/Mage.Sets/src/mage/cards/p/PrototypePortal.java @@ -141,7 +141,7 @@ class PrototypePortalCreateTokenEffect extends OneShotEffect { if (card != null) { EmptyToken token = new EmptyToken(); CardUtil.copyTo(token).from(card); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/Providence.java b/Mage.Sets/src/mage/cards/p/Providence.java index 38e24d49b48..f2724f15ad3 100644 --- a/Mage.Sets/src/mage/cards/p/Providence.java +++ b/Mage.Sets/src/mage/cards/p/Providence.java @@ -55,7 +55,7 @@ class ProvidenceDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/ProwlingPangolin.java b/Mage.Sets/src/mage/cards/p/ProwlingPangolin.java index e6eed743932..c2605633dab 100644 --- a/Mage.Sets/src/mage/cards/p/ProwlingPangolin.java +++ b/Mage.Sets/src/mage/cards/p/ProwlingPangolin.java @@ -69,16 +69,16 @@ class ProwlingPangolinEffect extends OneShotEffect { Cost cost = new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledCreaturePermanent("two creatures"), true)); Player player = game.getPlayer(playerId); if (player != null - && cost.canPay(source, source.getSourceId(), playerId, game) + && cost.canPay(source, source, playerId, game) && player.chooseUse(Outcome.Sacrifice, "Sacrifice two creatures?", source, game) - && cost.pay(source, game, source.getSourceId(), playerId, true, null)) { + && cost.pay(source, game, source, playerId, true, null)) { costPaid = true; } } if (costPaid) { Permanent sourceObject = game.getPermanent(source.getSourceId()); if (sourceObject != null) { - sourceObject.sacrifice(source.getSourceId(), game); + sourceObject.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PryingQuestions.java b/Mage.Sets/src/mage/cards/p/PryingQuestions.java index b1f314c267c..e818c11221e 100644 --- a/Mage.Sets/src/mage/cards/p/PryingQuestions.java +++ b/Mage.Sets/src/mage/cards/p/PryingQuestions.java @@ -67,7 +67,7 @@ class PryingQuestionsEffect extends OneShotEffect { targetOpponent.choose(Outcome.Detriment, target, source.getSourceId(), game); Card card = targetOpponent.getHand().get(target.getFirstTarget(), game); if (card != null) { - targetOpponent.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + targetOpponent.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PsionicBlast.java b/Mage.Sets/src/mage/cards/p/PsionicBlast.java index 0d6bfc7b287..0b54579ec7b 100644 --- a/Mage.Sets/src/mage/cards/p/PsionicBlast.java +++ b/Mage.Sets/src/mage/cards/p/PsionicBlast.java @@ -52,7 +52,7 @@ class PsionicBlastEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PsychicAllergy.java b/Mage.Sets/src/mage/cards/p/PsychicAllergy.java index 7b2fe2cc392..11013e4e59a 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicAllergy.java +++ b/Mage.Sets/src/mage/cards/p/PsychicAllergy.java @@ -80,7 +80,7 @@ class PsychicAllergyEffect extends OneShotEffect { filter.add(new ColorPredicate((ObjectColor) game.getState().getValue(source.getSourceId() + "_color"))); filter.add(Predicates.not(TokenPredicate.instance)); int damage = game.getBattlefield().countAll(filter, player.getId(), game); - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/p/PsychicIntrusion.java b/Mage.Sets/src/mage/cards/p/PsychicIntrusion.java index 251c3056bf3..3f78e74a2a6 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicIntrusion.java +++ b/Mage.Sets/src/mage/cards/p/PsychicIntrusion.java @@ -104,7 +104,7 @@ class PsychicIntrusionExileEffect extends OneShotEffect { if (card != null) { // move card to exile UUID exileId = CardUtil.getCardExileZoneId(game, source); - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, fromHand ? Zone.HAND : Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, fromHand ? Zone.HAND : Zone.GRAVEYARD, true); // allow to cast the card ContinuousEffect effect = new PsychicIntrusionCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); diff --git a/Mage.Sets/src/mage/cards/p/PsychicMiasma.java b/Mage.Sets/src/mage/cards/p/PsychicMiasma.java index 6d6db17db49..fbd9ce630fa 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicMiasma.java +++ b/Mage.Sets/src/mage/cards/p/PsychicMiasma.java @@ -54,7 +54,7 @@ class PsychicMiasmaEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - Card discardedCard = player.discardOne(false, source, game); + Card discardedCard = player.discardOne(false, false, source, game); if (discardedCard != null && discardedCard.isLand()) { Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); if (spellCard != null) { diff --git a/Mage.Sets/src/mage/cards/p/PsychicPossession.java b/Mage.Sets/src/mage/cards/p/PsychicPossession.java index 5321700cbef..96909eaa4f2 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicPossession.java +++ b/Mage.Sets/src/mage/cards/p/PsychicPossession.java @@ -73,7 +73,7 @@ class PsychicPossessionTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PsychicPurge.java b/Mage.Sets/src/mage/cards/p/PsychicPurge.java index b44415b194b..c3852080de5 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicPurge.java +++ b/Mage.Sets/src/mage/cards/p/PsychicPurge.java @@ -63,7 +63,7 @@ class PsychicPurgeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PsychicRebuttal.java b/Mage.Sets/src/mage/cards/p/PsychicRebuttal.java index cb210c26230..08495e50df9 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicRebuttal.java +++ b/Mage.Sets/src/mage/cards/p/PsychicRebuttal.java @@ -78,7 +78,7 @@ class PsychicRebuttalEffect extends OneShotEffect { } Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); if (spell != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); if (SpellMasteryCondition.instance.apply(game, source) && controller.chooseUse(Outcome.PlayForFree, "Copy " + spell.getName() + " (you may choose new targets for the copy)?", source, game)) { diff --git a/Mage.Sets/src/mage/cards/p/PsychicStrike.java b/Mage.Sets/src/mage/cards/p/PsychicStrike.java index 4f185ee2933..0162d43fcca 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicStrike.java +++ b/Mage.Sets/src/mage/cards/p/PsychicStrike.java @@ -59,7 +59,7 @@ class PsychicStrikeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { boolean countered = false; StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source)); - if (game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) { + if (game.getStack().counter(source.getFirstTarget(), source, game)) { countered = true; } if (stackObject != null) { diff --git a/Mage.Sets/src/mage/cards/p/PsychicSurgery.java b/Mage.Sets/src/mage/cards/p/PsychicSurgery.java index 1c21405e4e3..b65547c5dde 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicSurgery.java +++ b/Mage.Sets/src/mage/cards/p/PsychicSurgery.java @@ -61,7 +61,7 @@ class PsychicSurgeryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LIBRARY_SHUFFLED; + return event.getType() == GameEvent.EventType.LIBRARY_SHUFFLED; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PsychicTheft.java b/Mage.Sets/src/mage/cards/p/PsychicTheft.java index 565ecf2dbb7..7802664b780 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicTheft.java +++ b/Mage.Sets/src/mage/cards/p/PsychicTheft.java @@ -86,7 +86,7 @@ class PsychicTheftEffect extends OneShotEffect { } if (chosenCard != null) { - opponent.moveCardToExileWithInfo(chosenCard, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.HAND, true); + opponent.moveCardToExileWithInfo(chosenCard, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.HAND, true); AsThoughEffect effect = new PsychicTheftCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(chosenCard.getId())); diff --git a/Mage.Sets/src/mage/cards/p/PsychicVortex.java b/Mage.Sets/src/mage/cards/p/PsychicVortex.java index 87b86d7e5bd..32e819169cc 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicVortex.java +++ b/Mage.Sets/src/mage/cards/p/PsychicVortex.java @@ -59,10 +59,10 @@ class PsychicVortexCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - controller.drawCards(1, sourceId, game); + controller.drawCards(1, source, game); this.paid = true; return true; } @@ -70,7 +70,7 @@ class PsychicVortexCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); return controller != null && controller.getLibrary().hasCards(); } diff --git a/Mage.Sets/src/mage/cards/p/PsychogenicProbe.java b/Mage.Sets/src/mage/cards/p/PsychogenicProbe.java index 1a267e81fe6..e13eda53806 100644 --- a/Mage.Sets/src/mage/cards/p/PsychogenicProbe.java +++ b/Mage.Sets/src/mage/cards/p/PsychogenicProbe.java @@ -54,7 +54,7 @@ class PsychogenicProbeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LIBRARY_SHUFFLED; + return event.getType() == GameEvent.EventType.LIBRARY_SHUFFLED; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java b/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java index e199220f555..b622d94945d 100644 --- a/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java +++ b/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java @@ -82,15 +82,14 @@ class PulseOfLlanowarReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); - if (mageObject != null && mageObject.isLand()) { - Permanent land = game.getPermanent(event.getSourceId()); - return land != null && filter.match(land, game); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null && permanent.isLand()) { + return filter.match(permanent, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/p/PunishingFire.java b/Mage.Sets/src/mage/cards/p/PunishingFire.java index a42ee248736..e226825a3c0 100644 --- a/Mage.Sets/src/mage/cards/p/PunishingFire.java +++ b/Mage.Sets/src/mage/cards/p/PunishingFire.java @@ -60,7 +60,7 @@ class PunishingFireTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PuppetMaster.java b/Mage.Sets/src/mage/cards/p/PuppetMaster.java index 7f3fa86a860..74b827ad3e7 100644 --- a/Mage.Sets/src/mage/cards/p/PuppetMaster.java +++ b/Mage.Sets/src/mage/cards/p/PuppetMaster.java @@ -74,14 +74,14 @@ class PuppetMasterEffect extends OneShotEffect { if (object instanceof Permanent) { Card card = game.getCard(((Permanent) object).getId()); if (card != null) { - if (card.moveToZone(Zone.HAND, source.getSourceId(), game, false)) { + if (card.moveToZone(Zone.HAND, source, game, false)) { Cost cost = new ManaCostsImpl("{U}{U}{U}"); Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { if (controller.chooseUse(Outcome.Neutral, "Pay " + cost.getText() + " to return " + sourcePermanent.getLogName() + " to its owner's hand?", source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { - sourcePermanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + && cost.pay(source, game, source, controller.getId(), false, null)) { + sourcePermanent.moveToZone(Zone.HAND, source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java b/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java index 080d25a75cf..d0ae0468f2f 100644 --- a/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java +++ b/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java @@ -59,14 +59,14 @@ class PuppetsVerdictEffect extends OneShotEffect { FilterCreaturePermanent filterPower2OrLess = new FilterCreaturePermanent("all creatures power 2 or less"); filterPower2OrLess.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3)); for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filterPower2OrLess, game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } else { FilterCreaturePermanent filterPower3OrGreater = new FilterCreaturePermanent("all creatures power 3 or greater"); filterPower3OrGreater.add(new PowerPredicate(ComparisonType.MORE_THAN, 2)); for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filterPower3OrGreater, game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PureIntentions.java b/Mage.Sets/src/mage/cards/p/PureIntentions.java index df8ff3752bb..8734301b710 100644 --- a/Mage.Sets/src/mage/cards/p/PureIntentions.java +++ b/Mage.Sets/src/mage/cards/p/PureIntentions.java @@ -62,7 +62,7 @@ class PureIntentionsAllTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override @@ -110,7 +110,7 @@ class PureIntentionsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PureReflection.java b/Mage.Sets/src/mage/cards/p/PureReflection.java index 645bc1d8958..e99f84be6b5 100644 --- a/Mage.Sets/src/mage/cards/p/PureReflection.java +++ b/Mage.Sets/src/mage/cards/p/PureReflection.java @@ -69,13 +69,13 @@ public final class PureReflection extends CardImpl { FilterPermanent filter = new FilterPermanent("Reflections"); filter.add(SubType.REFLECTION.getPredicate()); game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).forEach((permanent) -> { - permanent.destroy(source.getSourceId(), game,false); + permanent.destroy(source, game,false); }); game.getState().processAction(game); // Then that player creates an X/X white Reflection creature token, where X is the converted mana cost of that spell. ReflectionPureToken token = new ReflectionPureToken(spell.getConvertedManaCost()); - token.putOntoBattlefield(1, game, source.getSourceId(), spell.getControllerId()); + token.putOntoBattlefield(1, game, source, spell.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/p/PuresightMerrow.java b/Mage.Sets/src/mage/cards/p/PuresightMerrow.java index e8df9abeaec..b9118e817e2 100644 --- a/Mage.Sets/src/mage/cards/p/PuresightMerrow.java +++ b/Mage.Sets/src/mage/cards/p/PuresightMerrow.java @@ -78,7 +78,7 @@ class PuresightMerrowEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controller.lookAtCards("Puresight Merrow", cards, game); if (controller.chooseUse(Outcome.Removal, "Do you wish to exile the card from the top of your library?", source, game)) { - controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.LIBRARY, true); } else { game.informPlayers(controller.getLogName() + " puts the card back on top of their library."); } diff --git a/Mage.Sets/src/mage/cards/p/Purgatory.java b/Mage.Sets/src/mage/cards/p/Purgatory.java index 25818c66db9..299444db283 100644 --- a/Mage.Sets/src/mage/cards/p/Purgatory.java +++ b/Mage.Sets/src/mage/cards/p/Purgatory.java @@ -78,7 +78,7 @@ class PurgatoryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PurgingScythe.java b/Mage.Sets/src/mage/cards/p/PurgingScythe.java index 17b15d25afb..2fa2a529ae2 100644 --- a/Mage.Sets/src/mage/cards/p/PurgingScythe.java +++ b/Mage.Sets/src/mage/cards/p/PurgingScythe.java @@ -93,7 +93,7 @@ class PurgingScytheEffect extends OneShotEffect { } if (permanentToDamage != null) { game.informPlayers(sourcePermanent.getName() + " chosen creature: " + permanentToDamage.getName()); - return permanentToDamage.damage(2, source.getSourceId(), game, false, true) > 0; + return permanentToDamage.damage(2, source.getSourceId(), source, game, false, true) > 0; } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PurphorossIntervention.java b/Mage.Sets/src/mage/cards/p/PurphorossIntervention.java index d69bfc84f2f..2fa4e467944 100644 --- a/Mage.Sets/src/mage/cards/p/PurphorossIntervention.java +++ b/Mage.Sets/src/mage/cards/p/PurphorossIntervention.java @@ -72,7 +72,7 @@ class PurphorossInterventionEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Token token = new PurphorossInterventionToken(source.getManaCostsToPay().getX()); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); token.getLastAddedTokenIds() .stream() .forEach(uuid -> game.addDelayedTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/p/PursuedWhale.java b/Mage.Sets/src/mage/cards/p/PursuedWhale.java index d26a8f02d8c..d3f76cff3ef 100644 --- a/Mage.Sets/src/mage/cards/p/PursuedWhale.java +++ b/Mage.Sets/src/mage/cards/p/PursuedWhale.java @@ -69,7 +69,7 @@ class PursuedWhaleTokenEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (UUID playerId : game.getOpponents(source.getControllerId())) { - token.putOntoBattlefield(1, game, source.getSourceId(), playerId); + token.putOntoBattlefield(1, game, source, playerId); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PursuitOfKnowledge.java b/Mage.Sets/src/mage/cards/p/PursuitOfKnowledge.java index ab791292f40..d81d2596abb 100644 --- a/Mage.Sets/src/mage/cards/p/PursuitOfKnowledge.java +++ b/Mage.Sets/src/mage/cards/p/PursuitOfKnowledge.java @@ -32,6 +32,7 @@ public final class PursuitOfKnowledge extends CardImpl { // If you would draw a card, you may put a study counter on Pursuit of Knowledge instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PursuitOfKnowledgeEffect())); + // Remove three study counters from Pursuit of Knowledge, Sacrifice Pursuit of Knowledge: Draw seven cards. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(7), new RemoveCountersSourceCost(CounterType.STUDY.createInstance(3))); diff --git a/Mage.Sets/src/mage/cards/p/PutridWarrior.java b/Mage.Sets/src/mage/cards/p/PutridWarrior.java index a80e4163de5..fb96b56b4c1 100644 --- a/Mage.Sets/src/mage/cards/p/PutridWarrior.java +++ b/Mage.Sets/src/mage/cards/p/PutridWarrior.java @@ -71,8 +71,8 @@ class PutridWarriorDealsDamageTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER || event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Pyroblast.java b/Mage.Sets/src/mage/cards/p/Pyroblast.java index e65d8908ae8..8d4a695dc06 100644 --- a/Mage.Sets/src/mage/cards/p/Pyroblast.java +++ b/Mage.Sets/src/mage/cards/p/Pyroblast.java @@ -63,7 +63,7 @@ class PyroblastCounterTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Spell targetSpell = game.getStack().getSpell(source.getFirstTarget()); if (targetSpell != null && targetSpell.getColor(game).isBlue()) { - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); } return true; } @@ -94,7 +94,7 @@ class PyroblastDestroyTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget()); if (permanent != null && permanent.getColor(game).isBlue()) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PyromancersAssault.java b/Mage.Sets/src/mage/cards/p/PyromancersAssault.java index f51ade62545..911e2bc90e8 100644 --- a/Mage.Sets/src/mage/cards/p/PyromancersAssault.java +++ b/Mage.Sets/src/mage/cards/p/PyromancersAssault.java @@ -57,7 +57,7 @@ class PyromancersAssaultTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java b/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java index f6f2ec08a5d..d39159cb1c1 100644 --- a/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java +++ b/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java @@ -79,7 +79,7 @@ class PyromancersGogglesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.MANA_PAID; + return event.getType() == GameEvent.EventType.MANA_PAID; } @Override diff --git a/Mage.Sets/src/mage/cards/p/PyrostaticPillar.java b/Mage.Sets/src/mage/cards/p/PyrostaticPillar.java index 943c0dafd72..9f880a7996e 100644 --- a/Mage.Sets/src/mage/cards/p/PyrostaticPillar.java +++ b/Mage.Sets/src/mage/cards/p/PyrostaticPillar.java @@ -58,7 +58,7 @@ class PyrostaticPillarTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/q/QuarryHauler.java b/Mage.Sets/src/mage/cards/q/QuarryHauler.java index f43e6dee4c6..b9a7c23a938 100644 --- a/Mage.Sets/src/mage/cards/q/QuarryHauler.java +++ b/Mage.Sets/src/mage/cards/q/QuarryHauler.java @@ -86,9 +86,9 @@ class QuarryHaulerEffect extends OneShotEffect { } else { counterType = CounterType.findByName(counter.getName()); if (counterType != null) { - permanent.removeCounters(counterType.createInstance(), game); + permanent.removeCounters(counterType.createInstance(), source, game); } else { - permanent.removeCounters(counter.getName(), 1, game); + permanent.removeCounters(counter.getName(), 1, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/q/QuartzwoodCrasher.java b/Mage.Sets/src/mage/cards/q/QuartzwoodCrasher.java index e83513d2237..6d222c63694 100644 --- a/Mage.Sets/src/mage/cards/q/QuartzwoodCrasher.java +++ b/Mage.Sets/src/mage/cards/q/QuartzwoodCrasher.java @@ -120,7 +120,7 @@ class QuartzwoodCrasherEffect extends OneShotEffect { QuartzwoodCrasherWatcher watcher = game.getState().getWatcher(QuartzwoodCrasherWatcher.class); return watcher != null && new DinosaurBeastToken( watcher.getDamage(targetPointer.getFirst(game, source), source.getControllerId()) - ).putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + ).putOntoBattlefield(1, game, source, source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/q/QuestForPureFlame.java b/Mage.Sets/src/mage/cards/q/QuestForPureFlame.java index dac44f71919..e11f82d588a 100644 --- a/Mage.Sets/src/mage/cards/q/QuestForPureFlame.java +++ b/Mage.Sets/src/mage/cards/q/QuestForPureFlame.java @@ -71,7 +71,7 @@ class QuestForPureFlameTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -107,9 +107,9 @@ class QuestForPureFlameEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE - || event.getType() == EventType.DAMAGE_PLAYER - || event.getType() == EventType.DAMAGE_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE + || event.getType() == GameEvent.EventType.DAMAGE_PLAYER + || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/q/QuestForTheHolyRelic.java b/Mage.Sets/src/mage/cards/q/QuestForTheHolyRelic.java index 9cee4d7b57c..cbb764873f4 100644 --- a/Mage.Sets/src/mage/cards/q/QuestForTheHolyRelic.java +++ b/Mage.Sets/src/mage/cards/q/QuestForTheHolyRelic.java @@ -95,7 +95,7 @@ class QuestForTheHolyRelicEffect extends OneShotEffect { Target targetCreature = new TargetControlledCreaturePermanent(); if (equipment != null && controller.choose(Outcome.BoostCreature, targetCreature, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(targetCreature.getFirstTarget()); - permanent.addAttachment(equipment.getId(), game); + permanent.addAttachment(equipment.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/q/QuestForTheNihilStone.java b/Mage.Sets/src/mage/cards/q/QuestForTheNihilStone.java index 779f892af95..c14d44fa246 100644 --- a/Mage.Sets/src/mage/cards/q/QuestForTheNihilStone.java +++ b/Mage.Sets/src/mage/cards/q/QuestForTheNihilStone.java @@ -62,7 +62,7 @@ class QuestForTheNihilStoneTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java b/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java index 3fc788d13ff..51e83890cdf 100644 --- a/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java +++ b/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java @@ -111,7 +111,7 @@ class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/q/Quickling.java b/Mage.Sets/src/mage/cards/q/Quickling.java index 4f409074ec3..c88a6aa5c34 100644 --- a/Mage.Sets/src/mage/cards/q/Quickling.java +++ b/Mage.Sets/src/mage/cards/q/Quickling.java @@ -78,12 +78,12 @@ class QuicklingEffect extends OneShotEffect { if (controller != null) { boolean targetChosen = false; TargetPermanent target = new TargetPermanent(1, 1, filter, true); - if (target.canChoose(controller.getId(), game) && controller.chooseUse(outcome, "Return another creature you control to its owner's hand?", source, game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseUse(outcome, "Return another creature you control to its owner's hand?", source, game)) { controller.chooseTarget(Outcome.ReturnToHand, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { targetChosen = true; - permanent.moveToZone(Zone.HAND, this.getId(), game, false); + permanent.moveToZone(Zone.HAND, source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/q/QuicksilverFountain.java b/Mage.Sets/src/mage/cards/q/QuicksilverFountain.java index f4043c0c5c0..f36ec104332 100644 --- a/Mage.Sets/src/mage/cards/q/QuicksilverFountain.java +++ b/Mage.Sets/src/mage/cards/q/QuicksilverFountain.java @@ -135,8 +135,7 @@ class QuicksilverFountainEffect2 extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent land : game.getBattlefield().getAllActivePermanents(CardType.LAND)) { - land.removeCounters(CounterType.FLOOD.createInstance( - land.getCounters(game).getCount(CounterType.FLOOD)), game); + land.removeCounters(CounterType.FLOOD.createInstance(land.getCounters(game).getCount(CounterType.FLOOD)), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/Rackling.java b/Mage.Sets/src/mage/cards/r/Rackling.java index 6dbfa34bd60..bed4eae7422 100644 --- a/Mage.Sets/src/mage/cards/r/Rackling.java +++ b/Mage.Sets/src/mage/cards/r/Rackling.java @@ -60,7 +60,7 @@ class RacklingEffect extends OneShotEffect { if (player != null) { int damage = 3 - player.getHand().size(); if (damage > 0) { - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RafiqOfTheMany.java b/Mage.Sets/src/mage/cards/r/RafiqOfTheMany.java index 904e443aa4a..8cec4d8cab6 100644 --- a/Mage.Sets/src/mage/cards/r/RafiqOfTheMany.java +++ b/Mage.Sets/src/mage/cards/r/RafiqOfTheMany.java @@ -72,7 +72,7 @@ class RafiqOfTheManyAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RagMan.java b/Mage.Sets/src/mage/cards/r/RagMan.java index 30e89cd39df..22b27304ffc 100644 --- a/Mage.Sets/src/mage/cards/r/RagMan.java +++ b/Mage.Sets/src/mage/cards/r/RagMan.java @@ -83,7 +83,7 @@ class RagManDiscardEffect extends OneShotEffect { if (!creatureCardsInHand.isEmpty()) { Card card = creatureCardsInHand.getRandom(game); - player.discard(card, source, game); + player.discard(card, false, source, game); } diff --git a/Mage.Sets/src/mage/cards/r/RageExtractor.java b/Mage.Sets/src/mage/cards/r/RageExtractor.java index 10bfaa1f765..466e609d2b4 100644 --- a/Mage.Sets/src/mage/cards/r/RageExtractor.java +++ b/Mage.Sets/src/mage/cards/r/RageExtractor.java @@ -56,7 +56,7 @@ class RageExtractorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RageForger.java b/Mage.Sets/src/mage/cards/r/RageForger.java index 9dec24f5fda..fcb83ded9b8 100644 --- a/Mage.Sets/src/mage/cards/r/RageForger.java +++ b/Mage.Sets/src/mage/cards/r/RageForger.java @@ -87,7 +87,7 @@ class RageForgerDamageEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent attackingCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (controller != null && attackingCreature != null) { - game.damagePlayerOrPlaneswalker(source.getFirstTarget(), 1, attackingCreature.getId(), game, false, true); + game.damagePlayerOrPlaneswalker(source.getFirstTarget(), 1, attackingCreature.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/r/RaidBombardment.java b/Mage.Sets/src/mage/cards/r/RaidBombardment.java index 25f1a4d7a1d..d87e5455a27 100644 --- a/Mage.Sets/src/mage/cards/r/RaidBombardment.java +++ b/Mage.Sets/src/mage/cards/r/RaidBombardment.java @@ -54,7 +54,7 @@ class RaidBombardmentTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RaidingParty.java b/Mage.Sets/src/mage/cards/r/RaidingParty.java index 35168604c6e..1a959299bfd 100644 --- a/Mage.Sets/src/mage/cards/r/RaidingParty.java +++ b/Mage.Sets/src/mage/cards/r/RaidingParty.java @@ -107,7 +107,7 @@ class RaidingPartyEffect extends OneShotEffect { for (UUID creatureId : untappedCreatureTarget.getTargets()) { Permanent creature = game.getPermanentOrLKIBattlefield(creatureId); if (creature != null) { - creature.tap(game); + creature.tap(source, game); } } } @@ -127,7 +127,7 @@ class RaidingPartyEffect extends OneShotEffect { } for (Permanent plains : game.getBattlefield().getActivePermanents(filter2, source.getControllerId(), source.getSourceId(), game)) { if (!plainsToSave.contains(plains.getId())) { - plains.destroy(source.getSourceId(), game, false); + plains.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/RainOfDaggers.java b/Mage.Sets/src/mage/cards/r/RainOfDaggers.java index d6cb1e0b290..48b6b131c14 100644 --- a/Mage.Sets/src/mage/cards/r/RainOfDaggers.java +++ b/Mage.Sets/src/mage/cards/r/RainOfDaggers.java @@ -61,7 +61,7 @@ class RainOfDaggersEffect extends OneShotEffect { if (controller != null && getTargetPointer().getFirst(game, source) != null) { int destroyedCreature = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, getTargetPointer().getFirst(game, source), game)) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { destroyedCreature++; } } diff --git a/Mage.Sets/src/mage/cards/r/RainOfGore.java b/Mage.Sets/src/mage/cards/r/RainOfGore.java index 9deeecbaf74..1864d97af6c 100644 --- a/Mage.Sets/src/mage/cards/r/RainOfGore.java +++ b/Mage.Sets/src/mage/cards/r/RainOfGore.java @@ -62,7 +62,7 @@ class RainOfGoreEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { - player.loseLife(event.getAmount(), game, false); + player.loseLife(event.getAmount(), game, source, false); } return true; } @@ -76,9 +76,7 @@ class RainOfGoreEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (!game.getStack().isEmpty()) { StackObject stackObject = game.getStack().getFirst(); - if (stackObject != null) { - return stackObject.isControlledBy(event.getPlayerId()); - } + return stackObject.isControlledBy(event.getPlayerId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/r/RainbowVale.java b/Mage.Sets/src/mage/cards/r/RainbowVale.java index 35e7ad1d9fd..8db55ede691 100644 --- a/Mage.Sets/src/mage/cards/r/RainbowVale.java +++ b/Mage.Sets/src/mage/cards/r/RainbowVale.java @@ -115,7 +115,7 @@ class OpponentGainControlEffect extends ContinuousEffectImpl { Player targetOpponent = game.getPlayer(opponentId); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && targetOpponent != null) { - permanent.changeControllerId(opponentId, game); + permanent.changeControllerId(opponentId, game, source); } else { // no valid target exists, effect can be discarded discard(); diff --git a/Mage.Sets/src/mage/cards/r/RakdosAugermage.java b/Mage.Sets/src/mage/cards/r/RakdosAugermage.java index 459a6c45abf..c4bf272c5db 100644 --- a/Mage.Sets/src/mage/cards/r/RakdosAugermage.java +++ b/Mage.Sets/src/mage/cards/r/RakdosAugermage.java @@ -76,7 +76,7 @@ class RakdosAugermageEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.HAND, new FilterCard()); if (player.choose(Outcome.Benefit, revealedCards, target, game)) { Card card = revealedCards.get(target.getFirstTarget(), game); - return player.discard(card, source, game); + return player.discard(card, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/r/RakdosCharm.java b/Mage.Sets/src/mage/cards/r/RakdosCharm.java index 2881609845a..beaf3868c5a 100644 --- a/Mage.Sets/src/mage/cards/r/RakdosCharm.java +++ b/Mage.Sets/src/mage/cards/r/RakdosCharm.java @@ -71,7 +71,7 @@ public final class RakdosCharm extends CardImpl { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { - controller.damage(1, permanent.getId(), game); + controller.damage(1, permanent.getId(), source, game); game.informPlayers("1 damage to " + controller.getLogName() + " from " + permanent.getName()); } } diff --git a/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java b/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java index b5aae28dc5e..bfec695bda7 100644 --- a/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java +++ b/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java @@ -77,7 +77,7 @@ class RakdosLordOfRiotsCantCastEffect extends ContinuousRuleModifyingEffectImpl @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL; + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RakdosTheShowstopper.java b/Mage.Sets/src/mage/cards/r/RakdosTheShowstopper.java index be9118e141c..89f84c05771 100644 --- a/Mage.Sets/src/mage/cards/r/RakdosTheShowstopper.java +++ b/Mage.Sets/src/mage/cards/r/RakdosTheShowstopper.java @@ -81,7 +81,7 @@ class RakdosTheShowstopperEffect extends OneShotEffect { && !permanent.hasSubtype(SubType.DEVIL, game) && !permanent.hasSubtype(SubType.IMP, game) && !player.flipCoin(source, game, false)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/RakingCanopy.java b/Mage.Sets/src/mage/cards/r/RakingCanopy.java index fc85e3fab73..28b866c81a5 100644 --- a/Mage.Sets/src/mage/cards/r/RakingCanopy.java +++ b/Mage.Sets/src/mage/cards/r/RakingCanopy.java @@ -57,7 +57,7 @@ class RakingCanopyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RakishHeir.java b/Mage.Sets/src/mage/cards/r/RakishHeir.java index a722a6cae78..3e7f2632ce8 100644 --- a/Mage.Sets/src/mage/cards/r/RakishHeir.java +++ b/Mage.Sets/src/mage/cards/r/RakishHeir.java @@ -63,7 +63,7 @@ class RakishHeirTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RallyTheHorde.java b/Mage.Sets/src/mage/cards/r/RallyTheHorde.java index 3c1e8a2fcaf..507a37b4e80 100644 --- a/Mage.Sets/src/mage/cards/r/RallyTheHorde.java +++ b/Mage.Sets/src/mage/cards/r/RallyTheHorde.java @@ -81,7 +81,7 @@ class RallyTheHordeEffect extends OneShotEffect { private int checkIfNextLibCardIsNonLandAndExile(Player controller, Ability source, Game game) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.LIBRARY, true); return card.isLand() ? 0 : 1; } return 0; diff --git a/Mage.Sets/src/mage/cards/r/RamThrough.java b/Mage.Sets/src/mage/cards/r/RamThrough.java index 18f8568f202..ee1eddbab7c 100644 --- a/Mage.Sets/src/mage/cards/r/RamThrough.java +++ b/Mage.Sets/src/mage/cards/r/RamThrough.java @@ -77,17 +77,17 @@ class RamThroughEffect extends OneShotEffect { return false; } if (!myPermanent.getAbilities().containsKey(TrampleAbility.getInstance().getId())) { - return anotherPermanent.damage(power, myPermanent.getId(), game, false, true) > 0; + return anotherPermanent.damage(power, myPermanent.getId(), source, game, false, true) > 0; } int lethal = getLethalDamage(anotherPermanent, game); if (myPermanent.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) { lethal = Math.min(lethal, 1); } lethal = Math.min(lethal, power); - anotherPermanent.damage(lethal, myPermanent.getId(), game); + anotherPermanent.damage(lethal, myPermanent.getId(), source, game); Player player = game.getPlayer(anotherPermanent.getControllerId()); if (player != null && lethal < power) { - player.damage(power - lethal, myPermanent.getId(), game); + player.damage(power - lethal, myPermanent.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RampageOfTheClans.java b/Mage.Sets/src/mage/cards/r/RampageOfTheClans.java index 0d1c4fa05e1..a05dfd1a88f 100644 --- a/Mage.Sets/src/mage/cards/r/RampageOfTheClans.java +++ b/Mage.Sets/src/mage/cards/r/RampageOfTheClans.java @@ -64,13 +64,13 @@ class RampageOfTheClansEffect extends OneShotEffect { source.getControllerId(), source.getSourceId(), game )) { UUID controllerId = p.getControllerId(); - if (p.destroy(source.getSourceId(), game, false)) { + if (p.destroy(source, game, false)) { playersWithPermanents.put(controllerId, playersWithPermanents.getOrDefault(controllerId, 0) + 1); } } Token token = new CentaurToken(); for (Map.Entry amountDestroyedByPlayer : playersWithPermanents.entrySet()) { - token.putOntoBattlefield(amountDestroyedByPlayer.getValue(), game, source.getSourceId(), amountDestroyedByPlayer.getKey()); + token.putOntoBattlefield(amountDestroyedByPlayer.getValue(), game, source, amountDestroyedByPlayer.getKey()); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RangeTrooper.java b/Mage.Sets/src/mage/cards/r/RangeTrooper.java index 39003453770..f70c375c690 100644 --- a/Mage.Sets/src/mage/cards/r/RangeTrooper.java +++ b/Mage.Sets/src/mage/cards/r/RangeTrooper.java @@ -73,7 +73,7 @@ class RangeTrooperEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); MageObject sourceObject = game.getObject(source.getSourceId()); if (permanent != null && sourceObject != null) { - if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source, game)) { Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step"); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game)); diff --git a/Mage.Sets/src/mage/cards/r/RapaciousOne.java b/Mage.Sets/src/mage/cards/r/RapaciousOne.java index 583112e67a1..a8b7e6b2f37 100644 --- a/Mage.Sets/src/mage/cards/r/RapaciousOne.java +++ b/Mage.Sets/src/mage/cards/r/RapaciousOne.java @@ -62,7 +62,7 @@ class RapaciousOneTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RapidHybridization.java b/Mage.Sets/src/mage/cards/r/RapidHybridization.java index 79ed435dee6..274e74bde36 100644 --- a/Mage.Sets/src/mage/cards/r/RapidHybridization.java +++ b/Mage.Sets/src/mage/cards/r/RapidHybridization.java @@ -60,7 +60,7 @@ class RapidHybridizationEffect extends OneShotEffect { Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (permanent != null) { FrogLizardToken token = new FrogLizardToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); + token.putOntoBattlefield(1, game, source, permanent.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RareBGone.java b/Mage.Sets/src/mage/cards/r/RareBGone.java index 5440a478f84..fd75db4c952 100644 --- a/Mage.Sets/src/mage/cards/r/RareBGone.java +++ b/Mage.Sets/src/mage/cards/r/RareBGone.java @@ -74,11 +74,11 @@ class RareBGoneEffect extends OneShotEffect { if (player == null) { } for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterPermanent, playerId, game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } Cards cards = player.getHand(); player.revealCards(source, cards, game); - player.discard(new CardsImpl(cards.getCards(filterCard, game)), source, game); + player.discard(new CardsImpl(cards.getCards(filterCard, game)), false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RasputinDreamweaver.java b/Mage.Sets/src/mage/cards/r/RasputinDreamweaver.java index 2533fb1aebc..7e19f8fa2f9 100644 --- a/Mage.Sets/src/mage/cards/r/RasputinDreamweaver.java +++ b/Mage.Sets/src/mage/cards/r/RasputinDreamweaver.java @@ -112,7 +112,7 @@ class RasputinDreamweaverStartedUntappedWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.BEGINNING_PHASE_PRE) { + if (event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE) { game.getBattlefield().getAllActivePermanents(filter, game).forEach(permanent -> startedUntapped.add(permanent.getId())); } } diff --git a/Mage.Sets/src/mage/cards/r/RatchetBomb.java b/Mage.Sets/src/mage/cards/r/RatchetBomb.java index b552045d290..ae3598d4979 100644 --- a/Mage.Sets/src/mage/cards/r/RatchetBomb.java +++ b/Mage.Sets/src/mage/cards/r/RatchetBomb.java @@ -69,7 +69,7 @@ public final class RatchetBomb extends CardImpl { int count = p.getCounters(game).getCount(CounterType.CHARGE); for (Permanent perm: game.getBattlefield().getAllActivePermanents()) { if (perm.getConvertedManaCost() == count && !(perm.isLand())) { - perm.destroy(source.getSourceId(), game, false); + perm.destroy(source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java b/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java index c64031eef9a..7a2f390e5f7 100644 --- a/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java +++ b/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java @@ -136,10 +136,10 @@ class RavagerOfTheFellsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), 2, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), 2, source.getSourceId(), source, game, false, true); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { - creature.damage(2, source.getSourceId(), game, false, true); + creature.damage(2, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RavenousGigantotherium.java b/Mage.Sets/src/mage/cards/r/RavenousGigantotherium.java index 53bc169dc80..e861033b416 100644 --- a/Mage.Sets/src/mage/cards/r/RavenousGigantotherium.java +++ b/Mage.Sets/src/mage/cards/r/RavenousGigantotherium.java @@ -127,7 +127,7 @@ class RavenousGigantotheriumEffect extends OneShotEffect { .filter(Objects::nonNull) .collect(Collectors.toList()); for (Permanent permanent : permanentList) { - sourcePerm.damage(permanent.getPower().getValue(), permanent.getId(), game); + sourcePerm.damage(permanent.getPower().getValue(), permanent.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RavenousWampa.java b/Mage.Sets/src/mage/cards/r/RavenousWampa.java index 63e1cc69fbd..5ce55801745 100644 --- a/Mage.Sets/src/mage/cards/r/RavenousWampa.java +++ b/Mage.Sets/src/mage/cards/r/RavenousWampa.java @@ -97,13 +97,13 @@ class RavenousWampaSacrificeTargetCost extends SacrificeTargetCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - boolean result = super.pay(ability, game, sourceId, controllerId, noMana, costToPay); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + boolean result = super.pay(ability, game, source, controllerId, noMana, costToPay); if (paid && !getPermanents().isEmpty()) { Permanent sacrificedPermanen = getPermanents().get(0); - Permanent sourcePermanent = game.getPermanent(sourceId); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null && sacrificedPermanen != null) { - game.getState().setValue(RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX + sourceId + sourcePermanent.getZoneChangeCounter(game), sacrificedPermanen.getToughness().getValue()); + game.getState().setValue(RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX + source.getSourceId() + sourcePermanent.getZoneChangeCounter(game), sacrificedPermanen.getToughness().getValue()); } } return result; diff --git a/Mage.Sets/src/mage/cards/r/RavingDead.java b/Mage.Sets/src/mage/cards/r/RavingDead.java index 91bbe0ec56d..aa902068db3 100644 --- a/Mage.Sets/src/mage/cards/r/RavingDead.java +++ b/Mage.Sets/src/mage/cards/r/RavingDead.java @@ -71,7 +71,7 @@ class RavingDeadDamageEffect extends OneShotEffect { if (player != null) { Integer amount = player.getLife() / 2; if (amount > 0) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RavingOniSlave.java b/Mage.Sets/src/mage/cards/r/RavingOniSlave.java index a96a0132859..5656c0c8d5d 100644 --- a/Mage.Sets/src/mage/cards/r/RavingOniSlave.java +++ b/Mage.Sets/src/mage/cards/r/RavingOniSlave.java @@ -64,7 +64,7 @@ class RavingOniSlaveEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (game.getBattlefield().count(new FilterCreaturePermanent(SubType.DEMON, "Demon"), source.getSourceId(), source.getControllerId(), game) < 1) { - controller.loseLife(3, game, false); + controller.loseLife(3, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RayOfCommand.java b/Mage.Sets/src/mage/cards/r/RayOfCommand.java index f70f0b5f9dc..c02cf8e2533 100644 --- a/Mage.Sets/src/mage/cards/r/RayOfCommand.java +++ b/Mage.Sets/src/mage/cards/r/RayOfCommand.java @@ -67,7 +67,7 @@ class RayOfCommandDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_CONTROL; + return event.getType() == GameEvent.EventType.LOST_CONTROL; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RayneAcademyChancellor.java b/Mage.Sets/src/mage/cards/r/RayneAcademyChancellor.java index b20a2e3d949..d347a52331d 100644 --- a/Mage.Sets/src/mage/cards/r/RayneAcademyChancellor.java +++ b/Mage.Sets/src/mage/cards/r/RayneAcademyChancellor.java @@ -65,7 +65,7 @@ class RayneAcademyChancellorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RaziasPurification.java b/Mage.Sets/src/mage/cards/r/RaziasPurification.java index 8cce688db40..62c63bc81e3 100644 --- a/Mage.Sets/src/mage/cards/r/RaziasPurification.java +++ b/Mage.Sets/src/mage/cards/r/RaziasPurification.java @@ -61,9 +61,9 @@ class RaziasPurificationEffect extends OneShotEffect { Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledPermanent(), true); - if (player != null && target1.canChoose(player.getId(), game)) { + if (player != null && target1.canChoose(source.getSourceId(), player.getId(), game)) { int chosenPermanents = 0; - while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game) && chosenPermanents < 3) { + while (player.canRespond() && !target1.isChosen() && target1.canChoose(source.getSourceId(), player.getId(), game) && chosenPermanents < 3) { player.chooseTarget(Outcome.Benefit, target1, source, game); for (UUID targetId : target1.getTargets()) { Permanent p = game.getPermanent(targetId); @@ -79,7 +79,7 @@ class RaziasPurificationEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (!chosen.contains(permanent)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/RazorBoomerang.java b/Mage.Sets/src/mage/cards/r/RazorBoomerang.java index bde95d286c3..25644f57186 100644 --- a/Mage.Sets/src/mage/cards/r/RazorBoomerang.java +++ b/Mage.Sets/src/mage/cards/r/RazorBoomerang.java @@ -81,10 +81,10 @@ class RazorBoomerangEffect extends OneShotEffect { if (targetedPermanent == null) { Player targetedPlayer = game.getPlayer(source.getFirstTarget()); if (targetedPlayer != null) { - targetedPlayer.damage(1, permanent.getId(), game); + targetedPlayer.damage(1, permanent.getId(), source, game); } } else { - targetedPermanent.damage(1, permanent.getId(), game); + targetedPermanent.damage(1, permanent.getId(), source, game); } return player.moveCards(permanent, Zone.HAND, source, game); } diff --git a/Mage.Sets/src/mage/cards/r/RazorPendulum.java b/Mage.Sets/src/mage/cards/r/RazorPendulum.java index 0c5d1f71514..3d506e54033 100644 --- a/Mage.Sets/src/mage/cards/r/RazorPendulum.java +++ b/Mage.Sets/src/mage/cards/r/RazorPendulum.java @@ -64,7 +64,7 @@ class RazorPendulumEffect extends OneShotEffect { if (player == null) { return false; } - return player.damage(2, source.getSourceId(), game) > 0; + return player.damage(2, source.getSourceId(), source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/r/ReadTheRunes.java b/Mage.Sets/src/mage/cards/r/ReadTheRunes.java index ed406a3715a..dfbcbf6a4fa 100644 --- a/Mage.Sets/src/mage/cards/r/ReadTheRunes.java +++ b/Mage.Sets/src/mage/cards/r/ReadTheRunes.java @@ -59,19 +59,19 @@ class ReadTheRunesEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int drawnCards = controller.drawCards(source.getManaCostsToPay().getX(), source.getSourceId(), game); + int drawnCards = controller.drawCards(source.getManaCostsToPay().getX(), source, game); Target target = new TargetControlledPermanent(0, drawnCards, new FilterControlledPermanent(), true); controller.chooseTarget(Outcome.Sacrifice, target, source, game); int sacrificedPermanents = 0; for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { sacrificedPermanents++; } } } - controller.discard(drawnCards - sacrificedPermanents, false, source, game); + controller.discard(drawnCards - sacrificedPermanents, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/r/RealitySmasher.java b/Mage.Sets/src/mage/cards/r/RealitySmasher.java index 706af59e41f..879409caa2e 100644 --- a/Mage.Sets/src/mage/cards/r/RealitySmasher.java +++ b/Mage.Sets/src/mage/cards/r/RealitySmasher.java @@ -67,7 +67,7 @@ class RealitySmasherTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RealitySpasm.java b/Mage.Sets/src/mage/cards/r/RealitySpasm.java index 3d016b3fd9f..61e4401266f 100644 --- a/Mage.Sets/src/mage/cards/r/RealitySpasm.java +++ b/Mage.Sets/src/mage/cards/r/RealitySpasm.java @@ -60,13 +60,13 @@ class RealitySpasmTapEffect extends OneShotEffect { int numberToTap = source.getManaCostsToPay().getX(); numberToTap = Math.min(game.getBattlefield().getAllActivePermanents().size(), numberToTap); TargetPermanent target = new TargetPermanent(numberToTap, filter); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { List targets = target.getTargets(); for (UUID targetId : targets) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } } } @@ -100,7 +100,7 @@ class RealitySpasmUntapEffect extends OneShotEffect { int numberToTap = source.getManaCostsToPay().getX(); numberToTap = Math.min(game.getBattlefield().getAllActivePermanents().size(), numberToTap); TargetPermanent target = new TargetPermanent(numberToTap, filter); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Untap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Untap, source.getControllerId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { List targets = target.getTargets(); for (UUID targetId : targets) { diff --git a/Mage.Sets/src/mage/cards/r/RealityTwist.java b/Mage.Sets/src/mage/cards/r/RealityTwist.java index dfdae1bcd77..33c7a053dde 100644 --- a/Mage.Sets/src/mage/cards/r/RealityTwist.java +++ b/Mage.Sets/src/mage/cards/r/RealityTwist.java @@ -123,7 +123,7 @@ class RealityTwistEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanent(event.getSourceId()); + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); return permanent != null && (permanent.hasSubtype(SubType.PLAINS, game) || permanent.hasSubtype(SubType.SWAMP, game) diff --git a/Mage.Sets/src/mage/cards/r/RealmRazer.java b/Mage.Sets/src/mage/cards/r/RealmRazer.java index 84f8597b07b..ea7f13d6b6a 100644 --- a/Mage.Sets/src/mage/cards/r/RealmRazer.java +++ b/Mage.Sets/src/mage/cards/r/RealmRazer.java @@ -69,7 +69,7 @@ class ExileAllEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.moveToExile(source.getSourceId(), "Realm Razer", source.getSourceId(), game); + permanent.moveToExile(source.getSourceId(), "Realm Razer", source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/ReapIntellect.java b/Mage.Sets/src/mage/cards/r/ReapIntellect.java index b9f13f7281c..5970c0751e8 100644 --- a/Mage.Sets/src/mage/cards/r/ReapIntellect.java +++ b/Mage.Sets/src/mage/cards/r/ReapIntellect.java @@ -89,7 +89,7 @@ class ReapIntellectEffect extends OneShotEffect { for (UUID cardId : target.getTargets()) { Card chosenCard = game.getCard(cardId); if (chosenCard != null) { - controller.moveCardToExileWithInfo(chosenCard, null, "", source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(chosenCard, null, "", source, game, Zone.HAND, true); exiledCards.add(chosenCard); } } @@ -118,7 +118,7 @@ class ReapIntellectEffect extends OneShotEffect { for (UUID cardId : targetCardsGraveyard.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); } } @@ -128,7 +128,7 @@ class ReapIntellectEffect extends OneShotEffect { for (UUID cardId : targetCardsHand.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.HAND, true); } } @@ -138,7 +138,7 @@ class ReapIntellectEffect extends OneShotEffect { for (UUID cardId : targetCardsLibrary.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.LIBRARY, true); } } diff --git a/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java b/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java index dfa2962adbb..722cecc35d5 100644 --- a/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java +++ b/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java @@ -75,7 +75,7 @@ class ReaperFromTheAbyssAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/ReaperOfSheoldred.java b/Mage.Sets/src/mage/cards/r/ReaperOfSheoldred.java index 11f9d14817e..caef95c04c0 100644 --- a/Mage.Sets/src/mage/cards/r/ReaperOfSheoldred.java +++ b/Mage.Sets/src/mage/cards/r/ReaperOfSheoldred.java @@ -66,7 +66,7 @@ class ReaperOfSheoldredTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/Recall.java b/Mage.Sets/src/mage/cards/r/Recall.java index 0037d066afb..4106e15285a 100644 --- a/Mage.Sets/src/mage/cards/r/Recall.java +++ b/Mage.Sets/src/mage/cards/r/Recall.java @@ -63,7 +63,7 @@ class RecallEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { // Discard X cards - Cards cardsDiscarded = controller.discard(source.getManaCostsToPay().getX(), false, source, game); + Cards cardsDiscarded = controller.discard(source.getManaCostsToPay().getX(), false, false, source, game); if (!cardsDiscarded.isEmpty()) { // then return a card from your graveyard to your hand for each card discarded this way TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(cardsDiscarded.size(), new FilterCard()); diff --git a/Mage.Sets/src/mage/cards/r/Recoil.java b/Mage.Sets/src/mage/cards/r/Recoil.java index ed04daf10cd..ed266eee2c2 100644 --- a/Mage.Sets/src/mage/cards/r/Recoil.java +++ b/Mage.Sets/src/mage/cards/r/Recoil.java @@ -64,7 +64,7 @@ class RecoilEffect extends OneShotEffect { Player controller = game.getPlayer(target.getControllerId()); if (controller != null) { controller.moveCards(target, Zone.HAND, source, game); - controller.discard(1, false, source, game); + controller.discard(1, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/r/RecurringInsight.java b/Mage.Sets/src/mage/cards/r/RecurringInsight.java index adb29672126..7170c3e0f68 100644 --- a/Mage.Sets/src/mage/cards/r/RecurringInsight.java +++ b/Mage.Sets/src/mage/cards/r/RecurringInsight.java @@ -57,7 +57,7 @@ class RecurringInsightEffect extends OneShotEffect { if (controller != null) { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); if (opponent != null) { - controller.drawCards(opponent.getHand().size(), source.getSourceId(), game); + controller.drawCards(opponent.getHand().size(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/Recycle.java b/Mage.Sets/src/mage/cards/r/Recycle.java index 9622807d25b..046966890ea 100644 --- a/Mage.Sets/src/mage/cards/r/Recycle.java +++ b/Mage.Sets/src/mage/cards/r/Recycle.java @@ -63,7 +63,7 @@ class RecycleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST || event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RedcapMelee.java b/Mage.Sets/src/mage/cards/r/RedcapMelee.java index bad15206c2a..c1d51991892 100644 --- a/Mage.Sets/src/mage/cards/r/RedcapMelee.java +++ b/Mage.Sets/src/mage/cards/r/RedcapMelee.java @@ -64,7 +64,7 @@ class RedcapMeleeEffect extends OneShotEffect { return false; } boolean isRed = permanent.getColor(game).isRed(); - if (permanent.damage(4, source.getSourceId(), game) > 0 && !isRed) { + if (permanent.damage(4, source.getSourceId(), source, game) > 0 && !isRed) { return effect.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/r/RefractionTrap.java b/Mage.Sets/src/mage/cards/r/RefractionTrap.java index 0c05f22d29f..8f136f2f61b 100644 --- a/Mage.Sets/src/mage/cards/r/RefractionTrap.java +++ b/Mage.Sets/src/mage/cards/r/RefractionTrap.java @@ -125,12 +125,12 @@ class RefractionTrapPreventDamageEffect extends PreventionEffectImpl { Permanent permanent = game.getPermanent(damageTarget); if (permanent != null) { game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + permanent.getLogName()); - permanent.damage(preventionData.getPreventedDamage(), source.getSourceId(), game, false, true); + permanent.damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game, false, true); } Player player = game.getPlayer(damageTarget); if (player != null) { game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + player.getLogName()); - player.damage(preventionData.getPreventedDamage(), source.getSourceId(), game); + player.damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/r/RefuseCooperate.java b/Mage.Sets/src/mage/cards/r/RefuseCooperate.java index acd6e1353ca..fe90e5d5297 100644 --- a/Mage.Sets/src/mage/cards/r/RefuseCooperate.java +++ b/Mage.Sets/src/mage/cards/r/RefuseCooperate.java @@ -72,7 +72,7 @@ class RefuseEffect extends OneShotEffect { if (spell != null) { Player spellController = game.getPlayer(spell.getControllerId()); if (spellController != null) { - spellController.damage(spell.getConvertedManaCost(), source.getSourceId(), game); + spellController.damage(spell.getConvertedManaCost(), source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/r/ReignOfTerror.java b/Mage.Sets/src/mage/cards/r/ReignOfTerror.java index c19cb0cd468..71499a45ea4 100644 --- a/Mage.Sets/src/mage/cards/r/ReignOfTerror.java +++ b/Mage.Sets/src/mage/cards/r/ReignOfTerror.java @@ -75,8 +75,8 @@ class ReignOfTerrorEffect extends OneShotEffect { int died = game.getBattlefield() .getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game) .stream() - .mapToInt(permanent -> permanent.destroy(source.getSourceId(), game, true) ? 1 : 0) + .mapToInt(permanent -> permanent.destroy(source, game, true) ? 1 : 0) .sum(); - return player.loseLife(2 * died, game, false) > 0; + return player.loseLife(2 * died, game, source, false) > 0; } } diff --git a/Mage.Sets/src/mage/cards/r/ReignOfThePit.java b/Mage.Sets/src/mage/cards/r/ReignOfThePit.java index 2d4a6e8e973..a67c6111d46 100644 --- a/Mage.Sets/src/mage/cards/r/ReignOfThePit.java +++ b/Mage.Sets/src/mage/cards/r/ReignOfThePit.java @@ -69,7 +69,7 @@ class ReignOfThePitEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { while (!target.isChosen() && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } @@ -81,7 +81,7 @@ class ReignOfThePitEffect extends OneShotEffect { Permanent permanent = game.getPermanent(permID); if (permanent != null) { int power = permanent.getPower().getValue(); - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { totalPowerSacrificed += power; } } diff --git a/Mage.Sets/src/mage/cards/r/Reincarnation.java b/Mage.Sets/src/mage/cards/r/Reincarnation.java index 470183dfa44..bb3d9d9a8b9 100644 --- a/Mage.Sets/src/mage/cards/r/Reincarnation.java +++ b/Mage.Sets/src/mage/cards/r/Reincarnation.java @@ -88,7 +88,7 @@ class ReincarnationDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/ReinsOfTheVinesteed.java b/Mage.Sets/src/mage/cards/r/ReinsOfTheVinesteed.java index e0864264745..2ba74f15aad 100644 --- a/Mage.Sets/src/mage/cards/r/ReinsOfTheVinesteed.java +++ b/Mage.Sets/src/mage/cards/r/ReinsOfTheVinesteed.java @@ -96,10 +96,10 @@ class ReinsOfTheVinesteedEffect extends OneShotEffect { if (controller != null && controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { Permanent targetPermanent = game.getPermanent(target.getFirstTarget()); - if (!targetPermanent.cantBeAttachedBy(aura, game, false)) { + if (!targetPermanent.cantBeAttachedBy(aura, source, game, false)) { game.getState().setValue("attachTo:" + aura.getId(), targetPermanent); controller.moveCards(aura, Zone.BATTLEFIELD, source, game); - return targetPermanent.addAttachment(aura.getId(), game); + return targetPermanent.addAttachment(aura.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/r/RelicOfProgenitus.java b/Mage.Sets/src/mage/cards/r/RelicOfProgenitus.java index 72d7fa26847..67ac5614166 100644 --- a/Mage.Sets/src/mage/cards/r/RelicOfProgenitus.java +++ b/Mage.Sets/src/mage/cards/r/RelicOfProgenitus.java @@ -79,7 +79,7 @@ class RelicOfProgenitusEffect extends OneShotEffect { if (targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - targetPlayer.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + targetPlayer.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RelicPutrescence.java b/Mage.Sets/src/mage/cards/r/RelicPutrescence.java index 5c89bf8d503..6bbbcac401c 100644 --- a/Mage.Sets/src/mage/cards/r/RelicPutrescence.java +++ b/Mage.Sets/src/mage/cards/r/RelicPutrescence.java @@ -68,7 +68,7 @@ class RelicPutrescenceAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED; + return event.getType() == GameEvent.EventType.TAPPED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RemorselessPunishment.java b/Mage.Sets/src/mage/cards/r/RemorselessPunishment.java index fdc99657035..886c6121077 100644 --- a/Mage.Sets/src/mage/cards/r/RemorselessPunishment.java +++ b/Mage.Sets/src/mage/cards/r/RemorselessPunishment.java @@ -76,7 +76,7 @@ class RemorselessPunishmentEffect extends OneShotEffect { private void handleBaseEffect(Game game, Ability source, Player opponent, String iteration) { if (opponent.getHand().size() > 1) { if (opponent.chooseUse(outcome, "Choose your " + iteration + " punishment.", null, "Discard two cards", "Choose another option", source, game)) { - opponent.discard(2, false, source, game); + opponent.discard(2, false, false, source, game); return; } } @@ -87,7 +87,7 @@ class RemorselessPunishmentEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return; @@ -95,6 +95,6 @@ class RemorselessPunishmentEffect extends OneShotEffect { } } - opponent.loseLife(5, game, false); + opponent.loseLife(5, game, source, false); } } diff --git a/Mage.Sets/src/mage/cards/r/RenderSilent.java b/Mage.Sets/src/mage/cards/r/RenderSilent.java index 41c441d74b6..cc30f5f667a 100644 --- a/Mage.Sets/src/mage/cards/r/RenderSilent.java +++ b/Mage.Sets/src/mage/cards/r/RenderSilent.java @@ -72,7 +72,7 @@ class RenderSilentCounterEffect extends OneShotEffect { Spell spell = game.getStack().getSpell(source.getFirstTarget()); if (spell != null) { source.getEffects().get(1).setTargetPointer(new FixedTarget(spell.getControllerId())); - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/r/RendingVines.java b/Mage.Sets/src/mage/cards/r/RendingVines.java index 06cac670eef..fecb7bc19a3 100644 --- a/Mage.Sets/src/mage/cards/r/RendingVines.java +++ b/Mage.Sets/src/mage/cards/r/RendingVines.java @@ -67,7 +67,7 @@ class RendingVinesEffect extends OneShotEffect { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null) { if (permanent.getConvertedManaCost() <= controller.getHand().size()) { - return permanent.destroy(source.getSourceId(), game, false); + return permanent.destroy(source, game, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/r/RenegadeDoppelganger.java b/Mage.Sets/src/mage/cards/r/RenegadeDoppelganger.java index c6cf0e58e18..288443705a0 100644 --- a/Mage.Sets/src/mage/cards/r/RenegadeDoppelganger.java +++ b/Mage.Sets/src/mage/cards/r/RenegadeDoppelganger.java @@ -64,7 +64,7 @@ class RenegadeDoppelgangerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RenegadeKrasis.java b/Mage.Sets/src/mage/cards/r/RenegadeKrasis.java index ab8baf8c1da..062bac28fa6 100644 --- a/Mage.Sets/src/mage/cards/r/RenegadeKrasis.java +++ b/Mage.Sets/src/mage/cards/r/RenegadeKrasis.java @@ -70,7 +70,7 @@ class RenegadeKrasisTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.EVOLVED_CREATURE; + return event.getType() == GameEvent.EventType.EVOLVED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/Renounce.java b/Mage.Sets/src/mage/cards/r/Renounce.java index 1aa1ecd52c2..9bbfd757bbf 100644 --- a/Mage.Sets/src/mage/cards/r/Renounce.java +++ b/Mage.Sets/src/mage/cards/r/Renounce.java @@ -65,7 +65,7 @@ class RenounceEffect extends OneShotEffect { for(UUID uuid : toSacrifice.getTargets()){ Permanent permanent = game.getPermanent(uuid); if(permanent != null){ - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); amount++; } } diff --git a/Mage.Sets/src/mage/cards/r/Reparations.java b/Mage.Sets/src/mage/cards/r/Reparations.java index e909ec6339f..e9fa4cd2c02 100644 --- a/Mage.Sets/src/mage/cards/r/Reparations.java +++ b/Mage.Sets/src/mage/cards/r/Reparations.java @@ -56,7 +56,7 @@ class ReparationsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/r/Repentance.java b/Mage.Sets/src/mage/cards/r/Repentance.java index df854c0166d..9f948e4f0ad 100644 --- a/Mage.Sets/src/mage/cards/r/Repentance.java +++ b/Mage.Sets/src/mage/cards/r/Repentance.java @@ -59,7 +59,7 @@ class RepentanceEffect extends OneShotEffect { if (controller != null) { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(targetCreature.getPower().getValue(), source.getSourceId(), game, false, true); + targetCreature.damage(targetCreature.getPower().getValue(), source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/Repercussion.java b/Mage.Sets/src/mage/cards/r/Repercussion.java index adf5a149c8b..ddc757515c7 100644 --- a/Mage.Sets/src/mage/cards/r/Repercussion.java +++ b/Mage.Sets/src/mage/cards/r/Repercussion.java @@ -97,7 +97,7 @@ class RepercussionEffect extends OneShotEffect { if (creature != null) { Player player = game.getPlayer(creature.getControllerId()); if (player != null) { - player.damage(playerDamage, source.getSourceId(), game); + player.damage(playerDamage, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/Reprocess.java b/Mage.Sets/src/mage/cards/r/Reprocess.java index bb16d7dcb17..c2e7291420e 100644 --- a/Mage.Sets/src/mage/cards/r/Reprocess.java +++ b/Mage.Sets/src/mage/cards/r/Reprocess.java @@ -74,11 +74,11 @@ class ReprocessEffect extends OneShotEffect { for(UUID uuid : toSacrifice.getTargets()){ Permanent permanent = game.getPermanent(uuid); if(permanent != null){ - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); amount++; } } - player.drawCards(amount, source.getSourceId(), game); + player.drawCards(amount, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RescueFromTheUnderworld.java b/Mage.Sets/src/mage/cards/r/RescueFromTheUnderworld.java index 8997a22c4a2..b65e3b8a555 100644 --- a/Mage.Sets/src/mage/cards/r/RescueFromTheUnderworld.java +++ b/Mage.Sets/src/mage/cards/r/RescueFromTheUnderworld.java @@ -164,7 +164,7 @@ class RescueFromTheUnderworldDelayedTriggeredAbility extends DelayedTriggeredAbi @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java b/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java index 54065c4f6bb..2a66b834aa8 100644 --- a/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java +++ b/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java @@ -103,7 +103,7 @@ class DevelopmentEffect extends OneShotEffect { if (opponent != null && opponent.chooseUse(Outcome.Detriment, "Allow " + player.getLogName() + " to draw a card instead? (" + (i + 1) + ')', source, game)) { game.informPlayers(opponent.getLogName() + " had chosen to let " + player.getLogName() + " draw a card."); - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); putToken = false; break; } diff --git a/Mage.Sets/src/mage/cards/r/ResoluteStrike.java b/Mage.Sets/src/mage/cards/r/ResoluteStrike.java index 59797cde940..df88ff51118 100644 --- a/Mage.Sets/src/mage/cards/r/ResoluteStrike.java +++ b/Mage.Sets/src/mage/cards/r/ResoluteStrike.java @@ -75,6 +75,6 @@ class ResoluteStrikeEffect extends OneShotEffect { } TargetPermanent targetPermanent = new TargetPermanent(0, 1, filter, true); player.choose(outcome, targetPermanent, source.getSourceId(), game); - return permanent.addAttachment(targetPermanent.getFirstTarget(), game); + return permanent.addAttachment(targetPermanent.getFirstTarget(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/r/RestInPeace.java b/Mage.Sets/src/mage/cards/r/RestInPeace.java index 2bc7282dd9f..bf447706b6b 100644 --- a/Mage.Sets/src/mage/cards/r/RestInPeace.java +++ b/Mage.Sets/src/mage/cards/r/RestInPeace.java @@ -80,28 +80,13 @@ class RestInPeaceReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (((ZoneChangeEvent)event).getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = ((ZoneChangeEvent)event).getTarget(); - if (permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); - } - } - else { - Card card = game.getCard(event.getTargetId()); - if (card != null) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - return controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, zEvent.getFromZone(), true); - } - } - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RestoreThePeace.java b/Mage.Sets/src/mage/cards/r/RestoreThePeace.java index ff0bd8cc49d..5dafe4520fe 100644 --- a/Mage.Sets/src/mage/cards/r/RestoreThePeace.java +++ b/Mage.Sets/src/mage/cards/r/RestoreThePeace.java @@ -61,7 +61,7 @@ class RestoreThePeaceEffect extends OneShotEffect { for (UUID permId : watcher.damageSources) { Permanent perm = game.getPermanent(permId); if (perm != null) { - perm.moveToZone(Zone.HAND, source.getSourceId(), game, true); + perm.moveToZone(Zone.HAND, source, game, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/Retether.java b/Mage.Sets/src/mage/cards/r/Retether.java index 8c0f54f941e..afc2513249e 100644 --- a/Mage.Sets/src/mage/cards/r/Retether.java +++ b/Mage.Sets/src/mage/cards/r/Retether.java @@ -100,11 +100,11 @@ class RetetherEffect extends OneShotEffect { if (target != null) { target.getFilter().add(CardType.CREATURE.getPredicate()); target.setNotTarget(true); - if (target.canChoose(controller.getId(), game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game)) { target.setTargetName("creature to enchant (" + aura.getLogName() + ')'); if (controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); - if (permanent != null && !permanent.cantBeAttachedBy(aura, game, true)) { + if (permanent != null && !permanent.cantBeAttachedBy(aura, source, game, true)) { auraMap.put(aura, permanent); game.getState().setValue("attachTo:" + aura.getId(), permanent); continue auraCardsInGraveyard; @@ -120,7 +120,7 @@ class RetetherEffect extends OneShotEffect { Card aura = entry.getKey(); Permanent permanent = entry.getValue(); if (aura != null && permanent != null) { - permanent.addAttachment(aura.getId(), game); + permanent.addAttachment(aura.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/Rethink.java b/Mage.Sets/src/mage/cards/r/Rethink.java index f4ac2121866..63d8a450b0f 100644 --- a/Mage.Sets/src/mage/cards/r/Rethink.java +++ b/Mage.Sets/src/mage/cards/r/Rethink.java @@ -61,8 +61,8 @@ class RethinkEffect extends OneShotEffect { Player player = game.getPlayer(spell.getControllerId()); if (player != null) { Cost cost = ManaUtil.createManaCost(spell.getConvertedManaCost(), true); - if (!cost.pay(source, game, source.getSourceId(), player.getId(), false)) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + if (!cost.pay(source, game, source, player.getId(), false)) { + game.getStack().counter(spell.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RetracedImage.java b/Mage.Sets/src/mage/cards/r/RetracedImage.java index 6916cd6b23c..44a715d73a9 100644 --- a/Mage.Sets/src/mage/cards/r/RetracedImage.java +++ b/Mage.Sets/src/mage/cards/r/RetracedImage.java @@ -61,7 +61,7 @@ class RetracedImageEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { TargetCardInHand target = new TargetCardInHand(); - if (target.canChoose(controller.getId(), game) + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(outcome, target, source.getSourceId(), game)) { Card chosenCard = game.getCard(target.getFirstTarget()); if (chosenCard != null) { diff --git a/Mage.Sets/src/mage/cards/r/Retribution.java b/Mage.Sets/src/mage/cards/r/Retribution.java index 343f364c8f8..beb952d6719 100644 --- a/Mage.Sets/src/mage/cards/r/Retribution.java +++ b/Mage.Sets/src/mage/cards/r/Retribution.java @@ -72,7 +72,7 @@ class RetributionEffect extends OneShotEffect { && controllerOfCreature.chooseUse(Outcome.Sacrifice, "Sacrifice " + creature.getLogName() + '?', source, game)) || (count == 1 && !sacrificeDone)) { - creature.sacrifice(source.getId(), game); + creature.sacrifice(source, game); sacrificeDone = true; } else { creature.addCounters(CounterType.M1M1.createInstance(), source, game); diff --git a/Mage.Sets/src/mage/cards/r/Retromancer.java b/Mage.Sets/src/mage/cards/r/Retromancer.java index d0983f1e81e..972ae653c41 100644 --- a/Mage.Sets/src/mage/cards/r/Retromancer.java +++ b/Mage.Sets/src/mage/cards/r/Retromancer.java @@ -61,7 +61,7 @@ class RetromancerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/ReturnOfTheNightstalkers.java b/Mage.Sets/src/mage/cards/r/ReturnOfTheNightstalkers.java index 3f026a7d735..bbf3846c079 100644 --- a/Mage.Sets/src/mage/cards/r/ReturnOfTheNightstalkers.java +++ b/Mage.Sets/src/mage/cards/r/ReturnOfTheNightstalkers.java @@ -69,7 +69,7 @@ class ReturnOfTheNightstalkersEffect extends OneShotEffect { if (controller != null) { controller.moveCards(controller.getGraveyard().getCards(filter1, game), Zone.BATTLEFIELD, source, game); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter2, source.getControllerId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/Reverberation.java b/Mage.Sets/src/mage/cards/r/Reverberation.java index 1685d0e1919..96455c10f89 100644 --- a/Mage.Sets/src/mage/cards/r/Reverberation.java +++ b/Mage.Sets/src/mage/cards/r/Reverberation.java @@ -83,7 +83,7 @@ class ReverberationEffect extends ReplacementEffectImpl { if (targetSpell != null) { Player targetsController = game.getPlayer(targetSpell.getControllerId()); if (targetsController != null) { - targetsController.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + targetsController.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); return true; } } diff --git a/Mage.Sets/src/mage/cards/r/ReversePolarity.java b/Mage.Sets/src/mage/cards/r/ReversePolarity.java index 8df9a503ea6..78c1b1eafd7 100644 --- a/Mage.Sets/src/mage/cards/r/ReversePolarity.java +++ b/Mage.Sets/src/mage/cards/r/ReversePolarity.java @@ -44,10 +44,10 @@ public final class ReversePolarity extends CardImpl { class ReversePolarityAmount implements DynamicValue { @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { ReversePolarityWatcher watcher = game.getState().getWatcher(ReversePolarityWatcher.class); if(watcher != null) { - return watcher.getArtifactDamageReceivedThisTurn(source.getControllerId()) * 2; + return watcher.getArtifactDamageReceivedThisTurn(sourceAbility.getControllerId()) * 2; } return 0; } diff --git a/Mage.Sets/src/mage/cards/r/RevivalRevenge.java b/Mage.Sets/src/mage/cards/r/RevivalRevenge.java index 61846ac538e..b2c530e8cc0 100644 --- a/Mage.Sets/src/mage/cards/r/RevivalRevenge.java +++ b/Mage.Sets/src/mage/cards/r/RevivalRevenge.java @@ -80,7 +80,7 @@ class RevivalRevengeEffect extends OneShotEffect { } controller.gainLife(controller.getLife(), game, source); int life = player.getLife(); - player.loseLife(Math.floorDiv(life, 2) + (life % 2), game, false); + player.loseLife(Math.floorDiv(life, 2) + (life % 2), game, source, false); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/r/RevokePrivileges.java b/Mage.Sets/src/mage/cards/r/RevokePrivileges.java index 5b6a46359be..78acda8d2b2 100644 --- a/Mage.Sets/src/mage/cards/r/RevokePrivileges.java +++ b/Mage.Sets/src/mage/cards/r/RevokePrivileges.java @@ -88,7 +88,7 @@ class RevokePrivilegeCantCrewEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CREW_VEHICLE; + return event.getType() == GameEvent.EventType.CREW_VEHICLE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/Reweave.java b/Mage.Sets/src/mage/cards/r/Reweave.java index 73fd171b5f1..0135e4a1370 100644 --- a/Mage.Sets/src/mage/cards/r/Reweave.java +++ b/Mage.Sets/src/mage/cards/r/Reweave.java @@ -71,7 +71,7 @@ class ReweaveEffect extends OneShotEffect { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); MageObject sourceObject = source.getSourceObject(game); if (permanent != null && sourceObject != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { Player permanentController = game.getPlayer(permanent.getControllerId()); if (permanentController != null) { Library library = permanentController.getLibrary(); diff --git a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java index 65fe8fcc618..701011f4345 100644 --- a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java +++ b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java @@ -77,7 +77,7 @@ class ReyhanLastOfTheAbzanTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java b/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java index 9ed426f5d20..92247d09f23 100644 --- a/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java +++ b/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java @@ -78,7 +78,7 @@ class RhoxFaithmenderEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAIN_LIFE; + return event.getType() == GameEvent.EventType.GAIN_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RhysticScrying.java b/Mage.Sets/src/mage/cards/r/RhysticScrying.java index 6ad3e70eb02..efa19402519 100644 --- a/Mage.Sets/src/mage/cards/r/RhysticScrying.java +++ b/Mage.Sets/src/mage/cards/r/RhysticScrying.java @@ -61,10 +61,10 @@ class RhysticScryingEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && player.canRespond() - && cost.canPay(source, source.getSourceId(), player.getId(), game) + && cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " for " + sourceObject.getLogName() + "?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost for " + sourceObject.getLogName()); } @@ -75,7 +75,7 @@ class RhysticScryingEffect extends OneShotEffect { } // do the effects if anybody paid if (doEffect) { - controller.discard(3, false, source, game); + controller.discard(3, false, false, source, game); } return result; } diff --git a/Mage.Sets/src/mage/cards/r/RhysticStudy.java b/Mage.Sets/src/mage/cards/r/RhysticStudy.java index 8c34fd706d2..816587ea064 100644 --- a/Mage.Sets/src/mage/cards/r/RhysticStudy.java +++ b/Mage.Sets/src/mage/cards/r/RhysticStudy.java @@ -66,10 +66,10 @@ class RhysticStudyDrawEffect extends OneShotEffect { Cost cost = ManaUtil.createManaCost(1, false); String message = "Would you like to pay {1} to prevent the opponent to draw a card?"; if (opponent.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { + && cost.pay(source, game, source, opponent.getId(), false, null)) { return true; } - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/Ricochet.java b/Mage.Sets/src/mage/cards/r/Ricochet.java index f52a37caad0..de424878205 100644 --- a/Mage.Sets/src/mage/cards/r/Ricochet.java +++ b/Mage.Sets/src/mage/cards/r/Ricochet.java @@ -116,7 +116,7 @@ class RicochetEffect extends OneShotEffect { } do { for (Player player : playerRolls.keySet()) { - playerRolls.put(player, player.rollDice(game, 6)); + playerRolls.put(player, player.rollDice(source, game, 6)); } int minValueInMap = Collections.min(playerRolls.values()); for (Map.Entry mapEntry : new HashSet<>(playerRolls.entrySet())) { diff --git a/Mage.Sets/src/mage/cards/r/RiddleOfLightning.java b/Mage.Sets/src/mage/cards/r/RiddleOfLightning.java index 3f4a34634be..26d1031890c 100644 --- a/Mage.Sets/src/mage/cards/r/RiddleOfLightning.java +++ b/Mage.Sets/src/mage/cards/r/RiddleOfLightning.java @@ -69,12 +69,12 @@ class RiddleOfLightningEffect extends OneShotEffect { controller.revealCards(sourceCard.getName(), new CardsImpl(card), game); Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - targetCreature.damage(card.getConvertedManaCost(), source.getSourceId(), game, false, true); + targetCreature.damage(card.getConvertedManaCost(), source.getSourceId(), source, game, false, true); return true; } Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(card.getConvertedManaCost(), source.getSourceId(), game); + targetPlayer.damage(card.getConvertedManaCost(), source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/r/RideDown.java b/Mage.Sets/src/mage/cards/r/RideDown.java index 65e87b36d84..a58a018ff9a 100644 --- a/Mage.Sets/src/mage/cards/r/RideDown.java +++ b/Mage.Sets/src/mage/cards/r/RideDown.java @@ -85,7 +85,7 @@ class RideDownEffect extends OneShotEffect { break; } } - blockingCreature.destroy(source.getSourceId(), game, false); + blockingCreature.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RiftElemental.java b/Mage.Sets/src/mage/cards/r/RiftElemental.java index 91e19257e5f..8dccba7e100 100644 --- a/Mage.Sets/src/mage/cards/r/RiftElemental.java +++ b/Mage.Sets/src/mage/cards/r/RiftElemental.java @@ -73,21 +73,21 @@ class RiftElementalCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; Player controller = game.getPlayer(controllerId); if (controller != null) { Target target = new TargetPermanentOrSuspendedCard(filter, true); - if (target.choose(Outcome.Neutral, controllerId, sourceId, game)) { + if (target.choose(Outcome.Neutral, controllerId, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.removeCounters(CounterType.TIME.createInstance(), game); + permanent.removeCounters(CounterType.TIME.createInstance(), source, game); this.paid = true; } else { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - card.removeCounters(CounterType.TIME.createInstance(), game); + card.removeCounters(CounterType.TIME.createInstance(), source, game); this.paid = true; } } @@ -97,9 +97,9 @@ class RiftElementalCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Target target = new TargetPermanentOrSuspendedCard(filter, true); - return target.canChoose(sourceId, controllerId, game); + return target.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java b/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java index ce503f12173..d0639561d27 100644 --- a/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java +++ b/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java @@ -67,7 +67,7 @@ class RiftmarkedKnightTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RighteousFury.java b/Mage.Sets/src/mage/cards/r/RighteousFury.java index 6aa334fe0ea..80e00ca8c26 100644 --- a/Mage.Sets/src/mage/cards/r/RighteousFury.java +++ b/Mage.Sets/src/mage/cards/r/RighteousFury.java @@ -62,7 +62,7 @@ class RighteousFuryEffect extends OneShotEffect { FilterCreaturePermanent filter = new FilterCreaturePermanent("all tapped creatures"); filter.add(TappedPredicate.instance); for(Permanent creature: game.getState().getBattlefield().getActivePermanents(filter, controller.getId(), game)) { - if (creature.destroy(source.getSourceId(), game, false)) { + if (creature.destroy(source, game, false)) { destroyedCreature++; } } diff --git a/Mage.Sets/src/mage/cards/r/RighteousIndignation.java b/Mage.Sets/src/mage/cards/r/RighteousIndignation.java index 71b831b150d..e214044ccd9 100644 --- a/Mage.Sets/src/mage/cards/r/RighteousIndignation.java +++ b/Mage.Sets/src/mage/cards/r/RighteousIndignation.java @@ -56,7 +56,7 @@ class RighteousIndignationTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RingsOfBrighthearth.java b/Mage.Sets/src/mage/cards/r/RingsOfBrighthearth.java index 87d427feec3..a3efe875261 100644 --- a/Mage.Sets/src/mage/cards/r/RingsOfBrighthearth.java +++ b/Mage.Sets/src/mage/cards/r/RingsOfBrighthearth.java @@ -60,7 +60,7 @@ class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATED_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; } @Override @@ -103,9 +103,9 @@ class RingsOfBrighthearthEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); ManaCostsImpl cost = new ManaCostsImpl("{2}"); if (player != null) { - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) { - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { StackAbility ability = (StackAbility) getValue("stackAbility"); Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/r/RiptideReplicator.java b/Mage.Sets/src/mage/cards/r/RiptideReplicator.java index 2d4c1e5c7ea..a0d15cc0a26 100644 --- a/Mage.Sets/src/mage/cards/r/RiptideReplicator.java +++ b/Mage.Sets/src/mage/cards/r/RiptideReplicator.java @@ -85,6 +85,6 @@ class RiptideReplicatorEffect extends OneShotEffect { } int x = (new CountersSourceCount(CounterType.CHARGE)).calculate(game, source, this); Token token = new RiptideReplicatorToken(color, subType, x); - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(1, game, source, source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/r/RiseFall.java b/Mage.Sets/src/mage/cards/r/RiseFall.java index f345dce851e..9ee4135c3a8 100644 --- a/Mage.Sets/src/mage/cards/r/RiseFall.java +++ b/Mage.Sets/src/mage/cards/r/RiseFall.java @@ -133,7 +133,7 @@ class FallEffect extends OneShotEffect { cards.add(card); } targetPlayer.revealCards(sourceObject.getIdName(), cards, game); - targetPlayer.discard(new CardsImpl(cards.getCards(StaticFilters.FILTER_CARD_NON_LAND, game)), source, game); + targetPlayer.discard(new CardsImpl(cards.getCards(StaticFilters.FILTER_CARD_NON_LAND, game)), false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/r/RiseOfTheDarkRealms.java b/Mage.Sets/src/mage/cards/r/RiseOfTheDarkRealms.java index a1825edcd67..e8262c69c19 100644 --- a/Mage.Sets/src/mage/cards/r/RiseOfTheDarkRealms.java +++ b/Mage.Sets/src/mage/cards/r/RiseOfTheDarkRealms.java @@ -53,7 +53,6 @@ class RiseOfTheDarkRealmsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Set creatureCards = new LinkedHashSet<>(); for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/cards/r/RiseOfTheHobgoblins.java b/Mage.Sets/src/mage/cards/r/RiseOfTheHobgoblins.java index ef22ba145b1..b6f4a4c8405 100644 --- a/Mage.Sets/src/mage/cards/r/RiseOfTheHobgoblins.java +++ b/Mage.Sets/src/mage/cards/r/RiseOfTheHobgoblins.java @@ -89,9 +89,9 @@ class RiseOfTheHobgoblinsEffect extends OneShotEffect { if (you != null && you.chooseUse(Outcome.Neutral, "Do you want to to pay {X}?", source, game)) { int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { Token token = new GoblinSoldierToken(); - return token.putOntoBattlefield(costX, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(costX, game, source, source.getControllerId()); } } return false; diff --git a/Mage.Sets/src/mage/cards/r/RishadanPawnshop.java b/Mage.Sets/src/mage/cards/r/RishadanPawnshop.java index 48813c68a44..245e9d89421 100644 --- a/Mage.Sets/src/mage/cards/r/RishadanPawnshop.java +++ b/Mage.Sets/src/mage/cards/r/RishadanPawnshop.java @@ -78,7 +78,7 @@ class RishadanPawnshopShuffleIntoLibraryEffect extends OneShotEffect { if (permanent != null) { Player owner = game.getPlayer(permanent.getOwnerId()); if (owner != null) { - owner.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + owner.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, true, true); owner.shuffleLibrary(source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/r/RiskFactor.java b/Mage.Sets/src/mage/cards/r/RiskFactor.java index 9133a2df219..b7b0275dd36 100644 --- a/Mage.Sets/src/mage/cards/r/RiskFactor.java +++ b/Mage.Sets/src/mage/cards/r/RiskFactor.java @@ -65,9 +65,9 @@ class RiskFactorEffect extends OneShotEffect { return false; } if (opponent.chooseUse(outcome, "Do you choose to take the damage?", source, game)) { - opponent.damage(4, source.getSourceId(), game); + opponent.damage(4, source.getSourceId(), source, game); } else { - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RiskyMove.java b/Mage.Sets/src/mage/cards/r/RiskyMove.java index 1fc5ba2af77..35d423b8526 100644 --- a/Mage.Sets/src/mage/cards/r/RiskyMove.java +++ b/Mage.Sets/src/mage/cards/r/RiskyMove.java @@ -151,12 +151,12 @@ class RiskyMoveFlipCoinEffect extends OneShotEffect { Target target2 = new TargetOpponent(true); if (target1.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target1.isChosen() && target1.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target1.isChosen() && target1.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target1, source, game); } } if (target2.canChoose(source.getSourceId(), controller.getId(), game)) { - while (!target2.isChosen() && target2.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target2.isChosen() && target2.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target2, source, game); } } @@ -202,7 +202,7 @@ class RiskyMoveCreatureGainControlEffect extends ContinuousEffectImpl { permanent = game.getPermanent(targetPointer.getFirst(game, source)); } if (permanent != null) { - return permanent.changeControllerId(controller, game); + return permanent.changeControllerId(controller, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/r/RiteOfConsumption.java b/Mage.Sets/src/mage/cards/r/RiteOfConsumption.java index 6c5b805efc9..dee7908b468 100644 --- a/Mage.Sets/src/mage/cards/r/RiteOfConsumption.java +++ b/Mage.Sets/src/mage/cards/r/RiteOfConsumption.java @@ -76,7 +76,7 @@ class RiteOfConsumptionEffect extends OneShotEffect { if (sacrificedCreature != null) { int damage = sacrificedCreature.getPower().getValue(); if (damage > 0) { - int damageDealt = game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), game, false, true); + int damageDealt = game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), source, game, false, true); if (damageDealt > 0) { controller.gainLife(damage, game, source); } diff --git a/Mage.Sets/src/mage/cards/r/RiteOfPassage.java b/Mage.Sets/src/mage/cards/r/RiteOfPassage.java index 03393719cf9..c61caab2d7c 100644 --- a/Mage.Sets/src/mage/cards/r/RiteOfPassage.java +++ b/Mage.Sets/src/mage/cards/r/RiteOfPassage.java @@ -62,7 +62,7 @@ class RiteOfPassageTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RiteOfTheRagingStorm.java b/Mage.Sets/src/mage/cards/r/RiteOfTheRagingStorm.java index d2f3e634fde..a721f5afa0a 100644 --- a/Mage.Sets/src/mage/cards/r/RiteOfTheRagingStorm.java +++ b/Mage.Sets/src/mage/cards/r/RiteOfTheRagingStorm.java @@ -72,7 +72,7 @@ class RiteOfTheRagingStormEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - return new LightningRagerToken().putOntoBattlefield(1, game, source.getSourceId(), player.getId()); + return new LightningRagerToken().putOntoBattlefield(1, game, source, player.getId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/r/RiteOfUndoing.java b/Mage.Sets/src/mage/cards/r/RiteOfUndoing.java index 5693755e90a..3832f30ef30 100644 --- a/Mage.Sets/src/mage/cards/r/RiteOfUndoing.java +++ b/Mage.Sets/src/mage/cards/r/RiteOfUndoing.java @@ -74,11 +74,11 @@ class RiteOfUndoingEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - result |= permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + result |= permanent.moveToZone(Zone.HAND, source, game, false); } permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - result |= permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + result |= permanent.moveToZone(Zone.HAND, source, game, false); } return result; diff --git a/Mage.Sets/src/mage/cards/r/RitesOfFlourishing.java b/Mage.Sets/src/mage/cards/r/RitesOfFlourishing.java index 35a4da15717..d8d5407d719 100644 --- a/Mage.Sets/src/mage/cards/r/RitesOfFlourishing.java +++ b/Mage.Sets/src/mage/cards/r/RitesOfFlourishing.java @@ -58,7 +58,7 @@ class RitesOfFlourishingAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_STEP_PRE; + return event.getType() == GameEvent.EventType.DRAW_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RitesOfInitiation.java b/Mage.Sets/src/mage/cards/r/RitesOfInitiation.java index df60a86b483..46e73bd2ff5 100644 --- a/Mage.Sets/src/mage/cards/r/RitesOfInitiation.java +++ b/Mage.Sets/src/mage/cards/r/RitesOfInitiation.java @@ -57,7 +57,7 @@ class RitesOfInitiationEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { int numToDiscard = player.getAmount(0, player.getHand().size(), "Discard how many cards at random?", game); - player.discard(numToDiscard, true, source, game); + player.discard(numToDiscard, true, false, source, game); game.addEffect(new BoostControlledEffect(numToDiscard, 0, Duration.EndOfTurn), source); return true; } diff --git a/Mage.Sets/src/mage/cards/r/RitesOfRefusal.java b/Mage.Sets/src/mage/cards/r/RitesOfRefusal.java index 3ad6448b14e..3c1e7aacb6b 100644 --- a/Mage.Sets/src/mage/cards/r/RitesOfRefusal.java +++ b/Mage.Sets/src/mage/cards/r/RitesOfRefusal.java @@ -67,7 +67,7 @@ class RitesOfRefusalEffect extends OneShotEffect { if (controller != null && controllerOfTargetedSpell != null) { int numToDiscard = controller.getAmount(0, controller.getHand().size(), "How many cards do you want to discard?", game); - Cards discardedCards = controller.discard(numToDiscard, false, source, game); + Cards discardedCards = controller.discard(numToDiscard, false, false, source, game); int actualNumberDiscarded = discardedCards.size(); if (actualNumberDiscarded > 0) { Cost cost = ManaUtil.createManaCost(actualNumberDiscarded * 3, false); @@ -77,11 +77,11 @@ class RitesOfRefusalEffect extends OneShotEffect { + " to prevent " + targetSpell.getName() + " from gettting countered?", source, game) - && cost.pay(source, game, source.getSourceId(), + && cost.pay(source, game, source, controllerOfTargetedSpell.getId(), false)) { return true; } - game.getStack().counter(targetSpell.getId(), source.getSourceId(), game); + game.getStack().counter(targetSpell.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/r/RitesOfSpring.java b/Mage.Sets/src/mage/cards/r/RitesOfSpring.java index 3991d3acd3c..2f04978334f 100644 --- a/Mage.Sets/src/mage/cards/r/RitesOfSpring.java +++ b/Mage.Sets/src/mage/cards/r/RitesOfSpring.java @@ -64,7 +64,7 @@ class RitesOfSpringEffect extends OneShotEffect { } TargetCard target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD, controller.getId()); controller.choose(Outcome.AIDontUseIt, controller.getHand(), target, game); - int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); + int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), false, source, game).size(); new SearchLibraryPutInHandEffect(new TargetCardInLibrary( 0, numDiscarded, StaticFilters.FILTER_CARD_BASIC_LAND ), true, true).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/r/RitualOfSubdual.java b/Mage.Sets/src/mage/cards/r/RitualOfSubdual.java index 22296e7b621..bb78a644b04 100644 --- a/Mage.Sets/src/mage/cards/r/RitualOfSubdual.java +++ b/Mage.Sets/src/mage/cards/r/RitualOfSubdual.java @@ -78,12 +78,12 @@ class RitualOfSubdualReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - MageObject mageObject = game.getObject(event.getSourceId()); + MageObject mageObject = game.getPermanentOrLKIBattlefield(event.getSourceId()); return mageObject != null && mageObject.isLand(); } } diff --git a/Mage.Sets/src/mage/cards/r/RitualOfTheReturned.java b/Mage.Sets/src/mage/cards/r/RitualOfTheReturned.java index 9de5f94614c..ac500366333 100644 --- a/Mage.Sets/src/mage/cards/r/RitualOfTheReturned.java +++ b/Mage.Sets/src/mage/cards/r/RitualOfTheReturned.java @@ -62,7 +62,7 @@ class RitualOfTheReturnedExileEffect extends OneShotEffect { if (controller != null) { Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) { - controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, null, null, source, game, Zone.GRAVEYARD, true); return new CreateTokenEffect( new RitualOfTheReturnedZombieToken(card.getPower().getValue(), card.getToughness().getValue())).apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/r/Rivalry.java b/Mage.Sets/src/mage/cards/r/Rivalry.java index 7fdfe462de4..5ece3a80df6 100644 --- a/Mage.Sets/src/mage/cards/r/Rivalry.java +++ b/Mage.Sets/src/mage/cards/r/Rivalry.java @@ -57,7 +57,7 @@ class RivalryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RivalsDuel.java b/Mage.Sets/src/mage/cards/r/RivalsDuel.java index 08d8be7d6ec..ace505073c0 100644 --- a/Mage.Sets/src/mage/cards/r/RivalsDuel.java +++ b/Mage.Sets/src/mage/cards/r/RivalsDuel.java @@ -63,8 +63,8 @@ class RivalsDuelFightTargetsEffect extends OneShotEffect { // 20110930 - 701.10 if (creature1 != null && creature2 != null) { - creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, false, true); - creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true); + creature1.damage(creature2.getPower().getValue(), creature2.getId(), source, game, false, true); + creature2.damage(creature1.getPower().getValue(), creature1.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/r/RiversGrasp.java b/Mage.Sets/src/mage/cards/r/RiversGrasp.java index f050c73502d..f1bf4e8f8ff 100644 --- a/Mage.Sets/src/mage/cards/r/RiversGrasp.java +++ b/Mage.Sets/src/mage/cards/r/RiversGrasp.java @@ -86,7 +86,7 @@ class RiversGraspEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_A_NON_LAND); if (controller.choose(Outcome.Benefit, player.getHand(), target, game)) { Card card = player.getHand().get(target.getFirstTarget(), game); - return player.discard(card, source, game); + return player.discard(card, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/r/RiversRebuke.java b/Mage.Sets/src/mage/cards/r/RiversRebuke.java index 3199f29dc84..d3fef829474 100644 --- a/Mage.Sets/src/mage/cards/r/RiversRebuke.java +++ b/Mage.Sets/src/mage/cards/r/RiversRebuke.java @@ -56,7 +56,7 @@ class RiversRebukeReturnToHandEffect extends OneShotEffect { FilterNonlandPermanent filter = new FilterNonlandPermanent(); filter.add(new ControllerIdPredicate(targetPointer.getFirst(game, source))); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true); + permanent.moveToZone(Zone.HAND, source, game, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RixMaadiReveler.java b/Mage.Sets/src/mage/cards/r/RixMaadiReveler.java index a8196431f41..df47aee95c0 100644 --- a/Mage.Sets/src/mage/cards/r/RixMaadiReveler.java +++ b/Mage.Sets/src/mage/cards/r/RixMaadiReveler.java @@ -72,11 +72,11 @@ class RixMaadiRevelerEffect extends OneShotEffect { return false; } if (SpectacleCondition.instance.apply(game, source)) { - player.discard(player.getHand().size(), false, source, game); - player.drawCards(3, source.getSourceId(), game); + player.discard(player.getHand().size(), false, false, source, game); + player.drawCards(3, source, game); } else { - player.discard(1, false, source, game); - player.drawCards(1, source.getSourceId(), game); + player.discard(1, false, false, source, game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RobberFly.java b/Mage.Sets/src/mage/cards/r/RobberFly.java index bebc459c4e6..8bfead7d812 100644 --- a/Mage.Sets/src/mage/cards/r/RobberFly.java +++ b/Mage.Sets/src/mage/cards/r/RobberFly.java @@ -70,8 +70,8 @@ class DrawCardsDefendingPlayerEffect extends OneShotEffect { if (controller != null && defendingPlayer != null) { int numberOfCardsInHand = defendingPlayer.getHand().size(); - defendingPlayer.discard(defendingPlayer.getHand(), source, game); - defendingPlayer.drawCards(numberOfCardsInHand, source.getSourceId(), game); + defendingPlayer.discard(defendingPlayer.getHand(), false, source, game); + defendingPlayer.drawCards(numberOfCardsInHand, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/r/RobberOfTheRich.java b/Mage.Sets/src/mage/cards/r/RobberOfTheRich.java index 9562df0bdcb..cc3deb8a53a 100644 --- a/Mage.Sets/src/mage/cards/r/RobberOfTheRich.java +++ b/Mage.Sets/src/mage/cards/r/RobberOfTheRich.java @@ -112,7 +112,7 @@ class RobberOfTheRichEffect extends OneShotEffect { return true; } // move card to exile - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.LIBRARY, true); // Add effects only if the card has a spellAbility (e.g. not for lands). if (card.getSpellAbility() == null) { return true; diff --git a/Mage.Sets/src/mage/cards/r/RockHydra.java b/Mage.Sets/src/mage/cards/r/RockHydra.java index 1474c6810d2..08405205c3d 100644 --- a/Mage.Sets/src/mage/cards/r/RockHydra.java +++ b/Mage.Sets/src/mage/cards/r/RockHydra.java @@ -85,7 +85,7 @@ public final class RockHydra extends CardImpl { preventDamageAction(event, source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); //MTG ruling Rock Hydra loses counters even if the damage isn't prevented + permanent.removeCounters(CounterType.P1P1.createInstance(damage), source, game); //MTG ruling Rock Hydra loses counters even if the damage isn't prevented } return false; } diff --git a/Mage.Sets/src/mage/cards/r/RocketLauncher.java b/Mage.Sets/src/mage/cards/r/RocketLauncher.java index 498e8556528..143fe84c7d5 100644 --- a/Mage.Sets/src/mage/cards/r/RocketLauncher.java +++ b/Mage.Sets/src/mage/cards/r/RocketLauncher.java @@ -67,7 +67,7 @@ class RocketLauncherWatcher extends Watcher { changedControllerOR1stTurn = false; } if (event.getType() == GameEvent.EventType.LOST_CONTROL && - Objects.equals(event.getSourceId(), cardId)) { + Objects.equals(event.getTargetId(), cardId)) { changedControllerOR1stTurn = true; } } diff --git a/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java b/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java index e56b0bfd031..5b52e1cc54b 100644 --- a/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java +++ b/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java @@ -79,7 +79,7 @@ class RogueSkycaptainEffect extends OneShotEffect { if (controller != null && permanent != null) { new AddCountersSourceEffect(CounterType.WAGE.createInstance(), true).apply(game, source); Cost cost = ManaUtil.createManaCost(2 * permanent.getCounters(game).getCount(CounterType.WAGE), false); - if (!cost.pay(source, game, controller.getId(), controller.getId(), false)) { + if (!cost.pay(source, game, source, controller.getId(), false)) { new RemoveAllCountersSourceEffect(CounterType.WAGE).apply(game, source); Player opponent; Set opponents = game.getOpponents(controller.getId()); @@ -92,7 +92,7 @@ class RogueSkycaptainEffect extends OneShotEffect { opponent = game.getPlayer(target.getFirstTarget()); } if (opponent != null) { - permanent.changeControllerId(opponent.getId(), game); + permanent.changeControllerId(opponent.getId(), game, source); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/RohgahhOfKherKeep.java b/Mage.Sets/src/mage/cards/r/RohgahhOfKherKeep.java index 9744e077876..42681f7106a 100644 --- a/Mage.Sets/src/mage/cards/r/RohgahhOfKherKeep.java +++ b/Mage.Sets/src/mage/cards/r/RohgahhOfKherKeep.java @@ -98,9 +98,9 @@ class RohgahhOfKherKeepEffect extends OneShotEffect { return false; } Cost cost = new ManaCostsImpl("{R}{R}{R}"); - if (!cost.canPay(source, source.getSourceId(), player.getId(), game) + if (!cost.canPay(source, source, player.getId(), game) || !player.chooseUse(Outcome.Benefit, "Pay {R}{R}{R}?", source, game) - || !cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + || !cost.pay(source, game, source, player.getId(), false)) { TargetOpponent target = new TargetOpponent(); Player opponent = null; if (target.choose(Outcome.Detriment, player.getId(), source.getSourceId(), game)) { @@ -108,7 +108,7 @@ class RohgahhOfKherKeepEffect extends OneShotEffect { } new TapAllEffect(filter).apply(game, source); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } if (opponent != null) { new GainControlAllEffect(Duration.Custom, filter, opponent.getId()).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/r/RoilingHorror.java b/Mage.Sets/src/mage/cards/r/RoilingHorror.java index a526bc277de..4478919edf5 100644 --- a/Mage.Sets/src/mage/cards/r/RoilingHorror.java +++ b/Mage.Sets/src/mage/cards/r/RoilingHorror.java @@ -83,7 +83,7 @@ class RoilingHorrorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER_REMOVED; + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RoilingTerrain.java b/Mage.Sets/src/mage/cards/r/RoilingTerrain.java index d5872537c29..220a7227281 100644 --- a/Mage.Sets/src/mage/cards/r/RoilingTerrain.java +++ b/Mage.Sets/src/mage/cards/r/RoilingTerrain.java @@ -57,11 +57,11 @@ class RoilingTerrainEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent targetedLand = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetedLand != null) { - targetedLand.destroy(source.getSourceId(), game, true); + targetedLand.destroy(source, game, true); Player targetController = game.getPlayer(targetedLand.getControllerId()); if (targetController != null) { int landsInGraveyard = targetController.getGraveyard().count(new FilterLandCard(), game); - targetController.damage(landsInGraveyard, source.getSourceId(), game); + targetController.damage(landsInGraveyard, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RoninCliffrider.java b/Mage.Sets/src/mage/cards/r/RoninCliffrider.java index b03b6c3a483..1c10d20fae1 100644 --- a/Mage.Sets/src/mage/cards/r/RoninCliffrider.java +++ b/Mage.Sets/src/mage/cards/r/RoninCliffrider.java @@ -71,7 +71,7 @@ class RoninCliffriderEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(defenderId)); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.damage(1, source.getSourceId(), game, false, true); + permanent.damage(1, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RoninWarclub.java b/Mage.Sets/src/mage/cards/r/RoninWarclub.java index 0d4faf7a7b9..649dc2b7dc5 100644 --- a/Mage.Sets/src/mage/cards/r/RoninWarclub.java +++ b/Mage.Sets/src/mage/cards/r/RoninWarclub.java @@ -63,7 +63,7 @@ public final class RoninWarclub extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -119,11 +119,11 @@ public final class RoninWarclub extends CardImpl { if (attachment.getAttachedTo() != null) { Permanent oldTarget = game.getPermanent(attachment.getAttachedTo()); if (oldTarget != null) { - oldTarget.removeAttachment(source.getSourceId(), game); + oldTarget.removeAttachment(source.getSourceId(), source, game); } } boolean result; - result = permanent.addAttachment(source.getSourceId(), game); + result = permanent.addAttachment(source.getSourceId(), source, game); return result; } return false; diff --git a/Mage.Sets/src/mage/cards/r/RootGreevil.java b/Mage.Sets/src/mage/cards/r/RootGreevil.java index 62c26fec77e..87334f6f10f 100644 --- a/Mage.Sets/src/mage/cards/r/RootGreevil.java +++ b/Mage.Sets/src/mage/cards/r/RootGreevil.java @@ -74,7 +74,7 @@ public final class RootGreevil extends CardImpl { FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent(); filter.add(new ColorPredicate(choice.getColor())); for (Permanent enchantment : game.getBattlefield().getAllActivePermanents(filter, game)) { - enchantment.destroy(source.getSourceId(), game, false); + enchantment.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RootMaze.java b/Mage.Sets/src/mage/cards/r/RootMaze.java index aa83db6a211..602f904137e 100644 --- a/Mage.Sets/src/mage/cards/r/RootMaze.java +++ b/Mage.Sets/src/mage/cards/r/RootMaze.java @@ -62,7 +62,7 @@ class RootMazeEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RootwaterThief.java b/Mage.Sets/src/mage/cards/r/RootwaterThief.java index 4b58f296380..2b1f42abf9a 100644 --- a/Mage.Sets/src/mage/cards/r/RootwaterThief.java +++ b/Mage.Sets/src/mage/cards/r/RootwaterThief.java @@ -73,14 +73,14 @@ class RootwaterThiefEffect extends OneShotEffect { } String message = "Pay {2} to exile a card from damaged player's library?"; Cost cost = new ManaCostsImpl("{2}"); - if(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) + if(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source, controller.getId(), false, null)) { TargetCardInLibrary target = new TargetCardInLibrary(); if (controller.searchLibrary(target, source, game, damagedPlayer.getId())) { if (!target.getTargets().isEmpty()) { Card card = damagedPlayer.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/r/RotfeasterMaggot.java b/Mage.Sets/src/mage/cards/r/RotfeasterMaggot.java index 61ee4b2b793..c293e430635 100644 --- a/Mage.Sets/src/mage/cards/r/RotfeasterMaggot.java +++ b/Mage.Sets/src/mage/cards/r/RotfeasterMaggot.java @@ -70,7 +70,7 @@ class RotfeasterMaggotExileEffect extends OneShotEffect { Card targetCard = game.getCard(getTargetPointer().getFirst(game, source)); if (targetCard != null) { if (game.getState().getZone(targetCard.getId()) == Zone.GRAVEYARD) { - controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(targetCard, null, "", source, game, Zone.GRAVEYARD, true); } controller.gainLife(targetCard.getToughness().getValue(), game, source); return true; diff --git a/Mage.Sets/src/mage/cards/r/RowdyCrew.java b/Mage.Sets/src/mage/cards/r/RowdyCrew.java index 7d34ad922fe..7ffaf1e79e4 100644 --- a/Mage.Sets/src/mage/cards/r/RowdyCrew.java +++ b/Mage.Sets/src/mage/cards/r/RowdyCrew.java @@ -71,17 +71,17 @@ class RowdyCrewEffect extends OneShotEffect { Permanent creature = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); Cards cards = new CardsImpl(); int cardsInHand = player.getHand().size(); switch (cardsInHand) { case 0: break; case 1: - player.discard(1, true, source, game); + player.discard(1, true, false, source, game); break; default: - cards = player.discard(2, true, source, game); + cards = player.discard(2, true, false, source, game); } if (creature != null && cardsInHand > 1) { for (CardType type : CardType.values()) { diff --git a/Mage.Sets/src/mage/cards/r/Rowen.java b/Mage.Sets/src/mage/cards/r/Rowen.java index c44d050a386..f50acb789f3 100644 --- a/Mage.Sets/src/mage/cards/r/Rowen.java +++ b/Mage.Sets/src/mage/cards/r/Rowen.java @@ -59,7 +59,7 @@ class RowenAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RuinRaider.java b/Mage.Sets/src/mage/cards/r/RuinRaider.java index b91f50cd77c..e63c24e712d 100644 --- a/Mage.Sets/src/mage/cards/r/RuinRaider.java +++ b/Mage.Sets/src/mage/cards/r/RuinRaider.java @@ -71,7 +71,7 @@ class RuinRaiderEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controller.revealCards(source, cards, game); controller.moveCards(card, Zone.HAND, source, game); - controller.loseLife(card.getConvertedManaCost(), game, false); + controller.loseLife(card.getConvertedManaCost(), game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/r/RumblingAftershocks.java b/Mage.Sets/src/mage/cards/r/RumblingAftershocks.java index 9859f00ec22..eaea4db6a05 100644 --- a/Mage.Sets/src/mage/cards/r/RumblingAftershocks.java +++ b/Mage.Sets/src/mage/cards/r/RumblingAftershocks.java @@ -70,7 +70,7 @@ class RumblingAftershocksTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -120,12 +120,12 @@ class RumblingAftershocksDealDamageEffect extends OneShotEffect { if (player != null && damageAmount > 0) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(damageAmount, source.getSourceId(), game); + targetPlayer.damage(damageAmount, source.getSourceId(), source, game); return true; } Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(damageAmount, source.getSourceId(), game, false, true); + permanent.damage(damageAmount, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/r/Rumination.java b/Mage.Sets/src/mage/cards/r/Rumination.java index 1951201ed1e..5c5d8d8ed2e 100644 --- a/Mage.Sets/src/mage/cards/r/Rumination.java +++ b/Mage.Sets/src/mage/cards/r/Rumination.java @@ -56,7 +56,7 @@ public final class Rumination extends CardImpl { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); putOnLibrary(player, source, game); return true; } @@ -69,7 +69,7 @@ public final class Rumination extends CardImpl { player.chooseTarget(Outcome.ReturnToHand, target, source, game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - return player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + return player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/r/Runesword.java b/Mage.Sets/src/mage/cards/r/Runesword.java index 0f879aa7a70..11201a84c74 100644 --- a/Mage.Sets/src/mage/cards/r/Runesword.java +++ b/Mage.Sets/src/mage/cards/r/Runesword.java @@ -130,7 +130,7 @@ class RuneswordCantBeRegeneratedEffect extends ContinuousRuleModifyingEffectImpl @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.REGENERATE; + return event.getType() == GameEvent.EventType.REGENERATE; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RunicArmasaur.java b/Mage.Sets/src/mage/cards/r/RunicArmasaur.java index 7850ee2ccaf..12f25b5d33d 100644 --- a/Mage.Sets/src/mage/cards/r/RunicArmasaur.java +++ b/Mage.Sets/src/mage/cards/r/RunicArmasaur.java @@ -60,7 +60,7 @@ class RunicArmasaurTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATED_ABILITY; + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; } @Override diff --git a/Mage.Sets/src/mage/cards/r/Rupture.java b/Mage.Sets/src/mage/cards/r/Rupture.java index 3a0f8065d18..4824a39032c 100644 --- a/Mage.Sets/src/mage/cards/r/Rupture.java +++ b/Mage.Sets/src/mage/cards/r/Rupture.java @@ -66,13 +66,13 @@ class RuptureEffect extends OneShotEffect { int power = 0; TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("creature to sacrifice"), true); if (target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) { player.chooseTarget(Outcome.Sacrifice, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { power = permanent.getPower().getValue(); - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } if (power > 0) { diff --git a/Mage.Sets/src/mage/cards/r/RuricTharTheUnbowed.java b/Mage.Sets/src/mage/cards/r/RuricTharTheUnbowed.java index 5cfcc176d10..5997c068c1a 100644 --- a/Mage.Sets/src/mage/cards/r/RuricTharTheUnbowed.java +++ b/Mage.Sets/src/mage/cards/r/RuricTharTheUnbowed.java @@ -76,7 +76,7 @@ class RuricTharTheUnbowedAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RustElemental.java b/Mage.Sets/src/mage/cards/r/RustElemental.java index 046bf2aa758..1935486ea1a 100644 --- a/Mage.Sets/src/mage/cards/r/RustElemental.java +++ b/Mage.Sets/src/mage/cards/r/RustElemental.java @@ -83,11 +83,11 @@ class RustElementalEffect extends OneShotEffect { Permanent artifactSacrifice = game.getPermanent(target.getFirstTarget()); if (artifactSacrifice != null) { // sacrifice the chosen artifact - artifactSacrifice.sacrifice(source.getSourceId(), game); + artifactSacrifice.sacrifice(source, game); } } else { - sourceObject.tap(game); - controller.damage(4, source.getSourceId(), game); + sourceObject.tap(source, game); + controller.damage(4, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/r/RustScarab.java b/Mage.Sets/src/mage/cards/r/RustScarab.java index 90446812a68..0ffbdbcdff0 100644 --- a/Mage.Sets/src/mage/cards/r/RustScarab.java +++ b/Mage.Sets/src/mage/cards/r/RustScarab.java @@ -36,7 +36,7 @@ public final class RustScarab extends CardImpl { // Whenever Rust Scarab becomes blocked, you may destroy target artifact or enchantment defending player controls. Effect effect = new DestroyTargetEffect(); effect.setText("destroy target artifact or enchantment defending player controls"); - this.addAbility(new BecomesBlockedTriggeredAbility(effect, true)); + this.addAbility(new RustScarabBecomesBlockedTriggeredAbility(effect, true)); } @@ -51,19 +51,19 @@ public final class RustScarab extends CardImpl { } -class BecomesBlockedTriggeredAbility extends TriggeredAbilityImpl { +class RustScarabBecomesBlockedTriggeredAbility extends TriggeredAbilityImpl { - public BecomesBlockedTriggeredAbility(Effect effect, boolean optional) { + public RustScarabBecomesBlockedTriggeredAbility(Effect effect, boolean optional) { super(Zone.BATTLEFIELD, effect, optional); } - public BecomesBlockedTriggeredAbility(final BecomesBlockedTriggeredAbility ability) { + public RustScarabBecomesBlockedTriggeredAbility(final RustScarabBecomesBlockedTriggeredAbility ability) { super(ability); } @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.CREATURE_BLOCKED; + return event.getType() == GameEvent.EventType.CREATURE_BLOCKED; } @Override @@ -89,7 +89,7 @@ class BecomesBlockedTriggeredAbility extends TriggeredAbilityImpl { } @Override - public BecomesBlockedTriggeredAbility copy() { - return new BecomesBlockedTriggeredAbility(this); + public RustScarabBecomesBlockedTriggeredAbility copy() { + return new RustScarabBecomesBlockedTriggeredAbility(this); } } diff --git a/Mage.Sets/src/mage/cards/r/RustmouthOgre.java b/Mage.Sets/src/mage/cards/r/RustmouthOgre.java index 389656ac8e6..49adb56f32c 100644 --- a/Mage.Sets/src/mage/cards/r/RustmouthOgre.java +++ b/Mage.Sets/src/mage/cards/r/RustmouthOgre.java @@ -62,7 +62,7 @@ class RustmouthOgreTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/r/RuthlessDeathfang.java b/Mage.Sets/src/mage/cards/r/RuthlessDeathfang.java index 9bcef679a23..23ed218bb1e 100644 --- a/Mage.Sets/src/mage/cards/r/RuthlessDeathfang.java +++ b/Mage.Sets/src/mage/cards/r/RuthlessDeathfang.java @@ -67,7 +67,7 @@ class RuthlessDeathfangTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SacredGround.java b/Mage.Sets/src/mage/cards/s/SacredGround.java index 93a2b21b08f..9ce9e74d445 100644 --- a/Mage.Sets/src/mage/cards/s/SacredGround.java +++ b/Mage.Sets/src/mage/cards/s/SacredGround.java @@ -55,7 +55,7 @@ class SacredGroundTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SacredRites.java b/Mage.Sets/src/mage/cards/s/SacredRites.java index 3104c737bdc..4c302b9f2cf 100644 --- a/Mage.Sets/src/mage/cards/s/SacredRites.java +++ b/Mage.Sets/src/mage/cards/s/SacredRites.java @@ -63,7 +63,7 @@ class SacredRitesEffect extends OneShotEffect { } Target target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD, controller.getId()); target.choose(outcome, controller.getId(), source.getSourceId(), game); - int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); + int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), false, source, game).size(); if (numDiscarded > 0) { game.addEffect(new BoostControlledEffect(0, numDiscarded, Duration.EndOfTurn), source); } diff --git a/Mage.Sets/src/mage/cards/s/SadisticAugermage.java b/Mage.Sets/src/mage/cards/s/SadisticAugermage.java index dfbd3d36f51..8c66b541c76 100644 --- a/Mage.Sets/src/mage/cards/s/SadisticAugermage.java +++ b/Mage.Sets/src/mage/cards/s/SadisticAugermage.java @@ -74,7 +74,7 @@ class WidespreadPanicEffect extends OneShotEffect { player.choose(Outcome.Detriment, target, source.getSourceId(), game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/SadisticSacrament.java b/Mage.Sets/src/mage/cards/s/SadisticSacrament.java index 2f1b08a70b1..d16fce3d5af 100644 --- a/Mage.Sets/src/mage/cards/s/SadisticSacrament.java +++ b/Mage.Sets/src/mage/cards/s/SadisticSacrament.java @@ -85,7 +85,7 @@ class SadisticSacramentEffect extends OneShotEffect { for (UUID targetId : targets) { Card card = targetPlayer.getLibrary().remove(targetId, game); if (card != null) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SaffiEriksdotter.java b/Mage.Sets/src/mage/cards/s/SaffiEriksdotter.java index da707f54caf..f522a8de17c 100644 --- a/Mage.Sets/src/mage/cards/s/SaffiEriksdotter.java +++ b/Mage.Sets/src/mage/cards/s/SaffiEriksdotter.java @@ -99,7 +99,7 @@ class SaffiEriksdotterDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SakikoMotherOfSummer.java b/Mage.Sets/src/mage/cards/s/SakikoMotherOfSummer.java index da0593a803b..71e7045aae2 100644 --- a/Mage.Sets/src/mage/cards/s/SakikoMotherOfSummer.java +++ b/Mage.Sets/src/mage/cards/s/SakikoMotherOfSummer.java @@ -67,7 +67,7 @@ class SakikoMotherOfSummerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SamuraiOfThePaleCurtain.java b/Mage.Sets/src/mage/cards/s/SamuraiOfThePaleCurtain.java index 06b0e682567..67a2477cf55 100644 --- a/Mage.Sets/src/mage/cards/s/SamuraiOfThePaleCurtain.java +++ b/Mage.Sets/src/mage/cards/s/SamuraiOfThePaleCurtain.java @@ -79,7 +79,7 @@ class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SandsOfTime.java b/Mage.Sets/src/mage/cards/s/SandsOfTime.java index 8284670d768..622fb0f69de 100644 --- a/Mage.Sets/src/mage/cards/s/SandsOfTime.java +++ b/Mage.Sets/src/mage/cards/s/SandsOfTime.java @@ -78,7 +78,7 @@ class SandsOfTimeEffect extends OneShotEffect { if (permanent.isTapped()) { permanent.untap(game); } else { - permanent.tap(game); + permanent.tap(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SandstoneOracle.java b/Mage.Sets/src/mage/cards/s/SandstoneOracle.java index 775c31c40c4..bc77b6b4508 100644 --- a/Mage.Sets/src/mage/cards/s/SandstoneOracle.java +++ b/Mage.Sets/src/mage/cards/s/SandstoneOracle.java @@ -74,7 +74,7 @@ class SandstoneOracleEffect extends OneShotEffect { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName()); int cardsDiff = opponent.getHand().size() - controller.getHand().size(); if (cardsDiff > 0) { - controller.drawCards(cardsDiff, source.getSourceId(), game); + controller.drawCards(cardsDiff, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/Sangromancer.java b/Mage.Sets/src/mage/cards/s/Sangromancer.java index 10b77b15031..15b3d0bcb26 100644 --- a/Mage.Sets/src/mage/cards/s/Sangromancer.java +++ b/Mage.Sets/src/mage/cards/s/Sangromancer.java @@ -62,7 +62,7 @@ class SangromancerFirstTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -98,7 +98,7 @@ class SangromancerSecondTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SanguineBond.java b/Mage.Sets/src/mage/cards/s/SanguineBond.java index fa12709d1e4..3aa920b5361 100644 --- a/Mage.Sets/src/mage/cards/s/SanguineBond.java +++ b/Mage.Sets/src/mage/cards/s/SanguineBond.java @@ -54,7 +54,7 @@ class SanguineBondTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SanguinePraetor.java b/Mage.Sets/src/mage/cards/s/SanguinePraetor.java index f67e0b5a5a7..3b5ba73f65d 100644 --- a/Mage.Sets/src/mage/cards/s/SanguinePraetor.java +++ b/Mage.Sets/src/mage/cards/s/SanguinePraetor.java @@ -75,7 +75,7 @@ class SanguinePraetorEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) { if (permanent.getConvertedManaCost() == cmc) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SaplingOfColfenor.java b/Mage.Sets/src/mage/cards/s/SaplingOfColfenor.java index 4bfeb3924cc..b0978685e70 100644 --- a/Mage.Sets/src/mage/cards/s/SaplingOfColfenor.java +++ b/Mage.Sets/src/mage/cards/s/SaplingOfColfenor.java @@ -79,7 +79,7 @@ class SaplingOfColfenorEffect extends OneShotEffect { controller.revealCards(sourceObject.getIdName(), cards, game); if (card.isCreature()) { controller.gainLife(card.getToughness().getValue(), game, source); - controller.loseLife(card.getPower().getValue(), game, false); + controller.loseLife(card.getPower().getValue(), game, source, false); return controller.moveCards(cards.getCards(game), Zone.HAND, source, game); } } diff --git a/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java b/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java index 8b9c54db3de..b8e573b55ed 100644 --- a/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java +++ b/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java @@ -82,7 +82,7 @@ class SaprazzanBailiffEffect extends OneShotEffect { for (UUID cid : player.getGraveyard().copy()) { Card card = game.getCard(cid); if (card != null && (card.isArtifact() || card.isEnchantment())) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SaprolingBurst.java b/Mage.Sets/src/mage/cards/s/SaprolingBurst.java index cdbd0282cfb..81752378f19 100644 --- a/Mage.Sets/src/mage/cards/s/SaprolingBurst.java +++ b/Mage.Sets/src/mage/cards/s/SaprolingBurst.java @@ -74,7 +74,7 @@ class SaprolingBurstCreateTokenEffect extends OneShotEffect { @SuppressWarnings("unchecked") public boolean apply(Game game, Ability source) { Token token = new SaprolingBurstToken(new MageObjectReference(source.getSourceObject(game), game)); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { Object object = game.getState().getValue(CardUtil.getCardZoneString("_tokensCreated", source.getSourceId(), game)); @@ -150,7 +150,7 @@ class SaprolingBurstDestroyEffect extends OneShotEffect { for (UUID tokenId : tokensCreated) { Permanent token = game.getPermanent(tokenId); if (token != null) { - token.destroy(source.getSourceId(), game, true); + token.destroy(source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SarkhanTheMad.java b/Mage.Sets/src/mage/cards/s/SarkhanTheMad.java index bdb98abb0bb..869260f3094 100644 --- a/Mage.Sets/src/mage/cards/s/SarkhanTheMad.java +++ b/Mage.Sets/src/mage/cards/s/SarkhanTheMad.java @@ -84,7 +84,7 @@ class SarkhanTheMadRevealAndDrawEffect extends OneShotEffect { if (card != null) { controller.moveCards(card, Zone.HAND, source, game); if (sourcePermanent != null) { - sourcePermanent.damage(card.getConvertedManaCost(), source.getSourceId(), game, false, false); + sourcePermanent.damage(card.getConvertedManaCost(), source.getSourceId(), source, game, false, false); } controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game); } @@ -117,12 +117,12 @@ class SarkhanTheMadSacEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget()); if (permanent != null) { - permanent.sacrifice(this.getId(), game); + permanent.sacrifice(source, game); Player player = game.getPlayer(permanent.getControllerId()); if(player != null) { Token dragonToken = new DragonToken2(); - dragonToken.putOntoBattlefield(1, game, this.getId(), player.getId()); + dragonToken.putOntoBattlefield(1, game, source, player.getId()); } } return false; @@ -159,7 +159,7 @@ class SarkhanTheMadDragonDamageEffect extends OneShotEffect { List dragons = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); if (dragons != null && !dragons.isEmpty()) { for (Permanent dragon : dragons) { - game.damagePlayerOrPlaneswalker(source.getFirstTarget(), dragon.getPower().getValue(), dragon.getId(), game, false, true); + game.damagePlayerOrPlaneswalker(source.getFirstTarget(), dragon.getPower().getValue(), dragon.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SarkhanTheMasterless.java b/Mage.Sets/src/mage/cards/s/SarkhanTheMasterless.java index 844679b4676..52e3ca4cb3b 100644 --- a/Mage.Sets/src/mage/cards/s/SarkhanTheMasterless.java +++ b/Mage.Sets/src/mage/cards/s/SarkhanTheMasterless.java @@ -80,7 +80,7 @@ class SarkhanTheMasterlessDamageEffect extends OneShotEffect { } for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { if (permanent != null && permanent.hasSubtype(SubType.DRAGON, game)) { - creature.damage(1, permanent.getId(), game); + creature.damage(1, permanent.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SarkhanUnbroken.java b/Mage.Sets/src/mage/cards/s/SarkhanUnbroken.java index 8690b7fb60d..a2475cf5c4c 100644 --- a/Mage.Sets/src/mage/cards/s/SarkhanUnbroken.java +++ b/Mage.Sets/src/mage/cards/s/SarkhanUnbroken.java @@ -82,7 +82,7 @@ class SarkhanUnbrokenAbility1 extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); game.fireUpdatePlayersEvent(); diff --git a/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVII.java b/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVII.java index 7867f2a8437..feb77de278f 100644 --- a/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVII.java +++ b/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVII.java @@ -125,7 +125,7 @@ class SarpadianEmpiresCreateSelectedTokenEffect extends OneShotEffect { token = new SaprolingToken(); break; } - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SaskiaTheUnyielding.java b/Mage.Sets/src/mage/cards/s/SaskiaTheUnyielding.java index 892576b7a09..76114ba2cfe 100644 --- a/Mage.Sets/src/mage/cards/s/SaskiaTheUnyielding.java +++ b/Mage.Sets/src/mage/cards/s/SaskiaTheUnyielding.java @@ -80,7 +80,7 @@ class SaskiaTheUnyieldingEffect extends OneShotEffect { Integer damage = (Integer) this.getValue("damage"); UUID sourceId = (UUID) this.getValue("sourceId"); if (sourceId != null && damage > 0) { - player.damage(damage, sourceId, game); + player.damage(damage, sourceId, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java b/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java index 762b17575d4..9a547da8406 100644 --- a/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java +++ b/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java @@ -68,7 +68,7 @@ class SatyrFiredancerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -124,7 +124,7 @@ class SatyrFiredancerDamageEffect extends OneShotEffect { if (targetCreature != null && controller != null) { int damage = (Integer) this.getValue("damage"); if (damage > 0) { - targetCreature.damage(damage, source.getSourceId(), game, false, true); + targetCreature.damage(damage, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SavageAlliance.java b/Mage.Sets/src/mage/cards/s/SavageAlliance.java index 74215c38f72..a29580ab7ba 100644 --- a/Mage.Sets/src/mage/cards/s/SavageAlliance.java +++ b/Mage.Sets/src/mage/cards/s/SavageAlliance.java @@ -134,7 +134,7 @@ class SavageAllianceDamageEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(player.getId())); List creatures = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent creature : creatures) { - creature.damage(1, source.getSourceId(), game, false, true); + creature.damage(1, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SavageFirecat.java b/Mage.Sets/src/mage/cards/s/SavageFirecat.java index 0187df8c7e6..6a5849ec383 100644 --- a/Mage.Sets/src/mage/cards/s/SavageFirecat.java +++ b/Mage.Sets/src/mage/cards/s/SavageFirecat.java @@ -18,6 +18,7 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; /** * @@ -35,8 +36,10 @@ public final class SavageFirecat extends CardImpl { // Trample this.addAbility(TrampleAbility.getInstance()); + // Savage Firecat enters the battlefield with seven +1/+1 counters on it. this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(7)))); + // Whenever you tap a land for mana, remove a +1/+1 counter from Savage Firecat. this.addAbility(new SavageFirecatTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()))); @@ -69,16 +72,17 @@ class SavageFirecatTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { if (game.inCheckPlayableState()) { // Ignored - see GameEvent.TAPPED_FOR_MANA return false; - } - return game.getCard(event.getSourceId()).isLand() && - event.getPlayerId().equals(this.controllerId); + } + + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + return permanent != null && permanent.isLand() && event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index dc30ebe070f..99edf6e2d76 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -273,7 +273,7 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SavingGrace.java b/Mage.Sets/src/mage/cards/s/SavingGrace.java index bf4a045014f..086fea3169c 100644 --- a/Mage.Sets/src/mage/cards/s/SavingGrace.java +++ b/Mage.Sets/src/mage/cards/s/SavingGrace.java @@ -131,7 +131,7 @@ class SavingGraceReplacementEffect extends ReplacementEffectImpl { } game.informPlayers(message.toString()); // Redirect damage - creature.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + creature.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SavraQueenOfTheGolgari.java b/Mage.Sets/src/mage/cards/s/SavraQueenOfTheGolgari.java index 9d5f65d64a6..8a24b43040b 100644 --- a/Mage.Sets/src/mage/cards/s/SavraQueenOfTheGolgari.java +++ b/Mage.Sets/src/mage/cards/s/SavraQueenOfTheGolgari.java @@ -74,7 +74,7 @@ class SavraSacrificeBlackCreatureAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override @@ -116,7 +116,7 @@ class SavraSacrificeEffect extends OneShotEffect { if (player != null && !playerId.equals(source.getControllerId())) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -125,7 +125,7 @@ class SavraSacrificeEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; @@ -151,7 +151,7 @@ class SavraSacrificeGreenCreatureAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SawtoothLoon.java b/Mage.Sets/src/mage/cards/s/SawtoothLoon.java index d6cccfa11ff..50ac3eef217 100644 --- a/Mage.Sets/src/mage/cards/s/SawtoothLoon.java +++ b/Mage.Sets/src/mage/cards/s/SawtoothLoon.java @@ -84,7 +84,7 @@ class SawtoothLoonEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(2, source.getSourceId(), game); + controller.drawCards(2, source, game); TargetCardInHand target = new TargetCardInHand(2, 2, new FilterCard()); controller.chooseTarget(Outcome.Detriment, target, source, game); Cards cardsToLibrary = new CardsImpl(target.getTargets()); diff --git a/Mage.Sets/src/mage/cards/s/SawtuskDemolisher.java b/Mage.Sets/src/mage/cards/s/SawtuskDemolisher.java index 8e90904631c..0cc6b8e3ec5 100644 --- a/Mage.Sets/src/mage/cards/s/SawtuskDemolisher.java +++ b/Mage.Sets/src/mage/cards/s/SawtuskDemolisher.java @@ -87,7 +87,7 @@ class SawtuskDemolisherEffect extends OneShotEffect { return false; } Player player = game.getPlayer(permanent.getControllerId()); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (player == null) { return false; } diff --git a/Mage.Sets/src/mage/cards/s/ScalelordReckoner.java b/Mage.Sets/src/mage/cards/s/ScalelordReckoner.java index a1189e468f2..bbba43ef1fa 100644 --- a/Mage.Sets/src/mage/cards/s/ScalelordReckoner.java +++ b/Mage.Sets/src/mage/cards/s/ScalelordReckoner.java @@ -74,7 +74,7 @@ class ScalelardReckonerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/Scapeshift.java b/Mage.Sets/src/mage/cards/s/Scapeshift.java index b4eb29e6ee3..4e9508fe7be 100644 --- a/Mage.Sets/src/mage/cards/s/Scapeshift.java +++ b/Mage.Sets/src/mage/cards/s/Scapeshift.java @@ -69,7 +69,7 @@ class ScapeshiftEffect extends OneShotEffect { for (UUID uuid : sacrificeLand.getTargets()) { Permanent land = game.getPermanent(uuid); if (land != null) { - land.sacrifice(source.getSourceId(), game); + land.sacrifice(source, game); amount++; } } diff --git a/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java b/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java index 78bbebd0cb4..2689a34de7e 100644 --- a/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java +++ b/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java @@ -56,7 +56,7 @@ class ScarscaleRitualCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controllerId, game)) { return permanent != null; } @@ -64,7 +64,7 @@ class ScarscaleRitualCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(ability.getControllerId()); if (controller != null) { Target target = new TargetControlledCreaturePermanent(); diff --git a/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java b/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java index 1677f7eb35e..52feaa71676 100644 --- a/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java +++ b/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java @@ -114,10 +114,10 @@ class DoUnlessAnyOpponentPaysEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && player.canRespond() && !player.equals(controller) - && cost.canPay(source, source.getSourceId(), player.getId(), game) + && cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } diff --git a/Mage.Sets/src/mage/cards/s/ScatteringStroke.java b/Mage.Sets/src/mage/cards/s/ScatteringStroke.java index cfc42da922f..71ba7c1f309 100644 --- a/Mage.Sets/src/mage/cards/s/ScatteringStroke.java +++ b/Mage.Sets/src/mage/cards/s/ScatteringStroke.java @@ -64,7 +64,7 @@ class ScatteringStrokeEffect extends OneShotEffect { Spell spell = (Spell) game.getStack().getStackObject(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && spell != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); if (ClashEffect.getInstance().apply(game, source)) { Effect effect = new AddManaToManaPoolSourceControllerEffect(new Mana(0, 0, 0, 0, 0, 0, 0, spell.getConvertedManaCost())); AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility diff --git a/Mage.Sets/src/mage/cards/s/ScavengingOoze.java b/Mage.Sets/src/mage/cards/s/ScavengingOoze.java index 75b771379a2..3fbd0cc29ba 100644 --- a/Mage.Sets/src/mage/cards/s/ScavengingOoze.java +++ b/Mage.Sets/src/mage/cards/s/ScavengingOoze.java @@ -70,7 +70,7 @@ class ScavengingOozeEffect extends OneShotEffect { Card card = game.getCard(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); if (card.isCreature()) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { diff --git a/Mage.Sets/src/mage/cards/s/ScentOfBrine.java b/Mage.Sets/src/mage/cards/s/ScentOfBrine.java index 1b458207957..ecc1678d284 100644 --- a/Mage.Sets/src/mage/cards/s/ScentOfBrine.java +++ b/Mage.Sets/src/mage/cards/s/ScentOfBrine.java @@ -67,7 +67,7 @@ class ScentOfBrineEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/s/ScentOfCinder.java b/Mage.Sets/src/mage/cards/s/ScentOfCinder.java index 0ef39ec7924..13bd015801a 100644 --- a/Mage.Sets/src/mage/cards/s/ScentOfCinder.java +++ b/Mage.Sets/src/mage/cards/s/ScentOfCinder.java @@ -66,7 +66,7 @@ class ScentOfCinderEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/s/ScentOfIvy.java b/Mage.Sets/src/mage/cards/s/ScentOfIvy.java index 68d1f746354..91685f6f91e 100644 --- a/Mage.Sets/src/mage/cards/s/ScentOfIvy.java +++ b/Mage.Sets/src/mage/cards/s/ScentOfIvy.java @@ -67,7 +67,7 @@ class ScentOfIvyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java b/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java index a997bc36508..0e3f5168dc4 100644 --- a/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java +++ b/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java @@ -64,7 +64,7 @@ class ScentOfJasmineEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/s/ScentOfNightshade.java b/Mage.Sets/src/mage/cards/s/ScentOfNightshade.java index e5c3dffa2b1..11b05c2f310 100644 --- a/Mage.Sets/src/mage/cards/s/ScentOfNightshade.java +++ b/Mage.Sets/src/mage/cards/s/ScentOfNightshade.java @@ -68,7 +68,7 @@ class ScentOfNightshadeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (!cost.pay(source, game, source, source.getControllerId(), true)) { return false; } int xValue = -1 * cost.getNumberRevealedCards(); diff --git a/Mage.Sets/src/mage/cards/s/ScepterOfEmpires.java b/Mage.Sets/src/mage/cards/s/ScepterOfEmpires.java index 8455a23f8b2..9d4c9116f27 100644 --- a/Mage.Sets/src/mage/cards/s/ScepterOfEmpires.java +++ b/Mage.Sets/src/mage/cards/s/ScepterOfEmpires.java @@ -65,7 +65,7 @@ class ScepterOfEmpiresEffect extends OneShotEffect { } } int amount = throne && crown ? 3 : 1; - return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), amount, source.getSourceId(), game, false, true) > 0; + return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), amount, source.getSourceId(), source, game, false, true) > 0; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ScholarOfAthreos.java b/Mage.Sets/src/mage/cards/s/ScholarOfAthreos.java index aebf8005de6..e6535d5c99f 100644 --- a/Mage.Sets/src/mage/cards/s/ScholarOfAthreos.java +++ b/Mage.Sets/src/mage/cards/s/ScholarOfAthreos.java @@ -60,7 +60,7 @@ class ScholarOfAthreosEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if(opponent != null) { - lifeLost += opponent.loseLife(1, game, false); + lifeLost += opponent.loseLife(1, game, source, false); } } game.getPlayer(source.getControllerId()).gainLife(lifeLost, game, source); diff --git a/Mage.Sets/src/mage/cards/s/ScourgeOfNumai.java b/Mage.Sets/src/mage/cards/s/ScourgeOfNumai.java index 7d315669c7c..d92c46f740e 100644 --- a/Mage.Sets/src/mage/cards/s/ScourgeOfNumai.java +++ b/Mage.Sets/src/mage/cards/s/ScourgeOfNumai.java @@ -65,7 +65,7 @@ class ScourgeOfNumaiEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (game.getBattlefield().countAll(new FilterCreaturePermanent(SubType.OGRE, "Ogre"), source.getControllerId(), game) < 1) { - controller.loseLife(2, game, false); + controller.loseLife(2, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/ScourgeOfTheSkyclaves.java b/Mage.Sets/src/mage/cards/s/ScourgeOfTheSkyclaves.java index f818b249970..492050a6954 100644 --- a/Mage.Sets/src/mage/cards/s/ScourgeOfTheSkyclaves.java +++ b/Mage.Sets/src/mage/cards/s/ScourgeOfTheSkyclaves.java @@ -128,7 +128,7 @@ class ScourgeOfTheSkyclavesEffect extends OneShotEffect { continue; } int lifeToLose = (int) Math.ceil(player.getLife() / 2.0); - player.loseLife(lifeToLose, game, false); + player.loseLife(lifeToLose, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java b/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java index 27c638bd370..b5ce0a50788 100644 --- a/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java +++ b/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java @@ -93,11 +93,11 @@ class ScourgeOfValkasDamageEffect extends OneShotEffect { } Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.damage(dragons, enteringDragon.getId(), game, false, true); + permanent.damage(dragons, enteringDragon.getId(), source, game, false, true); } else { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player != null) { - player.damage(dragons, enteringDragon.getId(), game); + player.damage(dragons, enteringDragon.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/ScouringSands.java b/Mage.Sets/src/mage/cards/s/ScouringSands.java index 77909b9b946..fddb58727c4 100644 --- a/Mage.Sets/src/mage/cards/s/ScouringSands.java +++ b/Mage.Sets/src/mage/cards/s/ScouringSands.java @@ -61,7 +61,7 @@ class ScouringSandsDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != null) { - creature.damage(1, source.getSourceId(), game, false, false); + creature.damage(1, source.getSourceId(), source, game, false, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/ScrapMastery.java b/Mage.Sets/src/mage/cards/s/ScrapMastery.java index da66896e4a1..f393ab7196d 100644 --- a/Mage.Sets/src/mage/cards/s/ScrapMastery.java +++ b/Mage.Sets/src/mage/cards/s/ScrapMastery.java @@ -77,7 +77,7 @@ class ScrapMasteryEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), playerId, game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/ScrapTrawler.java b/Mage.Sets/src/mage/cards/s/ScrapTrawler.java index 65de4ee26e5..aba9ca44cc6 100644 --- a/Mage.Sets/src/mage/cards/s/ScrapTrawler.java +++ b/Mage.Sets/src/mage/cards/s/ScrapTrawler.java @@ -70,7 +70,7 @@ class ScrapTrawlerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/Scrapheap.java b/Mage.Sets/src/mage/cards/s/Scrapheap.java index 78385f1a2fa..18128f4dc61 100644 --- a/Mage.Sets/src/mage/cards/s/Scrapheap.java +++ b/Mage.Sets/src/mage/cards/s/Scrapheap.java @@ -56,7 +56,7 @@ class ScrapheapTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ScreechingBat.java b/Mage.Sets/src/mage/cards/s/ScreechingBat.java index 65864ec5c02..56ea12b935b 100644 --- a/Mage.Sets/src/mage/cards/s/ScreechingBat.java +++ b/Mage.Sets/src/mage/cards/s/ScreechingBat.java @@ -72,7 +72,7 @@ class ScreechingBatBeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImp @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -107,7 +107,7 @@ class ScreechingBatTransformSourceEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { Cost cost = new ManaCostsImpl("{2}{B}{B}"); - if (cost.pay(source, game, permanent.getControllerId(), permanent.getControllerId(), false, null)) { + if (cost.pay(source, game, source, permanent.getControllerId(), false, null)) { if (permanent.isTransformable()) { permanent.setTransformed(!permanent.isTransformed()); } diff --git a/Mage.Sets/src/mage/cards/s/ScribNibblers.java b/Mage.Sets/src/mage/cards/s/ScribNibblers.java index 8b47ffbf42f..358155e65a1 100644 --- a/Mage.Sets/src/mage/cards/s/ScribNibblers.java +++ b/Mage.Sets/src/mage/cards/s/ScribNibblers.java @@ -74,7 +74,7 @@ class ScribNibblersEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null && targetPlayer.getLibrary().hasCards()) { Card card = targetPlayer.getLibrary().getFromTop(game); - card.moveToExile(id, "Scrib Nibblers Exile", source.getSourceId(), game); + card.moveToExile(id, "Scrib Nibblers Exile", source, game); if (card.isLand() && you != null) { you.gainLife(1, game, source); return true; diff --git a/Mage.Sets/src/mage/cards/s/ScrollRack.java b/Mage.Sets/src/mage/cards/s/ScrollRack.java index dff971eb118..10a065738c1 100644 --- a/Mage.Sets/src/mage/cards/s/ScrollRack.java +++ b/Mage.Sets/src/mage/cards/s/ScrollRack.java @@ -65,7 +65,7 @@ class ScrollRackEffect extends OneShotEffect { TargetCardInHand target = new TargetCardInHand(0, controller.getHand().size(), filter); target.setRequired(false); int amountExiled = 0; - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { for (UUID targetId : target.getTargets()) { Card card = game.getCard(targetId); diff --git a/Mage.Sets/src/mage/cards/s/Scrounge.java b/Mage.Sets/src/mage/cards/s/Scrounge.java index b5d2f7cc2a0..b27c39625c4 100644 --- a/Mage.Sets/src/mage/cards/s/Scrounge.java +++ b/Mage.Sets/src/mage/cards/s/Scrounge.java @@ -64,7 +64,7 @@ class ScroungeEffect extends OneShotEffect { filter.add(new OwnerIdPredicate(opponent.getId())); TargetCardInGraveyard chosenCard = new TargetCardInGraveyard(filter); chosenCard.setNotTarget(true); - if (chosenCard.canChoose(opponent.getId(), game)) { + if (chosenCard.canChoose(source.getSourceId(), opponent.getId(), game)) { opponent.chooseTarget(Outcome.ReturnToHand, chosenCard, source, game); Card card = game.getCard(chosenCard.getFirstTarget()); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/s/ScroungingBandar.java b/Mage.Sets/src/mage/cards/s/ScroungingBandar.java index c9421d3b053..e96d91daa85 100644 --- a/Mage.Sets/src/mage/cards/s/ScroungingBandar.java +++ b/Mage.Sets/src/mage/cards/s/ScroungingBandar.java @@ -90,7 +90,7 @@ class ScroungingBandarEffect extends OneShotEffect { if (amountCounters > 0) { int amountToMove = controller.getAmount(0, amountCounters, "How many counters do you want to move?", game); if (amountToMove > 0) { - fromPermanent.removeCounters(CounterType.P1P1.createInstance(amountToMove), game); + fromPermanent.removeCounters(CounterType.P1P1.createInstance(amountToMove), source, game); toPermanent.addCounters(CounterType.P1P1.createInstance(amountToMove), source, game); } } diff --git a/Mage.Sets/src/mage/cards/s/ScryingGlass.java b/Mage.Sets/src/mage/cards/s/ScryingGlass.java index f0fd0cc4e92..ff7699cdbde 100644 --- a/Mage.Sets/src/mage/cards/s/ScryingGlass.java +++ b/Mage.Sets/src/mage/cards/s/ScryingGlass.java @@ -71,7 +71,7 @@ class ScryingGlassEffect extends OneShotEffect { targetOpponent.revealCards(source, targetOpponent.getHand(), game); if (targetOpponent.getHand().count(filter, game) == amount) { game.informPlayers(controller.getName() + " has chosen the exact number and color of the revealed cards from " + targetOpponent.getName() + "'s hand. They draw a card."); - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); return true; } else { game.informPlayers(controller.getName() + " has chosen incorrectly and will not draw a card."); diff --git a/Mage.Sets/src/mage/cards/s/ScuteMob.java b/Mage.Sets/src/mage/cards/s/ScuteMob.java index 9a464f96928..c45e2c4f260 100644 --- a/Mage.Sets/src/mage/cards/s/ScuteMob.java +++ b/Mage.Sets/src/mage/cards/s/ScuteMob.java @@ -62,7 +62,7 @@ class ScuteMobAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ScytheSpecter.java b/Mage.Sets/src/mage/cards/s/ScytheSpecter.java index baf78776926..b0eddf39d85 100644 --- a/Mage.Sets/src/mage/cards/s/ScytheSpecter.java +++ b/Mage.Sets/src/mage/cards/s/ScytheSpecter.java @@ -89,7 +89,7 @@ class ScytheSpecterEffect extends OneShotEffect { for (UUID opponentId : cardDiscarded.keySet()) {//discard must happen simultaneously Player player = game.getPlayer(opponentId); if (player != null - && player.discard(cardDiscarded.get(opponentId), source, game)) { + && player.discard(cardDiscarded.get(opponentId), false, source, game)) { discardedCheck.put(opponentId, 1);//note that a card was discarded } } @@ -100,7 +100,7 @@ class ScytheSpecterEffect extends OneShotEffect { Player opponent = game.getPlayer(playerId); if (opponent != null && discardedCheck.get(playerId) == 1) {//check that card was discarded - opponent.loseLife(highestCMC, game, false); + opponent.loseLife(highestCMC, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/SearchTheCity.java b/Mage.Sets/src/mage/cards/s/SearchTheCity.java index 0522121de16..35a787928d2 100644 --- a/Mage.Sets/src/mage/cards/s/SearchTheCity.java +++ b/Mage.Sets/src/mage/cards/s/SearchTheCity.java @@ -69,7 +69,7 @@ class SearchTheCityExileEffect extends OneShotEffect { for (int i = 0; i < 5; i++) { if (player.getLibrary().hasCards()) { Card topCard = player.getLibrary().getFromTop(game); - topCard.moveToExile(source.getSourceId(), "Cards exiled by Search the City", source.getSourceId(), game); + topCard.moveToExile(source.getSourceId(), "Cards exiled by Search the City", source, game); } } return true; @@ -96,7 +96,7 @@ class SearchTheCityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST || event.getType() == EventType.LAND_PLAYED; + return event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED; } @Override @@ -158,14 +158,14 @@ class SearchTheCityExiledCardToHandEffect extends OneShotEffect { if (cardName != null && searchTheCityExileZone != null) { for (Card card : searchTheCityExileZone.getCards(game)) { if (CardUtil.haveSameNames(card, cardName, game)) { - if (card.moveToZone(Zone.HAND, source.getSourceId(), game, true)) { + if (card.moveToZone(Zone.HAND, source, game, true)) { game.informPlayers("Search the City: put " + card.getName() + " into owner's hand"); } searchTheCityExileZone.remove(card); if (searchTheCityExileZone.isEmpty()) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); // extra turn game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), false)); } diff --git a/Mage.Sets/src/mage/cards/s/SearingBlaze.java b/Mage.Sets/src/mage/cards/s/SearingBlaze.java index 03c5e9287c4..49871698f5d 100644 --- a/Mage.Sets/src/mage/cards/s/SearingBlaze.java +++ b/Mage.Sets/src/mage/cards/s/SearingBlaze.java @@ -73,9 +73,9 @@ class SearingBlazeEffect extends OneShotEffect { if (watcher != null && watcher.landPlayed(source.getControllerId())) { damage = 3; } - game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), damage, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), damage, source.getSourceId(), source, game, false, true); if (creature != null) { - creature.damage(damage, source.getSourceId(), game, false, true); + creature.damage(damage, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SearingBlood.java b/Mage.Sets/src/mage/cards/s/SearingBlood.java index 36ad3cf7c1a..bdb781fdd2c 100644 --- a/Mage.Sets/src/mage/cards/s/SearingBlood.java +++ b/Mage.Sets/src/mage/cards/s/SearingBlood.java @@ -85,7 +85,7 @@ class SearingBloodDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -134,7 +134,7 @@ class SearingBloodDelayedEffect extends OneShotEffect { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { MageObject sourceObject = source.getSourceObject(game); - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SearingRays.java b/Mage.Sets/src/mage/cards/s/SearingRays.java index 9061960fb94..e24567d11d4 100644 --- a/Mage.Sets/src/mage/cards/s/SearingRays.java +++ b/Mage.Sets/src/mage/cards/s/SearingRays.java @@ -65,7 +65,7 @@ class SearingRaysEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java b/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java index 35ec167b157..fa08afef00d 100644 --- a/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java +++ b/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java @@ -20,6 +20,7 @@ import mage.constants.TargetController; import mage.constants.WatcherScope; import mage.filter.StaticFilters; import mage.game.Game; +import mage.game.events.DeclareAttackerEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -99,7 +100,7 @@ class SeasonOfTheWitchEffect extends OneShotEffect { continue; } // Destroy the rest. - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } @@ -129,8 +130,7 @@ class CouldAttackThisTurnWatcher extends Watcher { if (permanent.canAttack(defender, game)) { // exclude Propaganda style effects if (!game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects( - GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, - defender, permanent.getId(), permanent.getControllerId()), game)) { + new DeclareAttackerEvent(defender, permanent.getId(), permanent.getControllerId()), game)) { this.couldAttackThisTurnCreatures.add(new MageObjectReference(permanent.getId(), game)); break; } diff --git a/Mage.Sets/src/mage/cards/s/SeasonedPyromancer.java b/Mage.Sets/src/mage/cards/s/SeasonedPyromancer.java index f1e705b89d0..062c656d7a6 100644 --- a/Mage.Sets/src/mage/cards/s/SeasonedPyromancer.java +++ b/Mage.Sets/src/mage/cards/s/SeasonedPyromancer.java @@ -82,15 +82,13 @@ class SeasonedPyromancerEffect extends OneShotEffect { return false; } int nonlands = player - .discard(2, false, source, game) + .discard(2, false, false, source, game) .count(StaticFilters.FILTER_CARD_NON_LAND, game); - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); if (nonlands == 0) { return true; } - new RedElementalToken().putOntoBattlefield( - nonlands, game, source.getSourceId(), source.getControllerId() - ); + new RedElementalToken().putOntoBattlefield(nonlands, game, source, source.getControllerId()); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SeasonsBeatings.java b/Mage.Sets/src/mage/cards/s/SeasonsBeatings.java index f46c0688cd4..644ef03e675 100644 --- a/Mage.Sets/src/mage/cards/s/SeasonsBeatings.java +++ b/Mage.Sets/src/mage/cards/s/SeasonsBeatings.java @@ -78,7 +78,7 @@ class SeasonsBeatingsEffect extends OneShotEffect { } Permanent creature2 = game.getPermanent(creatures.get(other)); if (creature != null && creature2 != null) { - creature2.damage(creature.getPower().getValue(), creature.getId(), game, false, true); + creature2.damage(creature.getPower().getValue(), creature.getId(), source, game, false, true); } } diff --git a/Mage.Sets/src/mage/cards/s/SecondSunrise.java b/Mage.Sets/src/mage/cards/s/SecondSunrise.java index 3d173af8853..cd28e78d7b8 100644 --- a/Mage.Sets/src/mage/cards/s/SecondSunrise.java +++ b/Mage.Sets/src/mage/cards/s/SecondSunrise.java @@ -64,7 +64,7 @@ class SecondSunriseEffect extends OneShotEffect { if (c != null && game.getState().getZone(id) == Zone.GRAVEYARD) { if (c.isArtifact() || c.isCreature() || c.isEnchantment() || c.isLand()) - c.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + c.moveToZone(Zone.BATTLEFIELD, source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SecureTheScene.java b/Mage.Sets/src/mage/cards/s/SecureTheScene.java index 56805119155..77184c9dc44 100644 --- a/Mage.Sets/src/mage/cards/s/SecureTheScene.java +++ b/Mage.Sets/src/mage/cards/s/SecureTheScene.java @@ -63,6 +63,6 @@ class SecureTheSceneEffect extends OneShotEffect { if (permanent == null) { return false; } - return token.putOntoBattlefield(1, game, source.getSourceId(), permanent.getControllerId()); + return token.putOntoBattlefield(1, game, source, permanent.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/s/SeeBeyond.java b/Mage.Sets/src/mage/cards/s/SeeBeyond.java index aedd6c6073a..67795fbd2b6 100644 --- a/Mage.Sets/src/mage/cards/s/SeeBeyond.java +++ b/Mage.Sets/src/mage/cards/s/SeeBeyond.java @@ -53,7 +53,7 @@ class SeeBeyondEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if(controller != null) { - controller.drawCards(2, source.getSourceId(), game); + controller.drawCards(2, source, game); if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to shuffle into your library")); controller.choose(Outcome.Detriment, controller.getHand(), target, game); diff --git a/Mage.Sets/src/mage/cards/s/SeedsOfInnocence.java b/Mage.Sets/src/mage/cards/s/SeedsOfInnocence.java index d5eb50421e7..f26a88c6eee 100644 --- a/Mage.Sets/src/mage/cards/s/SeedsOfInnocence.java +++ b/Mage.Sets/src/mage/cards/s/SeedsOfInnocence.java @@ -60,7 +60,7 @@ class SeedsOfInnocenceEffect extends OneShotEffect { for (Permanent artifact : game.getState().getBattlefield().getActivePermanents(new FilterArtifactPermanent(), controller.getId(), game)) { Player artifactController = game.getPlayer(artifact.getControllerId()); int cmc = artifact.getConvertedManaCost(); - if (artifact.destroy(source.getSourceId(), game, true)) { + if (artifact.destroy(source, game, true)) { if(artifactController != null) { artifactController.gainLife(cmc, game, source); } diff --git a/Mage.Sets/src/mage/cards/s/Seizures.java b/Mage.Sets/src/mage/cards/s/Seizures.java index 53c1565a08e..4c05c63a026 100644 --- a/Mage.Sets/src/mage/cards/s/Seizures.java +++ b/Mage.Sets/src/mage/cards/s/Seizures.java @@ -84,14 +84,14 @@ class SeizuresEffect extends OneShotEffect { Player player = game.getPlayer(enchanted.getControllerId()); if (player != null) { Cost cost = new ManaCostsImpl("{3}"); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " to avoid damage?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { return true; } } - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SekkiSeasonsGuide.java b/Mage.Sets/src/mage/cards/s/SekkiSeasonsGuide.java index 3813083f169..48ada43683d 100644 --- a/Mage.Sets/src/mage/cards/s/SekkiSeasonsGuide.java +++ b/Mage.Sets/src/mage/cards/s/SekkiSeasonsGuide.java @@ -93,7 +93,7 @@ class SekkiSeasonsGuideEffect extends PreventionEffectImpl { preventDamageAction(event, source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); + permanent.removeCounters(CounterType.P1P1.createInstance(damage), source, game); } new CreateTokenEffect(new SpiritToken(), damage).apply(game, source); return true; diff --git a/Mage.Sets/src/mage/cards/s/SelectiveMemory.java b/Mage.Sets/src/mage/cards/s/SelectiveMemory.java index 83966eb4146..eaecdd19123 100644 --- a/Mage.Sets/src/mage/cards/s/SelectiveMemory.java +++ b/Mage.Sets/src/mage/cards/s/SelectiveMemory.java @@ -63,7 +63,7 @@ class SelectiveMemoryEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Card card = player.getLibrary().remove(targetId, game); if (card != null) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SelfInflictedWound.java b/Mage.Sets/src/mage/cards/s/SelfInflictedWound.java index a78d9bbcaf2..e27c9cb03de 100644 --- a/Mage.Sets/src/mage/cards/s/SelfInflictedWound.java +++ b/Mage.Sets/src/mage/cards/s/SelfInflictedWound.java @@ -77,8 +77,8 @@ class SelfInflictedWoundEffect extends OneShotEffect { targetOpponent.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { - targetOpponent.loseLife(2, game, false); + if (permanent.sacrifice(source, game)) { + targetOpponent.loseLife(2, game, source, false); } } diff --git a/Mage.Sets/src/mage/cards/s/SelflessExorcist.java b/Mage.Sets/src/mage/cards/s/SelflessExorcist.java index 1f9c1170c27..24c1e648e98 100644 --- a/Mage.Sets/src/mage/cards/s/SelflessExorcist.java +++ b/Mage.Sets/src/mage/cards/s/SelflessExorcist.java @@ -81,7 +81,7 @@ class SelflessExorcistEffect extends OneShotEffect { if (permanent == null) { return true; } - permanent.damage(card.getPower().getValue(), card.getId(), game); + permanent.damage(card.getPower().getValue(), card.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java b/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java index cb8b9077a36..24fa1da3a10 100644 --- a/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java +++ b/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java @@ -98,7 +98,7 @@ class SelvalaHeartOfTheWildsEffect extends OneShotEffect { Player permanentController = game.getPlayer(permanent.getControllerId()); if (permanentController != null && permanentController.chooseUse(Outcome.DrawCard, "Would you like to draw a card?", source, game)) { - permanentController.drawCards(1, source.getSourceId(), game); + permanentController.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java b/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java index 7cfdf8817bd..e09b7721d58 100644 --- a/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java +++ b/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java @@ -66,7 +66,7 @@ class SemblanceAnvilEffect extends OneShotEffect { player.choose(Outcome.Benefit, player.getHand(), target, game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - card.moveToExile(getId(), "Semblance Anvil (Imprint)", source.getSourceId(), game); + card.moveToExile(getId(), "Semblance Anvil (Imprint)", source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); diff --git a/Mage.Sets/src/mage/cards/s/SengirNosferatu.java b/Mage.Sets/src/mage/cards/s/SengirNosferatu.java index b172882f899..37a5fd851ea 100644 --- a/Mage.Sets/src/mage/cards/s/SengirNosferatu.java +++ b/Mage.Sets/src/mage/cards/s/SengirNosferatu.java @@ -93,7 +93,7 @@ class ReturnSengirNosferatuEffect extends OneShotEffect { player.chooseTarget(Outcome.PutCreatureInPlay, target, source, game); Card card = game.getCard(target.getTargets().get(0)); if (card != null) { - return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + return card.moveToZone(Zone.BATTLEFIELD, source, game, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/s/SepticRats.java b/Mage.Sets/src/mage/cards/s/SepticRats.java index c51c01fb0ad..6be30d92fe1 100644 --- a/Mage.Sets/src/mage/cards/s/SepticRats.java +++ b/Mage.Sets/src/mage/cards/s/SepticRats.java @@ -61,7 +61,7 @@ class SepticRatsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/Seraph.java b/Mage.Sets/src/mage/cards/s/Seraph.java index eadf1a19b62..0a04d962bb5 100644 --- a/Mage.Sets/src/mage/cards/s/Seraph.java +++ b/Mage.Sets/src/mage/cards/s/Seraph.java @@ -111,17 +111,17 @@ class SeraphDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_CONTROL - || event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.LOST_CONTROL + || event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.LOST_CONTROL - && event.getSourceId().equals(seraph)) { + if (event.getType() == GameEvent.EventType.LOST_CONTROL + && event.getTargetId().equals(seraph)) { return true; } - if (event.getType() == EventType.ZONE_CHANGE + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(seraph)) { return true; } diff --git a/Mage.Sets/src/mage/cards/s/SeraphicGreatsword.java b/Mage.Sets/src/mage/cards/s/SeraphicGreatsword.java index e489844eeff..8b2ee1dacf1 100644 --- a/Mage.Sets/src/mage/cards/s/SeraphicGreatsword.java +++ b/Mage.Sets/src/mage/cards/s/SeraphicGreatsword.java @@ -125,8 +125,7 @@ class SeraphicGreatswordEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - return new AngelToken().putOntoBattlefield( - 1, game, source.getSourceId(), source.getControllerId(), true, true, playerId - ); + return new AngelToken() + .putOntoBattlefield(1, game, source, source.getControllerId(), true, true, playerId); } } diff --git a/Mage.Sets/src/mage/cards/s/SerendibDjinn.java b/Mage.Sets/src/mage/cards/s/SerendibDjinn.java index 5fbfcd2bf93..b9f63b2e109 100644 --- a/Mage.Sets/src/mage/cards/s/SerendibDjinn.java +++ b/Mage.Sets/src/mage/cards/s/SerendibDjinn.java @@ -76,9 +76,9 @@ class SerendibDjinnEffect extends OneShotEffect { controller.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); if (permanent.hasSubtype(SubType.ISLAND, game)) { - controller.damage(3, source.getSourceId(), game); + controller.damage(3, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SerpentineSpike.java b/Mage.Sets/src/mage/cards/s/SerpentineSpike.java index 1f60475aee1..29d3a87b9ff 100644 --- a/Mage.Sets/src/mage/cards/s/SerpentineSpike.java +++ b/Mage.Sets/src/mage/cards/s/SerpentineSpike.java @@ -86,15 +86,15 @@ class SerpentineSpikeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getTargets().get(0).getFirstTarget()); if (permanent != null) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); } permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); } permanent = game.getPermanent(source.getTargets().get(2).getFirstTarget()); if (permanent != null) { - permanent.damage(4, source.getSourceId(), game, false, true); + permanent.damage(4, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SerraAvenger.java b/Mage.Sets/src/mage/cards/s/SerraAvenger.java index 1ddb5e47d22..caa5df031a5 100644 --- a/Mage.Sets/src/mage/cards/s/SerraAvenger.java +++ b/Mage.Sets/src/mage/cards/s/SerraAvenger.java @@ -77,7 +77,7 @@ class CantCastSerraAvengerEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) { + if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) { Player controller = game.getPlayer(source.getControllerId()); // it can be cast on other players turn 1 - 3 if some effect let allow you to do this if (controller != null && controller.getTurns() <= 3 && game.isActivePlayer(source.getControllerId())) { diff --git a/Mage.Sets/src/mage/cards/s/SerumPowder.java b/Mage.Sets/src/mage/cards/s/SerumPowder.java index 0f9ac2704e6..339496c67cb 100644 --- a/Mage.Sets/src/mage/cards/s/SerumPowder.java +++ b/Mage.Sets/src/mage/cards/s/SerumPowder.java @@ -67,9 +67,9 @@ class SerumPowderReplaceEffect extends ReplacementEffectImpl { if (cardsHand > 0){ Cards cards = new CardsImpl(controller.getHand()); for (Card card: cards.getCards(game)) { - card.moveToExile(null, null, source.getSourceId(), game); + card.moveToExile(null, null, source, game); } - controller.drawCards(cardsHand, source.getSourceId(), game); + controller.drawCards(cardsHand, source, game); // original event is not a draw event, so skip it in params } game.informPlayers(sourceCard.getLogName() +": " + controller.getLogName() + " exiles hand and draws " + cardsHand + " card(s)"); return true; diff --git a/Mage.Sets/src/mage/cards/s/ServantOfTymaret.java b/Mage.Sets/src/mage/cards/s/ServantOfTymaret.java index eb4bfbc3ef2..588de98bdd0 100644 --- a/Mage.Sets/src/mage/cards/s/ServantOfTymaret.java +++ b/Mage.Sets/src/mage/cards/s/ServantOfTymaret.java @@ -62,7 +62,7 @@ class ServantOfTymaretEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int lostAmount = 0; for (UUID opponentId: game.getOpponents(source.getControllerId())) { - lostAmount += game.getPlayer(opponentId).loseLife(1, game, false); + lostAmount += game.getPlayer(opponentId).loseLife(1, game, source, false); } game.getPlayer(source.getControllerId()).gainLife(lostAmount, game, source); return true; diff --git a/Mage.Sets/src/mage/cards/s/SeshiroTheAnointed.java b/Mage.Sets/src/mage/cards/s/SeshiroTheAnointed.java index 9753db7a697..a529da7e214 100644 --- a/Mage.Sets/src/mage/cards/s/SeshiroTheAnointed.java +++ b/Mage.Sets/src/mage/cards/s/SeshiroTheAnointed.java @@ -73,7 +73,7 @@ class SeshiroTheAnointedAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SeverTheBloodline.java b/Mage.Sets/src/mage/cards/s/SeverTheBloodline.java index dfde359a4f6..5a5aa5e629c 100644 --- a/Mage.Sets/src/mage/cards/s/SeverTheBloodline.java +++ b/Mage.Sets/src/mage/cards/s/SeverTheBloodline.java @@ -75,7 +75,7 @@ class SeverTheBloodlineEffect extends OneShotEffect { filter.add(new NamePredicate(targetPermanent.getName())); } for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(permanent, null, "", source, game, Zone.BATTLEFIELD, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SewerNemesis.java b/Mage.Sets/src/mage/cards/s/SewerNemesis.java index 74c069c7a88..02e9561b63f 100644 --- a/Mage.Sets/src/mage/cards/s/SewerNemesis.java +++ b/Mage.Sets/src/mage/cards/s/SewerNemesis.java @@ -99,7 +99,7 @@ class SewerNemesisTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java b/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java index 68795142d2d..cd86f7c446e 100644 --- a/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java +++ b/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java @@ -64,7 +64,7 @@ class ShadowOfTheGraveEffect extends OneShotEffect { for (Card card : watcher.getCardsCycledOrDiscardedThisTurn(controller.getId()).getCards(game)) { if (game.getState().getZone(card.getId()) == Zone.GRAVEYARD //must come from their graveyard && card.isOwnedBy(controller.getId())) { //confirm ownership, but it should not be possible to get not ownwd cards here - controller.moveCardToHandWithInfo(card, source.getId(), game, true); + controller.moveCardToHandWithInfo(card, source, game, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/ShahOfNaarIsle.java b/Mage.Sets/src/mage/cards/s/ShahOfNaarIsle.java index 9e9d404ff64..163bdaea664 100644 --- a/Mage.Sets/src/mage/cards/s/ShahOfNaarIsle.java +++ b/Mage.Sets/src/mage/cards/s/ShahOfNaarIsle.java @@ -106,7 +106,7 @@ class ShahOfNaarIsleEffect extends OneShotEffect { Player opponent = game.getPlayer(playerId); if (opponent != null) { int number = opponent.getAmount(0, 3, "Draw how many cards?", game); - opponent.drawCards(number, source.getSourceId(), game); + opponent.drawCards(number, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/ShamanEnKor.java b/Mage.Sets/src/mage/cards/s/ShamanEnKor.java index f8850642b95..f9875083225 100644 --- a/Mage.Sets/src/mage/cards/s/ShamanEnKor.java +++ b/Mage.Sets/src/mage/cards/s/ShamanEnKor.java @@ -95,7 +95,7 @@ class ShamanEnKorRedirectFromTargetEffect extends RedirectionEffect { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ShapeAnew.java b/Mage.Sets/src/mage/cards/s/ShapeAnew.java index 1e4f0df1a22..63566bb441a 100644 --- a/Mage.Sets/src/mage/cards/s/ShapeAnew.java +++ b/Mage.Sets/src/mage/cards/s/ShapeAnew.java @@ -56,7 +56,7 @@ public final class ShapeAnew extends CardImpl { if (targetPermanent == null) { return false; } - targetPermanent.sacrifice(source.getSourceId(), game); + targetPermanent.sacrifice(source, game); Player targetController = game.getPlayer(targetPermanent.getControllerId()); if (targetController == null) { return false; diff --git a/Mage.Sets/src/mage/cards/s/SharedFate.java b/Mage.Sets/src/mage/cards/s/SharedFate.java index b778c0c5e45..8188948b909 100644 --- a/Mage.Sets/src/mage/cards/s/SharedFate.java +++ b/Mage.Sets/src/mage/cards/s/SharedFate.java @@ -85,7 +85,7 @@ class SharedFateReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SharkTyphoon.java b/Mage.Sets/src/mage/cards/s/SharkTyphoon.java index 51924e4752c..4462becf5de 100644 --- a/Mage.Sets/src/mage/cards/s/SharkTyphoon.java +++ b/Mage.Sets/src/mage/cards/s/SharkTyphoon.java @@ -74,7 +74,7 @@ class SharkTyphoonCastEffect extends OneShotEffect { if (spell != null) { xValue = spell.getConvertedManaCost(); } - return new SharkToken(xValue).putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return new SharkToken(xValue).putOntoBattlefield(1, game, source, source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/s/ShatterAssumptions.java b/Mage.Sets/src/mage/cards/s/ShatterAssumptions.java index 09dc73af6fd..d145d519c81 100644 --- a/Mage.Sets/src/mage/cards/s/ShatterAssumptions.java +++ b/Mage.Sets/src/mage/cards/s/ShatterAssumptions.java @@ -92,7 +92,7 @@ class ShatterAssumptionsEffect extends OneShotEffect { } else { f = filter2; } - player.discard(new CardsImpl(player.getHand().getCards(f, game)), source, game); + player.discard(new CardsImpl(player.getHand().getCards(f, game)), false, source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/s/ShatterTheSky.java b/Mage.Sets/src/mage/cards/s/ShatterTheSky.java index df61edd0014..72b3ff9f46a 100644 --- a/Mage.Sets/src/mage/cards/s/ShatterTheSky.java +++ b/Mage.Sets/src/mage/cards/s/ShatterTheSky.java @@ -75,7 +75,7 @@ class ShatterTheSkyEffect extends OneShotEffect { .distinct() .map(game::getPlayer) .filter(Objects::nonNull) - .forEach(player -> player.drawCards(1, source.getSourceId(), game)); + .forEach(player -> player.drawCards(1, source, game)); effect.apply(game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/s/ShattergangBrothers.java b/Mage.Sets/src/mage/cards/s/ShattergangBrothers.java index 08665eb086e..e4125c8c6d5 100644 --- a/Mage.Sets/src/mage/cards/s/ShattergangBrothers.java +++ b/Mage.Sets/src/mage/cards/s/ShattergangBrothers.java @@ -101,7 +101,7 @@ class ShattergangBrothersEffect extends OneShotEffect { && player.chooseTarget(outcome, target, source, game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/ShellOfTheLastKappa.java b/Mage.Sets/src/mage/cards/s/ShellOfTheLastKappa.java index 04e045c93dd..011b47713d2 100644 --- a/Mage.Sets/src/mage/cards/s/ShellOfTheLastKappa.java +++ b/Mage.Sets/src/mage/cards/s/ShellOfTheLastKappa.java @@ -101,12 +101,12 @@ class ShellOfTheLastKappaEffect extends OneShotEffect { sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); Card card = spell.getCard(); if (card != null) { return card.moveToExile(CardUtil.getExileZoneId(game, source.getSourceId(), sourcePermanent.getZoneChangeCounter(game)), - sourcePermanent.getName(), source.getSourceId(), game); + sourcePermanent.getName(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/ShelteringAncient.java b/Mage.Sets/src/mage/cards/s/ShelteringAncient.java index 7dbbe50516b..272bbc5e05e 100644 --- a/Mage.Sets/src/mage/cards/s/ShelteringAncient.java +++ b/Mage.Sets/src/mage/cards/s/ShelteringAncient.java @@ -64,11 +64,11 @@ class ShelteringAncientCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { Target target = new TargetCreaturePermanent(1, 1, filter, true); - if (target.choose(Outcome.BoostCreature, controllerId, sourceId, game)) { + if (target.choose(Outcome.BoostCreature, controllerId, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(), ability, game); @@ -81,8 +81,8 @@ class ShelteringAncientCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getBattlefield().contains(filter, sourceId, game, 1); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return game.getBattlefield().contains(filter, source.getSourceId(), game, 1); } @Override diff --git a/Mage.Sets/src/mage/cards/s/ShieldDancer.java b/Mage.Sets/src/mage/cards/s/ShieldDancer.java index 7d3f4679caf..24abe85c06e 100644 --- a/Mage.Sets/src/mage/cards/s/ShieldDancer.java +++ b/Mage.Sets/src/mage/cards/s/ShieldDancer.java @@ -68,7 +68,7 @@ class ShieldDancerRedirectionEffect extends RedirectionEffect { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ShieldOfTheAvatar.java b/Mage.Sets/src/mage/cards/s/ShieldOfTheAvatar.java index 085410a9fe1..59e8a98412b 100644 --- a/Mage.Sets/src/mage/cards/s/ShieldOfTheAvatar.java +++ b/Mage.Sets/src/mage/cards/s/ShieldOfTheAvatar.java @@ -14,6 +14,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import java.util.UUID; @@ -74,7 +75,7 @@ class ShieldOfTheAvatarPreventionEffect extends PreventionEffectImpl { if (equipment != null && equipment.getAttachedTo() != null) { int numberOfCreaturesControlled = CreaturesYouControlCount.instance.calculate(game, source, this); int toPrevent = Math.min(numberOfCreaturesControlled, event.getAmount()); - GameEvent preventEvent = new PreventDamageEvent(equipment.getAttachedTo(), source.getSourceId(), source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { if (event.getAmount() >= toPrevent) { event.setAmount(event.getAmount() - toPrevent); @@ -84,8 +85,7 @@ class ShieldOfTheAvatarPreventionEffect extends PreventionEffectImpl { } if (toPrevent > 0) { game.informPlayers("Shield of the Avatar " + "prevented " + toPrevent + " damage to " + game.getPermanent(equipment.getAttachedTo()).getName()); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, - equipment.getAttachedTo(), source.getSourceId(), source.getControllerId(), toPrevent)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent)); } } } diff --git a/Mage.Sets/src/mage/cards/s/ShiftingShadow.java b/Mage.Sets/src/mage/cards/s/ShiftingShadow.java index 5f9f1e72ba1..a626942a5b1 100644 --- a/Mage.Sets/src/mage/cards/s/ShiftingShadow.java +++ b/Mage.Sets/src/mage/cards/s/ShiftingShadow.java @@ -106,7 +106,7 @@ class ShiftingShadowEffect extends OneShotEffect { } } if (aura != null) { - enchanted.destroy(source.getSourceId(), game, false); + enchanted.destroy(source, game, false); // Because this effect has two steps, we have to call the processAction method here, so that triggered effects of the target going to graveyard go to the stack // If we don't do it here, gained triggered effects to the target will be removed from the following moveCards method and the applyEffcts done there. // Example: {@link org.mage.test.commander.duel.MairsilThePretenderTest#MairsilThePretenderTest Test} @@ -126,7 +126,7 @@ class ShiftingShadowEffect extends OneShotEffect { target.addTarget(newEnchanted.getId(), source, game); aura.getSpellAbility().getTargets().clear(); aura.getSpellAbility().getTargets().add(target); - newEnchanted.addAttachment(aura.getId(), game); + newEnchanted.addAttachment(aura.getId(), source, game); } break; } else { diff --git a/Mage.Sets/src/mage/cards/s/ShiftyDoppelganger.java b/Mage.Sets/src/mage/cards/s/ShiftyDoppelganger.java index c73a0b3f5bf..36ac434bde0 100644 --- a/Mage.Sets/src/mage/cards/s/ShiftyDoppelganger.java +++ b/Mage.Sets/src/mage/cards/s/ShiftyDoppelganger.java @@ -139,7 +139,7 @@ class ShiftyDoppelgangerReturnEffect extends OneShotEffect { Permanent creature = game.getPermanent(creatureId); Player player = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); - if (creature != null && creature.getZoneChangeCounter(game) == this.creatureZoneCount && creature.sacrifice(source.getSourceId(), game)) { + if (creature != null && creature.getZoneChangeCounter(game) == this.creatureZoneCount && creature.sacrifice(source, game)) { if (player != null && sourceObject != null && sourceObject.getZoneChangeCounter(game) == this.sourceZoneCount) { player.moveCards(game.getCard(source.getSourceId()), Zone.BATTLEFIELD, source, game); } diff --git a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java index 66d2b5c8ab3..148fa3794e5 100644 --- a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java +++ b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java @@ -89,7 +89,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl { game.informPlayers(controller.getLogName() + " sacrifices " + sacrificedCreatures + " creatures for " + creature.getLogName()); for (UUID targetId : target.getTargets()) { Permanent targetCreature = game.getPermanent(targetId); - if (targetCreature == null || !targetCreature.sacrifice(source.getSourceId(), game)) { + if (targetCreature == null || !targetCreature.sacrifice(source, game)) { return false; } } diff --git a/Mage.Sets/src/mage/cards/s/ShimianSpecter.java b/Mage.Sets/src/mage/cards/s/ShimianSpecter.java index d0bb35fc5f6..8c96194436b 100644 --- a/Mage.Sets/src/mage/cards/s/ShimianSpecter.java +++ b/Mage.Sets/src/mage/cards/s/ShimianSpecter.java @@ -93,7 +93,7 @@ class ShimianSpecterEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.HAND, new FilterNonlandCard()); target.setNotTarget(true); Card chosenCard = null; - if (target.canChoose(controller.getId(), game) + if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.chooseTarget(Outcome.Benefit, targetPlayer.getHand(), target, source, game)) { chosenCard = game.getCard(target.getFirstTarget()); } @@ -116,7 +116,7 @@ class ShimianSpecterEffect extends OneShotEffect { for (Card checkCard : targetPlayer.getGraveyard().getCards(game)) { if (checkCard.getName().equals(chosenCard.getName())) { controller.moveCardToExileWithInfo(checkCard, null, "", - source.getSourceId(), game, Zone.GRAVEYARD, true); + source, game, Zone.GRAVEYARD, true); } } @@ -127,7 +127,7 @@ class ShimianSpecterEffect extends OneShotEffect { Card card = game.getCard(cardId); if (card != null) { controller.moveCardToExileWithInfo(card, null, "", - source.getSourceId(), game, Zone.HAND, true); + source, game, Zone.HAND, true); } } } @@ -142,7 +142,7 @@ class ShimianSpecterEffect extends OneShotEffect { for (UUID cardId : targetCardsLibrary.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.LIBRARY, true); } } targetPlayer.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/s/ShimmeringGlasskite.java b/Mage.Sets/src/mage/cards/s/ShimmeringGlasskite.java index 3d4de061855..cae5ec6739a 100644 --- a/Mage.Sets/src/mage/cards/s/ShimmeringGlasskite.java +++ b/Mage.Sets/src/mage/cards/s/ShimmeringGlasskite.java @@ -68,7 +68,7 @@ class ShimmeringGlasskiteAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ShinkaGatekeeper.java b/Mage.Sets/src/mage/cards/s/ShinkaGatekeeper.java index 0deaee22e5d..0f120f3ff38 100644 --- a/Mage.Sets/src/mage/cards/s/ShinkaGatekeeper.java +++ b/Mage.Sets/src/mage/cards/s/ShinkaGatekeeper.java @@ -63,7 +63,7 @@ class ShinkaGatekeeperDealDamageEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/ShipbreakerKraken.java b/Mage.Sets/src/mage/cards/s/ShipbreakerKraken.java index 2d20ff90ff7..b1459e2afae 100644 --- a/Mage.Sets/src/mage/cards/s/ShipbreakerKraken.java +++ b/Mage.Sets/src/mage/cards/s/ShipbreakerKraken.java @@ -101,7 +101,7 @@ class ShipbreakerKrakenReplacementEffect extends ContinuousRuleModifyingEffectIm } } if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) { - ZoneChangeEvent zEvent = (ZoneChangeEvent)event; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD) { discard(); return false; @@ -126,7 +126,9 @@ class ShipbreakerKrakenWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST_CONTROL && event.getPlayerId().equals(controllerId) && event.getTargetId().equals(sourceId)) { + if (event.getType() == GameEvent.EventType.LOST_CONTROL + && event.getPlayerId().equals(controllerId) + && event.getTargetId().equals(sourceId)) { condition = true; game.replaceEvent(event); return; diff --git a/Mage.Sets/src/mage/cards/s/ShireiShizosCaretaker.java b/Mage.Sets/src/mage/cards/s/ShireiShizosCaretaker.java index de64a813aa2..d607f410e2e 100644 --- a/Mage.Sets/src/mage/cards/s/ShireiShizosCaretaker.java +++ b/Mage.Sets/src/mage/cards/s/ShireiShizosCaretaker.java @@ -65,7 +65,7 @@ class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ShivanSandMage.java b/Mage.Sets/src/mage/cards/s/ShivanSandMage.java index 8b286bf275c..3b60a53cefb 100644 --- a/Mage.Sets/src/mage/cards/s/ShivanSandMage.java +++ b/Mage.Sets/src/mage/cards/s/ShivanSandMage.java @@ -91,7 +91,7 @@ class ShivanSandMageEffect extends OneShotEffect { if (addCounters) { permanent.addCounters(CounterType.TIME.createInstance(2), source, game); } else { - permanent.removeCounters(CounterType.TIME.getName(), 2, game); + permanent.removeCounters(CounterType.TIME.getName(), 2, source, game); } return true; } @@ -100,7 +100,7 @@ class ShivanSandMageEffect extends OneShotEffect { if (addCounters) { card.addCounters(CounterType.TIME.createInstance(2), source, game); } else { - card.removeCounters(CounterType.TIME.getName(), 2, game); + card.removeCounters(CounterType.TIME.getName(), 2, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/ShivanWumpus.java b/Mage.Sets/src/mage/cards/s/ShivanWumpus.java index 2399e62c817..19248075b95 100644 --- a/Mage.Sets/src/mage/cards/s/ShivanWumpus.java +++ b/Mage.Sets/src/mage/cards/s/ShivanWumpus.java @@ -73,9 +73,9 @@ class ShivanWumpusEffect extends PutOnLibrarySourceEffect { Cost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent())); Player player = game.getPlayer(playerId); if (player != null - && cost.canPay(source, source.getSourceId(), playerId, game) + && cost.canPay(source, source, playerId, game) && player.chooseUse(Outcome.Sacrifice, "Sacrifice a land?", source, game) - && cost.pay(source, game, source.getSourceId(), playerId, true, null)) { + && cost.pay(source, game, source, playerId, true, null)) { costPaid = true; } } diff --git a/Mage.Sets/src/mage/cards/s/Shocker.java b/Mage.Sets/src/mage/cards/s/Shocker.java index 176afefbf0e..f563d38808c 100644 --- a/Mage.Sets/src/mage/cards/s/Shocker.java +++ b/Mage.Sets/src/mage/cards/s/Shocker.java @@ -61,8 +61,8 @@ class ShockerEffect extends OneShotEffect { if (targetPlayer == null) { return false; } - int count = targetPlayer.discard(targetPlayer.getHand(), source, game).size(); - targetPlayer.drawCards(count, source.getSourceId(), game); + int count = targetPlayer.discard(targetPlayer.getHand(), false, source, game).size(); + targetPlayer.drawCards(count, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/ShredsOfSanity.java b/Mage.Sets/src/mage/cards/s/ShredsOfSanity.java index b9d2ae6bcf0..1d087f1c287 100644 --- a/Mage.Sets/src/mage/cards/s/ShredsOfSanity.java +++ b/Mage.Sets/src/mage/cards/s/ShredsOfSanity.java @@ -82,7 +82,7 @@ class ShredsOfSanityEffect extends OneShotEffect { cardsToHand.add(card); } controller.moveCards(cardsToHand, Zone.HAND, source, game); - controller.discardOne(false, source, game); + controller.discardOne(false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/Shriekgeist.java b/Mage.Sets/src/mage/cards/s/Shriekgeist.java index 9c0b1c8c0d6..61774b914bb 100644 --- a/Mage.Sets/src/mage/cards/s/Shriekgeist.java +++ b/Mage.Sets/src/mage/cards/s/Shriekgeist.java @@ -63,7 +63,7 @@ class ShriekgeistTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/ShrivelingRot.java b/Mage.Sets/src/mage/cards/s/ShrivelingRot.java index e64f2700c76..c66fe82ba71 100644 --- a/Mage.Sets/src/mage/cards/s/ShrivelingRot.java +++ b/Mage.Sets/src/mage/cards/s/ShrivelingRot.java @@ -156,7 +156,7 @@ class ShrivelingRotEffect extends OneShotEffect { Player permanentController = game.getPlayer(permanent.getControllerId()); if (permanentController != null) { int amount = permanent.getToughness().getValue(); - permanentController.loseLife(amount, game, false); + permanentController.loseLife(amount, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/ShroudedLore.java b/Mage.Sets/src/mage/cards/s/ShroudedLore.java index b4042febd67..a2fe1105725 100644 --- a/Mage.Sets/src/mage/cards/s/ShroudedLore.java +++ b/Mage.Sets/src/mage/cards/s/ShroudedLore.java @@ -72,7 +72,7 @@ class ShroudedLoreEffect extends OneShotEffect { do { chosenCard = new TargetCardInGraveyard(filter); chosenCard.setNotTarget(true); - if (chosenCard.canChoose(opponent.getId(), game)) { + if (chosenCard.canChoose(source.getSourceId(), opponent.getId(), game)) { opponent.chooseTarget(Outcome.ReturnToHand, chosenCard, source, game); card = game.getCard(chosenCard.getFirstTarget()); if (card != null) { @@ -84,9 +84,9 @@ class ShroudedLoreEffect extends OneShotEffect { } if (!done) { - if (cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {B} to choose a different card ?", source, game)) { + if (cost.canPay(source, source, you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {B} to choose a different card ?", source, game)) { cost.clearPaid(); - if (!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { + if (!cost.pay(source, game, source, you.getId(), false, null)) { done = true; } } else { diff --git a/Mage.Sets/src/mage/cards/s/Shuriken.java b/Mage.Sets/src/mage/cards/s/Shuriken.java index 1051f59e059..0060f8ad6c4 100644 --- a/Mage.Sets/src/mage/cards/s/Shuriken.java +++ b/Mage.Sets/src/mage/cards/s/Shuriken.java @@ -78,7 +78,7 @@ class ShurikenEffect extends OneShotEffect { return false; } Permanent equipment = (Permanent) object; - targetedPermanent.damage(2, equipment.getId(), game); + targetedPermanent.damage(2, equipment.getId(), source, game); Permanent attached = source.getSourcePermanentOrLKI(game); if (attached != null && attached.hasSubtype(SubType.NINJA, game)) { return true; diff --git a/Mage.Sets/src/mage/cards/s/SibilantSpirit.java b/Mage.Sets/src/mage/cards/s/SibilantSpirit.java index 6b68ad9b4b2..401fa7abdbb 100644 --- a/Mage.Sets/src/mage/cards/s/SibilantSpirit.java +++ b/Mage.Sets/src/mage/cards/s/SibilantSpirit.java @@ -66,7 +66,7 @@ class SibilantSpiritEffect extends OneShotEffect { Player defender = game.getPlayer(defenderId); if (defender != null) { if (defender.chooseUse(outcome, "Draw a card?", source, game)) { - defender.drawCards(1, source.getSourceId(), game); + defender.drawCards(1, source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java b/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java index dcf87eb9c54..76a05d28af9 100644 --- a/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java +++ b/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java @@ -68,7 +68,10 @@ class SidisiBroodTyrantTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; - if (zEvent != null && Zone.LIBRARY == zEvent.getFromZone() && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { + if (zEvent != null + && Zone.LIBRARY == zEvent.getFromZone() + && Zone.GRAVEYARD == zEvent.getToZone() + && zEvent.getCards() != null) { for (Card card : zEvent.getCards()) { if (card != null) { UUID cardOwnerId = card.getOwnerId(); diff --git a/Mage.Sets/src/mage/cards/s/SiegeDragon.java b/Mage.Sets/src/mage/cards/s/SiegeDragon.java index 8bfca003544..0a0980b0d98 100644 --- a/Mage.Sets/src/mage/cards/s/SiegeDragon.java +++ b/Mage.Sets/src/mage/cards/s/SiegeDragon.java @@ -85,7 +85,7 @@ class SiegeDragonAttacksTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override @@ -129,7 +129,7 @@ class SiegeDragonDamageEffect extends OneShotEffect { filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SiegeStriker.java b/Mage.Sets/src/mage/cards/s/SiegeStriker.java index 33bfd4cc6fb..a073d63c1e9 100644 --- a/Mage.Sets/src/mage/cards/s/SiegeStriker.java +++ b/Mage.Sets/src/mage/cards/s/SiegeStriker.java @@ -74,12 +74,12 @@ class SiegeStrikerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int tappedAmount = 0; TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); - if (target.canChoose(source.getControllerId(), game) + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { for (UUID creatureId : target.getTargets()) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { - creature.tap(game); + creature.tap(source, game); tappedAmount++; } } diff --git a/Mage.Sets/src/mage/cards/s/SiftThroughSands.java b/Mage.Sets/src/mage/cards/s/SiftThroughSands.java index 72fcbdae294..95c6007d1f2 100644 --- a/Mage.Sets/src/mage/cards/s/SiftThroughSands.java +++ b/Mage.Sets/src/mage/cards/s/SiftThroughSands.java @@ -88,7 +88,7 @@ class SiftThroughSandsWatcher extends Watcher { if (condition) { //no need to check - condition has already occured return; } - if (event.getType() == EventType.SPELL_CAST + if (event.getType() == GameEvent.EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell.getCard().getName().equals("Peer Through Depths")) { diff --git a/Mage.Sets/src/mage/cards/s/SigardasAid.java b/Mage.Sets/src/mage/cards/s/SigardasAid.java index d8a34bafe2f..d14c18d6461 100644 --- a/Mage.Sets/src/mage/cards/s/SigardasAid.java +++ b/Mage.Sets/src/mage/cards/s/SigardasAid.java @@ -78,7 +78,7 @@ class SigardasAidEffect extends OneShotEffect { Permanent equipment = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent targetCreature = game.getPermanent(source.getTargets().getFirstTarget()); if (equipment != null && targetCreature != null) { - targetCreature.addAttachment(equipment.getId(), game); + targetCreature.addAttachment(equipment.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SigilCaptain.java b/Mage.Sets/src/mage/cards/s/SigilCaptain.java index 0e5408a88ab..1e9addd778f 100644 --- a/Mage.Sets/src/mage/cards/s/SigilCaptain.java +++ b/Mage.Sets/src/mage/cards/s/SigilCaptain.java @@ -60,7 +60,7 @@ class SigilCaptainTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/s/Silence.java b/Mage.Sets/src/mage/cards/s/Silence.java index 9c62da44ef6..7fe030fd4ac 100644 --- a/Mage.Sets/src/mage/cards/s/Silence.java +++ b/Mage.Sets/src/mage/cards/s/Silence.java @@ -69,7 +69,7 @@ class SilenceEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL; + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java b/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java index e38ebb54006..31ad3ad26fe 100644 --- a/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java +++ b/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java @@ -73,10 +73,10 @@ class SilenceTheBelieversExileEffect extends OneShotEffect { for (UUID attachmentId : attachments) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) { - controller.moveCardToExileWithInfo(attachment, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(attachment, null, null, source, game, Zone.BATTLEFIELD, true); } } - controller.moveCardToExileWithInfo(creature, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(creature, null, null, source, game, Zone.BATTLEFIELD, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java b/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java index fb4ab05538b..8da6400bede 100644 --- a/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java +++ b/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java @@ -102,11 +102,11 @@ class SilumgarsScornCounterEffect extends OneShotEffect { } } if (condition) { - return game.getStack().counter(spell.getId(), source.getSourceId(), game); + return game.getStack().counter(spell.getId(), source, game); } if (!(player.chooseUse(Outcome.Benefit, "Would you like to pay {1} to prevent counter effect?", source, game) && - new GenericManaCost(1).pay(source, game, spell.getSourceId(), spell.getControllerId(), false))) { - return game.getStack().counter(spell.getId(), source.getSourceId(), game); + new GenericManaCost(1).pay(source, game, source, spell.getControllerId(), false))) { + return game.getStack().counter(spell.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SilvergillAdept.java b/Mage.Sets/src/mage/cards/s/SilvergillAdept.java index c5ce56494b4..4086ae168bb 100644 --- a/Mage.Sets/src/mage/cards/s/SilvergillAdept.java +++ b/Mage.Sets/src/mage/cards/s/SilvergillAdept.java @@ -69,7 +69,7 @@ class SilvergillAdeptCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player == null) { @@ -80,7 +80,7 @@ class SilvergillAdeptCost extends CostImpl { if (player.getHand().count(filter, game) > 0 && player.chooseUse(Outcome.Benefit, "Reveal a Merfolk card? Otherwise pay {3}.", ability, game)) { TargetCardInHand target = new TargetCardInHand(filter); - if (player.choose(Outcome.Benefit, target, sourceId, game)) { + if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) { Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { paid = true; @@ -89,7 +89,7 @@ class SilvergillAdeptCost extends CostImpl { } } else { mana.clearPaid(); - if (mana.pay(ability, game, player.getId(), player.getId(), false)) { + if (mana.pay(ability, game, source, player.getId(), false)) { paid = true; } } @@ -98,13 +98,13 @@ class SilvergillAdeptCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); if (player != null && player.getHand().count(filter, game) > 0) { return true; } - return mana.canPay(ability, sourceId, controllerId, game); + return mana.canPay(ability, source, controllerId, game); } diff --git a/Mage.Sets/src/mage/cards/s/SimianSpiritGuide.java b/Mage.Sets/src/mage/cards/s/SimianSpiritGuide.java index ae036351281..1f672242cbb 100644 --- a/Mage.Sets/src/mage/cards/s/SimianSpiritGuide.java +++ b/Mage.Sets/src/mage/cards/s/SimianSpiritGuide.java @@ -57,19 +57,19 @@ class ExileSourceFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Card card = game.getCard(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Card card = game.getCard(source.getSourceId()); Player player = game.getPlayer(controllerId); - if (player != null && player.getHand().contains(sourceId) && card != null) { - paid = card.moveToExile(ability.getSourceId(), "from Hand", ability.getSourceId(), game); + if (player != null && player.getHand().contains(source.getSourceId()) && card != null) { + paid = card.moveToExile(ability.getSourceId(), "from Hand", source, game); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); - if (player != null && player.getHand().contains(sourceId)) { + if (player != null && player.getHand().contains(source.getSourceId())) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SimicAscendancy.java b/Mage.Sets/src/mage/cards/s/SimicAscendancy.java index 6316d881f74..22738f02fe1 100644 --- a/Mage.Sets/src/mage/cards/s/SimicAscendancy.java +++ b/Mage.Sets/src/mage/cards/s/SimicAscendancy.java @@ -93,7 +93,9 @@ class SimicAscendancyTriggeredAbility extends TriggeredAbilityImpl { && permanent.isCreature() && permanent.isControlledBy(this.getControllerId())) { this.getEffects().clear(); - this.addEffect(new AddCountersSourceEffect(CounterType.GROWTH.createInstance(event.getAmount()))); + if (event.getAmount() > 0) { + this.addEffect(new AddCountersSourceEffect(CounterType.GROWTH.createInstance(event.getAmount()))); + } return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SimicFluxmage.java b/Mage.Sets/src/mage/cards/s/SimicFluxmage.java index 892f35772a1..1c3aefc790c 100644 --- a/Mage.Sets/src/mage/cards/s/SimicFluxmage.java +++ b/Mage.Sets/src/mage/cards/s/SimicFluxmage.java @@ -77,7 +77,7 @@ class MoveCounterFromSourceToTargetEffect extends OneShotEffect { if (sourcePermanent != null && sourcePermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); if (targetPermanent != null) { - sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), game); + sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), source, game); targetPermanent.addCounters(CounterType.P1P1.createInstance(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/s/SimicGuildmage.java b/Mage.Sets/src/mage/cards/s/SimicGuildmage.java index d4245812054..5c2b8a4d1a9 100644 --- a/Mage.Sets/src/mage/cards/s/SimicGuildmage.java +++ b/Mage.Sets/src/mage/cards/s/SimicGuildmage.java @@ -111,7 +111,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { if (fromPermanent == null || toPermanent == null || !fromPermanent.isControlledBy(toPermanent.getControllerId())) { return false; } - fromPermanent.removeCounters(CounterType.P1P1.createInstance(1), game); + fromPermanent.removeCounters(CounterType.P1P1.createInstance(1), source, game); toPermanent.addCounters(CounterType.P1P1.createInstance(1), source, game); return true; } @@ -196,12 +196,12 @@ class MoveAuraEffect extends OneShotEffect { Permanent permanentToAttachAura = game.getPermanent(chosenPermanentToAttachAuras.getFirstTarget()); if (permanentToAttachAura != null) { // Check for protection - if (permanentToAttachAura.cantBeAttachedBy(aura, game, true)) { + if (permanentToAttachAura.cantBeAttachedBy(aura, source, game, true)) { passed = false; } if (passed) { - fromPermanent.removeAttachment(aura.getId(), game); - permanentToAttachAura.addAttachment(aura.getId(), game); + fromPermanent.removeAttachment(aura.getId(), source, game); + permanentToAttachAura.addAttachment(aura.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/Simoon.java b/Mage.Sets/src/mage/cards/s/Simoon.java index 52545da96b7..bfa3b2e3bfa 100644 --- a/Mage.Sets/src/mage/cards/s/Simoon.java +++ b/Mage.Sets/src/mage/cards/s/Simoon.java @@ -64,7 +64,7 @@ class SimoonEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(player.getId())); List creatures = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent creature : creatures) { - creature.damage(1, source.getSourceId(), game, false, true); + creature.damage(1, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/Simulacrum.java b/Mage.Sets/src/mage/cards/s/Simulacrum.java index f1afc1603df..37e0089d505 100644 --- a/Mage.Sets/src/mage/cards/s/Simulacrum.java +++ b/Mage.Sets/src/mage/cards/s/Simulacrum.java @@ -46,10 +46,10 @@ public final class Simulacrum extends CardImpl { class SimulacrumAmount implements DynamicValue { @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class); if(watcher != null) { - return watcher.getAmountOfDamageReceivedThisTurn(source.getControllerId()); + return watcher.getAmountOfDamageReceivedThisTurn(sourceAbility.getControllerId()); } return 0; } diff --git a/Mage.Sets/src/mage/cards/s/SinProdder.java b/Mage.Sets/src/mage/cards/s/SinProdder.java index 100caa744e1..d88e221bea5 100644 --- a/Mage.Sets/src/mage/cards/s/SinProdder.java +++ b/Mage.Sets/src/mage/cards/s/SinProdder.java @@ -74,7 +74,7 @@ class SinProdderEffect extends OneShotEffect { Player opponent = game.getPlayer(opponentUuid); if (opponent != null && !putInGraveyard && opponent.chooseUse(Outcome.Damage, message, source, game)) { putInGraveyard = true; - opponent.damage(card.getConvertedManaCost(), source.getSourceId(), game); + opponent.damage(card.getConvertedManaCost(), source.getSourceId(), source, game); // 4/8/2016: Each opponent in turn order, starting with the one after you in turn order, may choose to have you put that card into your graveyard. // Once a player does so, Sin Prodder deals damage equal to that card's converted mana cost to that player immediately // and Sin Prodder's trigger has no further action. diff --git a/Mage.Sets/src/mage/cards/s/Sindbad.java b/Mage.Sets/src/mage/cards/s/Sindbad.java index 16be022934d..9718a45a5a9 100644 --- a/Mage.Sets/src/mage/cards/s/Sindbad.java +++ b/Mage.Sets/src/mage/cards/s/Sindbad.java @@ -71,12 +71,12 @@ class SindbadEffect extends OneShotEffect { // Gatherer ruling (2007-02-01) // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, // even if the draw is replaced by another draw (such as with Enduring Renewal). - if (controller.drawCards(1, source.getSourceId(), game) != 1) { + if (controller.drawCards(1, source, game) != 1) { return true; } controller.revealCards(source, new CardsImpl(card), game); if (!card.isLand()) { - controller.discard(card, source, game); + controller.discard(card, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SingeMindOgre.java b/Mage.Sets/src/mage/cards/s/SingeMindOgre.java index e71b5bf35a0..e747d172f06 100644 --- a/Mage.Sets/src/mage/cards/s/SingeMindOgre.java +++ b/Mage.Sets/src/mage/cards/s/SingeMindOgre.java @@ -74,7 +74,7 @@ class SingeMindOgreEffect extends OneShotEffect { if (card != null) { revealed.add(card); targetPlayer.revealCards("Singe-Mind Ogre", revealed, game); - targetPlayer.loseLife(card.getConvertedManaCost(), game, false); + targetPlayer.loseLife(card.getConvertedManaCost(), game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SingleCombat.java b/Mage.Sets/src/mage/cards/s/SingleCombat.java index eec4681d946..496c1566c6f 100644 --- a/Mage.Sets/src/mage/cards/s/SingleCombat.java +++ b/Mage.Sets/src/mage/cards/s/SingleCombat.java @@ -87,7 +87,7 @@ class SingleCombatEffect extends OneShotEffect { } } for (Permanent permanent : game.getBattlefield().getActivePermanents(filterSac, source.getControllerId(), game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SinsOfTheFather.java b/Mage.Sets/src/mage/cards/s/SinsOfTheFather.java index a9f920ba940..6ed28824b4d 100644 --- a/Mage.Sets/src/mage/cards/s/SinsOfTheFather.java +++ b/Mage.Sets/src/mage/cards/s/SinsOfTheFather.java @@ -60,12 +60,12 @@ class SinsOfTheFatherEffect extends OneShotEffect { int exiledCards = 0; for(Card card : targetPlayer.getGraveyard().getCards(game)) { if(filter.match(card, game)) { - if(card.moveToExile(null, "", source.getSourceId(), game)) { + if(card.moveToExile(null, "", source, game)) { exiledCards++; } } } - targetPlayer.loseLife(exiledCards, game, false); + targetPlayer.loseLife(exiledCards, game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SinsOfThePast.java b/Mage.Sets/src/mage/cards/s/SinsOfThePast.java index 86ba7e7066f..8964ed5cf7f 100644 --- a/Mage.Sets/src/mage/cards/s/SinsOfThePast.java +++ b/Mage.Sets/src/mage/cards/s/SinsOfThePast.java @@ -97,12 +97,7 @@ class SinsOfThePastReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - Card card = game.getCard(this.cardId); - if (controller != null && card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); - return true; - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } diff --git a/Mage.Sets/src/mage/cards/s/SireOfInsanity.java b/Mage.Sets/src/mage/cards/s/SireOfInsanity.java index 90ece9fc954..8e1b19ef579 100644 --- a/Mage.Sets/src/mage/cards/s/SireOfInsanity.java +++ b/Mage.Sets/src/mage/cards/s/SireOfInsanity.java @@ -63,7 +63,7 @@ class SireOfInsanityEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.discard(player.getHand(), source, game); + player.discard(player.getHand(), false, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SirensCall.java b/Mage.Sets/src/mage/cards/s/SirensCall.java index e37225124eb..a322941e066 100644 --- a/Mage.Sets/src/mage/cards/s/SirensCall.java +++ b/Mage.Sets/src/mage/cards/s/SirensCall.java @@ -129,7 +129,7 @@ class SirensCallDestroyEffect extends OneShotEffect { continue; } // Destroy the rest. - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SirensRuse.java b/Mage.Sets/src/mage/cards/s/SirensRuse.java index fe0a4fdcf61..ebbc511e611 100644 --- a/Mage.Sets/src/mage/cards/s/SirensRuse.java +++ b/Mage.Sets/src/mage/cards/s/SirensRuse.java @@ -64,7 +64,7 @@ class SirensRuseEffect extends ExileTargetForSourceEffect { if (super.apply(game, source)) { new ReturnToBattlefieldUnderYourControlTargetEffect(false).apply(game, source); if (isPirate && player != null) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SithMagic.java b/Mage.Sets/src/mage/cards/s/SithMagic.java index 5a8049ab2db..ccdc93d90b2 100644 --- a/Mage.Sets/src/mage/cards/s/SithMagic.java +++ b/Mage.Sets/src/mage/cards/s/SithMagic.java @@ -126,12 +126,8 @@ class SithMagicReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanent(source.getFirstTarget()); - Player controller = game.getPlayer(source.getControllerId()); - if (permanent != null && controller != null) { - controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); - } - return true; + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SithRavager.java b/Mage.Sets/src/mage/cards/s/SithRavager.java index 1972304de8f..0ca26e4d600 100644 --- a/Mage.Sets/src/mage/cards/s/SithRavager.java +++ b/Mage.Sets/src/mage/cards/s/SithRavager.java @@ -67,6 +67,7 @@ public final class SithRavager extends CardImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { + // non combat lose life return !event.getFlag() && game.getOpponents(game.getControllerId(getSourceId())).contains(event.getPlayerId()); } diff --git a/Mage.Sets/src/mage/cards/s/SivvisValor.java b/Mage.Sets/src/mage/cards/s/SivvisValor.java index eb331a4ab11..6193333745c 100644 --- a/Mage.Sets/src/mage/cards/s/SivvisValor.java +++ b/Mage.Sets/src/mage/cards/s/SivvisValor.java @@ -94,7 +94,7 @@ class SivvisValorEffect extends ReplacementEffectImpl { Player controller = game.getPlayer(source.getControllerId()); DamageEvent damageEvent = (DamageEvent) event; if (controller != null) { - controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SixthSense.java b/Mage.Sets/src/mage/cards/s/SixthSense.java index e0915ada23e..08900173dc5 100644 --- a/Mage.Sets/src/mage/cards/s/SixthSense.java +++ b/Mage.Sets/src/mage/cards/s/SixthSense.java @@ -75,7 +75,7 @@ class SixthSenseTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SixyBeast.java b/Mage.Sets/src/mage/cards/s/SixyBeast.java index 662f032f639..4d7f411316c 100644 --- a/Mage.Sets/src/mage/cards/s/SixyBeast.java +++ b/Mage.Sets/src/mage/cards/s/SixyBeast.java @@ -85,7 +85,7 @@ class SixyBeastEffect extends OneShotEffect { int guessedAmount = opponent.getAmount(0, 6, "Guess the number of counters on " + permanent.getName(), game); game.informPlayers(opponent.getLogName() + " guessed " + guessedAmount + " as the number of counters on " + permanent.getLogName()); if (counterAmount == guessedAmount) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SkeletalScrying.java b/Mage.Sets/src/mage/cards/s/SkeletalScrying.java index 76a790f5f58..13c9d82a48d 100644 --- a/Mage.Sets/src/mage/cards/s/SkeletalScrying.java +++ b/Mage.Sets/src/mage/cards/s/SkeletalScrying.java @@ -105,8 +105,8 @@ class SkeletalScryingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if ( controller != null ) { - controller.drawCards(amount.calculate(game, source, this), source.getSourceId(), game); - controller.loseLife(amount.calculate(game, source, this), game, false); + controller.drawCards(amount.calculate(game, source, this), source, game); + controller.loseLife(amount.calculate(game, source, this), game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SkeletonScavengers.java b/Mage.Sets/src/mage/cards/s/SkeletonScavengers.java index 95f31ef9eb8..88f55964858 100644 --- a/Mage.Sets/src/mage/cards/s/SkeletonScavengers.java +++ b/Mage.Sets/src/mage/cards/s/SkeletonScavengers.java @@ -69,24 +69,24 @@ class DynamicValueGenericManaCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller == null) { return false; } Cost cost = ManaUtil.createManaCost(amount, game, ability, null); - return cost.canPay(ability, sourceId, controllerId, game); + return cost.canPay(ability, source, controllerId, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller == null) { return false; } Cost cost = ManaUtil.createManaCost(amount, game, ability, null); - paid = cost.pay(ability, game, sourceId, controllerId, noMana); + paid = cost.pay(ability, game, source, controllerId, noMana); return paid; } diff --git a/Mage.Sets/src/mage/cards/s/Skeletonize.java b/Mage.Sets/src/mage/cards/s/Skeletonize.java index edf74e58413..c2b5c31012a 100644 --- a/Mage.Sets/src/mage/cards/s/Skeletonize.java +++ b/Mage.Sets/src/mage/cards/s/Skeletonize.java @@ -88,7 +88,7 @@ class SkeletonizeDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SkittishValesk.java b/Mage.Sets/src/mage/cards/s/SkittishValesk.java index 604f9a2e6d0..13fe875c675 100644 --- a/Mage.Sets/src/mage/cards/s/SkittishValesk.java +++ b/Mage.Sets/src/mage/cards/s/SkittishValesk.java @@ -64,7 +64,7 @@ class SkittishValeskEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null && !controller.flipCoin(source, game, true)) { - return permanent.turnFaceDown(game, source.getControllerId()); + return permanent.turnFaceDown(source, game, source.getControllerId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/s/Skred.java b/Mage.Sets/src/mage/cards/s/Skred.java index fc59969bba6..7649c35f991 100644 --- a/Mage.Sets/src/mage/cards/s/Skred.java +++ b/Mage.Sets/src/mage/cards/s/Skred.java @@ -65,7 +65,7 @@ class SkredDamageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if(amount > 0) { if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SkullRend.java b/Mage.Sets/src/mage/cards/s/SkullRend.java index e2a3f3ec399..47503e0c36f 100644 --- a/Mage.Sets/src/mage/cards/s/SkullRend.java +++ b/Mage.Sets/src/mage/cards/s/SkullRend.java @@ -54,10 +54,10 @@ public final class SkullRend extends CardImpl { .filter(Objects::nonNull) .collect(Collectors.toList()); for (Player opponent : opponents) { - opponent.damage(2, source.getSourceId(), game); + opponent.damage(2, source.getSourceId(), source, game); } for (Player opponent : opponents) { - opponent.discard(2, true, source, game); + opponent.discard(2, true, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SkullStorm.java b/Mage.Sets/src/mage/cards/s/SkullStorm.java index 5f1d8d884f8..1e6afd09a6f 100644 --- a/Mage.Sets/src/mage/cards/s/SkullStorm.java +++ b/Mage.Sets/src/mage/cards/s/SkullStorm.java @@ -72,7 +72,7 @@ class SkullStormEffect extends OneShotEffect { filter, source.getControllerId(), game ).isEmpty()) { int lifeToLose = (int) Math.ceil(player.getLife() / 2f); - player.loseLife(lifeToLose, game, false); + player.loseLife(lifeToLose, game, source, false); } else { Effect effect = new SacrificeEffect( StaticFilters.FILTER_PERMANENT_CREATURE, 1, null diff --git a/Mage.Sets/src/mage/cards/s/Skullcage.java b/Mage.Sets/src/mage/cards/s/Skullcage.java index 65da7df3a1c..d6e0827ce2b 100644 --- a/Mage.Sets/src/mage/cards/s/Skullcage.java +++ b/Mage.Sets/src/mage/cards/s/Skullcage.java @@ -58,7 +58,7 @@ class SkullcageEffect extends OneShotEffect { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player != null) { if (player.getHand().size() != 3 && player.getHand().size() != 4) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/s/SkullknockerOgre.java b/Mage.Sets/src/mage/cards/s/SkullknockerOgre.java index f75f81793cc..4256230c219 100644 --- a/Mage.Sets/src/mage/cards/s/SkullknockerOgre.java +++ b/Mage.Sets/src/mage/cards/s/SkullknockerOgre.java @@ -64,8 +64,8 @@ class SkullknockerOgreEffect extends OneShotEffect { if (player == null) { return false; } - if (player.discard(1, true, source, game).size() > 0) { - player.drawCards(1, source.getSourceId(), game); + if (player.discard(1, true, false, source, game).size() > 0) { + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/Skullscorch.java b/Mage.Sets/src/mage/cards/s/Skullscorch.java index 548b3abac01..af3d42d7c1c 100644 --- a/Mage.Sets/src/mage/cards/s/Skullscorch.java +++ b/Mage.Sets/src/mage/cards/s/Skullscorch.java @@ -71,11 +71,11 @@ class SkullscorchDiscardEffect extends OneShotEffect { if (player != null) { if (player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 4 damage to you?", source, game)) { discardCards = false; - player.damage(4, source.getSourceId(), game); + player.damage(4, source.getSourceId(), source, game); game.informPlayers(player.getLogName() + " has " + spell.getLogName() + " deal 4 to them"); } if (discardCards) { - player.discard(2, true, source, game); + player.discard(2, true, false, source, game); } } return discardCards; diff --git a/Mage.Sets/src/mage/cards/s/Skullsnatcher.java b/Mage.Sets/src/mage/cards/s/Skullsnatcher.java index 484a2c9b310..babf2731ae2 100644 --- a/Mage.Sets/src/mage/cards/s/Skullsnatcher.java +++ b/Mage.Sets/src/mage/cards/s/Skullsnatcher.java @@ -79,7 +79,7 @@ class SkullsnatcherTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SkySwallower.java b/Mage.Sets/src/mage/cards/s/SkySwallower.java index 68252b51382..4df18984ac0 100644 --- a/Mage.Sets/src/mage/cards/s/SkySwallower.java +++ b/Mage.Sets/src/mage/cards/s/SkySwallower.java @@ -70,7 +70,7 @@ class GainControlAllPermanentsEffect extends ContinuousEffectImpl { if (targetPlayer != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (permanent != null && !permanent.getId().equals(source.getSourceId())) { - permanent.changeControllerId(targetPlayer.getId(), game); + permanent.changeControllerId(targetPlayer.getId(), game, source); } } } else { diff --git a/Mage.Sets/src/mage/cards/s/Skybind.java b/Mage.Sets/src/mage/cards/s/Skybind.java index 083cd8eaa94..db4faa085a5 100644 --- a/Mage.Sets/src/mage/cards/s/Skybind.java +++ b/Mage.Sets/src/mage/cards/s/Skybind.java @@ -65,7 +65,7 @@ class SkybindEffect extends OneShotEffect { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (permanent != null && sourcePermanent != null) { - if (permanent.moveToExile(source.getSourceId(), sourcePermanent.getName(), source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), sourcePermanent.getName(), source, game)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step"); diff --git a/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java b/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java index 3878b0c9b22..12b70ecc408 100644 --- a/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java +++ b/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java @@ -110,9 +110,7 @@ class SkyclaveApparitionEffect extends OneShotEffect { .mapToInt(MageObject::getConvertedManaCost) .sum(); for (UUID playerId : owners) { - new CustomIllusionToken(totalCMC).putOntoBattlefield( - 1, game, source.getSourceId(), playerId - ); + new CustomIllusionToken(totalCMC).putOntoBattlefield(1, game, source, playerId); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SkymarkRoc.java b/Mage.Sets/src/mage/cards/s/SkymarkRoc.java index 77ad6541430..763b8e01adb 100644 --- a/Mage.Sets/src/mage/cards/s/SkymarkRoc.java +++ b/Mage.Sets/src/mage/cards/s/SkymarkRoc.java @@ -63,7 +63,7 @@ class SkymarkRocAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SkyshipPlunderer.java b/Mage.Sets/src/mage/cards/s/SkyshipPlunderer.java index e8191160d8c..990f906de8a 100644 --- a/Mage.Sets/src/mage/cards/s/SkyshipPlunderer.java +++ b/Mage.Sets/src/mage/cards/s/SkyshipPlunderer.java @@ -80,7 +80,7 @@ class SkyshipPlundererEffect extends OneShotEffect { } else { counterToAdd = new Counter(counter.getName()); } - player.addCounters(counterToAdd, game); + player.addCounters(counterToAdd, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java index 817b025966f..eee5620f4c6 100644 --- a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java +++ b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java @@ -96,7 +96,7 @@ class SkyshipWeatherlightEffect extends SearchEffect { for (UUID cardID : target.getTargets()) { Card card = controller.getLibrary().getCard(cardID, game); if (card != null) { - controller.moveCardToExileWithInfo(card, exileZone, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, exileZone, sourceObject.getIdName(), source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SlateStreetRuffian.java b/Mage.Sets/src/mage/cards/s/SlateStreetRuffian.java index 4389ac4401e..aa95397563f 100644 --- a/Mage.Sets/src/mage/cards/s/SlateStreetRuffian.java +++ b/Mage.Sets/src/mage/cards/s/SlateStreetRuffian.java @@ -66,7 +66,7 @@ class SlateStreetRuffianDiscardEffect extends OneShotEffect { if (blockingCreature != null) { Player opponent = game.getPlayer(blockingCreature.getControllerId()); if (opponent != null) { - opponent.discard(1, false, source, game); + opponent.discard(1, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SlaughterTheStrong.java b/Mage.Sets/src/mage/cards/s/SlaughterTheStrong.java index c3832f3cebf..52cf3cb6d4a 100644 --- a/Mage.Sets/src/mage/cards/s/SlaughterTheStrong.java +++ b/Mage.Sets/src/mage/cards/s/SlaughterTheStrong.java @@ -130,7 +130,7 @@ class SlaughterTheStrongEffect extends OneShotEffect { } for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game)) { if (!selectedCreatures.contains(creature.getId())) { - creature.sacrifice(source.getSourceId(), game); + creature.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SlaveringNulls.java b/Mage.Sets/src/mage/cards/s/SlaveringNulls.java index 91dec6147b4..888f7e37292 100644 --- a/Mage.Sets/src/mage/cards/s/SlaveringNulls.java +++ b/Mage.Sets/src/mage/cards/s/SlaveringNulls.java @@ -71,7 +71,7 @@ class SlaveringNullsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SlayersPlate.java b/Mage.Sets/src/mage/cards/s/SlayersPlate.java index 04bfcb2ad7d..5f9054f82a7 100644 --- a/Mage.Sets/src/mage/cards/s/SlayersPlate.java +++ b/Mage.Sets/src/mage/cards/s/SlayersPlate.java @@ -68,7 +68,7 @@ class SlayersPlateTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/Sleep.java b/Mage.Sets/src/mage/cards/s/Sleep.java index b9380485bf1..b90fc9929f3 100644 --- a/Mage.Sets/src/mage/cards/s/Sleep.java +++ b/Mage.Sets/src/mage/cards/s/Sleep.java @@ -59,7 +59,7 @@ class SleepEffect extends OneShotEffect { if (player != null) { List doNotUntapNextUntapStep = new ArrayList<>(); for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game)) { - creature.tap(game); + creature.tap(source, game); doNotUntapNextUntapStep.add(creature); } if (!doNotUntapNextUntapStep.isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/s/SleeperAgent.java b/Mage.Sets/src/mage/cards/s/SleeperAgent.java index b86f171ffe9..3460f38d621 100644 --- a/Mage.Sets/src/mage/cards/s/SleeperAgent.java +++ b/Mage.Sets/src/mage/cards/s/SleeperAgent.java @@ -71,7 +71,7 @@ class SleeperAgentChangeControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/s/SlimeMolding.java b/Mage.Sets/src/mage/cards/s/SlimeMolding.java index 66ebf3c050b..07ae8cfa428 100644 --- a/Mage.Sets/src/mage/cards/s/SlimeMolding.java +++ b/Mage.Sets/src/mage/cards/s/SlimeMolding.java @@ -53,7 +53,7 @@ class SlimeMoldingEffect extends OneShotEffect { OozeToken oozeToken = new OozeToken(); oozeToken.getPower().modifyBaseValue(count); oozeToken.getToughness().modifyBaseValue(count); - oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + oozeToken.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/s/SlipperyBogbonder.java b/Mage.Sets/src/mage/cards/s/SlipperyBogbonder.java index ccaf584530f..fd31c986812 100644 --- a/Mage.Sets/src/mage/cards/s/SlipperyBogbonder.java +++ b/Mage.Sets/src/mage/cards/s/SlipperyBogbonder.java @@ -135,7 +135,7 @@ class SlipperyBogbonderEffect extends OneShotEffect { .filter(entry -> entry.getValue() > 0) .map(entry -> CounterType.findByName(entry.getKey()).createInstance(entry.getValue())) .filter(counter -> creature.addCounters(counter, source, game)) - .forEach(counter -> permanent.removeCounters(counter, game)); + .forEach(counter -> permanent.removeCounters(counter, source, game)); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/Slithermuse.java b/Mage.Sets/src/mage/cards/s/Slithermuse.java index 0f80ab9aaa3..d4ebce607cc 100644 --- a/Mage.Sets/src/mage/cards/s/Slithermuse.java +++ b/Mage.Sets/src/mage/cards/s/Slithermuse.java @@ -83,7 +83,7 @@ class SlithermuseEffect extends OneShotEffect { game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName()); int diff = chosenPlayer.getHand().size() - player.getHand().size(); if (diff > 0) { - player.drawCards(diff, source.getSourceId(), game); + player.drawCards(diff, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SlowMotion.java b/Mage.Sets/src/mage/cards/s/SlowMotion.java index adfd520219b..e27ea80356a 100644 --- a/Mage.Sets/src/mage/cards/s/SlowMotion.java +++ b/Mage.Sets/src/mage/cards/s/SlowMotion.java @@ -88,11 +88,11 @@ class SacrificeEquipedUnlessPaysEffect extends OneShotEffect { } if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? (Or " + equipped.getName() + " will be sacrificed.)", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), equipped.getControllerId(), false, null)) { + if (cost.pay(source, game, source, equipped.getControllerId(), false, null)) { return true; } } - equipped.sacrifice(source.getSourceId(), game); + equipped.sacrifice(source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/s/SludgeStrider.java b/Mage.Sets/src/mage/cards/s/SludgeStrider.java index 4ba957c8abc..6edcd6c27e4 100644 --- a/Mage.Sets/src/mage/cards/s/SludgeStrider.java +++ b/Mage.Sets/src/mage/cards/s/SludgeStrider.java @@ -70,7 +70,7 @@ class SludgeStriderTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD || event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -122,7 +122,7 @@ class SludgeStriderEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (targetPlayer != null) { - targetPlayer.loseLife(1, game, false); + targetPlayer.loseLife(1, game, source, false); } if (you != null) { you.gainLife(1, game, source); diff --git a/Mage.Sets/src/mage/cards/s/SmashToSmithereens.java b/Mage.Sets/src/mage/cards/s/SmashToSmithereens.java index c2315cbb1d2..f4b21626dd8 100644 --- a/Mage.Sets/src/mage/cards/s/SmashToSmithereens.java +++ b/Mage.Sets/src/mage/cards/s/SmashToSmithereens.java @@ -59,9 +59,9 @@ class SmashToSmithereensEffect extends OneShotEffect { Permanent targetArtifact = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (targetArtifact != null) { Player controllerOfArtifact = game.getPlayer(targetArtifact.getControllerId()); - targetArtifact.destroy(source.getSourceId(), game, false); + targetArtifact.destroy(source, game, false); if (controllerOfArtifact != null) { - controllerOfArtifact.damage(3, source.getSourceId(), game); + controllerOfArtifact.damage(3, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SmokeShroud.java b/Mage.Sets/src/mage/cards/s/SmokeShroud.java index 7e899b610e0..7c9a9570e63 100644 --- a/Mage.Sets/src/mage/cards/s/SmokeShroud.java +++ b/Mage.Sets/src/mage/cards/s/SmokeShroud.java @@ -89,7 +89,7 @@ class SmokeShroudEffect extends OneShotEffect { if (sourceCard != null && permanent != null && controller != null) { game.getState().setValue("attachTo:" + sourceCard.getId(), permanent); if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) { - permanent.addAttachment(sourceCard.getId(), game); + permanent.addAttachment(sourceCard.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/Smokestack.java b/Mage.Sets/src/mage/cards/s/Smokestack.java index 3f4c1868fb7..9b31897e1ff 100644 --- a/Mage.Sets/src/mage/cards/s/Smokestack.java +++ b/Mage.Sets/src/mage/cards/s/Smokestack.java @@ -72,8 +72,8 @@ class SmokestackEffect extends OneShotEffect { Target target = new TargetControlledPermanent(amount, amount, new FilterControlledPermanent(), true); //A spell or ability could have removed the only legal target this player //had, if thats the case this ability should fizzle. - if (target.canChoose(activePlayer.getId(), game)) { - while (!target.isChosen() && target.canChoose(activePlayer.getId(), game) && activePlayer.canRespond()) { + if (target.canChoose(source.getSourceId(), activePlayer.getId(), game)) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), activePlayer.getId(), game) && activePlayer.canRespond()) { activePlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } @@ -81,7 +81,7 @@ class SmokestackEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getTargets().get(idx)); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SmotheringAbomination.java b/Mage.Sets/src/mage/cards/s/SmotheringAbomination.java index 5742e6ddd9d..b336c67e194 100644 --- a/Mage.Sets/src/mage/cards/s/SmotheringAbomination.java +++ b/Mage.Sets/src/mage/cards/s/SmotheringAbomination.java @@ -74,7 +74,7 @@ class SmotheringAbominationTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SmotheringTithe.java b/Mage.Sets/src/mage/cards/s/SmotheringTithe.java index 8bcd90d15a8..2ac6e026d5f 100644 --- a/Mage.Sets/src/mage/cards/s/SmotheringTithe.java +++ b/Mage.Sets/src/mage/cards/s/SmotheringTithe.java @@ -66,7 +66,7 @@ class SmotheringTitheEffect extends OneShotEffect { } Cost cost = ManaUtil.createManaCost(2, false); if (!player.chooseUse(Outcome.Detriment, "Pay {2} to prevent this effect?", source, game) - || !cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + || !cost.pay(source, game, source, player.getId(), false)) { return new CreateTokenEffect(new TreasureToken()).apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/cards/s/SnickeringSquirrel.java b/Mage.Sets/src/mage/cards/s/SnickeringSquirrel.java index 8cce1e89f7d..f6e44a851ab 100644 --- a/Mage.Sets/src/mage/cards/s/SnickeringSquirrel.java +++ b/Mage.Sets/src/mage/cards/s/SnickeringSquirrel.java @@ -61,7 +61,7 @@ class SnickeringSquirrelEffect extends ReplacementEffectImpl { if (controller.chooseUse(Outcome.AIDontUseIt, "Do you want to tap this to increase the result of a die (" + event.getAmount() + ") " + dieRoller.getName() + " rolled by 1?", null, "Yes", "No", source, game)) { - permanent.tap(game); + permanent.tap(source, game); // ignore planar dies (dice roll amount of planar dies is equal to 0) if (event.getAmount() > 0) { event.setAmount(event.getAmount() + 1); diff --git a/Mage.Sets/src/mage/cards/s/SnowMercy.java b/Mage.Sets/src/mage/cards/s/SnowMercy.java index 0c42d49998e..17358ef128b 100644 --- a/Mage.Sets/src/mage/cards/s/SnowMercy.java +++ b/Mage.Sets/src/mage/cards/s/SnowMercy.java @@ -110,16 +110,16 @@ class SnowMercyCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); - Permanent permanent = game.getPermanent(sourceId); + Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { // Tap, Untap, Tap, Untap, Tap: - if (!permanent.isTapped() && permanent.tap(game)) { + if (!permanent.isTapped() && permanent.tap(source, game)) { if (permanent.isTapped() && permanent.untap(game)) { - if (!permanent.isTapped() && permanent.tap(game)) { + if (!permanent.isTapped() && permanent.tap(source, game)) { if (permanent.isTapped() && permanent.untap(game)) { - if (!permanent.isTapped() && permanent.tap(game)) { + if (!permanent.isTapped() && permanent.tap(source, game)) { paid = true; } } @@ -131,8 +131,8 @@ class SnowMercyCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { return !permanent.isTapped(); } diff --git a/Mage.Sets/src/mage/cards/s/SolarBlaze.java b/Mage.Sets/src/mage/cards/s/SolarBlaze.java index eeeca918884..731673eb93c 100644 --- a/Mage.Sets/src/mage/cards/s/SolarBlaze.java +++ b/Mage.Sets/src/mage/cards/s/SolarBlaze.java @@ -55,7 +55,7 @@ class SolarBlazeEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents( StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game) ) { - permanent.damage(permanent.getPower().getValue(), permanent.getId(), game); + permanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SoldeviDigger.java b/Mage.Sets/src/mage/cards/s/SoldeviDigger.java index 2ae2a1c4df6..7a28552b937 100644 --- a/Mage.Sets/src/mage/cards/s/SoldeviDigger.java +++ b/Mage.Sets/src/mage/cards/s/SoldeviDigger.java @@ -63,7 +63,7 @@ class SoldeviDiggerEffect extends OneShotEffect { topCard = card; } if (topCard != null) { - return controller.moveCardToLibraryWithInfo(topCard, source.getSourceId(), game, Zone.GRAVEYARD, false, true); + return controller.moveCardToLibraryWithInfo(topCard, source, game, Zone.GRAVEYARD, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SoldeviSentry.java b/Mage.Sets/src/mage/cards/s/SoldeviSentry.java index e0de16347c3..ed6b52b6081 100644 --- a/Mage.Sets/src/mage/cards/s/SoldeviSentry.java +++ b/Mage.Sets/src/mage/cards/s/SoldeviSentry.java @@ -55,7 +55,7 @@ class SoldeviSentryEffect extends RegenerateSourceEffect { if (permanent != null && permanent.regenerate(source, game)) { if (opponent != null) { if (opponent.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) { - opponent.drawCards(1, source.getSourceId(), game); + opponent.drawCards(1, source, game); } } this.used = true; diff --git a/Mage.Sets/src/mage/cards/s/Solemnity.java b/Mage.Sets/src/mage/cards/s/Solemnity.java index a8ed98f39a6..bd9a796e701 100644 --- a/Mage.Sets/src/mage/cards/s/Solemnity.java +++ b/Mage.Sets/src/mage/cards/s/Solemnity.java @@ -68,7 +68,7 @@ class SolemnityEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ADD_COUNTERS; + return event.getType() == GameEvent.EventType.ADD_COUNTERS; } @Override @@ -111,24 +111,21 @@ class SolemnityEffect2 extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ADD_COUNTERS; + return event.getType() == GameEvent.EventType.ADD_COUNTERS; } @Override public boolean applies(GameEvent event, Ability source, Game game) { MageObject object = game.getObject(event.getTargetId()); - Permanent permanent = game.getPermanentEntering(event.getSourceId()); + Permanent permanent1 = game.getPermanentEntering(event.getTargetId()); Permanent permanent2 = game.getPermanent(event.getTargetId()); - Permanent permanent3 = game.getPermanentEntering(event.getTargetId()); if (object instanceof Permanent) { return filter.match((Permanent) object, game); - } else if (permanent != null) { - return filter.match(permanent, game); + } else if (permanent1 != null) { + return filter.match(permanent1, game); } else if (permanent2 != null) { return filter.match(permanent2, game); - } else if (permanent3 != null) { - return filter.match(permanent3, game); } return false; diff --git a/Mage.Sets/src/mage/cards/s/SolkanarTheSwampKing.java b/Mage.Sets/src/mage/cards/s/SolkanarTheSwampKing.java index ec7117afee8..63c44678afe 100644 --- a/Mage.Sets/src/mage/cards/s/SolkanarTheSwampKing.java +++ b/Mage.Sets/src/mage/cards/s/SolkanarTheSwampKing.java @@ -64,7 +64,7 @@ class SolkanarTheSwampKingAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SoltariGuerrillas.java b/Mage.Sets/src/mage/cards/s/SoltariGuerrillas.java index 7d9fed18c70..3bcc81c68ff 100644 --- a/Mage.Sets/src/mage/cards/s/SoltariGuerrillas.java +++ b/Mage.Sets/src/mage/cards/s/SoltariGuerrillas.java @@ -89,7 +89,7 @@ class SoltariGuerrillasReplacementEffect extends PreventionEffectImpl { if (redirectTo != null) { game.informPlayers("Dealing " + preventionResult.getPreventedDamage() + " to " + redirectTo.getLogName() + " instead."); DamageEvent damageEvent = (DamageEvent) event; - redirectTo.damage(preventionResult.getPreventedDamage(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + redirectTo.damage(preventionResult.getPreventedDamage(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); } discard(); // (only once) } diff --git a/Mage.Sets/src/mage/cards/s/SoltariVisionary.java b/Mage.Sets/src/mage/cards/s/SoltariVisionary.java index 112edd65aa7..39406d26e0e 100644 --- a/Mage.Sets/src/mage/cards/s/SoltariVisionary.java +++ b/Mage.Sets/src/mage/cards/s/SoltariVisionary.java @@ -67,7 +67,7 @@ class SoltariVisionaryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SongOfBlood.java b/Mage.Sets/src/mage/cards/s/SongOfBlood.java index 9838614994a..4e11597e7ce 100644 --- a/Mage.Sets/src/mage/cards/s/SongOfBlood.java +++ b/Mage.Sets/src/mage/cards/s/SongOfBlood.java @@ -101,7 +101,7 @@ class SongOfBloodTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SonicAssault.java b/Mage.Sets/src/mage/cards/s/SonicAssault.java index 3564f429c81..4cea939de06 100644 --- a/Mage.Sets/src/mage/cards/s/SonicAssault.java +++ b/Mage.Sets/src/mage/cards/s/SonicAssault.java @@ -63,12 +63,12 @@ class SonicAssaultEffect extends OneShotEffect { if (creature == null) { return false; } - creature.tap(game); + creature.tap(source, game); Player player = game.getPlayer(creature.getControllerId()); if (player == null) { return false; } - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SootImp.java b/Mage.Sets/src/mage/cards/s/SootImp.java index 38f00658cc3..6aca3a43409 100644 --- a/Mage.Sets/src/mage/cards/s/SootImp.java +++ b/Mage.Sets/src/mage/cards/s/SootImp.java @@ -77,7 +77,7 @@ class SootImpEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player caster = game.getPlayer(targetPointer.getFirst(game, source)); if (caster != null) { - caster.loseLife(1, game, false); + caster.loseLife(1, game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SorinGrimNemesis.java b/Mage.Sets/src/mage/cards/s/SorinGrimNemesis.java index 49880cc15b7..9db5536d2b6 100644 --- a/Mage.Sets/src/mage/cards/s/SorinGrimNemesis.java +++ b/Mage.Sets/src/mage/cards/s/SorinGrimNemesis.java @@ -83,12 +83,12 @@ class SorinGrimNemesisRevealEffect extends OneShotEffect { cards.add(card); player.revealCards("Sorin, Grim Nemesis", cards, game); - if (card.moveToZone(Zone.HAND, source.getSourceId(), game, false)) { + if (card.moveToZone(Zone.HAND, source, game, false)) { for (UUID playerId : game.getOpponents(source.getControllerId())) { if (card.getConvertedManaCost() > 0) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - opponent.loseLife(card.getConvertedManaCost(), game, false); + opponent.loseLife(card.getConvertedManaCost(), game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java b/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java index d65929f660e..fe1cbb1e2b4 100644 --- a/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java +++ b/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java @@ -92,7 +92,7 @@ class SorinLordOfInnistradEffect extends OneShotEffect { for (UUID targetId : source.getTargets().get(0).getTargets()) { Permanent perm = game.getPermanent(targetId); if (perm != null) { - perm.destroy(source.getSourceId(), game, false); + perm.destroy(source, game, false); if (Zone.GRAVEYARD == game.getState().getZone(targetId)) { Card card = game.getCard(targetId); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/s/SorrowsPath.java b/Mage.Sets/src/mage/cards/s/SorrowsPath.java index f352c2bc234..29d8fc9ba71 100644 --- a/Mage.Sets/src/mage/cards/s/SorrowsPath.java +++ b/Mage.Sets/src/mage/cards/s/SorrowsPath.java @@ -17,6 +17,7 @@ import mage.filter.common.FilterOpponentsCreaturePermanent; import mage.filter.predicate.permanent.BlockingPredicate; import mage.game.Game; import mage.game.combat.CombatGroup; +import mage.game.events.BlockerDeclaredEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -135,7 +136,7 @@ class SorrowsPathSwitchBlockersEffect extends OneShotEffect { game.getState().setValue("becameBlocked_" + key, morSet); game.fireEvent(GameEvent.getEvent( GameEvent.EventType.BATCH_BLOCK_NONCOMBAT, - source.getSourceId(), source.getSourceId(), + source.getSourceId(), source, source.getControllerId(), key, 0) ); return true; @@ -177,7 +178,7 @@ class SorrowsPathSwitchBlockersEffect extends OneShotEffect { group.addBlockerToGroup(blocker.getId(), blocker.getControllerId(), game); game.getCombat().addBlockingGroup(blocker.getId(), attacker.getId(), blocker.getControllerId(), game); // TODO: find an alternate event solution for multi-blockers (as per issue #4285), this will work fine for single blocker creatures though - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BLOCKER_DECLARED, attacker.getId(), blocker.getId(), blocker.getControllerId())); + game.fireEvent(new BlockerDeclaredEvent(attacker.getId(), blocker.getId(), blocker.getControllerId())); group.pickBlockerOrder(attacker.getControllerId(), game); } } diff --git a/Mage.Sets/src/mage/cards/s/SosukeSonOfSeshiro.java b/Mage.Sets/src/mage/cards/s/SosukeSonOfSeshiro.java index 26285cbb2de..28a6a82fca7 100644 --- a/Mage.Sets/src/mage/cards/s/SosukeSonOfSeshiro.java +++ b/Mage.Sets/src/mage/cards/s/SosukeSonOfSeshiro.java @@ -79,7 +79,7 @@ class SosukeSonOfSeshiroTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SoulBarrier.java b/Mage.Sets/src/mage/cards/s/SoulBarrier.java index 7677d3c7e1d..2e976017785 100644 --- a/Mage.Sets/src/mage/cards/s/SoulBarrier.java +++ b/Mage.Sets/src/mage/cards/s/SoulBarrier.java @@ -66,8 +66,8 @@ class SoulBarrierEffect extends OneShotEffect { Cost cost = ManaUtil.createManaCost(2, false); String message = "Would you like to pay {2} to prevent taking 2 damage from " + permanent.getLogName() + "?"; if (!(player.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), player.getId(), false, null))) { - player.damage(2, source.getSourceId(), game); + && cost.pay(source, game, source, player.getId(), false, null))) { + player.damage(2, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SoulBurn.java b/Mage.Sets/src/mage/cards/s/SoulBurn.java index 728ee150ca7..fe1c77260bd 100644 --- a/Mage.Sets/src/mage/cards/s/SoulBurn.java +++ b/Mage.Sets/src/mage/cards/s/SoulBurn.java @@ -144,14 +144,14 @@ class SoulBurnEffect extends OneShotEffect { } else { return false; } - permanent.damage(totalXAmount, source.getSourceId(), game); + permanent.damage(totalXAmount, source.getSourceId(), source, game); } else { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player == null) { return false; } lifetogain = Math.min(player.getLife(), lifetogain); - player.damage(totalXAmount, source.getSourceId(), game); + player.damage(totalXAmount, source.getSourceId(), source, game); } Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { diff --git a/Mage.Sets/src/mage/cards/s/SoulEcho.java b/Mage.Sets/src/mage/cards/s/SoulEcho.java index 7adefc2cb6f..dd6edfcb4cf 100644 --- a/Mage.Sets/src/mage/cards/s/SoulEcho.java +++ b/Mage.Sets/src/mage/cards/s/SoulEcho.java @@ -122,7 +122,7 @@ class SoulEchoReplacementEffect extends ReplacementEffectImpl { Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (permanent != null && controller != null) { - permanent.removeCounters(CounterType.ECHO.createInstance(damage), game); + permanent.removeCounters(CounterType.ECHO.createInstance(damage), source, game); game.informPlayers(controller.getLogName() + ": " + damage + " damage replaced with " + permanent.getLogName()); } return true; @@ -130,7 +130,7 @@ class SoulEchoReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SoulFoundry.java b/Mage.Sets/src/mage/cards/s/SoulFoundry.java index 8949dad6e90..f914b4163d3 100644 --- a/Mage.Sets/src/mage/cards/s/SoulFoundry.java +++ b/Mage.Sets/src/mage/cards/s/SoulFoundry.java @@ -106,7 +106,7 @@ class SoulFoundryImprintEffect extends OneShotEffect { && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { Card card = controller.getHand().get(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getIdName() + " (Imprint)", source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getIdName() + " (Imprint)", source, game, Zone.HAND, true); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); diff --git a/Mage.Sets/src/mage/cards/s/SoulNova.java b/Mage.Sets/src/mage/cards/s/SoulNova.java index b7ce45b90c6..6172d7ba4b7 100644 --- a/Mage.Sets/src/mage/cards/s/SoulNova.java +++ b/Mage.Sets/src/mage/cards/s/SoulNova.java @@ -64,11 +64,11 @@ class SoulNovaEffect extends OneShotEffect { for (UUID attachmentId : attachments) { Permanent attachment = game.getPermanent(attachmentId); if (attachment.hasSubtype(SubType.EQUIPMENT, game)) { - attachment.moveToExile(null, "", source.getSourceId(), game); + attachment.moveToExile(null, "", source, game); } } - permanent.moveToExile(null, "", source.getSourceId(), game); + permanent.moveToExile(null, "", source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java b/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java index 8beb8d1b661..12d8a4e7a05 100644 --- a/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java +++ b/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java @@ -84,10 +84,10 @@ class SoulOfShandalarEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), 3, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), 3, source.getSourceId(), source, game, false, true); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { - creature.damage(3, source.getSourceId(), game, false, true); + creature.damage(3, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SoulRansom.java b/Mage.Sets/src/mage/cards/s/SoulRansom.java index d227a097d67..8c138eb5e23 100644 --- a/Mage.Sets/src/mage/cards/s/SoulRansom.java +++ b/Mage.Sets/src/mage/cards/s/SoulRansom.java @@ -83,7 +83,7 @@ class SoulRansomEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = source.getSourcePermanentIfItStillExists(game); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } else { permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } @@ -94,7 +94,7 @@ class SoulRansomEffect extends OneShotEffect { if (controller == null) { return false; } - controller.drawCards(2, source.getSourceId(), game); + controller.drawCards(2, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SoulReap.java b/Mage.Sets/src/mage/cards/s/SoulReap.java index 4520aec7370..ace9a45e93b 100644 --- a/Mage.Sets/src/mage/cards/s/SoulReap.java +++ b/Mage.Sets/src/mage/cards/s/SoulReap.java @@ -93,7 +93,7 @@ class SoulReapWatcher extends Watcher { if (condition == true) { //no need to check - condition has already occured return; } - if (event.getType() == EventType.SPELL_CAST + if (event.getType() == GameEvent.EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) { @@ -131,7 +131,7 @@ class SoulReapEffect extends OneShotEffect { if (creature != null) { Player controller = game.getPlayer(creature.getControllerId()); if (controller != null) { - controller.loseLife(3, game, false); + controller.loseLife(3, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SoulRend.java b/Mage.Sets/src/mage/cards/s/SoulRend.java index d306b6ab30f..9719876f8c4 100644 --- a/Mage.Sets/src/mage/cards/s/SoulRend.java +++ b/Mage.Sets/src/mage/cards/s/SoulRend.java @@ -56,7 +56,7 @@ class SoulRendEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null && permanent.getColor(game).isWhite()) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); } return false; } diff --git a/Mage.Sets/src/mage/cards/s/SoulSeizer.java b/Mage.Sets/src/mage/cards/s/SoulSeizer.java index c525664df3a..ae1bfe79493 100644 --- a/Mage.Sets/src/mage/cards/s/SoulSeizer.java +++ b/Mage.Sets/src/mage/cards/s/SoulSeizer.java @@ -74,7 +74,7 @@ class SoulSeizerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -118,7 +118,7 @@ class SoulSeizerEffect extends OneShotEffect { game.informPlayers(permanent.getName() + " transforms into " + permanent.getSecondCardFace().getName()); Permanent attachTo = game.getPermanent(targetPointer.getFirst(game, source)); if (attachTo != null) { - return attachTo.addAttachment(source.getSourceId(), game); + return attachTo.addAttachment(source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SoulSeparator.java b/Mage.Sets/src/mage/cards/s/SoulSeparator.java index 9691ba87725..0e60158acb7 100644 --- a/Mage.Sets/src/mage/cards/s/SoulSeparator.java +++ b/Mage.Sets/src/mage/cards/s/SoulSeparator.java @@ -84,9 +84,9 @@ class SoulSeparatorEffect extends OneShotEffect { if (creatureCard != null && controller != null) { boolean result = false; if (game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) { - result = controller.moveCardToExileWithInfo(creatureCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + result = controller.moveCardToExileWithInfo(creatureCard, null, "", source, game, Zone.GRAVEYARD, true); ZombieToken2 token = new ZombieToken2(creatureCard.getPower().getValue(), creatureCard.getToughness().getValue()); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); } return result; } diff --git a/Mage.Sets/src/mage/cards/s/SoulTithe.java b/Mage.Sets/src/mage/cards/s/SoulTithe.java index 89b360a4f57..7fc203ea4ca 100644 --- a/Mage.Sets/src/mage/cards/s/SoulTithe.java +++ b/Mage.Sets/src/mage/cards/s/SoulTithe.java @@ -76,11 +76,11 @@ class SoulTitheEffect extends OneShotEffect { if (player != null) { Cost cost = ManaUtil.createManaCost(permanent.getConvertedManaCost(), true); if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " for " + permanent.getName() + "? (otherwise you sacrifice it)", source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { return true; } } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/Soulblast.java b/Mage.Sets/src/mage/cards/s/Soulblast.java index d9adb505e9d..45461cc2996 100644 --- a/Mage.Sets/src/mage/cards/s/Soulblast.java +++ b/Mage.Sets/src/mage/cards/s/Soulblast.java @@ -71,11 +71,11 @@ class SoulblastEffect extends OneShotEffect { if (power > 0) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { - player.damage(power, source.getSourceId(), game); + player.damage(power, source.getSourceId(), source, game); } else { Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.damage(power, source.getSourceId(), game, false, true); + creature.damage(power, source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SoulfireEruption.java b/Mage.Sets/src/mage/cards/s/SoulfireEruption.java index 9ad3657ada6..e23cf249d2f 100644 --- a/Mage.Sets/src/mage/cards/s/SoulfireEruption.java +++ b/Mage.Sets/src/mage/cards/s/SoulfireEruption.java @@ -87,10 +87,10 @@ class SoulfireEruptionEffect extends OneShotEffect { continue; } if (permanent != null) { - permanent.damage(card.getConvertedManaCost(), source.getSourceId(), game); + permanent.damage(card.getConvertedManaCost(), source.getSourceId(), source, game); } if (player != null) { - player.damage(card.getConvertedManaCost(), source.getSourceId(), game); + player.damage(card.getConvertedManaCost(), source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/Soulquake.java b/Mage.Sets/src/mage/cards/s/Soulquake.java index 515f355491d..8d0c6d21b27 100644 --- a/Mage.Sets/src/mage/cards/s/Soulquake.java +++ b/Mage.Sets/src/mage/cards/s/Soulquake.java @@ -60,13 +60,13 @@ class SoulquakeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { - permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true); + permanent.moveToZone(Zone.HAND, source, game, true); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { for (Card card : player.getGraveyard().getCards(filter2, game)) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SoulsFire.java b/Mage.Sets/src/mage/cards/s/SoulsFire.java index 7418c8d9521..681588f734c 100644 --- a/Mage.Sets/src/mage/cards/s/SoulsFire.java +++ b/Mage.Sets/src/mage/cards/s/SoulsFire.java @@ -71,13 +71,13 @@ class SoulsFireEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(damage, sourcePermanent.getId(), game, false, true); + permanent.damage(damage, sourcePermanent.getId(), source, game, false, true); return true; } Player player = game.getPlayer(targetId); if (player != null) { - player.damage(damage, sourcePermanent.getId(), game); + player.damage(damage, sourcePermanent.getId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/s/SoulsMajesty.java b/Mage.Sets/src/mage/cards/s/SoulsMajesty.java index 19d4172741d..156591510b3 100644 --- a/Mage.Sets/src/mage/cards/s/SoulsMajesty.java +++ b/Mage.Sets/src/mage/cards/s/SoulsMajesty.java @@ -52,7 +52,7 @@ public final class SoulsMajesty extends CardImpl { Permanent target = game.getPermanent(source.getFirstTarget()); Player player = game.getPlayer(source.getControllerId()); if (player != null && target != null) { - player.drawCards(target.getPower().getValue(), source.getSourceId(), game); + player.drawCards(target.getPower().getValue(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SoulsOfTheFaultless.java b/Mage.Sets/src/mage/cards/s/SoulsOfTheFaultless.java index ea1a7e34141..703435f0290 100644 --- a/Mage.Sets/src/mage/cards/s/SoulsOfTheFaultless.java +++ b/Mage.Sets/src/mage/cards/s/SoulsOfTheFaultless.java @@ -67,7 +67,7 @@ class SoulsOfTheFaultlessTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -122,7 +122,7 @@ class SoulsOfTheFaultlessEffect extends OneShotEffect { UUID attackerId = (UUID) this.getValue("attackerId"); Player attacker = game.getPlayer(attackerId); if (attacker != null) { - attacker.loseLife(amount, game, false); + attacker.loseLife(amount, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SovereignsOfLostAlara.java b/Mage.Sets/src/mage/cards/s/SovereignsOfLostAlara.java index 3ec4101bda4..945e7f84ea5 100644 --- a/Mage.Sets/src/mage/cards/s/SovereignsOfLostAlara.java +++ b/Mage.Sets/src/mage/cards/s/SovereignsOfLostAlara.java @@ -71,7 +71,7 @@ class CreatureControlledAttacksAloneTriggeredAbility extends TriggeredAbilityImp @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override @@ -118,7 +118,7 @@ class SovereignsOfLostAlaraEffect extends OneShotEffect { Card aura = game.getCard(target.getFirstTarget()); game.getState().setValue("attachTo:" + aura.getId(), attackingCreature); controller.moveCards(aura, Zone.BATTLEFIELD, source, game); - return attackingCreature.addAttachment(aura.getId(), game); + return attackingCreature.addAttachment(aura.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SparkFiend.java b/Mage.Sets/src/mage/cards/s/SparkFiend.java index 3f55cc67b3f..283f95a7838 100644 --- a/Mage.Sets/src/mage/cards/s/SparkFiend.java +++ b/Mage.Sets/src/mage/cards/s/SparkFiend.java @@ -67,13 +67,13 @@ class SparkFiendEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int roll = controller.rollDice(game, 6) + controller.rollDice(game, 6); + int roll = controller.rollDice(source, game, 6) + controller.rollDice(source, game, 6); MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject instanceof Permanent) { Permanent sourcePermanent = (Permanent) mageObject; if (roll == 2 || roll == 3 || roll == 12) { // sacrifice - sourcePermanent.sacrifice(source.getSourceId(), game); + sourcePermanent.sacrifice(source, game); } else if (roll == 7 || roll == 11) { // don't roll again game.getState().setValue("SparkFiend" + source.getSourceId().toString(), 0); @@ -112,13 +112,13 @@ class SparkFiendUpkeepEffect extends OneShotEffect { if (controller != null) { if (game.getState().getValue("SparkFiend" + source.getSourceId().toString()) != null && (Integer) game.getState().getValue("SparkFiend" + source.getSourceId().toString()) != 0) { - int roll = controller.rollDice(game, 6) + controller.rollDice(game, 6); + int roll = controller.rollDice(source, game, 6) + controller.rollDice(source, game, 6); MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject instanceof Permanent) { Permanent sourcePermanent = (Permanent) mageObject; if (roll == 7) { // sacrifice - sourcePermanent.sacrifice(source.getSourceId(), game); + sourcePermanent.sacrifice(source, game); } else if (roll == (Integer) game.getState().getValue("SparkFiend" + source.getSourceId().toString())) { // don't roll again game.getState().setValue("SparkFiend" + source.getSourceId().toString(), 0); diff --git a/Mage.Sets/src/mage/cards/s/SparkMage.java b/Mage.Sets/src/mage/cards/s/SparkMage.java index fbd0fe7acc8..4274df21a99 100644 --- a/Mage.Sets/src/mage/cards/s/SparkMage.java +++ b/Mage.Sets/src/mage/cards/s/SparkMage.java @@ -65,7 +65,7 @@ class SparkMageTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java b/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java index 1b273e50eb8..d43d344642d 100644 --- a/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java +++ b/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java @@ -73,7 +73,7 @@ class SparkOfCreativityEffect extends OneShotEffect { if (targetCreature != null) { int cmc = card.getManaCost().convertedManaCost(); if (controller.chooseUse(outcome, "Let " + sourceObject.getLogName() + " deal " + cmc + " damage to " + targetCreature.getLogName() + '?', source, game)) { - targetCreature.damage(cmc, source.getSourceId(), game, false, true); + targetCreature.damage(cmc, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SpectralBears.java b/Mage.Sets/src/mage/cards/s/SpectralBears.java index 20790a16bca..8d8179c434f 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralBears.java +++ b/Mage.Sets/src/mage/cards/s/SpectralBears.java @@ -70,7 +70,7 @@ class SpectralBearsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpectralForce.java b/Mage.Sets/src/mage/cards/s/SpectralForce.java index d420a6c3b8e..6c9d41f067d 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralForce.java +++ b/Mage.Sets/src/mage/cards/s/SpectralForce.java @@ -71,7 +71,7 @@ class SpectralForceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpectralPrison.java b/Mage.Sets/src/mage/cards/s/SpectralPrison.java index f502fd33e08..7b297d35945 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralPrison.java +++ b/Mage.Sets/src/mage/cards/s/SpectralPrison.java @@ -74,7 +74,7 @@ class SpectralPrisonAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpellCrumple.java b/Mage.Sets/src/mage/cards/s/SpellCrumple.java index cfcac04d78a..c68f1b166db 100644 --- a/Mage.Sets/src/mage/cards/s/SpellCrumple.java +++ b/Mage.Sets/src/mage/cards/s/SpellCrumple.java @@ -60,7 +60,7 @@ class SpellCrumpleCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game, Zone.LIBRARY, false, ZoneDetail.BOTTOM); + return game.getStack().counter(targetPointer.getFirst(game, source), source, game, Zone.LIBRARY, false, ZoneDetail.BOTTOM); } return false; } diff --git a/Mage.Sets/src/mage/cards/s/SpellRupture.java b/Mage.Sets/src/mage/cards/s/SpellRupture.java index bb632297236..161b0fc1fa9 100644 --- a/Mage.Sets/src/mage/cards/s/SpellRupture.java +++ b/Mage.Sets/src/mage/cards/s/SpellRupture.java @@ -72,11 +72,11 @@ class SpellRuptureCounterUnlessPaysEffect extends OneShotEffect { int maxPower = new GreatestPowerCountCreatureYouControl().calculate(game, source, this); Cost cost = ManaUtil.createManaCost(maxPower, true); if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? (otherwise " + spell.getName() + " will be countered)", source, game) - && cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + && cost.pay(source, game, source, player.getId(), false)) { return true; } game.informPlayers(sourceObject.getName() + ": cost wasn't payed - countering " + spell.getName()); - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/s/SpellShrivel.java b/Mage.Sets/src/mage/cards/s/SpellShrivel.java index 6a38c3b9ff2..bb224fd89d7 100644 --- a/Mage.Sets/src/mage/cards/s/SpellShrivel.java +++ b/Mage.Sets/src/mage/cards/s/SpellShrivel.java @@ -70,13 +70,13 @@ class SpellShrivelCounterUnlessPaysEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Cost cost = ManaUtil.createManaCost(4, false); - if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) { + if (!cost.pay(source, game, source, spell.getControllerId(), false)) { StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget()); - if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source.getSourceId(), stackObject.getControllerId()))) { + if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source, stackObject.getControllerId()))) { game.informPlayers(sourceObject.getIdName() + ": cost wasn't payed - countering " + stackObject.getName()); game.rememberLKI(source.getFirstTarget(), Zone.STACK, stackObject); controller.moveCards((Spell) spell, Zone.EXILED, source, game); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, source.getFirstTarget(), source.getSourceId(), stackObject.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, source.getFirstTarget(), source, stackObject.getControllerId())); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SpellSwindle.java b/Mage.Sets/src/mage/cards/s/SpellSwindle.java index 3c3529e8874..1ffdace9e00 100644 --- a/Mage.Sets/src/mage/cards/s/SpellSwindle.java +++ b/Mage.Sets/src/mage/cards/s/SpellSwindle.java @@ -59,7 +59,7 @@ class SpellSwindleEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source)); if (stackObject != null) { - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); return new CreateTokenEffect(new TreasureToken(), stackObject.getConvertedManaCost()).apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/cards/s/SpellSyphon.java b/Mage.Sets/src/mage/cards/s/SpellSyphon.java index d756b28f2fc..5154fc24400 100644 --- a/Mage.Sets/src/mage/cards/s/SpellSyphon.java +++ b/Mage.Sets/src/mage/cards/s/SpellSyphon.java @@ -79,9 +79,9 @@ class SpellSyphonEffect extends OneShotEffect { game.informPlayers("Spell Syphon: no blue permanents in controller's battlefield."); } else { Cost cost = ManaUtil.createManaCost(amount, false); - if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) { + if (!cost.pay(source, game, source, spell.getControllerId(), false)) { game.informPlayers("Spell Syphon: cost wasn't payed - countering target spell."); - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/Spellbinder.java b/Mage.Sets/src/mage/cards/s/Spellbinder.java index 8341cd79820..3721e5162dc 100644 --- a/Mage.Sets/src/mage/cards/s/Spellbinder.java +++ b/Mage.Sets/src/mage/cards/s/Spellbinder.java @@ -76,7 +76,7 @@ class SpellbinderTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -125,7 +125,7 @@ class SpellbinderImprintEffect extends OneShotEffect { Card card = controller.getHand().get(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo(card, source.getSourceId(), - sourcePermanent.getIdName() + " (Imprint)", source.getSourceId(), game, Zone.HAND, true); + sourcePermanent.getIdName() + " (Imprint)", source, game, Zone.HAND, true); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); diff --git a/Mage.Sets/src/mage/cards/s/SpellboundDragon.java b/Mage.Sets/src/mage/cards/s/SpellboundDragon.java index 5083039fee7..b79f5260dcf 100644 --- a/Mage.Sets/src/mage/cards/s/SpellboundDragon.java +++ b/Mage.Sets/src/mage/cards/s/SpellboundDragon.java @@ -71,11 +71,11 @@ class SpellboundDragonEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); Permanent dragon = game.getPermanent(source.getSourceId()); if(you != null) { - you.drawCards(1, source.getSourceId(), game); + you.drawCards(1, source, game); TargetDiscard target = new TargetDiscard(you.getId()); you.choose(Outcome.Discard, target, source.getSourceId(), game); Card card = you.getHand().get(target.getFirstTarget(), game); - if (card != null && you.discard(card, source, game)) { + if (card != null && you.discard(card, false, source, game)) { int cmc = card.getConvertedManaCost(); if (dragon != null) { game.addEffect(new BoostSourceEffect(cmc, 0, Duration.EndOfTurn), source); diff --git a/Mage.Sets/src/mage/cards/s/Spelljack.java b/Mage.Sets/src/mage/cards/s/Spelljack.java index 23bda24acda..9527a7e122c 100644 --- a/Mage.Sets/src/mage/cards/s/Spelljack.java +++ b/Mage.Sets/src/mage/cards/s/Spelljack.java @@ -68,7 +68,7 @@ class SpelljackEffect extends OneShotEffect { if (controller != null) { UUID targetId = targetPointer.getFirst(game, source); StackObject stackObject = game.getStack().getStackObject(targetId); - if (stackObject != null && game.getStack().counter(targetId, source.getSourceId(), game, Zone.EXILED, false, ZoneDetail.NONE)) { + if (stackObject != null && game.getStack().counter(targetId, source, game, Zone.EXILED, false, ZoneDetail.NONE)) { Card card = ((Spell) stackObject).getCard(); if (card != null) { ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.Custom, true); diff --git a/Mage.Sets/src/mage/cards/s/Spellshock.java b/Mage.Sets/src/mage/cards/s/Spellshock.java index cb34f306b60..b9ebd084d4e 100644 --- a/Mage.Sets/src/mage/cards/s/Spellshock.java +++ b/Mage.Sets/src/mage/cards/s/Spellshock.java @@ -57,7 +57,7 @@ class SpellshockTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpelltitheEnforcer.java b/Mage.Sets/src/mage/cards/s/SpelltitheEnforcer.java index 020cf588cf5..f438f5543da 100644 --- a/Mage.Sets/src/mage/cards/s/SpelltitheEnforcer.java +++ b/Mage.Sets/src/mage/cards/s/SpelltitheEnforcer.java @@ -72,7 +72,7 @@ class SpelltitheEnforcerEffect extends SacrificeEffect { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { Cost cost = ManaUtil.createManaCost(1, false); - if (!cost.pay(source, game, player.getId(), player.getId(), false)) { + if (!cost.pay(source, game, source, player.getId(), false)) { super.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/s/SpellweaverVolute.java b/Mage.Sets/src/mage/cards/s/SpellweaverVolute.java index c55b0db53ec..e2dc039f74e 100644 --- a/Mage.Sets/src/mage/cards/s/SpellweaverVolute.java +++ b/Mage.Sets/src/mage/cards/s/SpellweaverVolute.java @@ -108,7 +108,7 @@ class SpellweaverVoluteEffect extends OneShotEffect { Card newAuraTarget = game.getCard(auraTarget.getFirstTarget()); if (newAuraTarget != null) { if (enchantedCard.getId().equals(newAuraTarget.getId())) { - } else if (newAuraTarget.addAttachment(sourcePermanent.getId(), game)) { + } else if (newAuraTarget.addAttachment(sourcePermanent.getId(), source, game)) { game.informPlayers(sourcePermanent.getLogName() + " was attached to " + newAuraTarget.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java b/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java index 4f307c51bde..7a551c8b2d1 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java +++ b/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java @@ -74,11 +74,11 @@ class SphinxBoneWandEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/s/SphinxSovereign.java b/Mage.Sets/src/mage/cards/s/SphinxSovereign.java index 4b4dd1d4a1e..a986354eb41 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxSovereign.java +++ b/Mage.Sets/src/mage/cards/s/SphinxSovereign.java @@ -73,7 +73,7 @@ class SphinxSovereignEffect extends OneShotEffect { if (controller.hasOpponent(opponentId, game)) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.loseLife(3, game, false); + opponent.loseLife(3, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/SpikeCannibal.java b/Mage.Sets/src/mage/cards/s/SpikeCannibal.java index 0cb9ff5ccde..09357aa75b6 100644 --- a/Mage.Sets/src/mage/cards/s/SpikeCannibal.java +++ b/Mage.Sets/src/mage/cards/s/SpikeCannibal.java @@ -80,7 +80,7 @@ class SpikeCannibalEffect extends OneShotEffect { if (!Objects.equals(creature, sourcePermanent)) { int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1); if (numberCounters > 0) { - creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game); + creature.removeCounters(CounterType.P1P1.getName(), numberCounters, source, game); countersRemoved += numberCounters; } } diff --git a/Mage.Sets/src/mage/cards/s/SpikeshotElder.java b/Mage.Sets/src/mage/cards/s/SpikeshotElder.java index 85fed75ad6b..5c8d74c0b3d 100644 --- a/Mage.Sets/src/mage/cards/s/SpikeshotElder.java +++ b/Mage.Sets/src/mage/cards/s/SpikeshotElder.java @@ -69,12 +69,12 @@ class SpikeshotElderEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damage, sourcePermanent.getId(), game, false, true); + permanent.damage(damage, sourcePermanent.getId(), source, game, false, true); return true; } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(damage, sourcePermanent.getId(), game); + player.damage(damage, sourcePermanent.getId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SpikeshotGoblin.java b/Mage.Sets/src/mage/cards/s/SpikeshotGoblin.java index 94618f17962..beba07072d1 100644 --- a/Mage.Sets/src/mage/cards/s/SpikeshotGoblin.java +++ b/Mage.Sets/src/mage/cards/s/SpikeshotGoblin.java @@ -70,12 +70,12 @@ class SpikeshotGoblinEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(damage, sourcePermanent.getId(), game, false, true); + permanent.damage(damage, sourcePermanent.getId(), source, game, false, true); return true; } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(damage, sourcePermanent.getId(), game); + player.damage(damage, sourcePermanent.getId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SpinalEmbrace.java b/Mage.Sets/src/mage/cards/s/SpinalEmbrace.java index 3814470b512..fc056bf55b7 100644 --- a/Mage.Sets/src/mage/cards/s/SpinalEmbrace.java +++ b/Mage.Sets/src/mage/cards/s/SpinalEmbrace.java @@ -104,7 +104,7 @@ class SpinalEmbraceSacrificeEffect extends OneShotEffect { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); affectedTargets++; Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/s/SpinalGraft.java b/Mage.Sets/src/mage/cards/s/SpinalGraft.java index c92d031f91e..442ac65477a 100644 --- a/Mage.Sets/src/mage/cards/s/SpinalGraft.java +++ b/Mage.Sets/src/mage/cards/s/SpinalGraft.java @@ -73,7 +73,7 @@ class SpinalGraftTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpinningDarkness.java b/Mage.Sets/src/mage/cards/s/SpinningDarkness.java index 52c1ab6a6d1..bc105457b0d 100644 --- a/Mage.Sets/src/mage/cards/s/SpinningDarkness.java +++ b/Mage.Sets/src/mage/cards/s/SpinningDarkness.java @@ -75,7 +75,7 @@ class SpinningDarknessCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { Set blackCardsInGraveyard = controller.getGraveyard().getCards(filter, game); @@ -98,7 +98,7 @@ class SpinningDarknessCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { return controller.getGraveyard().getCards(filter, game).size() >= 3; diff --git a/Mage.Sets/src/mage/cards/s/SpiritFlare.java b/Mage.Sets/src/mage/cards/s/SpiritFlare.java index cf1d2c8aa5a..660fecf0ce6 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritFlare.java +++ b/Mage.Sets/src/mage/cards/s/SpiritFlare.java @@ -81,13 +81,13 @@ class SpiritFlareEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); - if (permanent == null || !permanent.tap(game)) { + if (permanent == null || !permanent.tap(source, game)) { return false; } Permanent permanent1 = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent1 == null) { return false; } - return permanent1.damage(permanent.getPower().getValue(), permanent.getId(), game) > 0; + return permanent1.damage(permanent.getPower().getValue(), permanent.getId(), source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/s/SpiritualFocus.java b/Mage.Sets/src/mage/cards/s/SpiritualFocus.java index 4eb184fec1c..d9a36206101 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritualFocus.java +++ b/Mage.Sets/src/mage/cards/s/SpiritualFocus.java @@ -60,7 +60,7 @@ class SpiritualFocusTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override @@ -106,7 +106,7 @@ class SpiritualFocusDrawCardEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null && permanent != null) { if (player.chooseUse(outcome, "Draw a card (" + permanent.getLogName() + ')', source, game)) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/Spiritualize.java b/Mage.Sets/src/mage/cards/s/Spiritualize.java index 85d928d82bc..d4421bb2396 100644 --- a/Mage.Sets/src/mage/cards/s/Spiritualize.java +++ b/Mage.Sets/src/mage/cards/s/Spiritualize.java @@ -64,9 +64,9 @@ class SpiritualizeTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpitefulReturned.java b/Mage.Sets/src/mage/cards/s/SpitefulReturned.java index 2d80ec8660e..831f300877b 100644 --- a/Mage.Sets/src/mage/cards/s/SpitefulReturned.java +++ b/Mage.Sets/src/mage/cards/s/SpitefulReturned.java @@ -71,7 +71,7 @@ class SpitefulReturnedTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpitefulShadows.java b/Mage.Sets/src/mage/cards/s/SpitefulShadows.java index 16f3cc6923d..478b930faaa 100644 --- a/Mage.Sets/src/mage/cards/s/SpitefulShadows.java +++ b/Mage.Sets/src/mage/cards/s/SpitefulShadows.java @@ -75,7 +75,7 @@ class SpitefulShadowsEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.damage(damageAmount, permanent.getId(), game); + player.damage(damageAmount, permanent.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SpitefulVisions.java b/Mage.Sets/src/mage/cards/s/SpitefulVisions.java index b72c542a733..cb045dfcd93 100644 --- a/Mage.Sets/src/mage/cards/s/SpitefulVisions.java +++ b/Mage.Sets/src/mage/cards/s/SpitefulVisions.java @@ -58,7 +58,7 @@ class SpitefulVisionsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/s/Spitemare.java b/Mage.Sets/src/mage/cards/s/Spitemare.java index 2fb6a6ad1cc..4d9316660ab 100644 --- a/Mage.Sets/src/mage/cards/s/Spitemare.java +++ b/Mage.Sets/src/mage/cards/s/Spitemare.java @@ -65,7 +65,7 @@ class SpitemareTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -103,12 +103,12 @@ class SpitemareEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), game); + player.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), source, game); return true; } Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), game, false, true); + permanent.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SpittingImage.java b/Mage.Sets/src/mage/cards/s/SpittingImage.java index fc7bb69bff4..ed7bce0e9b3 100644 --- a/Mage.Sets/src/mage/cards/s/SpittingImage.java +++ b/Mage.Sets/src/mage/cards/s/SpittingImage.java @@ -66,7 +66,7 @@ class SpittingImageEffect extends OneShotEffect { if (permanent != null) { EmptyToken token = new EmptyToken(); CardUtil.copyTo(token).from(permanent); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SplitDecision.java b/Mage.Sets/src/mage/cards/s/SplitDecision.java index adc84052372..fe5df3e889f 100644 --- a/Mage.Sets/src/mage/cards/s/SplitDecision.java +++ b/Mage.Sets/src/mage/cards/s/SplitDecision.java @@ -73,7 +73,7 @@ class SplitDecisionEffect extends OneShotEffect { } } if (denialCount > duplicationCount) { - return game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game); + return game.getStack().counter(getTargetPointer().getFirst(game, source), source, game); } else { return new CopyTargetSpellEffect().apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/s/SplittingHeadache.java b/Mage.Sets/src/mage/cards/s/SplittingHeadache.java index f9d93dc48fb..a6f8a261616 100644 --- a/Mage.Sets/src/mage/cards/s/SplittingHeadache.java +++ b/Mage.Sets/src/mage/cards/s/SplittingHeadache.java @@ -74,7 +74,7 @@ class SplittingHeadacheEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.HAND, new FilterCard()); if (you.choose(Outcome.Benefit, player.getHand(), target, game)) { Card card = player.getHand().get(target.getFirstTarget(), game); - return player.discard(card, source, game); + return player.discard(card, false, source, game); } } diff --git a/Mage.Sets/src/mage/cards/s/SpoilsOfBlood.java b/Mage.Sets/src/mage/cards/s/SpoilsOfBlood.java index ba8ba86f38e..b36055c7bb4 100644 --- a/Mage.Sets/src/mage/cards/s/SpoilsOfBlood.java +++ b/Mage.Sets/src/mage/cards/s/SpoilsOfBlood.java @@ -89,7 +89,7 @@ class CreaturesDiedThisTurnWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (mageObject != null && mageObject.isCreature()) { creaturesDiedThisTurn++; diff --git a/Mage.Sets/src/mage/cards/s/SpoilsOfTheVault.java b/Mage.Sets/src/mage/cards/s/SpoilsOfTheVault.java index 3466f128b5d..3c113c8a9fe 100644 --- a/Mage.Sets/src/mage/cards/s/SpoilsOfTheVault.java +++ b/Mage.Sets/src/mage/cards/s/SpoilsOfTheVault.java @@ -78,7 +78,7 @@ class SpoilsOfTheVaultEffect extends OneShotEffect { } controller.revealCards(sourceObject.getIdName(), cardsToReveal, game); controller.moveCards(cardsToExile, Zone.EXILED, source, game); - controller.loseLife(cardsToExile.size(), game, false); + controller.loseLife(cardsToExile.size(), game, source, false); return true; } diff --git a/Mage.Sets/src/mage/cards/s/Sporogenesis.java b/Mage.Sets/src/mage/cards/s/Sporogenesis.java index 0d405c66b2a..beed23bee3c 100644 --- a/Mage.Sets/src/mage/cards/s/Sporogenesis.java +++ b/Mage.Sets/src/mage/cards/s/Sporogenesis.java @@ -84,7 +84,7 @@ class SporogenesisTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -155,7 +155,7 @@ class SporogenesisRemoveCountersEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { - permanent.removeCounters(CounterType.FUNGUS.createInstance(permanent.getCounters(game).getCount(CounterType.FUNGUS)), game); + permanent.removeCounters(CounterType.FUNGUS.createInstance(permanent.getCounters(game).getCount(CounterType.FUNGUS)), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SpreadingPlague.java b/Mage.Sets/src/mage/cards/s/SpreadingPlague.java index f2faa691fe1..939312aa87f 100644 --- a/Mage.Sets/src/mage/cards/s/SpreadingPlague.java +++ b/Mage.Sets/src/mage/cards/s/SpreadingPlague.java @@ -69,7 +69,7 @@ class SpreadingPlagueEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(FILTER, source.getControllerId(), game)) { if (permanent.getColor(game).shares(color) && !Objects.equals(permanent, creature)) { - permanent.destroy(source.getSourceId(), game, true); + permanent.destroy(source, game, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SpyNetwork.java b/Mage.Sets/src/mage/cards/s/SpyNetwork.java index a1a645e3c8b..dc6b46dcb2f 100644 --- a/Mage.Sets/src/mage/cards/s/SpyNetwork.java +++ b/Mage.Sets/src/mage/cards/s/SpyNetwork.java @@ -109,7 +109,7 @@ class SpyNetworkFaceDownEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), controller.getId(), game)) { while (controller.chooseUse(outcome, "Look at a face down creature controlled by " + player.getLogName() + "?", source, game)) { target.clearChosen(); - while (!target.isChosen() && target.canChoose(controller.getId(), game) && controller.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game) && controller.canRespond()) { controller.chooseTarget(outcome, target, source, game); } Permanent faceDownCreature = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/s/SquealingDevil.java b/Mage.Sets/src/mage/cards/s/SquealingDevil.java index a2976211e52..68f0e2bb9d0 100644 --- a/Mage.Sets/src/mage/cards/s/SquealingDevil.java +++ b/Mage.Sets/src/mage/cards/s/SquealingDevil.java @@ -83,7 +83,7 @@ class SquealingDevilEffect extends OneShotEffect { if (player.chooseUse(Outcome.BoostCreature, "Pay " + cost.getText() + "?", source, game)) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null && permanent.isCreature()) { ContinuousEffect effect = new BoostTargetEffect(costX, 0, Duration.EndOfTurn); diff --git a/Mage.Sets/src/mage/cards/s/SqueesRevenge.java b/Mage.Sets/src/mage/cards/s/SqueesRevenge.java index 036d5f293f6..2c7c05068d0 100644 --- a/Mage.Sets/src/mage/cards/s/SqueesRevenge.java +++ b/Mage.Sets/src/mage/cards/s/SqueesRevenge.java @@ -60,7 +60,7 @@ class SqueesRevengeEffect extends OneShotEffect { return true; } } - player.drawCards(2 * number, source.getSourceId(), game); + player.drawCards(2 * number, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/StalkingVengeance.java b/Mage.Sets/src/mage/cards/s/StalkingVengeance.java index a96d2e9e38a..232a956e4af 100644 --- a/Mage.Sets/src/mage/cards/s/StalkingVengeance.java +++ b/Mage.Sets/src/mage/cards/s/StalkingVengeance.java @@ -74,7 +74,7 @@ class StalkingVengeanceDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = (Permanent) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD); if (creature != null) { - game.damagePlayerOrPlaneswalker(source.getFirstTarget(), creature.getPower().getValue(), creature.getId(), game, false, true); + game.damagePlayerOrPlaneswalker(source.getFirstTarget(), creature.getPower().getValue(), creature.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/StalkingYeti.java b/Mage.Sets/src/mage/cards/s/StalkingYeti.java index 8f9b22eb30a..284f04a0fbc 100644 --- a/Mage.Sets/src/mage/cards/s/StalkingYeti.java +++ b/Mage.Sets/src/mage/cards/s/StalkingYeti.java @@ -85,8 +85,8 @@ class StalkingYetiEffect extends OneShotEffect { if (thisCreature == null || thatCreature == null) { return false; } - thatCreature.damage(thisCreature.getPower().getValue(), thisCreature.getId(), game, false, true); - thisCreature.damage(thatCreature.getPower().getValue(), thatCreature.getId(), game, false, true); + thatCreature.damage(thisCreature.getPower().getValue(), thisCreature.getId(), source, game, false, true); + thisCreature.damage(thatCreature.getPower().getValue(), thatCreature.getId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/Standstill.java b/Mage.Sets/src/mage/cards/s/Standstill.java index 13109fa7afc..81cddf98db7 100644 --- a/Mage.Sets/src/mage/cards/s/Standstill.java +++ b/Mage.Sets/src/mage/cards/s/Standstill.java @@ -53,7 +53,7 @@ class SpellCastTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -93,11 +93,11 @@ class StandstillEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { for (UUID uuid : game.getOpponents(this.getTargetPointer().getFirst(game, source))) { Player player = game.getPlayer(uuid); if (player != null) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/Starfall.java b/Mage.Sets/src/mage/cards/s/Starfall.java index 4bd0c27e373..14a6c41873b 100644 --- a/Mage.Sets/src/mage/cards/s/Starfall.java +++ b/Mage.Sets/src/mage/cards/s/Starfall.java @@ -58,11 +58,11 @@ class StarfallEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.damage(3, source.getSourceId(), game, false, true); + permanent.damage(3, source.getSourceId(), source, game, false, true); if (permanent.isEnchantment()) { Player targetController = game.getPlayer(permanent.getControllerId()); if (targetController != null) { - targetController.damage(3, source.getSourceId(), game); + targetController.damage(3, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/StarkeOfRath.java b/Mage.Sets/src/mage/cards/s/StarkeOfRath.java index 6b132158ad0..a6bd2015fa0 100644 --- a/Mage.Sets/src/mage/cards/s/StarkeOfRath.java +++ b/Mage.Sets/src/mage/cards/s/StarkeOfRath.java @@ -81,7 +81,7 @@ class StarkeOfRathEffect extends OneShotEffect { if (controller != null) { Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetPermanent != null) { - targetPermanent.destroy(source.getSourceId(), game, false); + targetPermanent.destroy(source, game, false); ContinuousEffect effect = new StarkeOfRathControlEffect(); effect.setTargetPointer(new FixedTarget(targetPermanent.getControllerId())); game.addEffect(effect, source); @@ -113,7 +113,7 @@ class StarkeOfRathControlEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(source.getSourceId()); Player newController = game.getPlayer(getTargetPointer().getFirst(game, source)); if (permanent != null && newController != null) { - return permanent.changeControllerId(newController.getId(), game); + return permanent.changeControllerId(newController.getId(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/s/StarlitSanctum.java b/Mage.Sets/src/mage/cards/s/StarlitSanctum.java index 88694b13653..881c6e30c2a 100644 --- a/Mage.Sets/src/mage/cards/s/StarlitSanctum.java +++ b/Mage.Sets/src/mage/cards/s/StarlitSanctum.java @@ -116,7 +116,7 @@ class StarlitSanctumBlackEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SteamAugury.java b/Mage.Sets/src/mage/cards/s/SteamAugury.java index 54dd837bfdd..d9efd16d17b 100644 --- a/Mage.Sets/src/mage/cards/s/SteamAugury.java +++ b/Mage.Sets/src/mage/cards/s/SteamAugury.java @@ -127,7 +127,7 @@ class SteamAuguryEffect extends OneShotEffect { if (i < pile1CardsIds.size()) { sb.append(", "); } - card.moveToZone(pile1Zone, source.getSourceId(), game, false); + card.moveToZone(pile1Zone, source, game, false); } } game.informPlayers(sb.toString()); @@ -142,7 +142,7 @@ class SteamAuguryEffect extends OneShotEffect { if (i < pile2CardsIds.size()) { sb.append(", "); } - card.moveToZone(pile2Zone, source.getSourceId(), game, false); + card.moveToZone(pile2Zone, source, game, false); } } game.informPlayers(sb.toString()); diff --git a/Mage.Sets/src/mage/cards/s/SteamVines.java b/Mage.Sets/src/mage/cards/s/SteamVines.java index 3e15311806e..5b4f91885dd 100644 --- a/Mage.Sets/src/mage/cards/s/SteamVines.java +++ b/Mage.Sets/src/mage/cards/s/SteamVines.java @@ -82,9 +82,9 @@ class SteamVinesEffect extends OneShotEffect { && controller != null) { Player landsController = game.getPlayer(enchantedLand.getControllerId()); if (game.getState().getZone(enchantedLand.getId()) == Zone.BATTLEFIELD) { // if 2 or more Steam Vines were on a land - enchantedLand.destroy(source.getId(), game, false); + enchantedLand.destroy(source, game, false); if (landsController != null) { - landsController.damage(1, source.getSourceId(), game); + landsController.damage(1, source.getSourceId(), source, game); } } if (!game.getBattlefield().getAllActivePermanents(CardType.LAND).isEmpty()) { //lands are available on the battlefield diff --git a/Mage.Sets/src/mage/cards/s/StenchOfEvil.java b/Mage.Sets/src/mage/cards/s/StenchOfEvil.java index 6562b791a0f..e025012fc02 100644 --- a/Mage.Sets/src/mage/cards/s/StenchOfEvil.java +++ b/Mage.Sets/src/mage/cards/s/StenchOfEvil.java @@ -65,13 +65,13 @@ class StenchOfEvilEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, game)) { UUID landControllerId = land.getControllerId(); - if (land.destroy(source.getSourceId(), game, false)) { + if (land.destroy(source, game, false)) { Cost cost = new ManaCostsImpl("{2}"); Player landController = game.getPlayer(landControllerId); if (landController != null - && cost.canPay(source, source.getSourceId(), landControllerId, game) - && !cost.pay(source, game, source.getSourceId(), landControllerId, false)) { - landController.damage(1, source.getSourceId(), game); + && cost.canPay(source, source, landControllerId, game) + && !cost.pay(source, game, source, landControllerId, false)) { + landController.damage(1, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/StensiaMasquerade.java b/Mage.Sets/src/mage/cards/s/StensiaMasquerade.java index 994a4ce5df7..5b435957304 100644 --- a/Mage.Sets/src/mage/cards/s/StensiaMasquerade.java +++ b/Mage.Sets/src/mage/cards/s/StensiaMasquerade.java @@ -80,7 +80,7 @@ class StensiaMasqueradeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SternJudge.java b/Mage.Sets/src/mage/cards/s/SternJudge.java index d184dd70591..76850549dd8 100644 --- a/Mage.Sets/src/mage/cards/s/SternJudge.java +++ b/Mage.Sets/src/mage/cards/s/SternJudge.java @@ -72,7 +72,7 @@ class SternJudgeEffect extends OneShotEffect { Player player = game.getPlayer(source.getSourceId()); if (player != null) { int lifeToLose = game.getBattlefield().getAllActivePermanents(filter, playerId, game).size(); - player.loseLife(lifeToLose, game, false); + player.loseLife(lifeToLose, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java b/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java index 7cee8dcdacd..44c931819f0 100644 --- a/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java +++ b/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java @@ -77,7 +77,7 @@ class StinkdrinkerBanditTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/s/StitcherGeralf.java b/Mage.Sets/src/mage/cards/s/StitcherGeralf.java index bbfc44d0d0d..e6ed32da350 100644 --- a/Mage.Sets/src/mage/cards/s/StitcherGeralf.java +++ b/Mage.Sets/src/mage/cards/s/StitcherGeralf.java @@ -87,7 +87,7 @@ class StitcherGeralfEffect extends OneShotEffect { Card card = game.getCard(cardId); if (card != null) { power += card.getPower().getValue(); - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); } } return new CreateTokenEffect(new StitcherGeralfZombieToken(power)).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/s/StitchersApprentice.java b/Mage.Sets/src/mage/cards/s/StitchersApprentice.java index 7f8cb0164b7..22f4dc0460b 100644 --- a/Mage.Sets/src/mage/cards/s/StitchersApprentice.java +++ b/Mage.Sets/src/mage/cards/s/StitchersApprentice.java @@ -75,10 +75,10 @@ class StitchersApprenticeEffect extends OneShotEffect { if (player != null) { Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent()); - if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/StitchersGraft.java b/Mage.Sets/src/mage/cards/s/StitchersGraft.java index d64cff26e2a..0ebde7ff3ad 100644 --- a/Mage.Sets/src/mage/cards/s/StitchersGraft.java +++ b/Mage.Sets/src/mage/cards/s/StitchersGraft.java @@ -75,7 +75,7 @@ class StitchersGraftTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/StolenStrategy.java b/Mage.Sets/src/mage/cards/s/StolenStrategy.java index 067df28273d..e873a04d6f7 100644 --- a/Mage.Sets/src/mage/cards/s/StolenStrategy.java +++ b/Mage.Sets/src/mage/cards/s/StolenStrategy.java @@ -75,7 +75,7 @@ class StolenStrategyEffect extends OneShotEffect { Card card = damagedPlayer.getLibrary().getFromTop(game); if (card != null && sourceObject != null) { // move card to exile - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.LIBRARY, true); // Add effects only if the card has a spellAbility (e.g. not for lands). if (!card.isLand() && card.getSpellAbility() != null) { // allow to cast the card diff --git a/Mage.Sets/src/mage/cards/s/StonehewerGiant.java b/Mage.Sets/src/mage/cards/s/StonehewerGiant.java index 65d8b53b4c9..85be417d273 100644 --- a/Mage.Sets/src/mage/cards/s/StonehewerGiant.java +++ b/Mage.Sets/src/mage/cards/s/StonehewerGiant.java @@ -96,7 +96,7 @@ class StonehewerGiantEffect extends OneShotEffect { targetCreature.setNotTarget(true); if (equipment != null && controller.choose(Outcome.BoostCreature, targetCreature, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(targetCreature.getFirstTarget()); - permanent.addAttachment(equipment.getId(), game); + permanent.addAttachment(equipment.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java b/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java index 7c9fffb4554..caa0f5514a9 100644 --- a/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java +++ b/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java @@ -16,6 +16,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; @@ -72,7 +73,7 @@ class StonewiseFortifierPreventAllDamageToEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), event.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), event.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int preventedDamage = event.getAmount(); MageObject damageSource = game.getObject(event.getSourceId()); @@ -84,7 +85,7 @@ class StonewiseFortifierPreventAllDamageToEffect extends PreventionEffectImpl { game.informPlayers(message); } event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, event.getTargetId(), source.getSourceId(), source.getControllerId(), preventedDamage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), preventedDamage)); } return false; } diff --git a/Mage.Sets/src/mage/cards/s/StormCauldron.java b/Mage.Sets/src/mage/cards/s/StormCauldron.java index 6d908c6fc87..29fc49a3a61 100644 --- a/Mage.Sets/src/mage/cards/s/StormCauldron.java +++ b/Mage.Sets/src/mage/cards/s/StormCauldron.java @@ -27,7 +27,7 @@ public final class StormCauldron extends CardImpl { // Whenever a land is tapped for mana, return it to its owner's hand. Effect effect = new ReturnToHandTargetEffect(); effect.setText("return it to its owner's hand"); - this.addAbility(new TapLandForManaAllTriggeredAbility(effect, false, true)); + this.addAbility(new TapLandForManaAllTriggeredAbility(effect, false, true, true)); } public StormCauldron(final StormCauldron card) { diff --git a/Mage.Sets/src/mage/cards/s/StormElemental.java b/Mage.Sets/src/mage/cards/s/StormElemental.java index f91d964afef..e9bcc1bceae 100644 --- a/Mage.Sets/src/mage/cards/s/StormElemental.java +++ b/Mage.Sets/src/mage/cards/s/StormElemental.java @@ -123,7 +123,7 @@ class ExileTopCardLibraryCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { card = controller.getLibrary().getFromTop(game); @@ -135,7 +135,7 @@ class ExileTopCardLibraryCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { return controller.getLibrary().hasCards(); diff --git a/Mage.Sets/src/mage/cards/s/StormHerald.java b/Mage.Sets/src/mage/cards/s/StormHerald.java index e2c2812034a..6a13a096f30 100644 --- a/Mage.Sets/src/mage/cards/s/StormHerald.java +++ b/Mage.Sets/src/mage/cards/s/StormHerald.java @@ -109,10 +109,10 @@ class StormHeraldEffect extends OneShotEffect { targetCreature.setNotTarget(true); if (controller.choose(Outcome.PutCardInPlay, targetCreature, source.getSourceId(), game)) { Permanent targetPermanent = game.getPermanent(targetCreature.getFirstTarget()); - if (!targetPermanent.cantBeAttachedBy(auraCard, game, true)) { + if (!targetPermanent.cantBeAttachedBy(auraCard, source, game, true)) { game.getState().setValue("attachTo:" + auraCard.getId(), targetPermanent); controller.moveCards(auraCard, Zone.BATTLEFIELD, source, game); - targetPermanent.addAttachment(auraCard.getId(), game); + targetPermanent.addAttachment(auraCard.getId(), source, game); Permanent permanent = game.getPermanent(auraId); if (permanent != null) { toExile.add(permanent); diff --git a/Mage.Sets/src/mage/cards/s/StormWorld.java b/Mage.Sets/src/mage/cards/s/StormWorld.java index 5ac8c1e118d..6637eab2292 100644 --- a/Mage.Sets/src/mage/cards/s/StormWorld.java +++ b/Mage.Sets/src/mage/cards/s/StormWorld.java @@ -58,7 +58,7 @@ class StormWorldEffect extends OneShotEffect { if (player != null) { int damage = 4 - player.getHand().size(); if (damage > 0) { - player.damage(damage, source.getSourceId(), game); + player.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/StormbreathDragon.java b/Mage.Sets/src/mage/cards/s/StormbreathDragon.java index 6fd9fb9fffc..111753228fa 100644 --- a/Mage.Sets/src/mage/cards/s/StormbreathDragon.java +++ b/Mage.Sets/src/mage/cards/s/StormbreathDragon.java @@ -76,7 +76,7 @@ class StormbreathDragonDamageEffect extends OneShotEffect { if (opponent != null) { int damage = opponent.getHand().size(); if (damage > 0) { - opponent.damage(damage, source.getSourceId(), game); + opponent.damage(damage, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/Stranglehold.java b/Mage.Sets/src/mage/cards/s/Stranglehold.java index 7a3b4d654bb..367fc79b6f9 100644 --- a/Mage.Sets/src/mage/cards/s/Stranglehold.java +++ b/Mage.Sets/src/mage/cards/s/Stranglehold.java @@ -119,7 +119,7 @@ class StrangleholdSkipExtraTurnsEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.EXTRA_TURN; + return event.getType() == GameEvent.EventType.EXTRA_TURN; } @Override diff --git a/Mage.Sets/src/mage/cards/s/StrataScythe.java b/Mage.Sets/src/mage/cards/s/StrataScythe.java index 9e362b19ff3..cd7dc23b96a 100644 --- a/Mage.Sets/src/mage/cards/s/StrataScythe.java +++ b/Mage.Sets/src/mage/cards/s/StrataScythe.java @@ -74,7 +74,7 @@ class StrataScytheImprintEffect extends OneShotEffect { UUID cardId = target.getTargets().get(0); Card card = player.getLibrary().remove(cardId, game); if (card != null) { - card.moveToExile(source.getSourceId(), "Strata Scythe", source.getSourceId(), game); + card.moveToExile(source.getSourceId(), "Strata Scythe", source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); diff --git a/Mage.Sets/src/mage/cards/s/StrategySchmategy.java b/Mage.Sets/src/mage/cards/s/StrategySchmategy.java index 559d4c796f9..5ea0285cebd 100644 --- a/Mage.Sets/src/mage/cards/s/StrategySchmategy.java +++ b/Mage.Sets/src/mage/cards/s/StrategySchmategy.java @@ -70,17 +70,17 @@ class StrategySchmategyffect extends OneShotEffect { // 5 - Each player discards their hand and draws seven cards. // 6 - Repeat this process two more times while (numTimesToDo > 0) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); numTimesToDo--; if (amount == 2) { List artifactPermanents = game.getBattlefield().getActivePermanents(new FilterArtifactPermanent(), controller.getId(), game); for (Permanent permanent : artifactPermanents) { - permanent.destroy(permanent.getId(), game, false); + permanent.destroy(source, game, false); } } else if (amount == 3) { List landPermanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LANDS, controller.getId(), game); for (Permanent permanent : landPermanents) { - permanent.destroy(permanent.getId(), game, false); + permanent.destroy(source, game, false); } } else if (amount == 4) { new DamageEverythingEffect(3, new FilterCreaturePermanent()).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/s/StreetSweeper.java b/Mage.Sets/src/mage/cards/s/StreetSweeper.java index ad5aa127e14..36437ea9f53 100644 --- a/Mage.Sets/src/mage/cards/s/StreetSweeper.java +++ b/Mage.Sets/src/mage/cards/s/StreetSweeper.java @@ -84,7 +84,7 @@ class StreetSweeperDestroyEffect extends OneShotEffect { Permanent aura = game.getPermanent(uuid); if(aura != null && aura.hasSubtype(SubType.AURA, game)) { - aura.destroy(source.getSourceId(), game, false); + aura.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/StringOfDisappearances.java b/Mage.Sets/src/mage/cards/s/StringOfDisappearances.java index 980102ebd6d..bd98212c243 100644 --- a/Mage.Sets/src/mage/cards/s/StringOfDisappearances.java +++ b/Mage.Sets/src/mage/cards/s/StringOfDisappearances.java @@ -74,7 +74,7 @@ class StringOfDisappearancesEffect extends OneShotEffect { return true; } Cost cost = new ManaCostsImpl("{U}{U}"); - if (!cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false, null)) { + if (!cost.pay(source, game, source, affectedPlayer.getId(), false, null)) { return true; } Spell spell = game.getStack().getSpell(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/s/StripBare.java b/Mage.Sets/src/mage/cards/s/StripBare.java index b023dfe6553..60eb57abdf3 100644 --- a/Mage.Sets/src/mage/cards/s/StripBare.java +++ b/Mage.Sets/src/mage/cards/s/StripBare.java @@ -70,7 +70,7 @@ class StripBareEffect extends OneShotEffect { for (Permanent attachment : game.getBattlefield().getAllActivePermanents(filter, game)) { if (attachment != null && targetCreature.getAttachments().contains(attachment.getId())) { - applied = attachment.destroy(source.getSourceId(), game, false); + applied = attachment.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/StromkirkOccultist.java b/Mage.Sets/src/mage/cards/s/StromkirkOccultist.java index 66f4c3618cc..44ce9e1f971 100644 --- a/Mage.Sets/src/mage/cards/s/StromkirkOccultist.java +++ b/Mage.Sets/src/mage/cards/s/StromkirkOccultist.java @@ -82,7 +82,7 @@ class StromkirkOccultistExileEffect extends OneShotEffect { Card card = controller.getLibrary().getFromTop(game); if (card != null) { String exileName = sourcePermanent.getIdName() + " "; - if (controller.moveCardToExileWithInfo(card, source.getSourceId(), exileName, source.getSourceId(), game, Zone.LIBRARY, true)) { + if (controller.moveCardToExileWithInfo(card, source.getSourceId(), exileName, source, game, Zone.LIBRARY, true)) { ContinuousEffect effect = new StromkirkOccultistPlayFromExileEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/s/StrongarmTactics.java b/Mage.Sets/src/mage/cards/s/StrongarmTactics.java index e7b7c632a00..12a0a94d152 100644 --- a/Mage.Sets/src/mage/cards/s/StrongarmTactics.java +++ b/Mage.Sets/src/mage/cards/s/StrongarmTactics.java @@ -85,8 +85,8 @@ class StrongarmTacticsEffect extends OneShotEffect { for (UUID cardId : cardsPlayer) { Card card = game.getCard(cardId); if (card != null) { - if (!(player.discard(card, source, game) && card.isCreature())) { - player.loseLife(4, game, false); + if (!(player.discard(card, false, source, game) && card.isCreature())) { + player.loseLife(4, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/StrongholdDiscipline.java b/Mage.Sets/src/mage/cards/s/StrongholdDiscipline.java index 6912b62a14c..d6b06a9add6 100644 --- a/Mage.Sets/src/mage/cards/s/StrongholdDiscipline.java +++ b/Mage.Sets/src/mage/cards/s/StrongholdDiscipline.java @@ -60,7 +60,7 @@ class StrongholdDisciplineEffect extends OneShotEffect { if (count > 0) { Player player = game.getPlayer(playerId); if (player != null) { - player.loseLife(count, game, false); + player.loseLife(count, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/StuffyDoll.java b/Mage.Sets/src/mage/cards/s/StuffyDoll.java index 99a4dc654a8..fd8f8a12518 100644 --- a/Mage.Sets/src/mage/cards/s/StuffyDoll.java +++ b/Mage.Sets/src/mage/cards/s/StuffyDoll.java @@ -71,7 +71,7 @@ class StuffyDollTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -110,7 +110,7 @@ class StuffyDollGainLifeEffect extends OneShotEffect { UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + "_player"); Player player = game.getPlayer(playerId); if (player != null && player.canRespond()) { - player.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), game); + player.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/StunningReversal.java b/Mage.Sets/src/mage/cards/s/StunningReversal.java index 9f4cd5e2f68..79859c421ac 100644 --- a/Mage.Sets/src/mage/cards/s/StunningReversal.java +++ b/Mage.Sets/src/mage/cards/s/StunningReversal.java @@ -65,7 +65,7 @@ class StunningReversalEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { - player.drawCards(7, source.getSourceId(), game); + player.drawCards(7, source, game); // original event is not a draw event, so skip it in params player.setLife(1, game, source); this.discard(); } diff --git a/Mage.Sets/src/mage/cards/s/SubterraneanTremors.java b/Mage.Sets/src/mage/cards/s/SubterraneanTremors.java index ca73f9508e6..f69c516c5ac 100644 --- a/Mage.Sets/src/mage/cards/s/SubterraneanTremors.java +++ b/Mage.Sets/src/mage/cards/s/SubterraneanTremors.java @@ -68,7 +68,6 @@ class SubterraneanTremorsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int damage = source.getManaCostsToPay().getX(); UUID sourceId = source.getSourceId(); UUID controllerId = source.getControllerId(); @@ -76,20 +75,20 @@ class SubterraneanTremorsEffect extends OneShotEffect { // X damage to each creature without flying List creaturePermanents = game.getBattlefield().getActivePermanents(filterCreatures, controllerId, game); for (Permanent permanent : creaturePermanents) { - permanent.damage(damage, sourceId, game, false, true); + permanent.damage(damage, sourceId, source, game, false, true); } // X 4 or more: destroy all artifacts if (damage >= 4) { List artifactPermanents = game.getBattlefield().getActivePermanents(filterArtifacts, controllerId, game); for (Permanent permanent : artifactPermanents) { - permanent.destroy(permanent.getId(), game, false); + permanent.destroy(source, game, false); } } // X 8 or more: create an 8/8 red lizard creature token on the battlefield if (damage >= 8) { SubterraneanTremorsLizardToken lizardToken = new SubterraneanTremorsLizardToken(); - lizardToken.putOntoBattlefield(1, game, sourceId, controllerId); + lizardToken.putOntoBattlefield(1, game, source, controllerId); } return true; diff --git a/Mage.Sets/src/mage/cards/s/Subversion.java b/Mage.Sets/src/mage/cards/s/Subversion.java index 8e20d24267f..fc927cda036 100644 --- a/Mage.Sets/src/mage/cards/s/Subversion.java +++ b/Mage.Sets/src/mage/cards/s/Subversion.java @@ -50,7 +50,7 @@ public final class Subversion extends CardImpl { public boolean apply(Game game, Ability source) { int damage = 0; for (UUID opponentId : game.getOpponents(source.getControllerId())) { - damage += game.getPlayer(opponentId).damage(1, source.getSourceId(), game); + damage += game.getPlayer(opponentId).damage(1, source.getSourceId(), source, game); } game.getPlayer(source.getControllerId()).gainLife(damage, game, source); return true; diff --git a/Mage.Sets/src/mage/cards/s/SuddenDemise.java b/Mage.Sets/src/mage/cards/s/SuddenDemise.java index 1730c8a6cbf..75117fb550d 100644 --- a/Mage.Sets/src/mage/cards/s/SuddenDemise.java +++ b/Mage.Sets/src/mage/cards/s/SuddenDemise.java @@ -65,7 +65,7 @@ class SuddenDemiseDamageEffect extends OneShotEffect { FilterPermanent filter = new FilterCreaturePermanent(); filter.add(new ColorPredicate(choice.getColor())); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.damage(damage, source.getSourceId(), game, false, true); + permanent.damage(damage, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SufferThePast.java b/Mage.Sets/src/mage/cards/s/SufferThePast.java index fdac058d6eb..8cd51875249 100644 --- a/Mage.Sets/src/mage/cards/s/SufferThePast.java +++ b/Mage.Sets/src/mage/cards/s/SufferThePast.java @@ -67,18 +67,18 @@ class SufferThePastEffect extends OneShotEffect { int numberToTarget = Math.min(targetPlayer.getGraveyard().size(), source.getManaCostsToPay().getX()); TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(numberToTarget, numberToTarget, filter); if (you != null) { - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { List targets = target.getTargets(); for (UUID targetId : targets) { Card card = game.getCard(targetId); if (card != null) { - card.moveToExile(id, "Suffer the Past", source.getSourceId(), game); + card.moveToExile(id, "Suffer the Past", source, game); numberExiled ++; } } you.gainLife(numberExiled, game, source); - targetPlayer.loseLife(numberExiled, game, false); + targetPlayer.loseLife(numberExiled, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SummaryDismissal.java b/Mage.Sets/src/mage/cards/s/SummaryDismissal.java index e695e38f296..04d10828d7e 100644 --- a/Mage.Sets/src/mage/cards/s/SummaryDismissal.java +++ b/Mage.Sets/src/mage/cards/s/SummaryDismissal.java @@ -66,7 +66,7 @@ class SummaryDismissalEffect extends OneShotEffect { ((Spell) stackObject).moveToExile(null, "", null, game); } if (stackObject instanceof Ability) { - game.getStack().counter(stackObject.getId(), source.getSourceId(), game); + game.getStack().counter(stackObject.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SummaryJudgment.java b/Mage.Sets/src/mage/cards/s/SummaryJudgment.java index 5e2cc2ee4ba..e00c8cc65a5 100644 --- a/Mage.Sets/src/mage/cards/s/SummaryJudgment.java +++ b/Mage.Sets/src/mage/cards/s/SummaryJudgment.java @@ -74,6 +74,6 @@ class SummaryJudgementEffect extends OneShotEffect { if (AddendumCondition.instance.apply(game, source)) { damage = 5; } - return permanent.damage(damage, source.getSourceId(), game) > 0; + return permanent.damage(damage, source.getSourceId(), source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/s/SummonersEgg.java b/Mage.Sets/src/mage/cards/s/SummonersEgg.java index d4d249ec2c0..73f2435d849 100644 --- a/Mage.Sets/src/mage/cards/s/SummonersEgg.java +++ b/Mage.Sets/src/mage/cards/s/SummonersEgg.java @@ -117,7 +117,7 @@ class SummonersEggPutOntoBattlefieldEffect extends OneShotEffect { Card imprintedCard = game.getCard(SummonersEgg.getImprinted().get(0)); if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()) == Zone.EXILED) { //turn the exiled card face up. - imprintedCard.turnFaceUp(game, source.getControllerId()); + imprintedCard.turnFaceUp(source, game, source.getControllerId()); //If it's a creature card, if (imprintedCard.isCreature()) { //put it onto the battlefield under your control diff --git a/Mage.Sets/src/mage/cards/s/SummoningTrap.java b/Mage.Sets/src/mage/cards/s/SummoningTrap.java index 26b70f88fdf..678017ce580 100644 --- a/Mage.Sets/src/mage/cards/s/SummoningTrap.java +++ b/Mage.Sets/src/mage/cards/s/SummoningTrap.java @@ -75,7 +75,7 @@ class SummoningTrapWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.COUNTERED) { + if (event.getType() == GameEvent.EventType.COUNTERED) { StackObject counteredSpell = game.getStack().getStackObject(event.getTargetId()); if (counteredSpell == null) { counteredSpell = (StackObject) game.getLastKnownInformation(event.getTargetId(), Zone.STACK); diff --git a/Mage.Sets/src/mage/cards/s/SunDroplet.java b/Mage.Sets/src/mage/cards/s/SunDroplet.java index 08b3f4e79c8..c97c95e4e05 100644 --- a/Mage.Sets/src/mage/cards/s/SunDroplet.java +++ b/Mage.Sets/src/mage/cards/s/SunDroplet.java @@ -65,14 +65,16 @@ class SunDropletTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(this.getControllerId())) { this.getEffects().clear(); - this.addEffect(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(event.getAmount()))); + if (event.getAmount() > 0) { + this.addEffect(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(event.getAmount()))); + } return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/Suncleanser.java b/Mage.Sets/src/mage/cards/s/Suncleanser.java index 8e31d29e69d..840ab041ce4 100644 --- a/Mage.Sets/src/mage/cards/s/Suncleanser.java +++ b/Mage.Sets/src/mage/cards/s/Suncleanser.java @@ -87,7 +87,7 @@ class SuncleanserRemoveCountersEffect extends OneShotEffect { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { for (Counter counter : permanent.getCounters(game).copy().values()) { // copy to prevent ConcurrentModificationException - permanent.removeCounters(counter, game); + permanent.removeCounters(counter, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SunderingTitan.java b/Mage.Sets/src/mage/cards/s/SunderingTitan.java index f0a6c62d172..895ae4722eb 100644 --- a/Mage.Sets/src/mage/cards/s/SunderingTitan.java +++ b/Mage.Sets/src/mage/cards/s/SunderingTitan.java @@ -82,7 +82,7 @@ class SunderingTitanDestroyLandEffect extends OneShotEffect { for (UUID landId : lands) { Permanent land = game.getPermanent(landId); if (land != null) { - if (land.destroy(source.getSourceId(), game, false)) { + if (land.destroy(source, game, false)) { destroyedLands++; } } diff --git a/Mage.Sets/src/mage/cards/s/Sunforger.java b/Mage.Sets/src/mage/cards/s/Sunforger.java index d072e1d6e95..bb0b5021690 100644 --- a/Mage.Sets/src/mage/cards/s/Sunforger.java +++ b/Mage.Sets/src/mage/cards/s/Sunforger.java @@ -136,20 +136,20 @@ class SunforgerUnattachCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent attachment = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent attachment = game.getPermanent(source.getSourceId()); if (attachment != null && attachment.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(attachment.getAttachedTo()); if (attachedTo != null) { - paid = attachedTo.removeAttachment(attachment.getId(), game); + paid = attachedTo.removeAttachment(attachment.getId(), source, game); } } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent attachment = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent attachment = game.getPermanent(source.getSourceId()); if (attachment != null && attachment.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(attachment.getAttachedTo()); if (attachedTo != null) { diff --git a/Mage.Sets/src/mage/cards/s/SunhomeEnforcer.java b/Mage.Sets/src/mage/cards/s/SunhomeEnforcer.java index 3068efc6643..792688e3ba3 100644 --- a/Mage.Sets/src/mage/cards/s/SunhomeEnforcer.java +++ b/Mage.Sets/src/mage/cards/s/SunhomeEnforcer.java @@ -66,9 +66,9 @@ class SunhomeEnforcerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SunkenHope.java b/Mage.Sets/src/mage/cards/s/SunkenHope.java index de5547375e7..7134fb8ba21 100644 --- a/Mage.Sets/src/mage/cards/s/SunkenHope.java +++ b/Mage.Sets/src/mage/cards/s/SunkenHope.java @@ -67,15 +67,15 @@ class SunkenHopeReturnToHandEffect extends OneShotEffect { } Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true); - if (target.canChoose(player.getId(), game)) { - while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.ReturnToHand, target, source, game); } for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - result |= permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + result |= permanent.moveToZone(Zone.HAND, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/s/SunseedNurturer.java b/Mage.Sets/src/mage/cards/s/SunseedNurturer.java index 55b04934de0..4d20f4622f9 100644 --- a/Mage.Sets/src/mage/cards/s/SunseedNurturer.java +++ b/Mage.Sets/src/mage/cards/s/SunseedNurturer.java @@ -72,7 +72,7 @@ class SunseedNurturerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java b/Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java index 80994ec3752..458ddcbb4b6 100644 --- a/Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java +++ b/Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java @@ -75,10 +75,10 @@ class SuperDuperDeathRayEffect extends OneShotEffect { lethal = Math.min(lethal, 1); } lethal = Math.min(lethal, 4); - permanent.damage(lethal, source.getSourceId(), game); + permanent.damage(lethal, source.getSourceId(), source, game); Player player = game.getPlayer(permanent.getControllerId()); if (player != null && lethal < 4) { - player.damage(4 - lethal, source.getSourceId(), game); + player.damage(4 - lethal, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SuperiorNumbers.java b/Mage.Sets/src/mage/cards/s/SuperiorNumbers.java index d2caee1ab8e..91a07b7ce00 100644 --- a/Mage.Sets/src/mage/cards/s/SuperiorNumbers.java +++ b/Mage.Sets/src/mage/cards/s/SuperiorNumbers.java @@ -71,6 +71,6 @@ class SuperiorNumbersEffect extends OneShotEffect { StaticFilters.FILTER_PERMANENT_CREATURE, opponent.getId(), game ); int damage = Math.max(controllerCreatures - opponentCreatures, 0); - return creature.damage(damage, source.getSourceId(), game) > 0; + return creature.damage(damage, source.getSourceId(), source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/s/SupremeInquisitor.java b/Mage.Sets/src/mage/cards/s/SupremeInquisitor.java index dc169411741..a9df4008bcc 100644 --- a/Mage.Sets/src/mage/cards/s/SupremeInquisitor.java +++ b/Mage.Sets/src/mage/cards/s/SupremeInquisitor.java @@ -91,7 +91,7 @@ class SupremeInquisitorEffect extends OneShotEffect { for (UUID targetCard : targetId) { Card card = targetPlayer.getLibrary().remove(targetCard, game); if (card != null) { - player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true); + player.moveCardToExileWithInfo(card, null, null, source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java b/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java index 4ddba10eb01..663af71de52 100644 --- a/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java +++ b/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java @@ -95,10 +95,10 @@ enum SupremeLeaderSnokeAdjuster implements TargetAdjuster { class OpponentNoncombatLostLifeCount implements DynamicValue { @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { PlayerLostLifeNonCombatWatcher watcher = game.getState().getWatcher(PlayerLostLifeNonCombatWatcher.class); if(watcher != null) { - return watcher.getAllOppLifeLost(source.getControllerId(), game); + return watcher.getAllOppLifeLost(sourceAbility.getControllerId(), game); } return 0; } diff --git a/Mage.Sets/src/mage/cards/s/SurgicalExtraction.java b/Mage.Sets/src/mage/cards/s/SurgicalExtraction.java index 47c622f7b7d..1c7d6efaddf 100644 --- a/Mage.Sets/src/mage/cards/s/SurgicalExtraction.java +++ b/Mage.Sets/src/mage/cards/s/SurgicalExtraction.java @@ -98,7 +98,7 @@ class SurgicalExtractionEffect extends OneShotEffect { Card targetCard = owner.getGraveyard().get(targetId, game); if (targetCard != null) { controller.moveCardToExileWithInfo(targetCard, null, - "", source.getSourceId(), game, Zone.GRAVEYARD, true); + "", source, game, Zone.GRAVEYARD, true); } } } @@ -113,7 +113,7 @@ class SurgicalExtractionEffect extends OneShotEffect { for (UUID targetId : targets) { Card targetCard = owner.getHand().get(targetId, game); if (targetCard != null) { - controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(targetCard, null, "", source, game, Zone.HAND, true); } } } @@ -126,7 +126,7 @@ class SurgicalExtractionEffect extends OneShotEffect { for (UUID targetId : targets) { Card targetCard = owner.getLibrary().getCard(targetId, game); if (targetCard != null) { - controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(targetCard, null, "", source, game, Zone.LIBRARY, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SurrealMemoir.java b/Mage.Sets/src/mage/cards/s/SurrealMemoir.java index 659ca3135e2..4c983f86932 100644 --- a/Mage.Sets/src/mage/cards/s/SurrealMemoir.java +++ b/Mage.Sets/src/mage/cards/s/SurrealMemoir.java @@ -66,7 +66,7 @@ class SurrealMemoirEffect extends OneShotEffect { Card[] cards = player.getGraveyard().getCards(filter, game).toArray(new Card[0]); if (cards.length > 0) { Card card = cards[RandomUtil.nextInt(cards.length)]; - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); game.informPlayers(card.getName() + "returned to the hand of" + player.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/s/SurvivalCache.java b/Mage.Sets/src/mage/cards/s/SurvivalCache.java index 1a80b98e864..29a3a43d671 100644 --- a/Mage.Sets/src/mage/cards/s/SurvivalCache.java +++ b/Mage.Sets/src/mage/cards/s/SurvivalCache.java @@ -62,7 +62,7 @@ class SurvivalCacheEffect extends OneShotEffect { } } if (haveMoreLife) - sourcePlayer.drawCards(1, source.getSourceId(), game); + sourcePlayer.drawCards(1, source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/s/SurvivorOfTheUnseen.java b/Mage.Sets/src/mage/cards/s/SurvivorOfTheUnseen.java index 277de3506cc..294255b741a 100644 --- a/Mage.Sets/src/mage/cards/s/SurvivorOfTheUnseen.java +++ b/Mage.Sets/src/mage/cards/s/SurvivorOfTheUnseen.java @@ -71,7 +71,7 @@ class SurvivorOfTheUnseenEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(2, source.getSourceId(), game); + player.drawCards(2, source, game); putOnLibrary(player, source, game); return true; } @@ -84,7 +84,7 @@ class SurvivorOfTheUnseenEffect extends OneShotEffect { player.chooseTarget(Outcome.ReturnToHand, target, source, game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - return player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + return player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/s/SuturePriest.java b/Mage.Sets/src/mage/cards/s/SuturePriest.java index f12db845eeb..84958fbc70c 100644 --- a/Mage.Sets/src/mage/cards/s/SuturePriest.java +++ b/Mage.Sets/src/mage/cards/s/SuturePriest.java @@ -70,7 +70,7 @@ class SuturePriestSecondTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SuturedGhoul.java b/Mage.Sets/src/mage/cards/s/SuturedGhoul.java index 1bca0b01575..84577ea8848 100644 --- a/Mage.Sets/src/mage/cards/s/SuturedGhoul.java +++ b/Mage.Sets/src/mage/cards/s/SuturedGhoul.java @@ -88,7 +88,7 @@ class SuturedGhoulEffect extends OneShotEffect { for (UUID uuid : target.getTargets()) { Card card = controller.getGraveyard().get(uuid, game); if (card != null) { - card.moveToExile(getId(), permanent.getIdName(), source.getSourceId(), game); + card.moveToExile(getId(), permanent.getIdName(), source, game); permanent.imprint(card.getId(), game); count++; } diff --git a/Mage.Sets/src/mage/cards/s/SwanSong.java b/Mage.Sets/src/mage/cards/s/SwanSong.java index e79026ce379..ab7f15905a0 100644 --- a/Mage.Sets/src/mage/cards/s/SwanSong.java +++ b/Mage.Sets/src/mage/cards/s/SwanSong.java @@ -69,12 +69,12 @@ class SwanSongEffect extends OneShotEffect { boolean countered = false; for (UUID targetId : targetPointer.getTargets(game, source)) { Spell spell = game.getStack().getSpell(targetId); - if (game.getStack().counter(targetId, source.getSourceId(), game)) { + if (game.getStack().counter(targetId, source, game)) { countered = true; } if (spell != null) { Token token = new SwanSongBirdToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), spell.getControllerId()); + token.putOntoBattlefield(1, game, source, spell.getControllerId()); } } return countered; diff --git a/Mage.Sets/src/mage/cards/s/SwansOfBrynArgoll.java b/Mage.Sets/src/mage/cards/s/SwansOfBrynArgoll.java index 093cee48e02..586c1cef33b 100644 --- a/Mage.Sets/src/mage/cards/s/SwansOfBrynArgoll.java +++ b/Mage.Sets/src/mage/cards/s/SwansOfBrynArgoll.java @@ -80,21 +80,24 @@ class SwansOfBrynArgollEffect extends PreventionEffectImpl { if (spell != null) { Player controllerOfSpell = game.getPlayer(spell.getControllerId()); if(controllerOfSpell != null) { - controllerOfSpell.drawCards(preventionEffectData.getPreventedDamage(), source.getSourceId(), game); + // original event is not a draw event, so skip it in params + controllerOfSpell.drawCards(preventionEffectData.getPreventedDamage(), source, game); passed = true; } } if (permanent != null) { Player controllerOfPermanent = game.getPlayer(permanent.getControllerId()); if(controllerOfPermanent != null) { - controllerOfPermanent.drawCards(preventionEffectData.getPreventedDamage(), source.getSourceId(), game); + // original event is not a draw event, so skip it in params + controllerOfPermanent.drawCards(preventionEffectData.getPreventedDamage(), source, game); passed = true; } } if (emblem != null) { Player controllerOfEmblem = game.getPlayer(emblem.getControllerId()); if(controllerOfEmblem != null) { - controllerOfEmblem.drawCards(preventionEffectData.getPreventedDamage(), source.getSourceId(), game); + // original event is not a draw event, so skip it in params + controllerOfEmblem.drawCards(preventionEffectData.getPreventedDamage(), source, game); } passed = true; } @@ -104,7 +107,8 @@ class SwansOfBrynArgollEffect extends PreventionEffectImpl { if (cardSource != null) { Player owner = game.getPlayer(cardSource.getOwnerId()); if (owner != null) { - owner.drawCards(preventionEffectData.getPreventedDamage(), source.getSourceId(), game); + // original event is not a draw event, so skip it in params + owner.drawCards(preventionEffectData.getPreventedDamage(), source, game); } } } @@ -115,7 +119,7 @@ class SwansOfBrynArgollEffect extends PreventionEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - return event.getType() == EventType.DAMAGE_CREATURE + return event.getType() == GameEvent.EventType.DAMAGE_CREATURE && event.getTargetId().equals(source.getSourceId()); } diff --git a/Mage.Sets/src/mage/cards/s/SwarmbornGiant.java b/Mage.Sets/src/mage/cards/s/SwarmbornGiant.java index 47240219ea6..12da1a8a066 100644 --- a/Mage.Sets/src/mage/cards/s/SwarmbornGiant.java +++ b/Mage.Sets/src/mage/cards/s/SwarmbornGiant.java @@ -78,7 +78,7 @@ class SwarmbornGiantTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SwiftSilence.java b/Mage.Sets/src/mage/cards/s/SwiftSilence.java index 3ca62a310bd..fd9b7c9b83d 100644 --- a/Mage.Sets/src/mage/cards/s/SwiftSilence.java +++ b/Mage.Sets/src/mage/cards/s/SwiftSilence.java @@ -60,13 +60,13 @@ class SwiftSilenceEffect extends OneShotEffect { } int toDraw = 0; for (Spell spell : spellsToCounter) { - if (game.getStack().counter(spell.getId(), source.getSourceId(), game)){ + if (game.getStack().counter(spell.getId(), source, game)){ toDraw++; } } Player controller = game.getPlayer(source.getControllerId()); if (toDraw > 0 && controller != null){ - controller.drawCards(toDraw, source.getSourceId(), game); + controller.drawCards(toDraw, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SwordOfBodyAndMind.java b/Mage.Sets/src/mage/cards/s/SwordOfBodyAndMind.java index ead24ed4389..72d64c26a78 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfBodyAndMind.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfBodyAndMind.java @@ -82,7 +82,7 @@ class SwordOfBodyAndMindAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SwordOfDungeonsAndDragons.java b/Mage.Sets/src/mage/cards/s/SwordOfDungeonsAndDragons.java index 2a72316966b..c1a61ffd4b0 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfDungeonsAndDragons.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfDungeonsAndDragons.java @@ -90,7 +90,7 @@ class SwordOfDungeonsAndDragonsAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -132,11 +132,11 @@ class SwordOfDungeonsAndDragonsEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int count = 1; - int amount = controller.rollDice(game, 20); + int amount = controller.rollDice(source, game, 20); while (amount == 20) { count += 1; - amount = controller.rollDice(game, 20); + amount = controller.rollDice(source, game, 20); } return new CreateTokenEffect(new DragonTokenGold(), count).apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/s/SwordOfFeastAndFamine.java b/Mage.Sets/src/mage/cards/s/SwordOfFeastAndFamine.java index 28862d5ab70..968bd185d77 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfFeastAndFamine.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfFeastAndFamine.java @@ -71,7 +71,7 @@ class SwordOfFeastAndFamineAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SwordOfFireAndIce.java b/Mage.Sets/src/mage/cards/s/SwordOfFireAndIce.java index 2fa4c805c4a..cd5a4e1da8a 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfFireAndIce.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfFireAndIce.java @@ -75,7 +75,7 @@ class SwordOfFireAndIceAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SwordOfKaldra.java b/Mage.Sets/src/mage/cards/s/SwordOfKaldra.java index b0d431aa4ae..a301caa0e81 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfKaldra.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfKaldra.java @@ -64,7 +64,7 @@ class SwordOfKaldraTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java b/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java index bf8f348265e..82ba0232ecd 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java @@ -79,7 +79,7 @@ class SwordOfLightAndShadowAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SwordOfTheAges.java b/Mage.Sets/src/mage/cards/s/SwordOfTheAges.java index 516e32af8c1..d15944b3681 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfTheAges.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfTheAges.java @@ -99,11 +99,11 @@ class SwordOfTheAgesEffect extends OneShotEffect { if (totalPower > 0) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { - player.damage(totalPower, source.getSourceId(), game); + player.damage(totalPower, source.getSourceId(), source, game); } else { Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.damage(totalPower, source.getSourceId(), game, false, true); + creature.damage(totalPower, source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java b/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java index a8e2ee7f878..03f0581a766 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java @@ -79,7 +79,7 @@ class SwordOfTheMeekEffect extends OneShotEffect { controller.moveCards(equipment, Zone.BATTLEFIELD, source, game); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - return permanent.addAttachment(equipment.getId(), game); + return permanent.addAttachment(equipment.getId(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/s/SwordOfTheParuns.java b/Mage.Sets/src/mage/cards/s/SwordOfTheParuns.java index 5c610773a70..69b68ada762 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfTheParuns.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfTheParuns.java @@ -102,7 +102,7 @@ class MayTapOrUntapAttachedEffect extends OneShotEffect { } } else { if (player.chooseUse(Outcome.Tap, "Tap equipped creature?", source, game)) { - equipedCreature.tap(game); + equipedCreature.tap(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SwordOfWarAndPeace.java b/Mage.Sets/src/mage/cards/s/SwordOfWarAndPeace.java index f26e594936e..c1fa54895d3 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfWarAndPeace.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfWarAndPeace.java @@ -78,7 +78,7 @@ class SwordOfWarAndPeaceAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -113,7 +113,7 @@ class SwordOfWarAndPeaceDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(targetPlayer.getHand().size(), source.getSourceId(), game); + targetPlayer.damage(targetPlayer.getHand().size(), source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SwordPointDiplomacy.java b/Mage.Sets/src/mage/cards/s/SwordPointDiplomacy.java index 415804e8a6d..389cd378b3a 100644 --- a/Mage.Sets/src/mage/cards/s/SwordPointDiplomacy.java +++ b/Mage.Sets/src/mage/cards/s/SwordPointDiplomacy.java @@ -77,9 +77,9 @@ class SwordPointDiplomacyEffect extends OneShotEffect { for (UUID oppId : game.getOpponents(controller.getId())) { Player opponent = game.getPlayer(oppId); if (opponent != null - && cost.canPay(source, source.getSourceId(), opponent.getId(), game) + && cost.canPay(source, source, opponent.getId(), game) && opponent.chooseUse(Outcome.Neutral, "Pay 3 life to prevent " + controller.getLogName() + " from getting " + card.getLogName() + "?", source, game) - && cost.pay(source, game, source.getSourceId(), opponent.getId(), true)) { + && cost.pay(source, game, source, opponent.getId(), true)) { keepIt = false; } } diff --git a/Mage.Sets/src/mage/cards/s/SylvanLibrary.java b/Mage.Sets/src/mage/cards/s/SylvanLibrary.java index 223e5306ccd..5d6a713da61 100644 --- a/Mage.Sets/src/mage/cards/s/SylvanLibrary.java +++ b/Mage.Sets/src/mage/cards/s/SylvanLibrary.java @@ -71,7 +71,7 @@ class SylvanLibraryEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(2, source.getSourceId(), game); + controller.drawCards(2, source, game); SylvanLibraryCardsDrawnThisTurnWatcher watcher = game.getState().getWatcher(SylvanLibraryCardsDrawnThisTurnWatcher.class); if (watcher != null) { Cards cards = new CardsImpl(); @@ -98,7 +98,7 @@ class SylvanLibraryEffect extends OneShotEffect { if (controller.canPayLifeCost(source) && controller.getLife() >= 4 && controller.chooseUse(outcome, "Pay 4 life for " + card.getLogName() + "? (Otherwise it's put on top of your library)", source, game)) { - controller.loseLife(4, game, false); + controller.loseLife(4, game, source, false); game.informPlayers(controller.getLogName() + " pays 4 life to keep a card on hand"); } else { cardsPutBack.add(card); diff --git a/Mage.Sets/src/mage/cards/s/SylvanPrimordial.java b/Mage.Sets/src/mage/cards/s/SylvanPrimordial.java index a60352c00d2..e121f007abb 100644 --- a/Mage.Sets/src/mage/cards/s/SylvanPrimordial.java +++ b/Mage.Sets/src/mage/cards/s/SylvanPrimordial.java @@ -106,7 +106,7 @@ class SylvanPrimordialEffect extends OneShotEffect { if (target instanceof TargetPermanent) { Permanent targetPermanent = game.getPermanent(target.getFirstTarget()); if (targetPermanent != null) { - if (targetPermanent.destroy(source.getSourceId(), game, false)) { + if (targetPermanent.destroy(source, game, false)) { destroyedCreatures++; } } diff --git a/Mage.Sets/src/mage/cards/s/SynchronizedSpellcraft.java b/Mage.Sets/src/mage/cards/s/SynchronizedSpellcraft.java index 7480f1c7fdf..1a4e756ff70 100644 --- a/Mage.Sets/src/mage/cards/s/SynchronizedSpellcraft.java +++ b/Mage.Sets/src/mage/cards/s/SynchronizedSpellcraft.java @@ -72,6 +72,6 @@ class SynchronizedSpellcraftEffect extends OneShotEffect { if (player == null) { return false; } - return player.damage(partyCount, source.getSourceId(), game) > 0; + return player.damage(partyCount, source.getSourceId(), source, game) > 0; } } diff --git a/Mage.Sets/src/mage/cards/s/Syncopate.java b/Mage.Sets/src/mage/cards/s/Syncopate.java index 7109d994c02..4148a42646a 100644 --- a/Mage.Sets/src/mage/cards/s/Syncopate.java +++ b/Mage.Sets/src/mage/cards/s/Syncopate.java @@ -68,13 +68,13 @@ class SyncopateCounterUnlessPaysEffect extends OneShotEffect { if (controller != null) { // can be zero cost Cost cost = ManaUtil.createManaCost(ManacostVariableValue.instance, game, source, this); - if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) { + if (!cost.pay(source, game, source, spell.getControllerId(), false)) { StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget()); - if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source.getSourceId(), stackObject.getControllerId()))) { + if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source, stackObject.getControllerId()))) { game.informPlayers(sourceObject.getIdName() + ": cost wasn't payed - countering " + stackObject.getName()); game.rememberLKI(source.getFirstTarget(), Zone.STACK, stackObject); controller.moveCards((Spell) spell, Zone.EXILED, source, game); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, source.getFirstTarget(), source.getSourceId(), stackObject.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, source.getFirstTarget(), source, stackObject.getControllerId())); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SynodSanctum.java b/Mage.Sets/src/mage/cards/s/SynodSanctum.java index 9c0b37b36c2..1126a20372d 100644 --- a/Mage.Sets/src/mage/cards/s/SynodSanctum.java +++ b/Mage.Sets/src/mage/cards/s/SynodSanctum.java @@ -85,7 +85,7 @@ class SynodSanctumEffect extends OneShotEffect { if (permanent != null) { UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); if (exileZone != null) { - controller.moveCardToExileWithInfo(permanent, exileZone, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(permanent, exileZone, sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true); } } } diff --git a/Mage.Sets/src/mage/cards/s/SyphonFlesh.java b/Mage.Sets/src/mage/cards/s/SyphonFlesh.java index ab1f79831ae..4b0f4e7b91d 100644 --- a/Mage.Sets/src/mage/cards/s/SyphonFlesh.java +++ b/Mage.Sets/src/mage/cards/s/SyphonFlesh.java @@ -65,7 +65,7 @@ class SyphonFleshEffect extends OneShotEffect { if (player != null && !playerId.equals(source.getControllerId())) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -74,14 +74,14 @@ class SyphonFleshEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } int sacrificedAmount = perms.isEmpty() ? 0 : perms.size(); if (sacrificedAmount > 0) { ZombieToken token = new ZombieToken(); - token.putOntoBattlefield(sacrificedAmount, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(sacrificedAmount, game, source, source.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SyphonMind.java b/Mage.Sets/src/mage/cards/s/SyphonMind.java index ba5bc4e75a6..9b28b803e1b 100644 --- a/Mage.Sets/src/mage/cards/s/SyphonMind.java +++ b/Mage.Sets/src/mage/cards/s/SyphonMind.java @@ -66,7 +66,7 @@ class SyphonMindEffect extends OneShotEffect { if (otherPlayer.choose(Outcome.Discard, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - if (otherPlayer.discard(card, source, game)) { + if (otherPlayer.discard(card, false, source, game)) { amount += 1; result = true; target.clearChosen(); @@ -76,7 +76,7 @@ class SyphonMindEffect extends OneShotEffect { } } } - you.drawCards(amount, source.getSourceId(), game); + you.drawCards(amount, source, game); } return result; } diff --git a/Mage.Sets/src/mage/cards/s/SyphonSoul.java b/Mage.Sets/src/mage/cards/s/SyphonSoul.java index 3ed9cc8bc8e..e56e70ca9db 100644 --- a/Mage.Sets/src/mage/cards/s/SyphonSoul.java +++ b/Mage.Sets/src/mage/cards/s/SyphonSoul.java @@ -48,7 +48,7 @@ class SyphonSoulEffect extends OneShotEffect { int damageDealt = 0; for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { if (!playerId.equals(source.getControllerId())) { - damageDealt += game.getPlayer(playerId).damage(2, source.getSourceId(), game); + damageDealt += game.getPlayer(playerId).damage(2, source.getSourceId(), source, game); } } if (damageDealt > 0) { diff --git a/Mage.Sets/src/mage/cards/s/SzatsWill.java b/Mage.Sets/src/mage/cards/s/SzatsWill.java index ae5b51ae538..f438ff647e1 100644 --- a/Mage.Sets/src/mage/cards/s/SzatsWill.java +++ b/Mage.Sets/src/mage/cards/s/SzatsWill.java @@ -134,8 +134,7 @@ class SzatsWillEffect extends OneShotEffect { .max() .orElse(0); if (maxPower > 0) { - new BreedingPitThrullToken().putOntoBattlefield( - 1, game, source.getSourceId(), source.getControllerId() + new BreedingPitThrullToken().putOntoBattlefield(1, game, source, source.getControllerId() ); } return true; diff --git a/Mage.Sets/src/mage/cards/t/TIEInterceptor.java b/Mage.Sets/src/mage/cards/t/TIEInterceptor.java index b9917107d9a..3356d40ffc2 100644 --- a/Mage.Sets/src/mage/cards/t/TIEInterceptor.java +++ b/Mage.Sets/src/mage/cards/t/TIEInterceptor.java @@ -60,7 +60,7 @@ class TIEInterceptorEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.loseLife(2, game, false); + opponent.loseLife(2, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TIESilencer.java b/Mage.Sets/src/mage/cards/t/TIESilencer.java index 2e71c23cf09..00dd11c38ae 100644 --- a/Mage.Sets/src/mage/cards/t/TIESilencer.java +++ b/Mage.Sets/src/mage/cards/t/TIESilencer.java @@ -66,12 +66,12 @@ class TIESilencerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { UUID defender = game.getCombat().getDefendingPlayerId(source.getSourceId(), game); if(defender != null) { - game.damagePlayerOrPlaneswalker(defender, 1, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(defender, 1, source.getSourceId(), source, game, false, true); UUID target = source.getTargets().getFirstTarget(); Permanent permanent = game.getPermanent(target); if(permanent != null) { - permanent.damage(1, source.getSourceId(), game, false, true); + permanent.damage(1, source.getSourceId(), source, game, false, true); } return true; diff --git a/Mage.Sets/src/mage/cards/t/TaboraxHopesDemise.java b/Mage.Sets/src/mage/cards/t/TaboraxHopesDemise.java index b5ef312ceee..7c04df25e71 100644 --- a/Mage.Sets/src/mage/cards/t/TaboraxHopesDemise.java +++ b/Mage.Sets/src/mage/cards/t/TaboraxHopesDemise.java @@ -106,8 +106,8 @@ class TaboraxHopesDemiseEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.chooseUse( outcome, "Draw a card and lose 1 life?", source, game - ) && player.drawCards(1, source.getSourceId(), game) > 0) { - player.loseLife(1, game, false); + ) && player.drawCards(1, source, game) > 0) { + player.loseLife(1, game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/t/TaintedPact.java b/Mage.Sets/src/mage/cards/t/TaintedPact.java index cc9adb3272d..8d83922ddfc 100644 --- a/Mage.Sets/src/mage/cards/t/TaintedPact.java +++ b/Mage.Sets/src/mage/cards/t/TaintedPact.java @@ -67,7 +67,7 @@ class TaintedPactEffect extends OneShotEffect{ Card card = player.getLibrary().getFromTop(game); if (card != null) { - card.moveToExile(null, null, source.getSourceId(), game); + card.moveToExile(null, null, source, game); // Checks if there was already exiled a card with the same name if (names.contains(card.getName())) { break; @@ -75,7 +75,7 @@ class TaintedPactEffect extends OneShotEffect{ names.add(card.getName()); if (player.chooseUse(outcome, "Put " + card.getName() + " into your hand?", source, game)) { //Adds the current card to hand if it is chosen. - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); break; } } diff --git a/Mage.Sets/src/mage/cards/t/TaintedRemedy.java b/Mage.Sets/src/mage/cards/t/TaintedRemedy.java index 43b7ccbbe28..496ceb54343 100644 --- a/Mage.Sets/src/mage/cards/t/TaintedRemedy.java +++ b/Mage.Sets/src/mage/cards/t/TaintedRemedy.java @@ -73,7 +73,7 @@ class TaintedRemedyReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player opponent = game.getPlayer(event.getPlayerId()); if (opponent != null) { - opponent.loseLife(event.getAmount(), game, false); + opponent.loseLife(event.getAmount(), game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TakenumaBleeder.java b/Mage.Sets/src/mage/cards/t/TakenumaBleeder.java index b05a2dfc783..a5f6f845de4 100644 --- a/Mage.Sets/src/mage/cards/t/TakenumaBleeder.java +++ b/Mage.Sets/src/mage/cards/t/TakenumaBleeder.java @@ -65,7 +65,7 @@ class TakenumaBleederEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (game.getBattlefield().countAll(new FilterCreaturePermanent(SubType.DEMON, "Demon"), source.getControllerId(), game) < 1) { - controller.loseLife(1, game, false); + controller.loseLife(1, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TalarasBane.java b/Mage.Sets/src/mage/cards/t/TalarasBane.java index e28a0ca5755..a90f0103daf 100644 --- a/Mage.Sets/src/mage/cards/t/TalarasBane.java +++ b/Mage.Sets/src/mage/cards/t/TalarasBane.java @@ -83,7 +83,7 @@ class TalarasBaneEffect extends OneShotEffect { if (card != null) { int lifeGain = card.getToughness().getValue(); you.gainLife(lifeGain, game, source); - return targetPlayer.discard(card, source, game); + return targetPlayer.discard(card, false, source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/t/TalarasBattalion.java b/Mage.Sets/src/mage/cards/t/TalarasBattalion.java index 105b37f6e3e..39c4c32441a 100644 --- a/Mage.Sets/src/mage/cards/t/TalarasBattalion.java +++ b/Mage.Sets/src/mage/cards/t/TalarasBattalion.java @@ -121,7 +121,7 @@ class TalarasBattalionWatcher extends Watcher { if (condition == true) { //no need to check - condition has already occured return; } - if (event.getType() == EventType.SPELL_CAST + if (event.getType() == GameEvent.EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) { diff --git a/Mage.Sets/src/mage/cards/t/TalusPaladin.java b/Mage.Sets/src/mage/cards/t/TalusPaladin.java index 5b7e061d868..0c585614262 100644 --- a/Mage.Sets/src/mage/cards/t/TalusPaladin.java +++ b/Mage.Sets/src/mage/cards/t/TalusPaladin.java @@ -73,7 +73,7 @@ class TalusPaladinTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TangleWire.java b/Mage.Sets/src/mage/cards/t/TangleWire.java index 8ee9fe07070..6017771fe91 100644 --- a/Mage.Sets/src/mage/cards/t/TangleWire.java +++ b/Mage.Sets/src/mage/cards/t/TangleWire.java @@ -87,7 +87,7 @@ class TangleWireEffect extends OneShotEffect { for (UUID uuid : target.getTargets()) { Permanent selectedPermanent = game.getPermanent(uuid); if ( selectedPermanent != null ) { - abilityApplied |= selectedPermanent.tap(game); + abilityApplied |= selectedPermanent.tap(source, game); } } diff --git a/Mage.Sets/src/mage/cards/t/Tariff.java b/Mage.Sets/src/mage/cards/t/Tariff.java index 96b653e92ff..d9931299a16 100644 --- a/Mage.Sets/src/mage/cards/t/Tariff.java +++ b/Mage.Sets/src/mage/cards/t/Tariff.java @@ -88,14 +88,14 @@ class TariffEffect extends OneShotEffect { String message = "Pay " + manaCost.getText() + " (otherwise sacrifice " + creatureToPayFor.getName() + ")?"; if (player.chooseUse(Outcome.Benefit, message, source, game)) { - if (manaCost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (manaCost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(sourceObject.getName() + ": " + player.getLogName() + " has paid"); return; } } game.informPlayers(sourceObject.getName() + ": " + player.getLogName() + " hasn't paid"); - creatureToPayFor.sacrifice(source.getSourceId(), game); + creatureToPayFor.sacrifice(source, game); } } diff --git a/Mage.Sets/src/mage/cards/t/TatsumasaTheDragonsFang.java b/Mage.Sets/src/mage/cards/t/TatsumasaTheDragonsFang.java index 35005063fe2..2007d7820d3 100644 --- a/Mage.Sets/src/mage/cards/t/TatsumasaTheDragonsFang.java +++ b/Mage.Sets/src/mage/cards/t/TatsumasaTheDragonsFang.java @@ -113,7 +113,7 @@ class TatsumaTheDragonsFangTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TawnossCoffin.java b/Mage.Sets/src/mage/cards/t/TawnossCoffin.java index a1375ba2fec..b3f3cd16179 100644 --- a/Mage.Sets/src/mage/cards/t/TawnossCoffin.java +++ b/Mage.Sets/src/mage/cards/t/TawnossCoffin.java @@ -221,7 +221,7 @@ class TawnossCoffinReturnEffect extends OneShotEffect { for (Card enchantment : returningAuras) { Permanent permanent = game.getPermanent(enchantment.getId()); if (permanent != null) { - newPermanent.addAttachment(permanent.getId(), game); + newPermanent.addAttachment(permanent.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java b/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java index d059364840a..637d6af2ef5 100644 --- a/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java +++ b/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java @@ -91,12 +91,12 @@ class TayamLuminousEnigmaCost extends RemoveCounterCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; int countersRemoved = 0; Player controller = game.getPlayer(controllerId); for (int i = 0; i < countersToRemove; i++) { - if (target.choose(Outcome.UnboostCreature, controllerId, sourceId, game)) { + if (target.choose(Outcome.UnboostCreature, controllerId, source.getSourceId(), game)) { UUID targetId = getOnlyElement(target.getTargets()); Permanent permanent = game.getPermanent(targetId); if (permanent != null) { @@ -124,7 +124,7 @@ class TayamLuminousEnigmaCost extends RemoveCounterCost { } } if (counterName != null) { - permanent.removeCounters(counterName, 1, game); + permanent.removeCounters(counterName, 1, source, game); target.clearChosen(); if (!game.isSimulation()) { game.informPlayers(new StringBuilder(controller.getLogName()) diff --git a/Mage.Sets/src/mage/cards/t/TectonicEdge.java b/Mage.Sets/src/mage/cards/t/TectonicEdge.java index d3e887b497f..385d1d6e000 100644 --- a/Mage.Sets/src/mage/cards/t/TectonicEdge.java +++ b/Mage.Sets/src/mage/cards/t/TectonicEdge.java @@ -77,7 +77,7 @@ class TectonicEdgeCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { for (UUID opponentId: game.getOpponents(controllerId)) { if (game.getBattlefield().countAll(StaticFilters.FILTER_LANDS, opponentId, game) > 3) { return true; @@ -87,7 +87,7 @@ class TectonicEdgeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/cards/t/TeferisAgelessInsight.java b/Mage.Sets/src/mage/cards/t/TeferisAgelessInsight.java index 42e2249712e..cf06c42efe5 100644 --- a/Mage.Sets/src/mage/cards/t/TeferisAgelessInsight.java +++ b/Mage.Sets/src/mage/cards/t/TeferisAgelessInsight.java @@ -61,7 +61,7 @@ class TeferisAgelessInsightEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.drawCards(2, event.getSourceId(), game, event.getAppliedEffects()); + controller.drawCards(2, source, game, event); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TeferisPuzzleBox.java b/Mage.Sets/src/mage/cards/t/TeferisPuzzleBox.java index 4ead6cbd57e..f143f63a81c 100644 --- a/Mage.Sets/src/mage/cards/t/TeferisPuzzleBox.java +++ b/Mage.Sets/src/mage/cards/t/TeferisPuzzleBox.java @@ -55,7 +55,7 @@ class TeferisPuzzleBoxEffect extends OneShotEffect { if (player != null) { int count = player.getHand().size(); player.putCardsOnBottomOfLibrary(player.getHand(), game, source, true); - player.drawCards(count, source.getSourceId(), game); + player.drawCards(count, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TeferisResponse.java b/Mage.Sets/src/mage/cards/t/TeferisResponse.java index 7c9ad386bac..754f3f994cd 100644 --- a/Mage.Sets/src/mage/cards/t/TeferisResponse.java +++ b/Mage.Sets/src/mage/cards/t/TeferisResponse.java @@ -70,12 +70,12 @@ class TeferisResponseEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { UUID targetId = source.getFirstTarget(); StackObject stackObject = game.getStack().getStackObject(targetId); - if (targetId != null && game.getStack().counter(targetId, source.getSourceId(), game)) { + if (targetId != null && game.getStack().counter(targetId, source, game)) { UUID permanentId = stackObject.getSourceId(); if (permanentId != null) { Permanent usedPermanent = game.getPermanent(permanentId); if (usedPermanent != null) { - usedPermanent.destroy(source.getSourceId(), game, false); + usedPermanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TempOfTheDamned.java b/Mage.Sets/src/mage/cards/t/TempOfTheDamned.java index 8d1249e920f..9e032a8246d 100644 --- a/Mage.Sets/src/mage/cards/t/TempOfTheDamned.java +++ b/Mage.Sets/src/mage/cards/t/TempOfTheDamned.java @@ -68,7 +68,7 @@ class TempOfTheDamnedEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - return new AddCountersSourceEffect(CounterType.FUNK.createInstance(controller.rollDice(game, 6))).apply(game, source); + return new AddCountersSourceEffect(CounterType.FUNK.createInstance(controller.rollDice(source, game, 6))).apply(game, source); } return false; } @@ -91,9 +91,9 @@ class TempOfTheDamnedUpkeepEffect extends OneShotEffect { if (permanent != null) { int amount = permanent.getCounters(game).getCount(CounterType.FUNK); if (amount > 0) { - permanent.removeCounters(CounterType.FUNK.createInstance(), game); + permanent.removeCounters(CounterType.FUNK.createInstance(), source, game); } else { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/Temper.java b/Mage.Sets/src/mage/cards/t/Temper.java index 6ce5de5ee15..7701a46b960 100644 --- a/Mage.Sets/src/mage/cards/t/Temper.java +++ b/Mage.Sets/src/mage/cards/t/Temper.java @@ -13,6 +13,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; @@ -77,20 +78,20 @@ class TemperPreventDamageTargetEffect extends PreventionEffectImpl { amount = dVal.calculate(game, source, this); initialized = true; } - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int prevented = 0; if (event.getAmount() >= this.amount) { int damage = amount; event.setAmount(event.getAmount() - amount); this.used = true; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); prevented = damage; } else { int damage = event.getAmount(); event.setAmount(0); amount -= damage; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); prevented = damage; } diff --git a/Mage.Sets/src/mage/cards/t/TemporalCascade.java b/Mage.Sets/src/mage/cards/t/TemporalCascade.java index d4d1fb3971e..e53e8674fba 100644 --- a/Mage.Sets/src/mage/cards/t/TemporalCascade.java +++ b/Mage.Sets/src/mage/cards/t/TemporalCascade.java @@ -63,7 +63,7 @@ class TemporalCascadeDrawEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(7, source.getSourceId(), game); + player.drawCards(7, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TemporalDistortion.java b/Mage.Sets/src/mage/cards/t/TemporalDistortion.java index 9d906a4807a..64a0842a854 100644 --- a/Mage.Sets/src/mage/cards/t/TemporalDistortion.java +++ b/Mage.Sets/src/mage/cards/t/TemporalDistortion.java @@ -76,7 +76,7 @@ class TemporalDistortionRemovalEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(game.getActivePlayerId())) { - permanent.removeCounters(CounterType.HOURGLASS.createInstance(permanent.getCounters(game).getCount(CounterType.HOURGLASS)), game); + permanent.removeCounters(CounterType.HOURGLASS.createInstance(permanent.getCounters(game).getCount(CounterType.HOURGLASS)), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TemporalExtortion.java b/Mage.Sets/src/mage/cards/t/TemporalExtortion.java index b9df59a3614..43f14aed0c4 100644 --- a/Mage.Sets/src/mage/cards/t/TemporalExtortion.java +++ b/Mage.Sets/src/mage/cards/t/TemporalExtortion.java @@ -65,11 +65,11 @@ class TemporalExtortionCounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && player.chooseUse(outcome, "Pay half your life, rounded up to counter " + sourceObject.getIdName() + '?', source, game)) { int amount = (int) Math.ceil(player.getLife() / 2f); - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); game.informPlayers(player.getLogName() + " pays half their life, rounded up to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { - game.getStack().counter(spell.getId(), source.getSourceId(), game); + game.getStack().counter(spell.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TemporaryTruce.java b/Mage.Sets/src/mage/cards/t/TemporaryTruce.java index b842241d4bc..75a69cf1948 100644 --- a/Mage.Sets/src/mage/cards/t/TemporaryTruce.java +++ b/Mage.Sets/src/mage/cards/t/TemporaryTruce.java @@ -58,7 +58,7 @@ class TemporaryTruceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int cardsToDraw = player.getAmount(0, 2, "Draw how many cards?", game); - player.drawCards(cardsToDraw, source.getSourceId(), game); + player.drawCards(cardsToDraw, source, game); player.gainLife((2 - cardsToDraw) * 2, game, source); } } diff --git a/Mage.Sets/src/mage/cards/t/TemptWithVengeance.java b/Mage.Sets/src/mage/cards/t/TemptWithVengeance.java index 15b0d1f6976..44552b370e6 100644 --- a/Mage.Sets/src/mage/cards/t/TemptWithVengeance.java +++ b/Mage.Sets/src/mage/cards/t/TemptWithVengeance.java @@ -59,7 +59,7 @@ class TemptWithVengeanceEffect extends OneShotEffect { if (controller != null && xValue > 0) { Token tokenCopy = new TemptWithVengeanceElementalToken(); - tokenCopy.putOntoBattlefield(xValue, game, source.getSourceId(), source.getControllerId(), false, false); + tokenCopy.putOntoBattlefield(xValue, game, source, source.getControllerId(), false, false); int opponentsAddedTokens = 0; for (UUID playerId : game.getOpponents(controller.getId())) { @@ -67,12 +67,12 @@ class TemptWithVengeanceEffect extends OneShotEffect { if (opponent != null) { if (opponent.chooseUse(outcome, "Create " + xValue + " Elemental tokens?", source, game)) { opponentsAddedTokens += xValue; - tokenCopy.putOntoBattlefield(xValue, game, source.getSourceId(), playerId, false, false); + tokenCopy.putOntoBattlefield(xValue, game, source, playerId, false, false); } } } if (opponentsAddedTokens > 0) { - tokenCopy.putOntoBattlefield(opponentsAddedTokens, game, source.getSourceId(), source.getControllerId(), false, false); + tokenCopy.putOntoBattlefield(opponentsAddedTokens, game, source, source.getControllerId(), false, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/Terastodon.java b/Mage.Sets/src/mage/cards/t/Terastodon.java index 3adf3d54bba..fac92429181 100644 --- a/Mage.Sets/src/mage/cards/t/Terastodon.java +++ b/Mage.Sets/src/mage/cards/t/Terastodon.java @@ -80,7 +80,7 @@ class TerastodonEffect extends OneShotEffect { for (UUID targetID : this.targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(targetID); if (permanent != null) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) { int numberPermanents = destroyedPermanents.getOrDefault(permanent.getControllerId(), 0); destroyedPermanents.put(permanent.getControllerId(), numberPermanents + 1); @@ -91,7 +91,7 @@ class TerastodonEffect extends OneShotEffect { game.getState().processAction(game); ElephantToken elephantToken = new ElephantToken(); for (Entry entry : destroyedPermanents.entrySet()) { - elephantToken.putOntoBattlefield(entry.getValue(), game, source.getSourceId(), entry.getKey()); + elephantToken.putOntoBattlefield(entry.getValue(), game, source, entry.getKey()); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TerritorialHellkite.java b/Mage.Sets/src/mage/cards/t/TerritorialHellkite.java index ece34d50789..2e6e4d2ab21 100644 --- a/Mage.Sets/src/mage/cards/t/TerritorialHellkite.java +++ b/Mage.Sets/src/mage/cards/t/TerritorialHellkite.java @@ -140,7 +140,7 @@ class AttackIfAbleTargetRandoOpponentSourceEffect extends OneShotEffect { } } else { game.informPlayers(sourcePermanent.getLogName() + " can't attack an opponent it didn't attack last combat."); - sourcePermanent.tap(game); + sourcePermanent.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TestOfFaith.java b/Mage.Sets/src/mage/cards/t/TestOfFaith.java index c3fc5605193..637c6fe14a1 100644 --- a/Mage.Sets/src/mage/cards/t/TestOfFaith.java +++ b/Mage.Sets/src/mage/cards/t/TestOfFaith.java @@ -11,6 +11,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; @@ -65,20 +66,20 @@ class TestOfFaithPreventDamageTargetEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int prevented = 0; if (event.getAmount() >= this.amount) { int damage = amount; event.setAmount(event.getAmount() - amount); this.used = true; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); prevented = damage; } else { int damage = event.getAmount(); event.setAmount(0); amount -= damage; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); prevented = damage; } diff --git a/Mage.Sets/src/mage/cards/t/Tetravus.java b/Mage.Sets/src/mage/cards/t/Tetravus.java index c0f8b59d442..d0178799ea7 100644 --- a/Mage.Sets/src/mage/cards/t/Tetravus.java +++ b/Mage.Sets/src/mage/cards/t/Tetravus.java @@ -108,7 +108,7 @@ class TetravusCreateTokensEffect extends OneShotEffect { } countersToRemove = player.getAmount(0, countersToRemove, "Choose an amount of counters to remove", game); Cost cost = new RemoveCountersSourceCost(CounterType.P1P1.createInstance(countersToRemove)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + if (cost.pay(source, game, source, source.getControllerId(), true)) { CreateTokenEffect effect = new CreateTokenEffect(new TetraviteToken(), countersToRemove); effect.apply(game, source); Object object = game.getState().getValue(CardUtil.getObjectZoneString("_tokensCreated", permanent, game)); @@ -157,7 +157,7 @@ class TetravusAddCountersEffect extends OneShotEffect { filter.add(new TetravusPredicate(new MageObjectReference(permanent, game))); filter.add(TokenPredicate.instance); ExileTargetCost cost = new ExileTargetCost(new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true)); - if (cost.pay(source, game, source.getSourceId(), player.getId(), true)) { + if (cost.pay(source, game, source, player.getId(), true)) { return new AddCountersSourceEffect(CounterType.P1P1.createInstance(cost.getPermanents().size())).apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/cards/t/TeveshSzatDoomOfFools.java b/Mage.Sets/src/mage/cards/t/TeveshSzatDoomOfFools.java index f78b0a9b3d6..57dfa23435d 100644 --- a/Mage.Sets/src/mage/cards/t/TeveshSzatDoomOfFools.java +++ b/Mage.Sets/src/mage/cards/t/TeveshSzatDoomOfFools.java @@ -114,12 +114,12 @@ class TeveshSzatDoomOfFoolsSacrificeEffect extends OneShotEffect { game.getPlayer(permanent.getControllerId()), CommanderCardType.COMMANDER_OR_OATHBREAKER ).contains(permanent.getId()); - if (!permanent.sacrifice(source.getSourceId(), game)) { + if (!permanent.sacrifice(source, game)) { return false; } - controller.drawCards(2, source.getSourceId(), game); + controller.drawCards(2, source, game); if (isCommander) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TezzeretAgentOfBolas.java b/Mage.Sets/src/mage/cards/t/TezzeretAgentOfBolas.java index 8d3f0b00e1b..d05d945de8c 100644 --- a/Mage.Sets/src/mage/cards/t/TezzeretAgentOfBolas.java +++ b/Mage.Sets/src/mage/cards/t/TezzeretAgentOfBolas.java @@ -97,7 +97,7 @@ class TezzeretAgentOfBolasEffect2 extends OneShotEffect { if (count > 0) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.loseLife(count, game, false); + targetPlayer.loseLife(count, game, source, false); } Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java b/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java index 3e5f13e3c05..77b29d52b07 100644 --- a/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java +++ b/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java @@ -121,7 +121,7 @@ class TezzeretMasterOfMetalControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null && controllerId != null) { - return permanent.changeControllerId(controllerId, game); + return permanent.changeControllerId(controllerId, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java b/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java index e7e02a1e2cc..713f14f26f8 100644 --- a/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java +++ b/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java @@ -76,7 +76,7 @@ class ThadaAdelAcquisitorEffect extends OneShotEffect { if (!target.getTargets().isEmpty()) { Card card = damagedPlayer.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.LIBRARY, true); ContinuousEffect effect = new ThadaAdelPlayFromExileEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/t/ThassasEmissary.java b/Mage.Sets/src/mage/cards/t/ThassasEmissary.java index 98003f0f960..ae849d5a7d6 100644 --- a/Mage.Sets/src/mage/cards/t/ThassasEmissary.java +++ b/Mage.Sets/src/mage/cards/t/ThassasEmissary.java @@ -68,7 +68,7 @@ class ThassasEmissaryTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ThatcherRevolt.java b/Mage.Sets/src/mage/cards/t/ThatcherRevolt.java index a8828865059..32758606d20 100644 --- a/Mage.Sets/src/mage/cards/t/ThatcherRevolt.java +++ b/Mage.Sets/src/mage/cards/t/ThatcherRevolt.java @@ -60,7 +60,7 @@ class ThatcherRevoltEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { ThatcherHumanToken token = new ThatcherHumanToken(); - token.putOntoBattlefield(3, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(3, game, source, source.getControllerId()); List toSacrifice = new ArrayList<>(); for (UUID tokenId : token.getLastAddedTokenIds()) { Permanent tokenPermanent = game.getPermanent(tokenId); diff --git a/Mage.Sets/src/mage/cards/t/TheAkroanWar.java b/Mage.Sets/src/mage/cards/t/TheAkroanWar.java index dd83d55df6b..865c1c869f7 100644 --- a/Mage.Sets/src/mage/cards/t/TheAkroanWar.java +++ b/Mage.Sets/src/mage/cards/t/TheAkroanWar.java @@ -98,7 +98,7 @@ class TheAkroanWarEffect extends OneShotEffect { game.getBattlefield() .getActivePermanents(filter, source.getControllerId(), game) .stream() - .forEach(permanent -> permanent.damage(permanent.getPower().getValue(), permanent.getId(), game)); + .forEach(permanent -> permanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game)); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/t/TheBattleOfNaboo.java b/Mage.Sets/src/mage/cards/t/TheBattleOfNaboo.java index 569b56fe786..2d6792b4be8 100644 --- a/Mage.Sets/src/mage/cards/t/TheBattleOfNaboo.java +++ b/Mage.Sets/src/mage/cards/t/TheBattleOfNaboo.java @@ -74,7 +74,7 @@ class TheBattleOfNabooEffect extends OneShotEffect { if (player != null) { int x = source.getManaCostsToPay().getX(); if (x > 0) { - player.drawCards(2 * x, source.getSourceId(), game); + player.drawCards(2 * x, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TheBattleOfYavin.java b/Mage.Sets/src/mage/cards/t/TheBattleOfYavin.java index e13a60cde8b..2b2dccb3d11 100644 --- a/Mage.Sets/src/mage/cards/t/TheBattleOfYavin.java +++ b/Mage.Sets/src/mage/cards/t/TheBattleOfYavin.java @@ -88,12 +88,12 @@ class TheBattleOfYavinEffect extends OneShotEffect { if (lifePaid > 0) { Player player = game.getPlayer(opponent.getId()); if (player != null) { - player.loseLife(lifePaid, game, false); + player.loseLife(lifePaid, game, source, false); } } for (Permanent permanent : sacrifices) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TheBigIdea.java b/Mage.Sets/src/mage/cards/t/TheBigIdea.java index 8a3a85ea197..28ab1d31459 100644 --- a/Mage.Sets/src/mage/cards/t/TheBigIdea.java +++ b/Mage.Sets/src/mage/cards/t/TheBigIdea.java @@ -97,7 +97,7 @@ class TheBigIdeaReplacementEffect extends ReplacementEffectImpl { if (controller != null) { discard(); - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); event.setAmount(event.getAmount() + amount); return true; } @@ -139,7 +139,7 @@ class TheBigIdeaEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); return new CreateTokenEffect(new BrainiacToken(), amount).apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/cards/t/TheElderspell.java b/Mage.Sets/src/mage/cards/t/TheElderspell.java index 0251cb93779..833fe25ea52 100644 --- a/Mage.Sets/src/mage/cards/t/TheElderspell.java +++ b/Mage.Sets/src/mage/cards/t/TheElderspell.java @@ -70,7 +70,7 @@ class TheElderspellEffect extends OneShotEffect { int count = 0; for (UUID permId : source.getTargets().get(0).getTargets()) { Permanent permanent = game.getPermanent(permId); - if (permanent != null && permanent.destroy(source.getSourceId(), game, false)) { + if (permanent != null && permanent.destroy(source, game, false)) { count++; } } diff --git a/Mage.Sets/src/mage/cards/t/TheFallen.java b/Mage.Sets/src/mage/cards/t/TheFallen.java index 38e010e4664..e7c82933570 100644 --- a/Mage.Sets/src/mage/cards/t/TheFallen.java +++ b/Mage.Sets/src/mage/cards/t/TheFallen.java @@ -66,7 +66,7 @@ class TheFallenEffect extends OneShotEffect { if (watcher != null && watcher.getPlayersAndWalkersDealtDamageThisGame(source.getSourceId()) != null) { for (UUID playerId : watcher.getPlayersAndWalkersDealtDamageThisGame(source.getSourceId())) { if (!source.isControlledBy(playerId)) { - game.damagePlayerOrPlaneswalker(playerId, 1, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(playerId, 1, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TheFirstEruption.java b/Mage.Sets/src/mage/cards/t/TheFirstEruption.java index 650ed09b161..d6db1f77f3f 100644 --- a/Mage.Sets/src/mage/cards/t/TheFirstEruption.java +++ b/Mage.Sets/src/mage/cards/t/TheFirstEruption.java @@ -99,15 +99,15 @@ class TheFirstEruptionEffect extends OneShotEffect { Target target = new TargetControlledPermanent(1, 1, filter, false); boolean sacrificed = false; - if (target.canChoose(controller.getId(), game)) { - while (controller.canRespond() && !target.isChosen() && target.canChoose(controller.getId(), game)) { + if (target.canChoose(source.getSourceId(), controller.getId(), game)) { + while (controller.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game)) { controller.chooseTarget(Outcome.Sacrifice, target, source, game); } for (int idx = 0; idx < target.getTargets().size(); idx++) { Permanent permanent = game.getPermanent(target.getTargets().get(idx)); if (permanent != null) { - sacrificed |= permanent.sacrifice(source.getSourceId(), game); + sacrificed |= permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TheGitrogMonster.java b/Mage.Sets/src/mage/cards/t/TheGitrogMonster.java index a4073f519e0..7db5edf16bc 100644 --- a/Mage.Sets/src/mage/cards/t/TheGitrogMonster.java +++ b/Mage.Sets/src/mage/cards/t/TheGitrogMonster.java @@ -75,7 +75,9 @@ class TheGitrogMonsterTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; - if (zEvent != null && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { + if (zEvent != null + && Zone.GRAVEYARD == zEvent.getToZone() + && zEvent.getCards() != null) { for (Card card : zEvent.getCards()) { if (card != null) { UUID cardOwnerId = card.getOwnerId(); diff --git a/Mage.Sets/src/mage/cards/t/TheGreatAurora.java b/Mage.Sets/src/mage/cards/t/TheGreatAurora.java index 063ae0af37b..3637a587660 100644 --- a/Mage.Sets/src/mage/cards/t/TheGreatAurora.java +++ b/Mage.Sets/src/mage/cards/t/TheGreatAurora.java @@ -83,7 +83,7 @@ class TheGreatAuroraEffect extends OneShotEffect { permanentsCount.put(playerId, handCards + (list != null ? list.size() : 0)); if (list != null) { for (Permanent permanent : list) { - player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + player.moveCardToLibraryWithInfo(permanent, source, game, Zone.BATTLEFIELD, true, true); } player.shuffleLibrary(source, game); } @@ -98,7 +98,7 @@ class TheGreatAuroraEffect extends OneShotEffect { if (player != null) { int count = permanentsCount.get(playerId); if (count > 0) { - player.drawCards(count, source.getSourceId(), game); + player.drawCards(count, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TheMendingOfDominaria.java b/Mage.Sets/src/mage/cards/t/TheMendingOfDominaria.java index 11c91d05e74..90d6c64e754 100644 --- a/Mage.Sets/src/mage/cards/t/TheMendingOfDominaria.java +++ b/Mage.Sets/src/mage/cards/t/TheMendingOfDominaria.java @@ -114,7 +114,7 @@ class TheMendingOfDominariaSecondEffect extends OneShotEffect { Zone.BATTLEFIELD, source, game, false, false, false, null ); for (Card card : controller.getGraveyard().getCards(game)) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } controller.shuffleLibrary(source, game); } diff --git a/Mage.Sets/src/mage/cards/t/TheMirariConjecture.java b/Mage.Sets/src/mage/cards/t/TheMirariConjecture.java index 248f8b56cfd..25a378e28ca 100644 --- a/Mage.Sets/src/mage/cards/t/TheMirariConjecture.java +++ b/Mage.Sets/src/mage/cards/t/TheMirariConjecture.java @@ -89,7 +89,7 @@ class TheMirariConjectureDelayedTriggeredAbility extends DelayedTriggeredAbility @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TheOzolith.java b/Mage.Sets/src/mage/cards/t/TheOzolith.java index 549d980355c..dae38f99bcd 100644 --- a/Mage.Sets/src/mage/cards/t/TheOzolith.java +++ b/Mage.Sets/src/mage/cards/t/TheOzolith.java @@ -175,7 +175,7 @@ class TheOzolithMoveCountersEffect extends OneShotEffect { .values() .stream() .filter(counter -> creature.addCounters(counter, source, game)) - .forEach(counter -> permanent.removeCounters(counter, game)); + .forEach(counter -> permanent.removeCounters(counter, source, game)); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/TheRack.java b/Mage.Sets/src/mage/cards/t/TheRack.java index 6405b57eb27..02060e132bc 100644 --- a/Mage.Sets/src/mage/cards/t/TheRack.java +++ b/Mage.Sets/src/mage/cards/t/TheRack.java @@ -58,7 +58,7 @@ class TheRackTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -96,7 +96,7 @@ class TheRackEffect extends OneShotEffect { if (chosenPlayer != null) { int damage = 3 - chosenPlayer.getHand().size(); if (damage > 0) { - chosenPlayer.damage(damage, source.getSourceId(), game); + chosenPlayer.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TheScarabGod.java b/Mage.Sets/src/mage/cards/t/TheScarabGod.java index aa810cbebee..99f9d62893c 100644 --- a/Mage.Sets/src/mage/cards/t/TheScarabGod.java +++ b/Mage.Sets/src/mage/cards/t/TheScarabGod.java @@ -99,7 +99,7 @@ class TheScarabGodEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - opponent.loseLife(numZombies, game, false); + opponent.loseLife(numZombies, game, source, false); } } controller.scry(numZombies, source, game); diff --git a/Mage.Sets/src/mage/cards/t/TheScorpionGod.java b/Mage.Sets/src/mage/cards/t/TheScorpionGod.java index 43fd5f7a5b1..28c3d91ceda 100644 --- a/Mage.Sets/src/mage/cards/t/TheScorpionGod.java +++ b/Mage.Sets/src/mage/cards/t/TheScorpionGod.java @@ -92,7 +92,7 @@ class TheScorpionGodTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ThelonsChant.java b/Mage.Sets/src/mage/cards/t/ThelonsChant.java index 3d53bd3ed31..36070e9a5da 100644 --- a/Mage.Sets/src/mage/cards/t/ThelonsChant.java +++ b/Mage.Sets/src/mage/cards/t/ThelonsChant.java @@ -83,7 +83,7 @@ class ThelonsChantEffect extends OneShotEffect { } } if (!paid) { - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/ThelonsCurse.java b/Mage.Sets/src/mage/cards/t/ThelonsCurse.java index 2446105417c..40e59851753 100644 --- a/Mage.Sets/src/mage/cards/t/ThelonsCurse.java +++ b/Mage.Sets/src/mage/cards/t/ThelonsCurse.java @@ -95,7 +95,7 @@ class ThelonsCurseEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("U"); Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source, player.getId(), false)) { tappedCreature.untap(game); } } diff --git a/Mage.Sets/src/mage/cards/t/Thermokarst.java b/Mage.Sets/src/mage/cards/t/Thermokarst.java index f528936aef1..e14f4d9e11d 100644 --- a/Mage.Sets/src/mage/cards/t/Thermokarst.java +++ b/Mage.Sets/src/mage/cards/t/Thermokarst.java @@ -58,7 +58,7 @@ class ThermokarstEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null && controller != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (permanent.isSnow()) { controller.gainLife(1, game, source); } diff --git a/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java b/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java index 973efc189a5..d1fafe85ace 100644 --- a/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java +++ b/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java @@ -76,7 +76,7 @@ class ThiefOfBloodEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { Counters counters = permanent.getCounters(game).copy(); for (Counter counter : counters.values()) { - permanent.removeCounters(counter.getName(), counter.getCount(), game); + permanent.removeCounters(counter.getName(), counter.getCount(), source, game); countersRemoved += counter.getCount(); } } diff --git a/Mage.Sets/src/mage/cards/t/ThievingAmalgam.java b/Mage.Sets/src/mage/cards/t/ThievingAmalgam.java index d28aed647ed..6e683da46c0 100644 --- a/Mage.Sets/src/mage/cards/t/ThievingAmalgam.java +++ b/Mage.Sets/src/mage/cards/t/ThievingAmalgam.java @@ -135,7 +135,7 @@ class ThievingAmalgamLifeLossEffect extends OneShotEffect { if (player == null) { return false; } - player.loseLife(2, game, false); + player.loseLife(2, game, source, false); return effect.apply(game, source); } } diff --git a/Mage.Sets/src/mage/cards/t/ThievingSkydiver.java b/Mage.Sets/src/mage/cards/t/ThievingSkydiver.java index 2088eb91c59..cc9370f7416 100644 --- a/Mage.Sets/src/mage/cards/t/ThievingSkydiver.java +++ b/Mage.Sets/src/mage/cards/t/ThievingSkydiver.java @@ -110,7 +110,7 @@ class ThievingSkydiverEffect extends OneShotEffect { return false; } game.applyEffects(); - permanent.addAttachment(artifact.getId(), game); + permanent.addAttachment(artifact.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/ThievingSprite.java b/Mage.Sets/src/mage/cards/t/ThievingSprite.java index a2b3f62b338..78b82f3a9e6 100644 --- a/Mage.Sets/src/mage/cards/t/ThievingSprite.java +++ b/Mage.Sets/src/mage/cards/t/ThievingSprite.java @@ -116,7 +116,7 @@ class ThievingSpriteEffect extends OneShotEffect { } else { card = revealedCards.getRandom(game); } - targetPlayer.discard(card, source, game); + targetPlayer.discard(card, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/ThornbowArcher.java b/Mage.Sets/src/mage/cards/t/ThornbowArcher.java index 3c328a6e80f..677f790bb74 100644 --- a/Mage.Sets/src/mage/cards/t/ThornbowArcher.java +++ b/Mage.Sets/src/mage/cards/t/ThornbowArcher.java @@ -72,7 +72,7 @@ class ThornbowArcherEffect extends OneShotEffect { Player opponent = game.getPlayer(opponentId); if (opponent != null) { if (game.getBattlefield().countAll(filter, opponentId, game) == 0) { - opponent.loseLife(1, game, false); + opponent.loseLife(1, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/t/ThoughtDissector.java b/Mage.Sets/src/mage/cards/t/ThoughtDissector.java index d57da0a9b60..d571ab4c084 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtDissector.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtDissector.java @@ -94,7 +94,7 @@ class ThoughtDissectorEffect extends OneShotEffect { controller.moveCards(artifact, Zone.BATTLEFIELD, source, game); Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); if (sourcePermanent != null) { - sourcePermanent.sacrifice(source.getSourceId(), game); + sourcePermanent.sacrifice(source, game); } } targetOpponent.moveCards(nonArtifacts, Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java index f20363f2bba..bdaca5c4f98 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java @@ -79,7 +79,7 @@ class ThoughtGorgerEffectEnters extends OneShotEffect { )) { return false; } - player.discard(player.getHand(), source, game); + player.discard(player.getHand(), false, source, game); return true; } } @@ -106,7 +106,7 @@ class ThoughtGorgerEffectLeaves extends OneShotEffect { Permanent thoughtGorgerLastState = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); int numberCounters = thoughtGorgerLastState.getCounters(game).getCount(CounterType.P1P1); if (player != null) { - player.drawCards(numberCounters, source.getSourceId(), game); + player.drawCards(numberCounters, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/t/ThoughtHemorrhage.java b/Mage.Sets/src/mage/cards/t/ThoughtHemorrhage.java index 7c10810ef06..2b09722212e 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtHemorrhage.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtHemorrhage.java @@ -91,7 +91,7 @@ class ThoughtHemorrhageEffect extends OneShotEffect { } } if (cardsFound > 0) { - targetPlayer.damage(3 * cardsFound, source.getSourceId(), game); + targetPlayer.damage(3 * cardsFound, source.getSourceId(), source, game); } // Exile all cards with the same name // Building a card filter with the name diff --git a/Mage.Sets/src/mage/cards/t/ThoughtLash.java b/Mage.Sets/src/mage/cards/t/ThoughtLash.java index 46663adb7c5..d8368622148 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtLash.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtLash.java @@ -68,7 +68,7 @@ class ThoughtLashTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DIDNT_PAY_CUMULATIVE_UPKEEP; + return event.getType() == GameEvent.EventType.DIDNT_PAY_CUMULATIVE_UPKEEP; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java index aa76dd4462e..6fff55e6147 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java @@ -88,7 +88,7 @@ class ThoughtPrisonImprintEffect extends OneShotEffect { for (UUID targetId : targets) { Card card = targetPlayer.getHand().get(targetId, game); if (card != null) { - card.moveToExile(source.getSourceId(), "Thought Prison", source.getSourceId(), game); + card.moveToExile(source.getSourceId(), "Thought Prison", source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); @@ -127,7 +127,7 @@ class ThoughtPrisonTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -196,7 +196,7 @@ class ThoughtPrisonDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(2, source.getSourceId(), game); + targetPlayer.damage(2, source.getSourceId(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/t/ThoughtReflection.java b/Mage.Sets/src/mage/cards/t/ThoughtReflection.java index 591cab79cac..9377b62a67c 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtReflection.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtReflection.java @@ -14,6 +14,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; +import mage.util.CardUtil; /** * @@ -75,7 +76,7 @@ class ThoughtReflectionReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player you = game.getPlayer(event.getPlayerId()); if (you != null) { - you.drawCards(2, event.getSourceId(), game, event.getAppliedEffects()); + you.drawCards(2, source, game, event); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/ThoughtsOfRuin.java b/Mage.Sets/src/mage/cards/t/ThoughtsOfRuin.java index d1e1b5c6841..b96b29e8093 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtsOfRuin.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtsOfRuin.java @@ -92,7 +92,7 @@ class ThoughtsOfRuinEffect extends OneShotEffect { } // sacrifice all lands for (Permanent permanent :permanentsToSacrifice) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/ThoughtweftGambit.java b/Mage.Sets/src/mage/cards/t/ThoughtweftGambit.java index 3a5f3994946..132bb0eef5a 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtweftGambit.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtweftGambit.java @@ -59,7 +59,7 @@ class ThoughtweftGambitEffect extends OneShotEffect { if (opponents != null) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (opponents.contains(creature.getControllerId())) { - creature.tap(game); + creature.tap(source, game); } } passed = true; diff --git a/Mage.Sets/src/mage/cards/t/ThranFoundry.java b/Mage.Sets/src/mage/cards/t/ThranFoundry.java index 57c87d29f81..b55e46d4008 100644 --- a/Mage.Sets/src/mage/cards/t/ThranFoundry.java +++ b/Mage.Sets/src/mage/cards/t/ThranFoundry.java @@ -66,7 +66,7 @@ class ThranFoundryEffect extends OneShotEffect { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { for (Card card: player.getGraveyard().getCards(game)) { - player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + player.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/cards/t/ThranTome.java b/Mage.Sets/src/mage/cards/t/ThranTome.java index d67e5bd5e7c..e1ebf6adf11 100644 --- a/Mage.Sets/src/mage/cards/t/ThranTome.java +++ b/Mage.Sets/src/mage/cards/t/ThranTome.java @@ -107,7 +107,7 @@ class ThranTomeEffect extends OneShotEffect { } // draw 2 - controller.drawCards(2, source.getSourceId(), game); + controller.drawCards(2, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/ThrashingMudspawn.java b/Mage.Sets/src/mage/cards/t/ThrashingMudspawn.java index f27444fb356..715c2874906 100644 --- a/Mage.Sets/src/mage/cards/t/ThrashingMudspawn.java +++ b/Mage.Sets/src/mage/cards/t/ThrashingMudspawn.java @@ -70,7 +70,7 @@ class ThrashingMudspawnEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java b/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java index b0aa2d13bd4..c25d3e425d9 100644 --- a/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java +++ b/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java @@ -84,7 +84,7 @@ class ThrasiosTritonHeroEffect extends OneShotEffect { if (card.isLand()) { return controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); } - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/Thraximundar.java b/Mage.Sets/src/mage/cards/t/Thraximundar.java index c1441c014cd..dd9c3b5d554 100644 --- a/Mage.Sets/src/mage/cards/t/Thraximundar.java +++ b/Mage.Sets/src/mage/cards/t/Thraximundar.java @@ -114,7 +114,7 @@ class PlayerSacrificesCreatureTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ThroatSlitter.java b/Mage.Sets/src/mage/cards/t/ThroatSlitter.java index 9bf92f10184..79c0ddc0fb3 100644 --- a/Mage.Sets/src/mage/cards/t/ThroatSlitter.java +++ b/Mage.Sets/src/mage/cards/t/ThroatSlitter.java @@ -71,7 +71,7 @@ class ThroatSlitterTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ThroneOfBone.java b/Mage.Sets/src/mage/cards/t/ThroneOfBone.java index 048fe97eef4..3841d039e3a 100644 --- a/Mage.Sets/src/mage/cards/t/ThroneOfBone.java +++ b/Mage.Sets/src/mage/cards/t/ThroneOfBone.java @@ -56,7 +56,7 @@ class ThroneOfBoneAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ThroneOfEmpires.java b/Mage.Sets/src/mage/cards/t/ThroneOfEmpires.java index d0d28d69604..6e9815acdee 100644 --- a/Mage.Sets/src/mage/cards/t/ThroneOfEmpires.java +++ b/Mage.Sets/src/mage/cards/t/ThroneOfEmpires.java @@ -66,7 +66,7 @@ class ThroneOfEmpiresEffect extends OneShotEffect { } Token soldier = new SoldierToken(); int count = scepter && crown ? 5 : 1; - soldier.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId()); + soldier.putOntoBattlefield(count, game, source, source.getControllerId()); return false; } diff --git a/Mage.Sets/src/mage/cards/t/ThrullSurgeon.java b/Mage.Sets/src/mage/cards/t/ThrullSurgeon.java index e89f565b3e5..6a038fbc3ba 100644 --- a/Mage.Sets/src/mage/cards/t/ThrullSurgeon.java +++ b/Mage.Sets/src/mage/cards/t/ThrullSurgeon.java @@ -72,7 +72,7 @@ class ThrullSurgeonEffect extends OneShotEffect { target.setNotTarget(true); if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); - return targetPlayer.discard(card, source, game); + return targetPlayer.discard(card, false, source, game); } diff --git a/Mage.Sets/src/mage/cards/t/ThunderbreakRegent.java b/Mage.Sets/src/mage/cards/t/ThunderbreakRegent.java index 91d692f3b84..248428bc6f1 100644 --- a/Mage.Sets/src/mage/cards/t/ThunderbreakRegent.java +++ b/Mage.Sets/src/mage/cards/t/ThunderbreakRegent.java @@ -71,7 +71,7 @@ class ThunderbreakRegentTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ThundermawHellkite.java b/Mage.Sets/src/mage/cards/t/ThundermawHellkite.java index 9664c1a2984..a1bcfca3240 100644 --- a/Mage.Sets/src/mage/cards/t/ThundermawHellkite.java +++ b/Mage.Sets/src/mage/cards/t/ThundermawHellkite.java @@ -85,7 +85,7 @@ class TapAllEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.tap(game); + permanent.tap(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/ThwartTheGrave.java b/Mage.Sets/src/mage/cards/t/ThwartTheGrave.java index 81f3ec1b0c2..f3e0221f613 100644 --- a/Mage.Sets/src/mage/cards/t/ThwartTheGrave.java +++ b/Mage.Sets/src/mage/cards/t/ThwartTheGrave.java @@ -67,8 +67,8 @@ class ThwartTheGraveTarget extends TargetCardInYourGraveyard { } @Override - public Set possibleTargets(UUID sourceId, UUID playerId, Game game) { - Set possibleTargets = super.possibleTargets(sourceId, playerId, game); + public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { + Set possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); if (!this.getTargets().isEmpty()) { possibleTargets.removeIf(uuid -> { Card card = game.getCard(uuid); diff --git a/Mage.Sets/src/mage/cards/t/TianaShipsCaretaker.java b/Mage.Sets/src/mage/cards/t/TianaShipsCaretaker.java index bd76d2eefc7..d5d8e651ae9 100644 --- a/Mage.Sets/src/mage/cards/t/TianaShipsCaretaker.java +++ b/Mage.Sets/src/mage/cards/t/TianaShipsCaretaker.java @@ -78,7 +78,7 @@ class TianaShipsCaretakerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java b/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java index 4817151c4a2..2ee7ca30176 100644 --- a/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java +++ b/Mage.Sets/src/mage/cards/t/TibaltTheFiendBlooded.java @@ -86,9 +86,9 @@ class TibaltTheFiendBloodedFirstEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); Card card = player.getHand().getRandom(game); - player.discard(card, source, game); + player.discard(card, false, source, game); return true; } return false; @@ -152,7 +152,7 @@ class TibaltTheFiendBloodedControlEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null && controllerId != null) { - return permanent.changeControllerId(controllerId, game); + return permanent.changeControllerId(controllerId, game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/t/TidalFlats.java b/Mage.Sets/src/mage/cards/t/TidalFlats.java index 7bdc8a5767a..d98d3133115 100644 --- a/Mage.Sets/src/mage/cards/t/TidalFlats.java +++ b/Mage.Sets/src/mage/cards/t/TidalFlats.java @@ -89,7 +89,7 @@ class TidalFlatsEffect extends OneShotEffect { cost.clearPaid(); String message = "Pay " + cost.getText() + " for " + permanent.getLogName() + "? If you don't, creatures " + controller.getLogName() + " controls blocking it gain first strike until end of turn."; if (player.chooseUse(Outcome.Benefit, message, source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(player.getLogName() + " paid " + cost.getText() + " for " + permanent.getLogName()); } else { game.informPlayers(player.getLogName() + " didn't pay " + cost.getText() + " for " + permanent.getLogName()); diff --git a/Mage.Sets/src/mage/cards/t/TidalInfluence.java b/Mage.Sets/src/mage/cards/t/TidalInfluence.java index 521ea3374f7..cdb1f64ed2a 100644 --- a/Mage.Sets/src/mage/cards/t/TidalInfluence.java +++ b/Mage.Sets/src/mage/cards/t/TidalInfluence.java @@ -96,12 +96,12 @@ class TidalInfluenceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return !game.getBattlefield().contains(filter, 1, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/cards/t/TidalWave.java b/Mage.Sets/src/mage/cards/t/TidalWave.java index fa8941db2fc..b705069bb91 100644 --- a/Mage.Sets/src/mage/cards/t/TidalWave.java +++ b/Mage.Sets/src/mage/cards/t/TidalWave.java @@ -58,7 +58,7 @@ class TidalWaveEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Token token = new TidalWaveWallToken(); - if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) { + if (token.putOntoBattlefield(1, game, source, source.getControllerId())) { for (UUID tokenId : token.getLastAddedTokenIds()) { Permanent tokenPermanent = game.getPermanent(tokenId); if (tokenPermanent != null) { diff --git a/Mage.Sets/src/mage/cards/t/TideOfWar.java b/Mage.Sets/src/mage/cards/t/TideOfWar.java index 6c48d0af6bf..47742d45710 100644 --- a/Mage.Sets/src/mage/cards/t/TideOfWar.java +++ b/Mage.Sets/src/mage/cards/t/TideOfWar.java @@ -56,7 +56,7 @@ class BlocksTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_BLOCKERS; + return event.getType() == GameEvent.EventType.DECLARED_BLOCKERS; } @Override @@ -121,7 +121,7 @@ class TideOfWarEffect extends OneShotEffect { for(UUID creatureId: toSacrifice) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { - creature.sacrifice(source.getSourceId(), game); + creature.sacrifice(source, game); Player player = game.getPlayer(creature.getControllerId()); if (player != null) { game.informPlayers(player.getLogName() + " sacrifices " + creature.getName()); diff --git a/Mage.Sets/src/mage/cards/t/TidebinderMage.java b/Mage.Sets/src/mage/cards/t/TidebinderMage.java index fd43556096a..ba227ca3532 100644 --- a/Mage.Sets/src/mage/cards/t/TidebinderMage.java +++ b/Mage.Sets/src/mage/cards/t/TidebinderMage.java @@ -134,7 +134,9 @@ class TidebinderMageWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST_CONTROL && event.getPlayerId().equals(controllerId) && event.getTargetId().equals(sourceId)) { + if (event.getType() == GameEvent.EventType.LOST_CONTROL + && event.getPlayerId().equals(controllerId) + && event.getTargetId().equals(sourceId)) { condition = true; game.replaceEvent(event); return; diff --git a/Mage.Sets/src/mage/cards/t/TilonallisSummoner.java b/Mage.Sets/src/mage/cards/t/TilonallisSummoner.java index 4da45717a29..fc3826e2cbb 100644 --- a/Mage.Sets/src/mage/cards/t/TilonallisSummoner.java +++ b/Mage.Sets/src/mage/cards/t/TilonallisSummoner.java @@ -80,7 +80,7 @@ class TilonallisSummonerEffect extends OneShotEffect { if (controller.chooseUse(outcome, "Pay " + cost.getText() + "? If you do, you create X 1/1 red Elemental creature tokens that are tapped and attacking.", source, game)) { int costX = controller.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { controller.resetStoredBookmark(game); // otherwise you can undo the payment CreateTokenEffect effect = new CreateTokenEffect(new TilonallisSummonerElementalToken(), costX, true, true); effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/t/TimeOfIce.java b/Mage.Sets/src/mage/cards/t/TimeOfIce.java index 8307685b694..3699a1ebcfd 100644 --- a/Mage.Sets/src/mage/cards/t/TimeOfIce.java +++ b/Mage.Sets/src/mage/cards/t/TimeOfIce.java @@ -90,7 +90,9 @@ class TimeOfIceEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UNTAP || event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL; + return event.getType() == GameEvent.EventType.UNTAP + || event.getType() == GameEvent.EventType.ZONE_CHANGE + || event.getType() == GameEvent.EventType.LOST_CONTROL; } @Override @@ -146,7 +148,9 @@ class TimeOfIceWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST_CONTROL && event.getPlayerId().equals(controllerId) && event.getTargetId().equals(sourceId)) { + if (event.getType() == GameEvent.EventType.LOST_CONTROL + && event.getPlayerId().equals(controllerId) + && event.getTargetId().equals(sourceId)) { condition = true; game.replaceEvent(event); return; diff --git a/Mage.Sets/src/mage/cards/t/TimeOut.java b/Mage.Sets/src/mage/cards/t/TimeOut.java index 430b5556f69..69fcb8068e4 100644 --- a/Mage.Sets/src/mage/cards/t/TimeOut.java +++ b/Mage.Sets/src/mage/cards/t/TimeOut.java @@ -72,7 +72,7 @@ class TimeOutEffect extends OneShotEffect { if (owner == null) { return false; } - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); controller.putCardOnTopXOfLibrary(permanent, game, source, amount, true); return true; } diff --git a/Mage.Sets/src/mage/cards/t/TimeToFeed.java b/Mage.Sets/src/mage/cards/t/TimeToFeed.java index cccd3115044..a1fb2a52bec 100644 --- a/Mage.Sets/src/mage/cards/t/TimeToFeed.java +++ b/Mage.Sets/src/mage/cards/t/TimeToFeed.java @@ -124,7 +124,7 @@ class TimeToFeedDiesTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TimeVault.java b/Mage.Sets/src/mage/cards/t/TimeVault.java index 7586d9f3a89..16402e49b9d 100644 --- a/Mage.Sets/src/mage/cards/t/TimeVault.java +++ b/Mage.Sets/src/mage/cards/t/TimeVault.java @@ -73,7 +73,7 @@ class TimeVaultReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.PLAY_TURN; + return event.getType() == GameEvent.EventType.PLAY_TURN; } @Override diff --git a/Mage.Sets/src/mage/cards/t/Timebender.java b/Mage.Sets/src/mage/cards/t/Timebender.java index ec61a8517d4..f886a1d6676 100644 --- a/Mage.Sets/src/mage/cards/t/Timebender.java +++ b/Mage.Sets/src/mage/cards/t/Timebender.java @@ -92,7 +92,7 @@ class TimebenderEffect extends OneShotEffect { if (addCounters) { permanent.addCounters(CounterType.TIME.createInstance(2), source, game); } else { - permanent.removeCounters(CounterType.TIME.getName(), 2, game); + permanent.removeCounters(CounterType.TIME.getName(), 2, source, game); } return true; } @@ -101,7 +101,7 @@ class TimebenderEffect extends OneShotEffect { if (addCounters) { card.addCounters(CounterType.TIME.createInstance(2), source, game); } else { - card.removeCounters(CounterType.TIME.getName(), 2, game); + card.removeCounters(CounterType.TIME.getName(), 2, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/Timecrafting.java b/Mage.Sets/src/mage/cards/t/Timecrafting.java index 6c8c2fee0cd..78f230d0b5a 100644 --- a/Mage.Sets/src/mage/cards/t/Timecrafting.java +++ b/Mage.Sets/src/mage/cards/t/Timecrafting.java @@ -75,12 +75,12 @@ class TimecraftingRemoveEffect extends OneShotEffect { int xValue = source.getManaCostsToPay().getX(); Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.removeCounters(CounterType.TIME.createInstance(xValue), game); + permanent.removeCounters(CounterType.TIME.createInstance(xValue), source, game); } else { Card card = game.getExile().getCard(this.getTargetPointer().getFirst(game, source), game); if (card != null) { - card.removeCounters(CounterType.TIME.createInstance(xValue), game); + card.removeCounters(CounterType.TIME.createInstance(xValue), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TinybonesTrinketThief.java b/Mage.Sets/src/mage/cards/t/TinybonesTrinketThief.java index dd67bdf538f..106b0dea569 100644 --- a/Mage.Sets/src/mage/cards/t/TinybonesTrinketThief.java +++ b/Mage.Sets/src/mage/cards/t/TinybonesTrinketThief.java @@ -118,7 +118,7 @@ class TinybonesTrinketThiefEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null && player.getHand().isEmpty()) { - player.loseLife(10, game, false); + player.loseLife(10, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TirelessTracker.java b/Mage.Sets/src/mage/cards/t/TirelessTracker.java index 299a5a4f2ed..d86572d37f8 100644 --- a/Mage.Sets/src/mage/cards/t/TirelessTracker.java +++ b/Mage.Sets/src/mage/cards/t/TirelessTracker.java @@ -73,7 +73,7 @@ class TirelessTrackerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TitanHunter.java b/Mage.Sets/src/mage/cards/t/TitanHunter.java index 6202dd76585..29be00c4440 100644 --- a/Mage.Sets/src/mage/cards/t/TitanHunter.java +++ b/Mage.Sets/src/mage/cards/t/TitanHunter.java @@ -82,7 +82,7 @@ class TitanHunterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { return game.damagePlayerOrPlaneswalker( game.getActivePlayerId(), 4, source.getSourceId(), - game, false, true + source, game, false, true ) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/t/TitaniasChosen.java b/Mage.Sets/src/mage/cards/t/TitaniasChosen.java index 3f4e0f4e309..5c6455e7f3e 100644 --- a/Mage.Sets/src/mage/cards/t/TitaniasChosen.java +++ b/Mage.Sets/src/mage/cards/t/TitaniasChosen.java @@ -63,7 +63,7 @@ class TitaniasChosenAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TobiasBeckett.java b/Mage.Sets/src/mage/cards/t/TobiasBeckett.java index 26dffb17d0b..2a21c0c0b36 100644 --- a/Mage.Sets/src/mage/cards/t/TobiasBeckett.java +++ b/Mage.Sets/src/mage/cards/t/TobiasBeckett.java @@ -78,7 +78,7 @@ class TobiasBeckettEffect extends OneShotEffect { Card card = opponent.getLibrary().getFromTop(game); if (card != null && sourceObject != null) { // move card to exile - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.LIBRARY, true); // Add effects only if the card has a spellAbility (e.g. not for lands). if (card.getSpellAbility() != null) { // allow to cast the card diff --git a/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java b/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java index 7935690413d..824739184ff 100644 --- a/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java +++ b/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java @@ -65,7 +65,7 @@ public final class ToilsOfNightAndDay extends CardImpl { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { if (player.chooseUse(Outcome.Tap, "Tap " + permanent.getName() + '?', source, game)) { - permanent.tap(game); + permanent.tap(source, game); } else if (player.chooseUse(Outcome.Untap, "Untap " + permanent.getName() + '?', source, game)) { permanent.untap(game); } diff --git a/Mage.Sets/src/mage/cards/t/TolarianEntrancer.java b/Mage.Sets/src/mage/cards/t/TolarianEntrancer.java index 90db5a66f35..d2ced85c1ba 100644 --- a/Mage.Sets/src/mage/cards/t/TolarianEntrancer.java +++ b/Mage.Sets/src/mage/cards/t/TolarianEntrancer.java @@ -59,7 +59,7 @@ public final class TolarianEntrancer extends CardImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_COMBAT_STEP_POST; + return event.getType() == GameEvent.EventType.END_COMBAT_STEP_POST; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TombOfUrami.java b/Mage.Sets/src/mage/cards/t/TombOfUrami.java index 68de60de8ce..c76ea619ad2 100644 --- a/Mage.Sets/src/mage/cards/t/TombOfUrami.java +++ b/Mage.Sets/src/mage/cards/t/TombOfUrami.java @@ -63,17 +63,17 @@ class SacrificeAllLandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), ability.getControllerId(), game)) { - paid |= permanent.sacrifice(sourceId, game); + paid |= permanent.sacrifice(source, game); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), ability.getControllerId(), game)) { - if (!game.getPlayer(controllerId).canPaySacrificeCost(permanent, sourceId, controllerId, game)) { + if (!game.getPlayer(controllerId).canPaySacrificeCost(permanent, source, controllerId, game)) { return false; } } diff --git a/Mage.Sets/src/mage/cards/t/Tombfire.java b/Mage.Sets/src/mage/cards/t/Tombfire.java index f6c1c417f49..463ee3517d0 100644 --- a/Mage.Sets/src/mage/cards/t/Tombfire.java +++ b/Mage.Sets/src/mage/cards/t/Tombfire.java @@ -64,7 +64,7 @@ class TombfireEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { for (Card card : targetPlayer.getGraveyard().getCards(filter, game)) { - card.moveToExile(null, "", source.getSourceId(), game); + card.moveToExile(null, "", source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TombstoneStairwell.java b/Mage.Sets/src/mage/cards/t/TombstoneStairwell.java index 6442bbcbb4d..723026300f0 100644 --- a/Mage.Sets/src/mage/cards/t/TombstoneStairwell.java +++ b/Mage.Sets/src/mage/cards/t/TombstoneStairwell.java @@ -93,7 +93,7 @@ class TombstoneStairwellCreateTokenEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); int creatureCardsInGraveyard = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, source.getControllerId(), source.getSourceId(), game); - token.putOntoBattlefield(creatureCardsInGraveyard, game, source.getSourceId(), playerId); + token.putOntoBattlefield(creatureCardsInGraveyard, game, source, playerId); for (UUID tokenId : token.getLastAddedTokenIds()) { tokensCreated.add(tokenId); } @@ -117,13 +117,13 @@ class TombstoneStairwellTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE - || event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE + || event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.END_TURN_STEP_PRE) { + if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) { Permanent permanent = game.getPermanentOrLKIBattlefield(sourceId); if (permanent != null) { for (Effect effect : this.getEffects()) { @@ -136,7 +136,7 @@ class TombstoneStairwellTriggeredAbility extends TriggeredAbilityImpl { } return true; } - } else if (event.getType() == EventType.ZONE_CHANGE) { + } else if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { if (event.getTargetId().equals(this.getSourceId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD) { @@ -191,7 +191,7 @@ class TombstoneStairwellDestroyEffect extends OneShotEffect { for (UUID tokenId : tokensCreated) { Permanent token = game.getPermanent(tokenId); if (token != null) { - token.destroy(source.getSourceId(), game, true); + token.destroy(source, game, true); } } } diff --git a/Mage.Sets/src/mage/cards/t/ToothCollector.java b/Mage.Sets/src/mage/cards/t/ToothCollector.java index aec6b677301..cdcd6d6a317 100644 --- a/Mage.Sets/src/mage/cards/t/ToothCollector.java +++ b/Mage.Sets/src/mage/cards/t/ToothCollector.java @@ -86,7 +86,7 @@ class ToothCollectorAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/ToppleTheStatue.java b/Mage.Sets/src/mage/cards/t/ToppleTheStatue.java index f00e5f258d0..eacfaa360d2 100644 --- a/Mage.Sets/src/mage/cards/t/ToppleTheStatue.java +++ b/Mage.Sets/src/mage/cards/t/ToppleTheStatue.java @@ -59,9 +59,9 @@ class ToppleTheStatueEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.tap(game); + permanent.tap(source, game); if (permanent.isArtifact()) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return new DrawCardSourceControllerEffect(1).apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/t/Topplegeist.java b/Mage.Sets/src/mage/cards/t/Topplegeist.java index 8cd57d82e88..253976443e7 100644 --- a/Mage.Sets/src/mage/cards/t/Topplegeist.java +++ b/Mage.Sets/src/mage/cards/t/Topplegeist.java @@ -88,7 +88,7 @@ class TopplegeistAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TormentOfHailfire.java b/Mage.Sets/src/mage/cards/t/TormentOfHailfire.java index 5485c4e7f36..fea94e645c8 100644 --- a/Mage.Sets/src/mage/cards/t/TormentOfHailfire.java +++ b/Mage.Sets/src/mage/cards/t/TormentOfHailfire.java @@ -72,7 +72,7 @@ class TormentOfHailfireEffect extends OneShotEffect { if (opponent.choose(outcome, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { continue; } } @@ -80,10 +80,10 @@ class TormentOfHailfireEffect extends OneShotEffect { } if (!opponent.getHand().isEmpty() && opponent.chooseUse(outcome, "Discard a card? (Iteration " + i + " of " + repeat + ")", "Otherwise you lose 3 life.", "Discard", "Lose 3 life", source, game)) { - opponent.discardOne(false, source, game); + opponent.discardOne(false, false, source, game); continue; } - opponent.loseLife(3, game, false); + opponent.loseLife(3, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/t/TormentOfScarabs.java b/Mage.Sets/src/mage/cards/t/TormentOfScarabs.java index 7d9eeec3b13..11cf823f746 100644 --- a/Mage.Sets/src/mage/cards/t/TormentOfScarabs.java +++ b/Mage.Sets/src/mage/cards/t/TormentOfScarabs.java @@ -73,7 +73,7 @@ class TormentOfScarabsAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; } @Override @@ -125,17 +125,17 @@ class TormentOfScarabsEffect extends OneShotEffect { if (enchantedPlayer.choose(outcome, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } } if (!enchantedPlayer.getHand().isEmpty() && enchantedPlayer.chooseUse(outcome, "Discard a card?", "Otherwise you lose 3 life.", "Discard", "Lose 3 life", source, game)) { - enchantedPlayer.discardOne(false, source, game); + enchantedPlayer.discardOne(false, false, source, game); return true; } - enchantedPlayer.loseLife(3, game, false); + enchantedPlayer.loseLife(3, game, source, false); return true; } diff --git a/Mage.Sets/src/mage/cards/t/TormentOfVenom.java b/Mage.Sets/src/mage/cards/t/TormentOfVenom.java index 060e17038df..096f35337ea 100644 --- a/Mage.Sets/src/mage/cards/t/TormentOfVenom.java +++ b/Mage.Sets/src/mage/cards/t/TormentOfVenom.java @@ -79,17 +79,17 @@ class TormentOfVenomEffect extends OneShotEffect { if (controllingPlayer.choose(outcome, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } } if (!controllingPlayer.getHand().isEmpty() && controllingPlayer.chooseUse(outcome, "Discard a card?", "Otherwise you lose 3 life.", "Discard", "Lose 3 life", source, game)) { - controllingPlayer.discardOne(false, source, game); + controllingPlayer.discardOne(false, false, source, game); return true; } - controllingPlayer.loseLife(3, game, false); + controllingPlayer.loseLife(3, game, source, false); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/TormentedHero.java b/Mage.Sets/src/mage/cards/t/TormentedHero.java index eb26ac8625d..5051d0f4d25 100644 --- a/Mage.Sets/src/mage/cards/t/TormentedHero.java +++ b/Mage.Sets/src/mage/cards/t/TormentedHero.java @@ -59,7 +59,7 @@ class EachOpponentLosesYouGainSumLifeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int lostLife = 0; for (UUID opponentId : game.getOpponents(source.getControllerId())) { - lostLife += game.getPlayer(opponentId).loseLife(1, game, false); + lostLife += game.getPlayer(opponentId).loseLife(1, game, source, false); } game.getPlayer(source.getControllerId()).gainLife(lostLife, game, source); return true; diff --git a/Mage.Sets/src/mage/cards/t/TormentedThoughts.java b/Mage.Sets/src/mage/cards/t/TormentedThoughts.java index 004d9c4e58e..59e7936a7f7 100644 --- a/Mage.Sets/src/mage/cards/t/TormentedThoughts.java +++ b/Mage.Sets/src/mage/cards/t/TormentedThoughts.java @@ -77,7 +77,7 @@ class TormentedThoughtsDiscardEffect extends OneShotEffect { } } if (power > 0) { - targetPlayer.discard(power, false, source, game); + targetPlayer.discard(power, false, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java b/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java index 4f15357f42d..874104ed0ff 100644 --- a/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java +++ b/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java @@ -121,12 +121,7 @@ class TorrentialGearhulkReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - Card card = game.getCard(this.cardId); - if (controller != null && card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); - return true; - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } diff --git a/Mage.Sets/src/mage/cards/t/TortureChamber.java b/Mage.Sets/src/mage/cards/t/TortureChamber.java index 18838fb37c4..46dd4d459a0 100644 --- a/Mage.Sets/src/mage/cards/t/TortureChamber.java +++ b/Mage.Sets/src/mage/cards/t/TortureChamber.java @@ -81,7 +81,7 @@ class TortureChamberEffect1 extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { int painCounters = permanent.getCounters(game).getCount(CounterType.PAIN); - player.damage(painCounters, source.getSourceId(), game); + player.damage(painCounters, source.getSourceId(), source, game); return true; } return false; @@ -114,7 +114,7 @@ class TortureChamberEffect2 extends OneShotEffect { } Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.damage(countersRemoved, source.getSourceId(), game, false, true); + permanent.damage(countersRemoved, source.getSourceId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/t/ToshiroUmezawa.java b/Mage.Sets/src/mage/cards/t/ToshiroUmezawa.java index 796dda650dc..641eebd353b 100644 --- a/Mage.Sets/src/mage/cards/t/ToshiroUmezawa.java +++ b/Mage.Sets/src/mage/cards/t/ToshiroUmezawa.java @@ -140,7 +140,7 @@ class ToshiroUmezawaReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TotalWar.java b/Mage.Sets/src/mage/cards/t/TotalWar.java index ab124ae9b9c..ea5209bb5ae 100644 --- a/Mage.Sets/src/mage/cards/t/TotalWar.java +++ b/Mage.Sets/src/mage/cards/t/TotalWar.java @@ -59,7 +59,7 @@ class TotalWarTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DECLARED_ATTACKERS; + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; } @Override @@ -117,7 +117,7 @@ class TotalWarDestroyEffect extends OneShotEffect { continue; } // Destroy the rest. - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TouchOfMoonglove.java b/Mage.Sets/src/mage/cards/t/TouchOfMoonglove.java index f449d02d5d1..c1ecaa451e7 100644 --- a/Mage.Sets/src/mage/cards/t/TouchOfMoonglove.java +++ b/Mage.Sets/src/mage/cards/t/TouchOfMoonglove.java @@ -98,7 +98,7 @@ class TouchOfMoongloveDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TourachsChant.java b/Mage.Sets/src/mage/cards/t/TourachsChant.java index a8eb5d7cbd2..8cc85006737 100644 --- a/Mage.Sets/src/mage/cards/t/TourachsChant.java +++ b/Mage.Sets/src/mage/cards/t/TourachsChant.java @@ -83,7 +83,7 @@ class TourachsChantEffect extends OneShotEffect { } } if (!paid) { - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TourachsGate.java b/Mage.Sets/src/mage/cards/t/TourachsGate.java index 9964344acff..7e711acc3ef 100644 --- a/Mage.Sets/src/mage/cards/t/TourachsGate.java +++ b/Mage.Sets/src/mage/cards/t/TourachsGate.java @@ -116,12 +116,12 @@ class TourachsGateUpkeepEffect extends OneShotEffect { if (permanent != null) { int amount = permanent.getCounters(game).getCount(CounterType.TIME); if (amount > 0) { - permanent.removeCounters(CounterType.TIME.createInstance(), game); + permanent.removeCounters(CounterType.TIME.createInstance(), source, game); } // is supposed to function similar to Vanishing amount = permanent.getCounters(game).getCount(CounterType.TIME); if (amount == 0) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TovolarsMagehunter.java b/Mage.Sets/src/mage/cards/t/TovolarsMagehunter.java index 863c0c2b992..166f5a22036 100644 --- a/Mage.Sets/src/mage/cards/t/TovolarsMagehunter.java +++ b/Mage.Sets/src/mage/cards/t/TovolarsMagehunter.java @@ -76,7 +76,7 @@ class TovolarsMagehunterTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TowerAbove.java b/Mage.Sets/src/mage/cards/t/TowerAbove.java index df1cac6c35e..e07d8983db5 100644 --- a/Mage.Sets/src/mage/cards/t/TowerAbove.java +++ b/Mage.Sets/src/mage/cards/t/TowerAbove.java @@ -103,7 +103,7 @@ class TowerAboveTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java b/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java index 361826e3480..cbf82496d2b 100644 --- a/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java +++ b/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java @@ -73,13 +73,17 @@ class TraceOfAbundanceTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + return enchantedLand != null && enchantedLand.isLand(); + } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TrackDown.java b/Mage.Sets/src/mage/cards/t/TrackDown.java index 08506dd9d01..5f4287404d9 100644 --- a/Mage.Sets/src/mage/cards/t/TrackDown.java +++ b/Mage.Sets/src/mage/cards/t/TrackDown.java @@ -76,7 +76,7 @@ class TrackDownEffect extends OneShotEffect { cards.add(card); controller.revealCards(sourceObject.getName(), cards, game); if (card.isLand() || card.isCreature()) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/t/TragicArrogance.java b/Mage.Sets/src/mage/cards/t/TragicArrogance.java index 9e8f0dc4c7e..499158b8b7d 100644 --- a/Mage.Sets/src/mage/cards/t/TragicArrogance.java +++ b/Mage.Sets/src/mage/cards/t/TragicArrogance.java @@ -128,7 +128,7 @@ class TragicArroganceffect extends OneShotEffect { if (player != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENTS_NON_LAND, playerId, game)) { if (!choosenPermanent.contains(permanent)) { - permanent.sacrifice(playerId, game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TragicLesson.java b/Mage.Sets/src/mage/cards/t/TragicLesson.java index babd1a1ff67..fcf3b8bfe4a 100644 --- a/Mage.Sets/src/mage/cards/t/TragicLesson.java +++ b/Mage.Sets/src/mage/cards/t/TragicLesson.java @@ -69,14 +69,14 @@ class TragicLessonEffect extends OneShotEffect { if (controller != null && controller.chooseUse(Outcome.Discard, "Do you want to return a land you control to its owner's hand? If you don't, you must discard 1 card", source, game)) { Cost cost = new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)); - if (cost.canPay(source, source.getSourceId(), controller.getId(), game)) { - if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { + if (cost.canPay(source, source, controller.getId(), game)) { + if (cost.pay(source, game, source, controller.getId(), false, null)) { return true; } } } if (controller != null) { - controller.discard(1, false, source, game); + controller.discard(1, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/t/TraitorsRoar.java b/Mage.Sets/src/mage/cards/t/TraitorsRoar.java index 1fe6b5de136..c6b9c630026 100644 --- a/Mage.Sets/src/mage/cards/t/TraitorsRoar.java +++ b/Mage.Sets/src/mage/cards/t/TraitorsRoar.java @@ -71,10 +71,10 @@ class TraitorsRoarEffect extends OneShotEffect { boolean applied = false; Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { - applied = targetCreature.tap(game); + applied = targetCreature.tap(source, game); Player controller = game.getPlayer(targetCreature.getControllerId()); if (controller != null) { - controller.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game); + controller.damage(targetCreature.getPower().getValue(), targetCreature.getId(), source, game); applied = true; } } diff --git a/Mage.Sets/src/mage/cards/t/Transcendence.java b/Mage.Sets/src/mage/cards/t/Transcendence.java index 204e8f160e6..a8dbd242009 100644 --- a/Mage.Sets/src/mage/cards/t/Transcendence.java +++ b/Mage.Sets/src/mage/cards/t/Transcendence.java @@ -97,7 +97,7 @@ class TranscendenceLoseLifeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST_LIFE; + return event.getType() == GameEvent.EventType.LOST_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java b/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java index f5c9671bd76..7137325ee0f 100644 --- a/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java +++ b/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java @@ -72,7 +72,7 @@ class TransmuteArtifactEffect extends SearchEffect { Permanent permanent = game.getPermanent(targetArtifact.getFirstTarget()); if (permanent != null) { convertedManaCost = permanent.getConvertedManaCost(); - sacrifice = permanent.sacrifice(source.getSourceId(), game); + sacrifice = permanent.sacrifice(source, game); } } else { return true; @@ -91,7 +91,7 @@ class TransmuteArtifactEffect extends SearchEffect { Cost cost = ManaUtil.createManaCost(card.getConvertedManaCost() - convertedManaCost, true); boolean payed = false; if (controller.chooseUse(Outcome.Benefit, "Do you want to pay " + cost.getText() + " to put it onto the battlefield?", source, game) - && cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + && cost.pay(source, game, source, source.getControllerId(), false)) { payed = true; } diff --git a/Mage.Sets/src/mage/cards/t/TrapfindersTrick.java b/Mage.Sets/src/mage/cards/t/TrapfindersTrick.java index 03c02e1b039..022bafdc9bb 100644 --- a/Mage.Sets/src/mage/cards/t/TrapfindersTrick.java +++ b/Mage.Sets/src/mage/cards/t/TrapfindersTrick.java @@ -67,7 +67,7 @@ class TrapfindersTrickEffect extends OneShotEffect { return false; } player.revealCards(source, player.getHand(), game); - player.discard(new CardsImpl(player.getHand().getCards(filter, game)), source, game); + player.discard(new CardsImpl(player.getHand().getCards(filter, game)), false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/TravelingPlague.java b/Mage.Sets/src/mage/cards/t/TravelingPlague.java index 9fd97761256..3711213d89f 100644 --- a/Mage.Sets/src/mage/cards/t/TravelingPlague.java +++ b/Mage.Sets/src/mage/cards/t/TravelingPlague.java @@ -135,10 +135,10 @@ class TravelingPlagueEffect extends OneShotEffect { target.setNotTarget(true); if (controllerOfEnchantedCreature.choose(Outcome.Detriment, target, source.getSourceId(), game)) { Permanent targetPermanent = game.getPermanent(target.getFirstTarget()); - if (!targetPermanent.cantBeAttachedBy(travelingPlague, game, false)) { + if (!targetPermanent.cantBeAttachedBy(travelingPlague, source, game, false)) { game.getState().setValue("attachTo:" + travelingPlague.getId(), targetPermanent); controllerOfEnchantedCreature.moveCards(travelingPlague, Zone.BATTLEFIELD, source, game); - return targetPermanent.addAttachment(travelingPlague.getId(), game); + return targetPermanent.addAttachment(travelingPlague.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TreacherousLink.java b/Mage.Sets/src/mage/cards/t/TreacherousLink.java index e7229df5682..3edc1598b23 100644 --- a/Mage.Sets/src/mage/cards/t/TreacherousLink.java +++ b/Mage.Sets/src/mage/cards/t/TreacherousLink.java @@ -89,7 +89,7 @@ class TreacherousLinkEffect extends ReplacementEffectImpl { if (controller == null) { return false; } - controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); + controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()); return true; } diff --git a/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java b/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java index 876e1d9be12..283ea510119 100644 --- a/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java +++ b/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java @@ -104,7 +104,7 @@ class TreacherousPitDwellerEffect extends ContinuousEffectImpl { Player targetOpponent = game.getPlayer(source.getFirstTarget()); if ((permanent instanceof Permanent) && targetOpponent != null) { - return ((Permanent) permanent).changeControllerId(targetOpponent.getId(), game); + return ((Permanent) permanent).changeControllerId(targetOpponent.getId(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/t/TreacherousTerrain.java b/Mage.Sets/src/mage/cards/t/TreacherousTerrain.java index ebaa6e2e0ed..f4b8d4f4c41 100644 --- a/Mage.Sets/src/mage/cards/t/TreacherousTerrain.java +++ b/Mage.Sets/src/mage/cards/t/TreacherousTerrain.java @@ -65,7 +65,7 @@ class TreacherousTerrainEffect extends OneShotEffect { } } if (amount > 0) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TreasureMap.java b/Mage.Sets/src/mage/cards/t/TreasureMap.java index b0abbf0a749..e74bc31e79d 100644 --- a/Mage.Sets/src/mage/cards/t/TreasureMap.java +++ b/Mage.Sets/src/mage/cards/t/TreasureMap.java @@ -78,7 +78,7 @@ class TreasureMapEffect extends OneShotEffect { permanent.addCounters(CounterType.LANDMARK.createInstance(), source, game); int counters = permanent.getCounters(game).getCount(CounterType.LANDMARK); if (counters > 2) { - permanent.removeCounters("landmark", counters, game); + permanent.removeCounters("landmark", counters, source, game); new TransformSourceEffect(true).apply(game, source); new CreateTokenEffect(new TreasureToken(), 3).apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/t/TreasureNabber.java b/Mage.Sets/src/mage/cards/t/TreasureNabber.java index 3b3edbb361e..a67d6e6c42a 100644 --- a/Mage.Sets/src/mage/cards/t/TreasureNabber.java +++ b/Mage.Sets/src/mage/cards/t/TreasureNabber.java @@ -56,8 +56,10 @@ class TreasureNabberAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA - && !game.inCheckPlayableState(); + if (game.inCheckPlayableState()) { + return false; + } + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override @@ -107,7 +109,7 @@ class TreasureNabberEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.changeControllerId(source.getControllerId(), game); + permanent.changeControllerId(source.getControllerId(), game, source); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/t/TreefolkMystic.java b/Mage.Sets/src/mage/cards/t/TreefolkMystic.java index e9a4807fc14..4b15d27b9e8 100644 --- a/Mage.Sets/src/mage/cards/t/TreefolkMystic.java +++ b/Mage.Sets/src/mage/cards/t/TreefolkMystic.java @@ -67,7 +67,7 @@ class TreefolkMysticEffect extends OneShotEffect { for (UUID uuid : attachments) { Permanent aura = game.getPermanent(uuid); if (aura != null && aura.hasSubtype(SubType.AURA, game)) { - aura.destroy(source.getSourceId(), game, false); + aura.destroy(source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/t/TrenchGorger.java b/Mage.Sets/src/mage/cards/t/TrenchGorger.java index 6b2b53ec04b..72ec79035fe 100644 --- a/Mage.Sets/src/mage/cards/t/TrenchGorger.java +++ b/Mage.Sets/src/mage/cards/t/TrenchGorger.java @@ -72,7 +72,7 @@ class TrenchGorgerEffect extends OneShotEffect { for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.LIBRARY, true); count++; } } diff --git a/Mage.Sets/src/mage/cards/t/TrespassersCurse.java b/Mage.Sets/src/mage/cards/t/TrespassersCurse.java index 7e84ea248e4..29929018753 100644 --- a/Mage.Sets/src/mage/cards/t/TrespassersCurse.java +++ b/Mage.Sets/src/mage/cards/t/TrespassersCurse.java @@ -117,7 +117,7 @@ class TrespassersCurseEffect extends OneShotEffect { Player controllerOfCreature = game.getPlayer(this.getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (controllerOfCreature != null && controller != null) { - controllerOfCreature.loseLife(1, game, false); + controllerOfCreature.loseLife(1, game, source, false); controller.gainLife(1, game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/t/TriadOfFates.java b/Mage.Sets/src/mage/cards/t/TriadOfFates.java index a905ca5d2ab..3c92f36043a 100644 --- a/Mage.Sets/src/mage/cards/t/TriadOfFates.java +++ b/Mage.Sets/src/mage/cards/t/TriadOfFates.java @@ -102,7 +102,7 @@ class DrawCardControllerTargetEffect extends OneShotEffect { if (creature != null) { Player controllerOfTarget = game.getPlayer(creature.getControllerId()); if (controllerOfTarget != null) { - controllerOfTarget.drawCards(2, source.getSourceId(), game); + controllerOfTarget.drawCards(2, source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/t/TributeToHunger.java b/Mage.Sets/src/mage/cards/t/TributeToHunger.java index 59be005951c..ff0b9971c7f 100644 --- a/Mage.Sets/src/mage/cards/t/TributeToHunger.java +++ b/Mage.Sets/src/mage/cards/t/TributeToHunger.java @@ -61,11 +61,11 @@ class TributeToHungerEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && opponent != null) { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true); - if (target.canChoose(opponent.getId(), game)) { + if (target.canChoose(source.getSourceId(), opponent.getId(), game)) { opponent.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); controller.gainLife(permanent.getToughness().getValue(), game, source); } } diff --git a/Mage.Sets/src/mage/cards/t/Trickbind.java b/Mage.Sets/src/mage/cards/t/Trickbind.java index 46619fded7b..17bc5a77eeb 100644 --- a/Mage.Sets/src/mage/cards/t/Trickbind.java +++ b/Mage.Sets/src/mage/cards/t/Trickbind.java @@ -63,7 +63,7 @@ class TrickbindCounterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget()); - if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) { + if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source, game)) { TrickbindCantActivateEffect effect = new TrickbindCantActivateEffect(); effect.setTargetPointer(new FixedTarget(stackObject.getSourceId())); game.getContinuousEffects().addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/t/TrigonOfCorruption.java b/Mage.Sets/src/mage/cards/t/TrigonOfCorruption.java index 0d5249c1d74..da011c26c46 100644 --- a/Mage.Sets/src/mage/cards/t/TrigonOfCorruption.java +++ b/Mage.Sets/src/mage/cards/t/TrigonOfCorruption.java @@ -1,5 +1,3 @@ - - package mage.cards.t; import java.util.UUID; @@ -32,18 +30,20 @@ public final class TrigonOfCorruption extends CardImpl { public TrigonOfCorruption (UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); + // Trigon of Corruption enters the battlefield with three charge counters on it. this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), "")); + // {2}, {T}, Remove a charge counter from Trigon of Corruption: Put a -1/-1 counter on target creature. Costs costs = new CostsImpl(); costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance())); costs.add(new TapSourceCost()); - Effect putCounterEffect = new AddCountersTargetEffect(CounterType.M1M1.createInstance()); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, putCounterEffect, costs); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.M1M1.createInstance()), costs); ability.addManaCost(new GenericManaCost(2)); Target target = new TargetCreaturePermanent(); ability.addTarget(target); this.addAbility(ability); + // {B}{B}, {T}: Put a charge counter on Trigon of Corruption. Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()); ability2.addManaCost(new ManaCostsImpl("{B}{B}")); this.addAbility(ability2); diff --git a/Mage.Sets/src/mage/cards/t/Triskaidekaphobia.java b/Mage.Sets/src/mage/cards/t/Triskaidekaphobia.java index 878f22d48b2..7e811237778 100644 --- a/Mage.Sets/src/mage/cards/t/Triskaidekaphobia.java +++ b/Mage.Sets/src/mage/cards/t/Triskaidekaphobia.java @@ -114,7 +114,7 @@ class TriskaidekaphobiaLoseLifeEffect extends OneShotEffect { for (UUID pid : playerList) { Player player = game.getPlayer(pid); if (player != null) { - player.loseLife(1, game, false); + player.loseLife(1, game, source, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TritonTactics.java b/Mage.Sets/src/mage/cards/t/TritonTactics.java index 16fc8601f6d..ece345f6d2a 100644 --- a/Mage.Sets/src/mage/cards/t/TritonTactics.java +++ b/Mage.Sets/src/mage/cards/t/TritonTactics.java @@ -116,7 +116,7 @@ class TritonTacticsTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_COMBAT_STEP_PRE; + return event.getType() == GameEvent.EventType.END_COMBAT_STEP_PRE; } @Override @@ -162,7 +162,7 @@ class TritonTacticsEndOfCombatEffect extends OneShotEffect { for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) { if (attackerSet.contains(CardUtil.getCardZoneString(null, creature.getId(), game))) { // tap creature and add the not untap effect - creature.tap(game); + creature.tap(source, game); doNotUntapNextUntapStep.add(creature); game.informPlayers("Triton Tactics: " + creature.getName() + " doesn't untap during its controller's next untap step"); } diff --git a/Mage.Sets/src/mage/cards/t/TrostaniDiscordant.java b/Mage.Sets/src/mage/cards/t/TrostaniDiscordant.java index d7dfd63b478..1d6561c1017 100644 --- a/Mage.Sets/src/mage/cards/t/TrostaniDiscordant.java +++ b/Mage.Sets/src/mage/cards/t/TrostaniDiscordant.java @@ -111,7 +111,7 @@ class TrostaniDiscordantEffect extends ContinuousEffectImpl { Permanent creature = it.next().getPermanent(game); if (creature != null) { if (!creature.isControlledBy(creature.getOwnerId())) { - creature.changeControllerId(creature.getOwnerId(), game); + creature.changeControllerId(creature.getOwnerId(), game, source); } } else { it.remove(); diff --git a/Mage.Sets/src/mage/cards/t/TrostaniSelesnyasVoice.java b/Mage.Sets/src/mage/cards/t/TrostaniSelesnyasVoice.java index d6ff2a36a32..0e4ae532f7a 100644 --- a/Mage.Sets/src/mage/cards/t/TrostaniSelesnyasVoice.java +++ b/Mage.Sets/src/mage/cards/t/TrostaniSelesnyasVoice.java @@ -71,7 +71,7 @@ class TrostaniSelesnyasVoiceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/t/Truce.java b/Mage.Sets/src/mage/cards/t/Truce.java index 49762b869b4..a1f1d1ccebb 100644 --- a/Mage.Sets/src/mage/cards/t/Truce.java +++ b/Mage.Sets/src/mage/cards/t/Truce.java @@ -58,7 +58,7 @@ class TruceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int cardsToDraw = player.getAmount(0, 2, "Draw how many cards?", game); - player.drawCards(cardsToDraw, source.getSourceId(), game); + player.drawCards(cardsToDraw, source, game); player.gainLife((2 - cardsToDraw) * 2, game, source); } } diff --git a/Mage.Sets/src/mage/cards/t/TrygonPredator.java b/Mage.Sets/src/mage/cards/t/TrygonPredator.java index 1acd12e690d..5ef3778a697 100644 --- a/Mage.Sets/src/mage/cards/t/TrygonPredator.java +++ b/Mage.Sets/src/mage/cards/t/TrygonPredator.java @@ -67,7 +67,7 @@ class TrygonPredatorTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TsabosDecree.java b/Mage.Sets/src/mage/cards/t/TsabosDecree.java index ab5b862b092..ceba41a0abd 100644 --- a/Mage.Sets/src/mage/cards/t/TsabosDecree.java +++ b/Mage.Sets/src/mage/cards/t/TsabosDecree.java @@ -75,12 +75,12 @@ class TsabosDecreeEffect extends OneShotEffect { targetPlayer.revealCards("hand of " + targetPlayer.getName(), targetPlayer.getHand(), game); FilterCard filterCard = new FilterCard(); filterCard.add(SubType.byDescription(typeChoice.getChoice()).getPredicate()); - targetPlayer.discard(new CardsImpl(targetPlayer.getHand().getCards(filterCard, game)), source, game); + targetPlayer.discard(new CardsImpl(targetPlayer.getHand().getCards(filterCard, game)), false, source, game); FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent(); filterCreaturePermanent.add(SubType.byDescription(typeChoice.getChoice()).getPredicate()); for (Permanent creature : game.getBattlefield().getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) { if (creature.isControlledBy(targetPlayer.getId())) { - creature.destroy(source.getSourceId(), game, true); + creature.destroy(source, game, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TuktukScrapper.java b/Mage.Sets/src/mage/cards/t/TuktukScrapper.java index d1955ef7bc2..8778520bc76 100644 --- a/Mage.Sets/src/mage/cards/t/TuktukScrapper.java +++ b/Mage.Sets/src/mage/cards/t/TuktukScrapper.java @@ -118,12 +118,12 @@ class TuktukScrapperEffect extends OneShotEffect { Permanent targetArtifact = game.getPermanent(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && targetArtifact != null) { - targetArtifact.destroy(source.getSourceId(), game, false); + targetArtifact.destroy(source, game, false); Player targetController = game.getPlayer(targetArtifact.getControllerId()); if (targetController != null && game.getState().getZone(targetArtifact.getId()) == Zone.GRAVEYARD) { int alliesControlled = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); if (alliesControlled > 0) { - targetController.damage(alliesControlled, source.getSourceId(), game); + targetController.damage(alliesControlled, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/TunnelIgnus.java b/Mage.Sets/src/mage/cards/t/TunnelIgnus.java index 96c613ae229..bf8466f682d 100644 --- a/Mage.Sets/src/mage/cards/t/TunnelIgnus.java +++ b/Mage.Sets/src/mage/cards/t/TunnelIgnus.java @@ -90,7 +90,7 @@ class TunnelIgnusTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TurnTheTables.java b/Mage.Sets/src/mage/cards/t/TurnTheTables.java index 327b966fbd9..dbaaafcd287 100644 --- a/Mage.Sets/src/mage/cards/t/TurnTheTables.java +++ b/Mage.Sets/src/mage/cards/t/TurnTheTables.java @@ -61,7 +61,7 @@ class TurnTheTablesEffect extends PreventDamageToControllerEffect { if (damage > 0) { Permanent attackingCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (attackingCreature != null) { - attackingCreature.damage(damage, source.getSourceId(), game, false, true); + attackingCreature.damage(damage, source.getSourceId(), source, game, false, true); } } return preventionEffectData; diff --git a/Mage.Sets/src/mage/cards/t/TurnToSlag.java b/Mage.Sets/src/mage/cards/t/TurnToSlag.java index b640897e8f9..b20c61c2177 100644 --- a/Mage.Sets/src/mage/cards/t/TurnToSlag.java +++ b/Mage.Sets/src/mage/cards/t/TurnToSlag.java @@ -62,9 +62,9 @@ class TurnToSlagEffect extends OneShotEffect { } } for (Permanent p : attachments) { - p.destroy(source.getSourceId(), game, false); + p.destroy(source, game, false); } - target.damage(5, source.getSourceId(), game, false, false); + target.damage(5, source.getSourceId(), source, game, false, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/t/Turnabout.java b/Mage.Sets/src/mage/cards/t/Turnabout.java index 2a0464eaf2c..26a743bdbc6 100644 --- a/Mage.Sets/src/mage/cards/t/Turnabout.java +++ b/Mage.Sets/src/mage/cards/t/Turnabout.java @@ -119,7 +119,7 @@ class TurnaboutEffect extends OneShotEffect { filter.add(Predicates.not(TappedPredicate.instance)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (permanent.isControlledBy(target)) { - permanent.tap(game); + permanent.tap(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TwistedJustice.java b/Mage.Sets/src/mage/cards/t/TwistedJustice.java index dff11f79f66..c96e9160db8 100644 --- a/Mage.Sets/src/mage/cards/t/TwistedJustice.java +++ b/Mage.Sets/src/mage/cards/t/TwistedJustice.java @@ -63,13 +63,13 @@ class TwistedJusticeEffect extends OneShotEffect { //A spell or ability could have removed the only legal target this player //had, if thats the case this ability should fizzle. - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); - controller.drawCards(permanent.getPower().getValue(), source.getSourceId(), game); + permanent.sacrifice(source, game); + controller.drawCards(permanent.getPower().getValue(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TymnaTheWeaver.java b/Mage.Sets/src/mage/cards/t/TymnaTheWeaver.java index 85fe4193928..b7988a43652 100644 --- a/Mage.Sets/src/mage/cards/t/TymnaTheWeaver.java +++ b/Mage.Sets/src/mage/cards/t/TymnaTheWeaver.java @@ -80,9 +80,9 @@ class TymnaTheWeaverEffect extends OneShotEffect { if (watcher != null) { int cardsToDraw = watcher.opponentsThatGotCombatDamage(source.getControllerId(), game); Cost cost = new PayLifeCost(cardsToDraw); - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) - && cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { - controller.drawCards(cardsToDraw, source.getSourceId(), game); + if (cost.canPay(source, source, source.getControllerId(), game) + && cost.pay(source, game, source, source.getControllerId(), false)) { + controller.drawCards(cardsToDraw, source, game); } return true; } @@ -102,7 +102,7 @@ class TymnaTheWeaverWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { DamagedPlayerEvent dEvent = (DamagedPlayerEvent) event; if (dEvent.isCombatDamage()) { if (players.containsKey(event.getTargetId())) { // opponenets can die before number of opponents are checked diff --git a/Mage.Sets/src/mage/cards/t/Typhoon.java b/Mage.Sets/src/mage/cards/t/Typhoon.java index 19c6b641701..e6cb62719b2 100644 --- a/Mage.Sets/src/mage/cards/t/Typhoon.java +++ b/Mage.Sets/src/mage/cards/t/Typhoon.java @@ -64,7 +64,7 @@ class TyphoonEffect extends OneShotEffect { amount++; } if (amount > 0) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/Tyrannize.java b/Mage.Sets/src/mage/cards/t/Tyrannize.java index c34f55f5280..e17f542c24d 100644 --- a/Mage.Sets/src/mage/cards/t/Tyrannize.java +++ b/Mage.Sets/src/mage/cards/t/Tyrannize.java @@ -61,10 +61,10 @@ class TyrannizeEffect extends OneShotEffect { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { Cost cost = new PayLifeCost(7); - if (!cost.canPay(source, source.getSourceId(), player.getId(), game) + if (!cost.canPay(source, source, player.getId(), game) || !player.chooseUse(Outcome.LoseLife, "Pay 7 life?", source, game) - || !cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { - player.discard(player.getHand(),source,game); + || !cost.pay(source, game, source, player.getId(), false, null)) { + player.discard(player.getHand(), false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TyrantOfDiscord.java b/Mage.Sets/src/mage/cards/t/TyrantOfDiscord.java index 6f1c1072247..0a7de51b851 100644 --- a/Mage.Sets/src/mage/cards/t/TyrantOfDiscord.java +++ b/Mage.Sets/src/mage/cards/t/TyrantOfDiscord.java @@ -74,7 +74,7 @@ class TyrantOfDiscordEffect extends OneShotEffect { int index = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(opponent.getId())) { if (index == random) { - if (permanent.sacrifice(source.getSourceId(), game)) { + if (permanent.sacrifice(source, game)) { if (permanent.isLand()) { stop = true; game.informPlayers("Land permanent has been sacrificed: " + permanent.getName() + ". Stopping process."); diff --git a/Mage.Sets/src/mage/cards/t/TyrantsChoice.java b/Mage.Sets/src/mage/cards/t/TyrantsChoice.java index 94415038aba..3d9ecad2662 100644 --- a/Mage.Sets/src/mage/cards/t/TyrantsChoice.java +++ b/Mage.Sets/src/mage/cards/t/TyrantsChoice.java @@ -95,7 +95,7 @@ class TyrantsChoiceLoseLifeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { - game.getPlayer(opponentId).loseLife(4, game, false); + game.getPlayer(opponentId).loseLife(4, game, source, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/u/UginTheIneffable.java b/Mage.Sets/src/mage/cards/u/UginTheIneffable.java index 3820105138b..9c966ea870c 100644 --- a/Mage.Sets/src/mage/cards/u/UginTheIneffable.java +++ b/Mage.Sets/src/mage/cards/u/UginTheIneffable.java @@ -117,7 +117,7 @@ class UginTheIneffableEffect extends OneShotEffect { // exile and look UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); if (player.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName() + " (" + player.getName() + ")")) { - card.turnFaceDown(game, source.getControllerId()); + card.turnFaceDown(source, game, source.getControllerId()); player.lookAtCards(player.getName() + " - " + card.getIdName() + " - " + CardUtil.sdf.format(System.currentTimeMillis()), card, game); } diff --git a/Mage.Sets/src/mage/cards/u/UginTheSpiritDragon.java b/Mage.Sets/src/mage/cards/u/UginTheSpiritDragon.java index 67db8d01eb8..9f6ad28295b 100644 --- a/Mage.Sets/src/mage/cards/u/UginTheSpiritDragon.java +++ b/Mage.Sets/src/mage/cards/u/UginTheSpiritDragon.java @@ -129,7 +129,7 @@ class UginTheSpiritDragonEffect3 extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.gainLife(7, game, source); - controller.drawCards(7, source.getSourceId(), game); + controller.drawCards(7, source, game); TargetCardInHand target = new TargetCardInHand(0, 7, new FilterPermanentCard("permanent cards")); if (controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { controller.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/u/UginsInsight.java b/Mage.Sets/src/mage/cards/u/UginsInsight.java index cf9309d5503..ec91ab7786a 100644 --- a/Mage.Sets/src/mage/cards/u/UginsInsight.java +++ b/Mage.Sets/src/mage/cards/u/UginsInsight.java @@ -59,7 +59,7 @@ class UginsInsightEffect extends OneShotEffect { if (highCMC > 0) { controller.scry(highCMC, source, game); } - controller.drawCards(3, source.getSourceId(), game); + controller.drawCards(3, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/u/UginsNexus.java b/Mage.Sets/src/mage/cards/u/UginsNexus.java index 30a5ab71fd2..c13dcdc5821 100644 --- a/Mage.Sets/src/mage/cards/u/UginsNexus.java +++ b/Mage.Sets/src/mage/cards/u/UginsNexus.java @@ -72,7 +72,7 @@ class UginsNexusSkipExtraTurnsEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.EXTRA_TURN; + return event.getType() == GameEvent.EventType.EXTRA_TURN; } @Override @@ -107,7 +107,7 @@ class UginsNexusExileEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanent = ((ZoneChangeEvent)event).getTarget(); if (permanent != null) { - permanent.moveToExile(null, "", source.getSourceId(), game); + permanent.moveToExile(null, "", source, game); new AddExtraTurnControllerEffect().apply(game, source); return true; } @@ -116,12 +116,12 @@ class UginsNexusExileEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent)event; if (zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getFromZone() == Zone.BATTLEFIELD) { return true; diff --git a/Mage.Sets/src/mage/cards/u/UkkimaStalkingShadow.java b/Mage.Sets/src/mage/cards/u/UkkimaStalkingShadow.java index 3f497068350..6343f67a926 100644 --- a/Mage.Sets/src/mage/cards/u/UkkimaStalkingShadow.java +++ b/Mage.Sets/src/mage/cards/u/UkkimaStalkingShadow.java @@ -79,7 +79,7 @@ class UkkimaStalkingShadowEffect extends OneShotEffect { } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { - player.damage(permanent.getPower().getValue(), source.getSourceId(), game); + player.damage(permanent.getPower().getValue(), source.getSourceId(), source, game); } Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/u/UlamogTheCeaselessHunger.java b/Mage.Sets/src/mage/cards/u/UlamogTheCeaselessHunger.java index 5cfa1c99d1c..c2ac222e9ee 100644 --- a/Mage.Sets/src/mage/cards/u/UlamogTheCeaselessHunger.java +++ b/Mage.Sets/src/mage/cards/u/UlamogTheCeaselessHunger.java @@ -74,7 +74,7 @@ class UlamogExilePermanentsOnCastAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -111,7 +111,7 @@ class UlamogAttackTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/u/UlamogsNullifier.java b/Mage.Sets/src/mage/cards/u/UlamogsNullifier.java index 4647d7c207a..d8d36cdf0b4 100644 --- a/Mage.Sets/src/mage/cards/u/UlamogsNullifier.java +++ b/Mage.Sets/src/mage/cards/u/UlamogsNullifier.java @@ -97,7 +97,7 @@ class UlamogsNullifierEffect extends OneShotEffect { if (controller.chooseTarget(outcome, target, source, game)) { Cards cardsToGraveyard = new CardsImpl(target.getTargets()); controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game); - game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + game.getStack().counter(source.getFirstTarget(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java b/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java index 538e66c96f0..ca07e3dca4c 100644 --- a/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java +++ b/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java @@ -74,7 +74,7 @@ class UlvenwaldMysteriesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SACRIFICED_PERMANENT; + return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT; } @Override diff --git a/Mage.Sets/src/mage/cards/u/Umbilicus.java b/Mage.Sets/src/mage/cards/u/Umbilicus.java index 037f63953b0..b5da58d3a5e 100644 --- a/Mage.Sets/src/mage/cards/u/Umbilicus.java +++ b/Mage.Sets/src/mage/cards/u/Umbilicus.java @@ -64,7 +64,7 @@ class BloodClockEffect extends OneShotEffect { return false; } if (player.getLife() > 2 && player.chooseUse(Outcome.Neutral, "Pay 2 life? If you don't, return a permanent you control to its owner's hand.", source, game)) { - player.loseLife(2, game, false); + player.loseLife(2, game, source, false); game.informPlayers(player.getLogName() + " pays 2 life. They will not return a permanent they control."); return true; } else { @@ -73,7 +73,7 @@ class BloodClockEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { game.informPlayers(player.getLogName() + " returns " + permanent.getName() + " to hand."); - return permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + return permanent.moveToZone(Zone.HAND, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/u/UmezawasJitte.java b/Mage.Sets/src/mage/cards/u/UmezawasJitte.java index a7b26b40caa..b7799088572 100644 --- a/Mage.Sets/src/mage/cards/u/UmezawasJitte.java +++ b/Mage.Sets/src/mage/cards/u/UmezawasJitte.java @@ -109,7 +109,7 @@ class UmezawasJitteAbility extends TriggeredAbilityImpl { return true; } } - if (event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE) { + if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE) { usedInPhase = false; } return false; diff --git a/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java b/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java index 1128412a940..7eac564272d 100644 --- a/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java +++ b/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java @@ -16,6 +16,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -115,16 +116,16 @@ class UnbreathingHordeEffect2 extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { boolean retValue = false; - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); int damage = event.getAmount(); if (!game.replaceEvent(preventEvent)) { event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); retValue = true; } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.removeCounters(CounterType.P1P1.createInstance(), game); + permanent.removeCounters(CounterType.P1P1.createInstance(), source, game); } return retValue; } diff --git a/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java b/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java index fb376510755..265db03c88c 100644 --- a/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java +++ b/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java @@ -83,7 +83,7 @@ class UnconventionalTacticsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/u/UndergrowthChampion.java b/Mage.Sets/src/mage/cards/u/UndergrowthChampion.java index 6a68cf957b5..3ecbf6e878f 100644 --- a/Mage.Sets/src/mage/cards/u/UndergrowthChampion.java +++ b/Mage.Sets/src/mage/cards/u/UndergrowthChampion.java @@ -96,7 +96,7 @@ class UndergrowthChampionPreventionEffect extends PreventionEffectImpl { if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { preventDamageAction(event, source, game); StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); + permanent.removeCounters(CounterType.P1P1.createInstance(), source, game); sb.append("Removed a +1/+1 counter "); game.informPlayers(sb.toString()); } diff --git a/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java b/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java index 618c2ea19e3..2b60a7057a4 100644 --- a/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java +++ b/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java @@ -134,7 +134,7 @@ class UneshCriosphinxSovereignEffect extends OneShotEffect { if (i < pile1.size()) { sb.append(", "); } - card.moveToZone(pile1Zone, source.getSourceId(), game, false); + card.moveToZone(pile1Zone, source, game, false); } game.informPlayers(sb.toString()); @@ -146,7 +146,7 @@ class UneshCriosphinxSovereignEffect extends OneShotEffect { if (i < pile2.size()) { sb.append(", "); } - card.moveToZone(pile2Zone, source.getSourceId(), game, false); + card.moveToZone(pile2Zone, source, game, false); } game.informPlayers(sb.toString()); } diff --git a/Mage.Sets/src/mage/cards/u/Unforge.java b/Mage.Sets/src/mage/cards/u/Unforge.java index 190f6de98d5..2779c7e1104 100644 --- a/Mage.Sets/src/mage/cards/u/Unforge.java +++ b/Mage.Sets/src/mage/cards/u/Unforge.java @@ -65,7 +65,7 @@ class UnforgeEffect extends OneShotEffect{ if(equipment != null){ Permanent creature = game.getPermanent(equipment.getAttachedTo()); if(creature != null){ - creature.damage(2, source.getId(), game, false, true); + creature.damage(2, source.getSourceId(), source, game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/u/UnifiedWill.java b/Mage.Sets/src/mage/cards/u/UnifiedWill.java index 6e8280d40ba..b29c8d1a20e 100644 --- a/Mage.Sets/src/mage/cards/u/UnifiedWill.java +++ b/Mage.Sets/src/mage/cards/u/UnifiedWill.java @@ -55,7 +55,7 @@ class UnifiedWillEffect extends OneShotEffect { StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget()); if (stackObject != null) { if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game) > game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, stackObject.getControllerId(), game)) { - return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); + return game.getStack().counter(source.getFirstTarget(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/u/UnifyingTheory.java b/Mage.Sets/src/mage/cards/u/UnifyingTheory.java index 653142390ec..28690e6aa0f 100644 --- a/Mage.Sets/src/mage/cards/u/UnifyingTheory.java +++ b/Mage.Sets/src/mage/cards/u/UnifyingTheory.java @@ -63,8 +63,8 @@ class UnifyingTheoryEffect extends OneShotEffect { if (caster != null) { if (caster.chooseUse(Outcome.DrawCard, "Pay {2} to draw a card?", source, game)) { Cost cost = new ManaCostsImpl("{2}"); - if (cost.pay(source, game, source.getSourceId(), caster.getId(), false, null)) { - caster.drawCards(1, source.getSourceId(), game); + if (cost.pay(source, game, source, caster.getId(), false, null)) { + caster.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/u/UnmooredEgo.java b/Mage.Sets/src/mage/cards/u/UnmooredEgo.java index d502014e6f1..2645e43649a 100644 --- a/Mage.Sets/src/mage/cards/u/UnmooredEgo.java +++ b/Mage.Sets/src/mage/cards/u/UnmooredEgo.java @@ -111,7 +111,7 @@ class UnmooredEgoEffect extends OneShotEffect { if (numberOfCardsExiledFromHand > 0) { game.getState().applyEffects(game); - targetPlayer.drawCards(numberOfCardsExiledFromHand, source.getSourceId(), game); + targetPlayer.drawCards(numberOfCardsExiledFromHand, source, game); } } diff --git a/Mage.Sets/src/mage/cards/u/UnnaturalHunger.java b/Mage.Sets/src/mage/cards/u/UnnaturalHunger.java index 5ded11fe930..a532ad43da8 100644 --- a/Mage.Sets/src/mage/cards/u/UnnaturalHunger.java +++ b/Mage.Sets/src/mage/cards/u/UnnaturalHunger.java @@ -79,13 +79,13 @@ class UnnaturalHungerEffect extends OneShotEffect { Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter)); Player enchantedCreatureController = game.getPlayer(attachedTo.getControllerId()); if (enchantedCreatureController != null - && cost.canPay(source, source.getSourceId(), enchantedCreatureController.getId(), game) + && cost.canPay(source, source, enchantedCreatureController.getId(), game) && enchantedCreatureController.chooseUse(outcome, "Sacrifice another creature to prevent " + attachedTo.getPower().getValue() + " damage?", source, game) - && cost.pay(source, game, source.getSourceId(), enchantedCreatureController.getId(), true)) { + && cost.pay(source, game, source, enchantedCreatureController.getId(), true)) { } if (enchantedCreatureController != null && !cost.isPaid()) { - enchantedCreatureController.damage(attachedTo.getPower().getValue(), source.getSourceId(), game); + enchantedCreatureController.damage(attachedTo.getPower().getValue(), source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/u/UnpredictableCyclone.java b/Mage.Sets/src/mage/cards/u/UnpredictableCyclone.java index c513f051cb1..043acbc6139 100644 --- a/Mage.Sets/src/mage/cards/u/UnpredictableCyclone.java +++ b/Mage.Sets/src/mage/cards/u/UnpredictableCyclone.java @@ -112,7 +112,7 @@ class UnpredictableCycloneReplacementEffect extends ReplacementEffectImpl { return false; } Player player = game.getPlayer(event.getPlayerId()); - StackObject stackObject = game.getStack().getStackObject(event.getSourceId()); + StackObject stackObject = game.getStack().getStackObject(event.getSourceId()); // event.getSourceId() will be null for default draws (non effects) if (player == null || stackObject == null || stackObject.getStackAbility() == null || !(stackObject.getStackAbility() instanceof CyclingAbility)) { diff --git a/Mage.Sets/src/mage/cards/u/UnscytheKillerOfKings.java b/Mage.Sets/src/mage/cards/u/UnscytheKillerOfKings.java index 04c7cad21ba..37054c6c8f5 100644 --- a/Mage.Sets/src/mage/cards/u/UnscytheKillerOfKings.java +++ b/Mage.Sets/src/mage/cards/u/UnscytheKillerOfKings.java @@ -76,7 +76,7 @@ class UnscytheKillerOfKingsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -132,9 +132,9 @@ class UnscytheEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Card card = game.getCard(targetPointer.getFirst(game, source)); - if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD && controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true)) { + if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD && controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true)) { ZombieToken zombie = new ZombieToken(); - return zombie.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return zombie.putOntoBattlefield(1, game, source, source.getControllerId()); } return true; } diff --git a/Mage.Sets/src/mage/cards/u/UnstableFooting.java b/Mage.Sets/src/mage/cards/u/UnstableFooting.java index 898570d5a5f..343c83624b7 100644 --- a/Mage.Sets/src/mage/cards/u/UnstableFooting.java +++ b/Mage.Sets/src/mage/cards/u/UnstableFooting.java @@ -87,7 +87,7 @@ class UnstableFootingEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.PREVENT_DAMAGE; + return event.getType() == GameEvent.EventType.PREVENT_DAMAGE; } @Override diff --git a/Mage.Sets/src/mage/cards/u/UrabraskTheHidden.java b/Mage.Sets/src/mage/cards/u/UrabraskTheHidden.java index f82a8a0a7f2..68fe26df7b6 100644 --- a/Mage.Sets/src/mage/cards/u/UrabraskTheHidden.java +++ b/Mage.Sets/src/mage/cards/u/UrabraskTheHidden.java @@ -68,7 +68,7 @@ class UrabraskTheHiddenEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/u/UrborgSyphonMage.java b/Mage.Sets/src/mage/cards/u/UrborgSyphonMage.java index f61826c156e..ebf49013d17 100644 --- a/Mage.Sets/src/mage/cards/u/UrborgSyphonMage.java +++ b/Mage.Sets/src/mage/cards/u/UrborgSyphonMage.java @@ -69,7 +69,7 @@ class UrborgSyphonMageEffect extends OneShotEffect { if (!source.isControlledBy(playerId)) { Player player = game.getPlayer(playerId); if (player != null) { - damage += player.loseLife(2, game, false); + damage += player.loseLife(2, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/u/UrgeToFeed.java b/Mage.Sets/src/mage/cards/u/UrgeToFeed.java index ac769666238..8254b1bcc00 100644 --- a/Mage.Sets/src/mage/cards/u/UrgeToFeed.java +++ b/Mage.Sets/src/mage/cards/u/UrgeToFeed.java @@ -64,11 +64,11 @@ class UrgeToFeedEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { for (UUID vampireId : target.getTargets()) { Permanent vampire = game.getPermanent(vampireId); if (vampire != null) { - vampire.tap(game); + vampire.tap(source, game); vampire.addCounters(CounterType.P1P1.createInstance(), source, game); } } diff --git a/Mage.Sets/src/mage/cards/u/UrgorosTheEmptyOne.java b/Mage.Sets/src/mage/cards/u/UrgorosTheEmptyOne.java index bd4571d3594..a669deabc4e 100644 --- a/Mage.Sets/src/mage/cards/u/UrgorosTheEmptyOne.java +++ b/Mage.Sets/src/mage/cards/u/UrgorosTheEmptyOne.java @@ -69,9 +69,9 @@ class UrgorosTheEmptyOneEffect extends OneShotEffect { Player attackedPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (controller != null && attackedPlayer != null) { if (attackedPlayer.getHand().isEmpty()) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } else { - attackedPlayer.discardOne(true, source, game); + attackedPlayer.discardOne(true, false, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java b/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java index 667e01bc984..1f3853c1d2b 100644 --- a/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java +++ b/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java @@ -83,6 +83,6 @@ class UroTitanOfNaturesWrathEffect extends OneShotEffect { if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())) { return false; } - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } diff --git a/Mage.Sets/src/mage/cards/u/UrzaAcademyHeadmaster.java b/Mage.Sets/src/mage/cards/u/UrzaAcademyHeadmaster.java index 137e2b46535..c416db33fde 100644 --- a/Mage.Sets/src/mage/cards/u/UrzaAcademyHeadmaster.java +++ b/Mage.Sets/src/mage/cards/u/UrzaAcademyHeadmaster.java @@ -550,7 +550,7 @@ class UrzaAcademyHeadmasterBrainstormEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); putOnLibrary(player, source, game); return true; } @@ -563,7 +563,7 @@ class UrzaAcademyHeadmasterBrainstormEffect extends OneShotEffect { player.chooseTarget(Outcome.ReturnToHand, target, source, game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - return player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + return player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return false; diff --git a/Mage.Sets/src/mage/cards/u/UrzasMiter.java b/Mage.Sets/src/mage/cards/u/UrzasMiter.java index d7bd1a874fc..a83501485ca 100644 --- a/Mage.Sets/src/mage/cards/u/UrzasMiter.java +++ b/Mage.Sets/src/mage/cards/u/UrzasMiter.java @@ -76,7 +76,6 @@ class UrzasMiterWatcher extends Watcher { this.cards = new ArrayList<>(); } - @Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT) { diff --git a/Mage.Sets/src/mage/cards/u/UrzasScienceFairProject.java b/Mage.Sets/src/mage/cards/u/UrzasScienceFairProject.java index 9355a70cbdb..0afa942853a 100644 --- a/Mage.Sets/src/mage/cards/u/UrzasScienceFairProject.java +++ b/Mage.Sets/src/mage/cards/u/UrzasScienceFairProject.java @@ -72,7 +72,7 @@ class UrzasScienceFairProjectEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int amount = controller.rollDice(game, 6); + int amount = controller.rollDice(source, game, 6); Effect effect = null; // 1 - -2/-2 until end of turn. diff --git a/Mage.Sets/src/mage/cards/u/UrzasTome.java b/Mage.Sets/src/mage/cards/u/UrzasTome.java index 4080f8ed73b..446bbdc7b0d 100644 --- a/Mage.Sets/src/mage/cards/u/UrzasTome.java +++ b/Mage.Sets/src/mage/cards/u/UrzasTome.java @@ -67,14 +67,14 @@ class UrzasTomeEffect extends OneShotEffect { if (controller != null && controller.chooseUse(Outcome.Exile, "Exile a historic card from your graveyard?", source, game)) { Cost cost = new ExileFromGraveCost(new TargetCardInYourGraveyard(new FilterHistoricCard())); - if (cost.canPay(source, source.getSourceId(), controller.getId(), game)) { - if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { + if (cost.canPay(source, source, controller.getId(), game)) { + if (cost.pay(source, game, source, controller.getId(), false, null)) { return true; } } } if (controller != null) { - controller.discard(1, false, source, game); + controller.discard(1, false, false, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java b/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java index ebd292581ef..4fd0e6aae3e 100644 --- a/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java +++ b/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java @@ -40,8 +40,10 @@ public final class UtopiaSprawl extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); + // As Utopia Sprawl enters the battlefield, choose a color. this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Detriment))); + // Whenever enchanted Forest is tapped for mana, its controller adds one mana of the chosen color. this.addAbility(new UtopiaSprawlTriggeredAbility()); } @@ -68,7 +70,7 @@ class UtopiaSprawlTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VaevictisAsmadiTheDire.java b/Mage.Sets/src/mage/cards/v/VaevictisAsmadiTheDire.java index 500691eb9cf..6ed59d4a90c 100644 --- a/Mage.Sets/src/mage/cards/v/VaevictisAsmadiTheDire.java +++ b/Mage.Sets/src/mage/cards/v/VaevictisAsmadiTheDire.java @@ -133,7 +133,7 @@ class VaevictisAsmadiTheDireEffect extends OneShotEffect { for (UUID permId : target.getTargets()) { Permanent permanent = game.getPermanent(permId); if (permanent == null - || !permanent.sacrifice(source.getSourceId(), game)) { + || !permanent.sacrifice(source, game)) { continue; } Player player = game.getPlayer(permanent.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/v/ValakutAwakening.java b/Mage.Sets/src/mage/cards/v/ValakutAwakening.java index 214c83fe4c1..5d324e0eba7 100644 --- a/Mage.Sets/src/mage/cards/v/ValakutAwakening.java +++ b/Mage.Sets/src/mage/cards/v/ValakutAwakening.java @@ -84,7 +84,7 @@ class ValakutAwakeningEffect extends OneShotEffect { player.choose(outcome, player.getHand(), targetCard, game); Cards cards = new CardsImpl(targetCard.getTargets()); player.putCardsOnBottomOfLibrary(cards, game, source, true); - player.drawCards(cards.size() + 1, source.getSourceId(), game); + player.drawCards(cards.size() + 1, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/v/ValakutExploration.java b/Mage.Sets/src/mage/cards/v/ValakutExploration.java index d98bf0a780b..7534b471160 100644 --- a/Mage.Sets/src/mage/cards/v/ValakutExploration.java +++ b/Mage.Sets/src/mage/cards/v/ValakutExploration.java @@ -171,7 +171,7 @@ class ValakutExplorationDamageEffect extends OneShotEffect { if (playerId == null) { continue; } - player.damage(count, source.getSourceId(), game); + player.damage(count, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/ValakutTheMoltenPinnacle.java b/Mage.Sets/src/mage/cards/v/ValakutTheMoltenPinnacle.java index a124785b3b3..ee4e99e107e 100644 --- a/Mage.Sets/src/mage/cards/v/ValakutTheMoltenPinnacle.java +++ b/Mage.Sets/src/mage/cards/v/ValakutTheMoltenPinnacle.java @@ -72,7 +72,7 @@ class ValakutTheMoltenPinnacleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/v/ValeronWardens.java b/Mage.Sets/src/mage/cards/v/ValeronWardens.java index e2d71a168f1..9adab5c6e43 100644 --- a/Mage.Sets/src/mage/cards/v/ValeronWardens.java +++ b/Mage.Sets/src/mage/cards/v/ValeronWardens.java @@ -63,7 +63,7 @@ class ValeronWardensTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BECOMES_RENOWNED; + return event.getType() == GameEvent.EventType.BECOMES_RENOWNED; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VampireHexmage.java b/Mage.Sets/src/mage/cards/v/VampireHexmage.java index 768c0d8a2f1..81f92061388 100644 --- a/Mage.Sets/src/mage/cards/v/VampireHexmage.java +++ b/Mage.Sets/src/mage/cards/v/VampireHexmage.java @@ -71,7 +71,7 @@ class VampireHexmageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { for (Counter counter : permanent.getCounters(game).copy().values()) { // copy to prevent ConcurrentModificationException - permanent.removeCounters(counter, game); + permanent.removeCounters(counter, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/VanishIntoMemory.java b/Mage.Sets/src/mage/cards/v/VanishIntoMemory.java index 6ff09bc0792..4f074f90bff 100644 --- a/Mage.Sets/src/mage/cards/v/VanishIntoMemory.java +++ b/Mage.Sets/src/mage/cards/v/VanishIntoMemory.java @@ -72,7 +72,7 @@ class VanishIntoMemoryEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && permanent != null && sourceObject != null) { if (controller.moveCardsToExile(permanent, source, game, true, source.getSourceId(), sourceObject.getIdName())) { - controller.drawCards(permanent.getPower().getValue(), source.getSourceId(), game); + controller.drawCards(permanent.getPower().getValue(), source, game); ExileZone exile = game.getExile().getExileZone(source.getSourceId()); // only if permanent is in exile (tokens would be stop to exist) if (exile != null && !exile.isEmpty()) { @@ -139,7 +139,7 @@ class VanishIntoMemoryEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -153,7 +153,7 @@ class VanishIntoMemoryEntersBattlefieldEffect extends ReplacementEffectImpl { if (permanent != null) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { - you.discard(permanent.getToughness().getValue(), false, source, game); + you.discard(permanent.getToughness().getValue(), false, false, source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/v/VanquishersBanner.java b/Mage.Sets/src/mage/cards/v/VanquishersBanner.java index ac3650e2d5d..fa9040b96aa 100644 --- a/Mage.Sets/src/mage/cards/v/VanquishersBanner.java +++ b/Mage.Sets/src/mage/cards/v/VanquishersBanner.java @@ -75,7 +75,7 @@ class DrawCardIfCreatureTypeAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VaporSnare.java b/Mage.Sets/src/mage/cards/v/VaporSnare.java index cbf801fdf06..a7faf7f9dd3 100644 --- a/Mage.Sets/src/mage/cards/v/VaporSnare.java +++ b/Mage.Sets/src/mage/cards/v/VaporSnare.java @@ -79,13 +79,13 @@ class VaporSnareEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); TargetPermanent target = new TargetPermanent(1, 1, filter, false); - if (player != null && target.canChoose(player.getId(), game)) { + if (player != null && target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if ( permanent != null ) { targetChosen = true; - permanent.moveToZone(Zone.HAND, this.getId(), game, false); + permanent.moveToZone(Zone.HAND, source, game, false); } } diff --git a/Mage.Sets/src/mage/cards/v/VaporousDjinn.java b/Mage.Sets/src/mage/cards/v/VaporousDjinn.java index 0294264c3d7..16b1b9236e1 100644 --- a/Mage.Sets/src/mage/cards/v/VaporousDjinn.java +++ b/Mage.Sets/src/mage/cards/v/VaporousDjinn.java @@ -72,7 +72,7 @@ class VaporousDjinnEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("{U}{U}"); String message = "Would you like to pay {U}{U} to prevent {this} from phasing out?"; if (!(controller.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) { + && cost.pay(source, game, source, controller.getId(), false, null))) { permanent.phaseOut(game); } return true; diff --git a/Mage.Sets/src/mage/cards/v/VarchildsWarRiders.java b/Mage.Sets/src/mage/cards/v/VarchildsWarRiders.java index 3962f9c4414..5f8c971e3bc 100644 --- a/Mage.Sets/src/mage/cards/v/VarchildsWarRiders.java +++ b/Mage.Sets/src/mage/cards/v/VarchildsWarRiders.java @@ -64,7 +64,7 @@ class OpponentCreateSurvivorTokenCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { if (!game.getOpponents(controllerId).isEmpty()) { @@ -75,7 +75,7 @@ class OpponentCreateSurvivorTokenCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { TargetOpponent target = new TargetOpponent(); diff --git a/Mage.Sets/src/mage/cards/v/VectisDominator.java b/Mage.Sets/src/mage/cards/v/VectisDominator.java index 22deeb8810c..704cad76b63 100644 --- a/Mage.Sets/src/mage/cards/v/VectisDominator.java +++ b/Mage.Sets/src/mage/cards/v/VectisDominator.java @@ -79,10 +79,10 @@ class VectisDominatorEffect extends OneShotEffect { cost.clearPaid(); String question = "Pay 2 life? (Otherwise " + targetCreature.getName()+" will be tapped)"; if (player.chooseUse(Outcome.Benefit, question, source, game)) { - cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), true, null); + cost.pay(source, game, source, targetCreature.getControllerId(), true, null); } if (!cost.isPaid()) { - return targetCreature.tap(game); + return targetCreature.tap(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java b/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java index b08a759db3c..4ef87437810 100644 --- a/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java +++ b/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java @@ -64,7 +64,7 @@ class VeilstoneAmuletEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGET; + return event.getType() == GameEvent.EventType.TARGET; } @Override diff --git a/Mage.Sets/src/mage/cards/v/Vendetta.java b/Mage.Sets/src/mage/cards/v/Vendetta.java index 0057abd3e2b..207e2147dc1 100644 --- a/Mage.Sets/src/mage/cards/v/Vendetta.java +++ b/Mage.Sets/src/mage/cards/v/Vendetta.java @@ -71,7 +71,7 @@ class VendettaEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent target = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (player != null && target != null) { - player.loseLife(target.getToughness().getValue(), game, false); + player.loseLife(target.getToughness().getValue(), game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/v/VendilionClique.java b/Mage.Sets/src/mage/cards/v/VendilionClique.java index dd054298ab5..a6c07391095 100644 --- a/Mage.Sets/src/mage/cards/v/VendilionClique.java +++ b/Mage.Sets/src/mage/cards/v/VendilionClique.java @@ -85,7 +85,7 @@ class VendilionCliqueEffect extends OneShotEffect { cards.add(card); player.revealCards(sourceObject.getIdName(), cards, game); player.putCardsOnBottomOfLibrary(cards, game, source, true); - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/VengefulArchon.java b/Mage.Sets/src/mage/cards/v/VengefulArchon.java index c271f2e00d2..3ae0d5151bd 100644 --- a/Mage.Sets/src/mage/cards/v/VengefulArchon.java +++ b/Mage.Sets/src/mage/cards/v/VengefulArchon.java @@ -74,7 +74,7 @@ class VengefulArchonEffect extends PreventDamageToControllerEffect { PreventionEffectData preventionEffectData = super.preventDamageAction(event, source, game); int damage = preventionEffectData.getPreventedDamage(); if (damage > 0) { - game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), game, false, true); + game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), source, game, false, true); } return preventionEffectData; } diff --git a/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java b/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java index 25d66d6245b..7a346249d5d 100644 --- a/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java +++ b/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java @@ -94,12 +94,12 @@ class VengefulPharaohTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if ((event.getType() == EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId())) + if ((event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId())) && ((DamagedEvent) event).isCombatDamage()) { if (!game.getPhase().getStep().equals(stepTriggeredPlayer) || game.getTurnNum() != turnTriggeredPlayer) { stepTriggeredPlayer = game.getPhase().getStep(); @@ -107,7 +107,7 @@ class VengefulPharaohTriggeredAbility extends TriggeredAbilityImpl { return true; } } - if (event.getType() == EventType.DAMAGED_PLANESWALKER && ((DamagedEvent) event).isCombatDamage()) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER && ((DamagedEvent) event).isCombatDamage()) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && permanent.isControlledBy(this.getControllerId())) { if (!game.getPhase().getStep().equals(stepTriggeredPlansewalker) || game.getTurnNum() != turnTriggeredPlaneswalker) { @@ -149,9 +149,9 @@ class VengefulPharaohEffect extends OneShotEffect { if (card != null && controller != null) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/v/VengefulRebirth.java b/Mage.Sets/src/mage/cards/v/VengefulRebirth.java index 5ef104cc08b..af9c45cc9fc 100644 --- a/Mage.Sets/src/mage/cards/v/VengefulRebirth.java +++ b/Mage.Sets/src/mage/cards/v/VengefulRebirth.java @@ -78,12 +78,12 @@ class VengefulRebirthEffect extends OneShotEffect { int damage = card.getConvertedManaCost(); Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.damage(damage, source.getSourceId(), game, false, true); + permanent.damage(damage, source.getSourceId(), source, game, false, true); return true; } Player targetPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (targetPlayer != null) { - targetPlayer.damage(damage, source.getSourceId(), game); + targetPlayer.damage(damage, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/VengefulWarchief.java b/Mage.Sets/src/mage/cards/v/VengefulWarchief.java index 611f1324a25..9c7889b4b97 100644 --- a/Mage.Sets/src/mage/cards/v/VengefulWarchief.java +++ b/Mage.Sets/src/mage/cards/v/VengefulWarchief.java @@ -66,7 +66,7 @@ class VengefulWarchiefTriggeredAbility extends TriggeredAbilityImpl { return false; } VengefulWarchiefWatcher watcher = game.getState().getWatcher(VengefulWarchiefWatcher.class); - return watcher != null && watcher.timesLostLifeThisTurn(event.getTargetId()) < 2; + return watcher != null && watcher.timesLostLifeThisTurn(event.getPlayerId()) < 2; } @Override @@ -91,9 +91,9 @@ class VengefulWarchiefWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.LOST_LIFE) { - int timesLifeLost = playersLostLife.getOrDefault(event.getTargetId(), 0); + int timesLifeLost = playersLostLife.getOrDefault(event.getPlayerId(), 0); timesLifeLost++; - playersLostLife.put(event.getTargetId(), timesLifeLost); + playersLostLife.put(event.getPlayerId(), timesLifeLost); } } diff --git a/Mage.Sets/src/mage/cards/v/Vengevine.java b/Mage.Sets/src/mage/cards/v/Vengevine.java index 5b52c37b3f3..88faa9f5dfb 100644 --- a/Mage.Sets/src/mage/cards/v/Vengevine.java +++ b/Mage.Sets/src/mage/cards/v/Vengevine.java @@ -64,7 +64,7 @@ class VengevineAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -97,7 +97,7 @@ class VengevineWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { condition = false; - if (event.getType() == EventType.SPELL_CAST && event.getPlayerId().equals(controllerId)) { + if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(controllerId)) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.isCreature()) { creatureSpellCount++; diff --git a/Mage.Sets/src/mage/cards/v/Venom.java b/Mage.Sets/src/mage/cards/v/Venom.java index 9932ae04016..9d4fd4d0cca 100644 --- a/Mage.Sets/src/mage/cards/v/Venom.java +++ b/Mage.Sets/src/mage/cards/v/Venom.java @@ -75,7 +75,7 @@ class VenomTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VenomousBreath.java b/Mage.Sets/src/mage/cards/v/VenomousBreath.java index 4561377e443..fadf8032d78 100644 --- a/Mage.Sets/src/mage/cards/v/VenomousBreath.java +++ b/Mage.Sets/src/mage/cards/v/VenomousBreath.java @@ -108,7 +108,7 @@ class VenomousBreathEffect extends OneShotEffect { } } for (Permanent creature : toDestroy) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java b/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java index 73781237d07..2b870926c5e 100644 --- a/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java +++ b/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java @@ -89,7 +89,7 @@ class VenserTheSojournerEffect extends OneShotEffect { if (getTargetPointer().getFirst(game, source) != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect(); effect.setText("Return it to the battlefield under your control at the beginning of the next end step"); diff --git a/Mage.Sets/src/mage/cards/v/VentifactBottle.java b/Mage.Sets/src/mage/cards/v/VentifactBottle.java index 4b0c2db6e5e..c4405f02fd9 100644 --- a/Mage.Sets/src/mage/cards/v/VentifactBottle.java +++ b/Mage.Sets/src/mage/cards/v/VentifactBottle.java @@ -80,8 +80,8 @@ class VentifactBottleEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); - sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), game); - sourcePermanent.tap(game); + sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), source, game); + sourcePermanent.tap(source, game); Mana mana = new Mana(); mana.setColorless(chargeCounters); player.getManaPool().addMana(mana, game, source); diff --git a/Mage.Sets/src/mage/cards/v/VerdantHaven.java b/Mage.Sets/src/mage/cards/v/VerdantHaven.java index 987606d5682..e424840a9a0 100644 --- a/Mage.Sets/src/mage/cards/v/VerdantHaven.java +++ b/Mage.Sets/src/mage/cards/v/VerdantHaven.java @@ -74,16 +74,19 @@ class VerdantHavenTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + return enchantedLand != null && enchantedLand.isLand(); + } + return false; } - @Override public String getRule() { return "Whenever enchanted land is tapped for mana, its controller adds one mana of any color."; diff --git a/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java b/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java index 130a1948602..f7ac090f55b 100644 --- a/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java +++ b/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java @@ -59,7 +59,7 @@ class VerdantSunsAvatarTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VeryCrypticCommandD.java b/Mage.Sets/src/mage/cards/v/VeryCrypticCommandD.java index 79c847ea792..bf4e577c0ec 100644 --- a/Mage.Sets/src/mage/cards/v/VeryCrypticCommandD.java +++ b/Mage.Sets/src/mage/cards/v/VeryCrypticCommandD.java @@ -106,9 +106,9 @@ class TurnOverEffect extends OneShotEffect { Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { if (creature.isFaceDown(game)) { - creature.turnFaceUp(game, source.getControllerId()); + creature.turnFaceUp(source, game, source.getControllerId()); } else { - creature.turnFaceDown(game, source.getControllerId()); + creature.turnFaceDown(source, game, source.getControllerId()); MageObjectReference objectReference = new MageObjectReference(creature.getId(), creature.getZoneChangeCounter(game), game); game.addEffect(new BecomesFaceDownCreatureEffect(null, objectReference, Duration.Custom, FaceDownType.MANUAL), source); } diff --git a/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java b/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java index 3c8862d80bc..f339bdd59a9 100644 --- a/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java +++ b/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java @@ -163,7 +163,7 @@ class VesuvanShapeshifterFaceDownEffect extends OneShotEffect { } } - permanent.turnFaceDown(game, source.getControllerId()); + permanent.turnFaceDown(source, game, source.getControllerId()); permanent.setManifested(false); permanent.setMorphed(true); return permanent.isFaceDown(game); diff --git a/Mage.Sets/src/mage/cards/v/VeteranBodyguard.java b/Mage.Sets/src/mage/cards/v/VeteranBodyguard.java index 987bfd6dbac..dd44206e0e4 100644 --- a/Mage.Sets/src/mage/cards/v/VeteranBodyguard.java +++ b/Mage.Sets/src/mage/cards/v/VeteranBodyguard.java @@ -75,7 +75,7 @@ class VeteranBodyguardEffect extends PreventionEffectImpl { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + permanent.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/v/Vex.java b/Mage.Sets/src/mage/cards/v/Vex.java index 6290902bd33..fb3566ccaca 100644 --- a/Mage.Sets/src/mage/cards/v/Vex.java +++ b/Mage.Sets/src/mage/cards/v/Vex.java @@ -61,11 +61,11 @@ class VexEffect extends OneShotEffect { controller = game.getPlayer(game.getControllerId(targetId)); } if (targetId != null - && game.getStack().counter(targetId, source.getSourceId(), game)) { + && game.getStack().counter(targetId, source, game)) { countered = true; } if (controller != null) { - controller.drawCards(1, source.getSourceId(), game); + controller.drawCards(1, source, game); } return countered; } diff --git a/Mage.Sets/src/mage/cards/v/VexingArcanix.java b/Mage.Sets/src/mage/cards/v/VexingArcanix.java index 742e51c56ae..a897472bf81 100644 --- a/Mage.Sets/src/mage/cards/v/VexingArcanix.java +++ b/Mage.Sets/src/mage/cards/v/VexingArcanix.java @@ -78,7 +78,7 @@ class VexingArcanixEffect extends OneShotEffect { player.moveCards(cards, Zone.HAND, source, game); } else { player.moveCards(cards, Zone.GRAVEYARD, source, game); - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/VexingDevil.java b/Mage.Sets/src/mage/cards/v/VexingDevil.java index 0d72c7dab8a..e7a2e6cd9fa 100644 --- a/Mage.Sets/src/mage/cards/v/VexingDevil.java +++ b/Mage.Sets/src/mage/cards/v/VexingDevil.java @@ -61,8 +61,8 @@ class VexingDevilEffect extends OneShotEffect { Player opponent = game.getPlayer(opponentUuid); if (opponent != null && opponent.chooseUse(Outcome.LoseLife, "Make " + permanent.getLogName() + " deal 4 damage to you?", source, game)) { game.informPlayers(opponent.getLogName() + " has chosen to receive 4 damage from " + permanent.getLogName()); - opponent.damage(4, permanent.getId(), game); - permanent.sacrifice(source.getSourceId(), game); + opponent.damage(4, permanent.getId(), source, game); + permanent.sacrifice(source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/v/VexingShusher.java b/Mage.Sets/src/mage/cards/v/VexingShusher.java index c82812672ea..1a320516344 100644 --- a/Mage.Sets/src/mage/cards/v/VexingShusher.java +++ b/Mage.Sets/src/mage/cards/v/VexingShusher.java @@ -85,7 +85,7 @@ class VexingShusherCantCounterTargetEffect extends ContinuousRuleModifyingEffect @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER; + return event.getType() == GameEvent.EventType.COUNTER; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VialSmasherTheFierce.java b/Mage.Sets/src/mage/cards/v/VialSmasherTheFierce.java index 44fa6ef443c..ce196d78124 100644 --- a/Mage.Sets/src/mage/cards/v/VialSmasherTheFierce.java +++ b/Mage.Sets/src/mage/cards/v/VialSmasherTheFierce.java @@ -141,12 +141,12 @@ class VialSmasherTheFierceEffect extends OneShotEffect { if (target.choose(Outcome.Damage, controller.getId(), source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - return permanent.damage(damage, source.getSourceId(), game, false, true) > 0; + return permanent.damage(damage, source.getSourceId(), source, game, false, true) > 0; } } } } - opponent.damage(damage, source.getSourceId(), game); + opponent.damage(damage, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/ViashinoHeretic.java b/Mage.Sets/src/mage/cards/v/ViashinoHeretic.java index 478d23a82a6..ea8c3999c70 100644 --- a/Mage.Sets/src/mage/cards/v/ViashinoHeretic.java +++ b/Mage.Sets/src/mage/cards/v/ViashinoHeretic.java @@ -72,9 +72,9 @@ class ViashinoHereticEffect extends OneShotEffect { if (permanent != null) { int couvertedManaCost = permanent.getConvertedManaCost(); Player player = game.getPlayer(permanent.getControllerId()); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (player != null) { - player.damage(couvertedManaCost, source.getSourceId(), game); + player.damage(couvertedManaCost, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/Victimize.java b/Mage.Sets/src/mage/cards/v/Victimize.java index 159bbf14b3b..78cca0d256d 100644 --- a/Mage.Sets/src/mage/cards/v/Victimize.java +++ b/Mage.Sets/src/mage/cards/v/Victimize.java @@ -63,7 +63,7 @@ class VictimizeEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { game.getState().processAction(game); // To end effects of the sacrificed creature controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); diff --git a/Mage.Sets/src/mage/cards/v/VigilForTheLost.java b/Mage.Sets/src/mage/cards/v/VigilForTheLost.java index 41b030ed94e..aae15ab942a 100644 --- a/Mage.Sets/src/mage/cards/v/VigilForTheLost.java +++ b/Mage.Sets/src/mage/cards/v/VigilForTheLost.java @@ -58,7 +58,7 @@ class VigilForTheLostTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -93,7 +93,7 @@ class VigilForTheLostEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { ManaCostsImpl cost = new ManaCostsImpl("{X}"); cost.clearPaid(); - if (cost.payOrRollback(source, game, source.getSourceId(), source.getControllerId())) { + if (cost.payOrRollback(source, game, source, source.getControllerId())) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(cost.getX(), game, source); diff --git a/Mage.Sets/src/mage/cards/v/Vigor.java b/Mage.Sets/src/mage/cards/v/Vigor.java index 10296ede3b1..4be622e1caa 100644 --- a/Mage.Sets/src/mage/cards/v/Vigor.java +++ b/Mage.Sets/src/mage/cards/v/Vigor.java @@ -15,6 +15,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import java.util.UUID; @@ -65,7 +66,7 @@ class VigorReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new PreventDamageEvent(source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int preventedDamage = event.getAmount(); event.setAmount(0); @@ -73,7 +74,7 @@ class VigorReplacementEffect extends ReplacementEffectImpl { if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(preventedDamage), source, game); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), preventedDamage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), preventedDamage)); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/v/VigorousCharge.java b/Mage.Sets/src/mage/cards/v/VigorousCharge.java index fccee6d9cb2..443482c2342 100644 --- a/Mage.Sets/src/mage/cards/v/VigorousCharge.java +++ b/Mage.Sets/src/mage/cards/v/VigorousCharge.java @@ -70,9 +70,9 @@ class VigorousChargeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLAYER - || event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VillageCannibals.java b/Mage.Sets/src/mage/cards/v/VillageCannibals.java index ea6af443dd0..10791bff766 100644 --- a/Mage.Sets/src/mage/cards/v/VillageCannibals.java +++ b/Mage.Sets/src/mage/cards/v/VillageCannibals.java @@ -61,7 +61,7 @@ class VillageCannibalsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/v/ViridianRevel.java b/Mage.Sets/src/mage/cards/v/ViridianRevel.java index 4d83d83f63c..1e832e007ab 100644 --- a/Mage.Sets/src/mage/cards/v/ViridianRevel.java +++ b/Mage.Sets/src/mage/cards/v/ViridianRevel.java @@ -56,7 +56,7 @@ class ViridianRevelTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VirtussManeuver.java b/Mage.Sets/src/mage/cards/v/VirtussManeuver.java index e122eaf4de3..3fc40c8dec2 100644 --- a/Mage.Sets/src/mage/cards/v/VirtussManeuver.java +++ b/Mage.Sets/src/mage/cards/v/VirtussManeuver.java @@ -107,7 +107,7 @@ class VirtussManeuverEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/VirulentWound.java b/Mage.Sets/src/mage/cards/v/VirulentWound.java index da3fa83f05b..d79420c1801 100644 --- a/Mage.Sets/src/mage/cards/v/VirulentWound.java +++ b/Mage.Sets/src/mage/cards/v/VirulentWound.java @@ -86,7 +86,7 @@ class VirulentWoundDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override @@ -136,7 +136,7 @@ class VirulentWoundDelayedEffect extends OneShotEffect { if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.addCounters(CounterType.POISON.createInstance(1), game); + player.addCounters(CounterType.POISON.createInstance(1), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/v/Viseling.java b/Mage.Sets/src/mage/cards/v/Viseling.java index ee96de41035..a91c3697488 100644 --- a/Mage.Sets/src/mage/cards/v/Viseling.java +++ b/Mage.Sets/src/mage/cards/v/Viseling.java @@ -64,7 +64,7 @@ class ViselingEffect extends OneShotEffect { if (opponent != null) { int xValue = opponent.getHand().size() - 4; if (xValue > 0) { - opponent.damage(xValue, source.getSourceId(), game); + opponent.damage(xValue, source.getSourceId(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/VishKalBloodArbiter.java b/Mage.Sets/src/mage/cards/v/VishKalBloodArbiter.java index fc5e0831ea2..8d22bb3fdb4 100644 --- a/Mage.Sets/src/mage/cards/v/VishKalBloodArbiter.java +++ b/Mage.Sets/src/mage/cards/v/VishKalBloodArbiter.java @@ -78,9 +78,9 @@ enum VishKalBloodArbiterDynamicValue implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - for (Cost cost : source.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof RemoveAllCountersSourceCost) { count += ((RemoveAllCountersSourceCost) cost).getRemovedCounters(); } diff --git a/Mage.Sets/src/mage/cards/v/VisionsOfBeyond.java b/Mage.Sets/src/mage/cards/v/VisionsOfBeyond.java index 59f51ea1b90..127c89772fb 100644 --- a/Mage.Sets/src/mage/cards/v/VisionsOfBeyond.java +++ b/Mage.Sets/src/mage/cards/v/VisionsOfBeyond.java @@ -59,7 +59,7 @@ class VisionsOfBeyondEffect extends OneShotEffect { } } } - sourcePlayer.drawCards(count, source.getSourceId(), game); + sourcePlayer.drawCards(count, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/v/VisionsOfBrutality.java b/Mage.Sets/src/mage/cards/v/VisionsOfBrutality.java index 1a3d9f66574..6a82cd60afd 100644 --- a/Mage.Sets/src/mage/cards/v/VisionsOfBrutality.java +++ b/Mage.Sets/src/mage/cards/v/VisionsOfBrutality.java @@ -92,7 +92,7 @@ class VisionsOfBrutalityEffect extends OneShotEffect { if (controllerEnchanted != null) { int damage = (Integer) getValue("damage"); if (damage > 0) { - controllerEnchanted.loseLife(damage, game, false); + controllerEnchanted.loseLife(damage, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java b/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java index 3964e955a64..79dd0e089ad 100644 --- a/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java +++ b/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java @@ -101,7 +101,7 @@ class VivienMonstersAdvocateTokenEffect extends OneShotEffect { if (player == null) { return false; } - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); for (UUID tokenId : token.getLastAddedTokenIds()) { Permanent permanent = game.getPermanent(tokenId); if (permanent == null) { diff --git a/Mage.Sets/src/mage/cards/v/ViviensInvocation.java b/Mage.Sets/src/mage/cards/v/ViviensInvocation.java index b3ed065a12c..64fc2b88ea0 100644 --- a/Mage.Sets/src/mage/cards/v/ViviensInvocation.java +++ b/Mage.Sets/src/mage/cards/v/ViviensInvocation.java @@ -128,6 +128,6 @@ class ViviensInvocationDamageEffect extends OneShotEffect { if (creature == null || permanent == null) { return false; } - return creature.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true) > 0; + return creature.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true) > 0; } } diff --git a/Mage.Sets/src/mage/cards/v/VizierOfDeferment.java b/Mage.Sets/src/mage/cards/v/VizierOfDeferment.java index 33389b3b540..68528ba7ea4 100644 --- a/Mage.Sets/src/mage/cards/v/VizierOfDeferment.java +++ b/Mage.Sets/src/mage/cards/v/VizierOfDeferment.java @@ -87,7 +87,7 @@ class VizierOfDefermentEffect extends OneShotEffect { if (controller != null && attackedOrBlocked && sourcePermanent != null) { - if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source, game, Zone.BATTLEFIELD, true)) { Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step"); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game)); diff --git a/Mage.Sets/src/mage/cards/v/VizierOfTheTrue.java b/Mage.Sets/src/mage/cards/v/VizierOfTheTrue.java index a3ad8f87af9..51d6f0d3fcb 100644 --- a/Mage.Sets/src/mage/cards/v/VizierOfTheTrue.java +++ b/Mage.Sets/src/mage/cards/v/VizierOfTheTrue.java @@ -73,7 +73,7 @@ class VizierOfTheTrueAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BECOMES_EXERTED; + return event.getType() == GameEvent.EventType.BECOMES_EXERTED; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VizkopaConfessor.java b/Mage.Sets/src/mage/cards/v/VizkopaConfessor.java index f9d392e22c1..78c15ca1c0f 100644 --- a/Mage.Sets/src/mage/cards/v/VizkopaConfessor.java +++ b/Mage.Sets/src/mage/cards/v/VizkopaConfessor.java @@ -81,7 +81,7 @@ class VizkopaConfessorEffect extends OneShotEffect { if (controller != null && targetPlayer != null && sourceCard != null) { int payLife = controller.getAmount(0, controller.getLife(),"Pay how many life?", game); if (payLife > 0) { - controller.loseLife(payLife, game, false); + controller.loseLife(payLife, game, source, false); game.informPlayers(sourceCard.getName() + ": " + controller.getLogName() + " pays " + payLife + " life"); Cards cardsInHand = new CardsImpl(); @@ -109,7 +109,7 @@ class VizkopaConfessorEffect extends OneShotEffect { controller.chooseTarget(Outcome.Exile, revealedCards, targetInHand, source, game); Card card = revealedCards.get(targetInHand.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, null, null, source, game, Zone.HAND, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/VizkopaGuildmage.java b/Mage.Sets/src/mage/cards/v/VizkopaGuildmage.java index 956949d553b..f1cd7fa3ac2 100644 --- a/Mage.Sets/src/mage/cards/v/VizkopaGuildmage.java +++ b/Mage.Sets/src/mage/cards/v/VizkopaGuildmage.java @@ -80,7 +80,7 @@ class VizkopaGuildmageDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override @@ -126,7 +126,7 @@ class OpponentsLoseLifeEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.loseLife(amountLifeGained, game, false); + opponent.loseLife(amountLifeGained, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/v/VodalianWarMachine.java b/Mage.Sets/src/mage/cards/v/VodalianWarMachine.java index eaa0fb74249..054c36bc313 100644 --- a/Mage.Sets/src/mage/cards/v/VodalianWarMachine.java +++ b/Mage.Sets/src/mage/cards/v/VodalianWarMachine.java @@ -145,7 +145,7 @@ class VodalianWarMachineEffect extends OneShotEffect { if (watcher != null && watcher.getTappedMerfolkIds(sourcePermanent, game) != null) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (watcher.getTappedMerfolkIds(sourcePermanent, game).contains(new MageObjectReference(permanent, game))) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/Void.java b/Mage.Sets/src/mage/cards/v/Void.java index 71c053f17ca..ca6939c47ff 100644 --- a/Mage.Sets/src/mage/cards/v/Void.java +++ b/Mage.Sets/src/mage/cards/v/Void.java @@ -70,7 +70,7 @@ class VoidEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if ((permanent.isArtifact() || permanent.isCreature()) && permanent.getConvertedManaCost() == number) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } FilterCard filterCard = new FilterCard(); @@ -82,7 +82,7 @@ class VoidEffect extends OneShotEffect { return true; } targetPlayer.revealCards(source, targetPlayer.getHand(), game); - targetPlayer.discard(new CardsImpl(targetPlayer.getHand().getCards(filterCard, game)), source, game); + targetPlayer.discard(new CardsImpl(targetPlayer.getHand().getCards(filterCard, game)), false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/v/VoidMaw.java b/Mage.Sets/src/mage/cards/v/VoidMaw.java index 02758747d53..5e0049d428d 100644 --- a/Mage.Sets/src/mage/cards/v/VoidMaw.java +++ b/Mage.Sets/src/mage/cards/v/VoidMaw.java @@ -132,7 +132,7 @@ class VoidMawCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { TargetCardInExile target = new TargetCardInExile(new FilterCard(), CardUtil.getCardExileZoneId(game, ability)); @@ -142,7 +142,7 @@ class VoidMawCost extends CostImpl { && controller.choose(Outcome.Benefit, cards, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - if (controller.moveCardToGraveyardWithInfo(card, sourceId, game, Zone.EXILED)) { + if (controller.moveCardToGraveyardWithInfo(card, source, game, Zone.EXILED)) { paid = true; } } @@ -152,7 +152,7 @@ class VoidMawCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); return player != null; } diff --git a/Mage.Sets/src/mage/cards/v/VoidWinnower.java b/Mage.Sets/src/mage/cards/v/VoidWinnower.java index 704de660dc3..1ced3591a51 100644 --- a/Mage.Sets/src/mage/cards/v/VoidWinnower.java +++ b/Mage.Sets/src/mage/cards/v/VoidWinnower.java @@ -78,7 +78,7 @@ class VoidWinnowerCantCastEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.CAST_SPELL_LATE; + return event.getType() == GameEvent.EventType.CAST_SPELL_LATE; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java b/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java index 16294ad597d..9bad4004188 100644 --- a/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java +++ b/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java @@ -124,7 +124,7 @@ class VoidstoneGargoyleRuleModifyingEffect2 extends ContinuousRuleModifyingEffec @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.ACTIVATE_ABILITY) { + if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { MageObject object = game.getObject(event.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); return CardUtil.haveSameNames(object, cardName, game); diff --git a/Mage.Sets/src/mage/cards/v/Voidwalk.java b/Mage.Sets/src/mage/cards/v/Voidwalk.java index 17890ff0e2d..b4de9d50c1a 100644 --- a/Mage.Sets/src/mage/cards/v/Voidwalk.java +++ b/Mage.Sets/src/mage/cards/v/Voidwalk.java @@ -63,7 +63,7 @@ class VoidwalkEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && permanent != null && sourceObject != null) { - if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step"); diff --git a/Mage.Sets/src/mage/cards/v/VolatileRig.java b/Mage.Sets/src/mage/cards/v/VolatileRig.java index cd5be00e171..3a58c9350c4 100644 --- a/Mage.Sets/src/mage/cards/v/VolatileRig.java +++ b/Mage.Sets/src/mage/cards/v/VolatileRig.java @@ -76,8 +76,8 @@ class VolatileRigTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.COMBAT_DAMAGE_STEP_POST - || event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST + || event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -87,7 +87,7 @@ class VolatileRigTriggeredAbility extends TriggeredAbilityImpl { * (for example, multiple blocking creatures), its first triggered ability * will trigger only once. */ - if (triggerdThisCombatStep && event.getType() == EventType.COMBAT_DAMAGE_STEP_POST) { + if (triggerdThisCombatStep && event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST) { triggerdThisCombatStep = false; } @@ -128,7 +128,7 @@ class VolatileRigEffect extends OneShotEffect { if (!player.flipCoin(source, game, true)) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } } @@ -160,12 +160,12 @@ class VolatileRigEffect2 extends OneShotEffect { List permanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { - permanent.damage(4, source.getSourceId(), game, false, true); + permanent.damage(4, source.getSourceId(), source, game, false, true); } for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) { Player damageToPlayer = game.getPlayer(playerId); if (damageToPlayer != null) { - damageToPlayer.damage(4, source.getSourceId(), game); + damageToPlayer.damage(4, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/VolcanicEruption.java b/Mage.Sets/src/mage/cards/v/VolcanicEruption.java index be3f0ca67ec..73e1851e16b 100644 --- a/Mage.Sets/src/mage/cards/v/VolcanicEruption.java +++ b/Mage.Sets/src/mage/cards/v/VolcanicEruption.java @@ -78,7 +78,7 @@ class VolcanicEruptionEffect extends OneShotEffect { for (UUID targetID : this.targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(targetID); if (permanent != null) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) { destroyedCount++; } @@ -89,12 +89,12 @@ class VolcanicEruptionEffect extends OneShotEffect { if (destroyedCount > 0) { List permanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { - permanent.damage(destroyedCount, source.getSourceId(), game, false, true); + permanent.damage(destroyedCount, source.getSourceId(), source, game, false, true); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(destroyedCount, source.getSourceId(), game); + player.damage(destroyedCount, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/v/VolcanicOffering.java b/Mage.Sets/src/mage/cards/v/VolcanicOffering.java index d329a5f05b5..e209ef2e464 100644 --- a/Mage.Sets/src/mage/cards/v/VolcanicOffering.java +++ b/Mage.Sets/src/mage/cards/v/VolcanicOffering.java @@ -96,19 +96,19 @@ class VolcanicOfferingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } permanent = game.getPermanent(source.getTargets().get(2).getFirstTarget()); if (permanent != null) { - permanent.damage(7, source.getSourceId(), game, false, true); + permanent.damage(7, source.getSourceId(), source, game, false, true); } permanent = game.getPermanent(source.getTargets().get(3).getFirstTarget()); if (permanent != null) { - permanent.damage(7, source.getSourceId(), game, false, true); + permanent.damage(7, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/VolcanicVision.java b/Mage.Sets/src/mage/cards/v/VolcanicVision.java index e39bb3ec4fc..cf0da4f36b9 100644 --- a/Mage.Sets/src/mage/cards/v/VolcanicVision.java +++ b/Mage.Sets/src/mage/cards/v/VolcanicVision.java @@ -81,7 +81,7 @@ class VolcanicVisionReturnToHandTargetEffect extends OneShotEffect { int damage = card.getConvertedManaCost(); if (damage > 0) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - creature.damage(damage, source.getSourceId(), game, false, true); + creature.damage(damage, source.getSourceId(), source, game, false, true); } } } diff --git a/Mage.Sets/src/mage/cards/v/VolcanoHellion.java b/Mage.Sets/src/mage/cards/v/VolcanoHellion.java index b8bd54d50e2..13cf023815a 100644 --- a/Mage.Sets/src/mage/cards/v/VolcanoHellion.java +++ b/Mage.Sets/src/mage/cards/v/VolcanoHellion.java @@ -74,9 +74,9 @@ class VolcanoHellionEffect extends OneShotEffect { if (controller != null) { int amount = controller.getAmount(0, Integer.MAX_VALUE, "Choose the amount of damage to deliver to you and a target creature. The damage can't be prevented.", game); if (amount > 0) { - controller.damage(amount, source.getSourceId(), game, false, false); + controller.damage(amount, source.getSourceId(), source, game, false, false); if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, false); + permanent.damage(amount, source.getSourceId(), source, game, false, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java b/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java index d4730a4938c..eac9796c9d0 100644 --- a/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java +++ b/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java @@ -20,9 +20,11 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; +import mage.game.events.GameEvent; import mage.players.Player; import mage.target.TargetPlayer; import mage.target.common.TargetCardInHand; +import mage.util.CardUtil; import java.util.UUID; @@ -79,23 +81,24 @@ class PayLifeActivePlayerCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { int lifeToPayAmount = amount.calculate(game, ability, null); return game.getPlayer(game.getActivePlayerId()).getLife() >= lifeToPayAmount; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - int lifeToPayAmount = amount.calculate(game, ability, null); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player activatingPlayer = game.getPlayer(game.getActivePlayerId()); - if (activatingPlayer != null - && activatingPlayer.chooseUse(Outcome.LoseLife, "Do you wish to pay " + lifeToPayAmount + " life?", ability, game)) { - Player player = game.getPlayer(game.getActivePlayerId()); - if (player != null) { - this.paid = player.loseLife(lifeToPayAmount, game, false) == lifeToPayAmount; - } + if (activatingPlayer == null) { + return false; } - return paid; + + int lifeToPayAmount = amount.calculate(game, ability, null); + if (activatingPlayer.chooseUse(Outcome.LoseLife, "Do you wish to pay " + lifeToPayAmount + " life?", ability, game)) { + this.paid = CardUtil.tryPayLife(lifeToPayAmount, activatingPlayer, source, game); + return this.paid; + } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java b/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java index 3ddb23ac0cb..a2957fd08ff 100644 --- a/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java +++ b/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java @@ -75,6 +75,6 @@ class VolrathsLaboratoryEffect extends OneShotEffect { ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game); Token token = new VolrathsLaboratoryToken(color, subType); - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return token.putOntoBattlefield(1, game, source, source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/v/VonasHunger.java b/Mage.Sets/src/mage/cards/v/VonasHunger.java index b9044e81006..607de5d6376 100644 --- a/Mage.Sets/src/mage/cards/v/VonasHunger.java +++ b/Mage.Sets/src/mage/cards/v/VonasHunger.java @@ -82,7 +82,7 @@ class VonasHungerEffect extends OneShotEffect { int numTargets = (game.getBattlefield().countAll(StaticFilters.FILTER_CONTROLLED_CREATURE, player.getId(), game) + 1) / 2; if (numTargets > 0) { TargetPermanent target = new TargetPermanent(numTargets, numTargets, StaticFilters.FILTER_CONTROLLED_CREATURE, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -92,7 +92,7 @@ class VonasHungerEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/VoyagerStaff.java b/Mage.Sets/src/mage/cards/v/VoyagerStaff.java index f25ac1c5c75..bc9b4824013 100644 --- a/Mage.Sets/src/mage/cards/v/VoyagerStaff.java +++ b/Mage.Sets/src/mage/cards/v/VoyagerStaff.java @@ -63,7 +63,7 @@ class VoyagerStaffEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && creature != null && sourcePermanent != null) { - if (controller.moveCardToExileWithInfo(creature, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(creature, source.getSourceId(), sourcePermanent.getIdName(), source, game, Zone.BATTLEFIELD, true)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true); effect.setText("Return the exiled card to the battlefield under its owner's control at the beginning of the next end step"); diff --git a/Mage.Sets/src/mage/cards/v/VraskaRelicSeeker.java b/Mage.Sets/src/mage/cards/v/VraskaRelicSeeker.java index 9a792d8e08a..9607a75ce61 100644 --- a/Mage.Sets/src/mage/cards/v/VraskaRelicSeeker.java +++ b/Mage.Sets/src/mage/cards/v/VraskaRelicSeeker.java @@ -81,7 +81,7 @@ class VraskaRelicSeekerDestroyEffect extends OneShotEffect { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return new CreateTokenEffect(new TreasureToken()).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/v/VraskaTheUnseen.java b/Mage.Sets/src/mage/cards/v/VraskaTheUnseen.java index 3cc609ca21e..dc46a0d499d 100644 --- a/Mage.Sets/src/mage/cards/v/VraskaTheUnseen.java +++ b/Mage.Sets/src/mage/cards/v/VraskaTheUnseen.java @@ -115,7 +115,7 @@ class VraskaTheUnseenTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLANESWALKER; + return event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; } @Override diff --git a/Mage.Sets/src/mage/cards/v/VraskasStoneglare.java b/Mage.Sets/src/mage/cards/v/VraskasStoneglare.java index 7c849798bc0..584df94dba8 100644 --- a/Mage.Sets/src/mage/cards/v/VraskasStoneglare.java +++ b/Mage.Sets/src/mage/cards/v/VraskasStoneglare.java @@ -73,7 +73,7 @@ class VraskasStoneglareEffect extends OneShotEffect { } Player player = game.getPlayer(source.getControllerId()); int toughness = permanent.getToughness().getValue(); - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); if (player != null) { player.gainLife(toughness, game, source); } diff --git a/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java b/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java index 9ebc82afd9a..7ab799806f7 100644 --- a/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java +++ b/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java @@ -68,8 +68,8 @@ public final class VulshokBattlemaster extends CardImpl { for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) { if (equipment != null) { //If an Equipment can't equip Vulshok Battlemaster, it isn't attached to the Battlemaster, and it doesn't become unattached (if it's attached to a creature). (https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125) - if (!battlemaster.cantBeAttachedBy(equipment, game, false)) { - battlemaster.addAttachment(equipment.getId(), game); + if (!battlemaster.cantBeAttachedBy(equipment, source, game, false)) { + battlemaster.addAttachment(equipment.getId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/WaitingInTheWeeds.java b/Mage.Sets/src/mage/cards/w/WaitingInTheWeeds.java index 114c0fa8132..f0ade85e64d 100644 --- a/Mage.Sets/src/mage/cards/w/WaitingInTheWeeds.java +++ b/Mage.Sets/src/mage/cards/w/WaitingInTheWeeds.java @@ -70,7 +70,7 @@ class WaitingInTheWeedsEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Token token = new GreenCatToken(); int amount = game.getBattlefield().getAllActivePermanents(filter, playerId, game).size(); - token.putOntoBattlefield(amount, game, source.getSourceId(), playerId); + token.putOntoBattlefield(amount, game, source, playerId); } return true; } diff --git a/Mage.Sets/src/mage/cards/w/WakeThrasher.java b/Mage.Sets/src/mage/cards/w/WakeThrasher.java index cea61f17380..1e64046483a 100644 --- a/Mage.Sets/src/mage/cards/w/WakeThrasher.java +++ b/Mage.Sets/src/mage/cards/w/WakeThrasher.java @@ -62,7 +62,7 @@ class BecomesUntappedControlledPermanentTriggeredAbility extends TriggeredAbilit @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAPPED; + return event.getType() == GameEvent.EventType.UNTAPPED; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WallOfEssence.java b/Mage.Sets/src/mage/cards/w/WallOfEssence.java index 2f431f64876..8484c82b6d5 100644 --- a/Mage.Sets/src/mage/cards/w/WallOfEssence.java +++ b/Mage.Sets/src/mage/cards/w/WallOfEssence.java @@ -65,7 +65,7 @@ class WallOfEssenceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WallOfHope.java b/Mage.Sets/src/mage/cards/w/WallOfHope.java index 81b265ff398..926c06e5930 100644 --- a/Mage.Sets/src/mage/cards/w/WallOfHope.java +++ b/Mage.Sets/src/mage/cards/w/WallOfHope.java @@ -64,7 +64,7 @@ class WallOfHopeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WallOfLimbs.java b/Mage.Sets/src/mage/cards/w/WallOfLimbs.java index 779944f27dd..286533a113e 100644 --- a/Mage.Sets/src/mage/cards/w/WallOfLimbs.java +++ b/Mage.Sets/src/mage/cards/w/WallOfLimbs.java @@ -80,7 +80,7 @@ class WallOfLimbsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.GAINED_LIFE; + return event.getType() == GameEvent.EventType.GAINED_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WallOfSouls.java b/Mage.Sets/src/mage/cards/w/WallOfSouls.java index 64712ff31b6..ea4373e90e3 100644 --- a/Mage.Sets/src/mage/cards/w/WallOfSouls.java +++ b/Mage.Sets/src/mage/cards/w/WallOfSouls.java @@ -67,7 +67,7 @@ class WallOfSoulsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE; } @Override @@ -105,7 +105,7 @@ class WallOfSoulsDealDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = (Integer) getValue("damage"); if (amount > 0) { - return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), amount, source.getSourceId(), game, false, true) > 0; + return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), amount, source.getSourceId(), source, game, false, true) > 0; } return false; } diff --git a/Mage.Sets/src/mage/cards/w/WallOfStolenIdentity.java b/Mage.Sets/src/mage/cards/w/WallOfStolenIdentity.java index 845850f9fa3..ce8d7819e00 100644 --- a/Mage.Sets/src/mage/cards/w/WallOfStolenIdentity.java +++ b/Mage.Sets/src/mage/cards/w/WallOfStolenIdentity.java @@ -122,7 +122,7 @@ class WallOfStolenIdentityCopyEffect extends OneShotEffect { } }); - copyFromPermanent.tap(game); + copyFromPermanent.tap(source, game); // Incredibly, you can't just add a fixed target to a continuousrulemodifyingeffect, thus the workaround. ContinuousRuleModifyingEffect effect = new DontUntapInControllersUntapStepSourceEffect(); Ability ability = new SimpleStaticAbility(effect); diff --git a/Mage.Sets/src/mage/cards/w/WandOfDenial.java b/Mage.Sets/src/mage/cards/w/WandOfDenial.java index a30a6cd70bf..9798c264f1e 100644 --- a/Mage.Sets/src/mage/cards/w/WandOfDenial.java +++ b/Mage.Sets/src/mage/cards/w/WandOfDenial.java @@ -72,7 +72,7 @@ class WandOfDenialEffect extends OneShotEffect { && controller.canPayLifeCost(source) && controller.getLife() >= 2 && controller.chooseUse(Outcome.Neutral, "Pay 2 life to put " + card.getLogName() + " into graveyard?", source, game)) { - controller.loseLife(2, game, false); + controller.loseLife(2, game, source, false); controller.moveCards(card, Zone.GRAVEYARD, source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/w/WandOfIth.java b/Mage.Sets/src/mage/cards/w/WandOfIth.java index 5f689e14575..f0d914b31e3 100644 --- a/Mage.Sets/src/mage/cards/w/WandOfIth.java +++ b/Mage.Sets/src/mage/cards/w/WandOfIth.java @@ -68,12 +68,12 @@ class WandOfIthEffect extends OneShotEffect { player.revealCards(sourcePermanent.getName(), revealed, game); int lifeToPay = card.isLand() ? 1 : card.getConvertedManaCost(); PayLifeCost cost = new PayLifeCost(lifeToPay); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(outcome, "Pay " + lifeToPay + " life to prevent discarding " + card.getLogName() + "?", source, game) - && cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + && cost.pay(source, game, source, player.getId(), false, null)) { game.informPlayers(player.getLogName() + " has paid " + lifeToPay + " life to prevent discarding " + card.getLogName() + " (" + sourcePermanent.getLogName() + ')'); } else { - player.discard(card, source, game); + player.discard(card, false, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WanderingMage.java b/Mage.Sets/src/mage/cards/w/WanderingMage.java index 71ab5592c05..ef6c79dc0bf 100644 --- a/Mage.Sets/src/mage/cards/w/WanderingMage.java +++ b/Mage.Sets/src/mage/cards/w/WanderingMage.java @@ -93,12 +93,12 @@ class WanderingMageCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget()); if (permanent != null) { permanent.addCounters(CounterType.M1M1.createInstance(), ability, game); diff --git a/Mage.Sets/src/mage/cards/w/WarCadence.java b/Mage.Sets/src/mage/cards/w/WarCadence.java index 703925733f5..2a71ced9e79 100644 --- a/Mage.Sets/src/mage/cards/w/WarCadence.java +++ b/Mage.Sets/src/mage/cards/w/WarCadence.java @@ -63,9 +63,9 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl { if (amount > 0) { String mana = "{" + amount + '}'; ManaCostsImpl cost = new ManaCostsImpl(mana); - if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) + if (cost.canPay(source, source, event.getPlayerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare blocker?", source, game)) { - if (cost.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) { + if (cost.payOrRollback(source, game, source, event.getPlayerId())) { return false; } } diff --git a/Mage.Sets/src/mage/cards/w/WarElemental.java b/Mage.Sets/src/mage/cards/w/WarElemental.java index 08fdeccdaa5..664e0129599 100644 --- a/Mage.Sets/src/mage/cards/w/WarElemental.java +++ b/Mage.Sets/src/mage/cards/w/WarElemental.java @@ -70,7 +70,7 @@ class WarElementalTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WarrenPilferers.java b/Mage.Sets/src/mage/cards/w/WarrenPilferers.java index 8c410594253..3bbb1a1c068 100644 --- a/Mage.Sets/src/mage/cards/w/WarrenPilferers.java +++ b/Mage.Sets/src/mage/cards/w/WarrenPilferers.java @@ -66,7 +66,7 @@ class WarrenPilferersReturnEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getFirstTarget()); if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); if (card.hasSubtype(SubType.GOBLIN, game)) { game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source); } diff --git a/Mage.Sets/src/mage/cards/w/WarrenWeirding.java b/Mage.Sets/src/mage/cards/w/WarrenWeirding.java index 06de8220b67..0e85fef1aa7 100644 --- a/Mage.Sets/src/mage/cards/w/WarrenWeirding.java +++ b/Mage.Sets/src/mage/cards/w/WarrenWeirding.java @@ -83,11 +83,11 @@ class WarrenWeirdingEffect extends OneShotEffect { //A spell or ability could have removed the only legal target this player //had, if thats the case this ability should fizzle. - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); if (filterGoblin.match(permanent, game)) { for (int i = 0; i < 2; i++) { Token token = new GoblinRogueToken(); diff --git a/Mage.Sets/src/mage/cards/w/WarsToll.java b/Mage.Sets/src/mage/cards/w/WarsToll.java index d83011a4233..12cf9ce1850 100644 --- a/Mage.Sets/src/mage/cards/w/WarsToll.java +++ b/Mage.Sets/src/mage/cards/w/WarsToll.java @@ -70,7 +70,7 @@ class WarsTollTapEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { if (getTargetPointer().getFirst(game, source) != null) { game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_LAND, getTargetPointer().getFirst(game, source), game).forEach((permanent) -> { - permanent.tap(game); + permanent.tap(source, game); }); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WarstormSurge.java b/Mage.Sets/src/mage/cards/w/WarstormSurge.java index 772327b1c0a..4d67bea988b 100644 --- a/Mage.Sets/src/mage/cards/w/WarstormSurge.java +++ b/Mage.Sets/src/mage/cards/w/WarstormSurge.java @@ -54,7 +54,7 @@ class WarstormSurgeTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override @@ -106,12 +106,12 @@ class WarstormSurgeEffect extends OneShotEffect { UUID target = source.getTargets().getFirstTarget(); Permanent targetCreature = game.getPermanent(target); if (targetCreature != null) { - targetCreature.damage(amount, creature.getId(), game, false, true); + targetCreature.damage(amount, creature.getId(), source, game, false, true); return true; } Player player = game.getPlayer(target); if (player != null) { - player.damage(amount, creature.getId(), game); + player.damage(amount, creature.getId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/w/WashOut.java b/Mage.Sets/src/mage/cards/w/WashOut.java index 5c9cf86c26e..77b14182a03 100644 --- a/Mage.Sets/src/mage/cards/w/WashOut.java +++ b/Mage.Sets/src/mage/cards/w/WashOut.java @@ -69,7 +69,7 @@ class WashOutEffect extends OneShotEffect { FilterPermanent filter = new FilterPermanent(); filter.add(new ColorPredicate(color)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true); + permanent.moveToZone(Zone.HAND, source, game, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/w/WasitoraNekoruQueen.java b/Mage.Sets/src/mage/cards/w/WasitoraNekoruQueen.java index 19b42c19fc7..6ff35a0ddac 100644 --- a/Mage.Sets/src/mage/cards/w/WasitoraNekoruQueen.java +++ b/Mage.Sets/src/mage/cards/w/WasitoraNekoruQueen.java @@ -84,7 +84,7 @@ class WasitoraNekoruQueenEffect extends OneShotEffect { if (damagedPlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) { Permanent objectToBeSacrificed = game.getPermanent(target.getFirstTarget()); if (objectToBeSacrificed != null) { - if (objectToBeSacrificed.sacrifice(source.getSourceId(), game)) { + if (objectToBeSacrificed.sacrifice(source, game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/w/WasteNot.java b/Mage.Sets/src/mage/cards/w/WasteNot.java index aab2eee2e96..4277e4c962b 100644 --- a/Mage.Sets/src/mage/cards/w/WasteNot.java +++ b/Mage.Sets/src/mage/cards/w/WasteNot.java @@ -63,7 +63,7 @@ class WasteNotCreatureTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override @@ -100,7 +100,7 @@ class WasteNotLandTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override @@ -137,7 +137,7 @@ class WasteNotOtherTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WatchersOfTheDead.java b/Mage.Sets/src/mage/cards/w/WatchersOfTheDead.java index 6e20dafb89d..4948c890eae 100644 --- a/Mage.Sets/src/mage/cards/w/WatchersOfTheDead.java +++ b/Mage.Sets/src/mage/cards/w/WatchersOfTheDead.java @@ -80,7 +80,7 @@ class WatchersOfTheDeadEffect extends OneShotEffect { for (Card cardInGraveyard : cardsInGraveyard.getCards(game)) { if (!target.getTargets().contains(cardInGraveyard.getId())) { opponent.moveCardToExileWithInfo(cardInGraveyard, CardUtil.getCardExileZoneId(game, source.getId()), - sourceObject.getLogName(), source.getId(), game, Zone.GRAVEYARD, true); + sourceObject.getLogName(), source, game, Zone.GRAVEYARD, true); } } } diff --git a/Mage.Sets/src/mage/cards/w/WaveOfReckoning.java b/Mage.Sets/src/mage/cards/w/WaveOfReckoning.java index fab02cbc8db..ff8a9bffc92 100644 --- a/Mage.Sets/src/mage/cards/w/WaveOfReckoning.java +++ b/Mage.Sets/src/mage/cards/w/WaveOfReckoning.java @@ -55,7 +55,7 @@ class WaveOfReckoningDamageEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { int amount = permanent.getPower().getValue(); - permanent.damage(amount, permanent.getId(), game, false, true); + permanent.damage(amount, permanent.getId(), source, game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java b/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java index 528d4f14ec1..d9b2513f9af 100644 --- a/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java +++ b/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java @@ -83,7 +83,7 @@ class WaveOfVitriolEffect extends OneShotEffect { if (player != null) { int count = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) { - if (permanent.sacrifice(source.getSourceId(), game) && permanent.isLand()) { + if (permanent.sacrifice(source, game) && permanent.isLand()) { count++; } } diff --git a/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java b/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java index 9aa65d9c132..e382e3c2944 100644 --- a/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java +++ b/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java @@ -80,13 +80,13 @@ class WaxmaneBakuTapEffect extends OneShotEffect { } } TargetPermanent target = new TargetPermanent(numberToTap, filter); - if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { List targets = target.getTargets(); for (UUID targetId : targets) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/Waylay.java b/Mage.Sets/src/mage/cards/w/Waylay.java index 8f97c904a40..603166abd1e 100644 --- a/Mage.Sets/src/mage/cards/w/Waylay.java +++ b/Mage.Sets/src/mage/cards/w/Waylay.java @@ -61,7 +61,7 @@ class WaylayEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Token token = new WaylayToken(); - token.putOntoBattlefield(3, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(3, game, source, source.getControllerId()); List toExile = new ArrayList<>(); for (UUID tokenId : token.getLastAddedTokenIds()) { Permanent tokenPermanent = game.getPermanent(tokenId); diff --git a/Mage.Sets/src/mage/cards/w/WeaponRack.java b/Mage.Sets/src/mage/cards/w/WeaponRack.java index 33c75de119e..e9d8bdb7b7f 100644 --- a/Mage.Sets/src/mage/cards/w/WeaponRack.java +++ b/Mage.Sets/src/mage/cards/w/WeaponRack.java @@ -76,7 +76,7 @@ class WeaponRackEffect extends OneShotEffect { if (permanent == null || !permanent.addCounters(CounterType.P1P1.createInstance(), source, game)) { return false; } - sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), game); + sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/w/WeatheredBodyguards.java b/Mage.Sets/src/mage/cards/w/WeatheredBodyguards.java index 0ee846a890b..3616862efc3 100644 --- a/Mage.Sets/src/mage/cards/w/WeatheredBodyguards.java +++ b/Mage.Sets/src/mage/cards/w/WeatheredBodyguards.java @@ -66,10 +66,10 @@ class WeatheredBodyguardsEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; - Permanent damager = game.getPermanentOrLKIBattlefield(damageEvent.getSourceId()); - Permanent p = game.getPermanent(source.getSourceId()); - if (p != null && !p.isTapped() && damageEvent.isCombatDamage() && damager != null && damager.isAttacking() && !damager.isBlocked(game)) { - p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); + Permanent attacker = game.getPermanentOrLKIBattlefield(damageEvent.getSourceId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null && !permanent.isTapped() && damageEvent.isCombatDamage() && attacker != null && attacker.isAttacking() && !attacker.isBlocked(game)) { + permanent.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable()); return true; } return true; diff --git a/Mage.Sets/src/mage/cards/w/WebOfInertia.java b/Mage.Sets/src/mage/cards/w/WebOfInertia.java index b8a396e607b..33b05c03bd9 100644 --- a/Mage.Sets/src/mage/cards/w/WebOfInertia.java +++ b/Mage.Sets/src/mage/cards/w/WebOfInertia.java @@ -57,9 +57,9 @@ class WebOfInertiaEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); if (player != null && sourceObject != null) { Cost cost = new ExileFromGraveCost(new TargetCardInYourGraveyard()); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, "Exile a card from your graveyard?", source, game)) { + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Detriment, "Exile a card from your graveyard?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } diff --git a/Mage.Sets/src/mage/cards/w/WeedStrangle.java b/Mage.Sets/src/mage/cards/w/WeedStrangle.java index 7516ebdbd0b..78459b1e3b5 100644 --- a/Mage.Sets/src/mage/cards/w/WeedStrangle.java +++ b/Mage.Sets/src/mage/cards/w/WeedStrangle.java @@ -61,7 +61,7 @@ class WeedStrangleEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && creature != null) { - creature.destroy(source.getSourceId(), game, false); + creature.destroy(source, game, false); if (ClashEffect.getInstance().apply(game, source)) { controller.gainLife(creature.getToughness().getValue(), game, source); } diff --git a/Mage.Sets/src/mage/cards/w/WeiAssassins.java b/Mage.Sets/src/mage/cards/w/WeiAssassins.java index 44f05e4f82f..dbd4fab63a5 100644 --- a/Mage.Sets/src/mage/cards/w/WeiAssassins.java +++ b/Mage.Sets/src/mage/cards/w/WeiAssassins.java @@ -77,12 +77,12 @@ class WeiAssassinsEffect extends OneShotEffect { filter.add(new ControllerIdPredicate(player.getId())); Target target = new TargetPermanent(1, 1, filter, true); if (target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { + while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) { player.chooseTarget(Outcome.DestroyPermanent, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WellLaidPlans.java b/Mage.Sets/src/mage/cards/w/WellLaidPlans.java index 9e62a7d0053..f5582e9e545 100644 --- a/Mage.Sets/src/mage/cards/w/WellLaidPlans.java +++ b/Mage.Sets/src/mage/cards/w/WellLaidPlans.java @@ -58,12 +58,12 @@ class WellLaidPlansPreventionEffect extends PreventionEffectImpl { if (event.getType() != GameEvent.EventType.DAMAGE_CREATURE) { return false; } - Permanent damager = game.getPermanentOrLKIBattlefield(event.getSourceId()); + Permanent attacker = game.getPermanentOrLKIBattlefield(event.getSourceId()); Permanent damaged = game.getPermanentOrLKIBattlefield(event.getTargetId()); - if (damager == null || damaged == null - || !damager.isCreature() || !damaged.isCreature()) { + if (attacker == null || damaged == null + || !attacker.isCreature() || !damaged.isCreature()) { return false; } - return !damager.getColor(game).intersection(damaged.getColor(game)).isColorless(); + return !attacker.getColor(game).intersection(damaged.getColor(game)).isColorless(); } } diff --git a/Mage.Sets/src/mage/cards/w/WellOfKnowledge.java b/Mage.Sets/src/mage/cards/w/WellOfKnowledge.java index a054e2ced63..933ac50333f 100644 --- a/Mage.Sets/src/mage/cards/w/WellOfKnowledge.java +++ b/Mage.Sets/src/mage/cards/w/WellOfKnowledge.java @@ -60,7 +60,7 @@ class WellOfKnowledgeConditionalActivatedAbility extends ActivatedAbilityImpl { @Override public ActivationStatus canActivate(UUID playerId, Game game) { if (condition.apply(game, this) - && costs.canPay(this, sourceId, playerId, game) + && costs.canPay(this, this, playerId, game) && game.isActivePlayer(playerId)) { this.activatorId = playerId; return ActivationStatus.getTrue(this, game); @@ -100,7 +100,7 @@ class WellOfKnowledgeEffect extends OneShotEffect { if (source instanceof ActivatedAbilityImpl) { Player activator = game.getPlayer(((ActivatedAbilityImpl) source).getActivatorId()); if (activator != null) { - activator.drawCards(1, source.getSourceId(), game); + activator.drawCards(1, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java b/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java index 6b05181425a..73dc4469841 100644 --- a/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java +++ b/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java @@ -60,9 +60,9 @@ class WellOfLostDreamsEffect extends OneShotEffect { if (amount > 0) { int xValue = controller.announceXMana(0, amount, "Announce X Value", game, source); if (xValue > 0) { - if (new GenericManaCost(xValue).pay(source, game, source.getSourceId(), controller.getId(), false)) { + if (new GenericManaCost(xValue).pay(source, game, source, controller.getId(), false)) { game.informPlayers(controller.getLogName() + " payed {" + xValue + '}'); - controller.drawCards(xValue, source.getSourceId(), game); + controller.drawCards(xValue, source, game); } else { return false; } diff --git a/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java b/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java index 2f9699a1d4f..b73383907fd 100644 --- a/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java +++ b/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java @@ -77,7 +77,7 @@ class WerewolfRansackerAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TRANSFORMED; + return event.getType() == GameEvent.EventType.TRANSFORMED; } @Override @@ -117,12 +117,12 @@ class WerewolfRansackerEffect extends OneShotEffect { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - if (permanent.destroy(source.getSourceId(), game, false)) { + if (permanent.destroy(source, game, false)) { affectedTargets++; if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { - player.damage(3, source.getSourceId(), game); + player.damage(3, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java b/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java index 207fd6e1288..6c98410864c 100644 --- a/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java +++ b/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java @@ -77,7 +77,7 @@ class WharfInfiltratorDiscardAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DISCARDED_CARD; + return event.getType() == GameEvent.EventType.DISCARDED_CARD; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WheelOfMisfortune.java b/Mage.Sets/src/mage/cards/w/WheelOfMisfortune.java index a053f1f9fc1..ba0a4863311 100644 --- a/Mage.Sets/src/mage/cards/w/WheelOfMisfortune.java +++ b/Mage.Sets/src/mage/cards/w/WheelOfMisfortune.java @@ -82,10 +82,10 @@ class WheelOfMisfortuneEffect extends OneShotEffect { continue; } if (entry.getValue() >= maxValue) { - player.damage(maxValue, source.getSourceId(), game); + player.damage(maxValue, source.getSourceId(), source, game); } else if (entry.getValue() > minValue) { - player.discard(player.getHand(), source, game); - player.drawCards(7, source.getSourceId(), game); + player.discard(player.getHand(), false, source, game); + player.drawCards(7, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java b/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java index af23559ad45..2bd23975115 100644 --- a/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java +++ b/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java @@ -74,7 +74,7 @@ class WheelOfSunAndMoonEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WheelOfTorture.java b/Mage.Sets/src/mage/cards/w/WheelOfTorture.java index 78362a1d77d..cfc8bbe679e 100644 --- a/Mage.Sets/src/mage/cards/w/WheelOfTorture.java +++ b/Mage.Sets/src/mage/cards/w/WheelOfTorture.java @@ -53,7 +53,7 @@ class WheelOfTortureEffect extends OneShotEffect { if (player != null) { int amount = 3 - player.getHand().size(); if (amount > 0) { - player.damage(amount, source.getSourceId(), game); + player.damage(amount, source.getSourceId(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java b/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java index 07ebe8f4516..7881b3c7aca 100644 --- a/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java +++ b/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java @@ -145,7 +145,7 @@ class WhimsOfTheFateEffect extends OneShotEffect { for (UUID permanentId : playerPiles.getValue().get(sacrificePile)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/Whipkeeper.java b/Mage.Sets/src/mage/cards/w/Whipkeeper.java index 7693fe48b3a..574ba9b94fe 100644 --- a/Mage.Sets/src/mage/cards/w/Whipkeeper.java +++ b/Mage.Sets/src/mage/cards/w/Whipkeeper.java @@ -66,7 +66,7 @@ class WhipkeeperEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { - creature.damage(creature.getDamage(), source.getSourceId(), game, false, true); + creature.damage(creature.getDamage(), source.getSourceId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/w/WhiptongueHydra.java b/Mage.Sets/src/mage/cards/w/WhiptongueHydra.java index 0f39cbc4164..8a68ca1ce4d 100644 --- a/Mage.Sets/src/mage/cards/w/WhiptongueHydra.java +++ b/Mage.Sets/src/mage/cards/w/WhiptongueHydra.java @@ -78,7 +78,7 @@ class WhiptongueHydraEffect extends OneShotEffect { destroyedPermanents = game.getBattlefield().getActivePermanents( filter, source.getControllerId(), source.getSourceId(), game ).stream().filter( - (permanent) -> (permanent.destroy(source.getSourceId(), game, false)) + (permanent) -> (permanent.destroy(source, game, false)) ).map((_item) -> 1).reduce(destroyedPermanents, Integer::sum); if (destroyedPermanents > 0) { return new AddCountersSourceEffect( diff --git a/Mage.Sets/src/mage/cards/w/WhirlpoolWarrior.java b/Mage.Sets/src/mage/cards/w/WhirlpoolWarrior.java index aeef381aef6..9f00560c2c8 100644 --- a/Mage.Sets/src/mage/cards/w/WhirlpoolWarrior.java +++ b/Mage.Sets/src/mage/cards/w/WhirlpoolWarrior.java @@ -90,7 +90,7 @@ class WhirlpoolWarriorActivatedEffect extends OneShotEffect { for (Entry entry : playerCards.entrySet()) { Player player = game.getPlayer(entry.getKey()); if (player != null) { - player.drawCards(entry.getValue(), source.getSourceId(), game); + player.drawCards(entry.getValue(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WhirlpoolWhelm.java b/Mage.Sets/src/mage/cards/w/WhirlpoolWhelm.java index 6646d5044e6..f0d2e056286 100644 --- a/Mage.Sets/src/mage/cards/w/WhirlpoolWhelm.java +++ b/Mage.Sets/src/mage/cards/w/WhirlpoolWhelm.java @@ -65,7 +65,7 @@ class WhirlpoolWhelmEffect extends OneShotEffect { topOfLibrary = controller.chooseUse(outcome, "Put " + creature.getLogName() + " to top of libraray instead?", source, game); } if (topOfLibrary) { - controller.moveCardToLibraryWithInfo(creature, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); + controller.moveCardToLibraryWithInfo(creature, source, game, Zone.BATTLEFIELD, true, true); } else { controller.moveCards(creature, Zone.HAND, source, game); } diff --git a/Mage.Sets/src/mage/cards/w/WhirlwindDenial.java b/Mage.Sets/src/mage/cards/w/WhirlwindDenial.java index ad4a2acdefb..d13c6bdd90d 100644 --- a/Mage.Sets/src/mage/cards/w/WhirlwindDenial.java +++ b/Mage.Sets/src/mage/cards/w/WhirlwindDenial.java @@ -66,10 +66,10 @@ class WhirlwindDenialEffect extends OneShotEffect { return; } Cost cost = new GenericManaCost(4); - if (cost.canPay(source, source.getSourceId(), stackObject.getControllerId(), game) + if (cost.canPay(source, source, stackObject.getControllerId(), game) && player.chooseUse(outcome, "Pay {4} to prevent " + stackObject.getIdName() + " from being countered?", source, game) - && cost.pay(source, game, source.getSourceId(), stackObject.getControllerId(), false)) { + && cost.pay(source, game, source, stackObject.getControllerId(), false)) { game.informPlayers("The cost was paid by " + player.getLogName() + " to prevent " @@ -82,7 +82,7 @@ class WhirlwindDenialEffect extends OneShotEffect { + " to prevent " + stackObject.getIdName() + " from being countered."); - game.getStack().counter(stackObject.getId(), source.getSourceId(), game); + game.getStack().counter(stackObject.getId(), source, game); }); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WhisperingMadness.java b/Mage.Sets/src/mage/cards/w/WhisperingMadness.java index eb04fd9fa22..5e694b31a2d 100644 --- a/Mage.Sets/src/mage/cards/w/WhisperingMadness.java +++ b/Mage.Sets/src/mage/cards/w/WhisperingMadness.java @@ -59,7 +59,7 @@ class WhisperingMadnessEffect extends OneShotEffect { if (player == null) { continue; } - int discarded = player.discard(player.getHand(), source, game).size(); + int discarded = player.discard(player.getHand(), false, source, game).size(); if (discarded > maxDiscarded) { maxDiscarded = discarded; } @@ -67,7 +67,7 @@ class WhisperingMadnessEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(maxDiscarded, source.getSourceId(), game); + player.drawCards(maxDiscarded, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WhisperingSpecter.java b/Mage.Sets/src/mage/cards/w/WhisperingSpecter.java index 732322083b0..e0757ce7271 100644 --- a/Mage.Sets/src/mage/cards/w/WhisperingSpecter.java +++ b/Mage.Sets/src/mage/cards/w/WhisperingSpecter.java @@ -64,7 +64,7 @@ class WhisperingSpecterEffect extends OneShotEffect { if (player != null) { int value = player.getCounters().getCount(CounterType.POISON); if (value > 0) { - player.discard(value, false, source, game); + player.discard(value, false, false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/w/WickedGuardian.java b/Mage.Sets/src/mage/cards/w/WickedGuardian.java index 946cbb96ff4..927389b34e6 100644 --- a/Mage.Sets/src/mage/cards/w/WickedGuardian.java +++ b/Mage.Sets/src/mage/cards/w/WickedGuardian.java @@ -86,7 +86,7 @@ class WickedGuardianEffect extends OneShotEffect { if (permanent == null) { return false; } - permanent.damage(2, source.getSourceId(), game); - return player.drawCards(1, source.getSourceId(), game) > 0; + permanent.damage(2, source.getSourceId(), source, game); + return player.drawCards(1, source, game) > 0; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/w/WidespreadBrutality.java b/Mage.Sets/src/mage/cards/w/WidespreadBrutality.java index 5cdb9dd9f18..da7d34c1737 100644 --- a/Mage.Sets/src/mage/cards/w/WidespreadBrutality.java +++ b/Mage.Sets/src/mage/cards/w/WidespreadBrutality.java @@ -65,7 +65,7 @@ class WidespreadBrutalityEffect extends OneShotEffect { int power = amassedArmy.getPower().getValue(); for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (permanent != null && permanent.isCreature() && !permanent.hasSubtype(SubType.ARMY, game)) { - permanent.damage(power, amassedArmy.getId(), game); + permanent.damage(power, amassedArmy.getId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WidespreadPanic.java b/Mage.Sets/src/mage/cards/w/WidespreadPanic.java index 5191dd05c3c..b8804cf698e 100644 --- a/Mage.Sets/src/mage/cards/w/WidespreadPanic.java +++ b/Mage.Sets/src/mage/cards/w/WidespreadPanic.java @@ -59,11 +59,12 @@ class WidespreadPanicTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LIBRARY_SHUFFLED; + return event.getType() == GameEvent.EventType.LIBRARY_SHUFFLED; } @Override public boolean checkTrigger(GameEvent event, Game game) { + // event.getSourceId() must be null for default shuffle like mulligan if (event.getPlayerId().equals(game.getControllerId(event.getSourceId()))) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); @@ -106,7 +107,7 @@ class WidespreadPanicEffect extends OneShotEffect { shuffler.choose(Outcome.Detriment, target, source.getSourceId(), game); Card card = shuffler.getHand().get(target.getFirstTarget(), game); if (card != null) { - shuffler.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + shuffler.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } diff --git a/Mage.Sets/src/mage/cards/w/WildGrowth.java b/Mage.Sets/src/mage/cards/w/WildGrowth.java index d392d83b77e..0f3638bcfdc 100644 --- a/Mage.Sets/src/mage/cards/w/WildGrowth.java +++ b/Mage.Sets/src/mage/cards/w/WildGrowth.java @@ -67,21 +67,20 @@ class WildGrowthTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA; + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment == null || !event.getSourceId().equals(enchantment.getAttachedTo())) { - return false; + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + if (enchantedLand != null && enchantedLand.isLand()) { + this.getEffects().setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); + return true; + } } - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent == null) { - return false; - } - this.getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId())); - return true; + return false; } diff --git a/Mage.Sets/src/mage/cards/w/WildResearch.java b/Mage.Sets/src/mage/cards/w/WildResearch.java index 2cc4eecc20b..d441c8019f6 100644 --- a/Mage.Sets/src/mage/cards/w/WildResearch.java +++ b/Mage.Sets/src/mage/cards/w/WildResearch.java @@ -91,7 +91,7 @@ class WildResearchEffect extends OneShotEffect { } } } - controller.discardOne(true, source, game); + controller.discardOne(true, false, source, game); controller.shuffleLibrary(source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WildSwing.java b/Mage.Sets/src/mage/cards/w/WildSwing.java index 620909e0e68..763437cd056 100644 --- a/Mage.Sets/src/mage/cards/w/WildSwing.java +++ b/Mage.Sets/src/mage/cards/w/WildSwing.java @@ -74,7 +74,7 @@ class WildSwingEffect extends OneShotEffect { Permanent targetPermanent = game.getPermanent(target.getTargets().get(RandomUtil.nextInt(target.getTargets().size()))); if (targetPermanent != null) { game.informPlayers(sourceObject.getLogName() + ": The randomly chosen target to destroy is " + targetPermanent.getLogName()); - targetPermanent.destroy(source.getSourceId(), game, false); + targetPermanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/w/WildbornPreserver.java b/Mage.Sets/src/mage/cards/w/WildbornPreserver.java index 49ba457eaf4..2a34ec63014 100644 --- a/Mage.Sets/src/mage/cards/w/WildbornPreserver.java +++ b/Mage.Sets/src/mage/cards/w/WildbornPreserver.java @@ -96,7 +96,7 @@ class WildbornPreserverCreateReflexiveTriggerEffect extends OneShotEffect { } int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (!cost.pay(source, game, source, source.getControllerId(), false, null)) { return false; } game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/w/Willbreaker.java b/Mage.Sets/src/mage/cards/w/Willbreaker.java index 3a349014808..6085a0cba12 100644 --- a/Mage.Sets/src/mage/cards/w/Willbreaker.java +++ b/Mage.Sets/src/mage/cards/w/Willbreaker.java @@ -62,7 +62,7 @@ class WillbreakerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGETED; + return event.getType() == GameEvent.EventType.TARGETED; } @Override diff --git a/Mage.Sets/src/mage/cards/w/Windfall.java b/Mage.Sets/src/mage/cards/w/Windfall.java index b7c641a9a4e..cfef807871c 100644 --- a/Mage.Sets/src/mage/cards/w/Windfall.java +++ b/Mage.Sets/src/mage/cards/w/Windfall.java @@ -56,7 +56,7 @@ class WindfallEffect extends OneShotEffect { if (player == null) { continue; } - int discarded = player.discard(player.getHand(), source, game).size(); + int discarded = player.discard(player.getHand(), false, source, game).size(); if (discarded > maxDiscarded) { maxDiscarded = discarded; } @@ -64,7 +64,7 @@ class WindfallEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(maxDiscarded, source.getSourceId(), game); + player.drawCards(maxDiscarded, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WindreaderSphinx.java b/Mage.Sets/src/mage/cards/w/WindreaderSphinx.java index 4c92357326e..9f99750f716 100644 --- a/Mage.Sets/src/mage/cards/w/WindreaderSphinx.java +++ b/Mage.Sets/src/mage/cards/w/WindreaderSphinx.java @@ -64,7 +64,7 @@ class WindreaderSphinxTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WindsOfChange.java b/Mage.Sets/src/mage/cards/w/WindsOfChange.java index a2584e505f5..aa81fb93b87 100644 --- a/Mage.Sets/src/mage/cards/w/WindsOfChange.java +++ b/Mage.Sets/src/mage/cards/w/WindsOfChange.java @@ -69,7 +69,7 @@ class WindsOfChangeEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null && permanentsCount.containsKey(playerId)) { - player.drawCards(permanentsCount.get(playerId), source.getSourceId(), game); + player.drawCards(permanentsCount.get(playerId), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WingPuncture.java b/Mage.Sets/src/mage/cards/w/WingPuncture.java index 45b38fff9fe..436c0bc8331 100644 --- a/Mage.Sets/src/mage/cards/w/WingPuncture.java +++ b/Mage.Sets/src/mage/cards/w/WingPuncture.java @@ -68,7 +68,7 @@ class WingPunctureEffect extends OneShotEffect { Permanent targetPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (sourcePermanent != null && targetPermanent != null) { - targetPermanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true); + targetPermanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/w/WingStorm.java b/Mage.Sets/src/mage/cards/w/WingStorm.java index 939f1487b98..3fad426d574 100644 --- a/Mage.Sets/src/mage/cards/w/WingStorm.java +++ b/Mage.Sets/src/mage/cards/w/WingStorm.java @@ -67,7 +67,7 @@ class WingStormEffect extends OneShotEffect { if (amount > 0) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount * 2, source.getSourceId(), game); + player.damage(amount * 2, source.getSourceId(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/WinterBlast.java b/Mage.Sets/src/mage/cards/w/WinterBlast.java index 16f67ad957c..b9e60aaa5c5 100644 --- a/Mage.Sets/src/mage/cards/w/WinterBlast.java +++ b/Mage.Sets/src/mage/cards/w/WinterBlast.java @@ -71,9 +71,9 @@ class WinterBlastEffect extends OneShotEffect { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); if (permanent.getAbilities().contains(FlyingAbility.getInstance())) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); } affectedTargets++; } diff --git a/Mage.Sets/src/mage/cards/w/WitchEngine.java b/Mage.Sets/src/mage/cards/w/WitchEngine.java index 942336b3548..d34f38e6a31 100644 --- a/Mage.Sets/src/mage/cards/w/WitchEngine.java +++ b/Mage.Sets/src/mage/cards/w/WitchEngine.java @@ -75,7 +75,7 @@ class WitchEngineEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/w/WitchHunt.java b/Mage.Sets/src/mage/cards/w/WitchHunt.java index 9705a821f71..6cc548c2c0e 100644 --- a/Mage.Sets/src/mage/cards/w/WitchHunt.java +++ b/Mage.Sets/src/mage/cards/w/WitchHunt.java @@ -74,7 +74,7 @@ class WitchHuntEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return permanent.changeControllerId(this.getTargetPointer().getFirst(game, source), game); + return permanent.changeControllerId(this.getTargetPointer().getFirst(game, source), game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java b/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java index 05ad24929a4..f80bbe98da5 100644 --- a/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java +++ b/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java @@ -71,7 +71,7 @@ class WitchbaneOrbEffect extends OneShotEffect { } } for (Permanent curse : toDestroy) { - curse.destroy(source.getSourceId(), game, false); + curse.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/w/Witchstalker.java b/Mage.Sets/src/mage/cards/w/Witchstalker.java index 6c8f6fedd7e..2f4cda66359 100644 --- a/Mage.Sets/src/mage/cards/w/Witchstalker.java +++ b/Mage.Sets/src/mage/cards/w/Witchstalker.java @@ -69,7 +69,7 @@ class WitchstalkerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/w/Withdraw.java b/Mage.Sets/src/mage/cards/w/Withdraw.java index 8d2138ada8a..213651c9a4d 100644 --- a/Mage.Sets/src/mage/cards/w/Withdraw.java +++ b/Mage.Sets/src/mage/cards/w/Withdraw.java @@ -80,7 +80,7 @@ class WithdrawEffect extends OneShotEffect { if (creatureController != null) { Cost cost = ManaUtil.createManaCost(1, false); if (creatureController.chooseUse(Outcome.Benefit, "Pay {1}? (Otherwise " + secondCreature.getName() + " will be returned to its owner's hand)", source, game)) { - cost.pay(source, game, source.getSourceId(), creatureController.getId(), false); + cost.pay(source, game, source, creatureController.getId(), false); } if (!cost.isPaid()) { creatureController.moveCards(secondCreature, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/w/WithengarUnbound.java b/Mage.Sets/src/mage/cards/w/WithengarUnbound.java index 60ff51800ce..21568ba713d 100644 --- a/Mage.Sets/src/mage/cards/w/WithengarUnbound.java +++ b/Mage.Sets/src/mage/cards/w/WithengarUnbound.java @@ -73,7 +73,7 @@ class WithengarUnboundTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.LOST; + return event.getType() == GameEvent.EventType.LOST; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WitheringGaze.java b/Mage.Sets/src/mage/cards/w/WitheringGaze.java index 6ce7cc4b71b..09a14a38c0d 100644 --- a/Mage.Sets/src/mage/cards/w/WitheringGaze.java +++ b/Mage.Sets/src/mage/cards/w/WitheringGaze.java @@ -70,7 +70,7 @@ class WitheringGazeEffect extends OneShotEffect { count++; } } - controller.drawCards(count, source.getSourceId(), game); + controller.drawCards(count, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/w/WitsEnd.java b/Mage.Sets/src/mage/cards/w/WitsEnd.java index ff2e542b7d6..898893d71c8 100644 --- a/Mage.Sets/src/mage/cards/w/WitsEnd.java +++ b/Mage.Sets/src/mage/cards/w/WitsEnd.java @@ -57,7 +57,7 @@ class WitsEndEffect extends OneShotEffect { if (player == null) { return false; } - player.discard(player.getHand(), source, game); + player.discard(player.getHand(), false, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/w/WoebringerDemon.java b/Mage.Sets/src/mage/cards/w/WoebringerDemon.java index d61f395196b..93b9b5b42e6 100644 --- a/Mage.Sets/src/mage/cards/w/WoebringerDemon.java +++ b/Mage.Sets/src/mage/cards/w/WoebringerDemon.java @@ -75,18 +75,18 @@ class WoebringerDemonEffect extends OneShotEffect { if (currentPlayer != null) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); - if (target.canChoose(currentPlayer.getId(), game)) { + if (target.canChoose(source.getSourceId(), currentPlayer.getId(), game)) { currentPlayer.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } } } Permanent sourceObject = game.getPermanent(source.getSourceId()); if (sourceObject != null && sourceObject.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter()) { - sourceObject.sacrifice(source.getSourceId(), game); + sourceObject.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/w/Woeleecher.java b/Mage.Sets/src/mage/cards/w/Woeleecher.java index 4d72992df23..8e54c654e31 100644 --- a/Mage.Sets/src/mage/cards/w/Woeleecher.java +++ b/Mage.Sets/src/mage/cards/w/Woeleecher.java @@ -77,7 +77,7 @@ class WoeleecherEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); if (target != null && you != null) { numberCountersOriginal = target.getCounters(game).getCount(CounterType.M1M1); - target.removeCounters(CounterType.M1M1.createInstance(), game); + target.removeCounters(CounterType.M1M1.createInstance(), source, game); numberCountersAfter = target.getCounters(game).getCount(CounterType.M1M1); if (numberCountersAfter < numberCountersOriginal && you != null) { you.gainLife(2, game, source); diff --git a/Mage.Sets/src/mage/cards/w/WojekEmbermage.java b/Mage.Sets/src/mage/cards/w/WojekEmbermage.java index 4c73550abc7..8a36216e8da 100644 --- a/Mage.Sets/src/mage/cards/w/WojekEmbermage.java +++ b/Mage.Sets/src/mage/cards/w/WojekEmbermage.java @@ -71,7 +71,7 @@ class WojekEmbermageEffect extends OneShotEffect { ObjectColor targetColor = target.getColor(game); for (Permanent permanent : game.getBattlefield().getActivePermanents(FILTER, source.getControllerId(), game)) { if (target.getId().equals(permanent.getId()) || permanent.getColor(game).shares(targetColor)) { - permanent.damage(1, source.getSourceId(), game, false, true); + permanent.damage(1, source.getSourceId(), source, game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WolfridersSaddle.java b/Mage.Sets/src/mage/cards/w/WolfridersSaddle.java index d01f70a9a7c..a93fdb44094 100644 --- a/Mage.Sets/src/mage/cards/w/WolfridersSaddle.java +++ b/Mage.Sets/src/mage/cards/w/WolfridersSaddle.java @@ -75,7 +75,7 @@ class WolfridersSaddleEffect extends CreateTokenEffect { if (p == null) { return false; } - p.addAttachment(source.getSourceId(), game); + p.addAttachment(source.getSourceId(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java b/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java index 6b467004d33..da2bba18f2d 100644 --- a/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java +++ b/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java @@ -88,15 +88,14 @@ class WolfwillowHavenTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment == null || !event.getSourceId().equals(enchantment.getAttachedTo())) { - return false; + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + if (enchantedLand != null && enchantedLand.isLand()) { + getEffects().setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); + return true; + } } - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent == null) { - return false; - } - this.getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId())); - return true; + return false; } diff --git a/Mage.Sets/src/mage/cards/w/WoodElemental.java b/Mage.Sets/src/mage/cards/w/WoodElemental.java index 54142a0ac5e..9f259f45f32 100644 --- a/Mage.Sets/src/mage/cards/w/WoodElemental.java +++ b/Mage.Sets/src/mage/cards/w/WoodElemental.java @@ -93,7 +93,7 @@ class WoodElementalEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Permanent targetPermanent = game.getPermanent(targetId); if (targetPermanent != null) { - targetPermanent.sacrifice(source.getSourceId(), game); + targetPermanent.sacrifice(source, game); } } game.addEffect(new SetPowerToughnessSourceEffect(sacrificedForests, sacrificedForests, Duration.Custom, SubLayer.SetPT_7b), source); diff --git a/Mage.Sets/src/mage/cards/w/WoodenSphere.java b/Mage.Sets/src/mage/cards/w/WoodenSphere.java index ddd6b9985e9..1548593ad72 100644 --- a/Mage.Sets/src/mage/cards/w/WoodenSphere.java +++ b/Mage.Sets/src/mage/cards/w/WoodenSphere.java @@ -56,7 +56,7 @@ class WoodenSphereAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WoodenStake.java b/Mage.Sets/src/mage/cards/w/WoodenStake.java index dc946d204d7..273308bb636 100644 --- a/Mage.Sets/src/mage/cards/w/WoodenStake.java +++ b/Mage.Sets/src/mage/cards/w/WoodenStake.java @@ -62,7 +62,7 @@ class WoodenStakeBlocksOrBecomesBlockedTriggeredAbility extends TriggeredAbility @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WoodlandSleuth.java b/Mage.Sets/src/mage/cards/w/WoodlandSleuth.java index 008cea16163..bcb68605107 100644 --- a/Mage.Sets/src/mage/cards/w/WoodlandSleuth.java +++ b/Mage.Sets/src/mage/cards/w/WoodlandSleuth.java @@ -75,7 +75,7 @@ class WoodlandSleuthEffect extends OneShotEffect { Card[] cards = player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).toArray(new Card[0]); if (cards.length > 0) { Card card = cards[RandomUtil.nextInt(cards.length)]; - card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.moveToZone(Zone.HAND, source, game, true); game.informPlayers(card.getName() + " returned to the hand of " + player.getLogName()); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WoollySpider.java b/Mage.Sets/src/mage/cards/w/WoollySpider.java index 0707a3f39c0..372562d8f77 100644 --- a/Mage.Sets/src/mage/cards/w/WoollySpider.java +++ b/Mage.Sets/src/mage/cards/w/WoollySpider.java @@ -59,7 +59,7 @@ class BlocksCreatureWithFlyingTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.BLOCKER_DECLARED; + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WordOfCommand.java b/Mage.Sets/src/mage/cards/w/WordOfCommand.java index 42bd219fa22..95860d66f57 100644 --- a/Mage.Sets/src/mage/cards/w/WordOfCommand.java +++ b/Mage.Sets/src/mage/cards/w/WordOfCommand.java @@ -3,6 +3,7 @@ package mage.cards.w; import mage.ApprovingObject; import mage.MageObject; import mage.abilities.Ability; +import mage.abilities.PlayLandAbility; import mage.abilities.SpellAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.AsThoughEffect; @@ -164,10 +165,11 @@ class WordOfCommandEffect extends OneShotEffect { if (card.isLand()) { // we can't use getPlayableObjects(game) in here because it disallows playing lands outside the main step // TODO: replace to getPlayable() checks with disable step condition? if (targetPlayer.canPlayLand() && game.getActivePlayerId().equals(targetPlayer.getId())) { - canPlay = true; for (Ability ability : card.getAbilities(game)) { - if (!game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(), ability.getSourceId(), targetPlayer.getId()), ability, game, true)) { - canPlay &= true; + if (ability instanceof PlayLandAbility) { + if (!game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(), ability, targetPlayer.getId()), ability, game, true)) { + canPlay = true; + } } } } diff --git a/Mage.Sets/src/mage/cards/w/Wordmail.java b/Mage.Sets/src/mage/cards/w/Wordmail.java index e6aa8654e1e..ff552016d36 100644 --- a/Mage.Sets/src/mage/cards/w/Wordmail.java +++ b/Mage.Sets/src/mage/cards/w/Wordmail.java @@ -62,8 +62,8 @@ class WordmailCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { - Permanent aura = game.getPermanent(source.getSourceId()); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Permanent aura = game.getPermanent(sourceAbility.getSourceId()); if (aura != null) { Permanent permanent = game.getPermanent(aura.getAttachedTo()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/w/WordsOfWar.java b/Mage.Sets/src/mage/cards/w/WordsOfWar.java index 3d6f1ddba32..d3c730d8a25 100644 --- a/Mage.Sets/src/mage/cards/w/WordsOfWar.java +++ b/Mage.Sets/src/mage/cards/w/WordsOfWar.java @@ -70,14 +70,14 @@ class WordsOfWarEffect extends ReplacementEffectImpl { if (controller != null) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.damage(2, source.getSourceId(), game); + player.damage(2, source.getSourceId(), source, game); this.used = true; discard(); return true; } Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(2, source.getSourceId(), game, false, true); + permanent.damage(2, source.getSourceId(), source, game, false, true); this.used = true; discard(); return true; diff --git a/Mage.Sets/src/mage/cards/w/WordsOfWind.java b/Mage.Sets/src/mage/cards/w/WordsOfWind.java index 3a06be36c92..7898d8ea585 100644 --- a/Mage.Sets/src/mage/cards/w/WordsOfWind.java +++ b/Mage.Sets/src/mage/cards/w/WordsOfWind.java @@ -77,7 +77,7 @@ class WordsOfWindEffect extends ReplacementEffectImpl { } Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false); + permanent.moveToZone(Zone.HAND, source, game, false); } } } diff --git a/Mage.Sets/src/mage/cards/w/WordsOfWisdom.java b/Mage.Sets/src/mage/cards/w/WordsOfWisdom.java index 57edc3de523..a3806399808 100644 --- a/Mage.Sets/src/mage/cards/w/WordsOfWisdom.java +++ b/Mage.Sets/src/mage/cards/w/WordsOfWisdom.java @@ -62,7 +62,7 @@ class WordsOfWisdomEffect extends OneShotEffect { if (!playerId.equals(controller.getId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/WorldAtWar.java b/Mage.Sets/src/mage/cards/w/WorldAtWar.java index 01dbdcae335..eb263bb76d1 100644 --- a/Mage.Sets/src/mage/cards/w/WorldAtWar.java +++ b/Mage.Sets/src/mage/cards/w/WorldAtWar.java @@ -97,7 +97,7 @@ class UntapDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.PHASE_CHANGED || event.getType() == EventType.COMBAT_PHASE_PRE; + return event.getType() == GameEvent.EventType.PHASE_CHANGED || event.getType() == GameEvent.EventType.COMBAT_PHASE_PRE; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WorldBottlingKit.java b/Mage.Sets/src/mage/cards/w/WorldBottlingKit.java index 5018b294227..e37b5b08efe 100644 --- a/Mage.Sets/src/mage/cards/w/WorldBottlingKit.java +++ b/Mage.Sets/src/mage/cards/w/WorldBottlingKit.java @@ -80,7 +80,7 @@ class WorldBottlingKitEffect extends OneShotEffect { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { if (permanent.getExpansionSetCode().equals(setChosen)) { - controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(permanent, null, "", source, game, Zone.BATTLEFIELD, true); } } } diff --git a/Mage.Sets/src/mage/cards/w/WorldQueller.java b/Mage.Sets/src/mage/cards/w/WorldQueller.java index 6cadcf6e785..f904433b5e2 100644 --- a/Mage.Sets/src/mage/cards/w/WorldQueller.java +++ b/Mage.Sets/src/mage/cards/w/WorldQueller.java @@ -118,8 +118,8 @@ class WorldQuellerEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player2 = game.getPlayer(playerId); - if (player2 != null && target.canChoose(playerId, game)) { - while (player2.canRespond() && !target.isChosen() && target.canChoose(playerId, game)) { + if (player2 != null && target.canChoose(source.getSourceId(), playerId, game)) { + while (player2.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), playerId, game)) { player2.chooseTarget(Outcome.Sacrifice, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); @@ -133,7 +133,7 @@ class WorldQuellerEffect extends OneShotEffect { // all chosen permanents are sacrificed together for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (chosen.contains(permanent)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/Worldfire.java b/Mage.Sets/src/mage/cards/w/Worldfire.java index 9ab0417d202..847dcfb2ee0 100644 --- a/Mage.Sets/src/mage/cards/w/Worldfire.java +++ b/Mage.Sets/src/mage/cards/w/Worldfire.java @@ -58,7 +58,7 @@ class WorldfireEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.moveToExile(null, "", source.getSourceId(), game); + permanent.moveToExile(null, "", source, game); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); @@ -66,13 +66,13 @@ class WorldfireEffect extends OneShotEffect { for (UUID cid : player.getHand().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(null, null, source.getSourceId(), game); + c.moveToExile(null, null, source, game); } } for (UUID cid : player.getGraveyard().copy()) { Card c = game.getCard(cid); if (c != null) { - c.moveToExile(null, null, source.getSourceId(), game); + c.moveToExile(null, null, source, game); } } player.setLife(1, game, source); diff --git a/Mage.Sets/src/mage/cards/w/Worldpurge.java b/Mage.Sets/src/mage/cards/w/Worldpurge.java index 7a05c398b4b..0e09511afdc 100644 --- a/Mage.Sets/src/mage/cards/w/Worldpurge.java +++ b/Mage.Sets/src/mage/cards/w/Worldpurge.java @@ -84,7 +84,7 @@ class WorldpurgeEffect extends OneShotEffect { player.shuffleCardsToLibrary(cardsToLibrary, game, source); } } - game.emptyManaPools(); + game.emptyManaPools(source); game.informPlayers(sourceObject.getLogName() + " - All players have lost all unspent mana"); return true; } diff --git a/Mage.Sets/src/mage/cards/w/Worldslayer.java b/Mage.Sets/src/mage/cards/w/Worldslayer.java index 1d87c09ab4c..2e529272647 100644 --- a/Mage.Sets/src/mage/cards/w/Worldslayer.java +++ b/Mage.Sets/src/mage/cards/w/Worldslayer.java @@ -65,7 +65,7 @@ class WorldslayerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override @@ -102,7 +102,7 @@ class WorldslayerEffect extends OneShotEffect { List permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game); for (Permanent permanent : permanents) { if (!Objects.equals(permanent.getId(), source.getSourceId())) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } } return true; diff --git a/Mage.Sets/src/mage/cards/w/WormfangDrake.java b/Mage.Sets/src/mage/cards/w/WormfangDrake.java index 6888edf518b..78e29eff5d1 100644 --- a/Mage.Sets/src/mage/cards/w/WormfangDrake.java +++ b/Mage.Sets/src/mage/cards/w/WormfangDrake.java @@ -78,18 +78,18 @@ class WormfangDrakeExileCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); MageObject sourceObject = ability.getSourceObject(game); if (controller != null && sourceObject != null) { - if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { UUID exileId = CardUtil.getExileZoneId(game, ability.getSourceId(), ability.getSourceObjectZoneChangeCounter()); for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } - paid |= controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName() + " exiled permanents", sourceId, game, Zone.BATTLEFIELD, true); + paid |= controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName() + " exiled permanents", source, game, Zone.BATTLEFIELD, true); } } } @@ -97,8 +97,8 @@ class WormfangDrakeExileCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java b/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java index 1dcb063095d..6503ed779f1 100644 --- a/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java +++ b/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java @@ -135,17 +135,17 @@ class WormsOfTheEarthDestroyEffect extends OneShotEffect { if (player != null) { if (player.chooseUse(outcome, "Do you want to destroy " + sourcePermanent.getLogName() + "? (sacrifice two lands or have it deal 5 damage to you)", source, game)) { cost.clearPaid(); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Sacrifice, "Will you sacrifice two lands? (otherwise you'll be dealt 5 damage)", source, game)) { - if (!cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { - player.damage(5, source.getSourceId(), game); + if (!cost.pay(source, game, source, player.getId(), false, null)) { + player.damage(5, source.getSourceId(), source, game); } } else { - player.damage(5, source.getSourceId(), game); + player.damage(5, source.getSourceId(), source, game); } sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - sourcePermanent.destroy(source.getSourceId(), game, false); + sourcePermanent.destroy(source, game, false); } break; } diff --git a/Mage.Sets/src/mage/cards/w/WoundReflection.java b/Mage.Sets/src/mage/cards/w/WoundReflection.java index e039278c0a9..fc27a25967f 100644 --- a/Mage.Sets/src/mage/cards/w/WoundReflection.java +++ b/Mage.Sets/src/mage/cards/w/WoundReflection.java @@ -64,7 +64,7 @@ class WoundReflectionEffect extends OneShotEffect { if (opponent != null) { int lifeLost = watcher.getLifeLost(playerId); if (lifeLost > 0) { - opponent.loseLife(lifeLost, game, false); + opponent.loseLife(lifeLost, game, source, false); } } } diff --git a/Mage.Sets/src/mage/cards/w/WrackWithMadness.java b/Mage.Sets/src/mage/cards/w/WrackWithMadness.java index 494c4fa363f..eae1929dfb0 100644 --- a/Mage.Sets/src/mage/cards/w/WrackWithMadness.java +++ b/Mage.Sets/src/mage/cards/w/WrackWithMadness.java @@ -57,7 +57,7 @@ class WrackWithMadnessEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true); + permanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/w/WrenchMind.java b/Mage.Sets/src/mage/cards/w/WrenchMind.java index 552f2cfb161..27b335baff0 100644 --- a/Mage.Sets/src/mage/cards/w/WrenchMind.java +++ b/Mage.Sets/src/mage/cards/w/WrenchMind.java @@ -62,14 +62,14 @@ class WrenchMindEffect extends OneShotEffect { } if (targetPlayer.getHand().count(StaticFilters.FILTER_CARD_ARTIFACT, game) < 1 || !targetPlayer.chooseUse(Outcome.Benefit, "Discard an artifact card?", source, game)) { - return !targetPlayer.discard(2, false, source, game).isEmpty(); + return !targetPlayer.discard(2, false, false, source, game).isEmpty(); } TargetDiscard target = new TargetDiscard(StaticFilters.FILTER_CARD_ARTIFACT_AN, targetPlayer.getId()); targetPlayer.choose(Outcome.Discard, target, source.getSourceId(), game); Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); - if (card != null && targetPlayer.discard(card, source, game)) { + if (card != null && targetPlayer.discard(card, false, source, game)) { return true; } - return !targetPlayer.discard(2, false, source, game).isEmpty(); + return !targetPlayer.discard(2, false, false, source, game).isEmpty(); } } diff --git a/Mage.Sets/src/mage/cards/w/WretchedBanquet.java b/Mage.Sets/src/mage/cards/w/WretchedBanquet.java index 1404401c491..c2b0500b1e4 100644 --- a/Mage.Sets/src/mage/cards/w/WretchedBanquet.java +++ b/Mage.Sets/src/mage/cards/w/WretchedBanquet.java @@ -70,7 +70,7 @@ class WretchedBanquetEffect extends OneShotEffect { } if (targetCreature.getPower().getValue() <= minPower) { - targetCreature.destroy(source.getSourceId(), game, false); + targetCreature.destroy(source, game, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/w/WrexialTheRisenDeep.java b/Mage.Sets/src/mage/cards/w/WrexialTheRisenDeep.java index 17f7e6cccbc..f4c5dde4c78 100644 --- a/Mage.Sets/src/mage/cards/w/WrexialTheRisenDeep.java +++ b/Mage.Sets/src/mage/cards/w/WrexialTheRisenDeep.java @@ -169,7 +169,7 @@ class WrexialReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/w/Wurmcalling.java b/Mage.Sets/src/mage/cards/w/Wurmcalling.java index dfd12755e89..7e19865823b 100644 --- a/Mage.Sets/src/mage/cards/w/Wurmcalling.java +++ b/Mage.Sets/src/mage/cards/w/Wurmcalling.java @@ -54,7 +54,7 @@ class WurmcallingEffect extends OneShotEffect { WurmCallingWurmToken token = new WurmCallingWurmToken(); token.getPower().modifyBaseValue(count); token.getToughness().modifyBaseValue(count); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(1, game, source, source.getControllerId()); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WurmsTooth.java b/Mage.Sets/src/mage/cards/w/WurmsTooth.java index 8318686225e..5b7d200d034 100644 --- a/Mage.Sets/src/mage/cards/w/WurmsTooth.java +++ b/Mage.Sets/src/mage/cards/w/WurmsTooth.java @@ -53,7 +53,7 @@ class WurmsToothAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/x/XantidSwarm.java b/Mage.Sets/src/mage/cards/x/XantidSwarm.java index 20a9c4b3484..8bbe6c0ac49 100644 --- a/Mage.Sets/src/mage/cards/x/XantidSwarm.java +++ b/Mage.Sets/src/mage/cards/x/XantidSwarm.java @@ -68,7 +68,7 @@ class XantidSwarmTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override diff --git a/Mage.Sets/src/mage/cards/x/XathridDemon.java b/Mage.Sets/src/mage/cards/x/XathridDemon.java index 0e7c174c463..298a1de1f17 100644 --- a/Mage.Sets/src/mage/cards/x/XathridDemon.java +++ b/Mage.Sets/src/mage/cards/x/XathridDemon.java @@ -89,22 +89,22 @@ class XathridDemonEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { int amount = permanent.getPower().getValue(); - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); if (amount > 0) { Set opponents = game.getOpponents(source.getControllerId()); for (UUID opponentId : opponents) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { - opponent.loseLife(amount, game, false); + opponent.loseLife(amount, game, source, false); } } } return true; } } else { - sourcePermanent.tap(game); - controller.loseLife(7, game, false); + sourcePermanent.tap(source, game); + controller.loseLife(7, game, source, false); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/x/XyrisTheWrithingStorm.java b/Mage.Sets/src/mage/cards/x/XyrisTheWrithingStorm.java index 9dedb057a7d..b15254d019d 100644 --- a/Mage.Sets/src/mage/cards/x/XyrisTheWrithingStorm.java +++ b/Mage.Sets/src/mage/cards/x/XyrisTheWrithingStorm.java @@ -118,8 +118,8 @@ class XyrisTheWrithingStormCombatDamageEffect extends OneShotEffect { if (sourceController != null && damagedPlayer != null) { int amount = (Integer) getValue("damage"); if (amount > 0) { - sourceController.drawCards(amount, source.getSourceId(), game); - damagedPlayer.drawCards(amount, source.getSourceId(), game); + sourceController.drawCards(amount, source, game); + damagedPlayer.drawCards(amount, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/y/YawgmothDemon.java b/Mage.Sets/src/mage/cards/y/YawgmothDemon.java index ce0fe2241de..68acb29fe10 100644 --- a/Mage.Sets/src/mage/cards/y/YawgmothDemon.java +++ b/Mage.Sets/src/mage/cards/y/YawgmothDemon.java @@ -77,8 +77,8 @@ class YawgmothDemonEffect extends OneShotEffect { if (!artifactSacrificed) { Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game); if (sourceObject != null) { - sourceObject.tap(game); - controller.damage(2, source.getSourceId(), game); + sourceObject.tap(source, game); + controller.damage(2, source.getSourceId(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/y/YawgmothsAgenda.java b/Mage.Sets/src/mage/cards/y/YawgmothsAgenda.java index d36dfbe7421..fd1801b33ce 100644 --- a/Mage.Sets/src/mage/cards/y/YawgmothsAgenda.java +++ b/Mage.Sets/src/mage/cards/y/YawgmothsAgenda.java @@ -108,27 +108,13 @@ class YawgmothsAgendaReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - if (permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } else { - Card card = game.getCard(event.getTargetId()); - if (card != null) { - return controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } - return false; - } - return true; + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/y/YawgmothsVileOffering.java b/Mage.Sets/src/mage/cards/y/YawgmothsVileOffering.java index 4cbc745d66f..20820278c26 100644 --- a/Mage.Sets/src/mage/cards/y/YawgmothsVileOffering.java +++ b/Mage.Sets/src/mage/cards/y/YawgmothsVileOffering.java @@ -87,7 +87,7 @@ class YawgmothsVileOfferingEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.destroy(source.getId(), game, false); + permanent.destroy(source, game, false); } return false; diff --git a/Mage.Sets/src/mage/cards/y/YawgmothsWill.java b/Mage.Sets/src/mage/cards/y/YawgmothsWill.java index cfdb0d77e18..03f190e0d3a 100644 --- a/Mage.Sets/src/mage/cards/y/YawgmothsWill.java +++ b/Mage.Sets/src/mage/cards/y/YawgmothsWill.java @@ -98,27 +98,13 @@ class YawgmothsWillReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - if (permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } else { - Card card = game.getCard(event.getTargetId()); - if (card != null) { - return controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } - return false; - } - return true; + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/y/YennettCrypticSovereign.java b/Mage.Sets/src/mage/cards/y/YennettCrypticSovereign.java index ffe1e9160e7..863105418b8 100644 --- a/Mage.Sets/src/mage/cards/y/YennettCrypticSovereign.java +++ b/Mage.Sets/src/mage/cards/y/YennettCrypticSovereign.java @@ -99,10 +99,10 @@ class YennettCrypticSovereignEffect extends OneShotEffect { choose not to cast it, you draw a card. Keep in mind that revealing a card doesn’t cause it to change zones. This means that the card you draw will be the card you revealed. */ - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } } else { - player.drawCards(1, source.getSourceId(), game); + player.drawCards(1, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/y/YodaJediMaster.java b/Mage.Sets/src/mage/cards/y/YodaJediMaster.java index 63f1a3768db..027b5ced276 100644 --- a/Mage.Sets/src/mage/cards/y/YodaJediMaster.java +++ b/Mage.Sets/src/mage/cards/y/YodaJediMaster.java @@ -91,7 +91,7 @@ class YodaJediMasterEffect extends OneShotEffect { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (permanent != null && sourcePermanent != null) { - if (permanent.moveToExile(source.getSourceId(), sourcePermanent.getName(), source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), sourcePermanent.getName(), source, game)) { //create delayed triggered ability Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect(); effect.setText("Return that card to the battlefield under your control at the beginning of your next end step"); diff --git a/Mage.Sets/src/mage/cards/y/YoseiTheMorningStar.java b/Mage.Sets/src/mage/cards/y/YoseiTheMorningStar.java index 32c1b591a12..01ee5417a73 100644 --- a/Mage.Sets/src/mage/cards/y/YoseiTheMorningStar.java +++ b/Mage.Sets/src/mage/cards/y/YoseiTheMorningStar.java @@ -114,7 +114,7 @@ class YoseiTheMorningStarTapEffect extends OneShotEffect { for (UUID target : target1.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } else { return false; } diff --git a/Mage.Sets/src/mage/cards/y/YukoraThePrisoner.java b/Mage.Sets/src/mage/cards/y/YukoraThePrisoner.java index 89790500109..eaef028626a 100644 --- a/Mage.Sets/src/mage/cards/y/YukoraThePrisoner.java +++ b/Mage.Sets/src/mage/cards/y/YukoraThePrisoner.java @@ -80,7 +80,7 @@ class YukoraThePrisonerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game); for (Permanent permanent : permanents) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java b/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java index 651b84fdddf..67e67ef83fe 100644 --- a/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java +++ b/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java @@ -66,7 +66,7 @@ class ZadaHedronGrinderTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage.Sets/src/mage/cards/z/ZaxaraTheExemplary.java b/Mage.Sets/src/mage/cards/z/ZaxaraTheExemplary.java index a5b097d41d2..fa0d7f12d99 100644 --- a/Mage.Sets/src/mage/cards/z/ZaxaraTheExemplary.java +++ b/Mage.Sets/src/mage/cards/z/ZaxaraTheExemplary.java @@ -131,7 +131,7 @@ class ZaxaraTheExemplaryHydraTokenEffect extends OneShotEffect { int xValue = spell.getSpellAbility().getManaCostsToPay().getX(); Token hydraToken = new ZaxaraTheExemplaryHydraToken(); - hydraToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + hydraToken.putOntoBattlefield(1, game, source, source.getControllerId()); for (UUID tokenId : hydraToken.getLastAddedTokenIds()) { Permanent permanent = game.getPermanent(tokenId); diff --git a/Mage.Sets/src/mage/cards/z/ZedruuTheGreathearted.java b/Mage.Sets/src/mage/cards/z/ZedruuTheGreathearted.java index 78c292f791e..0f1c8999007 100644 --- a/Mage.Sets/src/mage/cards/z/ZedruuTheGreathearted.java +++ b/Mage.Sets/src/mage/cards/z/ZedruuTheGreathearted.java @@ -88,7 +88,7 @@ public final class ZedruuTheGreathearted extends CardImpl { public boolean apply(Game game, Ability source) { Permanent permanent = targetPermanentReference.getPermanent(game); if (permanent != null) { - return permanent.changeControllerId(source.getFirstTarget(), game); + return permanent.changeControllerId(source.getFirstTarget(), game, source); } else { discard(); } diff --git a/Mage.Sets/src/mage/cards/z/ZhurTaaDruid.java b/Mage.Sets/src/mage/cards/z/ZhurTaaDruid.java index acd05e15372..ffeae4d28e2 100644 --- a/Mage.Sets/src/mage/cards/z/ZhurTaaDruid.java +++ b/Mage.Sets/src/mage/cards/z/ZhurTaaDruid.java @@ -58,8 +58,10 @@ class ZhurTaaDruidAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.TAPPED_FOR_MANA - && !game.inCheckPlayableState(); + if (game.inCheckPlayableState()) { + return false; + } + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; } @Override diff --git a/Mage.Sets/src/mage/cards/z/ZoZuThePunisher.java b/Mage.Sets/src/mage/cards/z/ZoZuThePunisher.java index c235d1e655f..6c8eb10c0da 100644 --- a/Mage.Sets/src/mage/cards/z/ZoZuThePunisher.java +++ b/Mage.Sets/src/mage/cards/z/ZoZuThePunisher.java @@ -63,7 +63,7 @@ class ZoZuThePunisherAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage.Sets/src/mage/cards/z/ZombieApocalypse.java b/Mage.Sets/src/mage/cards/z/ZombieApocalypse.java index 5c06588625b..647c136cfdd 100644 --- a/Mage.Sets/src/mage/cards/z/ZombieApocalypse.java +++ b/Mage.Sets/src/mage/cards/z/ZombieApocalypse.java @@ -69,7 +69,7 @@ class ZombieApocalypseEffect extends OneShotEffect { game.getState().processAction(game); for (Permanent permanent : game.getBattlefield().getActivePermanents( new FilterPermanent(SubType.HUMAN, "Humans"), source.getControllerId(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage.Sets/src/mage/cards/z/ZursWeirding.java b/Mage.Sets/src/mage/cards/z/ZursWeirding.java index 0f2a3035b4a..463012ce960 100644 --- a/Mage.Sets/src/mage/cards/z/ZursWeirding.java +++ b/Mage.Sets/src/mage/cards/z/ZursWeirding.java @@ -107,7 +107,7 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { while (otherPlayer.canRespond() && !paid && otherPlayer.chooseUse(Outcome.Benefit, message, source, game)) { - paid = lifeCost.pay(source, game, source.getSourceId(), otherPlayer.getId(), false, null); + paid = lifeCost.pay(source, game, source, otherPlayer.getId(), false, null); } if (paid) { player.moveCards(card, Zone.GRAVEYARD, source, game); @@ -116,7 +116,7 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { } } // This is still replacing the draw, so we still return true - player.drawCards(1, source.getSourceId(), game, event.getAppliedEffects()); + player.drawCards(1, source, game, event); return true; } } diff --git a/Mage.Sets/src/mage/cards/z/ZurzothChaosRider.java b/Mage.Sets/src/mage/cards/z/ZurzothChaosRider.java index 9cc45d7afa8..1afcb0d7a87 100644 --- a/Mage.Sets/src/mage/cards/z/ZurzothChaosRider.java +++ b/Mage.Sets/src/mage/cards/z/ZurzothChaosRider.java @@ -178,8 +178,8 @@ class ZurzothChaosRiderEffect extends OneShotEffect { if (player == null) { continue; } - player.drawCards(1, source.getSourceId(), game); - player.discard(1, true, source, game); + player.drawCards(1, source, game); + player.discard(1, true, false, source, game); } return true; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConspireTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConspireTest.java index aafdaa4efb2..a1634acd61e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConspireTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConspireTest.java @@ -84,13 +84,21 @@ public class ConspireTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Wort, the Raidmother"); addCard(Zone.HAND, playerA, "Lightning Bolt"); + // prepare goblins castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wort, the Raidmother");// {4}{R/G}{R/G} + // cast with conspire castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB); - setChoice(playerA, "Yes"); + setChoice(playerA, "Yes"); // use conspire + setChoice(playerA, "Goblin Warrior"); + setChoice(playerA, "Goblin Warrior"); + setChoice(playerA, "No"); // keep targets + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_TURN); execute(); + assertAllCommandsUsed(); + assertPermanentCount(playerA, "Wort, the Raidmother", 1); assertGraveyardCount(playerA, "Lightning Bolt", 1); assertLife(playerB, 14); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java index c5fc534f911..fafc7c99fd2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java @@ -1,5 +1,3 @@ - - package org.mage.test.cards.abilities.keywords; import mage.abilities.keyword.HexproofAbility; @@ -20,10 +18,13 @@ public class HexproofTest extends CardTestPlayerBase { public void testOneTargetOneGainingHexproof() { addCard(Zone.BATTLEFIELD, playerA, "Forest", 4); addCard(Zone.BATTLEFIELD, playerA, "Elder of Laurels"); - addCard(Zone.HAND, playerA, "Ranger's Guile"); - + // + // Target creature you control gets +1/+1 and gains hexproof until end of turn. + addCard(Zone.HAND, playerA, "Ranger's Guile"); // {G} + // + // Return up to two target creatures to their owners’ hands. + addCard(Zone.HAND, playerB, "Into the Void"); //{3}{U} addCard(Zone.BATTLEFIELD, playerB, "Island", 4); - addCard(Zone.HAND, playerB, "Into the Void"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Into the Void", "Elder of Laurels"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Ranger's Guile", "Elder of Laurels"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MadnessTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MadnessTest.java index 3c41b01166f..8f366cf8a32 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MadnessTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MadnessTest.java @@ -35,9 +35,13 @@ public class MadnessTest extends CardTestPlayerBase { @Test public void testMadness() { addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); - addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); + // + // Madness {2}{G} (If you discard this card, discard it into exile. When you do, cast it for its madness cost or put it into your graveyard.) addCard(Zone.HAND, playerA, "Arrogant Wurm"); - addCard(Zone.HAND, playerA, "Raven's Crime"); + // + // Target player discards a card. + addCard(Zone.HAND, playerA, "Raven's Crime"); // {B} + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raven's Crime", playerA); setChoice(playerA, "Yes"); // use madness triggered ability diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ReboundTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ReboundTest.java index b47aa4f91e2..889788ec3d2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ReboundTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ReboundTest.java @@ -10,125 +10,134 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * 702.87. Rebound - * 702.87a Rebound appears on some instants and sorceries. It represents a static ability that functions while - * the spell is on the stack and may create a delayed triggered ability. "Rebound" means "If this spell was cast - * from your hand, instead of putting it into your graveyard as it resolves, exile it and, at the beginning of - * your next upkeep, you may cast this card from exile without paying its mana cost." - * 702.87b Casting a card without paying its mana cost as the result of a rebound ability follows the rules for - * paying alternative costs in rules 601.2b and 601.2e–g. - * 702.87c Multiple instances of rebound on the same spell are redundant. - * + * 702.87. Rebound + * 702.87a Rebound appears on some instants and sorceries. It represents a static ability that functions while + * the spell is on the stack and may create a delayed triggered ability. "Rebound" means "If this spell was cast + * from your hand, instead of putting it into your graveyard as it resolves, exile it and, at the beginning of + * your next upkeep, you may cast this card from exile without paying its mana cost." + * 702.87b Casting a card without paying its mana cost as the result of a rebound ability follows the rules for + * paying alternative costs in rules 601.2b and 601.2e–g. + * 702.87c Multiple instances of rebound on the same spell are redundant. + * * @author jeff */ -public class ReboundTest extends CardTestPlayerBase{ - +public class ReboundTest extends CardTestPlayerBase { + /** * Test that the spell with rebound is moved to exile if * the spell resolves */ - + @Test public void testCastFromHandMovedToExile() { addCard(Zone.BATTLEFIELD, playerA, "Island", 1); - + // Target creature gets +1/+0 until end of turn and is unblockable this turn. addCard(Zone.HAND, playerA, "Distortion Strike"); - + addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - + //check exile and graveyard assertExileCount("Distortion Strike", 1); assertGraveyardCount(playerA, 0); } + /** * Test that the spell with rebound can be cast again * on the beginning of the next upkeep without paying mana costs */ - + @Test public void testRecastFromExile() { addCard(Zone.BATTLEFIELD, playerA, "Island", 1); - + // Target creature gets +1/+0 until end of turn and is unblockable this turn. addCard(Zone.HAND, playerA, "Distortion Strike"); - + addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite"); setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); - + //check exile and graveyard assertPowerToughness(playerA, "Memnite", 2, 1); assertExileCount("Distortion Strike", 0); assertGraveyardCount(playerA, "Distortion Strike", 1); } - + /** * Check that a countered spell with rebound * is not cast again */ - + @Test public void testDontRecastAfterCounter() { addCard(Zone.BATTLEFIELD, playerA, "Island", 1); - + // Target creature gets +1/+0 until end of turn and is unblockable this turn. - addCard(Zone.HAND, playerA, "Distortion Strike"); + addCard(Zone.HAND, playerA, "Distortion Strike"); addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1); addCard(Zone.BATTLEFIELD, playerB, "Island", 2); - addCard(Zone.HAND, playerB, "Counterspell"); + addCard(Zone.HAND, playerB, "Counterspell"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Counterspell", "Distortion Strike"); setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); - + //check exile and graveyard assertGraveyardCount(playerB, "Counterspell", 1); assertGraveyardCount(playerA, "Distortion Strike", 1); assertPowerToughness(playerA, "Memnite", 1, 1); assertExileCount("Distortion Strike", 0); - } - - + } + + /** * Check that a fizzled spell with rebound * is not cast again on the next controllers upkeep + *

+ * rules: + * If a spell with rebound that you cast from your hand doesn’t resolve for any reason (due being countered by a + * spell like Cancel, or because all of its targets are illegal), rebound has no effect. The spell is simply put + * into your graveyard. You won’t get to cast it again next turn. + * (2010-06-15) */ - + @Test public void testDontRecastAfterFizzling() { addCard(Zone.BATTLEFIELD, playerA, "Island", 1); - + // Target creature gets +1/+0 until end of turn and is unblockable this turn. // Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, // you may cast this card from exile without paying its mana cost.) - addCard(Zone.HAND, playerA, "Distortion Strike"); + addCard(Zone.HAND, playerA, "Distortion Strike"); addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); - addCard(Zone.HAND, playerB, "Lightning Bolt", 1); + addCard(Zone.HAND, playerB, "Lightning Bolt", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Memnite","Distortion Strike"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Memnite", "Distortion Strike"); + setStrictChooseMode(true); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - + assertAllCommandsUsed(); + //check exile and graveyard assertGraveyardCount(playerB, "Lightning Bolt", 1); assertGraveyardCount(playerA, "Memnite", 1); - assertGraveyardCount(playerA, "Distortion Strike", 1); - } + assertGraveyardCount(playerA, "Distortion Strike", 1); // rebound is not activated in fizzled spell + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java index 9457ec96b79..31bd38c3430 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java @@ -1,4 +1,3 @@ - package org.mage.test.cards.abilities.oneshot.counter; import mage.constants.PhaseStep; @@ -7,7 +6,6 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * * @author LevelX2 */ public class AddingCountersToPermanentsTest extends CardTestPlayerBase { @@ -135,28 +133,28 @@ public class AddingCountersToPermanentsTest extends CardTestPlayerBase { */ @Test public void HapatraVizierOfPoisons() { - // Whenever Hapatra, Vizier of Poisons deals combat damage to a player, you may put a -1/-1 counter on target creature. // Whenever you put one or more -1/-1 counters on a creature, create a 1/1 green Snake creature token with deathtouch. addCard(Zone.BATTLEFIELD, playerA, "Hapatra, Vizier of Poisons", 1); - + // // When Kitchen Finks enters the battlefield, you gain 2 life. // Persist (When this creature dies, if it had no -1/-1 counters on it, return it to the battlefield under its owner's control with a -1/-1 counter on it.) addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 1); // Creature 3/2 - + // addCard(Zone.HAND, playerB, "Lightning Bolt"); addCard(Zone.BATTLEFIELD, playerB, "Mountain"); + // kill finks and return it to battlefield with hapata's trigger castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Kitchen Finks"); + setChoice(playerA, "When "); // two triggers (gain life + snake) + setStrictChooseMode(true); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); assertGraveyardCount(playerB, "Lightning Bolt", 1); - assertPowerToughness(playerA, "Kitchen Finks", 2, 1); - assertPermanentCount(playerA, "Snake", 1); - } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java index 3374cee1708..2e723097d8d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java @@ -7,22 +7,21 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * * @author escplan9 */ public class NestOfScarabsTest extends CardTestPlayerBase { - + /* Nest of Scarabs 2B Enchantment Whenever you put one or more -1/-1 counters on a creature, create that many 1/1 black Insect creature tokens. */ private final String nestScarabs = "Nest of Scarabs"; - + /* - * Reported bug: Nest of Scarabs not triggering off -1/-1 counters placed on creatures. - */ + * Reported bug: Nest of Scarabs not triggering off -1/-1 counters placed on creatures. + */ @Test public void scarabs_SoulStinger_TwoCountersTwoTokens() { @@ -33,24 +32,26 @@ public class NestOfScarabsTest extends CardTestPlayerBase { When Soulstinger dies, you may put a -1/-1 counter on target creature for each -1/-1 counter on Soulstinger. */ String stinger = "Soulstinger"; - + addCard(Zone.BATTLEFIELD, playerA, nestScarabs); addCard(Zone.HAND, playerA, stinger); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, stinger); addTarget(playerA, stinger); // place two -1/-1 counters on himself - + + setStrictChooseMode(true); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - + assertAllCommandsUsed(); + assertPermanentCount(playerA, nestScarabs, 1); assertPermanentCount(playerA, stinger, 1); assertCounterCount(playerA, stinger, CounterType.M1M1, 2); assertPowerToughness(playerA, stinger, 2, 3); // 4/5 with two -1/-1 counters assertPermanentCount(playerA, "Insect", 2); // two counters = two insects } - + /* * NOTE: test is failing due to bug in code. See issue #3402 * Bug from testing: @@ -65,27 +66,27 @@ public class NestOfScarabsTest extends CardTestPlayerBase { Put X -1/-1 counters on each creature. Shuffle Black Sun's Zenith into its owner's library. */ String blackZenith = "Black Sun's Zenith"; - + String hillGiant = "Hill Giant"; // {3}{R} 3/3 String grizzly = "Grizzly Bears"; // {1}{G} 2/2 String memnite = "Memnite"; // {0} 1/1 String fugitive = "Fugitive Wizard"; // {U} 1/1 - + addCard(Zone.BATTLEFIELD, playerA, nestScarabs); addCard(Zone.HAND, playerA, blackZenith); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, fugitive); - + addCard(Zone.BATTLEFIELD, playerB, grizzly); addCard(Zone.BATTLEFIELD, playerB, memnite); addCard(Zone.BATTLEFIELD, playerB, hillGiant); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, blackZenith); setChoice(playerA, "X=1"); - + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - + assertPermanentCount(playerA, nestScarabs, 1); assertHandCount(playerA, blackZenith, 0); assertLibraryCount(playerA, blackZenith, 1); // shuffles back into library @@ -93,13 +94,13 @@ public class NestOfScarabsTest extends CardTestPlayerBase { assertGraveyardCount(playerB, memnite, 1); assertPermanentCount(playerB, grizzly, 1); assertPermanentCount(playerB, hillGiant, 1); - assertCounterCount(playerB, grizzly, CounterType.M1M1, 1); + assertCounterCount(playerB, grizzly, CounterType.M1M1, 1); assertCounterCount(playerB, hillGiant, CounterType.M1M1, 1); assertPowerToughness(playerB, grizzly, 1, 1); // 2/2 with -1/-1 counter assertPowerToughness(playerB, hillGiant, 2, 2); // 3/3 with -1/-1 counter assertPermanentCount(playerA, "Insect", 4); // 4 counters = 4 insects } - + /* * NOTE: test is failing due to bug in code. See issue #3402 * Bug from testing: @@ -115,28 +116,28 @@ public class NestOfScarabsTest extends CardTestPlayerBase { Put X -1/-1 counters on each creature. Shuffle Black Sun's Zenith into its owner's library. */ String blackZenith = "Black Sun's Zenith"; - + String hillGiant = "Hill Giant"; // {3}{R} 3/3 String grizzly = "Grizzly Bears"; // {1}{G} 2/2 String memnite = "Memnite"; // {0} 1/1 String fugitive = "Fugitive Wizard"; // {U} 1/1 - + addCard(Zone.BATTLEFIELD, playerA, nestScarabs); addCard(Zone.HAND, playerA, blackZenith); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, fugitive); - + addCard(Zone.BATTLEFIELD, playerB, nestScarabs); addCard(Zone.BATTLEFIELD, playerB, grizzly); addCard(Zone.BATTLEFIELD, playerB, memnite); addCard(Zone.BATTLEFIELD, playerB, hillGiant); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, blackZenith); setChoice(playerA, "X=1"); - + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - + assertPermanentCount(playerA, nestScarabs, 1); assertPermanentCount(playerB, nestScarabs, 1); assertHandCount(playerA, blackZenith, 0); @@ -145,14 +146,14 @@ public class NestOfScarabsTest extends CardTestPlayerBase { assertGraveyardCount(playerB, memnite, 1); assertPermanentCount(playerB, grizzly, 1); assertPermanentCount(playerB, hillGiant, 1); - assertCounterCount(playerB, grizzly, CounterType.M1M1, 1); + assertCounterCount(playerB, grizzly, CounterType.M1M1, 1); assertCounterCount(playerB, hillGiant, CounterType.M1M1, 1); assertPowerToughness(playerB, grizzly, 1, 1); // 2/2 with -1/-1 counter assertPowerToughness(playerB, hillGiant, 2, 2); // 3/3 with -1/-1 counter assertPermanentCount(playerB, "Insect", 0); // playerB did not place the -1/-1 counters, should not trigger assertPermanentCount(playerA, "Insect", 4); // 4 counters = 4 insects } - + /* Reported bug: Nest of Scarabs not triggering off infect damage dealt by creatures such as Blight Mamba */ @@ -178,14 +179,14 @@ public class NestOfScarabsTest extends CardTestPlayerBase { assertCounterCount(playerB, wOmens, CounterType.M1M1, 1); assertPermanentCount(playerA, "Insect", 1); } - + /* Reported bug: Nest of Scarabs not triggering off wither damage dealt by creatures such as Sickle Ripper */ @Test public void scarab_witherDamageTriggers() { - + String sickleRipper = "Sickle Ripper"; // {1}{B} 2/1 Creature - Elemental Warrior, Wither String wOmens = "Wall of Omens"; // {1}{W} 0/4 defender ETB: draw a card diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/UnpredictableCycloneTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/UnpredictableCycloneTest.java index f4b81b34d39..1536617dbdd 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/UnpredictableCycloneTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/UnpredictableCycloneTest.java @@ -24,9 +24,11 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase { activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling"); setChoice(playerA, "Yes"); + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_TURN); execute(); assertAllCommandsUsed(); + assertPermanentCount(playerA, "Goblin Piker", 1); } @@ -42,9 +44,11 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase { activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling"); + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_TURN); execute(); assertAllCommandsUsed(); + assertHandCount(playerA, "Swamp", 1); } @@ -60,12 +64,16 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Thought Reflection"); addCard(Zone.HAND, playerA, "Desert Cerodon"); + showAvailableAbilities("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling"); setChoice(playerA, "Thought Reflection"); // apply doubling first + setChoice(playerA, "Yes", 2); // cast founded library cards + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_TURN); execute(); assertAllCommandsUsed(); + assertPermanentCount(playerA, "Goblin Piker", 2); } @@ -82,11 +90,18 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Desert Cerodon"); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling"); - setChoice(playerA, "Thought Reflection", 3); // apply doubling first + // from first cycle call + setChoice(playerA, "Thought Reflection", 2); // 3 triggers: 2x doubling + 1x cycle + setChoice(playerA, "Yes", 2); // cast founded library cards for 2x doubling triggers + // from triggered cycle + setChoice(playerA, "Thought Reflection", 1); // 2 triggers: 1x doubling + 1x cycle + setChoice(playerA, "Yes", 2); // cast founded library cards for 2x doubling triggers + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_TURN); execute(); assertAllCommandsUsed(); + assertPermanentCount(playerA, "Goblin Piker", 4); } @@ -105,10 +120,13 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plagiarize", playerB); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cycling"); + setChoice(playerA, "Yes"); // cast founded library card + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_TURN); execute(); assertAllCommandsUsed(); + assertPermanentCount(playerA, "Goblin Piker", 1); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java index f66f66b05c9..55ef69c44c4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java @@ -4,8 +4,6 @@ import mage.game.permanent.Permanent; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; -import java.util.UUID; - import static mage.constants.PhaseStep.*; import static mage.constants.Zone.BATTLEFIELD; import static mage.constants.Zone.HAND; @@ -34,7 +32,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase { @Test public void should_reduce_life_of_playerA_by_1_at_the_beginning_of_the_next_end_step() { - playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID()); + setLife(playerA, ANY_LIFE_TOTAL); playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase(); @@ -48,7 +46,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase { @Test public void should_not_reduce_life_of_playerA_by_1_at_post_combat_main_step() { - playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID()); + setLife(playerA, ANY_LIFE_TOTAL); playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase(); @@ -62,7 +60,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase { @Test public void should_return_Brood_of_Cockroaches_to_playerA_hand_end_of_turn() { - playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID()); + setLife(playerA, ANY_LIFE_TOTAL); playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase(); @@ -76,7 +74,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase { @Test public void should_not_return_Brood_of_Cockroaches_to_playerA_at_post_combat_step() { - playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID()); + setLife(playerA, ANY_LIFE_TOTAL); playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/AbilityOwnershipTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/AbilityOwnershipTest.java index e1970fa1919..eea23ee1b1a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/AbilityOwnershipTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/AbilityOwnershipTest.java @@ -9,32 +9,51 @@ public class AbilityOwnershipTest extends CardTestPlayerBase { @Test public void testOwned() { + // When Soul Snuffers enters the battlefield, put a -1/-1 counter on each creature. addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers"); + // + // Exploit (When this creature enters the battlefield, you may sacrifice a creature.) + // When Minister of Pain exploits a creature, creatures your opponents control get -1/-1 until end of turn. addCard(Zone.GRAVEYARD, playerB, "Minister of Pain"); + // Put all creature cards from all graveyards onto the battlefield under your control. addCard(Zone.HAND, playerA, "Rise of the Dark Realms"); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9); + // + // Whenever you put one or more -1/-1 counters on a creature, each opponent loses 1 life and you gain 1 life. addCard(Zone.BATTLEFIELD, playerA, "Obelisk Spider"); setLife(playerA, 20); setLife(playerB, 20); + // return two creatures from graveyard: + // - Soul Snuffers must gives 1 counter to each creature (total: 3x from my creatures) + // - Minister of Pain must gives 0 counter to opponent's creature (total: 0x, cause opponents don't have creatures and we don't use exploit) + // - SO Obelisk Spider must triggers 3x times castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms"); - setChoice(playerA, "Yes"); - addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit + setChoice(playerA, "When "); // two triggers + // * Ability: Soul Snuffers - EntersBattlefieldTriggeredAbility: When {this} enters the battlefield, put a -1/-1 counter on each creature. + // * Ability: Minister of Pain - ExploitAbility: Exploit (When this creature enters the battlefield, you may sacrifice a creature.) + setChoice(playerA, "No"); // no exploit + // 3x life triggers + setChoice(playerA, "Whenever you put one or more"); + setChoice(playerA, "Whenever you put one or more"); + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_COMBAT); execute(); + assertAllCommandsUsed(); - // Obelisk Spider Triggers twice once for the counter on Obelisk Spider. Once for the counter on Minister of Pain. - assertLife(playerA, 22); - assertLife(playerB, 18); + // Obelisk Spider Triggers 3x (Soul Snuffers puts 3 counters on 3 creatures) + assertLife(playerA, 20 + 3); + assertLife(playerB, 20 - 3); } @Test public void testToGraveyard() { addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers"); addCard(Zone.GRAVEYARD, playerB, "Minister of Pain"); + // Whenever you put one or more -1/-1 counters on a creature, each opponent loses 1 life and you gain 1 life. addCard(Zone.BATTLEFIELD, playerB, "Obelisk Spider"); addCard(Zone.HAND, playerA, "Rise of the Dark Realms"); @@ -43,12 +62,18 @@ public class AbilityOwnershipTest extends CardTestPlayerBase { setLife(playerA, 20); setLife(playerB, 20); + // return two creatures from graveyard: + // - Soul Snuffers must gives 1 counter to each creature (total: 2x from my creatures) + // - Minister of Pain must gives 0 counter to opponent's creature (total: 0x, cause opponents don't have creatures and we don't use exploit) + // - SO Obelisk Spider must triggers 2x times, BUT it's controlled by opponent, so no triggers at all castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms"); - setChoice(playerA, "Yes"); - addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit + setChoice(playerA, "When "); // two triggers + setChoice(playerA, "No"); // no exploit + setStrictChooseMode(true); setStopAt(1, PhaseStep.END_COMBAT); execute(); + assertAllCommandsUsed(); assertLife(playerA, 20); assertLife(playerB, 20); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/StormCauldronTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/StormCauldronTest.java index 23536478a18..228983b70ac 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/StormCauldronTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/StormCauldronTest.java @@ -1,8 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ package org.mage.test.cards.triggers; import mage.constants.PhaseStep; @@ -11,7 +6,6 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * * @author LevelX2 */ public class StormCauldronTest extends CardTestPlayerBase { @@ -20,37 +14,37 @@ public class StormCauldronTest extends CardTestPlayerBase { * With Storm Cauldron in play (owned by opponent), I sacced Crystal Vein * for 2 mana... except it got returned to my hand, which shouldn't happen. * Haven't tested it with other sac lands yet. - * + *

* Relevant ruing for Storm Cauldron: - * + *

* 10/4/2004: If a land is tapped for mana and sacrificed all in one action, * it goes to the graveyard before the Cauldron can return it to the * player's hand. - * */ @Test public void testLandNotReturnedToHand() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + addCard(Zone.HAND, playerA, "Mountain", 1); // {T}: Add {C}. // {T}, Sacrifice Crystal Vein: Add {C}{C}. - addCard(Zone.BATTLEFIELD, playerA, "Crystal Vein", 1); - + addCard(Zone.HAND, playerA, "Crystal Vein", 1); + // // Each player may play an additional land during each of their turns. // Whenever a land is tapped for mana, return it to its owner's hand. addCard(Zone.BATTLEFIELD, playerB, "Storm Cauldron", 1); + // can play two lands playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crystal Vein"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mountain"); - activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}, Sacrifice"); + activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}, Sacrifice"); - setStopAt(1, PhaseStep.BEGIN_COMBAT); + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); execute(); + assertAllCommandsUsed(); assertGraveyardCount(playerA, "Crystal Vein", 1); assertPermanentCount(playerA, "Mountain", 1); assertHandCount(playerA, "Crystal Vein", 0); - } - } diff --git a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java index 4d38ed4e1c2..b5eaf6da364 100644 --- a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java @@ -46,6 +46,7 @@ public class LoadTest { private static final int TEST_PORT = 17171; private static final String TEST_PROXY_TYPE = "None"; private static final String TEST_USER_NAME = "user"; + private static final String TEST_AI_SETS_USAGE = "CMR"; // set in generated decks for AI games (empty for all sets usage) @BeforeClass public static void initDatabase() { @@ -267,7 +268,7 @@ public class LoadTest { @Test @Ignore public void test_TwoAIPlayGame_One() { - playTwoAIGame("Single AI game", "GR", "GRN"); + playTwoAIGame("Single AI game", "WGUBR", TEST_AI_SETS_USAGE); } @Test @@ -293,7 +294,7 @@ public class LoadTest { long randomSeed = seedsList.get(i); logger.info("Game " + (i + 1) + " of " + seedsList.size() + ", RANDOM seed: " + randomSeed); RandomUtil.setSeed(randomSeed); - playTwoAIGame("AI game #" + (i + 1), "WGUBR", "ELD"); + playTwoAIGame("AI game #" + (i + 1), "WGUBR", TEST_AI_SETS_USAGE); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java index f2db711c38b..8c2d4f25622 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java @@ -30,7 +30,7 @@ import java.util.*; */ public class RandomPlayer extends ComputerPlayer { - private boolean isSimulatedPlayer; + private final boolean isSimulatedPlayer; private int actionCount = 0; protected PassAbility pass = new PassAbility(); @@ -138,7 +138,7 @@ public class RandomPlayer extends ComputerPlayer { if (ability.isUsesStack()) { game.getStack().push(new StackAbility(ability, playerId)); if (ability.activate(game, false)) { - game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability, ability.getControllerId())); actionCount++; return true; } @@ -178,7 +178,7 @@ public class RandomPlayer extends ComputerPlayer { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { int numGroups = game.getCombat().getGroups().size(); if (numGroups == 0) { return; @@ -373,7 +373,7 @@ public class RandomPlayer extends ComputerPlayer { } @Override - public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { + public void assignDamage(int damage, List targets, String singleTargetName, UUID attackerId, Ability source, Game game) { int remainingDamage = damage; UUID targetId; int amount; @@ -387,12 +387,12 @@ public class RandomPlayer extends ComputerPlayer { } Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(amount, sourceId, game, false, true); + permanent.damage(amount, attackerId, source, game, false, true); remainingDamage -= amount; } else { Player player = game.getPlayer(targetId); if (player != null) { - player.damage(amount, sourceId, game); + player.damage(amount, attackerId, source, game); remainingDamage -= amount; } } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 9f448363f68..d025829913f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -2,12 +2,14 @@ package org.mage.test.player; import mage.*; import mage.abilities.*; +import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.AlternativeSourceCosts; import mage.abilities.costs.Cost; import mage.abilities.costs.Costs; import mage.abilities.costs.VariableCost; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ManaOptions; import mage.cards.Card; @@ -35,6 +37,7 @@ import mage.game.Graveyard; import mage.game.Table; import mage.game.combat.CombatGroup; import mage.game.draft.Draft; +import mage.game.events.GameEvent; import mage.game.match.Match; import mage.game.match.MatchPlayer; import mage.game.permanent.Permanent; @@ -564,6 +567,10 @@ public class TestPlayer implements Player { removed.forEach(actionsToRemoveLater::remove); } + // fake test ability for triggers and events + Ability source = new SimpleStaticAbility(Zone.OUTSIDE, new InfoEffect("adding testing cards")); + source.setControllerId(this.getId()); + int numberOfActions = actions.size(); List tempActions = new ArrayList<>(); tempActions.addAll(actions); @@ -663,7 +670,7 @@ public class TestPlayer implements Player { CounterType counterType = CounterType.findByName(groups[1]); Assert.assertNotNull("Invalid counter type " + groups[1], counterType); Counter counter = counterType.createInstance(Integer.parseInt(groups[2])); - permanent.addCounters(counter, null, game); + permanent.addCounters(counter, source, game); actions.remove(action); return true; } @@ -1034,7 +1041,7 @@ public class TestPlayer implements Player { * rollback. * * @param game - * @param rollbackBlock rollback block to add the actions for + * @param rollbackBlockNumber rollback block to add the actions for */ private void addActionsAfterRollback(Game game, int rollbackBlockNumber) { Map> rollbackBlock = rollbackActions.get(rollbackBlockNumber); @@ -1680,7 +1687,7 @@ public class TestPlayer implements Player { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { List tempActions = new ArrayList<>(actions); UUID opponentId = game.getOpponents(computerPlayer.getId()).iterator().next(); @@ -1692,7 +1699,7 @@ public class TestPlayer implements Player { // aiXXX commands if (action.getTurnNum() == game.getTurnNum() && action.getAction().equals(AI_PREFIX + AI_COMMAND_PLAY_STEP)) { mustBlockByAction = true; - this.computerPlayer.selectBlockers(game, defendingPlayerId); + this.computerPlayer.selectBlockers(source, game, defendingPlayerId); actions.remove(action); break; } @@ -1726,7 +1733,7 @@ public class TestPlayer implements Player { // AI FULL play if no actions available if (!mustBlockByAction && this.AIPlayer) { - this.computerPlayer.selectBlockers(game, defendingPlayerId); + this.computerPlayer.selectBlockers(source, game, defendingPlayerId); } } @@ -2154,15 +2161,15 @@ public class TestPlayer implements Player { // ^ - multiple targets // [] - special option like [no copy] // = - target type like targetPlayer=PlayerA - Boolean foundMulti = targetDefinition.contains("^"); - Boolean foundSpecialStart = targetDefinition.contains("["); - Boolean foundSpecialClose = targetDefinition.contains("]"); - Boolean foundEquals = targetDefinition.contains("="); + boolean foundMulti = targetDefinition.contains("^"); + boolean foundSpecialStart = targetDefinition.contains("["); + boolean foundSpecialClose = targetDefinition.contains("]"); + boolean foundEquals = targetDefinition.contains("="); - Boolean canMulti = canSupportChars.contains("^"); - Boolean canSpecialStart = canSupportChars.contains("["); - Boolean canSpecialClose = canSupportChars.contains("]"); - Boolean canEquals = canSupportChars.contains("="); + boolean canMulti = canSupportChars.contains("^"); + boolean canSpecialStart = canSupportChars.contains("["); + boolean canSpecialClose = canSupportChars.contains("]"); + boolean canEquals = canSupportChars.contains("="); // how to fix: change target definition for addTarget in test's code or update choose from targets implementation in TestPlayer if ((foundMulti && !canMulti) || (foundSpecialStart && !canSpecialStart) || (foundSpecialClose && !canSpecialClose) || (foundEquals && !canEquals)) { @@ -2715,13 +2722,13 @@ public class TestPlayer implements Player { } @Override - public int drawCards(int num, UUID sourceId, Game game) { - return computerPlayer.drawCards(num, sourceId, game); + public int drawCards(int num, Ability source, Game game) { + return computerPlayer.drawCards(num, source, game); } @Override - public int drawCards(int num, UUID sourceId, Game game, List appliedEffects) { - return computerPlayer.drawCards(num, sourceId, game, appliedEffects); + public int drawCards(int num, Ability source, Game game, GameEvent event) { + return computerPlayer.drawCards(num, source, game, event); } @Override @@ -2745,23 +2752,23 @@ public class TestPlayer implements Player { } @Override - public Card discardOne(boolean random, Ability source, Game game) { - return computerPlayer.discardOne(random, source, game); + public Card discardOne(boolean random, boolean payForCost, Ability source, Game game) { + return computerPlayer.discardOne(random, payForCost, source, game); } @Override - public Cards discard(int amount, boolean random, Ability source, Game game) { - return computerPlayer.discard(amount, random, source, game); + public Cards discard(int amount, boolean random, boolean payForCost, Ability source, Game game) { + return computerPlayer.discard(amount, random, payForCost, source, game); } @Override - public Cards discard(Cards cards, Ability source, Game game) { - return computerPlayer.discard(cards, source, game); + public Cards discard(Cards cards, boolean payForCost, Ability source, Game game) { + return computerPlayer.discard(cards, payForCost, source, game); } @Override - public boolean discard(Card card, Ability source, Game game) { - return computerPlayer.discard(card, source, game); + public boolean discard(Card card, boolean payForCost, Ability source, Game game) { + return computerPlayer.discard(card, payForCost, source, game); } @Override @@ -2770,18 +2777,18 @@ public class TestPlayer implements Player { } @Override - public boolean addAttachment(UUID permanentId, Game game) { - return computerPlayer.addAttachment(permanentId, game); + public boolean addAttachment(UUID permanentId, Ability source, Game game) { + return computerPlayer.addAttachment(permanentId, source, game); } @Override - public boolean removeAttachment(Permanent attachment, Game game) { - return computerPlayer.removeAttachment(attachment, game); + public boolean removeAttachment(Permanent attachment, Ability source, Game game) { + return computerPlayer.removeAttachment(attachment, source, game); } @Override - public boolean removeFromBattlefield(Permanent permanent, Game game) { - return computerPlayer.removeFromBattlefield(permanent, game); + public boolean removeFromBattlefield(Permanent permanent, Ability source, Game game) { + return computerPlayer.removeFromBattlefield(permanent, source, game); } @Override @@ -3006,11 +3013,6 @@ public class TestPlayer implements Player { computerPlayer.initLife(life); } - @Override - public void setLife(int life, Game game, UUID sourceId) { - computerPlayer.setLife(life, game, sourceId); - } - @Override public void setLife(int life, Game game, Ability source) { computerPlayer.setLife(life, game, source); @@ -3042,8 +3044,13 @@ public class TestPlayer implements Player { } @Override - public int loseLife(int amount, Game game, boolean atCombat) { - return computerPlayer.loseLife(amount, game, atCombat); + public int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId) { + return computerPlayer.loseLife(amount, game, source, atCombat, attackerId); + } + + @Override + public int loseLife(int amount, Game game, Ability source, boolean atCombat) { + return computerPlayer.loseLife(amount, game, source, atCombat); } @Override @@ -3062,28 +3069,23 @@ public class TestPlayer implements Player { } @Override - public int gainLife(int amount, Game game, UUID sourceId) { - return computerPlayer.gainLife(amount, game, sourceId); + public int damage(int damage, UUID attackerId, Ability source, Game game) { + return computerPlayer.damage(damage, attackerId, source, game); } @Override - public int damage(int damage, UUID sourceId, Game game) { - return computerPlayer.damage(damage, sourceId, game); + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable) { + return computerPlayer.damage(damage, attackerId, source, game, combatDamage, preventable); } @Override - public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) { - return computerPlayer.damage(damage, sourceId, game, combatDamage, preventable); + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { + return computerPlayer.damage(damage, attackerId, source, game, combatDamage, preventable, appliedEffects); } @Override - public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { - return computerPlayer.damage(damage, sourceId, game, combatDamage, preventable, appliedEffects); - } - - @Override - public boolean addCounters(Counter counter, Game game) { - return computerPlayer.addCounters(counter, game); + public boolean addCounters(Counter counter, Ability source, Game game) { + return computerPlayer.addCounters(counter, source, game); } @Override @@ -3303,13 +3305,13 @@ public class TestPlayer implements Player { } @Override - public int rollDice(Game game, int numSides) { - return computerPlayer.rollDice(game, numSides); + public int rollDice(Ability source, Game game, int numSides) { + return computerPlayer.rollDice(source, game, numSides); } @Override - public int rollDice(Game game, List appliedEffects, int numSides) { - return computerPlayer.rollDice(game, appliedEffects, numSides); + public int rollDice(Ability source, Game game, List appliedEffects, int numSides) { + return computerPlayer.rollDice(source, game, appliedEffects, numSides); } @Override @@ -3413,8 +3415,8 @@ public class TestPlayer implements Player { } @Override - public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId, UUID controllerId, Game game) { - return computerPlayer.canPaySacrificeCost(permanent, sourceId, controllerId, game); + public boolean canPaySacrificeCost(Permanent permanent, Ability source, UUID controllerId, Game game) { + return computerPlayer.canPaySacrificeCost(permanent, source, controllerId, game); } @Override @@ -3538,13 +3540,8 @@ public class TestPlayer implements Player { } @Override - public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) { - return computerPlayer.moveCardToHandWithInfo(card, sourceId, game); - } - - @Override - public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName) { - return computerPlayer.moveCardToHandWithInfo(card, sourceId, game, withName); + public boolean moveCardToHandWithInfo(Card card, Ability source, Game game, boolean withName) { + return computerPlayer.moveCardToHandWithInfo(card, source, game, withName); } @Override @@ -3563,23 +3560,23 @@ public class TestPlayer implements Player { } @Override - public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { - return computerPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone); + public boolean moveCardToGraveyardWithInfo(Card card, Ability source, Game game, Zone fromZone) { + return computerPlayer.moveCardToGraveyardWithInfo(card, source, game, fromZone); } @Override - public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) { - return computerPlayer.moveCardToLibraryWithInfo(card, sourceId, game, fromZone, toTop, withName); + public boolean moveCardToLibraryWithInfo(Card card, Ability source, Game game, Zone fromZone, boolean toTop, boolean withName) { + return computerPlayer.moveCardToLibraryWithInfo(card, source, game, fromZone, toTop, withName); } @Override - public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName) { - return computerPlayer.moveCardToExileWithInfo(card, exileId, exileName, sourceId, game, fromZone, withName); + public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, Ability source, Game game, Zone fromZone, boolean withName) { + return computerPlayer.moveCardToExileWithInfo(card, exileId, exileName, source, game, fromZone, withName); } @Override - public boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { - return computerPlayer.moveCardToCommandWithInfo(card, sourceId, game, fromZone); + public boolean moveCardToCommandWithInfo(Card card, Ability source, Game game, Zone fromZone) { + return computerPlayer.moveCardToCommandWithInfo(card, source, game, fromZone); } @Override @@ -3905,10 +3902,10 @@ public class TestPlayer implements Player { @Override public void assignDamage(int damage, List targets, - String singleTargetName, UUID sourceId, + String singleTargetName, UUID attackerId, Ability source, Game game ) { - computerPlayer.assignDamage(damage, targets, singleTargetName, sourceId, game); + computerPlayer.assignDamage(damage, targets, singleTargetName, attackerId, source, game); } @Override @@ -4015,17 +4012,17 @@ public class TestPlayer implements Player { } @Override - public PlanarDieRoll rollPlanarDie(Game game) { + public PlanarDieRoll rollPlanarDie(Ability source, Game game) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override - public PlanarDieRoll rollPlanarDie(Game game, List appliedEffects) { + public PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override - public PlanarDieRoll rollPlanarDie(Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides) { + public PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 54f05da1b79..61c2dc80dfa 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -295,8 +295,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement if (!currentGame.isPaused()) { for (Player player : currentGame.getPlayers().values()) { TestPlayer testPlayer = (TestPlayer) player; - currentGame.cheat(player.getId(), getCommands(testPlayer)); - currentGame.cheat(player.getId(), activePlayer.getId(), getLibraryCards(testPlayer), getHandCards(testPlayer), + currentGame.cheat(testPlayer.getId(), getCommands(testPlayer)); + currentGame.cheat(testPlayer.getId(), getLibraryCards(testPlayer), getHandCards(testPlayer), getBattlefieldCards(testPlayer), getGraveCards(testPlayer), getCommandCards(testPlayer)); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java index 6c11c327309..fd99ac65e84 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java @@ -28,13 +28,16 @@ public class ProtectionFromTypeTest extends CardTestPlayerBase { @Test public void testNoProtection() { useRedDefault(); + // Trigon of Corruption enters the battlefield with three charge counters on it. addCard(Zone.BATTLEFIELD, playerA, "Trigon of Corruption"); addCard(Zone.BATTLEFIELD, playerB, "Coral Merfolk"); + setStrictChooseMode(true); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, Remove a charge counter from {this}, {T}: Put a -1/-1 counter on target creature.", "Coral Merfolk"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); // Coral Merfolk should be destroyed assertPermanentCount(playerB, "Coral Merfolk", 0); diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java index 40f8e4fe830..de21c8e3836 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java @@ -41,7 +41,7 @@ public class SerializationTest extends CardTestPlayerBase { // mark damage from infected ability permanent.addAbility(InfectAbility.getInstance(), null, currentGame); - permanent.markDamage(1, permanent.getId(), currentGame, false, false); + permanent.markDamage(1, permanent.getId(), null, currentGame, false, false); // test compress (it uses default java serialization) Object compressed = CompressUtil.compress(permanent); diff --git a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java index b6338f00127..82e3aed0d92 100644 --- a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java +++ b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java @@ -27,6 +27,7 @@ import mage.game.Graveyard; import mage.game.Table; import mage.game.combat.CombatGroup; import mage.game.draft.Draft; +import mage.game.events.GameEvent; import mage.game.match.Match; import mage.game.match.MatchPlayer; import mage.game.permanent.Permanent; @@ -121,12 +122,12 @@ public class PlayerStub implements Player { } @Override - public void setLife(int life, Game game, UUID sourceId) { - + public int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId) { + return 0; } @Override - public int loseLife(int amount, Game game, boolean at) { + public int loseLife(int amount, Game game, Ability source, boolean atCombat) { return 0; } @@ -136,22 +137,17 @@ public class PlayerStub implements Player { } @Override - public int gainLife(int amount, Game game, UUID sourceId) { + public int damage(int damage, UUID attackerId, Ability source, Game game) { return 0; } @Override - public int damage(int damage, UUID sourceId, Game game) { + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable) { return 0; } @Override - public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) { - return 0; - } - - @Override - public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { return 0; } @@ -200,7 +196,7 @@ public class PlayerStub implements Player { } @Override - public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId, UUID controllerId, Game game) { + public boolean canPaySacrificeCost(Permanent permanent, Ability source, UUID controllerId, Game game) { return false; } @@ -530,12 +526,12 @@ public class PlayerStub implements Player { } @Override - public int drawCards(int num, UUID sourceId, Game game) { + public int drawCards(int num, Ability source, Game game) { return 0; } @Override - public int drawCards(int num, UUID sourceId, Game game, List appliedEffects) { + public int drawCards(int num, Ability source, Game game, GameEvent event) { return 0; } @@ -555,7 +551,7 @@ public class PlayerStub implements Player { } @Override - public boolean removeFromBattlefield(Permanent permanent, Game game) { + public boolean removeFromBattlefield(Permanent permanent, Ability source, Game game) { return false; } @@ -634,27 +630,27 @@ public class PlayerStub implements Player { } @Override - public int rollDice(Game game, int numSides) { + public int rollDice(Ability source, Game game, int numSides) { return 1; } @Override - public int rollDice(Game game, List appliedEffects, int numSides) { + public int rollDice(Ability source, Game game, List appliedEffects, int numSides) { return 1; } @Override - public Cards discard(Cards cards, Ability source, Game game) { + public Cards discard(Cards cards, boolean payForCost, Ability source, Game game) { return null; } @Override - public Card discardOne(boolean random, Ability source, Game game) { + public Card discardOne(boolean random, boolean payForCost, Ability source, Game game) { return null; } @Override - public Cards discard(int amount, boolean random, Ability source, Game game) { + public Cards discard(int amount, boolean random, boolean payForCost, Ability source, Game game) { return null; } @@ -664,7 +660,7 @@ public class PlayerStub implements Player { } @Override - public boolean discard(Card card, Ability source, Game game) { + public boolean discard(Card card, boolean payForCost, Ability source, Game game) { return false; } @@ -939,7 +935,7 @@ public class PlayerStub implements Player { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { } @@ -954,7 +950,7 @@ public class PlayerStub implements Player { } @Override - public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { + public void assignDamage(int damage, List targets, String singleTargetName, UUID attackerId, Ability source, Game game) { } @@ -1069,7 +1065,7 @@ public class PlayerStub implements Player { } @Override - public boolean addCounters(Counter counter, Game game) { + public boolean addCounters(Counter counter, Ability source, Game game) { return true; } @@ -1084,12 +1080,12 @@ public class PlayerStub implements Player { } @Override - public boolean addAttachment(UUID permanentId, Game game) { + public boolean addAttachment(UUID permanentId, Ability source, Game game) { return false; } @Override - public boolean removeAttachment(Permanent permanent, Game game) { + public boolean removeAttachment(Permanent permanent, Ability source, Game game) { return false; } @@ -1179,22 +1175,17 @@ public class PlayerStub implements Player { } @Override - public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) { + public boolean moveCardToHandWithInfo(Card card, Ability source, Game game, boolean withName) { return false; } @Override - public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName) { + public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, Ability source, Game game, Zone fromZone, boolean withName) { return false; } @Override - public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName) { - return false; - } - - @Override - public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { + public boolean moveCardToGraveyardWithInfo(Card card, Ability source, Game game, Zone fromZone) { return false; } @@ -1204,12 +1195,12 @@ public class PlayerStub implements Player { } @Override - public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) { + public boolean moveCardToLibraryWithInfo(Card card, Ability source, Game game, Zone fromZone, boolean toTop, boolean withName) { return false; } @Override - public boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { + public boolean moveCardToCommandWithInfo(Card card, Ability source, Game game, Zone fromZone) { return false; } @@ -1344,17 +1335,17 @@ public class PlayerStub implements Player { } @Override - public PlanarDieRoll rollPlanarDie(Game game) { + public PlanarDieRoll rollPlanarDie(Ability source, Game game) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override - public PlanarDieRoll rollPlanarDie(Game game, List appliedEffects) { + public PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override - public PlanarDieRoll rollPlanarDie(Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides) { + public PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } diff --git a/Mage.Tests/src/test/java/org/mage/test/utils/RandomTest.java b/Mage.Tests/src/test/java/org/mage/test/utils/RandomTest.java index 0f98b73aa01..733b539c423 100644 --- a/Mage.Tests/src/test/java/org/mage/test/utils/RandomTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/utils/RandomTest.java @@ -101,7 +101,7 @@ public class RandomTest { for (int x = 0; x < weight; x++) { for (int y = 0; y < height; y++) { // roll dice - int diceVal = player.rollDice(game, 12); + int diceVal = player.rollDice(null, game, 12); int colorMult = Math.floorDiv(255, 12); image.setRGB(x, y, new Color(colorMult * diceVal, colorMult * diceVal, colorMult * diceVal).getRGB()); @@ -124,7 +124,7 @@ public class RandomTest { for (int x = 0; x < weight; x++) { for (int y = 0; y < height; y++) { // roll planar dice - PlanarDieRoll res = player.rollPlanarDie(game); + PlanarDieRoll res = player.rollPlanarDie(null, game); image.setRGB(x, y, new Color( res.equals(PlanarDieRoll.CHAOS_ROLL) ? 255 : 0, res.equals(PlanarDieRoll.PLANAR_ROLL) ? 255 : 0, diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 0532ae212ab..b26d8c63b60 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -156,7 +156,7 @@ public abstract class AbilityImpl implements Ability { if (checkIfClause(game)) { // Ability has started resolving. Fire event. // Used for abilities counting the number of resolutions like Ashling the Pilgrim. - game.fireEvent(new GameEvent(GameEvent.EventType.RESOLVING_ABILITY, this.getOriginalId(), this.getSourceId(), this.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.RESOLVING_ABILITY, this.getOriginalId(), this, this.getControllerId())); if (this instanceof TriggeredAbility) { for (UUID modeId : this.getModes().getSelectedModes()) { this.getModes().setActiveMode(modeId); @@ -288,11 +288,11 @@ public abstract class AbilityImpl implements Ability { // For effects from cards like Void Winnower x costs have to be set if (this.getAbilityType() == AbilityType.SPELL - && game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) { + && game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, this.getId(), this, getControllerId()), this)) { return false; } - handlePhyrexianManaCosts(game, sourceId, controller); + handlePhyrexianManaCosts(game, controller); /* 20130201 - 601.2b * If the spell is modal the player announces the mode choice (see rule 700.2). @@ -351,7 +351,7 @@ public abstract class AbilityImpl implements Ability { } // end modes // this is a hack to prevent mana abilities with mana costs from causing endless loops - pay other costs first - if (this instanceof ActivatedManaAbilityImpl && !costs.pay(this, game, sourceId, controllerId, noMana, null)) { + if (this instanceof ActivatedManaAbilityImpl && !costs.pay(this, game, this, controllerId, noMana, null)) { logger.debug("activate mana ability failed - non mana costs"); return false; } @@ -375,12 +375,12 @@ public abstract class AbilityImpl implements Ability { } //20100716 - 601.2f (noMana is not used here, because mana costs were cleared for this ability before adding additional costs and applying cost modification effects) - if (!manaCostsToPay.pay(this, game, sourceId, activatorId, false, null)) { + if (!manaCostsToPay.pay(this, game, this, activatorId, false, null)) { return false; // cancel during mana payment } //20100716 - 601.2g - if (!costs.pay(this, game, sourceId, activatorId, noMana, null)) { + if (!costs.pay(this, game, this, activatorId, noMana, null)) { logger.debug("activate failed - non mana costs"); return false; } @@ -510,7 +510,7 @@ public abstract class AbilityImpl implements Ability { * Phyrexian mana symbols, the player announces whether they intend to pay 2 * life or the corresponding colored mana cost for each of those symbols. */ - private void handlePhyrexianManaCosts(Game game, UUID sourceId, Player controller) { + private void handlePhyrexianManaCosts(Game game, Player controller) { Iterator costIterator = manaCostsToPay.iterator(); while (costIterator.hasNext()) { ManaCost cost = costIterator.next(); @@ -518,7 +518,7 @@ public abstract class AbilityImpl implements Ability { if (cost instanceof PhyrexianManaCost) { PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost) cost; PayLifeCost payLifeCost = new PayLifeCost(2); - if (payLifeCost.canPay(this, sourceId, controller.getId(), game) + if (payLifeCost.canPay(this, this, controller.getId(), game) && controller.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', this, game)) { costIterator.remove(); costs.add(payLifeCost); @@ -529,7 +529,7 @@ public abstract class AbilityImpl implements Ability { public int handleManaXMultiplier(Game game, int value) { // some spells can change X value without new pays (Unbound Flourishing doubles X) - GameEvent xEvent = GameEvent.getEvent(GameEvent.EventType.X_MANA_ANNOUNCE, getId(), getSourceId(), getControllerId(), value); + GameEvent xEvent = GameEvent.getEvent(GameEvent.EventType.X_MANA_ANNOUNCE, this.getId(), this, getControllerId(), value); game.replaceEvent(xEvent, this); return xEvent.getAmount(); } diff --git a/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java b/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java index dc87003fe5c..9abeadaf0fa 100644 --- a/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java @@ -193,7 +193,7 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa if (timing == TimingRule.INSTANT || game.canPlaySorcery(playerId) || null != approvingObject) { - if (costs.canPay(this, sourceId, playerId, game) + if (costs.canPay(this, this, playerId, game) && canChooseTarget(game)) { this.activatorId = playerId; return new ActivationStatus(true, approvingObject); diff --git a/Mage/src/main/java/mage/abilities/SpellAbility.java b/Mage/src/main/java/mage/abilities/SpellAbility.java index 6ad7cdaf62d..20428c4018d 100644 --- a/Mage/src/main/java/mage/abilities/SpellAbility.java +++ b/Mage/src/main/java/mage/abilities/SpellAbility.java @@ -92,7 +92,7 @@ public class SpellAbility extends ActivatedAbilityImpl { // Check if rule modifying events prevent to cast the spell in check playable mode if (game.inCheckPlayableState()) { if (game.getContinuousEffects().preventedByRuleModification( - GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, this.getId(), this.getSourceId(), playerId), this, game, true)) { + GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, this.getId(), this, playerId), this, game, true)) { return ActivationStatus.getFalse(); } } @@ -104,7 +104,7 @@ public class SpellAbility extends ActivatedAbilityImpl { return ActivationStatus.getFalse(); } } - if (costs.canPay(this, sourceId, playerId, game)) { + if (costs.canPay(this, this, playerId, game)) { if (getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) { SplitCard splitCard = (SplitCard) game.getCard(getSourceId()); if (splitCard != null) { diff --git a/Mage/src/main/java/mage/abilities/TriggeredAbilities.java b/Mage/src/main/java/mage/abilities/TriggeredAbilities.java index d354a44835a..39d20f9f0df 100644 --- a/Mage/src/main/java/mage/abilities/TriggeredAbilities.java +++ b/Mage/src/main/java/mage/abilities/TriggeredAbilities.java @@ -61,12 +61,8 @@ public class TriggeredAbilities extends ConcurrentHashMap manaCost instanceof VariableCost); diff --git a/Mage/src/main/java/mage/abilities/costs/CompositeCost.java b/Mage/src/main/java/mage/abilities/costs/CompositeCost.java index d4d38a1a665..34a79afc62f 100644 --- a/Mage/src/main/java/mage/abilities/costs/CompositeCost.java +++ b/Mage/src/main/java/mage/abilities/costs/CompositeCost.java @@ -39,19 +39,19 @@ public class CompositeCost implements Cost { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return firstCost.canPay(ability, sourceId, controllerId, game) && secondCost.canPay(ability, sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return firstCost.canPay(ability, source, controllerId, game) && secondCost.canPay(ability, source, controllerId, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - return pay(ability, game, sourceId, controllerId, noMana, this); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana) { + return pay(ability, game, source, controllerId, noMana, this); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - return firstCost.pay(ability, game, sourceId, controllerId, noMana, costToPay) - && secondCost.pay(ability, game, sourceId, controllerId, noMana, costToPay); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + return firstCost.pay(ability, game, source, controllerId, noMana, costToPay) + && secondCost.pay(ability, game, source, controllerId, noMana, costToPay); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/Cost.java b/Mage/src/main/java/mage/abilities/costs/Cost.java index af3ffa182a3..f30d497634a 100644 --- a/Mage/src/main/java/mage/abilities/costs/Cost.java +++ b/Mage/src/main/java/mage/abilities/costs/Cost.java @@ -19,11 +19,11 @@ public interface Cost extends Serializable { * Check is it possible to pay * For mana it checks only single color and amount available, not total mana cost */ - boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game); + boolean canPay(Ability ability, Ability source, UUID controllerId, Game game); - boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana); + boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana); - boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay); + boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay); boolean isPaid(); diff --git a/Mage/src/main/java/mage/abilities/costs/CostImpl.java b/Mage/src/main/java/mage/abilities/costs/CostImpl.java index 17121047083..56bde433593 100644 --- a/Mage/src/main/java/mage/abilities/costs/CostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/CostImpl.java @@ -28,8 +28,8 @@ public abstract class CostImpl implements Cost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - return pay(ability, game, sourceId, controllerId, noMana, this); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana) { + return pay(ability, game, source, controllerId, noMana, this); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java index b3ea32b8804..bda046a5ee5 100644 --- a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java @@ -61,9 +61,9 @@ public class CostsImpl extends ArrayList implements Costs } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { for (T cost : this) { - if (!cost.canPay(ability, sourceId, controllerId, game)) { + if (!cost.canPay(ability, source, controllerId, game)) { return false; } } @@ -71,16 +71,16 @@ public class CostsImpl extends ArrayList implements Costs } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - return pay(ability, game, sourceId, controllerId, noMana, this); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana) { + return pay(ability, game, source, controllerId, noMana, this); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { if (this.size() > 0) { while (!isPaid()) { T cost = getFirstUnpaid(); - if (!cost.pay(ability, game, sourceId, controllerId, noMana, costToPay)) { + if (!cost.pay(ability, game, source, controllerId, noMana, costToPay)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/costs/OrCost.java b/Mage/src/main/java/mage/abilities/costs/OrCost.java index df79fe81271..63bfe4285c6 100644 --- a/Mage/src/main/java/mage/abilities/costs/OrCost.java +++ b/Mage/src/main/java/mage/abilities/costs/OrCost.java @@ -46,23 +46,23 @@ public class OrCost implements Cost { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return firstCost.canPay(ability, sourceId, controllerId, game) || secondCost.canPay(ability, sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return firstCost.canPay(ability, source, controllerId, game) || secondCost.canPay(ability, source, controllerId, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - return pay(ability, game, sourceId, controllerId, noMana, this); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana) { + return pay(ability, game, source, controllerId, noMana, this); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { selectedCost = null; // if only one can be paid select it - if (!firstCost.canPay(ability, sourceId, controllerId, game)) { + if (!firstCost.canPay(ability, source, controllerId, game)) { selectedCost = secondCost; } - if (!secondCost.canPay(ability, sourceId, controllerId, game)) { + if (!secondCost.canPay(ability, source, controllerId, game)) { selectedCost = firstCost; } // if both can be paid player has to select @@ -84,7 +84,7 @@ public class OrCost implements Cost { if (selectedCost == null) { return false; } - return selectedCost.pay(ability, game, sourceId, controllerId, noMana, costToPay); + return selectedCost.pay(ability, game, source, controllerId, noMana, costToPay); } diff --git a/Mage/src/main/java/mage/abilities/costs/UseAttachedCost.java b/Mage/src/main/java/mage/abilities/costs/UseAttachedCost.java index 6640fb93864..e0c98170d7b 100644 --- a/Mage/src/main/java/mage/abilities/costs/UseAttachedCost.java +++ b/Mage/src/main/java/mage/abilities/costs/UseAttachedCost.java @@ -27,11 +27,11 @@ public abstract class UseAttachedCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { if (mageObjectReference == null) { return false; } - Permanent permanent = game.getPermanent(sourceId); + Permanent permanent = game.getPermanent(source.getSourceId()); return permanent != null && permanent .getAttachments() diff --git a/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java b/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java index 6d38676d0de..4f89a46d3e1 100644 --- a/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java @@ -99,19 +99,19 @@ public abstract class VariableCostImpl implements Cost, VariableCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - return pay(ability, game, sourceId, controllerId, noMana, this); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana) { + return pay(ability, game, source, controllerId, noMana, this); } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; /* not used */ } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { return true; /* not used */ diff --git a/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java b/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java index 64d6974a666..17c366f5fcd 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java @@ -22,12 +22,12 @@ public class ControlPermanentCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return game.getBattlefield().contains(filter, controllerId, 1, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/CyclingDiscardCost.java b/Mage/src/main/java/mage/abilities/costs/common/CyclingDiscardCost.java index 5c846b0bdc4..65d621a71fd 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/CyclingDiscardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/CyclingDiscardCost.java @@ -26,21 +26,21 @@ public class CyclingDiscardCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getPlayer(controllerId).getHand().contains(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return game.getPlayer(controllerId).getHand().contains(source.getSourceId()); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null) { - Card card = player.getHand().get(sourceId, game); + Card card = player.getHand().get(source.getSourceId(), game); if (card != null) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CYCLE_CARD, card.getId(), card.getId(), card.getOwnerId())); - paid = player.discard(card, null, game); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CYCLE_CARD, card.getId(), source, card.getOwnerId())); + paid = player.discard(card, true, source, game); if (paid) { cycledCard = new MageObjectReference(card, game); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CYCLED_CARD, card.getId(), card.getId(), card.getOwnerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CYCLED_CARD, card.getId(), source, card.getOwnerId())); } } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java index 32a76e3a797..ec4c6a7c9fe 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java @@ -27,17 +27,17 @@ public class DiscardHandCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player == null) { return paid; } - player.discard(player.getHand(), ability, game); + player.discard(player.getHand(), true, source, game); paid = true; return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java index 225f97a10ff..96188f942d6 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java @@ -31,16 +31,16 @@ public class DiscardSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getPlayer(controllerId).getHand().contains(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return game.getPlayer(controllerId).getHand().contains(source.getSourceId()); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null) { - Card card = player.getHand().get(sourceId, game); - paid = player.discard(card, null, game); + Card card = player.getHand().get(source.getSourceId(), game); + paid = player.discard(card, true, source, game); } return paid; diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java index 6c786f6ff1e..0711f3e0aad 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java @@ -40,7 +40,7 @@ public class DiscardTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { this.cards.clear(); this.targets.clearChosen(); Player player = game.getPlayer(controllerId); @@ -49,11 +49,11 @@ public class DiscardTargetCost extends CostImpl { } int amount = this.getTargets().get(0).getNumberOfTargets(); if (randomDiscard) { - this.cards.addAll(player.discard(amount, true, ability, game).getCards(game)); - } else if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { + this.cards.addAll(player.discard(amount, true, true, source, game).getCards(game)); + } else if (targets.choose(Outcome.Discard, controllerId, source.getSourceId(), game)) { Cards toDiscard = new CardsImpl(); toDiscard.addAll(targets.get(0).getTargets()); - Cards discarded = player.discard(toDiscard, ability, game); + Cards discarded = player.discard(toDiscard, true, source, game); if (!discarded.isEmpty()) { cards.addAll(discarded.getCards(game)); } @@ -70,8 +70,8 @@ public class DiscardTargetCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/DynamicValueGenericManaCost.java b/Mage/src/main/java/mage/abilities/costs/common/DynamicValueGenericManaCost.java index d98d8f81bff..471a9dd5c5e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DynamicValueGenericManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DynamicValueGenericManaCost.java @@ -24,15 +24,15 @@ public class DynamicValueGenericManaCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Cost cost = ManaUtil.createManaCost(amount, game, ability, null); - return cost.canPay(ability, sourceId, controllerId, game); + return cost.canPay(ability, source, controllerId, game); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Cost cost = ManaUtil.createManaCost(amount, game, ability, null); - paid = cost.pay(ability, game, sourceId, controllerId, noMana); + paid = cost.pay(ability, game, source, controllerId, noMana); return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExertSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExertSourceCost.java index f17236eb5be..aa002c695d3 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExertSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExertSourceCost.java @@ -29,16 +29,16 @@ public class ExertSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); - Permanent permanent = game.getPermanent(sourceId); + Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - game.fireEvent(GameEvent.getEvent(EventType.BECOMES_EXERTED, permanent.getId(), permanent.getId(), permanent.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_EXERTED, permanent.getId(), source, source.getControllerId())); ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", permanent.getControllerId()); effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, ability); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java index ba2279b8752..50c0c2d59c4 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java @@ -63,10 +63,10 @@ public class ExileFromGraveCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { for (UUID targetId : targets.get(0).getTargets()) { Card card = game.getCard(targetId); if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) { @@ -85,8 +85,8 @@ public class ExileFromGraveCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java index 5074791ef48..e7e5d58bed3 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java @@ -49,8 +49,8 @@ public class ExileFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { Player player = game.getPlayer(controllerId); int cmc = 0; for (UUID targetId : targets.get(0).getTargets()) { @@ -78,8 +78,8 @@ public class ExileFromHandCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java index b9ae752cf5f..62fe1191fcf 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java @@ -27,8 +27,8 @@ public class ExileFromStackCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { Player player = game.getPlayer(controllerId); for (UUID targetId : targets.get(0).getTargets()) { Spell spellToExile = game.getStack().getSpell(targetId); @@ -39,7 +39,7 @@ public class ExileFromStackCost extends CostImpl { if (spellToExile.isCopy()) { game.getStack().remove(spellToExile, game); } else { - spellToExile.moveToExile(null, "", ability.getSourceId(), game); + spellToExile.moveToExile(null, "", ability, game); } paid = true; if (!game.isSimulation()) { @@ -51,8 +51,8 @@ public class ExileFromStackCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java index c427b5bf8c8..808ee2ac8ee 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java @@ -30,7 +30,7 @@ public class ExileFromTopOfLibraryCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller == null) { return false; @@ -39,7 +39,7 @@ public class ExileFromTopOfLibraryCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { controller.moveCards(controller.getLibrary().getTopCards(game, amount), Zone.EXILED, ability, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java index 38045a9cf8d..dba83ddaa7a 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java @@ -38,7 +38,7 @@ public class ExileOpponentsCardFromExileToGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { FilterCard filter = new FilterCard(); @@ -56,7 +56,7 @@ public class ExileOpponentsCardFromExileToGraveyardCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (Card card : game.getExile().getAllCards(game)) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java index 5e460a9b445..12190a48411 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java @@ -41,7 +41,7 @@ public class ExileSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { MageObject sourceObject = ability.getSourceObject(game); Player controller = game.getPlayer(controllerId); if (controller != null && sourceObject instanceof Card) { @@ -52,7 +52,7 @@ public class ExileSourceCost extends CostImpl { exileZoneName = sourceObject.getName(); game.getState().setValue(sourceObject.getId().toString(), ability.getSourceObjectZoneChangeCounter()); } - controller.moveCardToExileWithInfo((Card) sourceObject, exileZoneId, exileZoneName, sourceId, game, game.getState().getZone(sourceObject.getId()), true); + controller.moveCardToExileWithInfo((Card) sourceObject, exileZoneId, exileZoneName, source, game, game.getState().getZone(sourceObject.getId()), true); // 117.11. The actions performed when paying a cost may be modified by effects. // Even if they are, meaning the actions that are performed don't match the actions // that are called for, the cost has still been paid. @@ -63,8 +63,8 @@ public class ExileSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); return permanent != null; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java index 2fcc873a167..1169199a7b9 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java @@ -25,12 +25,12 @@ public class ExileSourceFromGraveCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - Card card = game.getCard(sourceId); - if (card != null && game.getState().getZone(sourceId) == Zone.GRAVEYARD) { - controller.moveCardToExileWithInfo(card, null, "", sourceId, game, Zone.GRAVEYARD, true); + Card card = game.getCard(source.getSourceId()); + if (card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true); // 117.11. The actions performed when paying a cost may be modified by effects. // Even if they are, meaning the actions that are performed don't match the actions // that are called for, the cost has still been paid. @@ -42,9 +42,9 @@ public class ExileSourceFromGraveCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Card card = game.getCard(sourceId); - return card != null && game.getState().getZone(sourceId) == Zone.GRAVEYARD; + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Card card = game.getCard(source.getSourceId()); + return card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java index b4039fdf834..551fd5909fc 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java @@ -39,8 +39,8 @@ public class ExileTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { for (UUID targetId: targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { @@ -51,7 +51,7 @@ public class ExileTargetCost extends CostImpl { // Even if they are, meaning the actions that are performed don't match the actions // that are called for, the cost has still been paid. // so return state here is not important because the user indended to exile the target anyway - game.getPlayer(ability.getControllerId()).moveCardToExileWithInfo(permanent, null, null, sourceId, game, Zone.BATTLEFIELD, true); + game.getPlayer(ability.getControllerId()).moveCardToExileWithInfo(permanent, null, null, source, game, Zone.BATTLEFIELD, true); } paid = true; } @@ -59,8 +59,8 @@ public class ExileTargetCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java index dfb871086e3..4a5f2de1e63 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java @@ -33,7 +33,7 @@ public class ExileTopCardOfGraveyardCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if(controller == null) { return false; @@ -42,7 +42,7 @@ public class ExileTopCardOfGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if(controller != null) { Card topCard = null; @@ -50,7 +50,7 @@ public class ExileTopCardOfGraveyardCost extends CostImpl { topCard = card; } if (topCard != null) { - controller.moveCardToExileWithInfo(topCard, null, "", ability.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(topCard, null, "", source, game, Zone.GRAVEYARD, true); paid = true; } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java index 7d2087ab503..3f9fb497983 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java @@ -33,7 +33,7 @@ public class ExileTopCreatureCardOfGraveyardCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if(controller == null) { return false; @@ -42,7 +42,7 @@ public class ExileTopCreatureCardOfGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if(controller != null) { Card topCard = null; @@ -52,7 +52,7 @@ public class ExileTopCreatureCardOfGraveyardCost extends CostImpl { } } if (topCard != null) { - controller.moveCardToExileWithInfo(topCard, null, "", ability.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardToExileWithInfo(topCard, null, "", source, game, Zone.GRAVEYARD, true); paid = true; } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java b/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java index b91407c6463..f41f3bd6698 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java @@ -44,7 +44,7 @@ public class GainLifeOpponentCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (UUID opponentId : game.getOpponents(controllerId)) { @@ -59,14 +59,14 @@ public class GainLifeOpponentCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { TargetPlayer target = new TargetPlayer(1, 1, true, filter); if (controller.chooseTarget(Outcome.Detriment, target, ability, game)) { Player opponent = game.getPlayer(target.getFirstTarget()); if (opponent != null) { - opponent.gainLife(amount, game, sourceId); + opponent.gainLife(amount, game, source); paid = true; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java b/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java index 4a9219cff3f..b8c680baf53 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java @@ -27,7 +27,7 @@ public class GainLifePlayersCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { @@ -45,14 +45,14 @@ public class GainLifePlayersCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { if (!playerId.equals(controllerId)) { Player player = game.getPlayer(playerId); if (player != null) { - player.gainLife(amount, game, sourceId); + player.gainLife(amount, game, source); } } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/MillCardsCost.java b/Mage/src/main/java/mage/abilities/costs/common/MillCardsCost.java index 3445b345137..2c243ffe2b5 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/MillCardsCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/MillCardsCost.java @@ -33,7 +33,7 @@ public class MillCardsCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null && player.getLibrary().size() >= numberOfCards) { paid = true; @@ -43,7 +43,7 @@ public class MillCardsCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); return player != null && player.getLibrary().size() >= numberOfCards; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayEnergyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayEnergyCost.java index 9f02bc30528..e2462f3a25f 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayEnergyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayEnergyCost.java @@ -28,13 +28,13 @@ public class PayEnergyCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); return player != null && player.getCounters().getCount(CounterType.ENERGY) >= amount; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null && player.getCounters().getCount(CounterType.ENERGY) >= amount) { player.getCounters().removeCounter(CounterType.ENERGY, amount); diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java index 2f855bc2e2b..9c5a8ddd069 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java @@ -7,6 +7,8 @@ import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.game.Game; import mage.game.events.GameEvent; +import mage.players.Player; +import mage.util.CardUtil; import java.util.UUID; @@ -32,7 +34,7 @@ public class PayLifeCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { //118.4. If a cost or effect allows a player to pay an amount of life greater than 0, //the player may do so only if their life total is greater than or equal to the //amount of the payment. If a player pays life, the payment is subtracted from their @@ -46,13 +48,14 @@ public class PayLifeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - int lifeToPayAmount = amount.calculate(game, ability, null); - this.paid = game.getPlayer(controllerId).loseLife(lifeToPayAmount, game, false) == lifeToPayAmount; - if (paid) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIFE_PAID, controllerId, sourceId, controllerId, lifeToPayAmount)); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Player controller = game.getPlayer(controllerId); + if (controller == null) { + return false; } - return paid; + int lifeToPayAmount = amount.calculate(game, ability, null); + this.paid = CardUtil.tryPayLife(lifeToPayAmount, controller, source, game); + return this.paid; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java index 55ea9f43f85..b72229b67e9 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java @@ -32,8 +32,8 @@ public class PayLoyaltyCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent planeswalker = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent planeswalker = game.getPermanent(source.getSourceId()); return planeswalker != null && planeswalker.getCounters(game).getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game); } @@ -46,13 +46,13 @@ public class PayLoyaltyCost extends CostImpl { * */ @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent planeswalker = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent planeswalker = game.getPermanent(source.getSourceId()); if (planeswalker != null && planeswalker.getCounters(game).getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game)) { if (amount > 0) { planeswalker.addCounters(CounterType.LOYALTY.createInstance(amount), ability, game, false); } else if (amount < 0) { - planeswalker.removeCounters(CounterType.LOYALTY.getName(), Math.abs(amount), game); + planeswalker.removeCounters(CounterType.LOYALTY.getName(), Math.abs(amount), source, game); } planeswalker.addLoyaltyUsed(); this.paid = true; diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java index 4a68096e26b..30fe920e1b5 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java @@ -31,8 +31,8 @@ public class PayVariableLoyaltyCost extends VariableCostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent planeswalker = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent planeswalker = game.getPermanent(source.getSourceId()); return planeswalker!= null && planeswalker.canLoyaltyBeUsed(game); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCardFromHandOnTopOfLibraryCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCardFromHandOnTopOfLibraryCost.java index cd2820b391c..1b2ff3ae779 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCardFromHandOnTopOfLibraryCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCardFromHandOnTopOfLibraryCost.java @@ -32,21 +32,21 @@ public class PutCardFromHandOnTopOfLibraryCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); TargetCardInHand targetCardInHand = new TargetCardInHand(); targetCardInHand.setRequired(false); Card card; - if (targetCardInHand.canChoose(controllerId, game) - && controller.choose(Outcome.PreventDamage, targetCardInHand, sourceId, game)) { + if (targetCardInHand.canChoose(source.getSourceId(), controllerId, game) + && controller.choose(Outcome.PreventDamage, targetCardInHand, source.getSourceId(), game)) { card = game.getCard(targetCardInHand.getFirstTarget()); - paid = card != null && controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.HAND, true, true); + paid = card != null && controller.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, true); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); return (controller != null && !controller.getHand().isEmpty()); diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java index 2d0abb26c33..5d90fddd543 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java @@ -38,13 +38,13 @@ public class PutCountersSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { this.paid = permanent.addCounters(counter, ability, game, false); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutSourceOnBottomOwnerLibraryCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutSourceOnBottomOwnerLibraryCost.java index a49b52480cc..417b1f0e296 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutSourceOnBottomOwnerLibraryCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutSourceOnBottomOwnerLibraryCost.java @@ -25,9 +25,9 @@ public class PutSourceOnBottomOwnerLibraryCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); - Permanent sourcePermanent = game.getPermanent(sourceId); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (player != null && sourcePermanent != null) { paid = true; player.putCardsOnBottomOfLibrary(new CardsImpl(sourcePermanent), game, ability, false); @@ -36,8 +36,8 @@ public class PutSourceOnBottomOwnerLibraryCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getPermanent(sourceId) != null; + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return game.getPermanent(source.getSourceId()) != null; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveAllCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveAllCountersSourceCost.java index 4e7c306a46a..babfc40c0cf 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveAllCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveAllCountersSourceCost.java @@ -29,18 +29,18 @@ public class RemoveAllCountersSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); return permanent != null; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { this.removedCounters = permanent.getCounters(game).getCount(counterType); if (this.removedCounters > 0) { - permanent.removeCounters(counterType.createInstance(this.removedCounters), game); + permanent.removeCounters(counterType.createInstance(this.removedCounters), source, game); } } this.paid = true; diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index 4ebaf119233..16970dbf91c 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -53,7 +53,7 @@ public class RemoveCounterCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; int countersRemoved = 0; Player controller = game.getPlayer(controllerId); @@ -62,7 +62,7 @@ public class RemoveCounterCost extends CostImpl { return paid = true; } target.clearChosen(); - if (target.choose(Outcome.UnboostCreature, controllerId, sourceId, game)) { + if (target.choose(Outcome.UnboostCreature, controllerId, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { @@ -100,7 +100,7 @@ public class RemoveCounterCost extends CostImpl { numberOfCountersSelected = controller.getAmount(1, Math.min(countersLeft, countersOnPermanent), new StringBuilder("Remove how many counters from ").append(permanent.getIdName()).toString(), game); } - permanent.removeCounters(counterName, numberOfCountersSelected, game); + permanent.removeCounters(counterName, numberOfCountersSelected, source, game); countersRemoved += numberOfCountersSelected; if (!game.isSimulation()) { game.informPlayers(new StringBuilder(controller.getLogName()) @@ -123,8 +123,8 @@ public class RemoveCounterCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } private String setText() { diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java index aca91eb302f..dd9365f575a 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java @@ -36,16 +36,16 @@ public class RemoveCountersSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); return permanent != null && permanent.getCounters(game).getCount(name) >= amount; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && permanent.getCounters(game).getCount(name) >= amount) { - permanent.removeCounters(name, amount, game); + permanent.removeCounters(name, amount, source, game); this.paid = true; } return paid; diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java index bb7cc921387..bdae6a38c5f 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java @@ -46,7 +46,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java index c32ba68b222..7bc29c35039 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java @@ -42,17 +42,17 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { + if (targets.choose(Outcome.ReturnToHand, controllerId, source.getSourceId(), game)) { Set permanentsToReturn = new HashSet<>(); for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } - permanentsToReturn.add((Card) permanent); + permanentsToReturn.add(permanent); } controller.moveCards(permanentsToReturn, Zone.HAND, ability, game); paid = true; @@ -62,8 +62,8 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java index 1ca025b51eb..9df1a195e86 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java @@ -24,8 +24,8 @@ public class ReturnToHandFromBattlefieldSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(controllerId); if (permanent == null || controller == null) { return false; @@ -36,8 +36,8 @@ public class ReturnToHandFromBattlefieldSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getBattlefield().containsPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return game.getBattlefield().containsPermanent(source.getSourceId()); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java index 8771dcae91d..00187662ad1 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java @@ -34,10 +34,10 @@ public class ReturnToHandFromGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { - if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { + if (targets.choose(Outcome.ReturnToHand, controllerId, source.getSourceId(), game)) { Set cardsToMove = new LinkedHashSet<>(); for (UUID targetId : targets.get(0).getTargets()) { mage.cards.Card targetCard = game.getCard(targetId); @@ -55,8 +55,8 @@ public class ReturnToHandFromGraveyardCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java b/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java index c91c60c9b77..88eeef728d5 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java @@ -25,9 +25,9 @@ public class RevealHandSourceControllerCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); - MageObject sourceObject = game.getObject(sourceId); + MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { controller.revealCards(sourceObject.getName(), controller.getHand(), game); paid = true; @@ -36,7 +36,7 @@ public class RevealHandSourceControllerCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RevealSecretOpponentCost.java b/Mage/src/main/java/mage/abilities/costs/common/RevealSecretOpponentCost.java index daf8d54be58..6b9e0929124 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RevealSecretOpponentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RevealSecretOpponentCost.java @@ -27,27 +27,27 @@ public class RevealSecretOpponentCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - UUID playerThatChoseId = (UUID) game.getState().getValue(sourceId + ChooseSecretOpponentEffect.SECRET_OWNER); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + UUID playerThatChoseId = (UUID) game.getState().getValue(source.getSourceId() + ChooseSecretOpponentEffect.SECRET_OWNER); if (playerThatChoseId == null || !playerThatChoseId.equals(controllerId)) { return false; } - UUID opponentId = (UUID) game.getState().getValue(sourceId + ChooseSecretOpponentEffect.SECRET_OPPONENT); + UUID opponentId = (UUID) game.getState().getValue(source.getSourceId() + ChooseSecretOpponentEffect.SECRET_OPPONENT); return opponentId != null; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - UUID playerThatChoseId = (UUID) game.getState().getValue(sourceId + ChooseSecretOpponentEffect.SECRET_OWNER); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + UUID playerThatChoseId = (UUID) game.getState().getValue(source.getSourceId() + ChooseSecretOpponentEffect.SECRET_OWNER); if (playerThatChoseId == null || !playerThatChoseId.equals(controllerId)) { return false; } - UUID opponentId = (UUID) game.getState().getValue(sourceId + ChooseSecretOpponentEffect.SECRET_OPPONENT); + UUID opponentId = (UUID) game.getState().getValue(source.getSourceId() + ChooseSecretOpponentEffect.SECRET_OPPONENT); if (opponentId != null) { - game.getState().setValue(sourceId + ChooseSecretOpponentEffect.SECRET_OWNER, null); // because only once, the vale is set to null + game.getState().setValue(source.getSourceId() + ChooseSecretOpponentEffect.SECRET_OWNER, null); // because only once, the vale is set to null Player controller = game.getPlayer(controllerId); Player opponent = game.getPlayer(opponentId); - MageObject sourceObject = game.getObject(sourceId); + MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && opponent != null && sourceObject != null) { if (sourceObject instanceof Permanent) { ((Permanent) sourceObject).addInfo(ChooseSecretOpponentEffect.SECRET_OPPONENT, null, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java index 76659ce7e0b..6af8ad5ad4d 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java @@ -29,7 +29,7 @@ public class RevealSourceFromYourHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; Player player = game.getPlayer(controllerId); if (player != null) { @@ -44,8 +44,8 @@ public class RevealSourceFromYourHandCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getState().getZone(sourceId) == Zone.HAND; + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return game.getState().getZone(source.getSourceId()) == Zone.HAND; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java index 4bd68606344..1b45d629195 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java @@ -1,5 +1,3 @@ - -// author jeffwadsworth package mage.abilities.costs.common; import java.util.ArrayList; @@ -17,6 +15,10 @@ import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInHand; +/** + * + * @author jeffwadsworth + */ public class RevealTargetFromHandCost extends CostImpl { public int convertedManaCosts = 0; @@ -37,8 +39,8 @@ public class RevealTargetFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.Benefit, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.Benefit, controllerId, source.getSourceId(), game)) { convertedManaCosts = 0; numberCardsRevealed = 0; Player player = game.getPlayer(controllerId); @@ -53,7 +55,7 @@ public class RevealTargetFromHandCost extends CostImpl { } } if (numberCardsRevealed > 0) { - MageObject baseObject = game.getBaseObject(sourceId); + MageObject baseObject = game.getBaseObject(source.getSourceId()); player.revealCards(baseObject == null ? "card cost" : baseObject.getIdName(), cards, game); } if (targets.get(0).getNumberOfTargets() <= numberCardsRevealed) { @@ -78,8 +80,8 @@ public class RevealTargetFromHandCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java index 9e9c62345e9..31632393a05 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java @@ -34,9 +34,9 @@ public class SacrificeAllCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) { - if (permanent.sacrifice(sourceId, game)) { + if (permanent.sacrifice(source, game)) { permanents.add(permanent.copy()); } } @@ -45,7 +45,7 @@ public class SacrificeAllCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { UUID activator = controllerId; if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) { if (((ActivatedAbilityImpl) ability).getActivatorId() != null) { @@ -57,7 +57,7 @@ public class SacrificeAllCost extends CostImpl { } for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) { - if (!game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) { + if (!game.getPlayer(activator).canPaySacrificeCost(permanent, source, controllerId, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachedCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachedCost.java index 616e65026b2..6deb5b7e047 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachedCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachedCost.java @@ -23,20 +23,20 @@ public class SacrificeAttachedCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent attachment = game.getPermanentOrLKIBattlefield(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent attachment = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent permanent = game.getPermanent(attachment.getAttachedTo()); if (permanent != null) { - paid = permanent.sacrifice(sourceId, game); + paid = permanent.sacrifice(source, game); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent attachment = game.getPermanentOrLKIBattlefield(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent attachment = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent permanent = game.getPermanent(attachment.getAttachedTo()); - return permanent != null && game.getPlayer(controllerId).canPaySacrificeCost(permanent, sourceId, controllerId, game); + return permanent != null && game.getPlayer(controllerId).canPaySacrificeCost(permanent, source, controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachmentCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachmentCost.java index daa3ac03a28..c037e07f243 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachmentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAttachmentCost.java @@ -22,11 +22,11 @@ public class SacrificeAttachmentCost extends UseAttachedCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { if (mageObjectReference == null) { return false; } - Permanent permanent = game.getPermanent(sourceId); + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { return paid; } @@ -37,7 +37,7 @@ public class SacrificeAttachmentCost extends UseAttachedCost { Permanent attachment = game.getPermanent(attachmentId); paid = attachment != null && attachment.isControlledBy(controllerId) - && attachment.sacrifice(sourceId, game); + && attachment.sacrifice(source, game); if (paid) { break; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java index d2e101e25e0..7c3439808ac 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java @@ -23,19 +23,18 @@ public class SacrificeSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - paid = permanent.sacrifice(sourceId, game); + paid = permanent.sacrifice(source, game); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); - - return permanent != null && game.getPlayer(controllerId).canPaySacrificeCost(permanent, sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); + return permanent != null && game.getPlayer(controllerId).canPaySacrificeCost(permanent, source, controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java index 51644679b55..c672f40ab38 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java @@ -51,20 +51,20 @@ public class SacrificeTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { UUID activator = controllerId; if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) { activator = ((ActivatedAbilityImpl) ability).getActivatorId(); } // can be cancel by user - if (targets.choose(Outcome.Sacrifice, activator, sourceId, game)) { + if (targets.choose(Outcome.Sacrifice, activator, source.getSourceId(), game)) { for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } permanents.add(permanent.copy()); - paid |= permanent.sacrifice(sourceId, game); + paid |= permanent.sacrifice(source, game); } if (!paid && targets.get(0).getNumberOfTargets() == 0) { paid = true; // e.g. for Devouring Rage @@ -74,7 +74,7 @@ public class SacrificeTargetCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { UUID activator = controllerId; if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) { if (((ActivatedAbilityImpl) ability).getActivatorId() != null) { @@ -88,7 +88,7 @@ public class SacrificeTargetCost extends CostImpl { int validTargets = 0; int neededtargets = targets.get(0).getNumberOfTargets(); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(((TargetControlledPermanent) targets.get(0)).getFilter(), controllerId, game)) { - if (game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) { + if (game.getPlayer(activator).canPaySacrificeCost(permanent, source, controllerId, game)) { validTargets++; if (validTargets >= neededtargets) { return true; diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapAttachedCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapAttachedCost.java index 7dcfa103116..e022acb046f 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapAttachedCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapAttachedCost.java @@ -23,18 +23,18 @@ public class TapAttachedCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent attachment = game.getPermanentOrLKIBattlefield(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent attachment = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent permanent = game.getPermanent(attachment.getAttachedTo()); if (permanent != null) { - paid = permanent.tap(game); + paid = permanent.tap(source, game); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent attachment = game.getPermanentOrLKIBattlefield(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent attachment = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent permanent = game.getPermanent(attachment.getAttachedTo()); if (permanent != null) { // return true; // Technically the more correct implementation, but all cards using this cost also come with an "untapped" condition diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java index 3526217924f..7966f7eb16a 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java @@ -24,20 +24,20 @@ public class TapSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - paid = permanent.tap(game); + paid = permanent.tap(source, game); } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { return !permanent.isTapped() - && (permanent.canTap() || null != game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.ACTIVATE_HASTE, ability, controllerId, game)); + && (permanent.canTap() || null != game.getContinuousEffects().asThough(source.getSourceId(), AsThoughEffectType.ACTIVATE_HASTE, ability, controllerId, game)); } return false; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java index acfb38c7168..90cec6d387e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java @@ -35,22 +35,22 @@ public class TapTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (target.choose(Outcome.Tap, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (target.choose(Outcome.Tap, controllerId, source.getSourceId(), game)) { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } - paid |= permanent.tap(game); + paid |= permanent.tap(source, game); } } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(sourceId, controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } public TargetControlledPermanent getTarget() { diff --git a/Mage/src/main/java/mage/abilities/costs/common/UnattachCost.java b/Mage/src/main/java/mage/abilities/costs/common/UnattachCost.java index 6a496bced91..21c7239d75e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UnattachCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UnattachCost.java @@ -22,11 +22,11 @@ public class UnattachCost extends UseAttachedCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { if (mageObjectReference == null) { return false; } - Permanent permanent = game.getPermanent(sourceId); + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { return paid; } @@ -34,7 +34,7 @@ public class UnattachCost extends UseAttachedCost { if (!this.mageObjectReference.refersTo(attachmentId, game)) { continue; } - paid = permanent.removeAttachment(attachmentId, game); + paid = permanent.removeAttachment(attachmentId, source, game); if (paid) { break; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java index 3a808c48ac3..1eef97fb7f5 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java @@ -24,8 +24,8 @@ public class UntapSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { paid = permanent.untap(game); } @@ -33,10 +33,10 @@ public class UntapSourceCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(sourceId); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return permanent.isTapped() && (permanent.canTap() || null != game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.ACTIVATE_HASTE, ability, controllerId, game)); + return permanent.isTapped() && (permanent.canTap() || null != game.getContinuousEffects().asThough(source.getSourceId(), AsThoughEffectType.ACTIVATE_HASTE, ability, controllerId, game)); } return false; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java index 27bf912ba42..7532578d9fd 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java @@ -32,8 +32,8 @@ public class UntapTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (target.choose(Outcome.Untap, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (target.choose(Outcome.Untap, controllerId, source.getSourceId(), game)) { for (UUID targetId : (List) target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { @@ -46,8 +46,8 @@ public class UntapTargetCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return target.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return target.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java index afbab56ea0b..36b0ccceccc 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java @@ -213,12 +213,12 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { if (noMana) { setPaid(); return true; diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCosts.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCosts.java index 9d66251def4..1a2030abf8f 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCosts.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCosts.java @@ -41,7 +41,7 @@ public interface ManaCosts extends List, ManaCost { List getSymbols(); - boolean payOrRollback(Ability ability, Game game, UUID sourceId, UUID payingPlayerId); + boolean payOrRollback(Ability ability, Game game, Ability source, UUID payingPlayerId); @Override Mana getMana(); diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java index 0828f4a2b23..b07eb4cf25c 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java @@ -108,12 +108,12 @@ public class ManaCostsImpl extends ArrayList implements M } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - return pay(ability, game, sourceId, controllerId, noMana, this); + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana) { + return pay(ability, game, source, controllerId, noMana, this); } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID playerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID playerId, boolean noMana, Cost costToPay) { if (this.isEmpty() || noMana) { setPaid(); return true; @@ -154,12 +154,12 @@ public class ManaCostsImpl extends ArrayList implements M * @return true if the cost was paid */ @Override - public boolean payOrRollback(Ability ability, Game game, UUID sourceId, UUID payingPlayerId) { + public boolean payOrRollback(Ability ability, Game game, Ability source, UUID payingPlayerId) { Player payingPlayer = game.getPlayer(payingPlayerId); if (payingPlayer != null) { int bookmark = game.bookmarkState(); - handlePhyrexianManaCosts(payingPlayer, ability, game); - if (pay(ability, game, sourceId, payingPlayerId, false, null)) { + handlePhyrexianManaCosts(ability, payingPlayer, source, game); + if (pay(ability, game, source, payingPlayerId, false, null)) { game.removeBookmark(bookmark); return true; } @@ -168,7 +168,7 @@ public class ManaCostsImpl extends ArrayList implements M return false; } - private void handlePhyrexianManaCosts(Player payingPlayer, Ability source, Game game) { + private void handlePhyrexianManaCosts(Ability abilityToPay, Player payingPlayer, Ability source, Game game) { if (this.isEmpty()) { return; // nothing to be done without any mana costs. prevents NRE from occurring here } @@ -180,7 +180,7 @@ public class ManaCostsImpl extends ArrayList implements M if (manaCost instanceof PhyrexianManaCost) { PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost) manaCost; PayLifeCost payLifeCost = new PayLifeCost(2); - if (payLifeCost.canPay(source, source.getSourceId(), payingPlayer.getId(), game) + if (payLifeCost.canPay(abilityToPay, source, payingPlayer.getId(), game) && payingPlayer.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', source, game)) { manaCostIterator.remove(); tempCosts.add(payLifeCost); @@ -188,7 +188,7 @@ public class ManaCostsImpl extends ArrayList implements M } } - tempCosts.pay(source, game, source.getSourceId(), payingPlayer.getId(), false, null); + tempCosts.pay(source, game, source, payingPlayer.getId(), false, null); } private void handleLikePhyrexianManaCosts(Player player, Ability source, Game game) { @@ -220,14 +220,14 @@ public class ManaCostsImpl extends ArrayList implements M if (tempPhyrexianCost != null) { PayLifeCost payLifeCost = new PayLifeCost(2); - if (payLifeCost.canPay(source, source.getSourceId(), player.getId(), game) + if (payLifeCost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.LoseLife, "Pay 2 life (using an active ability) instead of " + tempPhyrexianCost.getBaseText() + '?', source, game)) { manaCostIterator.remove(); tempCosts.add(payLifeCost); } } } - tempCosts.pay(source, game, source.getSourceId(), player.getId(), false, null); + tempCosts.pay(source, game, source, player.getId(), false, null); } } @@ -566,9 +566,9 @@ public class ManaCostsImpl extends ArrayList implements M } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { for (T cost : this) { - if (!cost.canPay(ability, sourceId, controllerId, game)) { + if (!cost.canPay(ability, source, controllerId, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessValue.java index 363c033ef08..e12404a1ec7 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessValue.java @@ -19,12 +19,12 @@ public enum AttachedPermanentToughnessValue implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { // In the case that the enchantment is blinked - Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); + Permanent enchantment = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD); if (enchantment == null) { // It was not blinked, use the standard method - enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); + enchantment = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId()); } if (enchantment == null) { return 0; diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AuraAttachedCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AuraAttachedCount.java index 02816bd5f18..39d53b2a01f 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AuraAttachedCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AuraAttachedCount.java @@ -31,9 +31,9 @@ public class AuraAttachedCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Permanent p = game.getPermanent(source.getSourceId()); + Permanent p = game.getPermanent(sourceAbility.getSourceId()); if (p != null) { List attachments = p.getAttachments(); for (UUID attachmentId : attachments) { diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java index 1bc24e1aa6d..dc22bad5b11 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java @@ -32,11 +32,11 @@ public class ColorsOfManaSpentToCastCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Spell spell = game.getStack().getSpell(source.getSourceId()); + Spell spell = game.getStack().getSpell(sourceAbility.getSourceId()); if (spell == null) { - MageObject mageObject = game.getLastKnownInformation(source.getSourceId(), Zone.STACK); + MageObject mageObject = game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.STACK); if (mageObject instanceof Spell) { spell = (Spell) mageObject; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CommanderCastCountValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CommanderCastCountValue.java index 652bb4bb2db..d70027509bf 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CommanderCastCountValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CommanderCastCountValue.java @@ -13,9 +13,9 @@ public enum CommanderCastCountValue implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class); - return watcher != null ? watcher.getPlayerCount(source.getControllerId()) : 0; + return watcher != null ? watcher.getPlayerCount(sourceAbility.getControllerId()) : 0; } @Override diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/EffectKeyValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/EffectKeyValue.java index 1b6e03eb648..b3cbe5cb55d 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/EffectKeyValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/EffectKeyValue.java @@ -24,7 +24,7 @@ public class EffectKeyValue implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { return (Integer)effect.getValue(key); } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java index f87d0fa045a..9754b67f4cf 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java @@ -32,9 +32,9 @@ public class EquipmentAttachedCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Permanent permanent = game.getPermanent(source.getSourceId()); // don't change this - may affect other cards + Permanent permanent = game.getPermanent(sourceAbility.getSourceId()); // don't change this - may affect other cards if (permanent != null) { List attachments = permanent.getAttachments(); for (UUID attachmentId : attachments) { diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/GetKickerXValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/GetKickerXValue.java index c1dc2400b21..79a01cf6d16 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/GetKickerXValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/GetKickerXValue.java @@ -16,7 +16,7 @@ public enum GetKickerXValue implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { // calcs only kicker with X values // kicker adds additional costs to spell ability @@ -24,7 +24,7 @@ public enum GetKickerXValue implements DynamicValue { // kicker can be calls multiple times (use getKickedCounter) int finalValue = 0; - Spell spell = game.getSpellOrLKIStack(source.getSourceId()); + Spell spell = game.getSpellOrLKIStack(sourceAbility.getSourceId()); if (spell != null && spell.getSpellAbility() != null) { int xValue = spell.getSpellAbility().getManaCostsToPay().getX(); for (Ability ability : spell.getAbilities()) { @@ -38,7 +38,7 @@ public enum GetKickerXValue implements DynamicValue { if (haveVarCost) { - int kickedCount = ((KickerAbility) ability).getKickedCounter(game, source); + int kickedCount = ((KickerAbility) ability).getKickedCounter(game, sourceAbility); if (kickedCount > 0) { finalValue += kickedCount * xValue; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/HighestCMCOfPermanentValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/HighestCMCOfPermanentValue.java index c83a523b298..96a56a77df3 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/HighestCMCOfPermanentValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/HighestCMCOfPermanentValue.java @@ -40,7 +40,7 @@ public class HighestCMCOfPermanentValue implements DynamicValue { if (controller != null) { for (Permanent permanent : game.getBattlefield() .getActivePermanents(filter, sourceAbility.getControllerId(), sourceAbility.getSourceId(), game)) { - if ((!onlyIfCanBeSacrificed || controller.canPaySacrificeCost(permanent, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game)) + if ((!onlyIfCanBeSacrificed || controller.canPaySacrificeCost(permanent, sourceAbility, sourceAbility.getControllerId(), game)) && permanent.getConvertedManaCost() > value) { value = permanent.getConvertedManaCost(); } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java index 0ad7fed22b4..9ca01238b51 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java @@ -16,10 +16,10 @@ public enum ManaSpentToCastCount implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { - Spell spell = game.getStack().getSpell(source.getSourceId()); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Spell spell = game.getStack().getSpell(sourceAbility.getSourceId()); if (spell == null) { - MageObject mageObject = game.getLastKnownInformation(source.getSourceId(), Zone.STACK); + MageObject mageObject = game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.STACK); if (mageObject instanceof Spell) { spell = (Spell) mageObject; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java index b4b583c1da6..25de5d64578 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java @@ -15,13 +15,13 @@ public enum MultikickerCount implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - Card card = game.getCard(source.getSourceId()); + Card card = game.getCard(sourceAbility.getSourceId()); if (card != null) { - for (Ability ability : card.getAbilities()) { + for (Ability ability : card.getAbilities(game)) { if (ability instanceof KickerAbility) { - count += ((KickerAbility) ability).getKickedCounter(game, source); + count += ((KickerAbility) ability).getKickedCounter(game, sourceAbility); } } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/NumericSetToEffectValues.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/NumericSetToEffectValues.java index 6d7c4739332..2248712cc50 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/NumericSetToEffectValues.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/NumericSetToEffectValues.java @@ -33,7 +33,7 @@ public class NumericSetToEffectValues implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Object object = effect.getValue(valueKey); if (object instanceof Integer) { return (Integer) object; diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java index 6c49909cad5..c27b7de7ff7 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java @@ -16,11 +16,11 @@ public enum SunburstCount implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; if (!game.getStack().isEmpty()) { StackObject spell = game.getStack().getFirst(); - if (spell instanceof Spell && ((Spell) spell).getSourceId().equals(source.getSourceId())) { + if (spell instanceof Spell && ((Spell) spell).getSourceId().equals(sourceAbility.getSourceId())) { Mana mana = ((Spell) spell).getSpellAbility().getManaCostsToPay().getPayment(); if (mana.getBlack() > 0) { count++; diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SweepNumber.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SweepNumber.java index 4ad62e735bb..618e5164f99 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SweepNumber.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SweepNumber.java @@ -19,8 +19,9 @@ public class SweepNumber implements DynamicValue { } @Override - public int calculate(Game game, Ability source, Effect effect) { - Integer sweepNumber = (Integer) game.getState().getValue("sweep" + source.getSourceId() + game.getState().getZoneChangeCounter(source.getSourceId())); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Integer sweepNumber = (Integer) game.getState().getValue("sweep" + + sourceAbility.getSourceId() + game.getState().getZoneChangeCounter(sourceAbility.getSourceId())); return sweepNumber != null ? sweepNumber : 0; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java index 26fe5ed8f5a..f6a5995854e 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java @@ -14,8 +14,8 @@ public enum TargetConvertedManaCost implements DynamicValue { instance; @Override - public int calculate(Game game, Ability source, Effect effect) { - Card card = game.getCard(source.getFirstTarget()); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Card card = game.getCard(sourceAbility.getFirstTarget()); if (card != null) { return card.getConvertedManaCost(); } diff --git a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java index 5d02e906491..55a60146d50 100644 --- a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java @@ -59,8 +59,6 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Zone fromZone = ((ZoneChangeEvent) event).getFromZone(); Card card = game.getCard(event.getTargetId()); - UUID sourceId = event.getSourceId(); - UUID controllerId = event.getPlayerId(); if (card == null) { return false; } @@ -95,7 +93,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { } UUID targetId = null; - MageObject sourceObject = game.getObject(sourceId); + MageObject sourceObject = game.getObject(event.getSourceId()); boolean enchantCardInGraveyard = false; if (sourceObject instanceof StackAbility) { StackAbility stackAbility = (StackAbility) sourceObject; @@ -157,25 +155,25 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { if (targetCard != null || targetPermanent != null || targetPlayer != null) { if (firstCardFace != null) { // transforming card. remove first face (original card) from old zone - firstCardFace.removeFromZone(game, fromZone, sourceId); + firstCardFace.removeFromZone(game, fromZone, source); } else { - card.removeFromZone(game, fromZone, sourceId); + card.removeFromZone(game, fromZone, source); } PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game); - ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD); + ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, event.getPlayerId(), fromZone, Zone.BATTLEFIELD); permanent.updateZoneChangeCounter(game, zoneChangeEvent); game.addPermanent(permanent, 0); card.setZone(Zone.BATTLEFIELD, game); - if (permanent.entersBattlefield(event.getSourceId(), game, fromZone, true)) { + if (permanent.entersBattlefield(source, game, fromZone, true)) { String attachToName = null; if (targetCard != null) { - permanent.attachTo(targetCard.getId(), game); + permanent.attachTo(targetCard.getId(), source, game); attachToName = targetCard.getLogName(); } else if (targetPermanent != null) { - targetPermanent.addAttachment(permanent.getId(), game); + targetPermanent.addAttachment(permanent.getId(), source, game); attachToName = targetPermanent.getLogName(); } else if (targetPlayer != null) { - targetPlayer.addAttachment(permanent.getId(), game); + targetPlayer.addAttachment(permanent.getId(), source, game); attachToName = targetPlayer.getLogName(); } game.applyEffects(); diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index eebdcccb61f..a5cd2a688e2 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -419,7 +419,7 @@ public class ContinuousEffects implements Serializable { return true; } MageObject object; - if (event.getType() == EventType.ZONE_CHANGE + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD && event.getTargetId().equals(ability.getSourceId())) { object = ((ZoneChangeEvent) event).getTarget(); diff --git a/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java b/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java index 6b7668bb4a2..52db89542d2 100644 --- a/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java @@ -107,25 +107,23 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl { return false; } } - Spell spell = game.getStack().getSpell(event.getSourceId()); - if (spell == null) { + Spell entersBySpell = game.getStack().getSpell(event.getSourceId()); + if (entersBySpell == null) { StackObject stackObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK); if (stackObject instanceof Spell) { - spell = (Spell) stackObject; + entersBySpell = (Spell) stackObject; } } for (Effect effect : baseEffects) { - // if (source.activate(game, false)) { // Why is this needed???? if (effect instanceof ContinuousEffect) { game.addEffect((ContinuousEffect) effect, source); } else { - if (spell != null) { - effect.setValue(SOURCE_CAST_SPELL_ABILITY, spell.getSpellAbility()); + if (entersBySpell != null) { + effect.setValue(SOURCE_CAST_SPELL_ABILITY, entersBySpell.getSpellAbility()); } effect.setValue("appliedEffects", event.getAppliedEffects()); effect.apply(game, source); } - // } } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java index 1310dc54582..e000fabd618 100644 --- a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java @@ -82,9 +82,9 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm case ATTACK: return event.getType() == GameEvent.EventType.DECLARE_ATTACKER; case BLOCK: - return event.getType() == EventType.DECLARE_BLOCKER; + return event.getType() == GameEvent.EventType.DECLARE_BLOCKER; case ATTACK_AND_BLOCK: - return event.getType() == GameEvent.EventType.DECLARE_ATTACKER || event.getType() == EventType.DECLARE_BLOCKER; + return event.getType() == GameEvent.EventType.DECLARE_ATTACKER || event.getType() == GameEvent.EventType.DECLARE_BLOCKER; } return false; } @@ -106,16 +106,16 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm Player player = game.getPlayer(event.getPlayerId()); if (player != null) { String chooseText; - if (event.getType() == EventType.DECLARE_ATTACKER) { + if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER) { chooseText = "Pay " + attackBlockManaTax.getText() + " to attack?"; } else { chooseText = "Pay " + attackBlockManaTax.getText() + " to block?"; } attackBlockManaTax.clearPaid(); - if (attackBlockManaTax.canPay(source, source.getSourceId(), player.getId(), game) + if (attackBlockManaTax.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Neutral, chooseText, source, game)) { if (attackBlockManaTax instanceof ManaCostsImpl) { - if (attackBlockManaTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) { + if (attackBlockManaTax.payOrRollback(source, game, source, event.getPlayerId())) { return false; } } @@ -129,10 +129,10 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm Player player = game.getPlayer(event.getPlayerId()); if (player != null) { attackBlockOtherTax.clearPaid(); - if (attackBlockOtherTax.canPay(source, source.getSourceId(), event.getPlayerId(), game) + if (attackBlockOtherTax.canPay(source, source, event.getPlayerId(), game) && player.chooseUse(Outcome.Neutral, - attackBlockOtherTax.getText() + " to " + (event.getType() == EventType.DECLARE_ATTACKER ? "attack?" : "block?"), source, game)) { - if (attackBlockOtherTax.pay(source, game, source.getSourceId(), event.getPlayerId(), false, null)) { + attackBlockOtherTax.getText() + " to " + (event.getType() == GameEvent.EventType.DECLARE_ATTACKER ? "attack?" : "block?"), source, game)) { + if (attackBlockOtherTax.pay(source, game, source, event.getPlayerId(), false, null)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java b/Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java index 737d6a68fa4..d17c83d3d96 100644 --- a/Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java @@ -59,7 +59,7 @@ public class PhantomPreventionEffect extends PreventionEffectImpl { if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); + permanent.removeCounters(CounterType.P1P1.createInstance(), source, game); sb.append("Removed a +1/+1 counter "); game.informPlayers(sb.toString()); } diff --git a/Mage/src/main/java/mage/abilities/effects/PlaneswalkerRedirectionEffect.java b/Mage/src/main/java/mage/abilities/effects/PlaneswalkerRedirectionEffect.java index 2257545f9e5..6a4262deef4 100644 --- a/Mage/src/main/java/mage/abilities/effects/PlaneswalkerRedirectionEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/PlaneswalkerRedirectionEffect.java @@ -40,7 +40,7 @@ public class PlaneswalkerRedirectionEffect extends RedirectionEffect { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGE_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java index 14c49680178..0fa1e3a4395 100644 --- a/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java @@ -51,7 +51,7 @@ public class PreventDamageAndRemoveCountersEffect extends PreventionEffectImpl { if (!thatMany) { damage = 1; } - permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); //MTG ruling (this) loses counters even if the damage isn't prevented + permanent.removeCounters(CounterType.P1P1.createInstance(damage), source, game); //MTG ruling (this) loses counters even if the damage isn't prevented return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/RedirectionEffect.java b/Mage/src/main/java/mage/abilities/effects/RedirectionEffect.java index 262d7ab3bee..d5c0efaeeb2 100644 --- a/Mage/src/main/java/mage/abilities/effects/RedirectionEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/RedirectionEffect.java @@ -88,12 +88,12 @@ public abstract class RedirectionEffect extends ReplacementEffectImpl { } Permanent permanent = game.getPermanent(redirectTarget.getFirstTarget()); if (permanent != null) { - permanent.damage(damageToRedirect, event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + permanent.damage(damageToRedirect, event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); game.informPlayers(sourceLogName + "Redirected " + damageToRedirect + " damage" + getRedirectedFromText(event, game) + " to " + permanent.getLogName()); } else { Player player = game.getPlayer(redirectTarget.getFirstTarget()); if (player != null) { - player.damage(damageToRedirect, event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); + player.damage(damageToRedirect, event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects()); game.informPlayers(sourceLogName + "Redirected " + damageToRedirect + " damage" + getRedirectedFromText(event, game) + " to " + player.getLogName()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/AttachEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AttachEffect.java index 11fae020f2e..677f102bb81 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AttachEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AttachEffect.java @@ -43,16 +43,16 @@ public class AttachEffect extends OneShotEffect { || zcc == source.getSourceObjectZoneChangeCounter() + 2) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - return permanent.addAttachment(source.getSourceId(), game); + return permanent.addAttachment(source.getSourceId(), source, game); } else { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player != null) { - return player.addAttachment(source.getSourceId(), game); + return player.addAttachment(source.getSourceId(), source, game); } if (!source.getTargets().isEmpty() && source.getTargets().get(0) instanceof TargetCard) { // e.g. Spellweaver Volute Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null) { - return card.addAttachment(source.getSourceId(), game); + return card.addAttachment(source.getSourceId(), source, game); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/BalanceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/BalanceEffect.java index 3f6a41bb026..8da6c252587 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/BalanceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/BalanceEffect.java @@ -92,7 +92,7 @@ public class BalanceEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && cardsToDiscard.get(playerId) != null) { - player.discard(cardsToDiscard.get(playerId), source, game); + player.discard(cardsToDiscard.get(playerId), false, source, game); } } @@ -145,7 +145,7 @@ public class BalanceEffect extends OneShotEffect { for (Permanent permanent : permanentsToSacrifice) { if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/BecomeBlockedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/BecomeBlockedTargetEffect.java index a398d066eaa..37940ff454d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/BecomeBlockedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/BecomeBlockedTargetEffect.java @@ -52,17 +52,14 @@ public class BecomeBlockedTargetEffect extends OneShotEffect { if (alreadyBlocked) { continue; } - game.fireEvent(GameEvent.getEvent( - GameEvent.EventType.CREATURE_BLOCKED, permanent.getId(), - source.getSourceId(), null - )); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, permanent.getId(), source, null)); morSet.add(new MageObjectReference(permanent, game)); } String key = UUID.randomUUID().toString(); game.getState().setValue("becameBlocked_" + key, morSet); game.fireEvent(GameEvent.getEvent( GameEvent.EventType.BATCH_BLOCK_NONCOMBAT, - source.getSourceId(), source.getSourceId(), + source.getSourceId(), source, source.getControllerId(), key, 0) ); return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/BrainstormEffect.java b/Mage/src/main/java/mage/abilities/effects/common/BrainstormEffect.java index 5dd98633e86..7e3c5b843c4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/BrainstormEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/BrainstormEffect.java @@ -29,7 +29,7 @@ public class BrainstormEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(3, source.getSourceId(), game); + player.drawCards(3, source, game); putOnLibrary(player, source, game); putOnLibrary(player, source, game); return true; @@ -43,7 +43,7 @@ public class BrainstormEffect extends OneShotEffect { player.chooseTarget(Outcome.ReturnToHand, target, source, game); Card card = player.getHand().get(target.getFirstTarget(), game); if (card != null) { - return player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); + return player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); } } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java index 78aafb7885c..0098e281b79 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java @@ -55,7 +55,7 @@ public class CantBeCounteredControlledEffect extends ContinuousRuleModifyingEffe @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER; + return event.getType() == GameEvent.EventType.COUNTER; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java index c1a6bb87c53..a56d3744fb3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java @@ -50,7 +50,7 @@ public class CantBeCounteredSourceEffect extends ContinuousRuleModifyingEffectIm @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.COUNTER; + return event.getType() == GameEvent.EventType.COUNTER; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java index ea38ed40768..89fd454a988 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java @@ -37,7 +37,7 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.REGENERATE; + return event.getType() == GameEvent.EventType.REGENERATE; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java index 1d472fe5d80..2623a44451f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java @@ -36,7 +36,7 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.REGENERATE; + return event.getType() == GameEvent.EventType.REGENERATE; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java index 4f2a308ba0b..f7392444293 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java @@ -58,7 +58,7 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGET; + return event.getType() == GameEvent.EventType.TARGET; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java index e09fdb49906..2286ca91adb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java @@ -52,7 +52,7 @@ public class CantBeTargetedAttachedEffect extends ContinuousRuleModifyingEffectI @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGET; + return event.getType() == GameEvent.EventType.TARGET; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java index c4dc270db11..8d7fb405e81 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java @@ -44,7 +44,7 @@ public class CantBeTargetedSourceEffect extends ContinuousRuleModifyingEffectImp @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGET; + return event.getType() == GameEvent.EventType.TARGET; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java index 557da3ba21b..f0789905664 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java @@ -52,7 +52,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.TARGET; + return event.getType() == GameEvent.EventType.TARGET; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java index 8adce9ce2e6..19585e2a310 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java @@ -65,7 +65,7 @@ public class CipherEffect extends OneShotEffect { if (controller != null) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); target.setNotTarget(true); - if (target.canChoose(source.getControllerId(), game) + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.chooseUse(outcome, "Cipher this spell to a creature?", source, game)) { controller.chooseTarget(outcome, target, source, game); Card sourceCard = game.getCard(source.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java index 182b6e583f3..0fb8233495c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java @@ -86,7 +86,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null - && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CLASH, controller.getId(), controller.getId()))) { + && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CLASH, controller.getId(), source, controller.getId()))) { // choose opponent Target target = new TargetOpponent(true); target.setTargetName("an opponent to clash with"); @@ -152,10 +152,10 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { } while (nextPlayer != null && !nextPlayer.getId().equals(game.getActivePlayerId())); // put the cards back to library if (cardController != null) { - controller.moveCardToLibraryWithInfo(cardController, source.getSourceId(), game, Zone.LIBRARY, topController, true); + controller.moveCardToLibraryWithInfo(cardController, source, game, Zone.LIBRARY, topController, true); } if (cardOpponent != null) { - opponent.moveCardToLibraryWithInfo(cardOpponent, source.getSourceId(), game, Zone.LIBRARY, topOpponent, true); + opponent.moveCardToLibraryWithInfo(cardOpponent, source, game, Zone.LIBRARY, topOpponent, true); } // fire CLASHED event with info about who won String winner = "draw"; @@ -165,7 +165,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { if (cmcOpponent > cmcController) { winner = "opponent"; } - GameEvent gameEvent = new GameEvent(EventType.CLASHED, opponent.getId(), source.getSourceId(), controller.getId()); + GameEvent gameEvent = new GameEvent(GameEvent.EventType.CLASHED, opponent.getId(), source, controller.getId()); gameEvent.setData(winner); game.fireEvent(gameEvent); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopyPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopyPermanentEffect.java index e50ba8830ea..d95d1021bc2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopyPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopyPermanentEffect.java @@ -156,9 +156,9 @@ public class CopyPermanentEffect extends OneShotEffect { Permanent targetPermanent = game.getPermanent(targetId); Player targetPlayer = game.getPlayer(targetId); if (targetPermanent != null) { - targetPermanent.addAttachment(sourcePermanent.getId(), game); + targetPermanent.addAttachment(sourcePermanent.getId(), source, game); } else if (targetPlayer != null) { - targetPlayer.addAttachment(sourcePermanent.getId(), game); + targetPlayer.addAttachment(sourcePermanent.getId(), source, game); } else { return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java index 3da50530472..838d809d9a2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java @@ -10,6 +10,7 @@ import mage.filter.FilterImpl; import mage.filter.FilterInPlay; import mage.filter.predicate.mageobject.FromSetPredicate; import mage.game.Game; +import mage.game.events.CopiedStackObjectEvent; import mage.game.events.GameEvent; import mage.game.stack.Spell; import mage.players.Player; @@ -164,8 +165,7 @@ public abstract class CopySpellForEachItCouldTargetEffect ex Spell chosenCopy = targetCopyMap.get(chosenId); if (chosenCopy != null) { game.getStack().push(chosenCopy); - game.fireEvent(new GameEvent(GameEvent.EventType.COPIED_STACKOBJECT, - chosenCopy.getId(), spell.getId(), source.getControllerId())); + game.fireEvent(new CopiedStackObjectEvent(spell, chosenCopy, source.getControllerId())); toDelete.add(chosenId); madeACopy = true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetAndSearchGraveyardHandLibraryEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetAndSearchGraveyardHandLibraryEffect.java index 86ac6ae39f4..948ef45327f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetAndSearchGraveyardHandLibraryEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetAndSearchGraveyardHandLibraryEffect.java @@ -53,7 +53,7 @@ public class CounterTargetAndSearchGraveyardHandLibraryEffect extends SearchTarg cardName = targetObject.getName(); } searchPlayerId = stackObject.getControllerId(); - result = game.getStack().counter(objectId, source.getSourceId(), game); + result = game.getStack().counter(objectId, source, game); } } // 5/1/2008: If the targeted spell can't be countered (it's Vexing Shusher, for example), diff --git a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetEffect.java index 144bb81b448..8266328ecc2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetEffect.java @@ -31,7 +31,7 @@ public class CounterTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { boolean countered = false; for (UUID targetId : getTargetPointer().getTargets(game, source)) { - if (game.getStack().counter(targetId, source.getSourceId(), game)) { + if (game.getStack().counter(targetId, source, game)) { countered = true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java index fccadf14a47..5f3a9e030e4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java @@ -49,7 +49,7 @@ public class CounterTargetWithReplacementEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game, targetZone, false, zoneDetail); + return game.getStack().counter(targetPointer.getFirst(game, source), source, game, targetZone, false, zoneDetail); } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java index c4386b6fc35..b89b75a6793 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java @@ -68,9 +68,10 @@ public class CounterUnlessPaysEffect extends OneShotEffect { } costToPay.clearPaid(); - if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false, null))) { + if (!(player.chooseUse(Outcome.Benefit, message, source, game) + && costToPay.pay(source, game, source, spell.getControllerId(), false, null))) { game.informPlayers(player.getLogName() + " chooses not to pay " + costValueMessage + " to prevent the counter effect"); - return game.getStack().counter(spell.getId(), source.getSourceId(), game); + return game.getStack().counter(spell.getId(), source, game); } game.informPlayers(player.getLogName() + " chooses to pay " + costValueMessage + " to prevent the counter effect"); return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java index f6f1a2dd036..4173e8eaf8f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java @@ -211,7 +211,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { } additionalAbilities.stream().forEach(token::addAbility); - token.putOntoBattlefield(number, game, source.getSourceId(), playerId == null ? source.getControllerId() : playerId, tapped, attacking, attackedPlayer); + token.putOntoBattlefield(number, game, source, playerId == null ? source.getControllerId() : playerId, tapped, attacking, attackedPlayer); for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield Permanent tokenPermanent = game.getPermanent(tokenId); if (tokenPermanent != null) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 28d2a7cb1cd..6260447ec98 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -74,7 +74,7 @@ public class CreateTokenEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int value = amount.calculate(game, source, this); - token.putOntoBattlefield(value, game, source.getSourceId(), source.getControllerId(), tapped, attacking); + token.putOntoBattlefield(value, game, source, source.getControllerId(), tapped, attacking); this.lastAddedTokenId = token.getLastAddedToken(); this.lastAddedTokenIds = token.getLastAddedTokenIds(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java index 58af4a8c0d6..ce3992cb417 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java @@ -57,7 +57,7 @@ public class CreateTokenTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int value = amount.calculate(game, source, this); if (value > 0) { - return token.putOntoBattlefield(value, game, source.getSourceId(), targetPointer.getFirst(game, source), tapped, attacking); + return token.putOntoBattlefield(value, game, source, targetPointer.getFirst(game, source), tapped, attacking); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageAllControlledTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageAllControlledTargetEffect.java index ac3bf171bb9..da0c5dd2b3c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageAllControlledTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageAllControlledTargetEffect.java @@ -43,7 +43,7 @@ public class DamageAllControlledTargetEffect extends OneShotEffect { return false; } for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java index d489a9ba25c..11eaed42696 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java @@ -56,7 +56,7 @@ public class DamageAllEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, true); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedControllerEffect.java index 37ac30e505e..7e350a8da3a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedControllerEffect.java @@ -55,7 +55,7 @@ public class DamageAttachedControllerEffect extends OneShotEffect { } Player player = game.getPlayer(enchanted.getControllerId()); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedEffect.java index 43cb13ca722..0d4e3f86bb6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageAttachedEffect.java @@ -62,7 +62,7 @@ public class DamageAttachedEffect extends OneShotEffect { if(enchanted == null) { return false; } - enchanted.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); + enchanted.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, true); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java index 56d5c4fe876..15c41536dd9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java @@ -72,7 +72,7 @@ public class DamageControllerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, preventable); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java index ac3de07e837..f0d5880472c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java @@ -41,9 +41,9 @@ public class DamageEachOtherEffect extends OneShotEffect { if (sourceCreature != null && targetCreature != null && sourceCreature.isCreature() && targetCreature.isCreature()) { - targetCreature.damage(sourceCreature.getPower().getValue(), sourceCreature.getId(), game, false, true); + targetCreature.damage(sourceCreature.getPower().getValue(), sourceCreature.getId(), source, game, false, true); if (sourceOnBattlefield) { - sourceCreature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game, false, true); + sourceCreature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), source, game, false, true); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageEverythingEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageEverythingEffect.java index 03292024220..e6433a9a8b3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageEverythingEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageEverythingEffect.java @@ -77,12 +77,12 @@ public class DamageEverythingEffect extends OneShotEffect { int damage = amount.calculate(game, source, this); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); for (Permanent permanent : permanents) { - permanent.damage(damage, damageSource == null ? source.getSourceId() : damageSource, game, false, true); + permanent.damage(damage, damageSource == null ? source.getSourceId() : damageSource, source, game, false, true); } for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(damage, damageSource == null ? source.getSourceId() : damageSource, game); + player.damage(damage, damageSource == null ? source.getSourceId() : damageSource, source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java index a2cf55be8bc..34d92901d2b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java @@ -61,13 +61,13 @@ public class DamageMultiEffect extends OneShotEffect { for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - if (permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), game, false, true) > 0) { + if (permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), source, game, false, true) > 0) { damagedSet.add(new MageObjectReference(permanent, game)); } } else { Player player = game.getPlayer(target); if (player != null) { - player.damage(multiTarget.getTargetAmount(target), source.getSourceId(), game); + player.damage(multiTarget.getTargetAmount(target), source.getSourceId(), source, game); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamagePlayersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamagePlayersEffect.java index ef45ec725ad..c2d8dd83cb1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamagePlayersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamagePlayersEffect.java @@ -60,7 +60,7 @@ public class DamagePlayersEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game); } } break; @@ -68,7 +68,7 @@ public class DamagePlayersEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game); } } break; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageSelfEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageSelfEffect.java index a819b385d4b..8d195f5fba8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageSelfEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageSelfEffect.java @@ -35,7 +35,7 @@ public class DamageSelfEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, true); + permanent.damage(amount, source.getSourceId(), source, game, false, true); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetControllerEffect.java index 18ccef09a64..affd1a9f588 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetControllerEffect.java @@ -53,7 +53,7 @@ public class DamageTargetControllerEffect extends OneShotEffect { if (permanent != null) { Player targetController = game.getPlayer(permanent.getControllerId()); if (targetController != null) { - targetController.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); + targetController.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, preventable); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java index dff5f88bb3e..01f03e51b7f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java @@ -119,11 +119,11 @@ public class DamageTargetEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, preventable); } Player player = game.getPlayer(targetId); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, preventable); } } } @@ -132,11 +132,11 @@ public class DamageTargetEffect extends OneShotEffect { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, preventable); } else { Player player = game.getPlayer(targetId); if (player != null) { - player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); + player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game, false, preventable); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromOneToAnotherTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromOneToAnotherTargetEffect.java index 1b359ffd5fe..7fba58ba9fd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromOneToAnotherTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromOneToAnotherTargetEffect.java @@ -40,10 +40,10 @@ public class DamageWithPowerFromOneToAnotherTargetEffect extends OneShotEffect { Player anotherPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget()); if (myPermanent != null && anotherPermanent != null) { - anotherPermanent.damage(myPermanent.getPower().getValue(), myPermanent.getId(), game, false, true); + anotherPermanent.damage(myPermanent.getPower().getValue(), myPermanent.getId(), source, game, false, true); return true; } else if (myPermanent != null && anotherPlayer != null) { - anotherPlayer.damage(myPermanent.getPower().getValue(), myPermanent.getId(), game); + anotherPlayer.damage(myPermanent.getPower().getValue(), myPermanent.getId(), source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java index 8dea757273d..5be2ea79ee2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java @@ -40,10 +40,10 @@ public class DamageWithPowerFromSourceToAnotherTargetEffect extends OneShotEffec Player anotherPlayer = game.getPlayer(source.getTargets().get(0).getFirstTarget()); if (myPermanent != null && anotherPermanent != null) { - anotherPermanent.damage(myPermanent.getPower().getValue(), myPermanent.getId(), game, false, true); + anotherPermanent.damage(myPermanent.getPower().getValue(), myPermanent.getId(), source, game, false, true); return true; } else if (myPermanent != null && anotherPlayer != null) { - anotherPlayer.damage(myPermanent.getPower().getValue(), myPermanent.getId(), game); + anotherPlayer.damage(myPermanent.getPower().getValue(), myPermanent.getId(), source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllAttachedEquipmentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllAttachedEquipmentEffect.java index b55a48f3e95..e307f592df5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllAttachedEquipmentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllAttachedEquipmentEffect.java @@ -41,7 +41,7 @@ public class DestroyAllAttachedEquipmentEffect extends OneShotEffect { for (UUID attachmentId : attachments) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.hasSubtype(SubType.EQUIPMENT, game)) { - attachment.destroy(source.getSourceId(), game, false); + attachment.destroy(source, game, false); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllControlledTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllControlledTargetEffect.java index ef481718436..291813d9138 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllControlledTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllControlledTargetEffect.java @@ -36,7 +36,7 @@ public class DestroyAllControlledTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game)) { - permanent.destroy(source.getSourceId(), game, false); + permanent.destroy(source, game, false); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllEffect.java index d91cd361356..8769ed1a232 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllEffect.java @@ -45,7 +45,7 @@ public class DestroyAllEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.destroy(source.getSourceId(), game, noRegen); + permanent.destroy(source, game, noRegen); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllNamedPermanentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllNamedPermanentsEffect.java index cc767a1a600..68a0f79a465 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyAllNamedPermanentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyAllNamedPermanentsEffect.java @@ -42,7 +42,7 @@ public class DestroyAllNamedPermanentsEffect extends OneShotEffect { filter.add(new NamePredicate(targetPermanent.getName())); } for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { - perm.destroy(source.getSourceId(), game, false); + perm.destroy(source, game, false); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyAttachedToEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyAttachedToEffect.java index 54472140fb6..d18a28769bb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyAttachedToEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyAttachedToEffect.java @@ -44,7 +44,7 @@ public class DestroyAttachedToEffect extends OneShotEffect { if (attachment != null && attachment.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(attachment.getAttachedTo()); if (attachedTo != null) { - return attachedTo.destroy(source.getSourceId(), game, noRegen); + return attachedTo.destroy(source, game, noRegen); } } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyEquippedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyEquippedEffect.java index 6d833155850..c5441b28ff8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyEquippedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyEquippedEffect.java @@ -42,7 +42,7 @@ public class DestroyEquippedEffect extends OneShotEffect { permanent = game.getPermanent(equipment.getAttachedTo()); } if (permanent != null) { - return permanent.destroy(source.getSourceId(), game, false); + return permanent.destroy(source, game, false); } } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java index 3a8f2b90ab1..e4b6acf2f73 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java @@ -44,7 +44,7 @@ public class DestroyMultiTargetEffect extends OneShotEffect { for (UUID permanentId: target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.destroy(source.getSourceId(), game, noRegen); + permanent.destroy(source, game, noRegen); affectedTargets++; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroySourceEffect.java index 6ce1a75c8c4..962010d49b9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroySourceEffect.java @@ -41,7 +41,7 @@ public class DestroySourceEffect extends OneShotEffect { if (permanent != null && permanent.isPhasedIn() && !permanent.isPhasedOutIndirectly()) { - permanent.destroy(source.getSourceId(), game, noRegen); + permanent.destroy(source, game, noRegen); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyTargetEffect.java index 22fb9acf03e..481cdcaebb9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyTargetEffect.java @@ -67,7 +67,7 @@ public class DestroyTargetEffect extends OneShotEffect { if (permanent != null && permanent.isPhasedIn() && !permanent.isPhasedOutIndirectly()) { - permanent.destroy(source.getSourceId(), game, noRegen); + permanent.destroy(source, game, noRegen); affectedTargets++; } } @@ -78,7 +78,7 @@ public class DestroyTargetEffect extends OneShotEffect { if (permanent != null && permanent.isPhasedIn() && !permanent.isPhasedOutIndirectly()) { - permanent.destroy(source.getSourceId(), game, noRegen); + permanent.destroy(source, game, noRegen); affectedTargets++; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java index 553bf2b6c17..bf226a50b51 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java @@ -91,7 +91,7 @@ public class DevourEffect extends ReplacementEffectImpl { int devouredCreatures = 0; for (UUID targetId : target.getTargets()) { Permanent targetCreature = game.getPermanent(targetId); - if (targetCreature != null && targetCreature.sacrifice(source.getSourceId(), game)) { + if (targetCreature != null && targetCreature.sacrifice(source, game)) { cardSubtypes.add(targetCreature.getSubtype(game)); devouredCreatures++; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DiscardOntoBattlefieldEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DiscardOntoBattlefieldEffect.java index 46b44b41e05..43cae9b0e57 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DiscardOntoBattlefieldEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DiscardOntoBattlefieldEffect.java @@ -36,7 +36,7 @@ public class DiscardOntoBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index baa0f2738b2..fc54b6477a1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -90,11 +90,11 @@ public class DoIfCostPaid extends OneShotEffect { message = CardUtil.replaceSourceName(message, mageObject.getName()); boolean result = true; Outcome payOutcome = executingEffects.getOutcome(source, this.outcome); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) + if (cost.canPay(source, source, player.getId(), game) && (!optional || player.chooseUse(payOutcome, message, source, game))) { cost.clearPaid(); int bookmark = game.bookmarkState(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source, player.getId(), false)) { game.informPlayers(player.getLogName() + " paid for " + mageObject.getLogName() + " - " + message); for (Effect effect : executingEffects) { effect.setTargetPointer(this.targetPointer); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java index 28d2dda59d4..94e9dad3259 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java @@ -89,10 +89,10 @@ public class DoUnlessAnyPlayerPaysEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && player.canRespond() - && costToPay.canPay(source, source.getSourceId(), player.getId(), game) + && costToPay.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { costToPay.clearPaid(); - if (costToPay.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (costToPay.pay(source, game, source, player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java index d38ded3dcfa..86e5c36b7dc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java @@ -63,9 +63,9 @@ public class DoUnlessControllerPaysEffect extends OneShotEffect { boolean doEffect = true; // check if controller is willing to pay - if (cost.canPay(source, source.getSourceId(), controller.getId(), game) && controller.chooseUse(Outcome.Detriment, message, source, game)) { + if (cost.canPay(source, source, controller.getId(), game) && controller.chooseUse(Outcome.Detriment, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { + if (cost.pay(source, game, source, controller.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(controller.getLogName() + " pays the cost to prevent the effect"); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java index cb066a1fac4..2ae6240858d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java @@ -96,10 +96,10 @@ public class DoUnlessTargetPlayerOrTargetsControllerPaysEffect extends OneShotEf boolean doEffect = true; // check if targetController is willing to pay - if (costToPay.canPay(source, source.getSourceId(), player.getId(), game) + if (costToPay.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { costToPay.clearPaid(); - if (costToPay.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (costToPay.pay(source, game, source, player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoWhenCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoWhenCostPaid.java index 3a9139ce8ae..fb410fb5574 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoWhenCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoWhenCostPaid.java @@ -49,13 +49,13 @@ public class DoWhenCostPaid extends OneShotEffect { } String message = CardUtil.replaceSourceName(chooseUseText, mageObject.getLogName()); Outcome payOutcome = ability.getEffects().getOutcome(source, this.outcome); - if (!cost.canPay(source, source.getSourceId(), player.getId(), game) + if (!cost.canPay(source, source, player.getId(), game) || (optional && !player.chooseUse(payOutcome, message, source, game))) { return false; } cost.clearPaid(); int bookmark = game.bookmarkState(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source, player.getId(), false)) { ability.getEffects().setTargetPointer(getTargetPointer()); game.fireReflexiveTriggeredAbility(ability, source); player.resetStoredBookmark(game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java index 41200f26f0f..e016b17c4dd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java @@ -87,14 +87,14 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP_STEP || event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP_STEP || event.getType() == GameEvent.EventType.UNTAP; } @Override public boolean applies(GameEvent event, Ability source, Game game) { // the check if a permanent untap phase is already handled is needed if multiple effects are added to prevent untap in next untap step of controller // if we don't check it for every untap step of a turn only one effect would be consumed instead of all be valid for the next untap step - if (event.getType() == EventType.UNTAP_STEP) { + if (event.getType() == GameEvent.EventType.UNTAP_STEP) { boolean allHandled = true; for (UUID targetId : getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); @@ -120,7 +120,7 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR } } - if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == EventType.UNTAP) { + if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) { if (handledTargetsDuringTurn.containsKey(event.getTargetId()) && !handledTargetsDuringTurn.get(event.getTargetId()) && getTargetPointer().getTargets(game, source).contains(event.getTargetId())) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java index f7d139f97c5..72fa0bee8b3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java @@ -51,7 +51,7 @@ public class DontUntapInControllersUntapStepAllEffect extends ContinuousRuleModi @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java index 8c2d9842beb..e77ac30df73 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java @@ -42,7 +42,7 @@ public class DontUntapInControllersUntapStepSourceEffect extends ContinuousRuleM @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java index 82f48cce45e..cd10dc9649c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java @@ -65,7 +65,7 @@ public class DontUntapInPlayersNextUntapStepAllEffect extends ContinuousRuleModi @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP_STEP || event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP_STEP || event.getType() == GameEvent.EventType.UNTAP; } @Override @@ -80,7 +80,7 @@ public class DontUntapInPlayersNextUntapStepAllEffect extends ContinuousRuleModi return false; } // remember the turn of the untap step the effect has to be applied - if (event.getType() == EventType.UNTAP_STEP) { + if (event.getType() == GameEvent.EventType.UNTAP_STEP) { if (game.isActivePlayer(getTargetPointer().getFirst(game, source))) { if (validForTurnNum == game.getTurnNum()) { // the turn has a second untap step but the effect is already related to the first untap step discard(); @@ -90,7 +90,7 @@ public class DontUntapInPlayersNextUntapStepAllEffect extends ContinuousRuleModi } } - if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == EventType.UNTAP) { + if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null) { Player controller = game.getPlayer(source.getControllerId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardAllEffect.java index 772d25845ac..2f2f4fb2942 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardAllEffect.java @@ -59,7 +59,7 @@ public class DrawCardAllEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game); + player.drawCards(amount.calculate(game, source, this), source, game); } } break; @@ -67,7 +67,7 @@ public class DrawCardAllEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(controller.getId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game); + player.drawCards(amount.calculate(game, source, this), source, game); } } break; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardForEachColorAmongControlledPermanentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardForEachColorAmongControlledPermanentsEffect.java index 951d788acb8..771ecaa52e7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardForEachColorAmongControlledPermanentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardForEachColorAmongControlledPermanentsEffect.java @@ -49,7 +49,7 @@ public class DrawCardForEachColorAmongControlledPermanentsEffect extends OneShot colors.add(ObjectColor.WHITE); } } - controller.drawCards(colors.size(), source.getSourceId(), game); + controller.drawCards(colors.size(), source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java index 7dd857656fa..be85fa96d60 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java @@ -53,7 +53,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.canRespond()) { - player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game); + player.drawCards(amount.calculate(game, source, this), source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java index 15adc05b828..b67ddd9d5b7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java @@ -70,7 +70,7 @@ public class DrawCardTargetEffect extends OneShotEffect { } if (!optional || player.chooseUse(outcome, "Use draw effect?", source, game)) { - player.drawCards(cardsToDraw, source.getSourceId(), game); + player.drawCards(cardsToDraw, source, game); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardControllerEffect.java index 7823789af5a..280d1107689 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardControllerEffect.java @@ -58,8 +58,8 @@ public class DrawDiscardControllerEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { if (!optional || player.chooseUse(outcome, "Use draw, then discard effect?", source, game)) { - player.drawCards(cardsToDraw, source.getSourceId(), game); - player.discard(cardsToDiscard, false, source, game); + player.drawCards(cardsToDraw, source, game); + player.discard(cardsToDiscard, false, false, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardOneOfThemEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardOneOfThemEffect.java index 2738e12505a..bf306147e51 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardOneOfThemEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardOneOfThemEffect.java @@ -46,7 +46,7 @@ public class DrawDiscardOneOfThemEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Cards initialHand = controller.getHand().copy(); - controller.drawCards(cardsToDraw, source.getSourceId(), game); + controller.drawCards(cardsToDraw, source, game); Cards drawnCards = new CardsImpl(controller.getHand().copy()); drawnCards.removeAll(initialHand); if (!drawnCards.isEmpty()) { @@ -55,7 +55,7 @@ public class DrawDiscardOneOfThemEffect extends OneShotEffect { if (controller.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) { Card card = controller.getHand().get(cardToDiscard.getFirstTarget(), game); if (card != null) { - return controller.discard(card, source, game); + return controller.discard(card, false, source, game); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardTargetEffect.java index 9a8f21ae21d..9b9c234d578 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawDiscardTargetEffect.java @@ -49,8 +49,8 @@ public class DrawDiscardTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player != null) { - player.drawCards(cardsToDraw, source.getSourceId(), game); - player.discard(cardsToDiscard, false, source, game); + player.drawCards(cardsToDraw, source, game); + player.discard(cardsToDiscard, false, false, source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java index 0bec69cbc82..0a02c0a162f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java @@ -50,12 +50,12 @@ public class EnterBattlefieldPayCostOrPutGraveyardEffect extends ReplacementEffe MageObject sourceObject = game.getObject(source.getSourceId()); if (player != null && cost != null && sourceObject != null) { boolean replace = true; - if (cost.canPay(source, source.getSourceId(), player.getId(), game)) { + if (cost.canPay(source, source, player.getId(), game)) { if (player.chooseUse(outcome, cost.getText().substring(0, 1).toUpperCase(Locale.ENGLISH) + cost.getText().substring(1) + "? (otherwise " + sourceObject.getLogName() + " is put into graveyard)", source, game)) { cost.clearPaid(); - replace = !cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null); + replace = !cost.pay(source, game, source, source.getControllerId(), false, null); } } if (replace) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileAllEffect.java index 271d004bf45..8f4236e14ec 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileAllEffect.java @@ -52,7 +52,7 @@ public class ExileAllEffect extends OneShotEffect { if (controller != null) { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - controller.moveCardToExileWithInfo(permanent, exileId, exileZone, source.getSourceId(), game, Zone.BATTLEFIELD, true); + controller.moveCardToExileWithInfo(permanent, exileId, exileZone, source, game, Zone.BATTLEFIELD, true); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileAndGainLifeEqualPowerTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileAndGainLifeEqualPowerTargetEffect.java index 64ceb7543e8..b208f8472f6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileAndGainLifeEqualPowerTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileAndGainLifeEqualPowerTargetEffect.java @@ -34,7 +34,7 @@ public class ExileAndGainLifeEqualPowerTargetEffect extends OneShotEffect { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { int creaturePower = permanent.getPower().getValue(); - permanent.moveToExile(null, null, source.getSourceId(), game); + permanent.moveToExile(null, null, source, game); game.getState().processAction(game); player.gainLife(creaturePower, game, source); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java index f2f8de4a1fc..45f9846bc48 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java @@ -44,7 +44,7 @@ public class ExileCardFromOwnGraveyardControllerEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Card card = player.getGraveyard().get(targetId, game); if (card != null) { - card.moveToZone(Zone.EXILED, source.getSourceId(), game, false); + card.moveToZone(Zone.EXILED, source, game, false); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java index 2c2e57bb5d1..656a8d387d5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java @@ -47,7 +47,7 @@ public class ExileCardYouChooseTargetOpponentEffect extends OneShotEffect { if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) { Card card = opponent.getHand().get(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true); + controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.HAND, true); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java index 8d07b7ec05f..df002ff631f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java @@ -35,7 +35,7 @@ public class ExileGraveyardAllTargetPlayerEffect extends OneShotEffect { if (targetPlayer != null) { List graveyard = new ArrayList<>(targetPlayer.getGraveyard()); for (UUID cardId : graveyard) { - game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); + game.getCard(cardId).moveToZone(Zone.EXILED, source, game, false); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileReturnBattlefieldOwnerNextEndStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileReturnBattlefieldOwnerNextEndStepSourceEffect.java index 09d9e84916b..3c12c7fc737 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileReturnBattlefieldOwnerNextEndStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileReturnBattlefieldOwnerNextEndStepSourceEffect.java @@ -56,7 +56,7 @@ public class ExileReturnBattlefieldOwnerNextEndStepSourceEffect extends OneShotE Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { int zcc = game.getState().getZoneChangeCounter(permanent.getId()); - boolean exiled = controller.moveCardToExileWithInfo(permanent, source.getSourceId(), permanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true); + boolean exiled = controller.moveCardToExileWithInfo(permanent, source.getSourceId(), permanent.getIdName(), source, game, Zone.BATTLEFIELD, true); if (exiled || (returnAlways && (zcc == game.getState().getZoneChangeCounter(permanent.getId()) - 1))) { //create delayed triggered ability and return it from every public zone it was next moved to AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility( diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java index eadcce35a41..ff0ec0a2931 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java @@ -43,7 +43,7 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect { message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetAndSearchGraveyardHandLibraryEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetAndSearchGraveyardHandLibraryEffect.java index edff90134bf..fa2717c4776 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetAndSearchGraveyardHandLibraryEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetAndSearchGraveyardHandLibraryEffect.java @@ -40,7 +40,7 @@ public class ExileTargetAndSearchGraveyardHandLibraryEffect extends SearchTarget Permanent permanentToExile = game.getPermanent(exileTarget.getFirstTarget()); if (permanentToExile != null) { targetPlayerId = permanentToExile.getControllerId(); - result = permanentToExile.moveToExile(null, "", source.getSourceId(), game); + result = permanentToExile.moveToExile(null, "", source, game); this.applySearchAndExile(game, source, permanentToExile.getName(), targetPlayerId); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LivingDeathEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LivingDeathEffect.java index 21ba872a1c7..beedd03ac87 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LivingDeathEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LivingDeathEffect.java @@ -51,7 +51,7 @@ public class LivingDeathEffect extends OneShotEffect { // Sacrifice all creatures for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } game.getState().processAction(game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryMayPutToBottomEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryMayPutToBottomEffect.java index 4718bfdcb81..64829f47ca0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryMayPutToBottomEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryMayPutToBottomEffect.java @@ -46,7 +46,7 @@ public class LookLibraryMayPutToBottomEffect extends OneShotEffect { } controller.lookAtCards(sourceObject.getName(), new CardsImpl(card), game); boolean toBottom = controller.chooseUse(outcome, "Put card on the bottom of your library?", source, game); - return controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, !toBottom, false); + return controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, !toBottom, false); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryTopCardTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryTopCardTargetPlayerEffect.java index 1fd35fb54bc..e84bedee137 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryTopCardTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryTopCardTargetPlayerEffect.java @@ -75,7 +75,7 @@ public class LookLibraryTopCardTargetPlayerEffect extends OneShotEffect { if (putToGraveyard) { for (Card card : cards.getCards(game)) { if (player.chooseUse(outcome, "Do you wish to put card into the player's graveyard?", source, game)) { - player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY); + player.moveCardToGraveyardWithInfo(card, source, game, Zone.LIBRARY); } else { game.informPlayers(player.getLogName() + " puts the card back on top of the library."); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeEffect.java index 90948a5dac4..0b98930cae6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeEffect.java @@ -31,7 +31,7 @@ public class LoseHalfLifeEffect extends OneShotEffect { if (player != null) { int amount = (player.getLife() + 1) / 2; if (amount > 0) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeTargetEffect.java index 230c26baf89..010f30b2576 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseHalfLifeTargetEffect.java @@ -33,7 +33,7 @@ public class LoseHalfLifeTargetEffect extends OneShotEffect { if (player != null) { Integer amount = (int) Math.ceil(player.getLife() / 2f); if (amount > 0) { - player.loseLife(amount, game, false); + player.loseLife(amount, game, source, false); return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java index c320d8f13eb..f96a7c188aa 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java @@ -45,7 +45,7 @@ public class LoseLifeAllPlayersEffect extends OneShotEffect { for (UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.loseLife(amount.calculate(game, source, this), game, false); + player.loseLife(amount.calculate(game, source, this), game, source, false); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java index 450eaec382a..4ffcbdbdc81 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java @@ -50,7 +50,7 @@ public class LoseLifeControllerAttachedEffect extends OneShotEffect { if (creature != null) { Player player = game.getPlayer(creature.getControllerId()); if (player != null) { - player.loseLife(amount.calculate(game, source, this), game, false); + player.loseLife(amount.calculate(game, source, this), game, source, false); return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java index ca058b07622..8e3451e4fec 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java @@ -54,7 +54,7 @@ public class LoseLifeDefendingPlayerEffect extends OneShotEffect { defender = game.getPlayer(getTargetPointer().getFirst(game, source)); } if (defender != null) { - defender.loseLife(amount.calculate(game, source, this), game, false); + defender.loseLife(amount.calculate(game, source, this), game, source, false); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java index 30ef4bb0a36..d6e439a7ff6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java @@ -39,7 +39,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(opponentId); if (player != null) { - player.loseLife(amount.calculate(game, source, this), game, false); + player.loseLife(amount.calculate(game, source, this), game, source, false); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifePermanentControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifePermanentControllerEffect.java index 00274e26a9b..b6e1f5be6f8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifePermanentControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifePermanentControllerEffect.java @@ -48,7 +48,7 @@ public class LoseLifePermanentControllerEffect extends OneShotEffect { player = game.getPlayer(permanent.getControllerId()); } if (player != null) { - player.loseLife(amount.calculate(game, source, this), game, false); + player.loseLife(amount.calculate(game, source, this), game, source, false); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java index 0707a453340..98d89a10adf 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java @@ -42,7 +42,7 @@ public class LoseLifeSourceControllerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.loseLife(amount.calculate(game, source, this), game, false); + player.loseLife(amount.calculate(game, source, this), game, source, false); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetControllerEffect.java index 6c009e9ed39..60258d8c0ab 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetControllerEffect.java @@ -65,7 +65,7 @@ public class LoseLifeTargetControllerEffect extends OneShotEffect { } if ( controller != null ) { - controller.loseLife(amount, game, false); + controller.loseLife(amount, game, source, false); return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java index 93c03a71466..718635249bd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -43,7 +43,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { for (UUID playerId : targetPointer.getTargets(game, source)) { Player player = game.getPlayer(playerId); if (player != null - && player.loseLife(amount.calculate(game, source, this), game, false) > 0) { + && player.loseLife(amount.calculate(game, source, this), game, source, false) > 0) { applied = true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/MayTapOrUntapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/MayTapOrUntapTargetEffect.java index 59ef2da86ed..d5407da7b0f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/MayTapOrUntapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/MayTapOrUntapTargetEffect.java @@ -31,7 +31,7 @@ public class MayTapOrUntapTargetEffect extends OneShotEffect { target.untap(game); } } else if (player.chooseUse(Outcome.Tap, "Tap that permanent?", source, game)) { - target.tap(game); + target.tap(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/MistmeadowWitchEffect.java b/Mage/src/main/java/mage/abilities/effects/common/MistmeadowWitchEffect.java index 99825a1e5b9..a3a5c682c88 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/MistmeadowWitchEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/MistmeadowWitchEffect.java @@ -26,7 +26,7 @@ public class MistmeadowWitchEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Mistmeadow Witch Exile", source.getSourceId(), game)) { + if (permanent.moveToExile(source.getSourceId(), "Mistmeadow Witch Exile", source, game)) { //create delayed triggered ability AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD)); game.addDelayedTriggeredAbility(delayedAbility, source); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java index daaf001a37f..a9b0879594b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java @@ -45,7 +45,7 @@ public class PermanentsEnterBattlefieldTappedEffect extends ReplacementEffectImp Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { - target.tap(game); + target.tap(source, game); } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java index 4b1518252e4..9da3f5b1451 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java @@ -66,7 +66,7 @@ public class PopulateEffect extends OneShotEffect { } Target target = new TargetPermanent(filter); target.setNotTarget(true); - if (!target.canChoose(source.getControllerId(), game)) { + if (!target.canChoose(source.getSourceId(), source.getControllerId(), game)) { return true; } player.choose(Outcome.Copy, target, source.getSourceId(), game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java index 7aa79be735a..85e8cbaf888 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java @@ -10,6 +10,7 @@ import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.events.PreventDamageEvent; +import mage.game.events.PreventedDamageEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; @@ -79,18 +80,17 @@ public class PreventDamageToTargetMultiAmountEffect extends PreventionEffectImpl @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { int targetAmount = targetAmountMap.get(event.getTargetId()); - GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { if (event.getAmount() >= targetAmount) { - int damage = targetAmount; event.setAmount(event.getAmount() - targetAmount); targetAmountMap.remove(event.getTargetId()); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, event.getTargetId(), source.getSourceId(), source.getControllerId(), damage)); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), targetAmount)); } else { int damage = event.getAmount(); event.setAmount(0); - targetAmountMap.put(event.getTargetId(), targetAmount -= damage); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, event.getTargetId(), source.getSourceId(), source.getControllerId(), damage)); + targetAmountMap.put(event.getTargetId(), targetAmount - damage); + game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage)); } if (targetAmountMap.isEmpty()) { this.used = true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibrarySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibrarySourceEffect.java index 28e5b10ba54..f1ec5d8c036 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibrarySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibrarySourceEffect.java @@ -49,12 +49,12 @@ public class PutOnLibrarySourceEffect extends OneShotEffect { return false; } if (sourceObject instanceof Permanent) { - ((Permanent) sourceObject).moveToZone(Zone.LIBRARY, source.getSourceId(), game, onTop); + ((Permanent) sourceObject).moveToZone(Zone.LIBRARY, source, game, onTop); return true; } else if (sourceObject instanceof Card && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { for (Player player : game.getPlayers().values()) { if (player.getGraveyard().contains(sourceObject.getId())) { - ((Card) sourceObject).moveToZone(Zone.LIBRARY, source.getSourceId(), game, onTop); + ((Card) sourceObject).moveToZone(Zone.LIBRARY, source, game, onTop); return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java index 08ed0e6540a..a34a8a87d8c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java @@ -37,7 +37,7 @@ public class RemoveAllCountersSourceEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { int count = sourcePermanent.getCounters(game).getCount(counterType); - sourcePermanent.removeCounters(counterType.getName(), count, game); + sourcePermanent.removeCounters(counterType.getName(), count, source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandAttachedEffect.java index 0e39a35540b..8b3d1573eae 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandAttachedEffect.java @@ -35,7 +35,7 @@ public class ReturnToHandAttachedEffect extends OneShotEffect { Card card = game.getCard(((Permanent) object).getId()); if (card != null && getValue("zcc").equals(game.getState().getZoneChangeCounter(card.getId()))) { // Necrogenesis, etc. - if (card.moveToZone(Zone.HAND, source.getSourceId(), game, false)) { + if (card.moveToZone(Zone.HAND, source, game, false)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibraryPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibraryPermanentEffect.java index 0c3ffa5bd39..7a36135898e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibraryPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibraryPermanentEffect.java @@ -34,7 +34,7 @@ public class ReturnToLibraryPermanentEffect extends OneShotEffect { if (controller != null) { Card card = game.getPermanent(source.getSourceId()); if (card != null) { - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.STACK, toTop, true); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.STACK, toTop, true); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java index 8550b574c0b..ee660ee855c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java @@ -37,7 +37,7 @@ public class ReturnToLibrarySpellEffect extends OneShotEffect { if (spell != null) { Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); if (spellCard != null) { - controller.moveCardToLibraryWithInfo(spellCard, source.getSourceId(), game, Zone.STACK, toTop, true); + controller.moveCardToLibraryWithInfo(spellCard, source, game, Zone.STACK, toTop, true); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java index d14a23b5154..53a770ec7e5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java @@ -59,9 +59,9 @@ public class RevealAndShuffleIntoLibrarySourceEffect extends OneShotEffect { controller.revealCards(sourceObject.getName(), cards, game); } if (permanent != null) { - controller.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, fromZone, true, true); + controller.moveCardToLibraryWithInfo(permanent, source, game, fromZone, true, true); } else { - controller.moveCardToLibraryWithInfo((Card)sourceObject, source.getSourceId(), game, fromZone, true, true); + controller.moveCardToLibraryWithInfo((Card) sourceObject, source, game, fromZone, true, true); } if (!cards.isEmpty()) { controller.shuffleLibrary(source, game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/RollDiceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RollDiceEffect.java index a57afb35408..62c1fe6a6dd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RollDiceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RollDiceEffect.java @@ -47,7 +47,7 @@ public class RollDiceEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getObject(source.getSourceId()); if (controller != null && mageObject != null) { - controller.rollDice(game, numSides); + controller.rollDice(source, game, numSides); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java index dbfd982bb93..45a4d9df39d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java @@ -61,7 +61,7 @@ public class RollPlanarDieEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getObject(source.getSourceId()); if (controller != null && mageObject != null) { - PlanarDieRoll planarRoll = controller.rollPlanarDie(game); + PlanarDieRoll planarRoll = controller.rollPlanarDie(source, game); if (planarRoll == PlanarDieRoll.CHAOS_ROLL && chaosEffects != null && chaosTargets != null) { for (int i = 0; i < chaosTargets.size(); i++) { Target target = chaosTargets.get(i); @@ -78,7 +78,7 @@ public class RollPlanarDieEffect extends OneShotEffect { } boolean done = false; while (controller.canRespond() && effect != null && !done) { - if (target != null && !target.isChosen() && target.canChoose(controller.getId(), game)) { + if (target != null && !target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game)) { controller.chooseTarget(Outcome.Benefit, target, source, game); source.addTarget(target); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java index 168115a5779..6077f6174b4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java @@ -64,7 +64,7 @@ public class SacrificeAllEffect extends OneShotEffect { if (player != null) { int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game)); TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { while (!target.isChosen() && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } @@ -75,7 +75,7 @@ public class SacrificeAllEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java index 33d37346961..01ae1dd1702 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java @@ -58,14 +58,14 @@ public class SacrificeEffect extends OneShotEffect { Target target = new TargetPermanent(amount, amount, newFilter, true); if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) { while (!target.isChosen() - && target.canChoose(player.getId(), game) + && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) { player.chooseTarget(Outcome.Sacrifice, target, source, game); } for (int idx = 0; idx < target.getTargets().size(); idx++) { Permanent permanent = game.getPermanent(target.getTargets().get(idx)); if (permanent != null - && permanent.sacrifice(source.getSourceId(), game)) { + && permanent.sacrifice(source, game)) { applied = true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEquippedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEquippedEffect.java index a020e71d751..369578adb48 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEquippedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEquippedEffect.java @@ -37,7 +37,7 @@ public class SacrificeEquippedEffect extends OneShotEffect { permanent = game.getPermanent(equipment.getAttachedTo()); } if (permanent != null) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java index 52b840747fd..f866c26fc76 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java @@ -62,7 +62,7 @@ public class SacrificeOpponentsEffect extends OneShotEffect { int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game)); if (numTargets > 0) { TargetPermanent target = new TargetPermanent(numTargets, numTargets, filter, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); perms.addAll(target.getTargets()); } @@ -72,7 +72,7 @@ public class SacrificeOpponentsEffect extends OneShotEffect { for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java index f3e764b4437..11998312f63 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java @@ -122,14 +122,14 @@ public class SacrificeOpponentsUnlessPayEffect extends OneShotEffect { costToPay.clearPaid(); if (!(player.chooseUse(Outcome.Benefit, message, source, game) - && costToPay.pay(source, game, source.getSourceId(), player.getId(), false, null))) { + && costToPay.pay(source, game, source, player.getId(), false, null))) { game.informPlayers(player.getLogName() + " chooses not to pay " + costValueMessage + " to prevent the sacrifice effect"); int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game)); if (numTargets > 0) { TargetPermanent target = new TargetPermanent(numTargets, numTargets, filter, true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); permsToSacrifice.addAll(target.getTargets()); } @@ -144,7 +144,7 @@ public class SacrificeOpponentsUnlessPayEffect extends OneShotEffect { Permanent permanent = game.getPermanent(permID); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java index 806acf2a7ed..857b4808484 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java @@ -42,7 +42,7 @@ public class SacrificeSourceEffect extends OneShotEffect { Permanent permanent = (Permanent) sourceObject; // you can only sacrifice a permanent you control if (source.isControlledBy(permanent.getControllerId())) { - return permanent.sacrifice(source.getSourceId(), game); + return permanent.sacrifice(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessConditionEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessConditionEffect.java index 2a66dbba360..8badcb459b7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessConditionEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessConditionEffect.java @@ -36,7 +36,7 @@ public class SacrificeSourceUnlessConditionEffect extends OneShotEffect { if (condition.apply(game, source)) { return true; } - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java index 4560aeeb6be..fe679cd2c8d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java @@ -65,9 +65,9 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect { } costToPay.clearPaid(); - if (costToPay.canPay(source, source.getSourceId(), source.getControllerId(), game) + if (costToPay.canPay(source, source, source.getControllerId(), game) && player.chooseUse(Outcome.Benefit, message, source, game) - && costToPay.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + && costToPay.pay(source, game, source, source.getControllerId(), false, null)) { game.informPlayers(player.getLogName() + " chooses to pay " + costValueMessage + " to prevent sacrifice effect"); return true; } @@ -75,7 +75,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect { game.informPlayers(player.getLogName() + " chooses not to pay " + costValueMessage + " to prevent sacrifice effect"); if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { - sourcePermanent.sacrifice(source.getSourceId(), game); + sourcePermanent.sacrifice(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeTargetEffect.java index c5da5402971..ebd48484efc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeTargetEffect.java @@ -53,7 +53,7 @@ public class SacrificeTargetEffect extends OneShotEffect { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null && (playerIdThatHasToSacrifice == null || playerIdThatHasToSacrifice.equals(permanent.getControllerId()))) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); affectedTargets++; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandIntoLibraryDrawThatManySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandIntoLibraryDrawThatManySourceEffect.java index edc6e83545b..fdd82b636de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandIntoLibraryDrawThatManySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandIntoLibraryDrawThatManySourceEffect.java @@ -37,7 +37,7 @@ public class ShuffleHandIntoLibraryDrawThatManySourceEffect extends OneShotEffec controller.moveCards(controller.getHand(), Zone.LIBRARY, source, game); controller.shuffleLibrary(source, game); game.getState().processAction(game); // then - controller.drawCards(cardsHand, source.getSourceId(), game); + controller.drawCards(cardsHand, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibrarySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibrarySourceEffect.java index e5eba0c9742..8c6f5cd506e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibrarySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibrarySourceEffect.java @@ -37,14 +37,14 @@ public class ShuffleIntoLibrarySourceEffect extends OneShotEffect { if (mageObject instanceof Permanent) { owner = game.getPlayer(((Permanent) mageObject).getOwnerId()); if (owner != null) { - owner.moveCardToLibraryWithInfo((Permanent)mageObject, source.getSourceId(), game, fromZone, true, true); + owner.moveCardToLibraryWithInfo((Permanent) mageObject, source, game, fromZone, true, true); owner.shuffleLibrary(source, game); return true; } } else if (mageObject instanceof Card) { owner = game.getPlayer(((Card) mageObject).getOwnerId()); if (owner != null) { - owner.moveCardToLibraryWithInfo((Card)mageObject, source.getSourceId(), game, fromZone, true, true); + owner.moveCardToLibraryWithInfo((Card)mageObject, source, game, fromZone, true, true); owner.shuffleLibrary(source, game); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapAllEffect.java index bee5b365ba8..f2a38fcf6de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapAllEffect.java @@ -38,7 +38,7 @@ public class TapAllEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.tap(game); + permanent.tap(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapAllTargetPlayerControlsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapAllTargetPlayerControlsEffect.java index 421b2c2bc91..f01279adb75 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapAllTargetPlayerControlsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapAllTargetPlayerControlsEffect.java @@ -34,7 +34,7 @@ public class TapAllTargetPlayerControlsEffect extends OneShotEffect { if (player != null) { List permanents = game.getBattlefield().getAllActivePermanents(filter, player.getId(), game); for (Permanent p : permanents) { - p.tap(game); + p.tap(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapEnchantedEffect.java index 462f09c412f..124fa6c7a01 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapEnchantedEffect.java @@ -27,7 +27,7 @@ public class TapEnchantedEffect extends OneShotEffect { if (permanent != null) { Permanent attach = game.getPermanent(permanent.getAttachedTo()); if (attach != null) { - attach.tap(game); + attach.tap(source, game); return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapSourceEffect.java index 8239cc578c3..409a6859a04 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapSourceEffect.java @@ -44,7 +44,7 @@ public class TapSourceEffect extends OneShotEffect { if (withoutTrigger) { permanent.setTapped(true); } else { - permanent.tap(game); + permanent.tap(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java index 48303308660..6549172acec 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java @@ -37,14 +37,14 @@ public class TapSourceUnlessPaysEffect extends OneShotEffect { permanent = game.getPermanentEntering(source.getSourceId()); } if (player != null && permanent != null) { - if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) + if (cost.canPay(source, source, source.getControllerId(), game) && player.chooseUse(Outcome.Benefit, cost.getText() + "? (otherwise " + permanent.getName() + " becomes tapped)", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { return true; } } - permanent.tap(game); + permanent.tap(source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java index e3aa5c5c56b..c34f0aa9f4f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java @@ -42,7 +42,7 @@ public class TapTargetEffect extends OneShotEffect { for (UUID target : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - permanent.tap(game); + permanent.tap(source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java index edcf579fa42..1a7bf8c0ef7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java @@ -33,7 +33,7 @@ public class TurnFaceUpTargetEffect extends OneShotEffect { if (target != null) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - return permanent.turnFaceUp(game, source.getControllerId()); + return permanent.turnFaceUp(source, game, source.getControllerId()); } } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/UnlessPaysDelayedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UnlessPaysDelayedEffect.java index 61fc84a6f76..9d7e6037440 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/UnlessPaysDelayedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/UnlessPaysDelayedEffect.java @@ -114,9 +114,9 @@ class UnlessPaysDelayedEffectTriggeredAbility extends DelayedTriggeredAbility { public boolean checkEventType(GameEvent event, Game game) { switch (step) { case UPKEEP: - return event.getType() == EventType.UPKEEP_STEP_PRE; + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; case DRAW: - return event.getType() == EventType.DRAW_STEP_PRE; + return event.getType() == GameEvent.EventType.DRAW_STEP_PRE; default: return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java b/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java index 001dd53aafa..92a59226bc2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java @@ -103,7 +103,7 @@ public class WishEffect extends OneShotEffect { card = game.getCard(target.getFirstTarget()); } if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + card.moveToZone(Zone.HAND, source, game, false); if (reveal) { Cards revealCard = new CardsImpl(); revealCard.add(card); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java index e479c78d948..19923649c04 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java @@ -33,10 +33,10 @@ public class CantAttackBlockUnlessPaysAttachedEffect extends PayCostToAttackBloc public boolean applies(GameEvent event, Ability source, Game game) { Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null && enchantment.getAttachedTo() != null) { - if (event.getType() == EventType.DECLARE_ATTACKER) { + if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER) { return event.getSourceId().equals(enchantment.getAttachedTo()); } - if (event.getType() == EventType.DECLARE_BLOCKER) { + if (event.getType() == GameEvent.EventType.DECLARE_BLOCKER) { return event.getSourceId().equals(enchantment.getAttachedTo()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysSourceEffect.java index 60051d3a231..dde92356166 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysSourceEffect.java @@ -32,10 +32,10 @@ public class CantAttackBlockUnlessPaysSourceEffect extends PayCostToAttackBlockE @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (!(restrictType == RestrictType.BLOCK) && event.getType() == EventType.DECLARE_ATTACKER) { + if (!(restrictType == RestrictType.BLOCK) && event.getType() == GameEvent.EventType.DECLARE_ATTACKER) { return event.getSourceId().equals(source.getSourceId()); } - if (!(restrictType == RestrictType.ATTACK) && event.getType() == EventType.DECLARE_BLOCKER) { + if (!(restrictType == RestrictType.ATTACK) && event.getType() == GameEvent.EventType.DECLARE_BLOCKER) { return event.getSourceId().equals(source.getSourceId()); } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java index 7fbdc7bf2ab..38fdaa0c252 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java @@ -33,7 +33,7 @@ public class CantAttackUnlessPaysAttachedEffect extends PayCostToAttackBlockEffe public boolean applies(GameEvent event, Ability source, Game game) { Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null && enchantment.getAttachedTo() != null) { - if (event.getType() == EventType.DECLARE_ATTACKER) { + if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER) { return event.getSourceId().equals(enchantment.getAttachedTo()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java index 8b01f0fbc1f..4eb868f0de3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java @@ -52,7 +52,7 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple // check for Morph Card card = game.getCard(perm.getId()); if (card != null) { - for (Ability ability : card.getAbilities()) { + for (Ability ability : card.getAbilities(game)) { if (ability instanceof MorphAbility) { this.turnFaceUpAbilityMap.put(card.getId(), new TurnFaceUpAbility(((MorphAbility) ability).getMorphCosts())); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/ControlEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/ControlEnchantedEffect.java index d11d5c39470..d00c2d318e2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/ControlEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/ControlEnchantedEffect.java @@ -45,7 +45,7 @@ public class ControlEnchantedEffect extends ContinuousEffectImpl { switch (layer) { case ControlChangingEffects_2: if (sublayer == SubLayer.NA) { - permanent.changeControllerId(enchantment.getControllerId(), game); + permanent.changeControllerId(enchantment.getControllerId(), game, source); permanent.getAbilities().forEach((ability) -> { ability.setControllerId(enchantment.getControllerId()); }); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java index ecdac7e6679..2f780e7dd07 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java @@ -122,7 +122,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl { toDelete.add(entry.getKey()); continue; } - permanent.changeControllerId(lockedControllers.get(permanent.getId()), game); + permanent.changeControllerId(lockedControllers.get(permanent.getId()), game, source); permanent.getAbilities().setControllerId(lockedControllers.get(permanent.getId())); if (destroyAttachedAuras) { FilterPermanent filter = new FilterPermanent(); @@ -130,7 +130,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl { for (UUID attachmentId : new HashSet<>(permanent.getAttachments())) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && filter.match(attachment, game)) { - attachment.destroy(source.getSourceId(), game, false); + attachment.destroy(source, game, false); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java index aee19ee2ba8..da5aef9bda4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java @@ -83,19 +83,13 @@ public class GainControlTargetEffect extends ContinuousEffectImpl { if (permanent != null) { oneTargetStillExists = true; if (!permanent.isControlledBy(controllingPlayerId)) { - GameEvent loseControlEvent = GameEvent.getEvent(GameEvent.EventType.LOSE_CONTROL, permanentId, source.getId(), permanent.getControllerId()); - if (game.replaceEvent(loseControlEvent)) { - return false; - } boolean controlChanged = false; if (controllingPlayerId != null) { - if (permanent.changeControllerId(controllingPlayerId, game)) { - permanent.getAbilities().setControllerId(controllingPlayerId); + if (permanent.changeControllerId(controllingPlayerId, game, source)) { controlChanged = true; } } else { - if (permanent.changeControllerId(source.getControllerId(), game)) { - permanent.getAbilities().setControllerId(source.getControllerId()); + if (permanent.changeControllerId(source.getControllerId(), game, source)) { controlChanged = true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java index b08cd93997e..9c8ce0ecabb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java @@ -59,7 +59,7 @@ public class AddCountersControllerEffect extends OneShotEffect { } Player player = game.getPlayer(uuid); if (player != null) { - player.addCounters(counter, game); + player.addCounters(counter, source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index b3166e83b5f..e4d69b389d7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -60,44 +60,39 @@ public class AddCountersTargetEffect extends OneShotEffect { if (controller != null && sourceObject != null && counter != null) { int affectedTargets = 0; for (UUID uuid : targetPointer.getTargets(game, source)) { + Counter newCounter = counter.copy(); + int calculated = amount.calculate(game, source, this); // 0 -- you must use default couner + if (calculated < 0) { + continue; + } else if (calculated == 0) { + // use original counter + } else { + // increase to calculated value + newCounter.remove(newCounter.getCount()); + newCounter.add(calculated); + } + Permanent permanent = game.getPermanent(uuid); Player player = game.getPlayer(uuid); Card card = game.getCard(targetPointer.getFirst(game, source)); if (permanent != null) { - Counter newCounter = counter.copy(); - int calculated = amount.calculate(game, source, this); - if (calculated > 0 && newCounter.getCount() > 0) { - newCounter.remove(newCounter.getCount()); - } - newCounter.add(calculated); - int before = permanent.getCounters(game).getCount(counter.getName()); permanent.addCounters(newCounter, source, game); - int numberAdded = permanent.getCounters(game).getCount(counter.getName()) - before; affectedTargets++; - if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " - + numberAdded + ' ' + counter.getName().toLowerCase(Locale.ENGLISH) + " counter on " + permanent.getLogName()); - } + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + + newCounter.getCount() + ' ' + newCounter.getName().toLowerCase(Locale.ENGLISH) + " counters on " + permanent.getLogName()); } else if (player != null) { - Counter newCounter = counter.copy(); - newCounter.add(amount.calculate(game, source, this)); - player.addCounters(newCounter, game); + player.addCounters(newCounter, source, game); affectedTargets++; - if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " - + counter.getCount() + ' ' + counter.getName().toLowerCase(Locale.ENGLISH) + " counter on " + player.getLogName()); - } + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + + newCounter.getCount() + ' ' + newCounter.getName().toLowerCase(Locale.ENGLISH) + " counters on " + player.getLogName()); } else if (card != null) { - card.addCounters(counter, source, game); - if (!game.isSimulation()) { - game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(' ').append(counter.getName()) - .append(" counter to ").append(card.getName()) - .append(" (").append(card.getCounters(game).getCount(counter.getName())).append(')').toString()); - } - return true; + card.addCounters(newCounter, source, game); + affectedTargets++; + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + + newCounter.getCount() + ' ' + newCounter.getName().toLowerCase(Locale.ENGLISH) + " counters on " + card.getLogName()); } } - return true; + return affectedTargets > 0; } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddPoisonCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddPoisonCounterTargetEffect.java index 69d595db618..75e4043689e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddPoisonCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddPoisonCounterTargetEffect.java @@ -40,7 +40,7 @@ public class AddPoisonCounterTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.addCounters(CounterType.POISON.createInstance(amount), game); + player.addCounters(CounterType.POISON.createInstance(amount), source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java index 469b1126642..2d02ba27cda 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java @@ -66,7 +66,7 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect { final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); final Counter modifiedCounter = new Counter(counterName, countersToRemove); - card.removeCounters(modifiedCounter, game); + card.removeCounters(modifiedCounter, source, game); } else { card.addCounters(counter, source, game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java index 3be17d3df75..71dcc000c13 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -114,7 +114,7 @@ class RemoveCountersAtEndOfTurn extends OneShotEffect { for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - permanent.removeCounters(counterType.getName(), multiTarget.getTargetAmount(target), game); + permanent.removeCounters(counterType.getName(), multiTarget.getTargetAmount(target), source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java index 170a9448b70..581c5c75e21 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java @@ -37,7 +37,7 @@ public class GetEnergyCountersControllerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - return controller.addCounters(CounterType.ENERGY.createInstance(value.calculate(game, source, this)), game); + return controller.addCounters(CounterType.ENERGY.createInstance(value.calculate(game, source, this)), source, game); } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java index 1c6f4102668..3e5e3426181 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java @@ -41,7 +41,7 @@ public class MoveCountersTargetsEffect extends OneShotEffect { Permanent removeTargetCreature = game.getPermanent(targetPointer.getTargets(game, source).get(0)); Permanent addTargetCreature = game.getPermanent(targetPointer.getTargets(game, source).get(1)); if (removeTargetCreature != null && addTargetCreature != null && removeTargetCreature.getCounters(game).getCount(counterType) >= amount) { - removeTargetCreature.removeCounters(counterType.createInstance(amount), game); + removeTargetCreature.removeCounters(counterType.createInstance(amount), source, game); addTargetCreature.addCounters(counterType.createInstance(amount), source, game); if (!game.isSimulation()) { game.informPlayers("Moved " + amount + ' ' + counterType.getName() + " counter" + (amount > 1 ? "s" : "") + " from " + removeTargetCreature.getLogName() + " to " + addTargetCreature.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index e82e3c94def..b54a38486d7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -74,7 +74,7 @@ public class ProliferateEffect extends OneShotEffect { if (!player.getCounters().isEmpty()) { for (Counter counter : player.getCounters().values()) { newCounter = new Counter(counter.getName()); - player.addCounters(newCounter, game); + player.addCounters(newCounter, source, game); } if (newCounter != null) { game.informPlayers(player.getName() diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersSourceEffect.java index f0533bf8ca9..4624f665633 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersSourceEffect.java @@ -32,7 +32,7 @@ public class RemoveAllCountersSourceEffect extends OneShotEffect { Permanent permanent = source.getSourcePermanentIfItStillExists(game); if (permanent != null) { int count = permanent.getCounters(game).getCount(counterType); - permanent.removeCounters(counterType.getName(), count, game); + permanent.removeCounters(counterType.getName(), count, source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersTargetEffect.java index bdc0847a925..f6170abe556 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveAllCountersTargetEffect.java @@ -32,7 +32,7 @@ public class RemoveAllCountersTargetEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if(permanent != null) { int count = permanent.getCounters(game).getCount(counterType); - permanent.removeCounters(counterType.getName(), count, game); + permanent.removeCounters(counterType.getName(), count, source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java index 6345058e2f5..402af0ab2a7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java @@ -33,7 +33,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { if (permanent != null) { int toRemove = Math.min(counter.getCount(), permanent.getCounters(game).getCount(counter.getName())); if (toRemove > 0) { - permanent.removeCounters(counter.getName(), toRemove, game); + permanent.removeCounters(counter.getName(), toRemove, source, game); if (!game.isSimulation()) { game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + permanent.getLogName()); } @@ -45,7 +45,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { if (card != null) { int toRemove = Math.min(counter.getCount(), card.getCounters(game).getCount(counter.getName())); if (toRemove > 0) { - card.removeCounters(counter.getName(), toRemove, game); + card.removeCounters(counter.getName(), toRemove, source, game); if (!game.isSimulation()) { game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + card.getLogName() diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java index 03fc51e41ca..9f23c8e522a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java @@ -45,7 +45,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { if (p != null) { Counter toRemove = (counter == null ? selectCounterType(game, source, p) : counter); if (toRemove != null && p.getCounters(game).getCount(toRemove.getName()) >= toRemove.getCount()) { - p.removeCounters(toRemove.getName(), toRemove.getCount(), game); + p.removeCounters(toRemove.getName(), toRemove.getCount(), source, game); if (!game.isSimulation()) { game.informPlayers("Removed " + toRemove.getCount() + ' ' + toRemove.getName() + " counter from " + p.getName()); @@ -54,7 +54,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { } else { Card c = game.getCard(targetPointer.getFirst(game, source)); if (c != null && counter != null && c.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { - c.removeCounters(counter.getName(), counter.getCount(), game); + c.removeCounters(counter.getName(), counter.getCount(), source, game); if (!game.isSimulation()) { game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(' ').append(counter.getName()) .append(" counter from ").append(c.getName()) diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCountersAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCountersAttachedEffect.java index 59451c359b9..2d6c154b165 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCountersAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCountersAttachedEffect.java @@ -58,7 +58,7 @@ public class RemoveCountersAttachedEffect extends OneShotEffect { if (attachedTo != null && counter != null) { Counter newCounter = counter.copy(); newCounter.add(amount.calculate(game, source, this)); - attachedTo.removeCounters(newCounter, game); + attachedTo.removeCounters(newCounter, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java index 4ba0596c82a..6cb32929139 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java @@ -114,7 +114,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { TargetCard chosenCards = new TargetCard(numberToReveal, numberToReveal, Zone.HAND, new FilterCard("card in " + player.getName() + "'s hand")); chosenCards.setNotTarget(true); - if (chosenCards.canChoose(player.getId(), game) + if (chosenCards.canChoose(source.getSourceId(), player.getId(), game) && player.chooseTarget(Outcome.Discard, player.getHand(), chosenCards, source, game)) { if (!chosenCards.getTargets().isEmpty()) { List targets = chosenCards.getTargets(); @@ -144,7 +144,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { if (!controller.choose(Outcome.Benefit, revealedCards, target, game)) { return result; } - result=!player.discard(new CardsImpl(target.getTargets()),source,game).isEmpty(); + result=!player.discard(new CardsImpl(target.getTargets()),false, source,game).isEmpty(); return result; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java index 88d1f95aded..ed032cb68cb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java @@ -50,7 +50,7 @@ public class DiscardControllerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - return player != null && !player.discard(amount.calculate(game, source, this), randomDiscard, source, game).isEmpty(); + return player != null && !player.discard(amount.calculate(game, source, this), randomDiscard, false, source, game).isEmpty(); } private void setText() { diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java index 13b86e89eea..b4960606304 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java @@ -84,7 +84,7 @@ public class DiscardEachPlayerEffect extends OneShotEffect { break; } if (randomDiscard) { - player.discard(toDiscard, true, source, game); + player.discard(toDiscard, true, false, source, game); continue; } int numberOfCardsToDiscard = Math.min(toDiscard, player.getHand().size()); @@ -108,7 +108,7 @@ public class DiscardEachPlayerEffect extends OneShotEffect { if (player == null) { continue; } - player.discard(cardsToDiscard.get(playerId), source, game); + player.discard(cardsToDiscard.get(playerId), false, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandAllEffect.java index 60cc0bd3422..41e42797f95 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandAllEffect.java @@ -34,7 +34,7 @@ public class DiscardHandAllEffect extends OneShotEffect { if (player == null) { continue; } - player.discard(player.getHand(), source, game); + player.discard(player.getHand(), false, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandControllerEffect.java index 538df682378..0561343e904 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandControllerEffect.java @@ -35,7 +35,7 @@ public class DiscardHandControllerEffect extends OneShotEffect { if (player == null) { return false; } - player.discard(player.getHand().size(),false,source,game); + player.discard(player.getHand().size(), false, false, source,game); return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandDrawSameNumberSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandDrawSameNumberSourceEffect.java index 8fb68238efd..d0d6b8753ef 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandDrawSameNumberSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandDrawSameNumberSourceEffect.java @@ -27,8 +27,8 @@ public class DiscardHandDrawSameNumberSourceEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { int amount = player.getHand().getCards(game).size(); - player.discard(amount, false, source, game); - player.drawCards(amount, source.getSourceId(), game); + player.discard(amount, false, false, source, game); + player.drawCards(amount, source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java index cb1b992fe5b..8de0b78cb0a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java @@ -44,7 +44,7 @@ public class DiscardHandTargetEffect extends OneShotEffect { for (UUID playerId: getTargetPointer().getTargets(game, source)) { Player player = game.getPlayer(playerId); if (player != null) { - player.discard(player.getHand().size(), false, source, game); + player.discard(player.getHand().size(), false, false, source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java index 66b1351f340..f8ff05abd19 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java @@ -63,7 +63,7 @@ public class DiscardTargetEffect extends OneShotEffect { for (UUID targetPlayerId : targetPointer.getTargets(game, source)) { Player player = game.getPlayer(targetPlayerId); if (player != null) { - player.discard(amount.calculate(game, source, this), randomDiscard, source, game); + player.discard(amount.calculate(game, source, this), randomDiscard, false, source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java b/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java index 0c974f40213..9ae75d11a1f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java +++ b/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java @@ -46,17 +46,13 @@ public class DealtDamageToCreatureBySourceDies extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent != null) { - return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); - } + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); return false; } @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/replacement/DiesReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/common/replacement/DiesReplacementEffect.java index 3f5051ae44e..8d776a5cb78 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/replacement/DiesReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/replacement/DiesReplacementEffect.java @@ -59,7 +59,7 @@ public class DiesReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java index 89e30deba4d..9d0f8e9da67 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java @@ -39,7 +39,7 @@ public class CantRegenerateTargetEffect extends ContinuousRuleModifyingEffectImp @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.REGENERATE; + return event.getType() == GameEvent.EventType.REGENERATE; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/turn/AddExtraTurnControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/turn/AddExtraTurnControllerEffect.java index de6e8df8250..c37e36b4665 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/turn/AddExtraTurnControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/turn/AddExtraTurnControllerEffect.java @@ -81,7 +81,7 @@ class LoseGameDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.END_TURN_STEP_PRE; + return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java index 43a81809f3c..1dab6cfffd4 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java @@ -52,7 +52,7 @@ public class AdaptEffect extends OneShotEffect { return false; } GameEvent event = new GameEvent( - GameEvent.EventType.ADAPT, source.getSourceId(), source.getSourceId(), + GameEvent.EventType.ADAPT, source.getSourceId(), source, source.getControllerId(), adaptNumber, false ); if (game.replaceEvent(event)) { diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/EchoEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/EchoEffect.java index 15978c837b3..88a11a7d031 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/EchoEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/EchoEffect.java @@ -50,22 +50,22 @@ public class EchoEffect extends OneShotEffect { Cost altCost = new ManaCostsImpl("{0}"); if (controller.chooseUse(Outcome.Benefit, "Pay {0} instead of the echo cost?", source, game)) { altCost.clearPaid(); - if (altCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ECHO_PAID, source.getSourceId(), source.getSourceId(), source.getControllerId())); + if (altCost.pay(source, game, source, source.getControllerId(), false, null)) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ECHO_PAID, source.getSourceId(), source, source.getControllerId())); return true; } } } if (controller.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ECHO_PAID, source.getSourceId(), source.getSourceId(), source.getControllerId())); + if (cost.pay(source, game, source, source.getControllerId(), false, null)) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ECHO_PAID, source.getSourceId(), source, source.getControllerId())); return true; } } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java index b6ebef96c59..f054dc1253a 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java @@ -98,8 +98,7 @@ public class ExploreSourceEffect extends OneShotEffect { if (permanentController == null) { return false; } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLORED, permanentId, - source.getSourceId(), permanent.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLORED, permanentId, source, permanent.getControllerId())); if (permanentController.getLibrary().hasCards()) { Card card = permanentController.getLibrary().getFromTop(game); Cards cards = new CardsImpl(); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java index de8cf909944..edc2354a213 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java @@ -70,13 +70,13 @@ public class FatesealEffect extends OneShotEffect { Card card = cards.get(target1.getFirstTarget(), game); if (card != null) { cards.remove(card); - controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false); + controller.moveCardToLibraryWithInfo(card, source, game, Zone.LIBRARY, false, false); } target1.clearChosen(); } // move cards to the top of the library controller.putCardsOnTopOfLibrary(cards, game, source, true); - game.fireEvent(new GameEvent(GameEvent.EventType.FATESEALED, opponent.getId(), source.getSourceId(), source.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.FATESEALED, opponent.getId(), source, source.getControllerId())); controller.setTopCardRevealed(revealed); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/InvestigateEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/InvestigateEffect.java index 5f0aaf40644..82d30662c21 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/InvestigateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/InvestigateEffect.java @@ -29,7 +29,7 @@ public class InvestigateEffect extends CreateTokenEffect { @Override public boolean apply(Game game, Ability source) { if (super.apply(game, source)) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source.getSourceId(), source.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source, source.getControllerId())); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java index 4c0c3db0845..9ffd20d471c 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java @@ -55,10 +55,10 @@ public class DoUnlessAnyPlayerPaysManaEffect extends ManaEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && player.canRespond() - && cost.canPay(source, source.getSourceId(), player.getId(), game) + && cost.canPay(source, source, player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } diff --git a/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java index 72b09d7d54d..54403eb2931 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java @@ -133,7 +133,7 @@ public abstract class ManaEffect extends OneShotEffect { */ public void checkToFirePossibleEvents(Mana mana, Game game, Ability source) { if (source.getAbilityType() == AbilityType.MANA && source.hasTapCost()) { - ManaEvent event = new ManaEvent(GameEvent.EventType.TAPPED_FOR_MANA, source.getSourceId(), source.getSourceId(), source.getControllerId(), mana); + ManaEvent event = new ManaEvent(GameEvent.EventType.TAPPED_FOR_MANA, source.getSourceId(), source, source.getControllerId(), mana); if (!game.replaceEvent(event)) { game.fireEvent(event); } diff --git a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java index e457dafa1c2..67a8b94bfd6 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java @@ -143,9 +143,9 @@ class AftermathExileAsResolvesFromGraveyard extends ReplacementEffectImpl { } @Override - public boolean applies(GameEvent evt, Ability source, Game game) { - ZoneChangeEvent event = (ZoneChangeEvent) evt; - if (event.getFromZone() == Zone.STACK && event.getToZone() != Zone.EXILED) { + public boolean applies(GameEvent event, Ability source, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.STACK && zEvent.getToZone() != Zone.EXILED) { // Moving something from stack to somewhere else // Get the source id, getting the whole split card's ID, because @@ -165,7 +165,7 @@ class AftermathExileAsResolvesFromGraveyard extends ReplacementEffectImpl { sourceId = sourceCard.getId(); } - if (event.getTargetId().equals(sourceId)) { + if (zEvent.getTargetId().equals(sourceId)) { // Moving this spell from stack to yard Spell spell = game.getStack().getSpell(source.getSourceId()); // And this spell was cast from the graveyard, so we need to exile it diff --git a/Mage/src/main/java/mage/abilities/keyword/AnnihilatorAbility.java b/Mage/src/main/java/mage/abilities/keyword/AnnihilatorAbility.java index 313088817b6..43d7cb060de 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AnnihilatorAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AnnihilatorAbility.java @@ -44,7 +44,7 @@ public class AnnihilatorAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override @@ -100,16 +100,16 @@ class AnnihilatorEffect extends OneShotEffect { int amount = Math.min(count, game.getBattlefield().countAll(new FilterControlledPermanent(), player.getId(), game)); if (amount > 0) { Target target = new TargetControlledPermanent(amount, amount, new FilterControlledPermanent(), true); - if (target.canChoose(player.getId(), game)) { + if (target.canChoose(source.getSourceId(), player.getId(), game)) { while (player.canRespond() - && target.canChoose(player.getId(), game) + && target.canChoose(source.getSourceId(), player.getId(), game) && !target.isChosen()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } target.getTargets().stream() .map(game::getPermanent) .filter(Objects::nonNull) - .forEach(permanent -> permanent.sacrifice(source.getSourceId(), game)); + .forEach(permanent -> permanent.sacrifice(source, game)); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/AssistAbility.java b/Mage/src/main/java/mage/abilities/keyword/AssistAbility.java index 584d42e012e..5eb23725287 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AssistAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AssistAbility.java @@ -177,7 +177,7 @@ class AssistEffect extends OneShotEffect { if (amountToPay > 0) { Cost cost = ManaUtil.createManaCost(amountToPay, false); - if (cost.pay(source, game, source.getSourceId(), targetPlayer.getId(), false)) { + if (cost.pay(source, game, source, targetPlayer.getId(), false)) { ManaPool manaPool = controller.getManaPool(); manaPool.addMana(Mana.ColorlessMana(amountToPay), game, source); manaPool.unlockManaType(ManaType.COLORLESS); // it's unlock mana for one use/click, but it can gives more diff --git a/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java b/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java index a931e8e783e..86bb3d81429 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java @@ -77,9 +77,9 @@ class AuraSwapEffect extends OneShotEffect { if (auraInHand != null) { game.getState().setValue("attachTo:" + auraInHand.getId(), enchantedPermanent); controller.moveCards(auraInHand, Zone.BATTLEFIELD, source, game); - enchantedPermanent.addAttachment(auraInHand.getId(), game); + enchantedPermanent.addAttachment(auraInHand.getId(), source, game); game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + enchantedPermanent.getLogName() + '.'); - enchantedPermanent.removeAttachment(auraSourcePermanent.getId(), game); + enchantedPermanent.removeAttachment(auraSourcePermanent.getId(), source, game); return controller.moveCards(auraSourcePermanent, Zone.HAND, source, game); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java index 28817daaf58..c13c08c62e2 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java @@ -201,7 +201,7 @@ class BuybackEffect extends ReplacementEffectImpl { Card card = game.getCard(source.getSourceId()); if (card != null && source instanceof BuybackAbility) { if (((BuybackAbility) source).isBuybackActivated(game)) { - return card.moveToZone(Zone.HAND, source.getSourceId(), game, true, event.getAppliedEffects()); + return card.moveToZone(Zone.HAND, source, game, true, event.getAppliedEffects()); } } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index 26ce3dc39b7..fbb1e5df7be 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -109,10 +109,7 @@ class CascadeEffect extends OneShotEffect { controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw - GameEvent event = GameEvent.getEvent( - GameEvent.EventType.CASCADE_LAND, source.getSourceId(), - source.getSourceId(), source.getControllerId(), 0 - ); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.CASCADE_LAND, source.getSourceId(), source, source.getControllerId(), 0); game.replaceEvent(event); if (event.getAmount() > 0) { TargetCardInExile target = new TargetCardInExile( diff --git a/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java b/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java index e76a7145800..e3f3e7e831c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java @@ -135,7 +135,7 @@ public class ChampionAbility extends StaticAbility { class ChampionExileCost extends CostImpl { - private String exileZone = null; + private String exileZone; public ChampionExileCost(FilterControlledPermanent filter, String exileZone) { this.addTarget(new TargetControlledPermanent(1, 1, filter, true)); @@ -149,20 +149,20 @@ class ChampionExileCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); MageObject sourceObject = ability.getSourceObject(game); if (controller != null && sourceObject != null) { - if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) { UUID exileId = CardUtil.getExileZoneId(game, ability.getSourceId(), ability.getSourceObjectZoneChangeCounter()); for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } - paid |= controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName() + " championed permanents", sourceId, game, Zone.BATTLEFIELD, true); + paid |= controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName() + " championed permanents", source, game, Zone.BATTLEFIELD, true); if (paid) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_CHAMPIONED, permanent.getId(), sourceId, controllerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_CHAMPIONED, permanent.getId(), source, controllerId)); } } } @@ -171,8 +171,8 @@ class ChampionExileCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/CommanderStormAbility.java b/Mage/src/main/java/mage/abilities/keyword/CommanderStormAbility.java index 0ab7c537b6a..017fc0b96bb 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CommanderStormAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CommanderStormAbility.java @@ -37,7 +37,7 @@ public class CommanderStormAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java index 211fee26027..79d000798ed 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java @@ -138,7 +138,7 @@ public class ConspireAbility extends StaticAbility implements OptionalAdditional if (player != null) { resetConspire(ability, game); // AI supports conspire - if (conspireCost.canPay(ability, getSourceId(), getControllerId(), game) + if (conspireCost.canPay(ability, this, getControllerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + conspireCost.getText(false) + " ?", ability, game)) { activateConspire(ability, game); for (Iterator it = conspireCost.iterator(); it.hasNext(); ) { diff --git a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java index 16d3a8e43ef..7af6c49a480 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java @@ -219,7 +219,7 @@ class ConvokeEffect extends OneShotEffect { continue; } String manaName; - if (!perm.isTapped() && perm.tap(game)) { + if (!perm.isTapped() && perm.tap(source, game)) { ManaPool manaPool = controller.getManaPool(); Choice chooseManaType = buildChoice(perm.getColor(game), unpaid.getMana()); if (!chooseManaType.getChoices().isEmpty()) { @@ -262,7 +262,7 @@ class ConvokeEffect extends OneShotEffect { manaPool.unlockManaType(ManaType.COLORLESS); manaName = "colorless"; } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CONVOKED, perm.getId(), source.getSourceId(), source.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CONVOKED, perm.getId(), source, source.getControllerId())); game.informPlayers("Convoke: " + controller.getLogName() + " taps " + perm.getLogName() + " to pay one " + manaName + " mana"); // can't use mana abilities after that (convoke cost must be payed after mana abilities only) diff --git a/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java b/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java index 8f91103ef51..051c7a2d679 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java @@ -73,7 +73,7 @@ class CrewCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true) { @Override public String getMessage() { @@ -92,13 +92,13 @@ class CrewCost extends CostImpl { }; // can cancel - if (target.choose(Outcome.Tap, controllerId, sourceId, game)) { + if (target.choose(Outcome.Tap, controllerId, source.getSourceId(), game)) { int sumPower = 0; for (UUID targetId : target.getTargets()) { - GameEvent event = new GameEvent(GameEvent.EventType.CREW_VEHICLE, targetId, sourceId, controllerId); + GameEvent event = new GameEvent(GameEvent.EventType.CREW_VEHICLE, targetId, source, controllerId); if (!game.replaceEvent(event)) { Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.tap(game)) { + if (permanent != null && permanent.tap(source, game)) { sumPower += permanent.getPower().getValue(); } } @@ -106,7 +106,7 @@ class CrewCost extends CostImpl { paid = sumPower >= value; if (paid) { for (UUID targetId : target.getTargets()) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, targetId, sourceId, controllerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, targetId, source, controllerId)); } } } else { @@ -117,7 +117,7 @@ class CrewCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { int sumPower = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) { int powerToAdd = permanent.getPower().getValue(); diff --git a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java index cafd1a867b1..2a0105bc49b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -83,13 +83,13 @@ class CumulativeUpkeepEffect extends OneShotEffect { } if (player.chooseUse(Outcome.Benefit, "Pay " + totalCost.getText() + '?', source, game)) { totalCost.clearPaid(); - if (totalCost.payOrRollback(source, game, source.getSourceId(), source.getControllerId())) { - game.fireEvent(new ManaEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), totalCost.getUsedManaToPay())); + if (totalCost.payOrRollback(source, game, source, source.getControllerId())) { + game.fireEvent(new ManaEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), source, player.getId(), totalCost.getUsedManaToPay())); return true; } } - game.fireEvent(new GameEvent(EventType.DIDNT_PAY_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), ageCounter, false)); - permanent.sacrifice(source.getSourceId(), game); + game.fireEvent(new GameEvent(GameEvent.EventType.DIDNT_PAY_CUMULATIVE_UPKEEP, permanent.getId(), source, player.getId(), ageCounter, false)); + permanent.sacrifice(source, game); return true; } else { CostsImpl totalCost = new CostsImpl<>(); @@ -99,15 +99,15 @@ class CumulativeUpkeepEffect extends OneShotEffect { if (player.chooseUse(Outcome.Benefit, totalCost.getText() + '?', source, game)) { totalCost.clearPaid(); int bookmark = game.bookmarkState(); - if (totalCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { - game.fireEvent(new GameEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), ageCounter, false)); + if (totalCost.pay(source, game, source, source.getControllerId(), false, null)) { + game.fireEvent(new GameEvent(GameEvent.EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), source, player.getId(), ageCounter, false)); return true; } else { player.restoreState(bookmark, source.getRule(), game); } } - game.fireEvent(new GameEvent(EventType.DIDNT_PAY_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), ageCounter, false)); - permanent.sacrifice(source.getSourceId(), game); + game.fireEvent(new GameEvent(GameEvent.EventType.DIDNT_PAY_CUMULATIVE_UPKEEP, permanent.getId(), source, player.getId(), ageCounter, false)); + permanent.sacrifice(source, game); return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java index 4e6bfc14a4d..bf34351a150 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java @@ -106,7 +106,7 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts if (player != null) { this.resetDash(); for (AlternativeCost2 dashCost : alternativeSourceCosts) { - if (dashCost.canPay(ability, sourceId, controllerId, game) + if (dashCost.canPay(ability, this, controllerId, game) && player.chooseUse(Outcome.Benefit, KEYWORD + " the creature for " + dashCost.getText(true) + " ?", ability, game)) { activateDash(dashCost, game); ability.getManaCostsToPay().clear(); diff --git a/Mage/src/main/java/mage/abilities/keyword/DredgeAbility.java b/Mage/src/main/java/mage/abilities/keyword/DredgeAbility.java index a78a400e478..c628b3c71c7 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DredgeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DredgeAbility.java @@ -85,7 +85,7 @@ class DredgeEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.DRAW_CARD; + return event.getType() == GameEvent.EventType.DRAW_CARD; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java b/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java index c96cd120db4..446f94acd89 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java @@ -89,8 +89,8 @@ class EmbalmEffect extends OneShotEffect { token.getColor(game).setColor(ObjectColor.WHITE); token.addSubType(game, SubType.ZOMBIE); token.getManaCost().clear(); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EMBALMED_CREATURE, token.getId(), source.getSourceId(), controller.getId())); - token.putOntoBattlefield(1, game, source.getSourceId(), controller.getId(), false, false, null); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EMBALMED_CREATURE, token.getId(), source, controller.getId())); + token.putOntoBattlefield(1, game, source, controller.getId(), false, false, null); // Probably it makes sense to remove also the Embalm ability (it's not shown on the token cards). // Also it can never get active or? But it's not mentioned in the reminder text. return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/EmergeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EmergeAbility.java index 0aa1eddbd66..e5dadd0373e 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EmergeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EmergeAbility.java @@ -54,7 +54,7 @@ public class EmergeAbility extends SpellAbility { for (Permanent creature : game.getBattlefield().getActivePermanents( new FilterControlledCreaturePermanent(), this.getControllerId(), this.getSourceId(), game)) { ManaCost costToPay = CardUtil.reduceCost(emergeCost.copy(), creature.getConvertedManaCost()); - if (costToPay.canPay(this, this.getSourceId(), this.getControllerId(), game)) { + if (costToPay.canPay(this, this, this.getControllerId(), game)) { return ActivationStatus.getTrue(this, game); } } @@ -93,7 +93,7 @@ public class EmergeAbility extends SpellAbility { if (creature != null) { CardUtil.reduceCost(this, creature.getConvertedManaCost()); if (super.activate(game, false)) { - if (creature.sacrifice(getSourceId(), game)) { + if (creature.sacrifice(this, game)) { return true; } else { activated = false; diff --git a/Mage/src/main/java/mage/abilities/keyword/EncoreAbility.java b/Mage/src/main/java/mage/abilities/keyword/EncoreAbility.java index d82337edccc..1f455b6519b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EncoreAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EncoreAbility.java @@ -91,7 +91,7 @@ class EncoreEffect extends OneShotEffect { if (opponentCount < 1) { return false; } - token.putOntoBattlefield(opponentCount, game, source.getSourceId(), source.getControllerId()); + token.putOntoBattlefield(opponentCount, game, source, source.getControllerId()); Iterator it = token.getLastAddedTokenIds().iterator(); while (it.hasNext()) { for (UUID playerId : game.getOpponents(source.getControllerId())) { @@ -181,7 +181,7 @@ class EncoreSacrificeEffect extends OneShotEffect { for (MageObjectReference mageObjectReference : mageObjectReferenceSet) { Permanent permanent = mageObjectReference.getPermanent(game); if (permanent != null) { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java b/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java index 299712952f1..fffd612c754 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java @@ -83,7 +83,7 @@ public class EntwineAbility extends StaticAbility implements OptionalAdditionalM return; } - if (additionalCost.canPay(ability, ability.getSourceId(), ability.getControllerId(), game) + if (additionalCost.canPay(ability, this, ability.getControllerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + additionalCost.getText(false) + " ?", ability, game)) { addCostsToAbility(additionalCost, ability); activateCost(game, ability); diff --git a/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java index 61d185e263a..012f6fec20d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java @@ -97,8 +97,8 @@ class EternalizeEffect extends OneShotEffect { token.removePTCDA(); token.getPower().modifyBaseValue(4); token.getToughness().modifyBaseValue(4); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ETERNALIZED_CREATURE, token.getId(), source.getSourceId(), controller.getId())); - token.putOntoBattlefield(1, game, source.getSourceId(), controller.getId(), false, false, null); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ETERNALIZED_CREATURE, token.getId(), source, controller.getId())); + token.putOntoBattlefield(1, game, source, controller.getId(), false, false, null); // Probably it makes sense to remove also the Eternalize ability (it's not shown on the token cards). // Also it can never get active or? But it's not mentioned in the reminder text. return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java index ab0f8004b1e..e0f285d0fc0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java @@ -97,7 +97,7 @@ public class EvokeAbility extends StaticAbility implements AlternativeSourceCost if (player != null) { this.resetEvoke(); for (AlternativeCost2 evokeCost : evokeCosts) { - if (evokeCost.canPay(ability, sourceId, controllerId, game) + if (evokeCost.canPay(ability, this, controllerId, game) && player.chooseUse(Outcome.Benefit, new StringBuilder(EVOKE_KEYWORD).append(" the creature for ").append(evokeCost.getText(true)).append(" ?").toString(), ability, game)) { activateEvoke(evokeCost, game); ability.getManaCostsToPay().clear(); diff --git a/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java b/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java index 7e2183feb28..539676788a9 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java @@ -140,7 +140,7 @@ class EvolveEffect extends OneShotEffect { Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sourceCreature != null && EvolveAbility.isPowerOrThoughnessGreater(sourceCreature, triggeringCreature)) { sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EVOLVED_CREATURE, sourceCreature.getId(), source.getSourceId(), source.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EVOLVED_CREATURE, sourceCreature.getId(), source, source.getControllerId())); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/ExertAbility.java b/Mage/src/main/java/mage/abilities/keyword/ExertAbility.java index 61258ee24ac..1967b3156de 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ExertAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ExertAbility.java @@ -89,7 +89,7 @@ class ExertReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED; + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; } @Override @@ -119,7 +119,7 @@ class ExertReplacementEffect extends ReplacementEffectImpl { if (!game.isSimulation()) { game.informPlayers(controller.getLogName() + " exerted " + creature.getName()); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_EXERTED, creature.getId(), creature.getId(), creature.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_EXERTED, creature.getId(), source, source.getControllerId())); ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", creature.getControllerId()); effect.setTargetPointer(new FixedTarget(creature, game)); game.addEffect(effect, source); @@ -152,7 +152,7 @@ class ExertedThisTurnWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.BECOMES_EXERTED) { - this.exertedThisTurnCreatures.add(new MageObjectReference(event.getSourceId(), game)); + this.exertedThisTurnCreatures.add(new MageObjectReference(event.getTargetId(), game)); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/ExploitAbility.java b/Mage/src/main/java/mage/abilities/keyword/ExploitAbility.java index 31dfc724e2a..b314027b7d9 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ExploitAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ExploitAbility.java @@ -76,8 +76,8 @@ class ExploitEffect extends OneShotEffect { controller.chooseTarget(Outcome.Sacrifice, target, source, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null ) { - if (permanent.sacrifice(source.getSourceId(), game)) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLOITED_CREATURE, permanent.getId(), source.getSourceId(), controller.getId())); + if (permanent.sacrifice(source, game)) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLOITED_CREATURE, permanent.getId(), source, controller.getId())); } } } diff --git a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java index 9d0fe3f7d99..b522cc6e010 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java @@ -77,10 +77,10 @@ class ExtortEffect extends OneShotEffect { if (player != null && permanent != null) { if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(')').toString(), source, game)) { Cost cost = new ManaCostsImpl("{W/B}"); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { + if (cost.pay(source, game, source, player.getId(), false, null)) { int loseLife = 0; for (UUID opponentId : game.getOpponents(source.getControllerId())) { - loseLife += game.getPlayer(opponentId).loseLife(1, game, false); + loseLife += game.getPlayer(opponentId).loseLife(1, game, source, false); } if (loseLife > 0) { game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source); diff --git a/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java b/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java index 14584854cf2..d65f0c141e1 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java @@ -70,7 +70,7 @@ class FabricateEffect extends OneShotEffect { ((Card) sourceObject).addCounters(CounterType.P1P1.createInstance(value), source, game); } else { - new ServoToken().putOntoBattlefield(value, game, source.getSourceId(), controller.getId()); + new ServoToken().putOntoBattlefield(value, game, source, controller.getId()); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java b/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java index 08f6943a423..09c2adc2240 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java @@ -70,9 +70,9 @@ class FadingEffect extends OneShotEffect { if (permanent != null) { int amount = permanent.getCounters(game).getCount(CounterType.FADE); if (amount > 0) { - permanent.removeCounters(CounterType.FADE.createInstance(), game); + permanent.removeCounters(CounterType.FADE.createInstance(), source, game); } else { - permanent.sacrifice(source.getSourceId(), game); + permanent.sacrifice(source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java index eed6bc6800c..c181f86856c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java @@ -146,7 +146,7 @@ class GraftDistributeCounterEffect extends OneShotEffect { if (numberOfCounters > 0) { Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { - sourcePermanent.removeCounters(CounterType.P1P1.getName(), 1, game); + sourcePermanent.removeCounters(CounterType.P1P1.getName(), 1, source, game); targetCreature.addCounters(CounterType.P1P1.createInstance(1), source, game); if (!game.isSimulation()) { game.informPlayers("Moved one +1/+1 counter from " + sourcePermanent.getLogName() + " to " + targetCreature.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/keyword/GravestormAbility.java b/Mage/src/main/java/mage/abilities/keyword/GravestormAbility.java index 16f3ef71e48..20b06deb9ee 100644 --- a/Mage/src/main/java/mage/abilities/keyword/GravestormAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/GravestormAbility.java @@ -35,7 +35,7 @@ public class GravestormAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java index cc7eb68a479..bc0b2eb4952 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java @@ -192,7 +192,7 @@ class HauntEffect extends OneShotEffect { Permanent hauntedCreature = game.getPermanent(targetPointer.getFirst(game, source)); // haunting card will only be moved to exile, if if (hauntedCreature != null) { - if (card.moveToExile(source.getSourceId(), "Haunting", source.getSourceId(), game)) { + if (card.moveToExile(source.getSourceId(), "Haunting", source, game)) { // remember the haunted creature String key = new StringBuilder("Haunting_") .append(source.getSourceId().toString()) diff --git a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java index 12ea093ed09..4cc3f4b1d38 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java @@ -116,8 +116,7 @@ class HideawayExileEffect extends OneShotEffect { if (card != null) { cards.remove(card); UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); - controller.moveCardToExileWithInfo(card, exileId, - "Hideaway (" + hideawaySource.getIdName() + ')', source.getSourceId(), game, Zone.LIBRARY, false); + controller.moveCardToExileWithInfo(card, exileId, "Hideaway (" + hideawaySource.getIdName() + ')', source, game, Zone.LIBRARY, false); card.setFaceDown(true, game); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/ImproviseAbility.java b/Mage/src/main/java/mage/abilities/keyword/ImproviseAbility.java index fe5625809dd..a235a56340d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ImproviseAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ImproviseAbility.java @@ -160,7 +160,7 @@ class ImproviseEffect extends OneShotEffect { if (perm == null) { continue; } - if (!perm.isTapped() && perm.tap(game)) { + if (!perm.isTapped() && perm.tap(source, game)) { ManaPool manaPool = controller.getManaPool(); manaPool.addMana(Mana.ColorlessMana(1), game, source); manaPool.unlockManaType(ManaType.COLORLESS); diff --git a/Mage/src/main/java/mage/abilities/keyword/InspiredAbility.java b/Mage/src/main/java/mage/abilities/keyword/InspiredAbility.java index 3e20c1da547..9ea2eec2830 100644 --- a/Mage/src/main/java/mage/abilities/keyword/InspiredAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/InspiredAbility.java @@ -68,7 +68,7 @@ public class InspiredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAPPED; + return event.getType() == GameEvent.EventType.UNTAPPED; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java index 1c004e70647..475f6ef638d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java @@ -156,8 +156,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo amount += activations.get(key); } activations.put(key, amount); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.KICKED, - source.getSourceId(), source.getSourceId(), source.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.KICKED, source.getSourceId(), source, source.getControllerId())); } private String getActivationKey(Ability source, String costText, Game game) { @@ -190,15 +189,14 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo } // TODO: add AI support to find max number of possible activations (from available mana) // canPay checks only single mana available, not total mana usage - if (kickerCost.canPay(ability, sourceId, ability.getControllerId(), game) + if (kickerCost.canPay(ability, this, ability.getControllerId(), game) && player.chooseUse(/*Outcome.Benefit*/Outcome.AIDontUseIt, "Pay " + times + kickerCost.getText(false) + " ?", ability, game)) { this.activateKicker(kickerCost, ability, game); if (kickerCost instanceof Costs) { for (Iterator itKickerCost = ((Costs) kickerCost).iterator(); itKickerCost.hasNext(); ) { Object kickerCostObject = itKickerCost.next(); - if ((kickerCostObject instanceof Costs) - || (kickerCostObject instanceof CostsImpl)) { + if ((kickerCostObject instanceof Costs)) { for (@SuppressWarnings("unchecked") Iterator itDetails = ((Costs) kickerCostObject).iterator(); itDetails.hasNext(); ) { addKickerCostsToAbility(itDetails.next(), ability, game); diff --git a/Mage/src/main/java/mage/abilities/keyword/LivingWeaponAbility.java b/Mage/src/main/java/mage/abilities/keyword/LivingWeaponAbility.java index 3701f747022..3ec2ea5bcde 100644 --- a/Mage/src/main/java/mage/abilities/keyword/LivingWeaponAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/LivingWeaponAbility.java @@ -46,7 +46,7 @@ class LivingWeaponEffect extends CreateTokenEffect { if (super.apply(game, source)) { Permanent p = game.getPermanent(this.getLastAddedTokenId()); if (p != null) { - p.addAttachment(source.getSourceId(), game); + p.addAttachment(source.getSourceId(), source, game); return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java b/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java index cf05bd4fea4..b2e85ac4d49 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java @@ -14,6 +14,7 @@ import mage.cards.Card; import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.MadnessCardExiledEvent; import mage.game.events.ZoneChangeEvent; import mage.game.stack.Spell; import mage.players.Player; @@ -105,9 +106,9 @@ class MadnessReplacementEffect extends ReplacementEffectImpl { if (controller != null) { Card card = game.getCard(event.getTargetId()); if (card != null) { - if (controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true)) { + if (controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source, game, ((ZoneChangeEvent) event).getFromZone(), true)) { game.applyEffects(); // needed to add Madness ability to cards (e.g. by Falkenrath Gorger) - GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.MADNESS_CARD_EXILED, card.getId(), source.getOriginalId(), controller.getId()); + GameEvent gameEvent = new MadnessCardExiledEvent(card.getId(), source, controller.getId()); game.fireEvent(gameEvent); } return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/MeditateAbility.java b/Mage/src/main/java/mage/abilities/keyword/MeditateAbility.java index f40165312f1..200ac2aef24 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MeditateAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MeditateAbility.java @@ -69,7 +69,7 @@ class ReturnToHandEffect extends OneShotEffect { if (permanent != null) { boolean ret = controller.moveCards(permanent, Zone.HAND, source, game); if (ret) { - game.fireEvent(new GameEvent(EventType.MEDITATED, source.getSourceId(), source.getSourceId(), controller.getId())); + game.fireEvent(new GameEvent(GameEvent.EventType.MEDITATED, source.getSourceId(), source, controller.getId())); } return ret; } diff --git a/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java b/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java index 995e27004aa..13434e288e6 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java @@ -51,10 +51,10 @@ class MeleeWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.BEGIN_COMBAT_STEP_PRE) { + if (event.getType() == GameEvent.EventType.BEGIN_COMBAT_STEP_PRE) { this.playersAttacked.clear(); } - else if (event.getType() == EventType.ATTACKER_DECLARED) { + else if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { Set attackedPlayers = this.playersAttacked.getOrDefault(event.getPlayerId(), new HashSet<>(1)); attackedPlayers.add(event.getTargetId()); this.playersAttacked.put(event.getPlayerId(), attackedPlayers); diff --git a/Mage/src/main/java/mage/abilities/keyword/MiracleAbility.java b/Mage/src/main/java/mage/abilities/keyword/MiracleAbility.java index 85b710dbc27..a7788a0997d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MiracleAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MiracleAbility.java @@ -99,9 +99,9 @@ public class MiracleAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getSourceId().equals(getSourceId())) { + if (event.getTargetId().equals(this.getSourceId())) { // Refer to the card at the zone it is now (hand) - getEffects().setTargetPointer(new FixedTarget(game.getCard(event.getSourceId()), game)); + getEffects().setTargetPointer(new FixedTarget(game.getCard(event.getTargetId()), game)); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/MonstrosityAbility.java b/Mage/src/main/java/mage/abilities/keyword/MonstrosityAbility.java index 56c9ad45984..f9ce9c616fe 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MonstrosityAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MonstrosityAbility.java @@ -103,7 +103,7 @@ class BecomeMonstrousSourceEffect extends OneShotEffect { } new AddCountersSourceEffect(CounterType.P1P1.createInstance(monstrosityValue)).apply(game, source); permanent.setMonstrous(true); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_MONSTROUS, source.getSourceId(), source.getSourceId(), source.getControllerId(), monstrosityValue)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_MONSTROUS, source.getSourceId(), source, source.getControllerId(), monstrosityValue)); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java index 22bd6c4f03d..2c638e9869a 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java @@ -190,7 +190,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost && spell != null) { this.resetMorph(); spell.setFaceDown(true, game); // so only the back is visible - if (alternateCosts.canPay(ability, sourceId, ability.getControllerId(), game)) { + if (alternateCosts.canPay(ability, this, ability.getControllerId(), game)) { if (player.chooseUse(Outcome.Benefit, "Cast this card as a 2/2 " + "face-down creature for " + getCosts().getText() + " ?", ability, game)) { game.getState().setValue("MorphAbility" @@ -225,7 +225,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost Player player = game.getPlayer(ability.getControllerId()); if (player != null) { this.resetMorph(); - if (alternateCosts.canPay(ability, sourceId, ability.getControllerId(), game)) { + if (alternateCosts.canPay(ability, this, ability.getControllerId(), game)) { if (player.chooseUse(Outcome.Benefit, "Cast this card as a 2/2 " + "face-down creature for " + getCosts().getText() + " ?", ability, game)) { activateMorph(game); diff --git a/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java b/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java index 3ea3a2b4ca8..76862a16c6c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java @@ -145,8 +145,8 @@ class ReturnAttackerToHandTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (targets.choose(Outcome.ReturnToHand, controllerId, source.getSourceId(), game)) { for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); Player controller = game.getPlayer(controllerId); @@ -155,15 +155,15 @@ class ReturnAttackerToHandTargetCost extends CostImpl { return false; } defendingPlayerId = game.getCombat().getDefenderId(permanent.getId()); - paid |= controller.moveCardToHandWithInfo(permanent, sourceId, game); + paid |= controller.moveCardToHandWithInfo(permanent, source, game, true); } } return paid; } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return targets.canChoose(controllerId, game); + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return targets.canChoose(source.getSourceId(), controllerId, game); } @Override @@ -191,7 +191,7 @@ class RevealNinjutsuCardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); Card card = player.getHand().get(ability.getSourceId(), game); @@ -214,7 +214,7 @@ class RevealNinjutsuCardCost extends CostImpl { } @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java b/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java index 51016822f2c..da1ea7ea6cc 100644 --- a/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java @@ -225,7 +225,7 @@ class OfferingCostReductionEffect extends CostModificationEffectImpl { public boolean apply(Game game, Ability source, Ability abilityToModify) { Permanent toOffer = game.getPermanent(getTargetPointer().getFirst(game, source)); if (toOffer != null) { - toOffer.sacrifice(source.getSourceId(), game); + toOffer.sacrifice(source, game); CardUtil.reduceCost((SpellAbility) abilityToModify, toOffer.getSpellAbility().getManaCosts()); } game.getState().setValue("offering_" + source.getSourceId(), null); diff --git a/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java b/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java index 5c73a369f24..99d416546ba 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java @@ -95,7 +95,7 @@ public class ProwlAbility extends StaticAbility implements AlternativeSourceCost if (ProwlCondition.instance.apply(game, ability)) { this.resetProwl(); for (AlternativeCost2 prowlCost : prowlCosts) { - if (prowlCost.canPay(ability, sourceId, ability.getControllerId(), game) + if (prowlCost.canPay(ability, this, ability.getControllerId(), game) && player.chooseUse(Outcome.Benefit, "Cast for " + PROWL_KEYWORD + " cost " + prowlCost.getText(true) + " ?", ability, game)) { diff --git a/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java b/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java index 6f3cc283d29..f3a6c0f5f37 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java @@ -79,6 +79,11 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { + // rules: + // If a spell with rebound that you cast from your hand doesn’t resolve for any reason (due being countered + // by a spell like Cancel, or because all of its targets are illegal), rebound has no effect. + // The spell is simply put into your graveyard. You won’t get to cast it again next turn. + // (2010-06-15) if (((ZoneChangeEvent) event).getFromZone() == Zone.STACK && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD && event.getSourceId() != null @@ -108,7 +113,7 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl { game.addDelayedTriggeredAbility(trigger, source); player.moveCardToExileWithInfo(sourceCard, sourceCard.getId(), - player.getName() + " Rebound", source.getSourceId(), game, Zone.STACK, true); + player.getName() + " Rebound", source, game, Zone.STACK, true); return true; } } @@ -127,7 +132,7 @@ class ReboundEffectCastFromExileDelayedTrigger extends DelayedTriggeredAbility { ReboundEffectCastFromExileDelayedTrigger(UUID cardId, UUID sourceId) { super(new ReboundCastSpellFromExileEffect()); - setSourceId(sourceId); + setSourceId(sourceId); // TODO: WTF?! this.optional = true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java index 25f309b6b55..101879c834c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java @@ -92,7 +92,7 @@ class RecoverEffect extends OneShotEffect { && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { if (controller.chooseUse(Outcome.Damage, "Pay " + cost.getText() + " to recover " + sourceCard.getLogName() + "? (Otherwise the card will be exiled)", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { + if (cost.pay(source, game, source, controller.getId(), false, null)) { return new ReturnToHandSourceEffect().apply(game, source); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/RenownAbility.java b/Mage/src/main/java/mage/abilities/keyword/RenownAbility.java index 08cd9472f4b..d9a0685dd31 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RenownAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RenownAbility.java @@ -91,7 +91,7 @@ class BecomesRenownedSourceEffect extends OneShotEffect { } new AddCountersSourceEffect(CounterType.P1P1.createInstance(renownValue), true).apply(game, source); permanent.setRenowned(true); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_RENOWNED, source.getSourceId(), source.getSourceId(), source.getControllerId(), renownValue)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_RENOWNED, source.getSourceId(), source, source.getControllerId(), renownValue)); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java b/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java index 22d6bfce042..e10b4da315b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java @@ -94,7 +94,7 @@ public class ReplicateAbility extends StaticAbility implements OptionalAdditiona // TODO: add AI support to find max number of possible activations (from available mana) // canPay checks only single mana available, not total mana usage - if (additionalCost.canPay(ability, sourceId, ability.getControllerId(), game) + if (additionalCost.canPay(ability, this, ability.getControllerId(), game) && player.chooseUse(/*Outcome.Benefit*/Outcome.AIDontUseIt, new StringBuilder("Pay ").append(times).append( additionalCost.getText(false)).append(" ?").toString(), ability, game)) { diff --git a/Mage/src/main/java/mage/abilities/keyword/RiotAbility.java b/Mage/src/main/java/mage/abilities/keyword/RiotAbility.java index fe667a08cec..baaad997f16 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RiotAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RiotAbility.java @@ -53,7 +53,7 @@ class RiotReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/StormAbility.java b/Mage/src/main/java/mage/abilities/keyword/StormAbility.java index d7ea81e60c7..49775b5aa9a 100644 --- a/Mage/src/main/java/mage/abilities/keyword/StormAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/StormAbility.java @@ -35,7 +35,7 @@ public class StormAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java index 5d88a299c1b..7ea518521fe 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java @@ -262,7 +262,7 @@ class SuspendExileEffect extends OneShotEffect { if (card != null && controller != null) { UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " - + controller.getName(), source.getSourceId(), game, Zone.HAND, true)) { + + controller.getName(), source, game, Zone.HAND, true)) { if (suspend == Integer.MAX_VALUE) { suspend = source.getManaCostsToPay().getX(); } @@ -296,8 +296,8 @@ class SuspendPlayCardAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getTargetId().equals(getSourceId())) { - Card card = game.getCard(getSourceId()); + if (event.getTargetId().equals(this.getSourceId())) { + Card card = game.getCard(this.getSourceId()); return card != null && game.getState().getZone(card.getId()) == Zone.EXILED && card.getCounters(game).getCount(CounterType.TIME) == 0; @@ -350,7 +350,7 @@ class SuspendPlayCardEffect extends OneShotEffect { } } if (!abilitiesToRemove.isEmpty()) { - for (Ability ability : card.getAbilities()) { + for (Ability ability : card.getAbilities(game)) { if (ability instanceof SuspendBeginningOfUpkeepInterveningIfTriggeredAbility || ability instanceof SuspendPlayCardAbility) { abilitiesToRemove.add(ability); diff --git a/Mage/src/main/java/mage/abilities/keyword/TotemArmorAbility.java b/Mage/src/main/java/mage/abilities/keyword/TotemArmorAbility.java index 2f9e2963e12..be6d8b442ae 100644 --- a/Mage/src/main/java/mage/abilities/keyword/TotemArmorAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/TotemArmorAbility.java @@ -59,7 +59,7 @@ class TotemArmorEffect extends ReplacementEffectImpl { Permanent equipedPermanent = game.getPermanent(event.getTargetId()); if (equipedPermanent != null) { equipedPermanent.removeAllDamage(game); - sourcePermanent.destroy(source.getSourceId(), game, false); + sourcePermanent.destroy(source, game, false); return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java index ef3dad32080..56ddae7badd 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java @@ -108,7 +108,7 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java index 8e7da9419f5..110c8a25b52 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java @@ -56,7 +56,7 @@ class UnleashReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java index 30994dc7a90..5a0c14bf374 100644 --- a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java @@ -66,7 +66,7 @@ class VanishingEffect extends OneShotEffect { if (p != null) { int amount = p.getCounters(game).getCount(CounterType.TIME); if (amount > 0) { - p.removeCounters(CounterType.TIME.createInstance(), game); + p.removeCounters(CounterType.TIME.createInstance(), source, game); game.informPlayers("Removed a time counter from " + p.getLogName() + " (" + amount + " left)"); } return true; diff --git a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java index 02fdec3317c..53ebed55211 100644 --- a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java @@ -70,7 +70,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl } //20091005 - 605.3a - return new ActivationStatus(costs.canPay(this, sourceId, controllerId, game), null); + return new ActivationStatus(costs.canPay(this, this, controllerId, game), null); } /** diff --git a/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java index c257ee04103..c17c642877c 100644 --- a/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java @@ -1,4 +1,3 @@ - package mage.abilities.mana; diff --git a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java index 07f6dec4ab7..b2448fecca4 100644 --- a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java +++ b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java @@ -128,13 +128,13 @@ public class ManaOptions extends ArrayList { */ private boolean checkManaReplacementAndTriggeredMana(Ability ability, Game game, Mana mana) { if (ability.hasTapCost()) { - ManaEvent event = new ManaEvent(GameEvent.EventType.TAPPED_FOR_MANA, ability.getSourceId(), ability.getSourceId(), ability.getControllerId(), mana); + ManaEvent event = new ManaEvent(GameEvent.EventType.TAPPED_FOR_MANA, ability.getSourceId(), ability, ability.getControllerId(), mana); if (game.replaceEvent(event)) { return false; } game.fireEvent(event); } - ManaEvent manaEvent = new ManaEvent(GameEvent.EventType.MANA_ADDED, ability.getSourceId(), ability.getSourceId(), ability.getControllerId(), mana); + ManaEvent manaEvent = new ManaEvent(GameEvent.EventType.MANA_ADDED, ability.getSourceId(), ability, ability.getControllerId(), mana); manaEvent.setData(mana.toString()); game.fireEvent(manaEvent); return true; diff --git a/Mage/src/main/java/mage/actions/MageDrawAction.java b/Mage/src/main/java/mage/actions/MageDrawAction.java index f40d409b40b..c3d0c8760af 100644 --- a/Mage/src/main/java/mage/actions/MageDrawAction.java +++ b/Mage/src/main/java/mage/actions/MageDrawAction.java @@ -1,10 +1,14 @@ package mage.actions; +import mage.abilities.Ability; import mage.actions.impl.MageAction; import mage.actions.score.ArtificialScoringSystem; import mage.cards.Card; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.DrawCardEvent; +import mage.game.events.DrawCardsEvent; +import mage.game.events.DrewCardEvent; import mage.game.events.GameEvent; import mage.players.Player; import mage.util.CardUtil; @@ -23,35 +27,34 @@ public class MageDrawAction extends MageAction { private static final int NEGATIVE_VALUE = -1000000; private final Player player; - private final List appliedEffects; private final List drawnCards; + private final GameEvent originalDrawEvent; // for replace effects private int amount; - public MageDrawAction(Player player, int amount, List appliedEffects) { + public MageDrawAction(Player player, int amount, GameEvent originalDrawEvent) { this.player = player; this.amount = amount; - this.appliedEffects = appliedEffects; this.drawnCards = new ArrayList<>(); + this.originalDrawEvent = originalDrawEvent; } /** * Draw and set action score. * - * @param sourceId + * @param source * @param game Game context. * @return */ @Override - public int doAction(UUID sourceId, Game game) { + public int doAction(Ability source, Game game) { int numDrawn = 0; int score = 0; - GameEvent event = GameEvent.getEvent(GameEvent.EventType.DRAW_CARDS, player.getId(), null, player.getId(), null, amount); - event.addAppliedEffects(appliedEffects); + GameEvent event = new DrawCardsEvent(this.player.getId(), source, this.originalDrawEvent, this.amount); if (amount < 2 || !game.replaceEvent(event)) { amount = event.getAmount(); for (int i = 0; i < amount; i++) { - int value = drawCard(sourceId, game); + int value = drawCard(source, this.originalDrawEvent, game); if (value == NEGATIVE_VALUE) { continue; } @@ -72,23 +75,23 @@ public class MageDrawAction extends MageAction { * Draw a card if possible (there is no replacement effect that prevent us * from drawing). Fire event about card drawn. * - * @param sourceId + * @param source + * @param originalDrawEvent original draw event for replacement effects, can be null for normal calls * @param game * @return */ - protected int drawCard(UUID sourceId, Game game) { - GameEvent event = GameEvent.getEvent(GameEvent.EventType.DRAW_CARD, player.getId(), sourceId, player.getId()); - event.addAppliedEffects(appliedEffects); + protected int drawCard(Ability source, GameEvent originalDrawEvent, Game game) { + GameEvent event = new DrawCardEvent(this.player.getId(), source, originalDrawEvent); if (!game.replaceEvent(event)) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { drawnCards.add(card); - card.moveToZone(Zone.HAND, null, game, false); + card.moveToZone(Zone.HAND, source, game, false); // if you want to use event.getSourceId() here then thinks x10 times if (player.isTopCardRevealed()) { game.fireInformEvent(player.getLogName() + " draws a revealed card (" + card.getLogName() + ')'); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DREW_CARD, card.getId(), player.getId())); + game.fireEvent(new DrewCardEvent(card.getId(), player.getId(), source, originalDrawEvent)); return ArtificialScoringSystem.inst.getCardScore(card); } } diff --git a/Mage/src/main/java/mage/actions/MageLoseGameAction.java b/Mage/src/main/java/mage/actions/MageLoseGameAction.java index 55468ae9a37..30d5d5bd294 100644 --- a/Mage/src/main/java/mage/actions/MageLoseGameAction.java +++ b/Mage/src/main/java/mage/actions/MageLoseGameAction.java @@ -1,5 +1,6 @@ package mage.actions; +import mage.abilities.Ability; import mage.actions.impl.MageAction; import mage.actions.score.ArtificialScoringSystem; import mage.game.Game; @@ -28,7 +29,7 @@ public class MageLoseGameAction extends MageAction { } @Override - public int doAction(UUID sourceId, final Game game) { + public int doAction(Ability source, final Game game) { oldLosingPlayer = game.getLosingPlayer(); if (oldLosingPlayer == null && player.canLose(game)) { setScore(player, ArtificialScoringSystem.inst.getLoseGameScore(game)); diff --git a/Mage/src/main/java/mage/actions/impl/MageAction.java b/Mage/src/main/java/mage/actions/impl/MageAction.java index 9a384769eb0..13b8463a807 100644 --- a/Mage/src/main/java/mage/actions/impl/MageAction.java +++ b/Mage/src/main/java/mage/actions/impl/MageAction.java @@ -1,5 +1,6 @@ package mage.actions.impl; +import mage.abilities.Ability; import mage.game.Game; import mage.players.Player; @@ -55,11 +56,11 @@ public abstract class MageAction { * Execute action. * * - * @param sourceId + * @param source * @param game Game context. * @return */ - public abstract int doAction(UUID sourceId, final Game game); + public abstract int doAction(Ability source, final Game game); /** * Undo action. diff --git a/Mage/src/main/java/mage/cards/AdventureCard.java b/Mage/src/main/java/mage/cards/AdventureCard.java index 1fc792311e9..8f268964033 100644 --- a/Mage/src/main/java/mage/cards/AdventureCard.java +++ b/Mage/src/main/java/mage/cards/AdventureCard.java @@ -42,8 +42,8 @@ public abstract class AdventureCard extends CardImpl { } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { - if (super.moveToZone(toZone, sourceId, game, flag, appliedEffects)) { + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { + if (super.moveToZone(toZone, source, game, flag, appliedEffects)) { game.getState().setZone(getSpellCard().getId(), toZone); return true; } @@ -57,8 +57,8 @@ public abstract class AdventureCard extends CardImpl { } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { - if (super.moveToExile(exileId, name, sourceId, game, appliedEffects)) { + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { + if (super.moveToExile(exileId, name, source, game, appliedEffects)) { Zone currentZone = game.getState().getZone(getId()); game.getState().setZone(getSpellCard().getId(), currentZone); return true; @@ -67,9 +67,9 @@ public abstract class AdventureCard extends CardImpl { } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { // zone contains only one main card - return super.removeFromZone(game, fromZone, sourceId); + return super.removeFromZone(game, fromZone, source); } @Override diff --git a/Mage/src/main/java/mage/cards/AdventureCardSpellImpl.java b/Mage/src/main/java/mage/cards/AdventureCardSpellImpl.java index 21ec7047bdc..8e60f55793b 100644 --- a/Mage/src/main/java/mage/cards/AdventureCardSpellImpl.java +++ b/Mage/src/main/java/mage/cards/AdventureCardSpellImpl.java @@ -1,5 +1,6 @@ package mage.cards; +import mage.abilities.Ability; import mage.abilities.Modes; import mage.abilities.SpellAbility; import mage.abilities.effects.common.ExileAdventureSpellEffect; @@ -60,13 +61,13 @@ public class AdventureCardSpellImpl extends CardImpl implements AdventureCardSpe } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { - return adventureCardParent.moveToZone(toZone, sourceId, game, flag, appliedEffects); + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { + return adventureCardParent.moveToZone(toZone, source, game, flag, appliedEffects); } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { - return adventureCardParent.moveToExile(exileId, name, sourceId, game, appliedEffects); + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { + return adventureCardParent.moveToExile(exileId, name, source, game, appliedEffects); } @Override diff --git a/Mage/src/main/java/mage/cards/Card.java b/Mage/src/main/java/mage/cards/Card.java index 48d10c385eb..1b0b287b9d9 100644 --- a/Mage/src/main/java/mage/cards/Card.java +++ b/Mage/src/main/java/mage/cards/Card.java @@ -52,15 +52,15 @@ public interface Card extends MageObject { String getTokenDescriptor(); - void checkForCountersToAdd(Permanent permanent, Game game); + void checkForCountersToAdd(Permanent permanent, Ability source, Game game); void setFaceDown(boolean value, Game game); boolean isFaceDown(Game game); - boolean turnFaceUp(Game game, UUID playerId); + boolean turnFaceUp(Ability source, Game game, UUID playerId); - boolean turnFaceDown(Game game, UUID playerId); + boolean turnFaceDown(Ability source, Game game, UUID playerId); boolean isFlipCard(); @@ -84,7 +84,7 @@ public interface Card extends MageObject { * Moves the card to the specified zone * * @param zone - * @param sourceId + * @param source ability which calls that move, can be null * @param game * @param flag If zone *

    @@ -92,40 +92,38 @@ public interface Card extends MageObject { * bottom
*
  • BATTLEFIELD:
    • true - tapped
    • false - * untapped
  • - *
  • GRAVEYARD:
    • true - not from Battlefield
    • false - from - * Battlefield
  • * * @return true if card was moved to zone */ - boolean moveToZone(Zone zone, UUID sourceId, Game game, boolean flag); + boolean moveToZone(Zone zone, Ability source, Game game, boolean flag); - boolean moveToZone(Zone zone, UUID sourceId, Game game, boolean flag, List appliedEffects); + boolean moveToZone(Zone zone, Ability source, Game game, boolean flag, List appliedEffects); /** * Moves the card to an exile zone * * @param exileId set to null for generic exile zone * @param name used for exile zone with the specified exileId - * @param sourceId + * @param source * @param game * @return true if card was moved to zone */ - boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game); + boolean moveToExile(UUID exileId, String name, Ability source, Game game); - boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects); + boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects); boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId); // WARNING, don't add new move/remove methods (if you add then you must override it in all multi-parts card like Split Half or MDF Half) - boolean removeFromZone(Game game, Zone fromZone, UUID sourceId); + boolean removeFromZone(Game game, Zone fromZone, Ability source); - boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId); + boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId); - boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped); + boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped); - boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown); + boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped, boolean facedown); - boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, List appliedEffects); + boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped, boolean facedown, List appliedEffects); void setZone(Zone zone, Game game); @@ -152,9 +150,9 @@ public interface Card extends MageObject { boolean addCounters(Counter counter, Ability source, Game game, List appliedEffects, boolean isEffect); - void removeCounters(String name, int amount, Game game); + void removeCounters(String name, int amount, Ability source, Game game); - void removeCounters(Counter counter, Game game); + void removeCounters(Counter counter, Ability source, Game game); @Override Card copy(); @@ -175,9 +173,9 @@ public interface Card extends MageObject { List getAttachments(); - boolean addAttachment(UUID permanentId, Game game); + boolean addAttachment(UUID permanentId, Ability source, Game game); - boolean removeAttachment(UUID permanentId, Game game); + boolean removeAttachment(UUID permanentId, Ability source, Game game); default boolean isOwnedBy(UUID controllerId) { return getOwnerId().equals(controllerId); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 8bee7eeb669..4010706e33a 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -14,8 +14,7 @@ import mage.counters.Counters; import mage.filter.FilterMana; import mage.game.*; import mage.game.command.CommandObject; -import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeEvent; +import mage.game.events.*; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.game.stack.StackObject; @@ -424,14 +423,14 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag) { - return this.moveToZone(toZone, sourceId, game, flag, null); + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag) { + return this.moveToZone(toZone, source, game, flag, null); } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { Zone fromZone = game.getState().getZone(objectId); - ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, ownerId, fromZone, toZone, appliedEffects); + ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, source, ownerId, fromZone, toZone, appliedEffects); ZoneChangeInfo zoneChangeInfo; if (null != toZone) { switch (toZone) { @@ -439,13 +438,13 @@ public abstract class CardImpl extends MageObjectImpl implements Card { zoneChangeInfo = new ZoneChangeInfo.Library(event, flag /* put on top */); break; case BATTLEFIELD: - zoneChangeInfo = new ZoneChangeInfo.Battlefield(event, flag /* comes into play tapped */); + zoneChangeInfo = new ZoneChangeInfo.Battlefield(event, flag /* comes into play tapped */, source); break; default: zoneChangeInfo = new ZoneChangeInfo(event); break; } - return ZonesHandler.moveCard(zoneChangeInfo, game); + return ZonesHandler.moveCard(zoneChangeInfo, game, source); } return false; } @@ -453,49 +452,49 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId) { Card mainCard = getMainCard(); - ZoneChangeEvent event = new ZoneChangeEvent(mainCard.getId(), ability.getId(), controllerId, fromZone, Zone.STACK); + ZoneChangeEvent event = new ZoneChangeEvent(mainCard.getId(), ability, controllerId, fromZone, Zone.STACK); ZoneChangeInfo.Stack info = new ZoneChangeInfo.Stack(event, new Spell(this, ability.getSpellAbilityToResolve(game), controllerId, event.getFromZone())); - return ZonesHandler.cast(info, game); + return ZonesHandler.cast(info, game, ability); } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game) { - return moveToExile(exileId, name, sourceId, game, null); + public boolean moveToExile(UUID exileId, String name, Ability source, Game game) { + return moveToExile(exileId, name, source, game, null); } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { Zone fromZone = game.getState().getZone(objectId); - ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, ownerId, fromZone, Zone.EXILED, appliedEffects); + ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, source, ownerId, fromZone, Zone.EXILED, appliedEffects); ZoneChangeInfo.Exile info = new ZoneChangeInfo.Exile(event, exileId, name); - return ZonesHandler.moveCard(info, game); + return ZonesHandler.moveCard(info, game, source); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { - return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, false, false, null); + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId) { + return this.putOntoBattlefield(game, fromZone, source, controllerId, false, false, null); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped) { - return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, tapped, false, null); + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped) { + return this.putOntoBattlefield(game, fromZone, source, controllerId, tapped, false, null); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean faceDown) { - return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, tapped, faceDown, null); + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped, boolean faceDown) { + return this.putOntoBattlefield(game, fromZone, source, controllerId, tapped, faceDown, null); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean faceDown, List appliedEffects) { - ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD, appliedEffects); - ZoneChangeInfo.Battlefield info = new ZoneChangeInfo.Battlefield(event, faceDown, tapped); - return ZonesHandler.moveCard(info, game); + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped, boolean faceDown, List appliedEffects) { + ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, source, controllerId, fromZone, Zone.BATTLEFIELD, appliedEffects); + ZoneChangeInfo.Battlefield info = new ZoneChangeInfo.Battlefield(event, faceDown, tapped, source); + return ZonesHandler.moveCard(info, game, source); } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { boolean removed = false; MageObject lkiObject = null; switch (fromZone) { @@ -577,7 +576,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { removed = true; break; default: - MageObject sourceObject = game.getObject(sourceId); + MageObject sourceObject = game.getObject(source.getSourceId()); logger.fatal("Invalid from zone [" + fromZone + "] for card [" + this.getIdName() + "] source [" + (sourceObject != null ? sourceObject.getName() : "null") + ']'); break; @@ -595,11 +594,11 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public void checkForCountersToAdd(Permanent permanent, Game game) { + public void checkForCountersToAdd(Permanent permanent, Ability source, Game game) { Counters countersToAdd = game.getEnterWithCounters(permanent.getId()); if (countersToAdd != null) { for (Counter counter : countersToAdd.values()) { - permanent.addCounters(counter, null, game); + permanent.addCounters(counter, source, game); } game.setEnterWithCounters(permanent.getId(), null); } @@ -616,8 +615,8 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public boolean turnFaceUp(Game game, UUID playerId) { - GameEvent event = GameEvent.getEvent(GameEvent.EventType.TURNFACEUP, getId(), playerId); + public boolean turnFaceUp(Ability source, Game game, UUID playerId) { + GameEvent event = GameEvent.getEvent(GameEvent.EventType.TURNFACEUP, getId(), source, playerId); if (!game.replaceEvent(event)) { setFaceDown(false, game); for (Ability ability : abilities) { // abilities that were set to not visible face down must be set to visible again @@ -625,18 +624,18 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ability.setRuleVisible(true); } } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TURNEDFACEUP, getId(), playerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TURNEDFACEUP, getId(), source, playerId)); return true; } return false; } @Override - public boolean turnFaceDown(Game game, UUID playerId) { - GameEvent event = GameEvent.getEvent(GameEvent.EventType.TURNFACEDOWN, getId(), playerId); + public boolean turnFaceDown(Ability source, Game game, UUID playerId) { + GameEvent event = GameEvent.getEvent(GameEvent.EventType.TURNFACEDOWN, getId(), source, playerId); if (!game.replaceEvent(event)) { setFaceDown(true, game); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TURNEDFACEDOWN, getId(), playerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TURNEDFACEDOWN, getId(), source, playerId)); return true; } return false; @@ -729,16 +728,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public boolean addCounters(Counter counter, Ability source, Game game, List appliedEffects, boolean isEffect) { boolean returnCode = true; - UUID sourceId = getId(); - if (source != null) { - MageObject object = game.getObject(source.getId()); - if (object instanceof StackObject) { - sourceId = source.getId(); - } else { - sourceId = source.getSourceId(); - } - } - GameEvent addingAllEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, sourceId, getControllerOrOwner(), counter.getName(), counter.getCount()); + GameEvent addingAllEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, source, getControllerOrOwner(), counter.getName(), counter.getCount()); addingAllEvent.setAppliedEffects(appliedEffects); addingAllEvent.setFlag(isEffect); if (!game.replaceEvent(addingAllEvent)) { @@ -748,12 +738,12 @@ public abstract class CardImpl extends MageObjectImpl implements Card { for (int i = 0; i < amount; i++) { Counter eventCounter = counter.copy(); eventCounter.remove(eventCounter.getCount() - 1); - GameEvent addingOneEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, sourceId, getControllerOrOwner(), counter.getName(), 1); + GameEvent addingOneEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, source, getControllerOrOwner(), counter.getName(), 1); addingOneEvent.setAppliedEffects(appliedEffects); addingOneEvent.setFlag(isEffectFlag); if (!game.replaceEvent(addingOneEvent)) { getCounters(game).addCounter(eventCounter); - GameEvent addedOneEvent = GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, sourceId, getControllerOrOwner(), counter.getName(), 1); + GameEvent addedOneEvent = GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, source, getControllerOrOwner(), counter.getName(), 1); addedOneEvent.setFlag(addingOneEvent.getFlag()); game.fireEvent(addedOneEvent); } else { @@ -762,7 +752,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } } if (finalAmount > 0) { - GameEvent addedAllEvent = GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, sourceId, getControllerOrOwner(), counter.getName(), amount); + GameEvent addedAllEvent = GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, source, getControllerOrOwner(), counter.getName(), amount); addedAllEvent.setFlag(isEffectFlag); game.fireEvent(addedAllEvent); } @@ -773,27 +763,27 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public void removeCounters(String name, int amount, Game game) { + public void removeCounters(String name, int amount, Ability source, Game game) { int finalAmount = 0; for (int i = 0; i < amount; i++) { if (!getCounters(game).removeCounter(name, 1)) { break; } - GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, getControllerOrOwner()); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, source, getControllerOrOwner()); event.setData(name); game.fireEvent(event); finalAmount++; } - GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTERS_REMOVED, objectId, getControllerOrOwner()); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTERS_REMOVED, objectId, source, getControllerOrOwner()); event.setData(name); event.setAmount(finalAmount); game.fireEvent(event); } @Override - public void removeCounters(Counter counter, Game game) { + public void removeCounters(Counter counter, Ability source, Game game) { if (counter != null) { - removeCounters(counter.getName(), counter.getCount(), game); + removeCounters(counter.getName(), counter.getCount(), source, game); } } @@ -907,17 +897,17 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public boolean addAttachment(UUID permanentId, Game game) { + public boolean addAttachment(UUID permanentId, Ability source, Game game) { if (!this.attachments.contains(permanentId)) { Permanent attachment = game.getPermanent(permanentId); if (attachment == null) { attachment = game.getPermanentEntering(permanentId); } if (attachment != null) { - if (!game.replaceEvent(new GameEvent(GameEvent.EventType.ATTACH, objectId, permanentId, attachment.getControllerId()))) { + if (!game.replaceEvent(new AttachEvent(objectId, attachment, source))) { this.attachments.add(permanentId); - attachment.attachTo(objectId, game); - game.fireEvent(new GameEvent(GameEvent.EventType.ATTACHED, objectId, permanentId, attachment.getControllerId())); + attachment.attachTo(objectId, source, game); + game.fireEvent(new AttachedEvent(objectId, attachment, source)); return true; } } @@ -926,15 +916,15 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public boolean removeAttachment(UUID permanentId, Game game) { + public boolean removeAttachment(UUID permanentId, Ability source, Game game) { if (this.attachments.contains(permanentId)) { Permanent attachment = game.getPermanent(permanentId); if (attachment != null) { attachment.unattach(game); } - if (!game.replaceEvent(new GameEvent(GameEvent.EventType.UNATTACH, objectId, permanentId, attachment != null ? attachment.getControllerId() : null))) { + if (!game.replaceEvent(new UnattachEvent(objectId, permanentId, attachment, source))) { this.attachments.remove(permanentId); - game.fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, objectId, permanentId, attachment != null ? attachment.getControllerId() : null)); + game.fireEvent(new UnattachedEvent(objectId, permanentId, attachment, source)); return true; } } diff --git a/Mage/src/main/java/mage/cards/MeldCard.java b/Mage/src/main/java/mage/cards/MeldCard.java index ece76ef521e..abd03edf088 100644 --- a/Mage/src/main/java/mage/cards/MeldCard.java +++ b/Mage/src/main/java/mage/cards/MeldCard.java @@ -138,9 +138,9 @@ public abstract class MeldCard extends CardImpl { } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { // TODO: missing override method for meld cards? See removeFromZone, updateZoneChangeCounter, etc - return super.moveToZone(toZone, sourceId, game, flag, appliedEffects); + return super.moveToZone(toZone, source, game, flag, appliedEffects); } @Override @@ -150,26 +150,26 @@ public abstract class MeldCard extends CardImpl { } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { // TODO: missing override method for meld cards? See removeFromZone, updateZoneChangeCounter, etc - return super.moveToExile(exileId, name, sourceId, game, appliedEffects); + return super.moveToExile(exileId, name, source, game, appliedEffects); } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { if (isCopy()) { - return super.removeFromZone(game, fromZone, sourceId); + return super.removeFromZone(game, fromZone, source); } if (isMelded(game) && fromZone == Zone.BATTLEFIELD) { Permanent permanent = game.getPermanent(objectId); - return permanent != null && permanent.removeFromZone(game, fromZone, sourceId); + return permanent != null && permanent.removeFromZone(game, fromZone, source); } - boolean topRemoved = hasTopHalf(game) && topHalfCard.removeFromZone(game, fromZone, sourceId); + boolean topRemoved = hasTopHalf(game) && topHalfCard.removeFromZone(game, fromZone, source); if (!topRemoved) { // The top half isn't being moved with the pair anymore. halves.remove(topHalfCard); } - boolean bottomRemoved = hasBottomHalf(game) && bottomHalfCard.removeFromZone(game, fromZone, sourceId); + boolean bottomRemoved = hasBottomHalf(game) && bottomHalfCard.removeFromZone(game, fromZone, source); if (!bottomRemoved) { // The bottom half isn't being moved with the pair anymore. halves.remove(bottomHalfCard); diff --git a/Mage/src/main/java/mage/cards/ModalDoubleFacesCard.java b/Mage/src/main/java/mage/cards/ModalDoubleFacesCard.java index 5cccf5bb2fe..94b919b5768 100644 --- a/Mage/src/main/java/mage/cards/ModalDoubleFacesCard.java +++ b/Mage/src/main/java/mage/cards/ModalDoubleFacesCard.java @@ -67,8 +67,8 @@ public abstract class ModalDoubleFacesCard extends CardImpl { } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { - if (super.moveToZone(toZone, sourceId, game, flag, appliedEffects)) { + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { + if (super.moveToZone(toZone, source, game, flag, appliedEffects)) { game.getState().setZone(leftHalfCard.getId(), toZone); game.getState().setZone(rightHalfCard.getId(), toZone); return true; @@ -84,8 +84,8 @@ public abstract class ModalDoubleFacesCard extends CardImpl { } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { - if (super.moveToExile(exileId, name, sourceId, game, appliedEffects)) { + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { + if (super.moveToExile(exileId, name, source, game, appliedEffects)) { Zone currentZone = game.getState().getZone(getId()); game.getState().setZone(leftHalfCard.getId(), currentZone); game.getState().setZone(rightHalfCard.getId(), currentZone); @@ -95,9 +95,9 @@ public abstract class ModalDoubleFacesCard extends CardImpl { } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { // zone contains only one main card - return super.removeFromZone(game, fromZone, sourceId); + return super.removeFromZone(game, fromZone, source); } @Override diff --git a/Mage/src/main/java/mage/cards/ModalDoubleFacesCardHalfImpl.java b/Mage/src/main/java/mage/cards/ModalDoubleFacesCardHalfImpl.java index 475841d928f..762e3ebb522 100644 --- a/Mage/src/main/java/mage/cards/ModalDoubleFacesCardHalfImpl.java +++ b/Mage/src/main/java/mage/cards/ModalDoubleFacesCardHalfImpl.java @@ -1,6 +1,7 @@ package mage.cards; import mage.MageInt; +import mage.abilities.Ability; import mage.constants.CardType; import mage.constants.SpellAbilityType; import mage.constants.SubType; @@ -54,18 +55,18 @@ public class ModalDoubleFacesCardHalfImpl extends CardImpl implements ModalDoubl } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { - return parentCard.moveToZone(toZone, sourceId, game, flag, appliedEffects); + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { + return parentCard.moveToZone(toZone, source, game, flag, appliedEffects); } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { - return parentCard.moveToExile(exileId, name, sourceId, game, appliedEffects); + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { + return parentCard.moveToExile(exileId, name, source, game, appliedEffects); } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { - return parentCard.removeFromZone(game, fromZone, sourceId); + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { + return parentCard.removeFromZone(game, fromZone, source); } @Override diff --git a/Mage/src/main/java/mage/cards/SplitCard.java b/Mage/src/main/java/mage/cards/SplitCard.java index 75298907b4f..694897fe251 100644 --- a/Mage/src/main/java/mage/cards/SplitCard.java +++ b/Mage/src/main/java/mage/cards/SplitCard.java @@ -65,8 +65,8 @@ public abstract class SplitCard extends CardImpl { } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { - if (super.moveToZone(toZone, sourceId, game, flag, appliedEffects)) { + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { + if (super.moveToZone(toZone, source, game, flag, appliedEffects)) { game.getState().setZone(getLeftHalfCard().getId(), toZone); game.getState().setZone(getRightHalfCard().getId(), toZone); return true; @@ -82,8 +82,8 @@ public abstract class SplitCard extends CardImpl { } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { - if (super.moveToExile(exileId, name, sourceId, game, appliedEffects)) { + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { + if (super.moveToExile(exileId, name, source, game, appliedEffects)) { Zone currentZone = game.getState().getZone(getId()); game.getState().setZone(getLeftHalfCard().getId(), currentZone); game.getState().setZone(getRightHalfCard().getId(), currentZone); @@ -93,9 +93,9 @@ public abstract class SplitCard extends CardImpl { } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { // zone contains only one main card - return super.removeFromZone(game, fromZone, sourceId); + return super.removeFromZone(game, fromZone, source); } @Override diff --git a/Mage/src/main/java/mage/cards/SplitCardHalfImpl.java b/Mage/src/main/java/mage/cards/SplitCardHalfImpl.java index a1adb62bb46..28df4f572cc 100644 --- a/Mage/src/main/java/mage/cards/SplitCardHalfImpl.java +++ b/Mage/src/main/java/mage/cards/SplitCardHalfImpl.java @@ -1,5 +1,6 @@ package mage.cards; +import mage.abilities.Ability; import mage.constants.CardType; import mage.constants.SpellAbilityType; import mage.constants.Zone; @@ -46,18 +47,18 @@ public class SplitCardHalfImpl extends CardImpl implements SplitCardHalf { } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { - return splitCardParent.moveToZone(toZone, sourceId, game, flag, appliedEffects); + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { + return splitCardParent.moveToZone(toZone, source, game, flag, appliedEffects); } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { - return splitCardParent.moveToExile(exileId, name, sourceId, game, appliedEffects); + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { + return splitCardParent.moveToExile(exileId, name, source, game, appliedEffects); } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { - return splitCardParent.removeFromZone(game, fromZone, sourceId); + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { + return splitCardParent.removeFromZone(game, fromZone, source); } @Override diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java index fc919486d04..852f4885352 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java @@ -18,7 +18,7 @@ public class CanBeEnchantedByPredicate implements Predicate { @Override public boolean apply(Permanent input, Game game) { - return !input.cantBeAttachedBy(auraEnchantment, game, true); + return !input.cantBeAttachedBy(auraEnchantment, null, game, true); } @Override diff --git a/Mage/src/main/java/mage/game/Game.java b/Mage/src/main/java/mage/game/Game.java index 8a3a983ea46..efe08cc0046 100644 --- a/Mage/src/main/java/mage/game/Game.java +++ b/Mage/src/main/java/mage/game/Game.java @@ -361,7 +361,12 @@ public interface Game extends MageItem, Serializable { void undo(UUID playerId); - void emptyManaPools(); + /** + * Empty mana pool with mana burn and life lose checks + * + * @param source must be null for default game events + */ + void emptyManaPools(Ability source); void addEffect(ContinuousEffect continuousEffect, Ability source); @@ -420,7 +425,7 @@ public interface Game extends MageItem, Serializable { boolean endTurn(Ability source); - int doAction(MageAction action, UUID sourceId); + int doAction(Ability source, MageAction action); //game transaction methods void saveState(boolean bookmark); @@ -448,7 +453,7 @@ public interface Game extends MageItem, Serializable { // game cheats (for tests only) void cheat(UUID ownerId, Map commands); - void cheat(UUID ownerId, UUID activePlayerId, List library, List hand, List battlefield, List graveyard, List command); + void cheat(UUID ownerId, List library, List hand, List battlefield, List graveyard, List command); // controlling the behaviour of replacement effects while permanents entering the battlefield void setScopeRelevant(boolean scopeRelevant); @@ -486,9 +491,9 @@ public interface Game extends MageItem, Serializable { void setMonarchId(Ability source, UUID monarchId); - int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable); + int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable); - int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List appliedEffects); + int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List appliedEffects); Mulligan getMulligan(); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 88d73500bdb..3b24c52b999 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -6,12 +6,14 @@ import mage.abilities.*; import mage.abilities.common.AttachableToRestrictedAbility; import mage.abilities.common.CantHaveMoreThanAmountCountersSourceAbility; import mage.abilities.common.SagaAbility; +import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.delayed.ReflexiveTriggeredAbility; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffects; import mage.abilities.effects.Effect; import mage.abilities.effects.PreventionEffectData; import mage.abilities.effects.common.CopyEffect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.keyword.BestowAbility; import mage.abilities.keyword.CompanionAbility; import mage.abilities.keyword.MorphAbility; @@ -1069,7 +1071,7 @@ public abstract class GameImpl implements Game, Serializable { Player player = getPlayer(playerId); Cards cardsWithOpeningAction = new CardsImpl(); for (Card card : player.getHand().getCards(this)) { - for (Ability ability : card.getAbilities()) { + for (Ability ability : card.getAbilities(this)) { if (ability instanceof OpeningHandAction) { OpeningHandAction action = (OpeningHandAction) ability; if (action.isOpeningHandActionAllowed(card, player, this)) { @@ -1088,7 +1090,7 @@ public abstract class GameImpl implements Game, Serializable { card = cardsWithOpeningAction.getRandom(this); } if (card != null) { - for (Ability ability : card.getAbilities()) { + for (Ability ability : card.getAbilities(this)) { if (ability instanceof OpeningHandAction) { OpeningHandAction action = (OpeningHandAction) ability; if (action.askUseOpeningHandAction(card, player, this)) { @@ -1541,11 +1543,11 @@ public abstract class GameImpl implements Game, Serializable { } @Override - public void emptyManaPools() { + public void emptyManaPools(Ability source) { for (Player player : getPlayers().values()) { int amount = player.getManaPool().emptyPool(this); if (state.isManaBurn() && amount > 0) { - player.loseLife(amount, this, false); + player.loseLife(amount, this, source, false); } } } @@ -1783,7 +1785,7 @@ public abstract class GameImpl implements Game, Serializable { @Override public UUID fireReflexiveTriggeredAbility(ReflexiveTriggeredAbility reflexiveAbility, Ability source) { UUID uuid = this.addDelayedTriggeredAbility(reflexiveAbility, source); - this.fireEvent(GameEvent.getEvent(GameEvent.EventType.OPTION_USED, source.getOriginalId(), source.getSourceId(), source.getControllerId())); + this.fireEvent(GameEvent.getEvent(GameEvent.EventType.OPTION_USED, source.getOriginalId(), source, source.getControllerId())); return uuid; } @@ -2088,8 +2090,8 @@ public abstract class GameImpl implements Game, Serializable { Card card = this.getCard(perm.getId()); if (card != null && card.isCreature()) { UUID wasAttachedTo = perm.getAttachedTo(); - perm.attachTo(null, this); - fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId())); + perm.attachTo(null, null, this); + fireEvent(new UnattachedEvent(wasAttachedTo, perm.getId(), perm, null)); } else if (movePermanentToGraveyardWithInfo(perm)) { somethingHappened = true; } @@ -2097,19 +2099,19 @@ public abstract class GameImpl implements Game, Serializable { Filter auraFilter = spellAbility.getTargets().get(0).getFilter(); if (auraFilter instanceof FilterControlledPermanent) { if (!((FilterControlledPermanent) auraFilter).match(attachedTo, perm.getId(), perm.getControllerId(), this) - || attachedTo.cantBeAttachedBy(perm, this, true)) { + || attachedTo.cantBeAttachedBy(perm, null, this, true)) { if (movePermanentToGraveyardWithInfo(perm)) { somethingHappened = true; } } - } else if (!auraFilter.match(attachedTo, this) || attachedTo.cantBeAttachedBy(perm, this, true)) { + } else if (!auraFilter.match(attachedTo, this) || attachedTo.cantBeAttachedBy(perm, null, this, true)) { // handle bestow unattachment Card card = this.getCard(perm.getId()); if (card != null && card.isCreature()) { UUID wasAttachedTo = perm.getAttachedTo(); - perm.attachTo(null, this); + perm.attachTo(null, null, this); BestowAbility.becomeCreature(perm, this); - fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId())); + fireEvent(new UnattachedEvent(wasAttachedTo, perm.getId(), perm, null)); } else if (movePermanentToGraveyardWithInfo(perm)) { somethingHappened = true; } @@ -2135,7 +2137,7 @@ public abstract class GameImpl implements Game, Serializable { || !(spellAbility.getTargets().get(0)).canTarget(perm.getControllerId(), perm.getAttachedTo(), spellAbility, this)) { if (movePermanentToGraveyardWithInfo(perm)) { if (attachedTo != null) { - attachedTo.removeAttachment(perm.getId(), this); + attachedTo.removeAttachment(perm.getId(), null, this); } somethingHappened = true; } @@ -2169,7 +2171,7 @@ public abstract class GameImpl implements Game, Serializable { } if (noChapterAbilityTriggeredOrOnStack) { // After the last chapter ability has left the stack, you'll sacrifice the Saga - perm.sacrifice(perm.getId(), this); + perm.sacrifice(null, this); somethingHappened = true; } } @@ -2196,10 +2198,10 @@ public abstract class GameImpl implements Game, Serializable { } if (attachedTo == null || !attachedTo.getAttachments().contains(perm.getId())) { UUID wasAttachedTo = perm.getAttachedTo(); - perm.attachTo(null, this); - fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId())); + perm.attachTo(null, null, this); + fireEvent(new UnattachedEvent(wasAttachedTo, perm.getId(), perm, null)); } else if (!attachedTo.isCreature() || attachedTo.hasProtectionFrom(perm, this)) { - if (attachedTo.removeAttachment(perm.getId(), this)) { + if (attachedTo.removeAttachment(perm.getId(), null, this)) { somethingHappened = true; } } @@ -2209,16 +2211,16 @@ public abstract class GameImpl implements Game, Serializable { if (perm.getAttachedTo() != null) { Permanent land = getPermanent(perm.getAttachedTo()); if (land == null || !land.getAttachments().contains(perm.getId())) { - perm.attachTo(null, this); + perm.attachTo(null, null, this); } else if (!land.isLand() || land.hasProtectionFrom(perm, this)) { - if (land.removeAttachment(perm.getId(), this)) { + if (land.removeAttachment(perm.getId(), null, this)) { somethingHappened = true; } } } } //20091005 - 704.5q If a creature is attached to an object or player, it becomes unattached and remains on the battlefield. - // Similarly, if a permanent that’s neither an Aura, an Equipment, nor a Fortification is attached to an object or player, + // Similarly, if a permanent that's neither an Aura, an Equipment, nor a Fortification is attached to an object or player, // it becomes unattached and remains on the battlefield. if (!perm.getAttachments().isEmpty()) { for (UUID attachmentId : perm.getAttachments()) { @@ -2228,7 +2230,7 @@ public abstract class GameImpl implements Game, Serializable { || !(attachment.getSubtype(this).contains(SubType.AURA) || attachment.getSubtype(this).contains(SubType.EQUIPMENT) || attachment.getSubtype(this).contains(SubType.FORTIFICATION)))) { - if (perm.removeAttachment(attachment.getId(), this)) { + if (perm.removeAttachment(attachment.getId(), null, this)) { somethingHappened = true; break; } @@ -2253,7 +2255,7 @@ public abstract class GameImpl implements Game, Serializable { CantHaveMoreThanAmountCountersSourceAbility counterAbility = (CantHaveMoreThanAmountCountersSourceAbility) ability; int count = perm.getCounters(this).getCount(counterAbility.getCounterType()); if (count > counterAbility.getAmount()) { - perm.removeCounters(counterAbility.getCounterType().getName(), count - counterAbility.getAmount(), this); + perm.removeCounters(counterAbility.getCounterType().getName(), count - counterAbility.getAmount(), counterAbility, this); somethingHappened = true; } } @@ -2638,11 +2640,11 @@ public abstract class GameImpl implements Game, Serializable { if (perm.getAttachedTo() != null) { Permanent attachedTo = getPermanent(perm.getAttachedTo()); if (attachedTo != null) { - attachedTo.removeAttachment(perm.getId(), this); + attachedTo.removeAttachment(perm.getId(), null, this); } else { Player attachedToPlayer = getPlayer(perm.getAttachedTo()); if (attachedToPlayer != null) { - attachedToPlayer.removeAttachment(perm, this); + attachedToPlayer.removeAttachment(perm, null, this); } } } @@ -2814,7 +2816,7 @@ public abstract class GameImpl implements Game, Serializable { return result; } DamageEvent damageEvent = (DamageEvent) event; - GameEvent preventEvent = new PreventDamageEvent(damageEvent.getTargetId(), damageEvent.getSourceId(), source.getControllerId(), damageEvent.getAmount(), damageEvent.isCombatDamage()); + GameEvent preventEvent = new PreventDamageEvent(damageEvent.getTargetId(), damageEvent.getSourceId(), source, source.getControllerId(), damageEvent.getAmount(), damageEvent.isCombatDamage()); if (game.replaceEvent(preventEvent)) { result.setReplaced(true); return result; @@ -2855,7 +2857,7 @@ public abstract class GameImpl implements Game, Serializable { game.informPlayers(message.toString()); } } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, damageEvent.getTargetId(), source.getSourceId(), source.getControllerId(), result.getPreventedDamage())); + game.fireEvent(new PreventedDamageEvent(damageEvent.getTargetId(), source.getSourceId(), source, source.getControllerId(), result.getPreventedDamage())); return result; } @@ -3039,7 +3041,7 @@ public abstract class GameImpl implements Game, Serializable { if (s.length == 2) { try { Integer amount = Integer.parseInt(s[1]); - player.setLife(amount, this, ownerId); + player.setLife(amount, this, null); logger.debug("Setting player's life: "); } catch (NumberFormatException e) { logger.fatal("error setting life", e); @@ -3060,7 +3062,11 @@ public abstract class GameImpl implements Game, Serializable { } @Override - public void cheat(UUID ownerId, UUID activePlayerId, List library, List hand, List battlefield, List graveyard, List command) { + public void cheat(UUID ownerId, List library, List hand, List battlefield, List graveyard, List command) { + // fake test ability for triggers and events + Ability fakeSourceAbility = new SimpleStaticAbility(Zone.OUTSIDE, new InfoEffect("adding testing cards")); + fakeSourceAbility.setControllerId(ownerId); + Player player = getPlayer(ownerId); if (player != null) { loadCards(ownerId, library); @@ -3094,7 +3100,7 @@ public abstract class GameImpl implements Game, Serializable { } for (PermanentCard permanentCard : battlefield) { - CardUtil.putCardOntoBattlefieldWithEffects(this, permanentCard, player); + CardUtil.putCardOntoBattlefieldWithEffects(fakeSourceAbility, this, permanentCard, player); } applyEffects(); @@ -3116,11 +3122,8 @@ public abstract class GameImpl implements Game, Serializable { } @Override - public int doAction(MageAction action, UUID sourceId) { - //actions.add(action); - int value = action.doAction(sourceId, this); -// score += action.getScore(scorePlayer); - return value; + public int doAction(Ability source, MageAction action) { + return action.doAction(source, this); } @Override @@ -3370,10 +3373,7 @@ public abstract class GameImpl implements Game, Serializable { if (monarchId.equals(getMonarchId())) { // Nothing happens if you're already the monarch return; } - if (replaceEvent(GameEvent.getEvent( - GameEvent.EventType.BECOME_MONARCH, - monarchId, source.getSourceId(), monarchId - ))) { + if (replaceEvent(GameEvent.getEvent(GameEvent.EventType.BECOME_MONARCH, monarchId, source, monarchId))) { return; } Player newMonarch = getPlayer(monarchId); @@ -3383,24 +3383,24 @@ public abstract class GameImpl implements Game, Serializable { if (newMonarch != null) { getState().setMonarchId(monarchId); informPlayers(newMonarch.getLogName() + " is the monarch"); - fireEvent(new GameEvent(GameEvent.EventType.BECOMES_MONARCH, monarchId, source == null ? null : source.getSourceId(), monarchId)); + fireEvent(new GameEvent(GameEvent.EventType.BECOMES_MONARCH, monarchId, source, monarchId)); } } @Override - public int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) { - return damagePlayerOrPlaneswalker(playerOrWalker, damage, sourceId, game, combatDamage, preventable, null); + public int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable) { + return damagePlayerOrPlaneswalker(playerOrWalker, damage, attackerId, source, game, combatDamage, preventable, null); } @Override - public int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { + public int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { Player player = getPlayer(playerOrWalker); if (player != null) { - return player.damage(damage, sourceId, game, combatDamage, preventable, appliedEffects); + return player.damage(damage, attackerId, source, game, combatDamage, preventable, appliedEffects); } Permanent permanent = getPermanent(playerOrWalker); if (permanent != null) { - return permanent.damage(damage, sourceId, game, combatDamage, preventable, appliedEffects); + return permanent.damage(damage, attackerId, source, game, combatDamage, preventable, appliedEffects); } return 0; } diff --git a/Mage/src/main/java/mage/game/ZoneChangeInfo.java b/Mage/src/main/java/mage/game/ZoneChangeInfo.java index fa5ab517776..06420112fda 100644 --- a/Mage/src/main/java/mage/game/ZoneChangeInfo.java +++ b/Mage/src/main/java/mage/game/ZoneChangeInfo.java @@ -3,6 +3,8 @@ package mage.game; import java.util.ArrayList; import java.util.List; import java.util.UUID; + +import mage.abilities.Ability; import mage.cards.MeldCard; import mage.game.events.ZoneChangeEvent; import mage.game.stack.Spell; @@ -91,20 +93,24 @@ public class ZoneChangeInfo { public static class Battlefield extends ZoneChangeInfo { public boolean tapped; + public Ability source; - public Battlefield(ZoneChangeEvent event, boolean tapped) { + public Battlefield(ZoneChangeEvent event, boolean tapped, Ability source) { super(event); this.tapped = tapped; + this.source = source; } - public Battlefield(ZoneChangeEvent event, boolean faceDown, boolean tapped) { + public Battlefield(ZoneChangeEvent event, boolean faceDown, boolean tapped, Ability source) { super(event, faceDown); this.tapped = tapped; + this.source = source; } public Battlefield(final Battlefield info) { super(info); this.tapped = info.tapped; + this.source = info.source; } @Override @@ -147,14 +153,14 @@ public class ZoneChangeInfo { MeldCard meld = game.getMeldCard(info.event.getTargetId()); if (meld != null) { if (meld.hasTopHalf(game)) { - ZoneChangeEvent topEvent = new ZoneChangeEvent(meld.getTopHalfCard().getId(), event.getSourceId(), + ZoneChangeEvent topEvent = new ZoneChangeEvent(meld.getTopHalfCard().getId(), event.getSource(), event.getPlayerId(), event.getFromZone(), event.getToZone(), event.getAppliedEffects()); ZoneChangeInfo topInfo = info.copy(); topInfo.event = topEvent; subInfo.add(topInfo); } if (meld.hasBottomHalf(game)) { - ZoneChangeEvent bottomEvent = new ZoneChangeEvent(meld.getBottomHalfCard().getId(), event.getSourceId(), + ZoneChangeEvent bottomEvent = new ZoneChangeEvent(meld.getBottomHalfCard().getId(), event.getSource(), event.getPlayerId(), event.getFromZone(), event.getToZone(), event.getAppliedEffects()); ZoneChangeInfo bottomInfo = info.copy(); bottomInfo.event = bottomEvent; diff --git a/Mage/src/main/java/mage/game/ZonesHandler.java b/Mage/src/main/java/mage/game/ZonesHandler.java index 8b5f6090c93..40b5bef679d 100644 --- a/Mage/src/main/java/mage/game/ZonesHandler.java +++ b/Mage/src/main/java/mage/game/ZonesHandler.java @@ -1,5 +1,6 @@ package mage.game; +import mage.abilities.Ability; import mage.abilities.keyword.TransformAbility; import mage.cards.*; import mage.constants.Outcome; @@ -23,8 +24,8 @@ import java.util.*; */ public final class ZonesHandler { - public static boolean cast(ZoneChangeInfo info, Game game) { - if (maybeRemoveFromSourceZone(info, game)) { + public static boolean cast(ZoneChangeInfo info, Game game, Ability source) { + if (maybeRemoveFromSourceZone(info, game, source)) { placeInDestinationZone(info, game, 0); // create a group zone change event if a card is moved to stack for casting (it's always only one card, but some effects check for group events (one or more xxx)) Set cards = new HashSet<>(); @@ -43,13 +44,13 @@ public final class ZonesHandler { return false; } - public static boolean moveCard(ZoneChangeInfo info, Game game) { + public static boolean moveCard(ZoneChangeInfo info, Game game, Ability source) { List list = new ArrayList<>(); list.add(info); - return !moveCards(list, game).isEmpty(); + return !moveCards(list, game, source).isEmpty(); } - public static List moveCards(List zoneChangeInfos, Game game) { + public static List moveCards(List zoneChangeInfos, Game game, Ability source) { // Handle Unmelded Meld Cards for (ListIterator itr = zoneChangeInfos.listIterator(); itr.hasNext(); ) { ZoneChangeInfo info = itr.next(); @@ -75,13 +76,17 @@ public final class ZonesHandler { ZoneChangeInfo info = itr.next(); if (info.event.getToZone().equals(Zone.BATTLEFIELD)) { Card card = game.getCard(info.event.getTargetId()); + if (card instanceof ModalDoubleFacesCard || card instanceof ModalDoubleFacesCardHalf) { + System.out.println("!"); // TODO: remove after mdf test fixes + } + if (card instanceof ModalDoubleFacesCard) { info.event.setTargetId(((ModalDoubleFacesCard) card).getLeftHalfCard().getId()); } } } - zoneChangeInfos.removeIf(zoneChangeInfo -> !maybeRemoveFromSourceZone(zoneChangeInfo, game)); + zoneChangeInfos.removeIf(zoneChangeInfo -> !maybeRemoveFromSourceZone(zoneChangeInfo, game, source)); int createOrder = 0; for (ZoneChangeInfo zoneChangeInfo : zoneChangeInfos) { if (createOrder == 0 && Zone.BATTLEFIELD.equals(zoneChangeInfo.event.getToZone())) { @@ -270,14 +275,16 @@ public final class ZonesHandler { return game.getPermanent(targetId); } - private static boolean maybeRemoveFromSourceZone(ZoneChangeInfo info, Game game) { + private static boolean maybeRemoveFromSourceZone(ZoneChangeInfo info, Game game, Ability source) { + ZoneChangeEvent event = info.event; + // Handle Unmelded Cards if (info instanceof ZoneChangeInfo.Unmelded) { ZoneChangeInfo.Unmelded unmelded = (ZoneChangeInfo.Unmelded) info; - MeldCard meld = game.getMeldCard(info.event.getTargetId()); + MeldCard meld = game.getMeldCard(event.getTargetId()); for (Iterator itr = unmelded.subInfo.iterator(); itr.hasNext(); ) { ZoneChangeInfo subInfo = itr.next(); - if (!maybeRemoveFromSourceZone(subInfo, game)) { + if (!maybeRemoveFromSourceZone(subInfo, game, source)) { itr.remove(); } else if (Objects.equals(subInfo.event.getTargetId(), meld.getTopHalfCard().getId())) { meld.setTopLastZoneChangeCounter(meld.getTopHalfCard().getZoneChangeCounter(game)); @@ -294,7 +301,6 @@ public final class ZonesHandler { } // Handle all normal cases - ZoneChangeEvent event = info.event; Card card = getTargetCard(game, event.getTargetId()); if (card == null) { // If we can't find the card we can't remove it. @@ -304,7 +310,7 @@ public final class ZonesHandler { boolean success = false; if (info.faceDown) { card.setFaceDown(true, game); - } else if (info.event.getToZone().equals(Zone.BATTLEFIELD)) { + } else if (event.getToZone().equals(Zone.BATTLEFIELD)) { if (!card.isPermanent() && (!card.isTransformable() || Boolean.FALSE.equals(game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId())))) { // Non permanents (Instants, Sorceries, ... stay in the zone they are if an abilty/effect tries to move it to the battlefield @@ -332,7 +338,7 @@ public final class ZonesHandler { // put onto battlefield with possible counters game.getPermanentsEntering().put(permanent.getId(), permanent); - card.checkForCountersToAdd(permanent, game); + card.checkForCountersToAdd(permanent, source, game); permanent.setTapped(info instanceof ZoneChangeInfo.Battlefield && ((ZoneChangeInfo.Battlefield) info).tapped); @@ -344,8 +350,8 @@ public final class ZonesHandler { // make sure the controller of all continuous effects of this card are switched to the current controller game.setScopeRelevant(true); game.getContinuousEffects().setController(permanent.getId(), permanent.getControllerId()); - if (permanent.entersBattlefield(event.getSourceId(), game, fromZone, true) - && card.removeFromZone(game, fromZone, event.getSourceId())) { + if (permanent.entersBattlefield(source, game, fromZone, true) + && card.removeFromZone(game, fromZone, source)) { success = true; event.setTarget(permanent); } else { @@ -357,11 +363,11 @@ public final class ZonesHandler { } else if (event.getTarget() != null) { card.setFaceDown(info.faceDown, game); Permanent target = event.getTarget(); - success = game.getPlayer(target.getControllerId()).removeFromBattlefield(target, game) - && target.removeFromZone(game, fromZone, event.getSourceId()); + success = game.getPlayer(target.getControllerId()).removeFromBattlefield(target, source, game) + && target.removeFromZone(game, fromZone, source); } else { card.setFaceDown(info.faceDown, game); - success = card.removeFromZone(game, fromZone, event.getSourceId()); + success = card.removeFromZone(game, fromZone, source); } } if (success) { diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index 892a1f125c3..3784ff1c72a 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -23,6 +23,9 @@ import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.permanent.AttackingSameNotBandedPredicate; import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.game.Game; +import mage.game.events.AttackerDeclaredEvent; +import mage.game.events.DeclareAttackerEvent; +import mage.game.events.DeclareBlockerEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -272,13 +275,13 @@ public class Combat implements Serializable, Copyable { Permanent attackingPermanent = game.getPermanent(attacker); if (attackingPermanent != null) { attackingPermanent.setTapped(false); - attackingPermanent.tap(true, game); // to tap with event finally here is needed to prevent abusing of Vampire Envoy like cards + attackingPermanent.tap(true, null, game); // to tap with event finally here is needed to prevent abusing of Vampire Envoy like cards } } handleBanding(attacker, game); // This can only be used to modify the event, the attack can't be replaced here - game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ATTACKER_DECLARED, group.defenderId, attacker, attackingPlayerId)); - game.addSimultaneousEvent(GameEvent.getEvent(GameEvent.EventType.ATTACKER_DECLARED, group.defenderId, attacker, attackingPlayerId)); + game.replaceEvent(new AttackerDeclaredEvent(group.defenderId, attacker, attackingPlayerId)); + game.addSimultaneousEvent(new AttackerDeclaredEvent(group.defenderId, attacker, attackingPlayerId)); } } attackersTappedByAttack.clear(); @@ -287,7 +290,11 @@ public class Combat implements Serializable, Copyable { if (!game.isSimulation()) { Player player = game.getPlayer(attackingPlayerId); if (player != null) { - game.informPlayers(player.getLogName() + " attacks with " + groups.size() + (groups.size() == 1 ? " creature" : " creatures")); + if (groups.size() > 0) { + game.informPlayers(player.getLogName() + " attacks with " + groups.size() + (groups.size() == 1 ? " creature" : " creatures")); + } else { + game.informPlayers(player.getLogName() + " skip attack"); + } } } } @@ -452,8 +459,7 @@ public class Combat implements Serializable, Copyable { Set defendersCostlessAttackable = new HashSet<>(defenders); for (UUID defenderId : defenders) { if (game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects( - GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, - defenderId, creature.getId(), creature.getControllerId()), game)) { + new DeclareAttackerEvent(defenderId, creature.getId(), creature.getControllerId()), game)) { defendersCostlessAttackable.remove(defenderId); defendersForcedToAttack.remove(defenderId); } @@ -550,13 +556,13 @@ public class Combat implements Serializable, Copyable { public void selectBlockers(Game game) { if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARING_BLOCKERS, attackingPlayerId, attackingPlayerId))) { - game.getCombat().selectBlockers(null, game); + game.getCombat().selectBlockers(null, null, game); } for (UUID attackingCreatureID : game.getCombat().getAttackers()) { Permanent permanent = game.getPermanent(attackingCreatureID); CombatGroup group = game.getCombat().findGroup(attackingCreatureID); if (permanent != null && group != null && !group.getBlocked()) { - game.fireEvent(GameEvent.getEvent(EventType.UNBLOCKED_ATTACKER, attackingCreatureID, attackingPlayerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.UNBLOCKED_ATTACKER, attackingCreatureID, attackingPlayerId)); } } } @@ -568,7 +574,7 @@ public class Combat implements Serializable, Copyable { * defender is the controller * @param game */ - public void selectBlockers(Player blockController, Game game) { + public void selectBlockers(Player blockController, Ability source, Game game) { Player attacker = game.getPlayer(attackingPlayerId); //20101001 - 509.1c game.getCombat().retrieveMustBlockAttackerRequirements(attacker, game); @@ -583,7 +589,7 @@ public class Combat implements Serializable, Copyable { controller = blockController; } while (choose) { - controller.selectBlockers(game, defenderId); + controller.selectBlockers(source, game, defenderId); if (game.isPaused() || game.checkIfGameIsOver() || game.executingRollback()) { return; } @@ -613,7 +619,7 @@ public class Combat implements Serializable, Copyable { * Add info about attacker blocked by blocker to the game log */ private void logBlockerInfo(Player defender, Game game) { - boolean shownDefendingPlayer = game.getPlayers().size() < 3; // only two players no ned to sow the attacked player + boolean shownDefendingPlayer = game.getPlayers().size() < 3; // only two players no need to saw the attacked player for (CombatGroup group : game.getCombat().getGroups()) { if (group.defendingPlayerId.equals(defender.getId())) { if (!shownDefendingPlayer) { @@ -719,7 +725,7 @@ public class Combat implements Serializable, Copyable { } // check if the possible blocker has to pay cost to block, if so don't force if (game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects( - GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKER, attackingCreatureId, possibleBlocker.getId(), possibleBlocker.getControllerId()), game)) { + new DeclareBlockerEvent(attackingCreatureId, possibleBlocker.getId(), possibleBlocker.getControllerId()), game)) { // has cost to block to pay so remove this attacker continue; } @@ -1291,7 +1297,7 @@ public class Combat implements Serializable, Copyable { public boolean declareAttacker(UUID creatureId, UUID defenderId, UUID playerId, Game game) { Permanent attacker = game.getPermanent(creatureId); if (attacker != null) { - if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, defenderId, creatureId, playerId))) { + if (!game.replaceEvent(new DeclareAttackerEvent(defenderId, creatureId, playerId))) { if (addAttackerToCombat(creatureId, defenderId, game)) { if (!attacker.hasAbility(VigilanceAbility.getInstance(), game) && !attacker.hasAbility(JohanVigilanceAbility.getInstance(), game)) { diff --git a/Mage/src/main/java/mage/game/combat/CombatGroup.java b/Mage/src/main/java/mage/game/combat/CombatGroup.java index 616eebe7726..7f95c77a3a0 100644 --- a/Mage/src/main/java/mage/game/combat/CombatGroup.java +++ b/Mage/src/main/java/mage/game/combat/CombatGroup.java @@ -10,6 +10,8 @@ import mage.constants.Outcome; import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; +import mage.game.events.BlockerDeclaredEvent; +import mage.game.events.DeclareBlockerEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -266,23 +268,23 @@ public class CombatGroup implements Serializable, Copyable { if (hasTrample(attacker)) { int lethalDamage = getLethalDamage(blocker, attacker, game); if (lethalDamage >= damage) { - blocker.markDamage(damage, attacker.getId(), game, true, true); + blocker.markDamage(damage, attacker.getId(), null, game, true, true); } else { int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game); - blocker.markDamage(damageAssigned, attacker.getId(), game, true, true); + blocker.markDamage(damageAssigned, attacker.getId(), null, game, true, true); damage -= damageAssigned; if (damage > 0) { defenderDamage(attacker, damage, game); } } } else { - blocker.markDamage(damage, attacker.getId(), game, true, true); + blocker.markDamage(damage, attacker.getId(), null, game, true, true); } } if (canDamage(blocker, first)) { if (checkSoleBlockerAfter(blocker, game)) { // blocking several creatures handled separately if (!assignsDefendingPlayerAndOrDefendingCreaturesDividedDamage(blocker, blocker.getControllerId(), first, game, false)) { - attacker.markDamage(blockerDamage, blocker.getId(), game, true, true); + attacker.markDamage(blockerDamage, blocker.getId(), null, game, true, true); } } } @@ -349,20 +351,20 @@ public class CombatGroup implements Serializable, Copyable { // might be missing canDamage condition? Permanent blocker = game.getPermanent(blockerId); if (!assignsDefendingPlayerAndOrDefendingCreaturesDividedDamage(blocker, blocker.getControllerId(), first, game, false)) { - attacker.markDamage(power, blockerId, game, true, true); + attacker.markDamage(power, blockerId, null, game, true, true); } } } for (Map.Entry entry : assigned.entrySet()) { Permanent blocker = game.getPermanent(entry.getKey()); - blocker.markDamage(entry.getValue(), attacker.getId(), game, true, true); + blocker.markDamage(entry.getValue(), attacker.getId(), null, game, true, true); } } else { for (UUID blockerId : blockerOrder) { Permanent blocker = game.getPermanent(blockerId); if (canDamage(blocker, first)) { if (!assignsDefendingPlayerAndOrDefendingCreaturesDividedDamage(blocker, blocker.getControllerId(), first, game, false)) { - attacker.markDamage(getDamageValueFromPermanent(blocker, game), blocker.getId(), game, true, true); + attacker.markDamage(getDamageValueFromPermanent(blocker, game), blocker.getId(), null, game, true, true); } } } @@ -402,7 +404,7 @@ public class CombatGroup implements Serializable, Copyable { if (damage > 0) { Player defendingPlayer = game.getPlayer(defendingPlayerId); if (defendingPlayer != null) { - defendingPlayer.damage(damage, attacker.getId(), game, true, true); + defendingPlayer.damage(damage, attacker.getId(), null, game, true, true); } } if (isAttacking) { @@ -412,14 +414,14 @@ public class CombatGroup implements Serializable, Copyable { // might be missing canDamage condition? Permanent blocker = game.getPermanent(blockerId); if (!assignsDefendingPlayerAndOrDefendingCreaturesDividedDamage(blocker, blocker.getControllerId(), first, game, false)) { - attacker.markDamage(power, blockerId, game, true, true); + attacker.markDamage(power, blockerId, null, game, true, true); } } } } for (Map.Entry entry : assigned.entrySet()) { Permanent defendingCreature = game.getPermanent(entry.getKey()); - defendingCreature.markDamage(entry.getValue(), attacker.getId(), game, true, true); + defendingCreature.markDamage(entry.getValue(), attacker.getId(), null, game, true, true); } } else { if (isAttacking) { @@ -427,7 +429,7 @@ public class CombatGroup implements Serializable, Copyable { Permanent blocker = game.getPermanent(blockerId); if (canDamage(blocker, first)) { if (!assignsDefendingPlayerAndOrDefendingCreaturesDividedDamage(blocker, blocker.getControllerId(), first, game, false)) { - attacker.markDamage(getDamageValueFromPermanent(blocker, game), blocker.getId(), game, true, true); + attacker.markDamage(getDamageValueFromPermanent(blocker, game), blocker.getId(), null, game, true, true); } } } @@ -475,7 +477,7 @@ public class CombatGroup implements Serializable, Copyable { if (blocker != null && attacker != null) { if (canDamage(blocker, first)) { int damage = getDamageValueFromPermanent(blocker, game); - attacker.markDamage(damage, blocker.getId(), game, true, true); + attacker.markDamage(damage, blocker.getId(), null, game, true, true); } } } @@ -531,7 +533,7 @@ public class CombatGroup implements Serializable, Copyable { for (Map.Entry entry : assigned.entrySet()) { Permanent attacker = game.getPermanent(entry.getKey()); - attacker.markDamage(entry.getValue(), blocker.getId(), game, true, true); + attacker.markDamage(entry.getValue(), blocker.getId(), null, game, true, true); } } } @@ -540,12 +542,12 @@ public class CombatGroup implements Serializable, Copyable { if (this.defenderIsPlaneswalker) { Permanent defender = game.getPermanent(defenderId); if (defender != null) { - defender.markDamage(amount, attacker.getId(), game, true, true); + defender.markDamage(amount, attacker.getId(), null, game, true, true); } } else { Player defender = game.getPlayer(defenderId); if (defender != null) { - defender.damage(amount, attacker.getId(), game, true, true); + defender.damage(amount, attacker.getId(), null, game, true, true); } } } @@ -570,7 +572,7 @@ public class CombatGroup implements Serializable, Copyable { */ public void addBlocker(UUID blockerId, UUID playerId, Game game) { for (UUID attackerId : attackers) { - if (game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKER, attackerId, blockerId, playerId))) { + if (game.replaceEvent(new DeclareBlockerEvent(attackerId, blockerId, playerId))) { return; } } @@ -690,7 +692,7 @@ public class CombatGroup implements Serializable, Copyable { } for (UUID blockerId : blockers) { for (UUID attackerId : attackers) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BLOCKER_DECLARED, attackerId, blockerId, players.get(blockerId))); + game.fireEvent(new BlockerDeclaredEvent(attackerId, blockerId, players.get(blockerId))); } } diff --git a/Mage/src/main/java/mage/game/command/emblems/DackFaydenEmblem.java b/Mage/src/main/java/mage/game/command/emblems/DackFaydenEmblem.java index 25f7674a4e6..d25fa55bc82 100644 --- a/Mage/src/main/java/mage/game/command/emblems/DackFaydenEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/DackFaydenEmblem.java @@ -54,7 +54,7 @@ class DackFaydenEmblemTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override @@ -137,7 +137,7 @@ class DackFaydenEmblemEffect extends ContinuousEffectImpl { for (UUID permanentId : fixedTargets.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - permanent.changeControllerId(source.getControllerId(), game); + permanent.changeControllerId(source.getControllerId(), game, source); } } return true; diff --git a/Mage/src/main/java/mage/game/command/emblems/DarettiScrapSavantEmblem.java b/Mage/src/main/java/mage/game/command/emblems/DarettiScrapSavantEmblem.java index d9104aa3459..79e17f384af 100644 --- a/Mage/src/main/java/mage/game/command/emblems/DarettiScrapSavantEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/DarettiScrapSavantEmblem.java @@ -50,7 +50,7 @@ class DarettiScrapSavantTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage/src/main/java/mage/game/command/emblems/JayaBallardEmblem.java b/Mage/src/main/java/mage/game/command/emblems/JayaBallardEmblem.java index 8a2c9a21ab6..41da08520cb 100644 --- a/Mage/src/main/java/mage/game/command/emblems/JayaBallardEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/JayaBallardEmblem.java @@ -103,8 +103,7 @@ class JayaBallardReplacementEffect extends ReplacementEffectImpl { if (controller != null) { Card card = (Card) game.getState().getValue("JayaBallard"); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); - return true; + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); } } return false; @@ -112,7 +111,7 @@ class JayaBallardReplacementEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ZONE_CHANGE; + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage/src/main/java/mage/game/command/emblems/MomirEmblem.java b/Mage/src/main/java/mage/game/command/emblems/MomirEmblem.java index a0c9ae89056..20fe58be4b9 100644 --- a/Mage/src/main/java/mage/game/command/emblems/MomirEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/MomirEmblem.java @@ -89,7 +89,7 @@ class MomirEffect extends OneShotEffect { } } if (token != null) { - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false); + token.putOntoBattlefield(1, game, source, source.getControllerId(), false, false); return true; } diff --git a/Mage/src/main/java/mage/game/command/emblems/ObNixilisReignitedEmblem.java b/Mage/src/main/java/mage/game/command/emblems/ObNixilisReignitedEmblem.java index 6535e7f3bb2..8011d7c1005 100644 --- a/Mage/src/main/java/mage/game/command/emblems/ObNixilisReignitedEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/ObNixilisReignitedEmblem.java @@ -36,7 +36,7 @@ class ObNixilisEmblemTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DREW_CARD; + return event.getType() == GameEvent.EventType.DREW_CARD; } @Override diff --git a/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java b/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java index d83899e6c35..c3c570a4d5c 100644 --- a/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java @@ -56,7 +56,7 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; + return event.getType() == GameEvent.EventType.SPELL_CAST; } @Override diff --git a/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java b/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java index c5fce051a74..f948bab2a5d 100644 --- a/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java @@ -94,7 +94,7 @@ class DrawCardsActivePlayerEffect extends OneShotEffect { } Player player = game.getPlayer(game.getActivePlayerId()); if (player != null) { - player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game); + player.drawCards(amount.calculate(game, source, this), source, game); return true; } return false; diff --git a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java index 60ce3e1e882..06d74f100a1 100644 --- a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java @@ -84,7 +84,7 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java b/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java index 54691deffa6..af7024ca634 100644 --- a/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java @@ -76,7 +76,7 @@ class PanopticonTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.PLANESWALKED; + return event.getType() == GameEvent.EventType.PLANESWALKED; } @Override diff --git a/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java b/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java index c93b9b99523..76e463e3071 100644 --- a/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java @@ -82,7 +82,7 @@ class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage/src/main/java/mage/game/events/AttachEvent.java b/Mage/src/main/java/mage/game/events/AttachEvent.java new file mode 100644 index 00000000000..a6b423f119e --- /dev/null +++ b/Mage/src/main/java/mage/game/events/AttachEvent.java @@ -0,0 +1,17 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class AttachEvent extends GameEvent { + + public AttachEvent(UUID targetPermanentId, Permanent attachment, Ability source) { + super(GameEvent.EventType.ATTACH, targetPermanentId, null, attachment.getControllerId()); + this.setSourceId(attachment.getId()); + } +} diff --git a/Mage/src/main/java/mage/game/events/AttachedEvent.java b/Mage/src/main/java/mage/game/events/AttachedEvent.java new file mode 100644 index 00000000000..bc4bde6fe99 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/AttachedEvent.java @@ -0,0 +1,17 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class AttachedEvent extends GameEvent { + + public AttachedEvent(UUID targetPermanentId, Permanent attachment, Ability source) { + super(GameEvent.EventType.ATTACHED, targetPermanentId, null, attachment.getControllerId()); + this.setSourceId(attachment.getId()); + } +} diff --git a/Mage/src/main/java/mage/game/events/AttackerDeclaredEvent.java b/Mage/src/main/java/mage/game/events/AttackerDeclaredEvent.java new file mode 100644 index 00000000000..2ee7243fc7f --- /dev/null +++ b/Mage/src/main/java/mage/game/events/AttackerDeclaredEvent.java @@ -0,0 +1,14 @@ +package mage.game.events; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class AttackerDeclaredEvent extends GameEvent { + + public AttackerDeclaredEvent(UUID targetId, UUID attackerId, UUID attackerControllerId) { + super(GameEvent.EventType.ATTACKER_DECLARED, targetId, null, attackerControllerId); + this.setSourceId(attackerId); + } +} diff --git a/Mage/src/main/java/mage/game/events/BlockerDeclaredEvent.java b/Mage/src/main/java/mage/game/events/BlockerDeclaredEvent.java new file mode 100644 index 00000000000..1789f5ceb0e --- /dev/null +++ b/Mage/src/main/java/mage/game/events/BlockerDeclaredEvent.java @@ -0,0 +1,14 @@ +package mage.game.events; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class BlockerDeclaredEvent extends GameEvent { + + public BlockerDeclaredEvent(UUID attackerId, UUID blockerId, UUID blockerControllerId) { + super(GameEvent.EventType.BLOCKER_DECLARED, attackerId, null, blockerControllerId); + this.setSourceId(blockerId); + } +} diff --git a/Mage/src/main/java/mage/game/events/CoinFlippedEvent.java b/Mage/src/main/java/mage/game/events/CoinFlippedEvent.java index b7dad082256..554be49a9b0 100644 --- a/Mage/src/main/java/mage/game/events/CoinFlippedEvent.java +++ b/Mage/src/main/java/mage/game/events/CoinFlippedEvent.java @@ -8,15 +8,17 @@ import java.util.UUID; * @author TheElk801 **/ public class CoinFlippedEvent extends GameEvent { + private final boolean result; private final boolean chosen; private final boolean winnable; CoinFlippedEvent(UUID playerId, UUID sourceId, boolean result, boolean chosen, boolean winnable) { - super(EventType.COIN_FLIPPED, playerId, sourceId, playerId); + super(GameEvent.EventType.COIN_FLIPPED, playerId, null, playerId); this.result = result; this.chosen = chosen; this.winnable = winnable; + this.setSourceId(sourceId); } public boolean getResult() { diff --git a/Mage/src/main/java/mage/game/events/CopiedStackObjectEvent.java b/Mage/src/main/java/mage/game/events/CopiedStackObjectEvent.java new file mode 100644 index 00000000000..c7b56eae337 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/CopiedStackObjectEvent.java @@ -0,0 +1,16 @@ +package mage.game.events; + +import mage.MageObject; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class CopiedStackObjectEvent extends GameEvent { + + public CopiedStackObjectEvent(MageObject target, MageObject newCopy, UUID newControllerId) { + super(GameEvent.EventType.COPIED_STACKOBJECT, newCopy.getId(), null, newControllerId); + this.setSourceId(target.getId()); + } +} diff --git a/Mage/src/main/java/mage/game/events/CopyStackObjectEvent.java b/Mage/src/main/java/mage/game/events/CopyStackObjectEvent.java new file mode 100644 index 00000000000..54af7d4034c --- /dev/null +++ b/Mage/src/main/java/mage/game/events/CopyStackObjectEvent.java @@ -0,0 +1,16 @@ +package mage.game.events; + +import mage.MageObject; +import mage.abilities.Ability; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class CopyStackObjectEvent extends GameEvent { + + public CopyStackObjectEvent(Ability source, MageObject targetToCopy, UUID newControllerId, int amount) { + super(GameEvent.EventType.COPY_STACKOBJECT, targetToCopy.getId(), source, newControllerId, amount, false); + } +} diff --git a/Mage/src/main/java/mage/game/events/CostEvent.java b/Mage/src/main/java/mage/game/events/CostEvent.java deleted file mode 100644 index 10b76ce73b2..00000000000 --- a/Mage/src/main/java/mage/game/events/CostEvent.java +++ /dev/null @@ -1,28 +0,0 @@ - -package mage.game.events; - -import java.util.UUID; -import mage.abilities.costs.Cost; - -/** - * - * @author LevelX2 - */ -public class CostEvent extends GameEvent { - - protected Cost cost; - - public CostEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, Cost cost) { - super(type, targetId, sourceId, playerId); - this.cost = cost; - } - - public Cost getCost() { - return cost; - } - - public void setCost(Cost cost) { - this.cost = cost; - } - -} diff --git a/Mage/src/main/java/mage/game/events/CreateTokenEvent.java b/Mage/src/main/java/mage/game/events/CreateTokenEvent.java index fb486f74bdd..9c73da08565 100644 --- a/Mage/src/main/java/mage/game/events/CreateTokenEvent.java +++ b/Mage/src/main/java/mage/game/events/CreateTokenEvent.java @@ -1,14 +1,16 @@ package mage.game.events; +import mage.abilities.Ability; import mage.game.permanent.token.Token; import java.util.UUID; public class CreateTokenEvent extends GameEvent { + private Token token; - public CreateTokenEvent(UUID sourceId, UUID controllerId, int amount, Token token) { - super(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount, false); + public CreateTokenEvent(Ability source, UUID controllerId, int amount, Token token) { + super(GameEvent.EventType.CREATE_TOKEN, null, source, controllerId, amount, false); this.token = token; } diff --git a/Mage/src/main/java/mage/game/events/CreatedTokenEvent.java b/Mage/src/main/java/mage/game/events/CreatedTokenEvent.java index b300038a589..8aee05b7bd9 100644 --- a/Mage/src/main/java/mage/game/events/CreatedTokenEvent.java +++ b/Mage/src/main/java/mage/game/events/CreatedTokenEvent.java @@ -1,12 +1,11 @@ package mage.game.events; +import mage.abilities.Ability; import mage.game.permanent.PermanentToken; -import java.util.UUID; - public class CreatedTokenEvent extends GameEvent { - public CreatedTokenEvent(UUID sourceId, PermanentToken tokenPerm) { - super(EventType.CREATED_TOKEN, tokenPerm.getId(), sourceId, tokenPerm.getControllerId()); + public CreatedTokenEvent(Ability source, PermanentToken tokenPerm) { + super(GameEvent.EventType.CREATED_TOKEN, tokenPerm.getId(), source, tokenPerm.getControllerId()); } } diff --git a/Mage/src/main/java/mage/game/events/DamageCreatureEvent.java b/Mage/src/main/java/mage/game/events/DamageCreatureEvent.java index e6bcdd112f7..9e3d1372db2 100644 --- a/Mage/src/main/java/mage/game/events/DamageCreatureEvent.java +++ b/Mage/src/main/java/mage/game/events/DamageCreatureEvent.java @@ -1,5 +1,3 @@ - - package mage.game.events; import java.util.UUID; @@ -10,8 +8,7 @@ import java.util.UUID; */ public class DamageCreatureEvent extends DamageEvent { - public DamageCreatureEvent(UUID targetId, UUID sourceId, UUID playerId, int amount, boolean preventable, boolean combat) { - super(EventType.DAMAGE_CREATURE, targetId, sourceId, playerId, amount, preventable, combat); + public DamageCreatureEvent(UUID targetId, UUID damageSourceId, UUID targetControllerId, int amount, boolean preventable, boolean combat) { + super(GameEvent.EventType.DAMAGE_CREATURE, targetId, damageSourceId, targetControllerId, amount, preventable, combat); } - } diff --git a/Mage/src/main/java/mage/game/events/DamageEvent.java b/Mage/src/main/java/mage/game/events/DamageEvent.java index 58400e8cb44..83b94ba5370 100644 --- a/Mage/src/main/java/mage/game/events/DamageEvent.java +++ b/Mage/src/main/java/mage/game/events/DamageEvent.java @@ -1,5 +1,3 @@ - - package mage.game.events; import java.util.UUID; @@ -12,9 +10,10 @@ public abstract class DamageEvent extends GameEvent { protected boolean combat; - public DamageEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, int amount, boolean preventable, boolean combat) { - super(type, targetId, sourceId, playerId, amount, preventable); + public DamageEvent(EventType type, UUID targetId, UUID damageSourceId, UUID targetControllerId, int amount, boolean preventable, boolean combat) { + super(type, targetId, null, targetControllerId, amount, preventable); this.combat = combat; + this.setSourceId(damageSourceId); } public boolean isCombatDamage() { diff --git a/Mage/src/main/java/mage/game/events/DamagePlaneswalkerEvent.java b/Mage/src/main/java/mage/game/events/DamagePlaneswalkerEvent.java index bf46bfc6010..5c7481c810b 100644 --- a/Mage/src/main/java/mage/game/events/DamagePlaneswalkerEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagePlaneswalkerEvent.java @@ -1,5 +1,3 @@ - - package mage.game.events; import java.util.UUID; @@ -10,8 +8,7 @@ import java.util.UUID; */ public class DamagePlaneswalkerEvent extends DamageEvent { - public DamagePlaneswalkerEvent(UUID targetId, UUID sourceId, UUID playerId, int amount, boolean preventable, boolean combat) { - super(EventType.DAMAGE_PLANESWALKER, targetId, sourceId, playerId, amount, preventable, combat); + public DamagePlaneswalkerEvent(UUID targetId, UUID damageSourceId, UUID targetControllerId, int amount, boolean preventable, boolean combat) { + super(GameEvent.EventType.DAMAGE_PLANESWALKER, targetId, damageSourceId, targetControllerId, amount, preventable, combat); } - } diff --git a/Mage/src/main/java/mage/game/events/DamagePlayerEvent.java b/Mage/src/main/java/mage/game/events/DamagePlayerEvent.java index 95e51045106..e994f211409 100644 --- a/Mage/src/main/java/mage/game/events/DamagePlayerEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagePlayerEvent.java @@ -1,5 +1,3 @@ - - package mage.game.events; import java.util.UUID; @@ -10,8 +8,7 @@ import java.util.UUID; */ public class DamagePlayerEvent extends DamageEvent { - public DamagePlayerEvent(UUID targetId, UUID sourceId, UUID playerId, int amount, boolean preventable, boolean combat) { - super(EventType.DAMAGE_PLAYER, targetId, sourceId, playerId, amount, preventable, combat); + public DamagePlayerEvent(UUID targetId, UUID damageSourceId, UUID targetControllerId, int amount, boolean preventable, boolean combat) { + super(GameEvent.EventType.DAMAGE_PLAYER, targetId, damageSourceId, targetControllerId, amount, preventable, combat); } - } diff --git a/Mage/src/main/java/mage/game/events/DamagedBatchEvent.java b/Mage/src/main/java/mage/game/events/DamagedBatchEvent.java index a5dad5832b8..1b482d3c36e 100644 --- a/Mage/src/main/java/mage/game/events/DamagedBatchEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedBatchEvent.java @@ -12,7 +12,7 @@ public abstract class DamagedBatchEvent extends GameEvent { private final Set events = new HashSet<>(); public DamagedBatchEvent(EventType type, Class damageClazz) { - super(EventType.DAMAGED_PLAYER_BATCH, null, null, null); + super(GameEvent.EventType.DAMAGED_PLAYER_BATCH, null, null, null); this.damageClazz = damageClazz; } diff --git a/Mage/src/main/java/mage/game/events/DamagedCreatureBatchEvent.java b/Mage/src/main/java/mage/game/events/DamagedCreatureBatchEvent.java index 8f2c23d57ad..57fb3afc271 100644 --- a/Mage/src/main/java/mage/game/events/DamagedCreatureBatchEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedCreatureBatchEvent.java @@ -6,6 +6,6 @@ package mage.game.events; public class DamagedCreatureBatchEvent extends DamagedBatchEvent { public DamagedCreatureBatchEvent() { - super(EventType.DAMAGED_CREATURE_BATCH, DamagedCreatureEvent.class); + super(GameEvent.EventType.DAMAGED_CREATURE_BATCH, DamagedCreatureEvent.class); } } diff --git a/Mage/src/main/java/mage/game/events/DamagedCreatureEvent.java b/Mage/src/main/java/mage/game/events/DamagedCreatureEvent.java index 8dfa928779d..7272b5643e9 100644 --- a/Mage/src/main/java/mage/game/events/DamagedCreatureEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedCreatureEvent.java @@ -10,8 +10,7 @@ import java.util.UUID; */ public class DamagedCreatureEvent extends DamagedEvent { - public DamagedCreatureEvent(UUID targetId, UUID sourceId, UUID playerId, int amount, boolean combat) { - super(EventType.DAMAGED_CREATURE, targetId, sourceId, playerId, amount, combat); + public DamagedCreatureEvent(UUID targetId, UUID attackerId, UUID playerId, int amount, boolean combat) { + super(GameEvent.EventType.DAMAGED_CREATURE, targetId, attackerId, playerId, amount, combat); } - } diff --git a/Mage/src/main/java/mage/game/events/DamagedEvent.java b/Mage/src/main/java/mage/game/events/DamagedEvent.java index ca1a4f63060..6981fc8b926 100644 --- a/Mage/src/main/java/mage/game/events/DamagedEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedEvent.java @@ -12,9 +12,10 @@ public abstract class DamagedEvent extends GameEvent { protected boolean combat; - public DamagedEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, int amount, boolean combat) { - super(type, targetId, sourceId, playerId, amount, false); + public DamagedEvent(EventType type, UUID targetId, UUID attackerId, UUID playerId, int amount, boolean combat) { + super(type, targetId, null, playerId, amount, false); this.combat = combat; + this.setSourceId(attackerId); } public boolean isCombatDamage() { diff --git a/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerBatchEvent.java b/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerBatchEvent.java index 17b981b43af..9f74c2edb63 100644 --- a/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerBatchEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerBatchEvent.java @@ -6,6 +6,6 @@ package mage.game.events; public class DamagedPlaneswalkerBatchEvent extends DamagedBatchEvent { public DamagedPlaneswalkerBatchEvent() { - super(EventType.DAMAGED_PLANESWALKER_BATCH, DamagedPlaneswalkerEvent.class); + super(GameEvent.EventType.DAMAGED_PLANESWALKER_BATCH, DamagedPlaneswalkerEvent.class); } } diff --git a/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerEvent.java b/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerEvent.java index 7b13c7d203d..ed3092047cb 100644 --- a/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedPlaneswalkerEvent.java @@ -1,5 +1,3 @@ - - package mage.game.events; import java.util.UUID; @@ -10,8 +8,9 @@ import java.util.UUID; */ public class DamagedPlaneswalkerEvent extends DamagedEvent { - public DamagedPlaneswalkerEvent(UUID targetId, UUID sourceId, UUID playerId, int amount, boolean combat) { - super(EventType.DAMAGED_PLANESWALKER, targetId, sourceId, playerId, amount, combat); + public DamagedPlaneswalkerEvent(UUID targetId, UUID attackerId, UUID playerId, int amount, boolean combat) { + super(GameEvent.EventType.DAMAGED_PLANESWALKER, targetId, null, playerId, amount, combat); + this.setSourceId(attackerId); } } diff --git a/Mage/src/main/java/mage/game/events/DamagedPlayerBatchEvent.java b/Mage/src/main/java/mage/game/events/DamagedPlayerBatchEvent.java index c7f38a687d9..ccfd993e3cc 100644 --- a/Mage/src/main/java/mage/game/events/DamagedPlayerBatchEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedPlayerBatchEvent.java @@ -6,6 +6,6 @@ package mage.game.events; public class DamagedPlayerBatchEvent extends DamagedBatchEvent { public DamagedPlayerBatchEvent() { - super(EventType.DAMAGED_PLAYER_BATCH, DamagedPlayerEvent.class); + super(GameEvent.EventType.DAMAGED_PLAYER_BATCH, DamagedPlayerEvent.class); } } diff --git a/Mage/src/main/java/mage/game/events/DamagedPlayerEvent.java b/Mage/src/main/java/mage/game/events/DamagedPlayerEvent.java index b4cf87d20d3..1f3b1bf9204 100644 --- a/Mage/src/main/java/mage/game/events/DamagedPlayerEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedPlayerEvent.java @@ -10,8 +10,7 @@ import java.util.UUID; */ public class DamagedPlayerEvent extends DamagedEvent { - public DamagedPlayerEvent(UUID targetId, UUID sourceId, UUID playerId, int amount, boolean combat) { - super(EventType.DAMAGED_PLAYER, targetId, sourceId, playerId, amount, combat); + public DamagedPlayerEvent(UUID targetId, UUID attackerId, UUID playerId, int amount, boolean combat) { + super(GameEvent.EventType.DAMAGED_PLAYER, targetId, attackerId, playerId, amount, combat); } - } diff --git a/Mage/src/main/java/mage/game/events/DeclareAttackerEvent.java b/Mage/src/main/java/mage/game/events/DeclareAttackerEvent.java new file mode 100644 index 00000000000..52bf9a958d0 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/DeclareAttackerEvent.java @@ -0,0 +1,14 @@ +package mage.game.events; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class DeclareAttackerEvent extends GameEvent { + + public DeclareAttackerEvent(UUID targetId, UUID attackerId, UUID attackerControllerId) { + super(GameEvent.EventType.DECLARE_ATTACKER, targetId, null, attackerControllerId); + this.setSourceId(attackerId); + } +} diff --git a/Mage/src/main/java/mage/game/events/DeclareBlockerEvent.java b/Mage/src/main/java/mage/game/events/DeclareBlockerEvent.java new file mode 100644 index 00000000000..410f1c5d2a8 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/DeclareBlockerEvent.java @@ -0,0 +1,14 @@ +package mage.game.events; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class DeclareBlockerEvent extends GameEvent { + + public DeclareBlockerEvent(UUID attackerId, UUID blockerId, UUID blockerControllerId) { + super(GameEvent.EventType.DECLARE_BLOCKER, attackerId, null, blockerControllerId); + this.setSourceId(blockerId); + } +} diff --git a/Mage/src/main/java/mage/game/events/DrawCardEvent.java b/Mage/src/main/java/mage/game/events/DrawCardEvent.java new file mode 100644 index 00000000000..f72aa989cf9 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/DrawCardEvent.java @@ -0,0 +1,21 @@ +package mage.game.events; + +import mage.abilities.Ability; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class DrawCardEvent extends GameEvent { + + public DrawCardEvent(UUID playerId, Ability source, GameEvent originalDrawEvent) { + super(GameEvent.EventType.DRAW_CARD, playerId, source, playerId, 0, false); + + // source of draw events must be kept between replacements, example: UnpredictableCycloneTest + if (originalDrawEvent != null) { + this.addAppliedEffects(originalDrawEvent.getAppliedEffects()); + this.setSourceId(originalDrawEvent.getSourceId()); + } + } +} diff --git a/Mage/src/main/java/mage/game/events/DrawCardsEvent.java b/Mage/src/main/java/mage/game/events/DrawCardsEvent.java new file mode 100644 index 00000000000..31a18d3ed28 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/DrawCardsEvent.java @@ -0,0 +1,21 @@ +package mage.game.events; + +import mage.abilities.Ability; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class DrawCardsEvent extends GameEvent { + + public DrawCardsEvent(UUID playerId, Ability source, GameEvent originalDrawEvent, int amount) { + super(GameEvent.EventType.DRAW_CARDS, playerId, source, playerId, amount, false); + + // source of draw events must be kept between replacements, example: UnpredictableCycloneTest + if (originalDrawEvent != null) { + this.addAppliedEffects(originalDrawEvent.getAppliedEffects()); + this.setSourceId(originalDrawEvent.getSourceId()); + } + } +} diff --git a/Mage/src/main/java/mage/game/events/DrewCardEvent.java b/Mage/src/main/java/mage/game/events/DrewCardEvent.java new file mode 100644 index 00000000000..6650134b42d --- /dev/null +++ b/Mage/src/main/java/mage/game/events/DrewCardEvent.java @@ -0,0 +1,21 @@ +package mage.game.events; + +import mage.abilities.Ability; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class DrewCardEvent extends GameEvent { + + public DrewCardEvent(UUID cardId, UUID playerId, Ability source, GameEvent originalDrawEvent) { + super(EventType.DREW_CARD, cardId, source, playerId, 0, false); + + // source of draw events must be kept between replacements, example: UnpredictableCycloneTest + if (originalDrawEvent != null) { + //this.addAppliedEffects(originalDrawEvent.getAppliedEffects()); // event can't used for replace, so no needs in applied effects + this.setSourceId(originalDrawEvent.getSourceId()); + } + } +} diff --git a/Mage/src/main/java/mage/game/events/EnchantPlayerEvent.java b/Mage/src/main/java/mage/game/events/EnchantPlayerEvent.java new file mode 100644 index 00000000000..182466e725c --- /dev/null +++ b/Mage/src/main/java/mage/game/events/EnchantPlayerEvent.java @@ -0,0 +1,17 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class EnchantPlayerEvent extends GameEvent { + + public EnchantPlayerEvent(UUID targetId, Permanent attachment, Ability source) { + super(GameEvent.EventType.ENCHANT_PLAYER, targetId, null, attachment.getControllerId()); + this.setSourceId(attachment.getId()); + } +} diff --git a/Mage/src/main/java/mage/game/events/EnchantedPlayerEvent.java b/Mage/src/main/java/mage/game/events/EnchantedPlayerEvent.java new file mode 100644 index 00000000000..f5c2a78b00d --- /dev/null +++ b/Mage/src/main/java/mage/game/events/EnchantedPlayerEvent.java @@ -0,0 +1,17 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class EnchantedPlayerEvent extends GameEvent { + + public EnchantedPlayerEvent(UUID targetId, Permanent attachment, Ability source) { + super(GameEvent.EventType.ENCHANTED_PLAYER, targetId, null, attachment.getControllerId()); + this.setSourceId(attachment.getId()); + } +} diff --git a/Mage/src/main/java/mage/game/events/EntersTheBattlefieldEvent.java b/Mage/src/main/java/mage/game/events/EntersTheBattlefieldEvent.java index 3d7599a231a..eee86dee5bf 100644 --- a/Mage/src/main/java/mage/game/events/EntersTheBattlefieldEvent.java +++ b/Mage/src/main/java/mage/game/events/EntersTheBattlefieldEvent.java @@ -2,6 +2,8 @@ package mage.game.events; import java.util.UUID; + +import mage.abilities.Ability; import mage.constants.EnterEventType; import static mage.constants.EnterEventType.SELF; import mage.constants.Zone; @@ -16,12 +18,20 @@ public class EntersTheBattlefieldEvent extends GameEvent { private final Zone fromZone; private Permanent target; - public EntersTheBattlefieldEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone) { - this(target, sourceId, playerId, fromZone, EnterEventType.OTHER); + public EntersTheBattlefieldEvent(Permanent target, Ability source, UUID playerId, Zone fromZone) { + this(target, source, playerId, fromZone, EnterEventType.OTHER); } - public EntersTheBattlefieldEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, EnterEventType enterType) { - super(EventType.ENTERS_THE_BATTLEFIELD, target.getId(), sourceId, playerId); + /** + * + * @param target + * @param source can be null for default game actions like cheats + * @param playerId + * @param fromZone + * @param enterType + */ + public EntersTheBattlefieldEvent(Permanent target, Ability source, UUID playerId, Zone fromZone, EnterEventType enterType) { + super(GameEvent.EventType.ENTERS_THE_BATTLEFIELD, target.getId(), source, playerId); switch (enterType) { case SELF: type = EventType.ENTERS_THE_BATTLEFIELD_SELF; diff --git a/Mage/src/main/java/mage/game/events/FlipCoinEvent.java b/Mage/src/main/java/mage/game/events/FlipCoinEvent.java index 3dc799ad4ec..79dddbb0006 100644 --- a/Mage/src/main/java/mage/game/events/FlipCoinEvent.java +++ b/Mage/src/main/java/mage/game/events/FlipCoinEvent.java @@ -1,5 +1,6 @@ package mage.game.events; +import mage.abilities.Ability; import mage.util.CardUtil; import java.util.UUID; @@ -13,8 +14,8 @@ public class FlipCoinEvent extends GameEvent { private final boolean winnable; private int flipCount = 1; - public FlipCoinEvent(UUID playerId, UUID sourceId, boolean result, boolean chosen, boolean winnable) { - super(EventType.FLIP_COIN, playerId, sourceId, playerId); + public FlipCoinEvent(UUID playerId, Ability source, boolean result, boolean chosen, boolean winnable) { + super(GameEvent.EventType.FLIP_COIN, playerId, source, playerId); this.result = result; this.chosen = chosen; this.winnable = winnable; @@ -52,7 +53,7 @@ public class FlipCoinEvent extends GameEvent { this.flipCount = flipCount; } - public CoinFlippedEvent getFlippedEvent() { + public CoinFlippedEvent createFlippedEvent() { return new CoinFlippedEvent(playerId, sourceId, result, chosen, winnable); } } diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index e6014fed0c5..7f3ea461911 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -2,6 +2,7 @@ package mage.game.events; import mage.ApprovingObject; import mage.MageIdentifier; +import mage.abilities.Ability; import mage.constants.Zone; import java.io.Serializable; @@ -17,7 +18,7 @@ public class GameEvent implements Serializable { protected EventType type; protected UUID id; protected UUID targetId; - protected UUID sourceId; + protected UUID sourceId; // TODO: check sourceId usage in all events, it must gets sourceId from source ability only, not other values protected UUID playerId; protected int amount; // flags: @@ -25,6 +26,7 @@ public class GameEvent implements Serializable { // for combat damage: event is preventable damage // for discard: event is result of effect (1) or result of cost (0) // for prevent damage: try to prevent combat damage (1) or other damage (0) + // for tapped: is it tapped for combat (1) or for another reason (0) protected boolean flag; protected String data; protected Zone zone; @@ -70,11 +72,16 @@ public class GameEvent implements Serializable { */ ZONE_CHANGE, ZONE_CHANGE_GROUP, - DRAW_CARDS, // applies to an instruction to draw more than one card before any replacement effects apply to individual cards drawn + DRAW_CARDS, // event calls for multi draws only (if player draws 2+ cards at once) DRAW_CARD, DREW_CARD, EXPLORED, ECHO_PAID, MIRACLE_CARD_REVEALED, + /* MADNESS_CARD_EXILED, + targetId id of the card with madness + sourceId original id of the madness ability + playerId controller of the card + */ MADNESS_CARD_EXILED, INVESTIGATED, KICKED, @@ -84,6 +91,9 @@ public class GameEvent implements Serializable { playerId controller of the convoked spell */ CONVOKED, + /* DISCARD_CARD + flag event is result of effect (1) or result of cost (0) + */ DISCARD_CARD, DISCARDED_CARD, DISCARDED_CARDS, @@ -101,13 +111,20 @@ public class GameEvent implements Serializable { */ DAMAGED_PLAYER, DAMAGED_PLAYER_BATCH, + /* DAMAGE_CAUSES_LIFE_LOSS, + targetId the id of the damaged player + sourceId sourceId of the ability which caused the damage, can be null for default events like combat + playerId the id of the damged player + amount amount of damage + flag is it combat damage + */ DAMAGE_CAUSES_LIFE_LOSS, PLAYER_LIFE_CHANGE, GAIN_LIFE, GAINED_LIFE, LOSE_LIFE, LOST_LIFE, /* LOSE_LIFE + LOST_LIFE targetId the id of the player loosing life - sourceId the id of the player loosing life + sourceId sourceId of the ability which caused the lose playerId the id of the player loosing life amount amount of life loss flag true = from comabat damage - other from non combat damage @@ -172,7 +189,19 @@ public class GameEvent implements Serializable { */ TRIGGERED_ABILITY, RESOLVING_ABILITY, - COPY_STACKOBJECT, COPIED_STACKOBJECT, + /* COPY_STACKOBJECT + targetId id of the spell/ability to copy + sourceId id of the object with copy ability + playerId id of the player who will be control new copied spell/ability + amount number on copies + */ + COPY_STACKOBJECT, + /* COPIED_STACKOBJECT, TODO: make same logic in params for COPY_STACKOBJECT and COPIED_STACKOBJECT + targetId id of the new copied spell/ability + sourceId id of the spell/ability to copy + playerId id of the player who will be control new copied spell/ability + */ + COPIED_STACKOBJECT, /* ADD_MANA targetId id of the ability that added the mana sourceId sourceId of the ability that added the mana @@ -192,11 +221,19 @@ public class GameEvent implements Serializable { sourceId sourceId of the mana source playerId controller of the ability the mana was paid for amount not used for this event - flag indicates a special condition - data originalId of the mana producing ability + flag indicates a special condition of mana + data originalId of the mana producing ability as string (converted from UUID) */ MANA_PAID, LOSES, LOST, WINS, DRAW_PLAYER, + /* TARGET + targetId id of the targeting card + sourceId id of the ability's object that try to targeting + playerId player who try to targeting (can be different from source ability's controller) + TODO: BUT there is isLegal(Ability source, Game game) code and it uses only source ability's controller, + so some abilities can be fizzled on resolve cause no legal targets? + amount not used for this event + */ TARGET, TARGETED, /* TARGETS_VALID targetId id of the spell or id of stack ability the targets were set to @@ -239,11 +276,13 @@ public class GameEvent implements Serializable { */ DECLARING_BLOCKERS, DECLARED_BLOCKERS, - /* DECLARING_BLOCKERS - targetId id of the blocking player - sourceId id of the blocking player + DECLARE_BLOCKER, + /* BLOCKER_DECLARED + targetId attacker id + sourceId blocker id + playerId blocker controller id */ - DECLARE_BLOCKER, BLOCKER_DECLARED, + BLOCKER_DECLARED, CREATURE_BLOCKED, BATCH_BLOCK_NONCOMBAT, UNBLOCKED_ATTACKER, @@ -268,7 +307,15 @@ public class GameEvent implements Serializable { ENTERS_THE_BATTLEFIELD_CONTROL, // 616.1b ENTERS_THE_BATTLEFIELD_COPY, // 616.1c ENTERS_THE_BATTLEFIELD, // 616.1d - TAP, TAPPED, + TAP, + /* TAPPED, + targetId tapped permanent + sourceId id of the abilitity's source (can be null for standard tap actions like combat) + playerId controller of the tapped permanent + amount not used for this event + flag is it tapped for combat + */ + TAPPED, TAPPED_FOR_MANA, /* TAPPED_FOR_MANA During calculation of the available mana for a player the "TappedForMana" event is fired to simulate triggered mana production. @@ -281,14 +328,14 @@ public class GameEvent implements Serializable { TRANSFORM, TRANSFORMED, ADAPT, BECOMES_MONSTROUS, - BECOMES_EXERTED, /* BECOMES_EXERTED targetId id of the exerted creature - sourceId id of the exerted creature - playerId playerId of the player that controlls the creature + sourceId sourceId of the ability that triggered the event (do exert) + playerId player who makes the exert (can be different from permanent's controller) amount not used for this event flag not used for this event */ + BECOMES_EXERTED, BECOMES_RENOWNED, /* BECOMES_MONARCH targetId playerId of the player that becomes the monarch @@ -336,21 +383,44 @@ public class GameEvent implements Serializable { EMBALMED_CREATURE, ETERNALIZED_CREATURE, ATTACH, ATTACHED, - STAY_ATTACHED, UNATTACH, UNATTACHED, + /* ATTACH, ATTACHED, + UNATTACH, UNATTACHED, + targetId id of the permanent who get/lose attachment + sourceId id of the attachment + playerId player who control the attachment + amount not used for this event + flag not used for this event + */ + STAY_ATTACHED, ADD_COUNTER, COUNTER_ADDED, ADD_COUNTERS, COUNTERS_ADDED, COUNTER_REMOVED, COUNTERS_REMOVED, LOSE_CONTROL, /* LOST_CONTROL targetId id of the creature that lost control - sourceId id of the creature that lost control + sourceId null playerId player that controlles the creature before amount not used for this event flag not used for this event */ LOST_CONTROL, - GAIN_CONTROL, GAINED_CONTROL, + /* GAIN_CONTROL + targetId id of the permanent that trying to get control + sourceId null + playerId new player that try to get control of permanent + amount not used for this event + flag not used for this event + */ + GAIN_CONTROL, + /* GAINED_CONTROL + targetId id of the permanent that got control + sourceId null + playerId new player that got control of permanent + amount not used for this event + flag not used for this event + */ + GAINED_CONTROL, CREATE_TOKEN, CREATED_TOKEN, /* REGENERATE targetId id of the creature to regenerate @@ -370,79 +440,69 @@ public class GameEvent implements Serializable { CUSTOM_EVENT } - public GameEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId) { - this(type, null, targetId, sourceId, playerId, 0, false); + public GameEvent(EventType type, UUID targetId, Ability source, UUID playerId) { + this(type, null, targetId, source, playerId, 0, false); } - public GameEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, ApprovingObject approvingObject) { - this(type, null, targetId, sourceId, playerId, 0, false, approvingObject); + public GameEvent(EventType type, UUID targetId, Ability source, UUID playerId, ApprovingObject approvingObject) { + this(type, null, targetId, source, playerId, 0, false, approvingObject); } - public GameEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, int amount, boolean flag) { - this(type, null, targetId, sourceId, playerId, amount, flag); + public GameEvent(EventType type, UUID targetId, Ability source, UUID playerId, int amount, boolean flag) { + this(type, null, targetId, source, playerId, amount, flag); } - public GameEvent(UUID customEventType, UUID targetId, UUID sourceId, UUID playerId) { - this(EventType.CUSTOM_EVENT, customEventType, targetId, sourceId, playerId, 0, false); + public GameEvent(UUID customEventType, UUID targetId, Ability source, UUID playerId) { + this(EventType.CUSTOM_EVENT, customEventType, targetId, source, playerId, 0, false); } - public GameEvent(UUID customEventType, UUID targetId, UUID sourceId, UUID playerId, int amount, boolean flag) { - this(EventType.CUSTOM_EVENT, customEventType, targetId, sourceId, playerId, amount, flag); + public GameEvent(UUID customEventType, UUID targetId, Ability source, UUID playerId, int amount, boolean flag) { + this(EventType.CUSTOM_EVENT, customEventType, targetId, source, playerId, amount, flag); } - public static GameEvent getEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, int amount) { - return new GameEvent(type, targetId, sourceId, playerId, amount, false); + public static GameEvent getEvent(EventType type, UUID targetId, Ability source, UUID playerId, int amount) { + return new GameEvent(type, targetId, source, playerId, amount, false); } - public static GameEvent getEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId) { - return new GameEvent(type, targetId, sourceId, playerId); + public static GameEvent getEvent(EventType type, UUID targetId, Ability source, UUID playerId) { + return new GameEvent(type, targetId, source, playerId); } - public static GameEvent getEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, ApprovingObject approvingObject) { - return new GameEvent(type, targetId, sourceId, playerId, approvingObject); + public static GameEvent getEvent(EventType type, UUID targetId, Ability source, UUID playerId, ApprovingObject approvingObject) { + return new GameEvent(type, targetId, source, playerId, approvingObject); } + @Deprecated // usage must be replaced by getEvent with source ability public static GameEvent getEvent(EventType type, UUID targetId, UUID playerId) { return new GameEvent(type, targetId, null, playerId); } - public static GameEvent getEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, String data, int amount) { - GameEvent event = getEvent(type, targetId, sourceId, playerId); + public static GameEvent getEvent(EventType type, UUID targetId, Ability source, UUID playerId, String data, int amount) { + GameEvent event = getEvent(type, targetId, source, playerId); event.setAmount(amount); event.setData(data); return event; } - public static GameEvent getEvent(UUID customEventType, UUID targetId, UUID sourceId, UUID playerId, int amount) { - return new GameEvent(customEventType, targetId, sourceId, playerId, amount, false); + public static GameEvent getEvent(UUID customEventType, UUID targetId, Ability source, UUID playerId, int amount) { + return new GameEvent(customEventType, targetId, source, playerId, amount, false); } - public static GameEvent getEvent(UUID customEventType, UUID targetId, UUID sourceId, UUID playerId) { - return new GameEvent(customEventType, targetId, sourceId, playerId); + public static GameEvent getEvent(UUID customEventType, UUID targetId, Ability source, UUID playerId) { + return new GameEvent(customEventType, targetId, source, playerId); } - public static GameEvent getEvent(UUID customEventType, UUID targetId, UUID playerId) { - return new GameEvent(customEventType, targetId, null, playerId); - } - - public static GameEvent getEvent(UUID customEventType, UUID targetId, UUID playerId, String data, int amount) { - GameEvent event = getEvent(customEventType, targetId, playerId); - event.setAmount(amount); - event.setData(data); - return event; + private GameEvent(EventType type, UUID customEventType, UUID targetId, Ability source, UUID playerId, int amount, boolean flag) + { + this(type, customEventType, targetId, source, playerId, amount, flag, null); } private GameEvent(EventType type, UUID customEventType, - UUID targetId, UUID sourceId, UUID playerId, int amount, boolean flag) { - this(type, customEventType, targetId, sourceId, playerId, amount, flag, null); - } - - private GameEvent(EventType type, UUID customEventType, - UUID targetId, UUID sourceId, UUID playerId, int amount, boolean flag, ApprovingObject approvingObject) { + UUID targetId, Ability source, UUID playerId, int amount, boolean flag, ApprovingObject approvingObject) { this.type = type; this.customEventType = customEventType; this.targetId = targetId; - this.sourceId = sourceId; + this.sourceId = source == null ? null : source.getSourceId(); this.amount = amount; this.playerId = playerId; this.flag = flag; @@ -585,4 +645,13 @@ public class GameEvent implements Serializable { } return identifier.equals(approvingObject.getApprovingAbility().getIdentifier()); } + + /** + * Custom sourceId setup for some events (use it in constructor). TODO: replace all custom sourceId to normal event classes + * + * @param sourceId + */ + protected void setSourceId(UUID sourceId) { + this.sourceId = sourceId; + } } diff --git a/Mage/src/main/java/mage/game/events/LibrarySearchedEvent.java b/Mage/src/main/java/mage/game/events/LibrarySearchedEvent.java index b344b97e6ec..9db630cfc44 100644 --- a/Mage/src/main/java/mage/game/events/LibrarySearchedEvent.java +++ b/Mage/src/main/java/mage/game/events/LibrarySearchedEvent.java @@ -1,5 +1,6 @@ package mage.game.events; +import mage.abilities.Ability; import mage.target.Target; import java.util.UUID; @@ -15,12 +16,12 @@ public class LibrarySearchedEvent extends GameEvent { * Searched library event (after library searching finished). Return false on replaceEvent to * * @param targetPlayerId whose library searched - * @param sourceId source of the searching effect + * @param source source ability of the searching effect * @param playerId who must search the library * @param searchedTarget founded cards (targets list can be changed by replace events, see Opposition Agent) */ - public LibrarySearchedEvent(UUID targetPlayerId, UUID sourceId, UUID playerId, Target searchedTarget) { - super(EventType.LIBRARY_SEARCHED, targetPlayerId, sourceId, playerId, searchedTarget.getTargets().size(), false); + public LibrarySearchedEvent(UUID targetPlayerId, Ability source, UUID playerId, Target searchedTarget) { + super(GameEvent.EventType.LIBRARY_SEARCHED, targetPlayerId, source, playerId, searchedTarget.getTargets().size(), false); this.searchedTarget = searchedTarget; } diff --git a/Mage/src/main/java/mage/game/events/MadnessCardExiledEvent.java b/Mage/src/main/java/mage/game/events/MadnessCardExiledEvent.java new file mode 100644 index 00000000000..ffb8c42bf68 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/MadnessCardExiledEvent.java @@ -0,0 +1,16 @@ +package mage.game.events; + +import mage.abilities.Ability; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class MadnessCardExiledEvent extends GameEvent { + + public MadnessCardExiledEvent(UUID cardId, Ability source, UUID controllerId) { + super(GameEvent.EventType.MADNESS_CARD_EXILED, cardId, null, controllerId); + this.setSourceId(source.getOriginalId()); // save ability's id + } +} diff --git a/Mage/src/main/java/mage/game/events/ManaEvent.java b/Mage/src/main/java/mage/game/events/ManaEvent.java index debf475c453..d0d34a95d39 100644 --- a/Mage/src/main/java/mage/game/events/ManaEvent.java +++ b/Mage/src/main/java/mage/game/events/ManaEvent.java @@ -4,6 +4,7 @@ package mage.game.events; import java.util.UUID; import mage.Mana; +import mage.abilities.Ability; /** * @@ -13,8 +14,8 @@ public class ManaEvent extends GameEvent { protected Mana mana; - public ManaEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, Mana mana) { - super(type, targetId, sourceId, playerId); + public ManaEvent(EventType type, UUID targetId, Ability source, UUID playerId, Mana mana) { + super(type, targetId, source, playerId); this.mana = mana; } diff --git a/Mage/src/main/java/mage/game/events/ManaPaidEvent.java b/Mage/src/main/java/mage/game/events/ManaPaidEvent.java new file mode 100644 index 00000000000..4c34abd2397 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/ManaPaidEvent.java @@ -0,0 +1,17 @@ +package mage.game.events; + +import mage.abilities.Ability; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class ManaPaidEvent extends GameEvent { + + public ManaPaidEvent(Ability abilityToPay, UUID manaSourceId, boolean manaFlag, UUID manaOriginalId) { + super(GameEvent.EventType.MANA_PAID, abilityToPay.getId(), null, abilityToPay.getControllerId(), 0, manaFlag); + this.setSourceId(manaSourceId); + this.setData(manaOriginalId.toString()); + } +} diff --git a/Mage/src/main/java/mage/game/events/NumberOfTriggersEvent.java b/Mage/src/main/java/mage/game/events/NumberOfTriggersEvent.java index 5caa84f4a08..701e265fedc 100644 --- a/Mage/src/main/java/mage/game/events/NumberOfTriggersEvent.java +++ b/Mage/src/main/java/mage/game/events/NumberOfTriggersEvent.java @@ -1,7 +1,7 @@ - - package mage.game.events; +import mage.abilities.Ability; + import java.util.UUID; /** @@ -12,8 +12,8 @@ public class NumberOfTriggersEvent extends GameEvent { private final GameEvent sourceEvent; - public NumberOfTriggersEvent(UUID controllerOfAbilityId, UUID sourceOfTrigger, GameEvent sourceEvent) { - super(EventType.NUMBER_OF_TRIGGERS, null, sourceOfTrigger, controllerOfAbilityId); + public NumberOfTriggersEvent(Ability triggeredAbility, GameEvent sourceEvent) { + super(GameEvent.EventType.NUMBER_OF_TRIGGERS, null, triggeredAbility, triggeredAbility.getControllerId()); this.sourceEvent = sourceEvent; this.amount = 1; // Number of times to trigger. Panharmonicon can change this. } diff --git a/Mage/src/main/java/mage/game/events/PhaseChangedEvent.java b/Mage/src/main/java/mage/game/events/PhaseChangedEvent.java new file mode 100644 index 00000000000..ba35cdc0ac6 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/PhaseChangedEvent.java @@ -0,0 +1,16 @@ +package mage.game.events; + +import mage.game.turn.TurnMod; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class PhaseChangedEvent extends GameEvent { + + public PhaseChangedEvent(UUID playerId, TurnMod extraTurnMode) { + super(GameEvent.EventType.PHASE_CHANGED, playerId, null, playerId); + this.setSourceId(extraTurnMode == null ? null : extraTurnMode.getId()); + } +} diff --git a/Mage/src/main/java/mage/game/events/PreventDamageEvent.java b/Mage/src/main/java/mage/game/events/PreventDamageEvent.java index 49d9623afa8..e57898a31c8 100644 --- a/Mage/src/main/java/mage/game/events/PreventDamageEvent.java +++ b/Mage/src/main/java/mage/game/events/PreventDamageEvent.java @@ -1,5 +1,7 @@ package mage.game.events; +import mage.abilities.Ability; + import java.util.UUID; /** @@ -7,8 +9,9 @@ import java.util.UUID; */ public class PreventDamageEvent extends GameEvent { - public PreventDamageEvent(UUID targetId, UUID sourceId, UUID playerId, int damageToPrevent, boolean isCombatDamage) { - super(EventType.PREVENT_DAMAGE, targetId, sourceId, playerId, damageToPrevent, isCombatDamage); + public PreventDamageEvent(UUID targetId, UUID attackerId, Ability source, UUID playerId, int damageToPrevent, boolean isCombatDamage) { + super(GameEvent.EventType.PREVENT_DAMAGE, targetId, null, playerId, damageToPrevent, isCombatDamage); + this.setSourceId(attackerId); } public boolean isCombatDamage() { diff --git a/Mage/src/main/java/mage/game/events/PreventedDamageEvent.java b/Mage/src/main/java/mage/game/events/PreventedDamageEvent.java new file mode 100644 index 00000000000..e490667f5c2 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/PreventedDamageEvent.java @@ -0,0 +1,16 @@ +package mage.game.events; + +import mage.abilities.Ability; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class PreventedDamageEvent extends GameEvent { + + public PreventedDamageEvent(UUID targetId, UUID attackerId, Ability source, UUID playerId, int preventedDamage) { + super(GameEvent.EventType.PREVENTED_DAMAGE, targetId, null, playerId, preventedDamage, false); + this.setSourceId(attackerId); + } +} diff --git a/Mage/src/main/java/mage/game/events/SearchLibraryEvent.java b/Mage/src/main/java/mage/game/events/SearchLibraryEvent.java index d36a2e71d54..55c28f24b00 100644 --- a/Mage/src/main/java/mage/game/events/SearchLibraryEvent.java +++ b/Mage/src/main/java/mage/game/events/SearchLibraryEvent.java @@ -1,5 +1,7 @@ package mage.game.events; +import mage.abilities.Ability; + import java.util.UUID; /** @@ -17,8 +19,8 @@ public class SearchLibraryEvent extends GameEvent { * @param playerId who must search the library (also see searchingControllerId) * @param amount cards amount to search */ - public SearchLibraryEvent(UUID targetPlayerId, UUID sourceId, UUID playerId, int amount) { - super(GameEvent.EventType.SEARCH_LIBRARY, targetPlayerId, sourceId, playerId, amount, false); + public SearchLibraryEvent(UUID targetPlayerId, Ability source, UUID playerId, int amount) { + super(GameEvent.EventType.SEARCH_LIBRARY, targetPlayerId, source, playerId, amount, false); this.searchingControllerId = playerId; } diff --git a/Mage/src/main/java/mage/game/events/StayAttachedEvent.java b/Mage/src/main/java/mage/game/events/StayAttachedEvent.java new file mode 100644 index 00000000000..ee9efa920a1 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/StayAttachedEvent.java @@ -0,0 +1,18 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * + * @author JayDi85 + */ +public class StayAttachedEvent extends GameEvent { + + public StayAttachedEvent(UUID targetId, UUID attachmentId, Ability source) { + super(GameEvent.EventType.STAY_ATTACHED, targetId, null, null); + this.setSourceId(attachmentId); + } +} diff --git a/Mage/src/main/java/mage/game/events/TargetEvent.java b/Mage/src/main/java/mage/game/events/TargetEvent.java new file mode 100644 index 00000000000..063d16ac2ab --- /dev/null +++ b/Mage/src/main/java/mage/game/events/TargetEvent.java @@ -0,0 +1,30 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.cards.Card; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class TargetEvent extends GameEvent { + + /** + * @param target + * @param sourceId + * @param sourceControllerId can be different from real controller (example: ability instructs another player to targeting) + */ + public TargetEvent(Card target, UUID sourceId, UUID sourceControllerId) { + super(GameEvent.EventType.TARGET, target.getId(), null, sourceControllerId); + this.setSourceId(sourceId); + } + + /** + * @param targetId + * @param source + */ + public TargetEvent(UUID targetId, Ability source) { + super(GameEvent.EventType.TARGET, targetId, source, source.getControllerId()); + } +} diff --git a/Mage/src/main/java/mage/game/events/UnattachEvent.java b/Mage/src/main/java/mage/game/events/UnattachEvent.java new file mode 100644 index 00000000000..d7a84058990 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/UnattachEvent.java @@ -0,0 +1,17 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class UnattachEvent extends GameEvent { + + public UnattachEvent(UUID targetId, UUID attachmentId, Permanent attachment, Ability source) { + super(GameEvent.EventType.UNATTACH, targetId, null, attachment == null ? null : attachment.getControllerId()); + this.setSourceId(attachmentId); + } +} diff --git a/Mage/src/main/java/mage/game/events/UnattachedEvent.java b/Mage/src/main/java/mage/game/events/UnattachedEvent.java new file mode 100644 index 00000000000..3f155d303d2 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/UnattachedEvent.java @@ -0,0 +1,17 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author JayDi85 + */ +public class UnattachedEvent extends GameEvent { + + public UnattachedEvent(UUID targetId, UUID attachmentId, Permanent attachment, Ability source) { + super(GameEvent.EventType.UNATTACHED, targetId, null, attachment == null ? null : attachment.getControllerId()); + this.setSourceId(attachmentId); + } +} diff --git a/Mage/src/main/java/mage/game/events/ZoneChangeEvent.java b/Mage/src/main/java/mage/game/events/ZoneChangeEvent.java index 90685321417..b6de6b9ab90 100644 --- a/Mage/src/main/java/mage/game/events/ZoneChangeEvent.java +++ b/Mage/src/main/java/mage/game/events/ZoneChangeEvent.java @@ -2,6 +2,8 @@ package mage.game.events; import java.util.List; import java.util.UUID; + +import mage.abilities.Ability; import mage.constants.Zone; import mage.game.permanent.Permanent; @@ -15,34 +17,39 @@ public class ZoneChangeEvent extends GameEvent { private Zone toZone; private Zone originalToZone; private Permanent target; + private Ability source; // link to source ability, can be null in rare situations - public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) { - super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId); + public ZoneChangeEvent(Permanent target, Ability source, UUID playerId, Zone fromZone, Zone toZone) { + super(GameEvent.EventType.ZONE_CHANGE, target.getId(), source, playerId); this.fromZone = fromZone; this.setToZone(toZone); this.target = target; + this.source = source; } - public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, List appliedEffects) { - super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId); + public ZoneChangeEvent(Permanent target, Ability source, UUID playerId, Zone fromZone, Zone toZone, List appliedEffects) { + super(GameEvent.EventType.ZONE_CHANGE, target.getId(), source, playerId); this.fromZone = fromZone; this.setToZone(toZone); this.target = target; + this.source = source; if (appliedEffects != null) { this.appliedEffects = appliedEffects; } } - public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) { - super(EventType.ZONE_CHANGE, targetId, sourceId, playerId); + public ZoneChangeEvent(UUID targetId, Ability source, UUID playerId, Zone fromZone, Zone toZone) { + super(GameEvent.EventType.ZONE_CHANGE, targetId, source, playerId); this.fromZone = fromZone; this.setToZone(toZone); + this.source = source; } - public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, List appliedEffects) { - super(EventType.ZONE_CHANGE, targetId, sourceId, playerId); + public ZoneChangeEvent(UUID targetId, Ability source, UUID playerId, Zone fromZone, Zone toZone, List appliedEffects) { + super(GameEvent.EventType.ZONE_CHANGE, targetId, source, playerId); this.fromZone = fromZone; this.setToZone(toZone); + this.source = source; if (appliedEffects != null) { this.appliedEffects = appliedEffects; } @@ -87,4 +94,13 @@ public class ZoneChangeEvent extends GameEvent { return originalToZone; } + /** + * Source ability of the event, can be null in rare cases + * + * @return + */ + public Ability getSource() { + return this.source; + } + } diff --git a/Mage/src/main/java/mage/game/events/ZoneChangeGroupEvent.java b/Mage/src/main/java/mage/game/events/ZoneChangeGroupEvent.java index 213f3a39d97..a2cd7884f1a 100644 --- a/Mage/src/main/java/mage/game/events/ZoneChangeGroupEvent.java +++ b/Mage/src/main/java/mage/game/events/ZoneChangeGroupEvent.java @@ -18,7 +18,7 @@ public class ZoneChangeGroupEvent extends GameEvent { private final Set tokens; public ZoneChangeGroupEvent(Set cards, Set tokens, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) { - super(EventType.ZONE_CHANGE_GROUP, null, sourceId, playerId); + super(GameEvent.EventType.ZONE_CHANGE_GROUP, null, null, playerId); this.fromZone = fromZone; this.toZone = toZone; this.cards = cards; diff --git a/Mage/src/main/java/mage/game/permanent/Permanent.java b/Mage/src/main/java/mage/game/permanent/Permanent.java index 80706b1877f..f484eb00688 100644 --- a/Mage/src/main/java/mage/game/permanent/Permanent.java +++ b/Mage/src/main/java/mage/game/permanent/Permanent.java @@ -24,9 +24,9 @@ public interface Permanent extends Card, Controllable { boolean untap(Game game); - boolean tap(Game game); + boolean tap(Ability source, Game game); - boolean tap(boolean forCombat, Game game); + boolean tap(boolean forCombat, Ability source, Game game); /** * use tap(game) @@ -91,25 +91,23 @@ public interface Permanent extends Card, Controllable { int getAttachedToZoneChangeCounter(); - void attachTo(UUID permanentId, Game game); + void attachTo(UUID permanentId, Ability source, Game game); void unattach(Game game); - // boolean addAttachment(UUID permanentId, Game game); -// -// boolean removeAttachment(UUID permanentId, Game game); boolean canBeTargetedBy(MageObject source, UUID controllerId, Game game); boolean hasProtectionFrom(MageObject source, Game game); /** - * @param source + * @param attachment + * @param source can be null for default checks like state base * @param game * @param silentMode - use it to ignore warning message for users (e.g. for * checking only) * @return */ - boolean cantBeAttachedBy(MageObject source, Game game, boolean silentMode); + boolean cantBeAttachedBy(MageObject attachment, Ability source, Game game, boolean silentMode); boolean wasControlledFromStartOfControllerTurn(); @@ -117,23 +115,36 @@ public interface Permanent extends Card, Controllable { int getDamage(); - int damage(int damage, UUID sourceId, Game game); + int damage(int damage, UUID attackerId, Ability source, Game game); - int damage(int damage, UUID sourceId, Game game, boolean combat, boolean preventable); - - int damage(int damage, UUID sourceId, Game game, boolean combat, boolean preventable, List appliedEffects); + int damage(int damage, UUID attackerId, Ability source, Game game, boolean combat, boolean preventable); /** - * used in combat only to deal damage at the same time + * Uses in replace events only * * @param damage - * @param sourceId + * @param attackerId id of the permanent or player who make damage (source.getSourceId() in most cases) + * @param source can be null for default game actions like combat + * @param game + * @param combat + * @param preventable + * @param appliedEffects + * @return + */ + int damage(int damage, UUID attackerId, Ability source, Game game, boolean combat, boolean preventable, List appliedEffects); + + /** + * Uses in combat only to deal damage at the same time + * + * @param damage + * @param attackerId id of the permanent or player who make damage (source.getSourceId() in most cases) + * @param source can be null for default game actions like combat * @param game * @param preventable * @param combat * @return */ - int markDamage(int damage, UUID sourceId, Game game, boolean preventable, boolean combat); + int markDamage(int damage, UUID attackerId, Ability source, Game game, boolean preventable, boolean combat); void markLifelink(int damage); @@ -145,9 +156,15 @@ public interface Permanent extends Card, Controllable { MageObject getBasicMageObject(Game game); - boolean destroy(UUID sourceId, Game game, boolean noRegen); + boolean destroy(Ability source, Game game, boolean noRegen); - boolean sacrifice(UUID sourceId, Game game); + /** + * + * @param source can be null for state base actions + * @param game + * @return + */ + boolean sacrifice(Ability source, Game game); boolean regenerate(Ability source, Game game); @@ -155,7 +172,7 @@ public interface Permanent extends Card, Controllable { boolean fight(Permanent fightTarget, Ability source, Game game, boolean batchTrigger); - boolean entersBattlefield(UUID sourceId, Game game, Zone fromZone, boolean fireEvent); + boolean entersBattlefield(Ability source, Game game, Zone fromZone, boolean fireEvent); String getValue(GameState state); @@ -173,7 +190,7 @@ public interface Permanent extends Card, Controllable { void resetControl(); - boolean changeControllerId(UUID controllerId, Game game); + boolean changeControllerId(UUID controllerId, Game game, Ability source); boolean checkControlChanged(Game game); diff --git a/Mage/src/main/java/mage/game/permanent/PermanentCard.java b/Mage/src/main/java/mage/game/permanent/PermanentCard.java index 5fed87d284d..e8f2b638153 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentCard.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentCard.java @@ -163,8 +163,8 @@ public class PermanentCard extends PermanentImpl { } @Override - public boolean turnFaceUp(Game game, UUID playerId) { - if (super.turnFaceUp(game, playerId)) { + public boolean turnFaceUp(Ability source, Game game, UUID playerId) { + if (super.turnFaceUp(source, game, playerId)) { power.modifyBaseValue(power.getBaseValue()); toughness.modifyBaseValue(toughness.getBaseValue()); setManifested(false); diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 1506e04b6ee..87aee9ad462 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -500,17 +500,17 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean tap(Game game) { - return tap(false, game); + public boolean tap(Ability source, Game game) { + return tap(false, source, game); } @Override - public boolean tap(boolean forCombat, Game game) { + public boolean tap(boolean forCombat, Ability source, Game game) { //20091005 - 701.15a if (!tapped) { if (!replaceEvent(EventType.TAP, game)) { this.tapped = true; - game.fireEvent(new GameEvent(EventType.TAPPED, objectId, ownerId, controllerId, 0, forCombat)); + game.fireEvent(new GameEvent(GameEvent.EventType.TAPPED, objectId, source, controllerId, 0, forCombat)); return true; } } @@ -562,7 +562,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { if (!replaceEvent(EventType.TRANSFORM, game)) { setTransformed(!transformed); game.applyEffects(); - game.addSimultaneousEvent(GameEvent.getEvent(EventType.TRANSFORMED, getId(), getControllerId())); + game.addSimultaneousEvent(GameEvent.getEvent(GameEvent.EventType.TRANSFORMED, getId(), getControllerId())); return true; } } @@ -701,27 +701,29 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean changeControllerId(UUID controllerId, Game game) { - Player newController = game.getPlayer(controllerId); + public boolean changeControllerId(UUID newControllerId, Game game, Ability source) { + Player newController = game.getPlayer(newControllerId); + if (newController == null || !newController.isInGame()) { + return false; + } + // For each control change compared to last controler send a GAIN_CONTROL replace event to be able to prevent the gain control (e.g. Guardian Beast) - if (beforeResetControllerId != controllerId) { - GameEvent gainControlEvent = GameEvent.getEvent(GameEvent.EventType.GAIN_CONTROL, this.getId(), null, controllerId); + if (beforeResetControllerId != newControllerId) { + GameEvent gainControlEvent = GameEvent.getEvent(GameEvent.EventType.GAIN_CONTROL, this.getId(), null, newControllerId); if (game.replaceEvent(gainControlEvent)) { return false; } } - GameEvent loseControlEvent = GameEvent.getEvent(GameEvent.EventType.LOSE_CONTROL, this.getId(), null, controllerId); - + GameEvent loseControlEvent = GameEvent.getEvent(GameEvent.EventType.LOSE_CONTROL, this.getId(), null, newControllerId); if (game.replaceEvent(loseControlEvent)) { return false; } - if (newController != null && (!newController.hasLeft() || !newController.hasLost())) { - this.controllerId = controllerId; - return true; - } - return false; + // must change abilities controller too + this.controllerId = newControllerId; + this.getAbilities().setControllerId(newControllerId); + return true; } @Override @@ -733,8 +735,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { this.getAbilities(game).setControllerId(controllerId); game.getContinuousEffects().setController(objectId, controllerId); // the controller of triggered abilites is always set/checked before the abilities triggers so not needed here - game.fireEvent(new GameEvent(EventType.LOST_CONTROL, objectId, objectId, beforeResetControllerId)); - game.fireEvent(new GameEvent(EventType.GAINED_CONTROL, objectId, objectId, controllerId)); + game.fireEvent(new GameEvent(GameEvent.EventType.LOST_CONTROL, objectId, null, beforeResetControllerId)); + game.fireEvent(new GameEvent(GameEvent.EventType.GAINED_CONTROL, objectId, null, controllerId)); return true; } else if (isCopy()) {// Because the previous copied abilities can be from another controller - change controller in any case for abilities @@ -784,15 +786,15 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public void attachTo(UUID attachToObjectId, Game game) { + public void attachTo(UUID attachToObjectId, Ability source, Game game) { if (this.attachedTo != null && !Objects.equals(this.attachedTo, attachToObjectId)) { Permanent attachedToUntilNowObject = game.getPermanent(this.attachedTo); if (attachedToUntilNowObject != null) { - attachedToUntilNowObject.removeAttachment(this.objectId, game); + attachedToUntilNowObject.removeAttachment(this.objectId, source, game); } else { Card attachedToUntilNowCard = game.getCard(this.attachedTo); if (attachedToUntilNowCard != null) { - attachedToUntilNowCard.removeAttachment(this.objectId, game); + attachedToUntilNowCard.removeAttachment(this.objectId, source, game); } } @@ -835,72 +837,73 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public int damage(int damage, UUID sourceId, Game game) { - return damage(damage, sourceId, game, true, false, false, null); + public int damage(int damage, UUID attackerId, Ability source, Game game) { + return doDamage(damage, attackerId, source, game, true, false, false, null); } @Override - public int damage(int damage, UUID sourceId, Game game, boolean combat, boolean preventable) { - return damage(damage, sourceId, game, preventable, combat, false, null); + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combat, boolean preventable) { + return doDamage(damage, attackerId, source, game, preventable, combat, false, null); } @Override - public int damage(int damage, UUID sourceId, Game game, boolean combat, boolean preventable, List appliedEffects) { - return damage(damage, sourceId, game, preventable, combat, false, appliedEffects); + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combat, boolean preventable, List appliedEffects) { + return doDamage(damage, attackerId, source, game, preventable, combat, false, appliedEffects); } /** * @param damageAmount - * @param sourceId + * @param attackerId id of the permanent or player who make damage (source.getSourceId() in most cases) + * @param source * @param game * @param preventable * @param combat * @param markDamage If true, damage will be dealt later in applyDamage - * method + * method, uses only in inner markDamage. * @return */ - private int damage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat, boolean markDamage, List appliedEffects) { + private int doDamage(int damageAmount, UUID attackerId, Ability source, Game game, boolean preventable, boolean combat, boolean markDamage, List appliedEffects) { int damageDone = 0; - if (damageAmount > 0 && canDamage(game.getObject(sourceId), game)) { + if (damageAmount > 0 && canDamage(game.getObject(attackerId), game)) { if (this.isPlaneswalker()) { - damageDone = damagePlaneswalker(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects); + damageDone = damagePlaneswalker(damageAmount, attackerId, source, game, preventable, combat, markDamage, appliedEffects); } else { - damageDone = damageCreature(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects); + damageDone = damageCreature(damageAmount, attackerId, source, game, preventable, combat, markDamage, appliedEffects); } if (damageDone > 0) { UUID sourceControllerId = null; Abilities sourceAbilities = null; - MageObject source = game.getPermanentOrLKIBattlefield(sourceId); - if (source == null) { - StackObject stackObject = game.getStack().getStackObject(sourceId); + MageObject attacker = game.getPermanentOrLKIBattlefield(attackerId); + if (attacker == null) { + StackObject stackObject = game.getStack().getStackObject(attackerId); if (stackObject != null) { - source = stackObject.getStackAbility().getSourceObject(game); + attacker = stackObject.getStackAbility().getSourceObject(game); } else { - source = game.getObject(sourceId); + attacker = game.getObject(attackerId); } - if (source instanceof Spell) { - sourceAbilities = ((Spell) source).getAbilities(game); - sourceControllerId = ((Spell) source).getControllerId(); - } else if (source instanceof Card) { - sourceAbilities = ((Card) source).getAbilities(game); - sourceControllerId = ((Card) source).getOwnerId(); - } else if (source instanceof CommandObject) { - sourceControllerId = ((CommandObject) source).getControllerId(); - sourceAbilities = source.getAbilities(); + if (attacker instanceof Spell) { + sourceAbilities = ((Spell) attacker).getAbilities(game); + sourceControllerId = ((Spell) attacker).getControllerId(); + } else if (attacker instanceof Card) { + sourceAbilities = ((Card) attacker).getAbilities(game); + sourceControllerId = ((Card) attacker).getOwnerId(); + } else if (attacker instanceof CommandObject) { + sourceControllerId = ((CommandObject) attacker).getControllerId(); + sourceAbilities = attacker.getAbilities(); } else { - source = null; + attacker = null; } } else { - sourceAbilities = ((Permanent) source).getAbilities(game); - sourceControllerId = ((Permanent) source).getControllerId(); + sourceAbilities = ((Permanent) attacker).getAbilities(game); + sourceControllerId = ((Permanent) attacker).getControllerId(); } - if (source != null && sourceAbilities != null) { + if (attacker != null && sourceAbilities != null) { if (sourceAbilities.containsKey(LifelinkAbility.getInstance().getId())) { if (markDamage) { - game.getPermanent(sourceId).markLifelink(damageDone); + game.getPermanent(attackerId).markLifelink(damageDone); } else { Player player = game.getPlayer(sourceControllerId); - player.gainLife(damageDone, game, sourceId); + player.gainLife(damageDone, game, source); } } if (sourceAbilities.containsKey(DeathtouchAbility.getInstance().getId())) { @@ -912,14 +915,14 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { // Unstable ability - Earl of Squirrel if (sourceAbilities.containsKey(SquirrellinkAbility.getInstance().getId())) { Player player = game.getPlayer(sourceControllerId); - new SquirrelToken().putOntoBattlefield(damageDone, game, sourceId, player.getId()); + new SquirrelToken().putOntoBattlefield(damageDone, game, source, player.getId()); } - dealtDamageByThisTurn.add(new MageObjectReference(source, game)); + dealtDamageByThisTurn.add(new MageObjectReference(attacker, game)); } - if (source == null) { + if (attacker == null) { game.informPlayers(getLogName() + " gets " + damageDone + " damage"); } else { - game.informPlayers(source.getLogName() + " deals " + damageDone + " damage to " + getLogName()); + game.informPlayers(attacker.getLogName() + " deals " + damageDone + " damage to " + getLogName()); } } } @@ -932,15 +935,15 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public int markDamage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat) { - return damage(damageAmount, sourceId, game, preventable, combat, true, null); + public int markDamage(int damageAmount, UUID attackerId, Ability source, Game game, boolean preventable, boolean combat) { + return doDamage(damageAmount, attackerId, source, game, preventable, combat, true, null); } @Override public int applyDamage(Game game) { if (markedLifelink > 0) { Player player = game.getPlayer(this.getControllerId()); - player.gainLife(markedLifelink, game, this.getId()); + player.gainLife(markedLifelink, game, null); markedLifelink = 0; } if (markedDamage == null) { @@ -969,18 +972,18 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { deathtouched = false; } - protected int damagePlaneswalker(int damage, UUID sourceId, Game game, boolean preventable, boolean combat, boolean markDamage, List appliedEffects) { - GameEvent event = new DamagePlaneswalkerEvent(objectId, sourceId, controllerId, damage, preventable, combat); + protected int damagePlaneswalker(int damage, UUID attackerId, Ability source, Game game, boolean preventable, boolean combat, boolean markDamage, List appliedEffects) { + GameEvent event = new DamagePlaneswalkerEvent(objectId, attackerId, controllerId, damage, preventable, combat); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { - int actualDamage = checkProtectionAbilities(event, sourceId, game); + int actualDamage = checkProtectionAbilities(event, attackerId, source, game); if (actualDamage > 0) { int countersToRemove = actualDamage; if (countersToRemove > getCounters(game).getCount(CounterType.LOYALTY)) { countersToRemove = getCounters(game).getCount(CounterType.LOYALTY); } - removeCounters(CounterType.LOYALTY.getName(), countersToRemove, game); - DamagedEvent damagedEvent = new DamagedPlaneswalkerEvent(objectId, sourceId, controllerId, actualDamage, combat); + removeCounters(CounterType.LOYALTY.getName(), countersToRemove, source, game); + DamagedEvent damagedEvent = new DamagedPlaneswalkerEvent(objectId, attackerId, controllerId, actualDamage, combat); game.fireEvent(damagedEvent); game.getState().addSimultaneousDamage(damagedEvent, game); return actualDamage; @@ -989,23 +992,22 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { return 0; } - protected int damageCreature(int damage, UUID sourceId, Game game, boolean preventable, boolean combat, boolean markDamage, List appliedEffects) { - GameEvent event = new DamageCreatureEvent(objectId, sourceId, controllerId, damage, preventable, combat); + protected int damageCreature(int damage, UUID attackerId, Ability source, Game game, boolean preventable, boolean combat, boolean markDamage, List appliedEffects) { + GameEvent event = new DamageCreatureEvent(this.getId(), attackerId, this.getControllerId(), damage, preventable, combat); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { - int actualDamage = checkProtectionAbilities(event, sourceId, game); + int actualDamage = checkProtectionAbilities(event, attackerId, source, game); if (actualDamage > 0) { - //Permanent source = game.getPermanent(sourceId); - MageObject source = game.getObject(sourceId); - if (source != null && (source.getAbilities().containsKey(InfectAbility.getInstance().getId()) - || source.getAbilities().containsKey(WitherAbility.getInstance().getId()))) { + MageObject attacker = game.getObject(attackerId); + if (attacker != null && (attacker.getAbilities().containsKey(InfectAbility.getInstance().getId()) + || attacker.getAbilities().containsKey(WitherAbility.getInstance().getId()))) { if (markDamage) { // mark damage only - markDamage(CounterType.M1M1.createInstance(actualDamage), source); + markDamage(CounterType.M1M1.createInstance(actualDamage), attacker); } else { Ability damageSourceAbility = null; - if (source instanceof Permanent) { - damageSourceAbility = ((Permanent) source).getSpellAbility(); + if (attacker instanceof Permanent) { + damageSourceAbility = ((Permanent) attacker).getSpellAbility(); } // deal damage immediately addCounters(CounterType.M1M1.createInstance(actualDamage), damageSourceAbility, game); @@ -1013,7 +1015,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } else { this.damage = CardUtil.addWithOverflowCheck(this.damage, actualDamage); } - DamagedEvent damagedEvent = new DamagedCreatureEvent(objectId, sourceId, controllerId, actualDamage, combat); + DamagedEvent damagedEvent = new DamagedCreatureEvent(this.getId(), attackerId, this.getControllerId(), actualDamage, combat); game.fireEvent(damagedEvent); game.getState().addSimultaneousDamage(damagedEvent, game); return actualDamage; @@ -1022,14 +1024,14 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { return 0; } - private int checkProtectionAbilities(GameEvent event, UUID sourceId, Game game) { - MageObject source = game.getObject(sourceId); - if (source != null && hasProtectionFrom(source, game)) { - GameEvent preventEvent = new PreventDamageEvent(this.objectId, sourceId, this.controllerId, event.getAmount(), ((DamageEvent) event).isCombatDamage()); + private int checkProtectionAbilities(GameEvent event, UUID attackerId, Ability source, Game game) { + MageObject attacker = game.getObject(attackerId); + if (attacker != null && hasProtectionFrom(attacker, game)) { + GameEvent preventEvent = new PreventDamageEvent(this.getId(), attackerId, source, this.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage()); if (!game.replaceEvent(preventEvent)) { int preventedDamage = event.getAmount(); event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, this.objectId, sourceId, this.controllerId, preventedDamage)); + game.fireEvent(new PreventedDamageEvent(this.getId(), attackerId, source, this.getControllerId(), preventedDamage)); return 0; } } @@ -1044,18 +1046,18 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean entersBattlefield(UUID sourceId, Game game, Zone fromZone, boolean fireEvent) { + public boolean entersBattlefield(Ability source, Game game, Zone fromZone, boolean fireEvent) { controlledFromStartOfControllerTurn = false; if (this.isFaceDown(game)) { // remove some attributes here, because first apply effects comes later otherwise abilities (e.g. color related) will unintended trigger MorphAbility.setPermanentToFaceDownCreature(this); } - EntersTheBattlefieldEvent event = new EntersTheBattlefieldEvent(this, sourceId, getControllerId(), fromZone, EnterEventType.SELF); + EntersTheBattlefieldEvent event = new EntersTheBattlefieldEvent(this, source, getControllerId(), fromZone, EnterEventType.SELF); if (game.replaceEvent(event)) { return false; } - event = new EntersTheBattlefieldEvent(this, sourceId, getControllerId(), fromZone); + event = new EntersTheBattlefieldEvent(this, source, getControllerId(), fromZone); if (!game.replaceEvent(event)) { if (fireEvent) { game.addSimultaneousEvent(event); @@ -1088,7 +1090,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } // needed to get the correct possible targets if target rule modification effects are active // e.g. Fiendslayer Paladin tried to target with Ultimate Price - return !game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(EventType.TARGET, this.getId(), source.getId(), sourceControllerId), null, game, true); + return !game.getContinuousEffects().preventedByRuleModification(new TargetEvent(this, source.getId(), sourceControllerId), null, game, true); } return true; @@ -1105,19 +1107,19 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean cantBeAttachedBy(MageObject source, Game game, boolean silentMode) { + public boolean cantBeAttachedBy(MageObject attachment, Ability source, Game game, boolean silentMode) { for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) { - if (!(source.hasSubtype(SubType.AURA, game) + if (!(attachment.hasSubtype(SubType.AURA, game) && !ability.removesAuras()) - && !(source.hasSubtype(SubType.EQUIPMENT, game) + && !(attachment.hasSubtype(SubType.EQUIPMENT, game) && !ability.removesEquipment())) { - if (!source.getId().equals(ability.getAuraIdNotToBeRemoved()) - && !ability.canTarget(source, game)) { - return !ability.getDoesntRemoveControlled() || isControlledBy(game.getControllerId(source.getId())); + if (!attachment.getId().equals(ability.getAuraIdNotToBeRemoved()) + && !ability.canTarget(attachment, game)) { + return !ability.getDoesntRemoveControlled() || isControlledBy(game.getControllerId(attachment.getId())); } } } - return game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(EventType.STAY_ATTACHED, objectId, source.getId(), null), null, game, silentMode); + return game.getContinuousEffects().preventedByRuleModification(new StayAttachedEvent(this.getId(), attachment.getId(), source), null, game, silentMode); } protected boolean canDamage(MageObject source, Game game) { @@ -1128,7 +1130,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean destroy(UUID sourceId, Game game, boolean noRegen) { + public boolean destroy(Ability source, Game game, boolean noRegen) { // Only permanets on the battlefield can be destroyed if (!game.getState().getZone(getId()).equals(Zone.BATTLEFIELD)) { return false; @@ -1138,10 +1140,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { return false; } - if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) { + if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DESTROY_PERMANENT, objectId, source, controllerId, noRegen ? 1 : 0))) { // this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) it's still // handled as successful destroying (but not as sucessful "dies this way" for destroying). - if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) { + if (moveToZone(Zone.GRAVEYARD, source, game, false)) { if (!game.isSimulation()) { String logName; Card card = game.getCard(this.getId()); @@ -1151,12 +1153,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { logName = this.getLogName(); } if (this.isCreature()) { - game.informPlayers(logName + " died"); + game.informPlayers(logName + " died" + CardUtil.getSourceLogName(game, " by ", source, "", "")); } else { - game.informPlayers(logName + " was destroyed"); + game.informPlayers(logName + " was destroyed" + CardUtil.getSourceLogName(game, " by ", source, "", "")); } } - game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT, objectId, sourceId, controllerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DESTROYED_PERMANENT, objectId, source, controllerId)); } return true; } @@ -1164,17 +1166,17 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean sacrifice(UUID sourceId, Game game) { + public boolean sacrifice(Ability source, Game game) { //20091005 - 701.13 - if (isPhasedIn() && !game.replaceEvent(GameEvent.getEvent(EventType.SACRIFICE_PERMANENT, objectId, sourceId, controllerId))) { + if (isPhasedIn() && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SACRIFICE_PERMANENT, objectId, source, controllerId))) { // Commander replacement effect or Rest in Peace (exile instead of graveyard) in play does not prevent successful sacrifice // so the return value of the moveToZone is not taken into account here - moveToZone(Zone.GRAVEYARD, sourceId, game, false); + moveToZone(Zone.GRAVEYARD, source, game, false); Player player = game.getPlayer(getControllerId()); if (player != null && !game.isSimulation()) { - game.informPlayers(player.getLogName() + " sacrificed " + this.getLogName()); + game.informPlayers(player.getLogName() + " sacrificed " + this.getLogName() + CardUtil.getSourceLogName(game, source)); } - game.fireEvent(GameEvent.getEvent(EventType.SACRIFICED_PERMANENT, objectId, sourceId, controllerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.SACRIFICED_PERMANENT, objectId, source, controllerId)); return true; } return false; @@ -1183,15 +1185,15 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { @Override public boolean regenerate(Ability source, Game game) { //20110930 - 701.12 - if (!game.replaceEvent(GameEvent.getEvent(EventType.REGENERATE, objectId, source.getSourceId(), controllerId))) { - this.tap(game); + if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.REGENERATE, objectId, source, controllerId))) { + this.tap(source, game); this.removeFromCombat(game); this.removeAllDamage(game); // remove one regen shield RegenerateSourceEffect.decRegenerationShieldsAmount(game, this.getId()); - game.fireEvent(GameEvent.getEvent(EventType.REGENERATED, objectId, source.getSourceId(), controllerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.REGENERATED, objectId, source, controllerId)); return true; } return false; @@ -1207,12 +1209,23 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { this.toughness.boostValue(toughness); } + /** + * Simple event without source + * @param eventType + * @param game + */ protected void fireEvent(EventType eventType, Game game) { - game.fireEvent(GameEvent.getEvent(eventType, this.objectId, ownerId)); // controllerId seems to me more logical (LevelX2) + game.fireEvent(GameEvent.getEvent(eventType, this.objectId, null, this.controllerId)); } + /** + * Simple event without source + * @param eventType + * @param game + * @return + */ protected boolean replaceEvent(EventType eventType, Game game) { - return game.replaceEvent(GameEvent.getEvent(eventType, this.objectId, ownerId));// controllerId seems to me more logical (LevelX2) + return game.replaceEvent(GameEvent.getEvent(eventType, this.objectId, null, this.controllerId)); } @Override @@ -1580,19 +1593,21 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { @Override public boolean fight(Permanent fightTarget, Ability source, Game game, boolean batchTrigger) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, fightTarget.getId(), getId(), source.getControllerId())); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, getId(), fightTarget.getId(), source.getControllerId())); - damage(fightTarget.getPower().getValue(), fightTarget.getId(), game); - fightTarget.damage(getPower().getValue(), getId(), game); - if (!batchTrigger) { - return true; + // double fight events for each creature + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, fightTarget.getId(), source, source.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, getId(), source, source.getControllerId())); + damage(fightTarget.getPower().getValue(), fightTarget.getId(), source, game); + fightTarget.damage(getPower().getValue(), getId(), source, game); + + if (batchTrigger) { + Set morSet = new HashSet<>(); + morSet.add(new MageObjectReference(this, game)); + morSet.add(new MageObjectReference(fightTarget, game)); + String data = UUID.randomUUID().toString(); + game.getState().setValue("batchFight_" + data, morSet); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BATCH_FIGHT, getId(), source, source.getControllerId(), data, 0)); } - Set morSet = new HashSet<>(); - morSet.add(new MageObjectReference(this, game)); - morSet.add(new MageObjectReference(fightTarget, game)); - String data = UUID.randomUUID().toString(); - game.getState().setValue("batchFight_" + data, morSet); - game.fireEvent(GameEvent.getEvent(EventType.BATCH_FIGHT, getId(), getId(), source.getControllerId(), data, 0)); + return true; } @@ -1630,18 +1645,18 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List appliedEffects) { + public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List appliedEffects) { Zone fromZone = game.getState().getZone(objectId); Player controller = game.getPlayer(controllerId); if (controller != null) { - ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, controllerId, fromZone, toZone, appliedEffects); + ZoneChangeEvent event = new ZoneChangeEvent(this, source, controllerId, fromZone, toZone, appliedEffects); ZoneChangeInfo zoneChangeInfo; if (toZone == Zone.LIBRARY) { zoneChangeInfo = new ZoneChangeInfo.Library(event, flag /* put on top */); } else { zoneChangeInfo = new ZoneChangeInfo(event); } - boolean successfullyMoved = ZonesHandler.moveCard(zoneChangeInfo, game); + boolean successfullyMoved = ZonesHandler.moveCard(zoneChangeInfo, game, source); //20180810 - 701.3d detachAllAttachments(game); return successfullyMoved; @@ -1650,12 +1665,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { Zone fromZone = game.getState().getZone(objectId); - ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, ownerId, fromZone, Zone.EXILED, appliedEffects); + ZoneChangeEvent event = new ZoneChangeEvent(this, source, ownerId, fromZone, Zone.EXILED, appliedEffects); ZoneChangeInfo.Exile zcInfo = new ZoneChangeInfo.Exile(event, exileId, name); - boolean successfullyMoved = ZonesHandler.moveCard(zcInfo, game); + boolean successfullyMoved = ZonesHandler.moveCard(zcInfo, game, source); //20180810 - 701.3d detachAllAttachments(game); return successfullyMoved; diff --git a/Mage/src/main/java/mage/game/permanent/token/BelzenlokDemonToken.java b/Mage/src/main/java/mage/game/permanent/token/BelzenlokDemonToken.java index 61a0954317f..50e8f0c1500 100644 --- a/Mage/src/main/java/mage/game/permanent/token/BelzenlokDemonToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/BelzenlokDemonToken.java @@ -95,7 +95,7 @@ class BelzenlokDemonTokenEffect extends OneShotEffect { } else { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.damage(6, source.getSourceId(), game); + controller.damage(6, source.getSourceId(), source, game); } } return true; diff --git a/Mage/src/main/java/mage/game/permanent/token/SengirNosferatuBatToken.java b/Mage/src/main/java/mage/game/permanent/token/SengirNosferatuBatToken.java index 3af7624285c..1a7d90f50ef 100644 --- a/Mage/src/main/java/mage/game/permanent/token/SengirNosferatuBatToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/SengirNosferatuBatToken.java @@ -85,7 +85,7 @@ class ReturnSengirNosferatuEffect extends OneShotEffect { player.chooseTarget(Outcome.PutCreatureInPlay, target, source, game); Card card = game.getCard(target.getTargets().get(0)); if (card != null) { - return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + return card.moveToZone(Zone.BATTLEFIELD, source, game, false); } } return false; diff --git a/Mage/src/main/java/mage/game/permanent/token/Token.java b/Mage/src/main/java/mage/game/permanent/token/Token.java index 7cc1fbaba62..dde696755f3 100644 --- a/Mage/src/main/java/mage/game/permanent/token/Token.java +++ b/Mage/src/main/java/mage/game/permanent/token/Token.java @@ -27,13 +27,13 @@ public interface Token extends MageObject { void addAbility(Ability ability); - boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId); + boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId); - boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking); + boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking); - boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer); + boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer); - boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer, boolean created); + boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer, boolean created); void setPower(int power); diff --git a/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java b/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java index 8732c5d6071..5f1dc797f8c 100644 --- a/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java +++ b/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java @@ -123,13 +123,13 @@ public abstract class TokenImpl extends MageObjectImpl implements Token { } @Override - public boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId) { - return this.putOntoBattlefield(amount, game, sourceId, controllerId, false, false); + public boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId) { + return this.putOntoBattlefield(amount, game, source, controllerId, false, false); } @Override - public boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking) { - return putOntoBattlefield(amount, game, sourceId, controllerId, tapped, attacking, null); + public boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking) { + return putOntoBattlefield(amount, game, source, controllerId, tapped, attacking, null); } private String getSetCode(Game game, UUID sourceId) { @@ -158,12 +158,12 @@ public abstract class TokenImpl extends MageObjectImpl implements Token { } @Override - public boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer) { - return putOntoBattlefield(amount, game, sourceId, controllerId, tapped, attacking, attackedPlayer, true); + public boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer) { + return putOntoBattlefield(amount, game, source, controllerId, tapped, attacking, attackedPlayer, true); } @Override - public boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer, boolean created) { + public boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer, boolean created) { Player controller = game.getPlayer(controllerId); if (controller == null) { return false; @@ -173,16 +173,20 @@ public abstract class TokenImpl extends MageObjectImpl implements Token { } lastAddedTokenIds.clear(); - CreateTokenEvent event = new CreateTokenEvent(sourceId, controllerId, amount, this); + CreateTokenEvent event = new CreateTokenEvent(source, controllerId, amount, this); if (!created || !game.replaceEvent(event)) { - putOntoBattlefieldHelper(event, game, tapped, attacking, attackedPlayer, created); + putOntoBattlefieldHelper(event, game, source, tapped, attacking, attackedPlayer, created); return true; } return false; } - private static void putOntoBattlefieldHelper(CreateTokenEvent event, Game game, boolean tapped, boolean attacking, UUID attackedPlayer, boolean created) { + private static void putOntoBattlefieldHelper(CreateTokenEvent event, Game game, Ability source, boolean tapped, boolean attacking, UUID attackedPlayer, boolean created) { Player controller = game.getPlayer(event.getPlayerId()); + if (controller == null) { + return; + } + Token token = event.getToken(); int amount = event.getAmount(); @@ -200,7 +204,7 @@ public abstract class TokenImpl extends MageObjectImpl implements Token { } game.setScopeRelevant(true); for (Permanent permanent : permanents) { - if (permanent.entersBattlefield(event.getSourceId(), game, Zone.OUTSIDE, true)) { + if (permanent.entersBattlefield(source, game, Zone.OUTSIDE, true)) { permanentsEntered.add(permanent); } else { game.getPermanentsEntering().remove(permanent.getId()); @@ -219,7 +223,7 @@ public abstract class TokenImpl extends MageObjectImpl implements Token { } game.addSimultaneousEvent(new ZoneChangeEvent(permanent, permanent.getControllerId(), Zone.OUTSIDE, Zone.BATTLEFIELD)); if (permanent instanceof PermanentToken && created) { - game.addSimultaneousEvent(new CreatedTokenEvent(event.getSourceId(), (PermanentToken) permanent)); + game.addSimultaneousEvent(new CreatedTokenEvent(source, (PermanentToken) permanent)); } if (attacking && game.getCombat() != null && game.getActivePlayerId().equals(permanent.getControllerId())) { game.getCombat().addAttackingCreature(permanent.getId(), game, attackedPlayer); diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index a30e8cec7e5..1767c04f9c9 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -22,6 +22,8 @@ import mage.counters.Counters; import mage.filter.FilterMana; import mage.game.Game; import mage.game.GameState; +import mage.game.events.CopiedStackObjectEvent; +import mage.game.events.CopyStackObjectEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; @@ -243,7 +245,7 @@ public class Spell extends StackObjImpl implements Card { if (!game.isSimulation()) { game.informPlayers(getName() + " has been fizzled."); } - counter(null, game); + counter(null, /*this.getSpellAbility()*/ game); return false; } else if (this.isEnchantment() && this.hasSubtype(SubType.AURA, game)) { if (ability.getTargets().stillLegal(ability, game)) { @@ -265,7 +267,7 @@ public class Spell extends StackObjImpl implements Card { EmptyToken token = new EmptyToken(); CardUtil.copyTo(token).from(card); // The token that a resolving copy of a spell becomes isn’t said to have been “created.” (2020-09-25) - if (token.putOntoBattlefield(1, game, ability.getSourceId(), getControllerId(), false, false, null, false)) { + if (token.putOntoBattlefield(1, game, ability, getControllerId(), false, false, null, false)) { permId = token.getLastAddedToken(); flag = true; } @@ -318,14 +320,14 @@ public class Spell extends StackObjImpl implements Card { if (!game.isSimulation()) { game.informPlayers(getName() + " has been fizzled."); } - counter(null, game); + counter(null, /*this.getSpellAbility()*/ game); return false; } } else if (isCopy()) { EmptyToken token = new EmptyToken(); CardUtil.copyTo(token).from(card); // The token that a resolving copy of a spell becomes isn’t said to have been “created.” (2020-09-25) - token.putOntoBattlefield(1, game, ability.getSourceId(), getControllerId(), false, false, null, false); + token.putOntoBattlefield(1, game, ability, getControllerId(), false, false, null, false); return true; } else { return controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null); @@ -394,21 +396,25 @@ public class Spell extends StackObjImpl implements Card { } @Override - public void counter(UUID sourceId, Game game) { - this.counter(sourceId, game, Zone.GRAVEYARD, false, ZoneDetail.NONE); + public void counter(Ability source, Game game) { + this.counter(source, game, Zone.GRAVEYARD, false, ZoneDetail.NONE); } @Override - public void counter(UUID sourceId, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail) { + public void counter(Ability source, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail) { + // source can be null for fizzled spells, found only one place with that usage -- Rebound Ability: + // event.getSourceId().equals(source.getSourceId()) + // TODO: so later it must be replaced to another technics with non null source + UUID counteringSourceId = (source == null ? null : source.getSourceId()); this.countered = true; if (!isCopy()) { - Player player = game.getPlayer(game.getControllerId(sourceId)); + Player player = game.getPlayer(game.getControllerId(counteringSourceId)); if (player == null) { player = game.getPlayer(getControllerId()); } if (player != null) { Ability counteringAbility = null; - MageObject counteringObject = game.getObject(sourceId); + MageObject counteringObject = game.getObject(counteringSourceId); if (counteringObject instanceof StackObject) { counteringAbility = ((StackObject) counteringObject).getStackAbility(); } @@ -692,13 +698,13 @@ public class Spell extends StackObjImpl implements Card { } @Override - public boolean turnFaceUp(Game game, UUID playerId) { + public boolean turnFaceUp(Ability source, Game game, UUID playerId) { setFaceDown(false, game); return true; } @Override - public boolean turnFaceDown(Game game, UUID playerId) { + public boolean turnFaceDown(Ability source, Game game, UUID playerId) { setFaceDown(true, game); return true; } @@ -770,57 +776,57 @@ public class Spell extends StackObjImpl implements Card { } @Override - public boolean removeFromZone(Game game, Zone fromZone, UUID sourceId) { - return card.removeFromZone(game, fromZone, sourceId); + public boolean removeFromZone(Game game, Zone fromZone, Ability source) { + return card.removeFromZone(game, fromZone, source); } @Override - public boolean moveToZone(Zone zone, UUID sourceId, Game game, boolean flag) { - return moveToZone(zone, sourceId, game, flag, null); + public boolean moveToZone(Zone zone, Ability source, Game game, boolean flag) { + return moveToZone(zone, source, game, flag, null); } @Override - public boolean moveToZone(Zone zone, UUID sourceId, Game game, boolean flag, List appliedEffects) { + public boolean moveToZone(Zone zone, Ability source, Game game, boolean flag, List appliedEffects) { // 706.10a If a copy of a spell is in a zone other than the stack, it ceases to exist. // If a copy of a card is in any zone other than the stack or the battlefield, it ceases to exist. // These are state-based actions. See rule 704. if (this.isCopy() && zone != Zone.STACK) { return true; } - return card.moveToZone(zone, sourceId, game, flag, appliedEffects); + return card.moveToZone(zone, source, game, flag, appliedEffects); } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game) { - return moveToExile(exileId, name, sourceId, game, null); + public boolean moveToExile(UUID exileId, String name, Ability source, Game game) { + return moveToExile(exileId, name, source, game, null); } @Override - public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List appliedEffects) { + public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List appliedEffects) { if (this.isCopy()) { game.getStack().remove(this, game); return true; } - return this.card.moveToExile(exileId, name, sourceId, game, appliedEffects); + return this.card.moveToExile(exileId, name, source, game, appliedEffects); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId) { throw new UnsupportedOperationException("Unsupported operation"); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped) { + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown) { + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped, boolean facedown) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, List appliedEffects) { + public boolean putOntoBattlefield(Game game, Zone fromZone, Ability source, UUID controllerId, boolean tapped, boolean facedown, List appliedEffects) { throw new UnsupportedOperationException("Not supported yet."); } @@ -930,13 +936,13 @@ public class Spell extends StackObjImpl implements Card { } @Override - public void removeCounters(String name, int amount, Game game) { - card.removeCounters(name, amount, game); + public void removeCounters(String name, int amount, Ability source, Game game) { + card.removeCounters(name, amount, source, game); } @Override - public void removeCounters(Counter counter, Game game) { - card.removeCounters(counter, game); + public void removeCounters(Counter counter, Ability source, Game game) { + card.removeCounters(counter, source, game); } public Card getCard() { @@ -1025,8 +1031,8 @@ public class Spell extends StackObjImpl implements Card { } @Override - public void checkForCountersToAdd(Permanent permanent, Game game) { - card.checkForCountersToAdd(permanent, game); + public void checkForCountersToAdd(Permanent permanent, Ability source, Game game) { + card.checkForCountersToAdd(permanent, source, game); } @Override @@ -1037,7 +1043,7 @@ public class Spell extends StackObjImpl implements Card { @Override public StackObject createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets, int amount) { Spell spellCopy = null; - GameEvent gameEvent = GameEvent.getEvent(EventType.COPY_STACKOBJECT, this.getId(), source.getSourceId(), newControllerId, amount); + GameEvent gameEvent = new CopyStackObjectEvent(source, this, newControllerId, amount); if (game.replaceEvent(gameEvent)) { return null; } @@ -1048,7 +1054,7 @@ public class Spell extends StackObjImpl implements Card { if (chooseNewTargets) { spellCopy.chooseNewTargets(game, newControllerId); } - game.fireEvent(new GameEvent(EventType.COPIED_STACKOBJECT, spellCopy.getId(), this.getId(), newControllerId)); + game.fireEvent(new CopiedStackObjectEvent(this, spellCopy, newControllerId)); } return spellCopy; } @@ -1078,12 +1084,12 @@ public class Spell extends StackObjImpl implements Card { } @Override - public boolean addAttachment(UUID permanentId, Game game) { + public boolean addAttachment(UUID permanentId, Ability source, Game game) { throw new UnsupportedOperationException("Not supported."); //To change body of generated methods, choose Tools | Templates. } @Override - public boolean removeAttachment(UUID permanentId, Game game) { + public boolean removeAttachment(UUID permanentId, Ability source, Game game) { throw new UnsupportedOperationException("Not supported."); //To change body of generated methods, choose Tools | Templates. } diff --git a/Mage/src/main/java/mage/game/stack/SpellStack.java b/Mage/src/main/java/mage/game/stack/SpellStack.java index fe58bfebeea..7a8bb227ea2 100644 --- a/Mage/src/main/java/mage/game/stack/SpellStack.java +++ b/Mage/src/main/java/mage/game/stack/SpellStack.java @@ -5,6 +5,7 @@ import java.util.ArrayDeque; import java.util.Date; import java.util.UUID; import mage.MageObject; +import mage.abilities.Ability; import mage.constants.Zone; import mage.constants.ZoneDetail; import mage.game.Game; @@ -58,16 +59,16 @@ public class SpellStack extends ArrayDeque { return false; } - public boolean counter(UUID objectId, UUID sourceId, Game game) { - return counter(objectId, sourceId, game, Zone.GRAVEYARD, false, ZoneDetail.TOP); + public boolean counter(UUID objectId, Ability source, Game game) { + return counter(objectId, source, game, Zone.GRAVEYARD, false, ZoneDetail.TOP); } - public boolean counter(UUID objectId, UUID sourceId, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail) { + public boolean counter(UUID objectId, Ability source, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail) { // the counter logic is copied by some spells to handle replacement effects of the countered spell // so if logic is changed here check those spells for needed changes too // Concerned cards to check: Hinder, Spell Crumple StackObject stackObject = getStackObject(objectId); - MageObject sourceObject = game.getObject(sourceId); + MageObject sourceObject = game.getObject(source.getSourceId()); if (stackObject != null && sourceObject != null) { MageObject targetSourceObject = game.getObject(stackObject.getSourceId()); String counteredObjectName, targetSourceName; @@ -81,15 +82,15 @@ public class SpellStack extends ArrayDeque { } else { counteredObjectName = "Ability (" + stackObject.getStackAbility().getRule(targetSourceName) + ") of " + targetSourceName; } - if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, objectId, sourceId, stackObject.getControllerId()))) { + if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, objectId, source, stackObject.getControllerId()))) { if (!(stackObject instanceof Spell)) { // spells are removed from stack by the card movement this.remove(stackObject, game); } - stackObject.counter(sourceId, game, zone, owner, zoneDetail); + stackObject.counter(source, game, zone, owner, zoneDetail); if (!game.isSimulation()) { game.informPlayers(counteredObjectName + " is countered by " + sourceObject.getLogName()); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, objectId, sourceId, stackObject.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, objectId, source, stackObject.getControllerId())); return true; } else if (!game.isSimulation()) { game.informPlayers(counteredObjectName + " could not be countered by " + sourceObject.getLogName()); diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 329634eb54b..1380728a2c6 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -20,6 +20,8 @@ import mage.cards.Card; import mage.cards.FrameStyle; import mage.constants.*; import mage.game.Game; +import mage.game.events.CopiedStackObjectEvent; +import mage.game.events.CopyStackObjectEvent; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; @@ -90,7 +92,7 @@ public class StackAbility extends StackObjImpl implements Ability { if (!game.isSimulation()) { game.informPlayers("Ability has been fizzled: " + getRule()); } - counter(null, game); + counter(null, /*this*/ game); game.getStack().remove(this, game); return false; } @@ -100,13 +102,13 @@ public class StackAbility extends StackObjImpl implements Ability { } @Override - public void counter(UUID sourceId, Game game) { + public void counter(Ability source, Game game) { // zone, owner, top ignored - this.counter(sourceId, game, Zone.GRAVEYARD, true, ZoneDetail.TOP); + this.counter(source, game, Zone.GRAVEYARD, true, ZoneDetail.TOP); } @Override - public void counter(UUID sourceId, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail) { + public void counter(Ability source, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail) { //20100716 - 603.8 if (ability instanceof StateTriggeredAbility) { ((StateTriggeredAbility) ability).counter(game); @@ -579,7 +581,7 @@ public class StackAbility extends StackObjImpl implements Ability { public StackObject createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets, int amount) { StackAbility newStackAbility = null; - GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.COPY_STACKOBJECT, this.getId(), source.getSourceId(), newControllerId, amount); + GameEvent gameEvent = new CopyStackObjectEvent(source, this, newControllerId, amount); if (game.replaceEvent(gameEvent)) { return null; } @@ -596,7 +598,7 @@ public class StackAbility extends StackObjImpl implements Ability { newAbility.getTargets().chooseTargets(outcome, newControllerId, newAbility, false, game, false); } } - game.fireEvent(new GameEvent(GameEvent.EventType.COPIED_STACKOBJECT, newStackAbility.getId(), this.getId(), newControllerId)); + game.fireEvent(new CopiedStackObjectEvent(this, newStackAbility, newControllerId)); } return newStackAbility; } diff --git a/Mage/src/main/java/mage/game/stack/StackObject.java b/Mage/src/main/java/mage/game/stack/StackObject.java index 4536ee44f1c..9517243ce40 100644 --- a/Mage/src/main/java/mage/game/stack/StackObject.java +++ b/Mage/src/main/java/mage/game/stack/StackObject.java @@ -16,13 +16,17 @@ public interface StackObject extends MageObject, Controllable { UUID getSourceId(); - void counter(UUID sourceId, Game game); + /** + * + * @param source null for fizzled events (sourceId will be null) + * @param game + */ + void counter(Ability source, Game game); - void counter(UUID sourceId, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail); + void counter(Ability source, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail); Ability getStackAbility(); - // int getConvertedManaCost(); boolean chooseNewTargets(Game game, UUID playerId, boolean forceChange, boolean onlyOneTarget, FilterPermanent filterNewTarget); StackObject createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets); diff --git a/Mage/src/main/java/mage/game/turn/CombatDamageStep.java b/Mage/src/main/java/mage/game/turn/CombatDamageStep.java index 823c6a2aa0f..14ea24198c5 100644 --- a/Mage/src/main/java/mage/game/turn/CombatDamageStep.java +++ b/Mage/src/main/java/mage/game/turn/CombatDamageStep.java @@ -27,7 +27,7 @@ public class CombatDamageStep extends Step { @Override public void priority(Game game, UUID activePlayerId, boolean resuming) { - game.fireEvent(new GameEvent(EventType.COMBAT_DAMAGE_STEP_PRIORITY, null, null, activePlayerId)); + game.fireEvent(new GameEvent(GameEvent.EventType.COMBAT_DAMAGE_STEP_PRIORITY, null, null, activePlayerId)); super.priority(game, activePlayerId, resuming); } diff --git a/Mage/src/main/java/mage/game/turn/DrawStep.java b/Mage/src/main/java/mage/game/turn/DrawStep.java index b1320c740a2..ffa7d26f3b7 100644 --- a/Mage/src/main/java/mage/game/turn/DrawStep.java +++ b/Mage/src/main/java/mage/game/turn/DrawStep.java @@ -28,7 +28,6 @@ public class DrawStep extends Step { Player activePlayer = game.getPlayer(activePlayerId); //20091005 - 504.1/703.4c activePlayer.drawCards(1, null, game); -// game.saveState(); game.applyEffects(); super.beginStep(game, activePlayerId); } diff --git a/Mage/src/main/java/mage/game/turn/FirstCombatDamageStep.java b/Mage/src/main/java/mage/game/turn/FirstCombatDamageStep.java index ccab10fe2ab..fafe762c83c 100644 --- a/Mage/src/main/java/mage/game/turn/FirstCombatDamageStep.java +++ b/Mage/src/main/java/mage/game/turn/FirstCombatDamageStep.java @@ -27,7 +27,7 @@ public class FirstCombatDamageStep extends Step { @Override public void priority(Game game, UUID activePlayerId, boolean resuming) { - game.fireEvent(new GameEvent(EventType.COMBAT_DAMAGE_STEP_PRIORITY, null, null, activePlayerId)); + game.fireEvent(new GameEvent(GameEvent.EventType.COMBAT_DAMAGE_STEP_PRIORITY, null, null, activePlayerId)); super.priority(game, activePlayerId, resuming); } diff --git a/Mage/src/main/java/mage/game/turn/Phase.java b/Mage/src/main/java/mage/game/turn/Phase.java index 2cf15e94e76..823b5f2cf92 100644 --- a/Mage/src/main/java/mage/game/turn/Phase.java +++ b/Mage/src/main/java/mage/game/turn/Phase.java @@ -171,7 +171,7 @@ public abstract class Phase implements Serializable { public void postPriority(Game game, UUID activePlayerId) { currentStep.endStep(game, activePlayerId); //20091005 - 500.4/703.4n - game.emptyManaPools(); + game.emptyManaPools(null); //20091005 - 500.9 playExtraSteps(game, currentStep.getType()); } diff --git a/Mage/src/main/java/mage/game/turn/Turn.java b/Mage/src/main/java/mage/game/turn/Turn.java index b8df752ac79..681c36669f5 100644 --- a/Mage/src/main/java/mage/game/turn/Turn.java +++ b/Mage/src/main/java/mage/game/turn/Turn.java @@ -6,6 +6,7 @@ import mage.constants.TurnPhase; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.PhaseChangedEvent; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.game.stack.StackObject; @@ -121,14 +122,14 @@ public class Turn implements Serializable { } if (!isEndTurnRequested() || phase.getType() == TurnPhase.END) { currentPhase = phase; - game.fireEvent(new GameEvent(GameEvent.EventType.PHASE_CHANGED, activePlayer.getId(), null, activePlayer.getId())); + game.fireEvent(new PhaseChangedEvent(activePlayer.getId(), null)); if (!game.getState().getTurnMods().skipPhase(activePlayer.getId(), currentPhase.getType())) { if (phase.play(game, activePlayer.getId())) { if (game.executingRollback()) { return false; } //20091005 - 500.4/703.4n - game.emptyManaPools(); + game.emptyManaPools(null); game.saveState(false); //20091005 - 500.8 @@ -155,7 +156,7 @@ public class Turn implements Serializable { } while (phase.type != phaseType); if (phase.resumePlay(game, stepType, wasPaused)) { //20091005 - 500.4/703.4n - game.emptyManaPools(); + game.emptyManaPools(null); //game.saveState(); //20091005 - 500.8 playExtraPhases(game, phase.getType()); @@ -169,14 +170,14 @@ public class Turn implements Serializable { if (!game.getState().getTurnMods().skipPhase(activePlayerId, currentPhase.getType())) { if (phase.play(game, activePlayerId)) { //20091005 - 500.4/703.4n - game.emptyManaPools(); + game.emptyManaPools(null); //game.saveState(); //20091005 - 500.8 playExtraPhases(game, phase.getType()); } } if (!currentPhase.equals(phase)) { // phase was changed from the card - game.fireEvent(new GameEvent(GameEvent.EventType.PHASE_CHANGED, activePlayerId, null, activePlayerId)); + game.fireEvent(new PhaseChangedEvent(activePlayerId, null)); break; } } @@ -223,7 +224,7 @@ public class Turn implements Serializable { phase = new EndPhase(); } currentPhase = phase; - game.fireEvent(new GameEvent(GameEvent.EventType.PHASE_CHANGED, activePlayerId, extraPhaseTurnMod.getId(), activePlayerId)); + game.fireEvent(new PhaseChangedEvent(activePlayerId, extraPhaseTurnMod)); Player activePlayer = game.getPlayer(activePlayerId); if (activePlayer != null && !game.isSimulation()) { game.informPlayers(activePlayer.getLogName() + " starts an additional " + phase.getType().toString() + " phase"); @@ -256,7 +257,7 @@ public class Turn implements Serializable { while (!game.hasEnded() && !game.getStack().isEmpty()) { StackObject stackObject = game.getStack().peekFirst(); if (stackObject instanceof Spell) { - ((Spell) stackObject).moveToExile(null, "", source.getSourceId(), game); + ((Spell) stackObject).moveToExile(null, "", source, game); } else { game.getStack().remove(stackObject, game); // stack ability } diff --git a/Mage/src/main/java/mage/players/ManaPool.java b/Mage/src/main/java/mage/players/ManaPool.java index c0178f702f8..5f0f1381a14 100644 --- a/Mage/src/main/java/mage/players/ManaPool.java +++ b/Mage/src/main/java/mage/players/ManaPool.java @@ -15,6 +15,7 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ManaEvent; +import mage.game.events.ManaPaidEvent; import mage.game.stack.Spell; /** @@ -141,8 +142,7 @@ public class ManaPool implements Serializable { continue; } if (mana.get(usableManaType) > 0) { - GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag()); - event.setData(mana.getOriginalId().toString()); + GameEvent event = new ManaPaidEvent(ability, mana.getSourceId(), mana.getFlag(), mana.getOriginalId()); game.fireEvent(event); usedManaToPay.increase(usableManaType); mana.remove(usableManaType); @@ -309,7 +309,7 @@ public class ManaPool implements Serializable { public void addMana(Mana manaToAdd, Game game, Ability source, boolean emptyOnTurnsEnd) { if (manaToAdd != null) { Mana mana = manaToAdd.copy(); - if (!game.replaceEvent(new ManaEvent(EventType.ADD_MANA, source.getId(), source.getSourceId(), playerId, mana))) { + if (!game.replaceEvent(new ManaEvent(EventType.ADD_MANA, source.getId(), source, playerId, mana))) { if (mana instanceof ConditionalMana) { ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game), ((ConditionalMana) mana).getManaProducerOriginalId() != null @@ -325,7 +325,7 @@ public class ManaPool implements Serializable { } this.manaItems.add(item); } - ManaEvent manaEvent = new ManaEvent(EventType.MANA_ADDED, source.getId(), source.getSourceId(), playerId, mana); + ManaEvent manaEvent = new ManaEvent(EventType.MANA_ADDED, source.getId(), source, playerId, mana); manaEvent.setData(mana.toString()); game.fireEvent(manaEvent); } @@ -370,8 +370,7 @@ public class ManaPool implements Serializable { if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) { mana.set(manaType, mana.get(manaType) - 1); usedManaToPay.increase(manaType); - GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getManaProducerId(), ability.getControllerId(), 0, mana.getFlag()); - event.setData(mana.getManaProducerOriginalId().toString()); + GameEvent event = new ManaPaidEvent(ability, mana.getManaProducerId(), mana.getFlag(), mana.getManaProducerOriginalId()); game.fireEvent(event); break; } diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index 534fba58213..6f25b849030 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -28,6 +28,7 @@ import mage.game.Graveyard; import mage.game.Table; import mage.game.combat.CombatGroup; import mage.game.draft.Draft; +import mage.game.events.GameEvent; import mage.game.match.Match; import mage.game.match.MatchPlayer; import mage.game.permanent.Permanent; @@ -71,27 +72,41 @@ public interface Player extends MageItem, Copyable { void initLife(int life); + /** + * Set player's life + * + * @param life + * @param game + * @param source can be null for cheats or game startup setup + */ void setLife(int life, Game game, Ability source); - void setLife(int life, Game game, UUID sourceId); - /** * @param amount amount of life loss * @param game + * @param source can be null for default game events like mana burn * @param atCombat was the source combat damage + * @param attackerId id of the attacker for combat events (can be null) * @return */ - int loseLife(int amount, Game game, boolean atCombat); + int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId); + int loseLife(int amount, Game game, Ability source, boolean atCombat); + + /** + * + * @param amount + * @param game + * @param source can be null for default game events life lifelink damage + * @return + */ int gainLife(int amount, Game game, Ability source); - int gainLife(int amount, Game game, UUID sourceId); + int damage(int damage, UUID attackerId, Ability source, Game game); - int damage(int damage, UUID sourceId, Game game); + int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable); - int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable); - - int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List appliedEffects); + int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List appliedEffects); // to handle rule changing effects (613.10) boolean isCanLoseLife(); @@ -124,7 +139,7 @@ public interface Player extends MageItem, Copyable { FilterPermanent getSacrificeCostFilter(); - boolean canPaySacrificeCost(Permanent permanent, UUID sourceId, UUID controllerId, Game game); + boolean canPaySacrificeCost(Permanent permanent, Ability source, UUID controllerId, Game game); void setLifeTotalCanChange(boolean lifeTotalCanChange); @@ -322,11 +337,33 @@ public interface Player extends MageItem, Copyable { */ void reset(); + /** + * + * @param source can be null for game default shuffle (non effects, example: mulligans) + * @param game + */ void shuffleLibrary(Ability source, Game game); - int drawCards(int num, UUID sourceId, Game game); + /** + * Draw cards. If you call it in replace events then use method with event.appliedEffects param instead. + * + * @param num + * @param source can be null for game default draws (non effects, example: start of the turn) + * @param game + * @return + */ + int drawCards(int num, Ability source, Game game); - int drawCards(int num, UUID sourceId, Game game, List appliedEffects); + /** + * Draw cards with applied effects, for replaceEvent + * + * @param num + * @param source can be null for game default draws (non effects, example: start of the turn) + * @param game + * @param event original draw event in replacement code + * @return + */ + int drawCards(int num, Ability source, Game game, GameEvent event); boolean cast(SpellAbility ability, Game game, boolean noMana, ApprovingObject approvingObject); @@ -336,7 +373,7 @@ public interface Player extends MageItem, Copyable { boolean removeFromHand(Card card, Game game); - boolean removeFromBattlefield(Permanent permanent, Game game); + boolean removeFromBattlefield(Permanent permanent, Ability source, Game game); boolean putInGraveyard(Card card, Game game); @@ -407,25 +444,25 @@ public interface Player extends MageItem, Copyable { boolean flipCoin(Ability source, Game game, boolean winnable, List appliedEffects); - int rollDice(Game game, int numSides); + int rollDice(Ability source, Game game, int numSides); - int rollDice(Game game, List appliedEffects, int numSides); + int rollDice(Ability source, Game game, List appliedEffects, int numSides); - PlanarDieRoll rollPlanarDie(Game game); + PlanarDieRoll rollPlanarDie(Ability source, Game game); - PlanarDieRoll rollPlanarDie(Game game, List appliedEffects); + PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects); - PlanarDieRoll rollPlanarDie(Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides); + PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides); - Card discardOne(boolean random, Ability source, Game game); + Card discardOne(boolean random, boolean payForCost, Ability source, Game game); - Cards discard(int amount, boolean random, Ability source, Game game); + Cards discard(int amount, boolean random, boolean payForCost, Ability source, Game game); - Cards discard(Cards cards, Ability source, Game game); + Cards discard(Cards cards, boolean payForCost, Ability source, Game game); void discardToMax(Game game); - boolean discard(Card card, Ability source, Game game); + boolean discard(Card card, boolean payForCost, Ability source, Game game); void lost(Game game); @@ -611,7 +648,7 @@ public interface Player extends MageItem, Copyable { void selectAttackers(Game game, UUID attackingPlayerId); - void selectBlockers(Game game, UUID defendingPlayerId); + void selectBlockers(Ability source, Game game, UUID defendingPlayerId); UUID chooseAttackerOrder(List attacker, Game game); @@ -626,7 +663,7 @@ public interface Player extends MageItem, Copyable { */ UUID chooseBlockerOrder(List blockers, CombatGroup combatGroup, List blockerOrder, Game game); - void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game); + void assignDamage(int damage, List targets, String singleTargetName, UUID attackerId, Ability source, Game game); int getAmount(int min, int max, String message, Game game); @@ -670,15 +707,15 @@ public interface Player extends MageItem, Copyable { LinkedHashMap getPlayableActivatedAbilities(MageObject object, Zone zone, Game game); - boolean addCounters(Counter counter, Game game); + boolean addCounters(Counter counter, Ability source, Game game); void removeCounters(String name, int amount, Ability source, Game game); List getAttachments(); - boolean addAttachment(UUID permanentId, Game game); + boolean addAttachment(UUID permanentId, Ability source, Game game); - boolean removeAttachment(Permanent permanent, Game game); + boolean removeAttachment(Permanent permanent, Ability source, Game game); /** * Signals that the player becomes active player in this turn. @@ -786,20 +823,12 @@ public interface Player extends MageItem, Copyable { * into the game log * * @param card - * @param sourceId - * @param game - * @return - */ - boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game); - - /** - * @param card - * @param sourceId + * @param source * @param game * @param withName show the card name in the log * @return */ - boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName); + boolean moveCardToHandWithInfo(Card card, Ability source, Game game, boolean withName); /** * Uses card.moveToExile and posts a inform message about moving the card to @@ -809,26 +838,26 @@ public interface Player extends MageItem, Copyable { * @param card * @param exileId exile zone id (optional) * @param exileName name of exile zone (optional) - * @param sourceId + * @param source * @param game * @param fromZone * @param withName * @return */ - @Deprecated - boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName); + @Deprecated // if you want to use it in replaceEvent, then use ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, Ability source, Game game, Zone fromZone, boolean withName); /** * Uses card.moveToZone and posts a inform message about moving the card to * graveyard into the game log * * @param card - * @param sourceId + * @param source * @param game * @param fromZone if null, this info isn't postet * @return */ - boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone); + boolean moveCardToGraveyardWithInfo(Card card, Ability source, Game game, Zone fromZone); /** * Internal used to move cards Use commonly player.moveCards() @@ -846,26 +875,26 @@ public interface Player extends MageItem, Copyable { * library into the game log * * @param card - * @param sourceId + * @param source * @param game * @param fromZone if null, this info isn't postet * @param toTop to the top of the library else to the bottom * @param withName show the card name in the log * @return */ - boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName); + boolean moveCardToLibraryWithInfo(Card card, Ability source, Game game, Zone fromZone, boolean toTop, boolean withName); /** * Uses card.moveToZone and posts a inform message about moving the card to * library into the game log * * @param card - * @param sourceId + * @param source * @param game * @param fromZone if null, this info isn't postet * @return */ - boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone); + boolean moveCardToCommandWithInfo(Card card, Ability source, Game game, Zone fromZone); Cards millCards(int toMill, Ability source, Game game); diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 340b2368b04..d9b58fa51e6 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -439,7 +439,7 @@ public abstract class PlayerImpl implements Player, Serializable { this.canLoseLife = true; this.topCardRevealed = false; this.payManaMode = false; - this.setLife(game.getLife(), game, (UUID) null); + this.setLife(game.getLife(), game, null); this.setReachedNextTurnAfterLeaving(false); this.clearCastSourceIdManaCosts(); @@ -647,16 +647,16 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public int drawCards(int num, UUID sourceId, Game game) { + public int drawCards(int num, Ability source, Game game) { if (num > 0) { - return game.doAction(new MageDrawAction(this, num, null), sourceId); + return game.doAction(source, new MageDrawAction(this, num, null)); } return 0; } @Override - public int drawCards(int num, UUID sourceId, Game game, List appliedEffects) { - return game.doAction(new MageDrawAction(this, num, appliedEffects), sourceId); + public int drawCards(int num, Ability source, Game game, GameEvent event) { + return game.doAction(source, new MageDrawAction(this, num, event)); } @Override @@ -668,7 +668,7 @@ public abstract class PlayerImpl implements Player, Serializable { + (this.maxHandSize == 1 ? " hand card" : " hand cards")); } - discard(hand.size() - this.maxHandSize, false, null, game); + discard(hand.size() - this.maxHandSize, false, false, null, game); } } @@ -709,8 +709,8 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public Card discardOne(boolean random, Ability source, Game game) { - Cards cards = discard(1, random, source, game); + public Card discardOne(boolean random, boolean payForCost, Ability source, Game game) { + Cards cards = discard(1, random, payForCost, source, game); if (cards.isEmpty()) { return null; } @@ -718,40 +718,32 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public Cards discard(int amount, boolean random, Ability source, Game game) { - Cards discardedCards = doDiscard(amount, random, source, game); + public Cards discard(int amount, boolean random, boolean payForCost, Ability source, Game game) { + Cards discardedCards = doDiscardWithoutFinalEvent(amount, random, payForCost, source, game); if (!discardedCards.isEmpty()) { - UUID sourceId = source == null ? null : source.getSourceId(); - game.fireEvent(GameEvent.getEvent( - GameEvent.EventType.DISCARDED_CARDS, sourceId, - sourceId, playerId, discardedCards.size() - )); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARDS, null, source, playerId, discardedCards.size())); } return discardedCards; } @Override - public Cards discard(Cards cards, Ability source, Game game) { + public Cards discard(Cards cards, boolean payForCost, Ability source, Game game) { Cards discardedCards = new CardsImpl(); if (cards == null) { return discardedCards; } for (Card card : cards.getCards(game)) { - if (doDiscard(card, source, game, false)) { + if (doDiscard(card, source, game, payForCost, false)) { discardedCards.add(card); } } if (!discardedCards.isEmpty()) { - UUID sourceId = source == null ? null : source.getSourceId(); - game.fireEvent(GameEvent.getEvent( - GameEvent.EventType.DISCARDED_CARDS, sourceId, - sourceId, playerId, discardedCards.size() - )); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARDS, null, source, playerId, discardedCards.size())); } return discardedCards; } - private Cards doDiscard(int amount, boolean random, Ability source, Game game) { + private Cards doDiscardWithoutFinalEvent(int amount, boolean random, boolean payForCost, Ability source, Game game) { Cards discardedCards = new CardsImpl(); if (amount <= 0) { return discardedCards; @@ -761,7 +753,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (this.getHand().size() == 1 || this.getHand().size() == amount) { List cardsToDiscard = new ArrayList<>(this.getHand()); for (UUID id : cardsToDiscard) { - if (doDiscard(this.getHand().get(id, game), source, game, false)) { + if (doDiscard(this.getHand().get(id, game), source, game, payForCost, false)) { discardedCards.add(id); } } @@ -771,7 +763,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (random) { for (int i = 0; i < amount; i++) { Card card = this.getHand().getRandom(game); - if (doDiscard(card, source, game, false)) { + if (doDiscard(card, source, game, payForCost, false)) { discardedCards.add(card); } } @@ -782,7 +774,7 @@ public abstract class PlayerImpl implements Player, Serializable { + " card" + (possibleAmount > 1 ? "s" : "")), playerId); choose(Outcome.Discard, target, source == null ? null : source.getSourceId(), game); for (UUID cardId : target.getTargets()) { - if (doDiscard(this.getHand().get(cardId, game), source, game, false)) { + if (doDiscard(this.getHand().get(cardId, game), source, game, payForCost, false)) { discardedCards.add(cardId); } } @@ -791,11 +783,11 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean discard(Card card, Ability source, Game game) { - return doDiscard(card, source, game, true); + public boolean discard(Card card, boolean payForCost, Ability source, Game game) { + return doDiscard(card, source, game, payForCost, false); } - private boolean doDiscard(Card card, Ability source, Game game, boolean fireEvent) { + private boolean doDiscard(Card card, Ability source, Game game, boolean payForCost, boolean fireFinalEvent) { //20100716 - 701.7 /* 701.7. Discard # 701.7a To discard a card, move it from its owner’s hand to that player’s graveyard. @@ -813,31 +805,25 @@ public abstract class PlayerImpl implements Player, Serializable { if (card == null) { return false; } - GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.DISCARD_CARD, - card.getId(), source == null - ? null : source.getSourceId(), playerId); - gameEvent.setFlag(source != null); // event from effect or from cost (source == null) + GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.DISCARD_CARD, card.getId(), source, playerId); + gameEvent.setFlag(!payForCost); // event from effect (1) or from cost (0) if (game.replaceEvent(gameEvent, source)) { return false; } // write info to game log first so game log infos from triggered or replacement effects follow in the game log if (!game.isSimulation()) { - game.informPlayers(getLogName() + " discards " + card.getLogName()); + game.informPlayers(getLogName() + " discards " + card.getLogName() + CardUtil.getSourceLogName(game, source)); } /* If a card is discarded while Rest in Peace is on the battlefield, abilities that function * when a card is discarded (such as madness) still work, even though that card never reaches * a graveyard. In addition, spells or abilities that check the characteristics of a discarded * card (such as Chandra Ablaze's first ability) can find that card in exile. */ - card.moveToZone(Zone.GRAVEYARD, source == null ? null : source.getSourceId(), game, false); + card.moveToZone(Zone.GRAVEYARD, source, game, false); // So discard is also successful if card is moved to another zone by replacement effect! - UUID sourceId = source == null ? null : source.getSourceId(); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, - card.getId(), sourceId, playerId)); - if (fireEvent) { - game.fireEvent(GameEvent.getEvent( - GameEvent.EventType.DISCARDED_CARDS, sourceId, - sourceId, playerId, 1 - )); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, card.getId(), source, playerId)); + + if (fireFinalEvent) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARDS, null, source, playerId, 1)); } return true; } @@ -848,19 +834,17 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean addAttachment(UUID permanentId, Game game) { + public boolean addAttachment(UUID permanentId, Ability source, Game game) { if (!this.attachments.contains(permanentId)) { Permanent aura = game.getPermanent(permanentId); if (aura == null) { aura = game.getPermanentEntering(permanentId); } if (aura != null) { - if (!game.replaceEvent(new GameEvent(GameEvent.EventType.ENCHANT_PLAYER, - playerId, permanentId, aura.getControllerId()))) { + if (!game.replaceEvent(new EnchantPlayerEvent(playerId, aura, source))) { this.attachments.add(permanentId); - aura.attachTo(playerId, game); - game.fireEvent(new GameEvent(GameEvent.EventType.ENCHANTED_PLAYER, - playerId, permanentId, aura.getControllerId())); + aura.attachTo(playerId, source, game); + game.fireEvent(new EnchantedPlayerEvent(playerId, aura, source)); return true; } } @@ -869,14 +853,12 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean removeAttachment(Permanent attachment, Game game) { + public boolean removeAttachment(Permanent attachment, Ability source, Game game) { if (this.attachments.contains(attachment.getId())) { - if (!game.replaceEvent(new GameEvent(GameEvent.EventType.UNATTACH, - playerId, attachment.getId(), attachment.getControllerId()))) { + if (!game.replaceEvent(new UnattachEvent(playerId, attachment.getId(), attachment, source))) { this.attachments.remove(attachment.getId()); - attachment.attachTo(null, game); - game.fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, - playerId, attachment.getId(), attachment.getControllerId())); + attachment.attachTo(null, source, game); + game.fireEvent(new UnattachedEvent(playerId, attachment.getId(), attachment, source)); return true; } } @@ -884,21 +866,21 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean removeFromBattlefield(Permanent permanent, Game game) { + public boolean removeFromBattlefield(Permanent permanent, Ability source, Game game) { permanent.removeFromCombat(game, false); game.getBattlefield().removePermanent(permanent.getId()); if (permanent.getAttachedTo() != null) { Permanent attachedTo = game.getPermanent(permanent.getAttachedTo()); if (attachedTo != null) { - attachedTo.removeAttachment(permanent.getId(), game); + attachedTo.removeAttachment(permanent.getId(), source, game); } else { Player attachedToPlayer = game.getPlayer(permanent.getAttachedTo()); if (attachedToPlayer != null) { - attachedToPlayer.removeAttachment(permanent, game); + attachedToPlayer.removeAttachment(permanent, source, game); } else { Card attachedToCard = game.getCard(permanent.getAttachedTo()); if (attachedToCard != null) { - attachedToCard.removeAttachment(permanent.getId(), game); + attachedToCard.removeAttachment(permanent.getId(), source, game); } } } @@ -950,7 +932,7 @@ public abstract class PlayerImpl implements Player, Serializable { List ids = new ArrayList<>(cards); Collections.shuffle(ids); for (UUID id : ids) { - moveObjectToLibrary(id, source == null ? null : source.getSourceId(), game, false, false); + moveObjectToLibrary(id, source, game, false, false); } } else { // user defined order @@ -964,13 +946,11 @@ public abstract class PlayerImpl implements Player, Serializable { break; } cards.remove(targetObjectId); - moveObjectToLibrary(targetObjectId, source == null - ? null : source.getSourceId(), game, false, false); + moveObjectToLibrary(targetObjectId, source, game, false, false); target.clearChosen(); } for (UUID c : cards) { - moveObjectToLibrary(c, source == null - ? null : source.getSourceId(), game, false, false); + moveObjectToLibrary(c, source, game, false, false); } } } @@ -982,9 +962,9 @@ public abstract class PlayerImpl implements Player, Serializable { if (cards.isEmpty()) { return true; } - game.informPlayers(getLogName() + " shuffels " + CardUtil.numberToText(cards.size(), "a") + game.informPlayers(getLogName() + " shuffles " + CardUtil.numberToText(cards.size(), "a") + " card" + (cards.size() == 1 ? "" : "s") - + " into their library."); + + " into their library" + CardUtil.getSourceLogName(game, source)); boolean status = moveCards(cards, Zone.LIBRARY, source, game); shuffleLibrary(source, game); return status; @@ -1004,7 +984,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (library.size() + 1 < xFromTheTop) { putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, true); } else { - if (card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true) + if (card.moveToZone(Zone.LIBRARY, source, game, true) && !(card instanceof PermanentToken) && !card.isCopy()) { Card cardInLib = getLibrary().getFromTop(game); if (cardInLib != null && cardInLib.getId().equals(card.getId())) { // check needed because e.g. commander can go to command zone @@ -1015,7 +995,7 @@ public abstract class PlayerImpl implements Player, Serializable { + getLogName() + "'s library " + CardUtil.numberToOrdinalText(xFromTheTop) - + " from the top"); + + " from the top" + CardUtil.getSourceLogName(game, source, cardInLib.getId())); } } else { return false; @@ -1045,7 +1025,7 @@ public abstract class PlayerImpl implements Player, Serializable { List ids = new ArrayList<>(cards); Collections.shuffle(ids); for (UUID id : ids) { - moveObjectToLibrary(id, source == null ? null : source.getSourceId(), game, true, false); + moveObjectToLibrary(id, source, game, true, false); } } else { // user defined order @@ -1060,13 +1040,11 @@ public abstract class PlayerImpl implements Player, Serializable { break; } cards.remove(targetObjectId); - moveObjectToLibrary(targetObjectId, source == null - ? null : source.getSourceId(), game, true, false); + moveObjectToLibrary(targetObjectId, source, game, true, false); target.clearChosen(); } for (UUID c : cards) { - moveObjectToLibrary(c, source == null - ? null : source.getSourceId(), game, true, false); + moveObjectToLibrary(c, source, game, true, false); } } } @@ -1081,13 +1059,13 @@ public abstract class PlayerImpl implements Player, Serializable { return true; } - private boolean moveObjectToLibrary(UUID objectId, UUID sourceId, Game game, boolean toTop, boolean withName) { + private boolean moveObjectToLibrary(UUID objectId, Ability source, Game game, boolean toTop, boolean withName) { MageObject mageObject = game.getObject(objectId); if (mageObject instanceof Spell && mageObject.isCopy()) { // Spell copies are not moved as cards, so here the no copy spell has to be selected to move // (but because copy and original have the same objectId the wrong sepell can be selected from stack). // So let's check if the original spell is on the stack and has to be selected. // TODO: Better handling so each spell could be selected by a unique id - Spell spellNoCopy = game.getStack().getSpell(sourceId, false); + Spell spellNoCopy = game.getStack().getSpell(source.getSourceId(), false); if (spellNoCopy != null) { mageObject = spellNoCopy; } @@ -1095,11 +1073,9 @@ public abstract class PlayerImpl implements Player, Serializable { if (mageObject != null) { Zone fromZone = game.getState().getZone(objectId); if ((mageObject instanceof Permanent)) { - return this.moveCardToLibraryWithInfo((Permanent) mageObject, - sourceId, game, fromZone, toTop, withName); + return this.moveCardToLibraryWithInfo((Permanent) mageObject, source, game, fromZone, toTop, withName); } else if (mageObject instanceof Card) { - return this.moveCardToLibraryWithInfo((Card) mageObject, - sourceId, game, fromZone, toTop, withName); + return this.moveCardToLibraryWithInfo((Card) mageObject, source, game, fromZone, toTop, withName); } } return false; @@ -1188,7 +1164,7 @@ public abstract class PlayerImpl implements Player, Serializable { Card card = game.getCard(ability.getSourceId()); if (card != null) { if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, - ability.getId(), ability.getSourceId(), playerId, approvingObject), ability)) { + ability.getId(), ability, playerId, approvingObject), ability)) { int bookmark = game.bookmarkState(); setStoredBookmark(bookmark); // move global bookmark to current state (if you activated mana before then you can't rollback it) Zone fromZone = game.getState().getZone(card.getMainCard().getId()); @@ -1223,11 +1199,11 @@ public abstract class PlayerImpl implements Player, Serializable { clearCastSourceIdManaCosts(); // TODO: test multiple alternative cost for different cards as same time GameEvent event = GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, - spell.getSpellAbility().getId(), spell.getSpellAbility().getSourceId(), playerId, approvingObject); + spell.getSpellAbility().getId(), spell.getSpellAbility(), playerId, approvingObject); game.fireEvent(event); if (spell.activate(game, noMana)) { event = GameEvent.getEvent(GameEvent.EventType.SPELL_CAST, - spell.getSpellAbility().getId(), spell.getSpellAbility().getSourceId(), playerId, approvingObject); + spell.getSpellAbility().getId(), spell.getSpellAbility(), playerId, approvingObject); event.setZone(fromZone); game.fireEvent(event); if (!game.isSimulation()) { @@ -1251,7 +1227,7 @@ public abstract class PlayerImpl implements Player, Serializable { } ActivatedAbility playLandAbility = null; boolean foundAlternative = false; - for (Ability ability : card.getAbilities()) { + for (Ability ability : card.getAbilities(game)) { // if cast for noMana no Alternative costs are allowed if ((ability instanceof AlternativeSourceCosts) || (ability instanceof OptionalAdditionalSourceCosts)) { @@ -1291,19 +1267,19 @@ public abstract class PlayerImpl implements Player, Serializable { //20091005 - 305.1 if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, - card.getId(), card.getId(), playerId, activationStatus.getApprovingObject()))) { + card.getId(), playLandAbility, playerId, activationStatus.getApprovingObject()))) { // int bookmark = game.bookmarkState(); // land events must return original zone (uses for commander watcher) Zone cardZoneBefore = game.getState().getZone(card.getId()); GameEvent landEventBefore = GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, - card.getId(), card.getId(), playerId, activationStatus.getApprovingObject()); + card.getId(), playLandAbility, playerId, activationStatus.getApprovingObject()); landEventBefore.setZone(cardZoneBefore); game.fireEvent(landEventBefore); if (moveCards(card, Zone.BATTLEFIELD, playLandAbility, game, false, false, false, null)) { landsPlayed++; GameEvent landEventAfter = GameEvent.getEvent(GameEvent.EventType.LAND_PLAYED, - card.getId(), card.getId(), playerId, activationStatus.getApprovingObject()); + card.getId(), playLandAbility, playerId, activationStatus.getApprovingObject()); landEventAfter.setZone(cardZoneBefore); game.fireEvent(landEventAfter); @@ -1329,7 +1305,7 @@ public abstract class PlayerImpl implements Player, Serializable { protected boolean playManaAbility(ActivatedManaAbilityImpl ability, Game game) { if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, - ability.getId(), ability.getSourceId(), playerId))) { + ability.getId(), ability, playerId))) { int bookmark = game.bookmarkState(); if (ability.activate(game, false)) { if (ability.resolve(game)) { @@ -1352,7 +1328,7 @@ public abstract class PlayerImpl implements Player, Serializable { //20091005 - 602.2a if (ability.isUsesStack()) { if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, - ability.getId(), ability.getSourceId(), playerId))) { + ability.getId(), ability, playerId))) { int bookmark = game.bookmarkState(); setStoredBookmark(bookmark); // move global bookmark to current state (if you activated mana before then you can't rollback it) ability.newId(); @@ -1360,7 +1336,7 @@ public abstract class PlayerImpl implements Player, Serializable { game.getStack().push(new StackAbility(ability, playerId)); if (ability.activate(game, false)) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATED_ABILITY, - ability.getId(), ability.getSourceId(), playerId)); + ability.getId(), ability, playerId)); if (!game.isSimulation()) { game.informPlayers(getLogName() + ability.getGameLogMessage(game)); } @@ -1386,11 +1362,11 @@ public abstract class PlayerImpl implements Player, Serializable { protected boolean specialAction(SpecialAction action, Game game) { //20091005 - 114 if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TAKE_SPECIAL_ACTION, - action.getId(), action.getSourceId(), getId()))) { + action.getId(), action, getId()))) { int bookmark = game.bookmarkState(); if (action.activate(game, false)) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TAKEN_SPECIAL_ACTION, - action.getId(), action.getSourceId(), getId())); + action.getId(), action, getId())); if (!game.isSimulation()) { game.informPlayers(getLogName() + action.getGameLogMessage(game)); } @@ -1408,11 +1384,11 @@ public abstract class PlayerImpl implements Player, Serializable { protected boolean specialManaPayment(SpecialAction action, Game game) { //20091005 - 114 if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TAKE_SPECIAL_MANA_PAYMENT, - action.getId(), action.getSourceId(), getId()))) { + action.getId(), action, getId()))) { int bookmark = game.bookmarkState(); if (action.activate(game, false)) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TAKEN_SPECIAL_MANA_PAYMENT, - action.getId(), action.getSourceId(), getId())); + action.getId(), action, getId())); if (!game.isSimulation()) { game.informPlayers(getLogName() + action.getGameLogMessage(game)); } @@ -1525,13 +1501,13 @@ public abstract class PlayerImpl implements Player, Serializable { if ((ability.isUsesStack() || ability.getRuleVisible()) && !game.isSimulation()) { - game.informPlayers(ability.getGameLogMessage(game)); + game.informPlayers(getLogName() + ability.getGameLogMessage(game)); } if (!ability.isUsesStack()) { ability.resolve(game); } else { - game.fireEvent(new GameEvent(EventType.TRIGGERED_ABILITY, - ability.getId(), ability.getSourceId(), ability.getControllerId())); + game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, + ability.getId(), ability, ability.getControllerId())); } game.removeBookmark(bookmark); return true; @@ -1669,13 +1645,12 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public void shuffleLibrary(Ability source, Game game) { - if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SHUFFLE_LIBRARY, playerId, playerId))) { + if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SHUFFLE_LIBRARY, playerId, source, playerId))) { this.library.shuffle(); if (!game.isSimulation()) { - game.informPlayers(getLogName() + "'s library is shuffled"); + game.informPlayers(getLogName() + "'s library is shuffled" + CardUtil.getSourceLogName(game, source)); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SHUFFLED, playerId, - (source == null ? null : source.getSourceId()), playerId)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SHUFFLED, playerId, source, playerId)); } } @@ -1719,6 +1694,7 @@ public abstract class PlayerImpl implements Player, Serializable { sb.append(", "); } } + sb.append(CardUtil.getSourceLogName(game, source)); game.informPlayers(sb.toString()); } } @@ -1981,16 +1957,11 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public void setLife(int life, Game game, Ability source) { - setLife(life, game, source.getSourceId()); - } - - @Override - public void setLife(int life, Game game, UUID sourceId) { // rule 118.5 if (life > this.life) { - gainLife(life - this.life, game, sourceId); + gainLife(life - this.life, game, source); } else if (life < this.life) { - loseLife(this.life - life, game, false); + loseLife(this.life - life, game, source, false); } } @@ -2021,27 +1992,36 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public int loseLife(int amount, Game game, boolean atCombat) { + public int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId) { if (!canLoseLife || !this.isInGame()) { return 0; } GameEvent event = new GameEvent(GameEvent.EventType.LOSE_LIFE, - playerId, playerId, playerId, amount, atCombat); + playerId, source, playerId, amount, atCombat); if (!game.replaceEvent(event)) { - // this.life -= event.getAmount(); this.life = CardUtil.subtractWithOverflowCheck(this.life, event.getAmount()); if (!game.isSimulation()) { - game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life"); + UUID needId = attackerId; + if (needId == null) { + needId = source == null ? null : source.getSourceId(); + } + game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life" + + (atCombat ? " at combat" : "") + CardUtil.getSourceLogName(game, " from ", needId, "", "")); } if (amount > 0) { game.fireEvent(new GameEvent(GameEvent.EventType.LOST_LIFE, - playerId, playerId, playerId, amount, atCombat)); + playerId, source, playerId, amount, atCombat)); } return amount; } return 0; } + @Override + public int loseLife(int amount, Game game, Ability source, boolean atCombat) { + return loseLife(amount, game, source, atCombat, null); + } + @Override public boolean isCanGainLife() { return canGainLife; @@ -2054,127 +2034,121 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public int gainLife(int amount, Game game, Ability source) { - return gainLife(amount, game, source.getSourceId()); - } - - @Override - public int gainLife(int amount, Game game, UUID sourceId) { if (!canGainLife || amount <= 0) { return 0; } GameEvent event = new GameEvent(GameEvent.EventType.GAIN_LIFE, - playerId, playerId, playerId, amount, false); + playerId, source, playerId, amount, false); if (!game.replaceEvent(event)) { // TODO: lock life at Integer.MAX_VALUE if reached, until it's set to a different amount // (https://magic.wizards.com/en/articles/archive/news/unstable-faqawaslfaqpaftidawabiajtbt-2017-12-06 - "infinite" life total stays infinite no matter how much is gained or lost) // this.life += event.getAmount(); this.life = CardUtil.addWithOverflowCheck(this.life, event.getAmount()); if (!game.isSimulation()) { - game.informPlayers(this.getLogName() + " gains " + event.getAmount() + " life"); + game.informPlayers(this.getLogName() + " gains " + event.getAmount() + " life" + CardUtil.getSourceLogName(game, source)); } game.fireEvent(GameEvent.getEvent(GameEvent.EventType.GAINED_LIFE, - playerId, sourceId, playerId, event.getAmount())); + playerId, source, playerId, event.getAmount())); return event.getAmount(); } return 0; } @Override - public int damage(int damage, UUID sourceId, Game game) { - return doDamage(damage, sourceId, game, false, true, null); + public int damage(int damage, UUID attackerId, Ability source, Game game) { + return doDamage(damage, attackerId, source, game, false, true, null); } @Override - public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) { - return doDamage(damage, sourceId, game, combatDamage, preventable, null); + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable) { + return doDamage(damage, attackerId, source, game, combatDamage, preventable, null); } @Override - public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { - return doDamage(damage, sourceId, game, combatDamage, preventable, appliedEffects); + public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { + return doDamage(damage, attackerId, source, game, combatDamage, preventable, appliedEffects); } - @SuppressWarnings({"null", "ConstantConditions"}) - private int doDamage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { + private int doDamage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List appliedEffects) { if (!this.isInGame()) { return 0; } if (damage > 0) { - if (canDamage(game.getObject(sourceId), game)) { + if (canDamage(game.getObject(attackerId), game)) { GameEvent event = new DamagePlayerEvent(playerId, - sourceId, playerId, damage, preventable, combatDamage); + attackerId, playerId, damage, preventable, combatDamage); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { int actualDamage = event.getAmount(); if (actualDamage > 0) { UUID sourceControllerId = null; Abilities sourceAbilities = null; - MageObject source = game.getPermanentOrLKIBattlefield(sourceId); - if (source == null) { - StackObject stackObject = game.getStack().getStackObject(sourceId); + MageObject attacker = game.getPermanentOrLKIBattlefield(attackerId); + if (attacker == null) { + StackObject stackObject = game.getStack().getStackObject(attackerId); if (stackObject != null) { - source = stackObject.getStackAbility().getSourceObject(game); + attacker = stackObject.getStackAbility().getSourceObject(game); } else { - source = game.getObject(sourceId); + attacker = game.getObject(attackerId); } - if (source instanceof Spell) { - sourceAbilities = ((Spell) source).getAbilities(game); - sourceControllerId = ((Spell) source).getControllerId(); - } else if (source instanceof Card) { - sourceAbilities = ((Card) source).getAbilities(game); - sourceControllerId = ((Card) source).getOwnerId(); - } else if (source instanceof CommandObject) { - sourceControllerId = ((CommandObject) source).getControllerId(); - sourceAbilities = source.getAbilities(); + if (attacker instanceof Spell) { + sourceAbilities = ((Spell) attacker).getAbilities(game); + sourceControllerId = ((Spell) attacker).getControllerId(); + } else if (attacker instanceof Card) { + sourceAbilities = ((Card) attacker).getAbilities(game); + sourceControllerId = ((Card) attacker).getOwnerId(); + } else if (attacker instanceof CommandObject) { + sourceControllerId = ((CommandObject) attacker).getControllerId(); + sourceAbilities = attacker.getAbilities(); } } else { - sourceAbilities = ((Permanent) source).getAbilities(game); - sourceControllerId = ((Permanent) source).getControllerId(); + sourceAbilities = ((Permanent) attacker).getAbilities(game); + sourceControllerId = ((Permanent) attacker).getControllerId(); } if (sourceAbilities != null && sourceAbilities.containsKey(InfectAbility.getInstance().getId())) { - addCounters(CounterType.POISON.createInstance(actualDamage), game); + addCounters(CounterType.POISON.createInstance(actualDamage), source, game); } else { - GameEvent damageToLifeLossEvent = new GameEvent(EventType.DAMAGE_CAUSES_LIFE_LOSS, - playerId, sourceId, playerId, actualDamage, combatDamage); + GameEvent damageToLifeLossEvent = new GameEvent(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS, + playerId, source, playerId, actualDamage, combatDamage); if (!game.replaceEvent(damageToLifeLossEvent)) { - this.loseLife(damageToLifeLossEvent.getAmount(), game, combatDamage); + this.loseLife(damageToLifeLossEvent.getAmount(), game, source, combatDamage, attackerId); } } if (sourceAbilities != null && sourceAbilities.containsKey(LifelinkAbility.getInstance().getId())) { if (combatDamage) { - game.getPermanent(sourceId).markLifelink(actualDamage); + game.getPermanent(attackerId).markLifelink(actualDamage); } else { Player player = game.getPlayer(sourceControllerId); - player.gainLife(actualDamage, game, sourceId); + player.gainLife(actualDamage, game, source); } } // Unstable ability - Earl of Squirrel if (sourceAbilities != null && sourceAbilities.containsKey(SquirrellinkAbility.getInstance().getId())) { Player player = game.getPlayer(sourceControllerId); - new SquirrelToken().putOntoBattlefield(actualDamage, game, sourceId, player.getId()); + new SquirrelToken().putOntoBattlefield(actualDamage, game, source, player.getId()); } - DamagedEvent damagedEvent = new DamagedPlayerEvent(playerId, sourceId, playerId, actualDamage, combatDamage); + DamagedEvent damagedEvent = new DamagedPlayerEvent(playerId, attackerId, playerId, actualDamage, combatDamage); game.fireEvent(damagedEvent); game.getState().addSimultaneousDamage(damagedEvent, game); return actualDamage; } } } else { - MageObject sourceObject = game.getObject(sourceId); + MageObject sourceObject = game.getObject(attackerId); game.informPlayers(damage + " damage " + (sourceObject == null ? "" : "from " + sourceObject.getLogName()) + " to " + getLogName() - + (damage > 1 ? " were" : "was") + " prevented because of protection."); + + (damage > 1 ? " were" : "was") + " prevented because of protection"); } } return 0; } @Override - public boolean addCounters(Counter counter, Game game) { + public boolean addCounters(Counter counter, Ability source, Game game) { boolean returnCode = true; - GameEvent addingAllEvent = GameEvent.getEvent(EventType.ADD_COUNTERS, playerId, null, + GameEvent addingAllEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, playerId, source, playerId, counter.getName(), counter.getCount()); if (!game.replaceEvent(addingAllEvent)) { int amount = addingAllEvent.getAmount(); @@ -2183,12 +2157,12 @@ public abstract class PlayerImpl implements Player, Serializable { for (int i = 0; i < amount; i++) { Counter eventCounter = counter.copy(); eventCounter.remove(eventCounter.getCount() - 1); - GameEvent addingOneEvent = GameEvent.getEvent(EventType.ADD_COUNTER, playerId, null, + GameEvent addingOneEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, playerId, source, playerId, counter.getName(), 1); addingOneEvent.setFlag(isEffectFlag); if (!game.replaceEvent(addingOneEvent)) { getCounters().addCounter(eventCounter); - GameEvent addedOneEvent = GameEvent.getEvent(EventType.COUNTER_ADDED, playerId, null, + GameEvent addedOneEvent = GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, playerId, source, playerId, counter.getName(), 1); addedOneEvent.setFlag(addingOneEvent.getFlag()); game.fireEvent(addedOneEvent); @@ -2198,7 +2172,7 @@ public abstract class PlayerImpl implements Player, Serializable { } } if (finalAmount > 0) { - GameEvent addedAllEvent = GameEvent.getEvent(EventType.COUNTERS_ADDED, playerId, null, + GameEvent addedAllEvent = GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, playerId, source, playerId, counter.getName(), amount); addedAllEvent.setFlag(addingAllEvent.getFlag()); game.fireEvent(addedAllEvent); @@ -2217,16 +2191,14 @@ public abstract class PlayerImpl implements Player, Serializable { break; } GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, - getId(), (source == null ? null : source.getSourceId()), - (source == null ? null : source.getControllerId())); + getId(), source, (source == null ? null : source.getControllerId())); event.setData(name); event.setAmount(1); game.fireEvent(event); finalAmount++; } GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTERS_REMOVED, - getId(), (source == null ? null : source.getSourceId()), - (source == null ? null : source.getControllerId())); + getId(), source, (source == null ? null : source.getControllerId())); event.setData(name); event.setAmount(finalAmount); game.fireEvent(event); @@ -2608,7 +2580,7 @@ public abstract class PlayerImpl implements Player, Serializable { //20091005 - 701.14c // searching control can be intercepted by another player, see Opposition Agent - SearchLibraryEvent searchEvent = new SearchLibraryEvent(targetPlayerId, source.getSourceId(), playerId, Integer.MAX_VALUE); + SearchLibraryEvent searchEvent = new SearchLibraryEvent(targetPlayerId, source, playerId, Integer.MAX_VALUE); if (game.replaceEvent(searchEvent)) { return false; } @@ -2631,7 +2603,7 @@ public abstract class PlayerImpl implements Player, Serializable { } if (!game.isSimulation()) { - game.informPlayers(searchInfo); + game.informPlayers(searchInfo + CardUtil.getSourceLogName(game, source)); } // https://www.reddit.com/r/magicTCG/comments/jj8gh9/opposition_agent_and_panglacial_wurm_interaction/ @@ -2687,10 +2659,10 @@ public abstract class PlayerImpl implements Player, Serializable { // END SEARCH if (takeControl) { CardUtil.takeControlUnderPlayerEnd(game, searchingController, searchingPlayer); - game.informPlayers("Control of " + searchingPlayer.getLogName() + " is back"); + game.informPlayers("Control of " + searchingPlayer.getLogName() + " is back" + CardUtil.getSourceLogName(game, source)); } - LibrarySearchedEvent searchedEvent = new LibrarySearchedEvent(targetPlayer.getId(), source.getSourceId(), searchingPlayer.getId(), target); + LibrarySearchedEvent searchedEvent = new LibrarySearchedEvent(targetPlayer.getId(), source, searchingPlayer.getId(), target); if (game.replaceEvent(searchedEvent)) { return false; } @@ -2781,10 +2753,11 @@ public abstract class PlayerImpl implements Player, Serializable { game.informPlayers(getLogName() + " chose " + CardUtil.booleanToFlipName(chosen)); } boolean result = RandomUtil.nextBoolean(); - FlipCoinEvent event = new FlipCoinEvent(playerId, source.getSourceId(), result, chosen, winnable); + FlipCoinEvent event = new FlipCoinEvent(playerId, source, result, chosen, winnable); event.addAppliedEffects(appliedEffects); game.replaceEvent(event); - game.informPlayers(getLogName() + " flipped " + CardUtil.booleanToFlipName(event.getResult())); + game.informPlayers(getLogName() + " flipped " + CardUtil.booleanToFlipName(event.getResult()) + + CardUtil.getSourceLogName(game, source)); if (event.getFlipCount() > 1) { boolean canChooseHeads = event.getResult(); boolean canChooseTails = !event.getResult(); @@ -2805,10 +2778,11 @@ public abstract class PlayerImpl implements Player, Serializable { game.informPlayers(getLogName() + " chose to keep " + CardUtil.booleanToFlipName(event.getResult())); } if (event.isWinnable()) { - game.informPlayers(getLogName() + " " + (event.getResult() == event.getChosen() ? "won" : "lost") + " the flip"); + game.informPlayers(getLogName() + " " + (event.getResult() == event.getChosen() ? "won" : "lost") + " the flip" + + CardUtil.getSourceLogName(game, source)); } event.setAppliedEffects(appliedEffects); - game.fireEvent(event.getFlippedEvent()); + game.fireEvent(event.createFlippedEvent()); if (event.isWinnable()) { return event.getResult() == event.getChosen(); } @@ -2816,31 +2790,30 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public int rollDice(Game game, int numSides) { - return this.rollDice(game, null, numSides); + public int rollDice(Ability source, Game game, int numSides) { + return this.rollDice(source, game, null, numSides); } /** + * @param source * @param game * @param appliedEffects * @param numSides Number of sides the dice has * @return the number that the player rolled */ @Override - public int rollDice(Game game, List appliedEffects, int numSides) { + public int rollDice(Ability source, Game game, List appliedEffects, int numSides) { int result = RandomUtil.nextInt(numSides) + 1; if (!game.isSimulation()) { game.informPlayers("[Roll a die] " + getLogName() + " rolled a " - + result + " on a " + numSides + " sided die"); + + result + " on a " + numSides + " sided die" + CardUtil.getSourceLogName(game, source)); } - GameEvent event = new GameEvent(GameEvent.EventType.ROLL_DICE, playerId, - null, playerId, result, true); + GameEvent event = new GameEvent(GameEvent.EventType.ROLL_DICE, playerId, source, playerId, result, true); event.setAppliedEffects(appliedEffects); event.setAmount(result); event.setData(numSides + ""); if (!game.replaceEvent(event)) { - GameEvent ge = new GameEvent(GameEvent.EventType.DICE_ROLLED, playerId, null, - playerId, event.getAmount(), event.getFlag()); + GameEvent ge = new GameEvent(GameEvent.EventType.DICE_ROLLED, playerId, source, playerId, event.getAmount(), event.getFlag()); ge.setData(numSides + ""); game.fireEvent(ge); } @@ -2848,13 +2821,13 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public PlanarDieRoll rollPlanarDie(Game game) { - return this.rollPlanarDie(game, null); + public PlanarDieRoll rollPlanarDie(Ability source, Game game) { + return this.rollPlanarDie(source, game, null); } @Override - public PlanarDieRoll rollPlanarDie(Game game, List appliedEffects) { - return rollPlanarDie(game, appliedEffects, 2, 2); + public PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects) { + return rollPlanarDie(source, game, appliedEffects, 2, 2); } /** @@ -2868,7 +2841,7 @@ public abstract class PlayerImpl implements Player, Serializable { * or NilRoll */ @Override - public PlanarDieRoll rollPlanarDie(Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides) { + public PlanarDieRoll rollPlanarDie(Ability source, Game game, List appliedEffects, int numberChaosSides, int numberPlanarSides) { int result = RandomUtil.nextInt(9) + 1; PlanarDieRoll roll = PlanarDieRoll.NIL_ROLL; if (numberChaosSides + numberPlanarSides > 9) { @@ -2882,15 +2855,15 @@ public abstract class PlayerImpl implements Player, Serializable { } if (!game.isSimulation()) { game.informPlayers("[Roll the planar die] " + getLogName() - + " rolled a " + roll + " on the planar die"); + + " rolled a " + roll + " on the planar die" + CardUtil.getSourceLogName(game, source)); } GameEvent event = new GameEvent(GameEvent.EventType.ROLL_PLANAR_DIE, - playerId, null, playerId, result, true); + playerId, source, playerId, result, true); event.setAppliedEffects(appliedEffects); event.setData(roll + ""); if (!game.replaceEvent(event)) { GameEvent ge = new GameEvent(GameEvent.EventType.PLANAR_DIE_ROLLED, - playerId, null, playerId, event.getAmount(), event.getFlag()); + playerId, source, playerId, event.getAmount(), event.getFlag()); ge.setData(roll + ""); game.fireEvent(ge); } @@ -3153,10 +3126,10 @@ public abstract class PlayerImpl implements Player, Serializable { Costs costs = getCastSourceIdCosts().get(copy.getSourceId()); boolean canPutToPlay = true; - if (alternateCosts != null && !alternateCosts.canPay(copy, copy.getSourceId(), playerId, game)) { + if (alternateCosts != null && !alternateCosts.canPay(copy, copy, playerId, game)) { canPutToPlay = false; } - if (costs != null && !costs.canPay(copy, copy.getSourceId(), playerId, game)) { + if (costs != null && !costs.canPay(copy, copy, playerId, game)) { canPutToPlay = false; } @@ -3264,7 +3237,7 @@ public abstract class PlayerImpl implements Player, Serializable { // if cast for noMana no Alternative costs are allowed if (alternateSourceCostsAbility instanceof AlternativeSourceCosts) { if (((AlternativeSourceCosts) alternateSourceCostsAbility).isAvailable(ability, game)) { - if (alternateSourceCostsAbility.getCosts().canPay(ability, sourceObject.getId(), playerId, game)) { + if (alternateSourceCostsAbility.getCosts().canPay(ability, ability, playerId, game)) { ManaCostsImpl manaCosts = new ManaCostsImpl(); for (Cost cost : alternateSourceCostsAbility.getCosts()) { if (cost instanceof ManaCost) { @@ -3306,7 +3279,7 @@ public abstract class PlayerImpl implements Player, Serializable { for (AlternativeSourceCosts alternateSourceCosts : getAlternativeSourceCosts()) { if (alternateSourceCosts instanceof Ability) { if (alternateSourceCosts.isAvailable(ability, game)) { - if (((Ability) alternateSourceCosts).getCosts().canPay(ability, sourceObject.getId(), playerId, game)) { + if (((Ability) alternateSourceCosts).getCosts().canPay(ability, ability, playerId, game)) { ManaCostsImpl manaCosts = new ManaCostsImpl(); for (Cost cost : ((Ability) alternateSourceCosts).getCosts()) { if (cost instanceof ManaCost) { @@ -3460,19 +3433,19 @@ public abstract class PlayerImpl implements Player, Serializable { // play land restrictions if (isPlayLand && game.getContinuousEffects().preventedByRuleModification( GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(), - ability.getSourceId(), this.getId()), ability, game, true)) { + ability, this.getId()), ability, game, true)) { continue; } // cast spell restrictions 1 if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification( - GameEvent.getEvent(EventType.CAST_SPELL, ability.getSourceId(), - ability.getSourceId(), this.getId()), ability, game, true)) { + GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), + ability, this.getId()), ability, game, true)) { continue; } // cast spell restrictions 2 if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification( - GameEvent.getEvent(EventType.CAST_SPELL_LATE, ability.getSourceId(), - ability.getSourceId(), this.getId()), ability, game, true)) { + GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, ability.getSourceId(), + ability, this.getId()), ability, game, true)) { continue; } @@ -3570,19 +3543,19 @@ public abstract class PlayerImpl implements Player, Serializable { // play land restrictions if (isPlayLand && game.getContinuousEffects().preventedByRuleModification( GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(), - ability.getSourceId(), this.getId()), ability, game, true)) { + ability, this.getId()), ability, game, true)) { continue; } // cast spell restrictions 1 if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification( - GameEvent.getEvent(EventType.CAST_SPELL, ability.getSourceId(), - ability.getSourceId(), this.getId()), ability, game, true)) { + GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), + ability, this.getId()), ability, game, true)) { continue; } // cast spell restrictions 2 if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification( - GameEvent.getEvent(EventType.CAST_SPELL_LATE, ability.getSourceId(), - ability.getSourceId(), this.getId()), ability, game, true)) { + GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, ability.getSourceId(), + ability, this.getId()), ability, game, true)) { continue; } @@ -3920,8 +3893,8 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId, UUID controllerId, Game game) { - return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, sourceId, controllerId, game); + public boolean canPaySacrificeCost(Permanent permanent, Ability source, UUID controllerId, Game game) { + return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, source.getSourceId(), controllerId, game); } @Override @@ -4103,12 +4076,11 @@ public abstract class PlayerImpl implements Player, Serializable { List infoList = new ArrayList<>(); for (Card card : cards) { fromZone = game.getState().getZone(card.getId()); - ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), - source.getSourceId(), byOwner ? card.getOwnerId() : getId(), - fromZone, Zone.BATTLEFIELD, appliedEffects); - infoList.add(new ZoneChangeInfo.Battlefield(event, faceDown, tapped)); + ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source, + byOwner ? card.getOwnerId() : getId(), fromZone, Zone.BATTLEFIELD, appliedEffects); + infoList.add(new ZoneChangeInfo.Battlefield(event, faceDown, tapped, source)); } - infoList = ZonesHandler.moveCards(infoList, game); + infoList = ZonesHandler.moveCards(infoList, game, source); for (ZoneChangeInfo info : infoList) { Permanent permanent = game.getPermanent(info.event.getTargetId()); if (permanent != null) { @@ -4118,7 +4090,8 @@ public abstract class PlayerImpl implements Player, Serializable { if (eventPlayer != null && fromZone != null) { game.informPlayers(eventPlayer.getLogName() + " puts " + (info.faceDown ? "a card face down " : permanent.getLogName()) + " from " - + fromZone.toString().toLowerCase(Locale.ENGLISH) + " onto the Battlefield"); + + fromZone.toString().toLowerCase(Locale.ENGLISH) + " onto the Battlefield" + + CardUtil.getSourceLogName(game, source, permanent.getId())); } } } @@ -4132,7 +4105,7 @@ public abstract class PlayerImpl implements Player, Serializable { || (card.isFaceDown(game) && fromZone != Zone.STACK && fromZone != Zone.BATTLEFIELD); - if (moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, !hideCard)) { + if (moveCardToHandWithInfo(card, source, game, !hideCard)) { successfulMovedCards.add(card); } } @@ -4143,8 +4116,7 @@ public abstract class PlayerImpl implements Player, Serializable { boolean withName = (fromZone == Zone.BATTLEFIELD || fromZone == Zone.STACK) || !card.isFaceDown(game); - if (moveCardToExileWithInfo(card, null, "", source == null - ? null : source.getSourceId(), game, fromZone, withName)) { + if (moveCardToExileWithInfo(card, null, "", source, game, fromZone, withName)) { successfulMovedCards.add(card); } } @@ -4157,15 +4129,15 @@ public abstract class PlayerImpl implements Player, Serializable { fromZone = game.getState().getZone(card.getId()); } boolean hideCard = fromZone == Zone.HAND || fromZone == Zone.LIBRARY; - if (moveCardToLibraryWithInfo(card, source == null - ? null : source.getSourceId(), game, fromZone, true, !hideCard)) { + if (moveCardToLibraryWithInfo(card, source, game, fromZone, true, !hideCard)) { successfulMovedCards.add(card); } } break; case COMMAND: for (Card card : cards) { - if (moveCardToCommandWithInfo(card, source == null ? null : source.getSourceId(), game, fromZone)) { + fromZone = game.getState().getZone(card.getId()); + if (moveCardToCommandWithInfo(card, source, game, fromZone)) { successfulMovedCards.add(card); } } @@ -4174,8 +4146,7 @@ public abstract class PlayerImpl implements Player, Serializable { for (Card card : cards) { if (card instanceof Permanent) { game.getBattlefield().removePermanent(card.getId()); - ZoneChangeEvent event = new ZoneChangeEvent((Permanent) card, - (source == null ? null : source.getSourceId()), + ZoneChangeEvent event = new ZoneChangeEvent((Permanent) card, source, byOwner ? card.getOwnerId() : getId(), Zone.BATTLEFIELD, Zone.OUTSIDE, appliedEffects); game.fireEvent(event); } @@ -4202,25 +4173,19 @@ public abstract class PlayerImpl implements Player, Serializable { boolean result = false; for (Card card : cards) { Zone fromZone = game.getState().getZone(card.getId()); - result |= moveCardToExileWithInfo(card, exileId, exileZoneName, source == null - ? null : source.getSourceId(), game, fromZone, withName); + result |= moveCardToExileWithInfo(card, exileId, exileZoneName, source, game, fromZone, withName); } return result; } @Override - public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) { - return this.moveCardToHandWithInfo(card, sourceId, game, true); - } - - @Override - public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName) { + public boolean moveCardToHandWithInfo(Card card, Ability source, Game game, boolean withName) { boolean result = false; Zone fromZone = game.getState().getZone(card.getId()); if (fromZone == Zone.BATTLEFIELD && !(card instanceof Permanent)) { card = game.getPermanent(card.getId()); } - if (card.moveToZone(Zone.HAND, sourceId, game, false)) { + if (card.moveToZone(Zone.HAND, source, game, false)) { if (card instanceof PermanentCard && game.getCard(card.getId()) != null) { card = game.getCard(card.getId()); } @@ -4228,7 +4193,8 @@ public abstract class PlayerImpl implements Player, Serializable { game.informPlayers(getLogName() + " puts " + (withName ? card.getLogName() : (card.isFaceDown(game) ? "a face down card" : "a card")) + " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' - + (card.isOwnedBy(this.getId()) ? "into their hand" : "into its owner's hand") + + (card.isOwnedBy(this.getId()) ? "into their hand" : "into its owner's hand" + + CardUtil.getSourceLogName(game, source, card.getId())) ); } result = true; @@ -4238,7 +4204,6 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public Set moveCardsToGraveyardWithInfo(Set allCards, Ability source, Game game, Zone fromZone) { - UUID sourceId = source == null ? null : source.getSourceId(); Set movedCards = new LinkedHashSet<>(); while (!allCards.isEmpty()) { // identify cards from one owner @@ -4281,7 +4246,7 @@ public abstract class PlayerImpl implements Player, Serializable { cards.remove(targetObjectId); if (card != null) { fromZone = game.getState().getZone(card.getId()); - if (choosingPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone)) { + if (choosingPlayer.moveCardToGraveyardWithInfo(card, source, game, fromZone)) { movedCards.add(card); } } @@ -4289,13 +4254,13 @@ public abstract class PlayerImpl implements Player, Serializable { } if (cards.size() == 1) { Card card = cards.getCards(game).iterator().next(); - if (card != null && choosingPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone)) { + if (card != null && choosingPlayer.moveCardToGraveyardWithInfo(card, source, game, fromZone)) { movedCards.add(card); } } } else { for (Card card : cards.getCards(game)) { - if (choosingPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone)) { + if (choosingPlayer.moveCardToGraveyardWithInfo(card, source, game, fromZone)) { movedCards.add(card); } } @@ -4306,13 +4271,12 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { + public boolean moveCardToGraveyardWithInfo(Card card, Ability source, Game game, Zone fromZone) { if (card == null) { return false; } boolean result = false; - // Zone fromZone = game.getState().getZone(card.getId()); - if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null && fromZone == Zone.BATTLEFIELD)) { + if (card.moveToZone(Zone.GRAVEYARD, source, game, false)) { if (!game.isSimulation()) { if (card instanceof PermanentCard && game.getCard(card.getId()) != null) { card = game.getCard(card.getId()); @@ -4325,6 +4289,7 @@ public abstract class PlayerImpl implements Player, Serializable { } else { sb.append("it into its owner's graveyard"); } + sb.append(CardUtil.getSourceLogName(game, source, card.getId())); game.informPlayers(sb.toString()); } result = true; @@ -4333,12 +4298,12 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) { + public boolean moveCardToLibraryWithInfo(Card card, Ability source, Game game, Zone fromZone, boolean toTop, boolean withName) { if (card == null) { return false; } boolean result = false; - if (card.moveToZone(Zone.LIBRARY, sourceId, game, toTop)) { + if (card.moveToZone(Zone.LIBRARY, source, game, toTop)) { if (!game.isSimulation()) { if (card instanceof PermanentCard && game.getCard(card.getId()) != null) { card = game.getCard(card.getId()); @@ -4357,6 +4322,7 @@ public abstract class PlayerImpl implements Player, Serializable { sb.append(" of ").append(player.getLogName()).append("'s library"); } } + sb.append(CardUtil.getSourceLogName(game, source, card.getId())); game.informPlayers(sb.toString()); } result = true; @@ -4365,12 +4331,12 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { + public boolean moveCardToCommandWithInfo(Card card, Ability source, Game game, Zone fromZone) { if (card == null) { return false; } boolean result = false; - if (card.moveToZone(Zone.COMMAND, sourceId, game, true)) { + if (card.moveToZone(Zone.COMMAND, source, game, true)) { if (!game.isSimulation()) { if (card instanceof PermanentCard && game.getCard(card.getId()) != null) { card = game.getCard(card.getId()); @@ -4388,6 +4354,7 @@ public abstract class PlayerImpl implements Player, Serializable { sb.append(" to ").append(player.getLogName()).append("'s command zone"); } } + sb.append(CardUtil.getSourceLogName(game, source, card.getId())); game.informPlayers(sb.toString()); } result = true; @@ -4396,12 +4363,12 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName) { + public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, Ability source, Game game, Zone fromZone, boolean withName) { if (card == null) { return false; } boolean result = false; - if (card.moveToExile(exileId, exileName, sourceId, game)) { + if (card.moveToExile(exileId, exileName, source, game)) { if (!game.isSimulation()) { if (card instanceof PermanentCard) { // in case it's face down or name was changed by copying from other permanent @@ -4420,7 +4387,7 @@ public abstract class PlayerImpl implements Player, Serializable { game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName() + (card.isCopy() ? " (Copy)" : "") : "a card face down") + ' ' + (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) - + ' ' : "") + "to the exile zone"); + + ' ' : "") + "to the exile zone" + CardUtil.getSourceLogName(game, source, card.getId())); } } @@ -4431,14 +4398,14 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public Cards millCards(int toMill, Ability source, Game game) { - GameEvent event = GameEvent.getEvent(EventType.MILL_CARDS, getId(), source.getSourceId(), getId(), toMill); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.MILL_CARDS, getId(), source, getId(), toMill); if (game.replaceEvent(event)) { return new CardsImpl(); } Cards cards = new CardsImpl(this.getLibrary().getTopCards(game, event.getAmount())); this.moveCards(cards, Zone.GRAVEYARD, source, game); for (Card card : cards.getCards(game)) { - game.fireEvent(GameEvent.getEvent(EventType.MILLED_CARD, card.getId(), source.getSourceId(), getId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MILLED_CARD, card.getId(), source, getId())); } return cards; } @@ -4551,12 +4518,11 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean scry(int value, Ability source, Game game) { - GameEvent event = new GameEvent(EventType.SCRY, getId(), source == null - ? null : source.getSourceId(), getId(), value, true); + GameEvent event = new GameEvent(GameEvent.EventType.SCRY, getId(), source, getId(), value, true); if (game.replaceEvent(event)) { return false; } - game.informPlayers(getLogName() + " scries " + event.getAmount()); + game.informPlayers(getLogName() + " scries " + event.getAmount() + CardUtil.getSourceLogName(game, source)); Cards cards = new CardsImpl(); cards.addAll(getLibrary().getTopCards(game, event.getAmount())); if (!cards.isEmpty()) { @@ -4568,19 +4534,17 @@ public abstract class PlayerImpl implements Player, Serializable { cards.removeAll(target.getTargets()); putCardsOnTopOfLibrary(cards, game, source, true); } - game.fireEvent(new GameEvent(GameEvent.EventType.SCRIED, getId(), source == null - ? null : source.getSourceId(), getId(), event.getAmount(), true)); + game.fireEvent(new GameEvent(GameEvent.EventType.SCRIED, getId(), source, getId(), event.getAmount(), true)); return true; } @Override public boolean surveil(int value, Ability source, Game game) { - GameEvent event = new GameEvent(GameEvent.EventType.SURVEIL, getId(), source == null - ? null : source.getSourceId(), getId(), value, true); + GameEvent event = new GameEvent(GameEvent.EventType.SURVEIL, getId(), source, getId(), value, true); if (game.replaceEvent(event)) { return false; } - game.informPlayers(getLogName() + " surveils " + event.getAmount()); + game.informPlayers(getLogName() + " surveils " + event.getAmount() + CardUtil.getSourceLogName(game, source)); Cards cards = new CardsImpl(); cards.addAll(getLibrary().getTopCards(game, event.getAmount())); if (!cards.isEmpty()) { @@ -4591,8 +4555,7 @@ public abstract class PlayerImpl implements Player, Serializable { cards.removeAll(target.getTargets()); putCardsOnTopOfLibrary(cards, game, source, true); } - game.fireEvent(new GameEvent(GameEvent.EventType.SURVEILED, getId(), source == null - ? null : source.getSourceId(), getId(), event.getAmount(), true)); + game.fireEvent(new GameEvent(GameEvent.EventType.SURVEILED, getId(), source, getId(), event.getAmount(), true)); return true; } diff --git a/Mage/src/main/java/mage/players/StubPlayer.java b/Mage/src/main/java/mage/players/StubPlayer.java index 2f926a12e4b..1b86856123c 100644 --- a/Mage/src/main/java/mage/players/StubPlayer.java +++ b/Mage/src/main/java/mage/players/StubPlayer.java @@ -181,7 +181,7 @@ public class StubPlayer extends PlayerImpl implements Player { } @Override - public void selectBlockers(Game game, UUID defendingPlayerId) { + public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) { } @@ -196,7 +196,7 @@ public class StubPlayer extends PlayerImpl implements Player { } @Override - public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { + public void assignDamage(int damage, List targets, String singleTargetName, UUID attackerId, Ability source, Game game) { } diff --git a/Mage/src/main/java/mage/target/Target.java b/Mage/src/main/java/mage/target/Target.java index 87c6e89c07b..75561a06800 100644 --- a/Mage/src/main/java/mage/target/Target.java +++ b/Mage/src/main/java/mage/target/Target.java @@ -60,7 +60,6 @@ public interface Target extends Serializable { List getTargetOptions(Ability source, Game game); - //methods for non-targets boolean canChoose(UUID sourceControllerId, Game game); Set possibleTargets(UUID sourceControllerId, Game game); diff --git a/Mage/src/main/java/mage/target/TargetCard.java b/Mage/src/main/java/mage/target/TargetCard.java index 8e52747a7e5..6d4cc56fb81 100644 --- a/Mage/src/main/java/mage/target/TargetCard.java +++ b/Mage/src/main/java/mage/target/TargetCard.java @@ -8,6 +8,7 @@ import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.TargetEvent; import mage.players.Player; import java.util.*; @@ -72,7 +73,7 @@ public class TargetCard extends TargetObject { switch (zone) { case HAND: for (Card card : player.getHand().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets++; if (possibleTargets >= this.minNumberOfTargets) { return true; @@ -82,7 +83,7 @@ public class TargetCard extends TargetObject { break; case GRAVEYARD: for (Card card : player.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets++; if (possibleTargets >= this.minNumberOfTargets) { return true; @@ -92,7 +93,7 @@ public class TargetCard extends TargetObject { break; case LIBRARY: for (Card card : player.getLibrary().getUniqueCards(game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { if (filter.match(card, game)) { possibleTargets++; if (possibleTargets >= this.minNumberOfTargets) { @@ -104,7 +105,7 @@ public class TargetCard extends TargetObject { break; case EXILED: for (Card card : game.getExile().getPermanentExile().getCards(game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { if (filter.match(card, player.getId(), game)) { possibleTargets++; if (possibleTargets >= this.minNumberOfTargets) { @@ -141,21 +142,21 @@ public class TargetCard extends TargetObject { switch (zone) { case HAND: for (Card card : player.getHand().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets.add(card.getId()); } } break; case GRAVEYARD: for (Card card : player.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets.add(card.getId()); } } break; case LIBRARY: for (Card card : player.getLibrary().getUniqueCards(game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { if (filter.match(card, sourceId, sourceControllerId, game)) { possibleTargets.add(card.getId()); } @@ -164,7 +165,7 @@ public class TargetCard extends TargetObject { break; case EXILED: for (Card card : game.getExile().getPermanentExile().getCards(game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { if (filter.match(card, sourceId, sourceControllerId, game)) { possibleTargets.add(card.getId()); } @@ -179,7 +180,7 @@ public class TargetCard extends TargetObject { .filter(card -> filter.match(card, sourceId, sourceControllerId, game)) .collect(Collectors.toList()); for (Card card : possibleCards) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets.add(card.getId()); } } diff --git a/Mage/src/main/java/mage/target/TargetImpl.java b/Mage/src/main/java/mage/target/TargetImpl.java index a7772147a7d..053000e106a 100644 --- a/Mage/src/main/java/mage/target/TargetImpl.java +++ b/Mage/src/main/java/mage/target/TargetImpl.java @@ -9,6 +9,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; +import mage.game.events.TargetEvent; import mage.players.Player; import mage.util.RandomUtil; @@ -223,12 +224,12 @@ public abstract class TargetImpl implements Target { if (getMaxNumberOfTargets() == 0 || targets.size() < getMaxNumberOfTargets()) { if (!targets.containsKey(id)) { if (source != null && !skipEvent && shouldReportEvents) { - if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, id, source.getSourceId(), source.getControllerId()))) { + if (!game.replaceEvent(new TargetEvent(id, source))) { targets.put(id, 0); rememberZoneChangeCounter(id, game); chosen = targets.size() >= getNumberOfTargets(); if (!skipEvent && shouldReportEvents) { - game.addSimultaneousEvent(GameEvent.getEvent(EventType.TARGETED, id, source.getSourceId(), source.getControllerId())); + game.addSimultaneousEvent(GameEvent.getEvent(GameEvent.EventType.TARGETED, id, source, source.getControllerId())); } } } else { @@ -261,12 +262,12 @@ public abstract class TargetImpl implements Target { amount += targets.get(id); } if (source != null && !skipEvent && shouldReportEvents) { - if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, id, source.getSourceId(), source.getControllerId()))) { + if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, id, source, source.getControllerId()))) { targets.put(id, amount); rememberZoneChangeCounter(id, game); chosen = targets.size() >= getNumberOfTargets(); if (!skipEvent && shouldReportEvents) { - game.fireEvent(GameEvent.getEvent(EventType.TARGETED, id, source.getSourceId(), source.getControllerId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TARGETED, id, source, source.getControllerId())); } } } else { @@ -336,7 +337,7 @@ public abstract class TargetImpl implements Target { continue; // it's not legal so continue to have a look at other targeted objects } } - if (!notTarget && game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getSourceId(), source.getControllerId()))) { + if (!notTarget && game.replaceEvent(new TargetEvent(targetId, source))) { // replacedTargets++; illegalTargets.add(targetId); continue; diff --git a/Mage/src/main/java/mage/target/Targets.java b/Mage/src/main/java/mage/target/Targets.java index 0409700fe44..09d0b080aa3 100644 --- a/Mage/src/main/java/mage/target/Targets.java +++ b/Mage/src/main/java/mage/target/Targets.java @@ -91,7 +91,7 @@ public class Targets extends ArrayList { } // Check if there are some rules for targets are violated, if so reset the targets and start again if (this.getUnchosen().isEmpty() - && game.replaceEvent(new GameEvent(GameEvent.EventType.TARGETS_VALID, source.getSourceId(), source.getSourceId(), source.getControllerId()), source)) { + && game.replaceEvent(new GameEvent(GameEvent.EventType.TARGETS_VALID, source.getSourceId(), source, source.getControllerId()), source)) { //game.restoreState(state, "Targets"); clearChosen(); } @@ -110,6 +110,8 @@ public class Targets extends ArrayList { } /** + * For target choose + * * Checks if there are enough targets that can be chosen. Should only be * used for Ability targets since this checks for protection, shroud etc. * @@ -123,6 +125,8 @@ public class Targets extends ArrayList { } /** + * For non target choose (e.g. cost pay) + * * Checks if there are enough objects that can be selected. Should not be * used for Ability targets since this does not check for protection, shroud * etc. diff --git a/Mage/src/main/java/mage/target/common/TargetCardInHand.java b/Mage/src/main/java/mage/target/common/TargetCardInHand.java index 0b80182b1bf..11520478fc7 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInHand.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInHand.java @@ -6,6 +6,7 @@ import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.TargetEvent; import mage.players.Player; import mage.target.TargetCard; @@ -56,12 +57,12 @@ public class TargetCardInHand extends TargetCard { } @Override - public Set possibleTargets(UUID sourceId, UUID playerId, Game game) { + public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set possibleTargets = new HashSet<>(); - Player player = game.getPlayer(playerId); + Player player = game.getPlayer(sourceControllerId); if (player != null) { - for (Card card : player.getHand().getCards(filter, sourceId, playerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, playerId))) { + for (Card card : player.getHand().getCards(filter, sourceId, sourceControllerId, game)) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets.add(card.getId()); } } @@ -75,7 +76,7 @@ public class TargetCardInHand extends TargetCard { Player player = game.getPlayer(sourceControllerId); if (player != null) { for (Card card : player.getHand().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets++; if (possibleTargets >= this.minNumberOfTargets) { return true; diff --git a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java index 7ab5c77f95a..a3401641de6 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java @@ -54,7 +54,7 @@ public class TargetCardInLibrary extends TargetCard { } @Override - public boolean choose(Outcome outcome, UUID playerId, UUID targetPlayerId, Game game) { + public boolean choose(Outcome outcome, UUID playerId, UUID targetPlayerId, Game game) { // TODO: wtf sourceId named as targetPlayerId?! Player player = game.getPlayer(playerId); Player targetPlayer = game.getPlayer(targetPlayerId); if (targetPlayer == null) { diff --git a/Mage/src/main/java/mage/target/common/TargetCardInOpponentsGraveyard.java b/Mage/src/main/java/mage/target/common/TargetCardInOpponentsGraveyard.java index 0a1227bc073..097305fe5f1 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInOpponentsGraveyard.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInOpponentsGraveyard.java @@ -9,6 +9,7 @@ import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.TargetEvent; import mage.players.Player; import mage.target.TargetCard; @@ -100,7 +101,7 @@ public class TargetCardInOpponentsGraveyard extends TargetCard { Player player = game.getPlayer(playerId); if (player != null) { for (Card card : player.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets++; if (possibleTargets >= this.minNumberOfTargets) { return true; @@ -125,7 +126,7 @@ public class TargetCardInOpponentsGraveyard extends TargetCard { if (player != null) { Set targetsInThisGraveyeard = new HashSet<>(); for (Card card : player.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { targetsInThisGraveyeard.add(card.getId()); } } diff --git a/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java b/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java index e596adce261..5a6b38f0c7e 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java @@ -11,6 +11,7 @@ import mage.filter.FilterCard; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.TargetEvent; import mage.players.Player; import mage.target.TargetCard; @@ -76,7 +77,7 @@ public class TargetCardInYourGraveyard extends TargetCard { Set possibleTargets = new HashSet<>(); Player player = game.getPlayer(sourceControllerId); for (Card card : player.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets.add(card.getId()); } } @@ -116,7 +117,7 @@ public class TargetCardInYourGraveyard extends TargetCard { } int possibleTargets = 0; for (Card card : player.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) { - if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) { + if (sourceId == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) { possibleTargets++; if (possibleTargets >= this.minNumberOfTargets) { return true; diff --git a/Mage/src/main/java/mage/target/targetpointer/FixedTarget.java b/Mage/src/main/java/mage/target/targetpointer/FixedTarget.java index c6c2c3eb8ff..06c24f81b35 100644 --- a/Mage/src/main/java/mage/target/targetpointer/FixedTarget.java +++ b/Mage/src/main/java/mage/target/targetpointer/FixedTarget.java @@ -58,9 +58,7 @@ public class FixedTarget implements TargetPointer { * @param game */ public FixedTarget(Permanent permanent, Game game) { - this.targetId = permanent.getId(); - this.zoneChangeCounter = permanent.getZoneChangeCounter(game); - this.initialized = true; + this(permanent.getId(), game); } /** diff --git a/Mage/src/main/java/mage/util/CardUtil.java b/Mage/src/main/java/mage/util/CardUtil.java index 2298d1c6601..40c0f9d86ce 100644 --- a/Mage/src/main/java/mage/util/CardUtil.java +++ b/Mage/src/main/java/mage/util/CardUtil.java @@ -23,6 +23,7 @@ import mage.filter.Filter; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.CardState; import mage.game.Game; +import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentCard; import mage.game.permanent.PermanentMeld; @@ -849,13 +850,14 @@ public final class CardUtil { } /** - * Put card to battlefield without resolve + * Put card to battlefield without resolve (for cheats and tests only) * + * @param source must be non null (if you need it empty then use fakeSourceAbility) * @param game * @param card * @param player */ - public static void putCardOntoBattlefieldWithEffects(Game game, Card card, Player player) { + public static void putCardOntoBattlefieldWithEffects(Ability source, Game game, Card card, Player player) { // same logic as ZonesHandler->maybeRemoveFromSourceZone // prepare card and permanent @@ -870,8 +872,8 @@ public final class CardUtil { // put onto battlefield with possible counters game.getPermanentsEntering().put(permanent.getId(), permanent); - card.checkForCountersToAdd(permanent, game); - permanent.entersBattlefield(permanent.getId(), game, Zone.OUTSIDE, false); + card.checkForCountersToAdd(permanent, source, game); + permanent.entersBattlefield(source, game, Zone.OUTSIDE, false); game.addPermanent(permanent, game.getState().getNextPermanentOrderNumber()); game.getPermanentsEntering().remove(permanent.getId()); @@ -1010,4 +1012,67 @@ public final class CardUtil { game.addEffect(new CanPlayCardControllerEffect(game, card.getId(), zcc, duration), source); game.addEffect(new YouMaySpendManaAsAnyColorToCastTargetEffect(duration).setTargetPointer(new FixedTarget(card.getId(), zcc)), source); } + + /** + * Pay life in effects + * + * @param lifeToPay + * @param player + * @param source + * @param game + * @return true on good pay + */ + public static boolean tryPayLife(int lifeToPay, Player player, Ability source, Game game) { + // rules: + // 119.4. If a cost or effect allows a player to pay an amount of life greater than 0, the player may do so + // only if their life total is greater than or equal to the amount of the payment. If a player pays life, + // the payment is subtracted from their life total; in other words, the player loses that much life. + // (Players can always pay 0 life.) + if (lifeToPay == 0) { + return true; + } else if (lifeToPay < 0) { + return false; + } + + if (lifeToPay > player.getLife()) { + return false; + } + + if (player.loseLife(lifeToPay, game, source, false) >= lifeToPay) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIFE_PAID, player.getId(), source, player.getId(), lifeToPay)); + return true; + } + + return false; + } + + /** + * Generates source log name to insert into log messages + * + * @param game + * @param sourceId + * @param namePrefix if source object exists then that will be added before name + * @param namePostfix if source object exists then that will be added after name + * @param nonFoundText if source object not exists then it will be used + * @return + */ + public static String getSourceLogName(Game game, String namePrefix, UUID sourceId, String namePostfix, String nonFoundText) { + MageObject sourceObject = game.getObject(sourceId); + return (sourceObject == null ? nonFoundText : namePrefix + sourceObject.getLogName() + namePostfix); + } + + public static String getSourceLogName(Game game, String namePrefix, Ability source, String namePostfix, String nonFoundText) { + return getSourceLogName(game, namePrefix, source == null ? null : source.getSourceId(), namePostfix, nonFoundText); + } + + public static String getSourceLogName(Game game, Ability source) { + return CardUtil.getSourceLogName(game, " (source: ", source, ")", ""); + } + + public static String getSourceLogName(Game game, Ability source, UUID ignoreSourceId) { + if (ignoreSourceId != null && source != null && ignoreSourceId.equals(source.getSourceId())) { + return ""; + } + return CardUtil.getSourceLogName(game, " (source: ", source, ")", ""); + } } diff --git a/Mage/src/main/java/mage/util/ManaUtil.java b/Mage/src/main/java/mage/util/ManaUtil.java index 1d606b33cd3..4beb1f8aca1 100644 --- a/Mage/src/main/java/mage/util/ManaUtil.java +++ b/Mage/src/main/java/mage/util/ManaUtil.java @@ -543,7 +543,7 @@ public final class ManaUtil { wantToPay = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (wantToPay > 0) { Cost cost = ManaUtil.createManaCost(wantToPay, payAsX); - payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); + payed = cost.pay(source, game, source, player.getId(), false, null); } else { payed = true; } diff --git a/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java b/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java index 7d70b8f10ed..bfa3a48d237 100644 --- a/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java @@ -27,7 +27,7 @@ public class BlockedAttackerWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.BLOCKER_DECLARED) { + if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { MageObjectReference blocker = new MageObjectReference(event.getSourceId(), game); Set blockedAttackers = blockData.get(blocker); if (blockedAttackers != null) { diff --git a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java index f2794367cc2..01deb52095b 100644 --- a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java @@ -36,7 +36,7 @@ public class CommanderInfoWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (checkCommanderDamage && event.getType() == EventType.DAMAGED_PLAYER && event instanceof DamagedPlayerEvent) { + if (checkCommanderDamage && event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event instanceof DamagedPlayerEvent) { if (sourceId.equals(event.getSourceId())) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; if (damageEvent.isCombatDamage()) { diff --git a/Mage/src/main/java/mage/watchers/common/CommanderPlaysCountWatcher.java b/Mage/src/main/java/mage/watchers/common/CommanderPlaysCountWatcher.java index d96483b2278..888c4c8c13e 100644 --- a/Mage/src/main/java/mage/watchers/common/CommanderPlaysCountWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CommanderPlaysCountWatcher.java @@ -7,10 +7,7 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.watchers.Watcher; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; +import java.util.*; /** * Calcs commanders play count only from command zone (spell or land) @@ -33,13 +30,21 @@ public class CommanderPlaysCountWatcher extends Watcher { && event.getType() != EventType.SPELL_CAST) { return; } + final UUID objectId; + if (event.getType() == EventType.LAND_PLAYED) { + objectId = event.getTargetId(); + } else if (event.getType() == EventType.SPELL_CAST) { + objectId = event.getSourceId(); + } else { + objectId = null; + } boolean isCommanderObject = game .getPlayerList() .stream() .map(game::getPlayer) .map(game::getCommandersIds) .flatMap(Collection::stream) - .anyMatch(event.getSourceId()::equals); + .anyMatch(id -> Objects.equals(id, objectId)); if (!isCommanderObject || event.getZone() != Zone.COMMAND) { return; } diff --git a/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java b/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java index b7c3243f985..1956b98e1d9 100644 --- a/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java @@ -30,8 +30,8 @@ public class DamagedByWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - boolean eventHasAppropriateType = (event.getType() == EventType.DAMAGED_CREATURE) || - (watchPlaneswalkers && event.getType() == EventType.DAMAGED_PLANESWALKER); + boolean eventHasAppropriateType = (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) || + (watchPlaneswalkers && event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER); if (eventHasAppropriateType && sourceId.equals(event.getSourceId())) { MageObjectReference mor = new MageObjectReference(event.getTargetId(), game); damagedBySource.add(mor); diff --git a/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java index 80a1a329ee2..c0991704fc8 100644 --- a/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java @@ -29,9 +29,9 @@ public class FirstSpellCastThisTurnWatcher extends Watcher { case CAST_SPELL: Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null && !playerFirstSpellCast.containsKey(spell.getControllerId())) { - if (event.getType() == EventType.SPELL_CAST) { + if (event.getType() == GameEvent.EventType.SPELL_CAST) { playerFirstSpellCast.put(spell.getControllerId(), spell.getId()); - } else if (event.getType() == EventType.CAST_SPELL) { + } else if (event.getType() == GameEvent.EventType.CAST_SPELL) { playerFirstCastSpell.put(spell.getControllerId(), spell.getId()); } } diff --git a/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java b/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java index 5ee8b2a5220..e7d288314e9 100644 --- a/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java @@ -23,7 +23,7 @@ public class GravestormWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.isDiesEvent()) { gravestormCount++; diff --git a/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java b/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java index a68cf3eaa86..dd3cd9ef017 100644 --- a/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java @@ -24,6 +24,7 @@ public class LifeLossOtherFromCombatWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { + // non combat lose life if (event.getType() == GameEvent.EventType.LOST_LIFE && !event.getFlag()) { UUID playerId = event.getPlayerId(); if (playerId != null) { diff --git a/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java b/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java index 30202fc773a..d30185295bd 100644 --- a/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java @@ -34,13 +34,12 @@ public class MiracleWatcher extends Watcher { public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.UNTAP_STEP_PRE) { reset(); - return; } // inital card draws do not trigger miracle so check that phase != null if (game.getPhase() != null && event.getType() == GameEvent.EventType.DREW_CARD) { UUID playerId = event.getPlayerId(); if (playerId != null) { - Integer amount = 1 + amountOfCardsDrawnThisTurn.getOrDefault(playerId, 0); + int amount = 1 + amountOfCardsDrawnThisTurn.getOrDefault(playerId, 0); amountOfCardsDrawnThisTurn.put(playerId, amount); if (amount == 1) { checkMiracleAbility(event, game); @@ -52,7 +51,7 @@ public class MiracleWatcher extends Watcher { private void checkMiracleAbility(GameEvent event, Game game) { Card card = game.getCard(event.getTargetId()); if (card != null) { - for (Ability ability : card.getAbilities()) { + for (Ability ability : card.getAbilities(game)) { if (ability instanceof MiracleAbility) { Player controller = game.getPlayer(ability.getControllerId()); if (controller != null) { @@ -60,7 +59,7 @@ public class MiracleWatcher extends Watcher { controller.lookAtCards("Miracle", cards, game); if (controller.chooseUse(Outcome.Benefit, "Reveal " + card.getLogName() + " to be able to use Miracle?", ability, game)) { controller.revealCards("Miracle", cards, game); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MIRACLE_CARD_REVEALED, card.getId(), card.getId(), controller.getId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MIRACLE_CARD_REVEALED, card.getId(), ability, controller.getId())); break; } } diff --git a/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java index c30c552ec41..fc9e2d99c95 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java @@ -26,7 +26,7 @@ public class PlayerDamagedBySourceWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { if (event.getTargetId().equals(controllerId)) { damageSourceIds.add(CardUtil.getCardZoneString(null, event.getSourceId(), game)); } diff --git a/Mage/src/main/java/mage/watchers/common/PlayerLostLifeNonCombatWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerLostLifeNonCombatWatcher.java index e2d3ad210b3..2869021b238 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerLostLifeNonCombatWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerLostLifeNonCombatWatcher.java @@ -27,6 +27,7 @@ public class PlayerLostLifeNonCombatWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { + // non combat lose life if (event.getType() == GameEvent.EventType.LOST_LIFE && !event.getFlag()) { UUID playerId = event.getPlayerId(); if (playerId != null) { diff --git a/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java b/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java index db1dd3483a2..f6591eb6644 100644 --- a/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java @@ -26,7 +26,7 @@ public class RevoltWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && event instanceof ZoneChangeEvent) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event instanceof ZoneChangeEvent) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = zEvent.getTarget(); diff --git a/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java b/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java index f338ea1cb02..97112fd4b67 100644 --- a/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java @@ -24,9 +24,9 @@ public class SourceDidDamageWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_CREATURE - || event.getType() == EventType.DAMAGED_PLANESWALKER - || event.getType() == EventType.DAMAGED_PLAYER) { + if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE + || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { damageSources.add(event.getSourceId()); }