From 3a0324557ad240be44e79053964803995e087948 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Fri, 23 Jun 2023 04:18:11 +0200 Subject: [PATCH] [MOM] fix Tribute to the World Tree (#10501) Fix #10413. Fix #10499. --- .../mage/cards/t/TributeToTheWorldTree.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/cards/t/TributeToTheWorldTree.java b/Mage.Sets/src/mage/cards/t/TributeToTheWorldTree.java index 39c3be2361..34bbf4609e 100644 --- a/Mage.Sets/src/mage/cards/t/TributeToTheWorldTree.java +++ b/Mage.Sets/src/mage/cards/t/TributeToTheWorldTree.java @@ -57,14 +57,24 @@ class TributeToTheWorldTreeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = (Permanent) getValue("permanentEnteringBattlefield"); + Permanent permanentEntering = (Permanent) getValue("permanentEnteringBattlefield"); + if (permanentEntering == null) { + return false; + } + + // We need to ask the game for the actualized object for the entering permanent. + Permanent permanent = game.getPermanent(permanentEntering.getId()); if (permanent == null) { return false; } - if (permanent.getPower().getValue() < 3) { + + int power = permanent.getPower().getValue(); + if (power < 3) { return permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); } - Player player = game.getPlayer(source.getControllerId()); - return player != null && player.drawCards(1, source, game) > 0; + else { + Player player = game.getPlayer(source.getControllerId()); + return player != null && player.drawCards(1, source, game) > 0; + } } }