diff --git a/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java b/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java index 370f5d4eb7..c5061f7826 100644 --- a/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java +++ b/Mage.Sets/src/mage/cards/k/KazuulTyrantOfTheCliffs.java @@ -1,8 +1,5 @@ - package mage.cards.k; -import java.util.Objects; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -11,21 +8,17 @@ import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Outcome; -import mage.constants.SuperType; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; import mage.game.permanent.token.OgreToken; import mage.players.Player; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class KazuulTyrantOfTheCliffs extends CardImpl { @@ -55,11 +48,11 @@ public final class KazuulTyrantOfTheCliffs extends CardImpl { class KazuulTyrantOfTheCliffsTriggeredAbility extends TriggeredAbilityImpl { - public KazuulTyrantOfTheCliffsTriggeredAbility() { + KazuulTyrantOfTheCliffsTriggeredAbility() { super(Zone.BATTLEFIELD, new KazuulTyrantOfTheCliffsEffect(new GenericManaCost(3))); } - public KazuulTyrantOfTheCliffsTriggeredAbility(final KazuulTyrantOfTheCliffsTriggeredAbility ability) { + private KazuulTyrantOfTheCliffsTriggeredAbility(final KazuulTyrantOfTheCliffsTriggeredAbility ability) { super(ability); } @@ -75,19 +68,17 @@ class KazuulTyrantOfTheCliffsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent attacker = game.getPermanent(event.getSourceId()); - Player defender = game.getPlayer(event.getTargetId()); - Player you = game.getPlayer(controllerId); - if (!Objects.equals(attacker.getControllerId(), you.getId()) && Objects.equals(defender, you)) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(attacker.getControllerId())); - return true; + if (!getControllerId().equals(game.getCombat().getDefendingPlayerId(event.getSourceId(), game))) { + return false; } - return false; + this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getControllerId(event.getSourceId()))); + return true; } @Override public String getRule() { - return "Whenever a creature an opponent controls attacks, if you're the defending player, create a 3/3 red Ogre creature token unless that creature's controller pays {3}"; + return "Whenever a creature an opponent controls attacks, if you're the defending player, " + + "create a 3/3 red Ogre creature token unless that creature's controller pays {3}"; } } @@ -96,12 +87,12 @@ class KazuulTyrantOfTheCliffsEffect extends OneShotEffect { protected Cost cost; private static OgreToken token = new OgreToken(); - public KazuulTyrantOfTheCliffsEffect(Cost cost) { + KazuulTyrantOfTheCliffsEffect(Cost cost) { super(Outcome.PutCreatureInPlay); this.cost = cost; } - public KazuulTyrantOfTheCliffsEffect(KazuulTyrantOfTheCliffsEffect effect) { + private KazuulTyrantOfTheCliffsEffect(KazuulTyrantOfTheCliffsEffect effect) { super(effect); this.cost = effect.cost.copy(); } @@ -109,13 +100,14 @@ class KazuulTyrantOfTheCliffsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player payee = game.getPlayer(targetPointer.getFirst(game, source)); - if (payee != null) { - cost.clearPaid(); - if (!cost.pay(source, game, source.getSourceId(), payee.getId(), false, null)) { - return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); - } + if (payee == null) { + return false; } - return false; + cost.clearPaid(); + if (cost.pay(source, game, source.getSourceId(), payee.getId(), false, null)) { + return false; + } + return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); } @Override