From a90dbd853380d09bea8327fb15bbbf3297b512db Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 24 Jul 2020 12:08:08 +0200 Subject: [PATCH] * Some minot code clean up. --- .../src/mage/cards/s/SatyrFiredancer.java | 20 +++++----------- .../oneshot/damage/SatyrFiredancerTest.java | 24 +++++++++---------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java b/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java index 88bfb5bdc2..762b17575d 100644 --- a/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java +++ b/Mage.Sets/src/mage/cards/s/SatyrFiredancer.java @@ -1,6 +1,6 @@ - package mage.cards.s; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -19,18 +19,11 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; -import mage.game.stack.StackObject; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; import mage.target.targetadjustment.TargetAdjuster; import mage.target.targetpointer.FixedTarget; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - /** * @author LevelX2 */ @@ -80,16 +73,15 @@ class SatyrFiredancerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - boolean controlledBy = isControlledBy(game.getControllerId(event.getSourceId())); - if (!controlledBy) { + if (!isControlledBy(game.getControllerId(event.getSourceId()))) { return false; } MageObject damageSource = game.getObject(event.getSourceId()); if (damageSource == null) { return false; } - UUID damageTarget = event.getTargetId(); - if (!game.getOpponents(getControllerId()).contains(damageTarget)) { + UUID damageTargetId = event.getTargetId(); + if (!game.getOpponents(getControllerId()).contains(damageTargetId)) { return false; } MageObject sourceObject = game.getObject(event.getSourceId()); @@ -97,7 +89,7 @@ class SatyrFiredancerTriggeredAbility extends TriggeredAbilityImpl { return false; } for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(damageTarget)); // used by adjust targets + effect.setTargetPointer(new FixedTarget(damageTargetId)); // used by adjust targets effect.setValue("damage", event.getAmount()); } return true; @@ -152,4 +144,4 @@ enum SatyrFiredancerAdjuster implements TargetAdjuster { ability.getTargets().add(new TargetCreaturePermanent(filter)); } } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java index 26091b3859..779479ecd4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java @@ -1,4 +1,3 @@ - package org.mage.test.cards.abilities.oneshot.damage; import mage.constants.PhaseStep; @@ -11,12 +10,11 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * * @author LevelX2 */ - public class SatyrFiredancerTest extends CardTestPlayerBase { @Test public void testDamageFromInstantToPlayer() { - // Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls. + // Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls. addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer"); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); addCard(Zone.HAND, playerA, "Lightning Bolt"); @@ -31,20 +29,20 @@ public class SatyrFiredancerTest extends CardTestPlayerBase { assertLife(playerA, 20); assertLife(playerB, 17); - + assertGraveyardCount(playerA, "Lightning Bolt", 1); assertGraveyardCount(playerB, "Silvercoat Lion", 1); } @Test public void testDamageFromAttackWontTrigger() { - // Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls. + // Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls. addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer"); addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox", 1); addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); - attack(1, playerA, "Pillarfield Ox"); + attack(1, playerA, "Pillarfield Ox"); addTarget(playerA, "Silvercoat Lion"); setStopAt(1, PhaseStep.END_TURN); @@ -52,29 +50,28 @@ public class SatyrFiredancerTest extends CardTestPlayerBase { assertLife(playerA, 20); assertLife(playerB, 18); - + assertGraveyardCount(playerB, "Silvercoat Lion", 0); assertPermanentCount(playerB, "Silvercoat Lion", 1); } - @Test public void testDamageFromOtherCreature() { - // Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls. + // Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls. addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer"); // {T}: Prodigal Pyromancer deals 1 damage to any target. addCard(Zone.BATTLEFIELD, playerA, "Prodigal Pyromancer", 1); - activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals", playerB); - addTarget(playerA, playerB); - + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals", playerB); + addTarget(playerA, playerB); + setStopAt(3, PhaseStep.END_TURN); execute(); assertLife(playerA, 20); assertLife(playerB, 19); - + } @Test @@ -82,6 +79,7 @@ public class SatyrFiredancerTest extends CardTestPlayerBase { playerC = createPlayer(currentGame, playerC, "PlayerC"); addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer", 1); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + // Price of Progress deals damage to each player equal to twice the number of nonbasic lands that player controls. addCard(Zone.HAND, playerA, "Price of Progress", 1); addCard(Zone.BATTLEFIELD, playerB, "Taiga", 1);