[MOM] fix Tribute to the World Tree (#10501)

Fix #10413. Fix #10499.
This commit is contained in:
Susucre 2023-06-23 04:18:11 +02:00 committed by GitHub
parent 63be7589ae
commit 3a0324557a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,14 +57,24 @@ class TributeToTheWorldTreeEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { 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) { if (permanent == null) {
return false; return false;
} }
if (permanent.getPower().getValue() < 3) {
int power = permanent.getPower().getValue();
if (power < 3) {
return permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); return permanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
} }
else {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
return player != null && player.drawCards(1, source, game) > 0; return player != null && player.drawCards(1, source, game) > 0;
} }
} }
}