* Akron Legionnaire - Fixed not correct working restrict ability.

This commit is contained in:
LevelX2 2015-06-08 22:51:48 +02:00
parent 256b93ffd8
commit 21e2066bba
4 changed files with 82 additions and 24 deletions

View file

@ -89,6 +89,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
* @param options * @param options
*/ */
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, int priorityTime, GamePanel gamePanel, PlayAreaPanelOptions options) { public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, int priorityTime, GamePanel gamePanel, PlayAreaPanelOptions options) {
this.gamePanel = gamePanel;
this.options = options; this.options = options;
initComponents(); initComponents();
setOpaque(false); setOpaque(false);
@ -101,7 +102,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
addPopupMenuWatcher(); addPopupMenuWatcher();
} }
this.add(popupMenu); this.add(popupMenu);
this.gamePanel = gamePanel;
init(player, bigCard, gameId, priorityTime); init(player, bigCard, gameId, priorityTime);
update(player); update(player);
} }

View file

@ -30,8 +30,8 @@ package mage.sets.legends;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.combat.CantAttackAllAnyPlayerEffect; import mage.abilities.effects.common.combat.CantAttackAllAnyPlayerEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
@ -39,9 +39,10 @@ import mage.constants.Rarity;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
/** /**
* *
@ -53,7 +54,8 @@ public class AkronLegionnaire extends CardImpl {
static { static {
filter.add(new ControllerPredicate(TargetController.YOU)); filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new AkronLegionairePredicate()); filter.add(Predicates.not(new NamePredicate("Akron Legionnaire")));
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
} }
public AkronLegionnaire(UUID ownerId) { public AkronLegionnaire(UUID ownerId) {
@ -65,7 +67,9 @@ public class AkronLegionnaire extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Except for creatures named Akron Legionnaire and artifact creatures, creatures you control can't attack. // Except for creatures named Akron Legionnaire and artifact creatures, creatures you control can't attack.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackAllAnyPlayerEffect(Duration.WhileOnBattlefield, filter))); Effect effect = new CantAttackAllAnyPlayerEffect(Duration.WhileOnBattlefield, filter);
effect.setText("Except for creatures named Akron Legionnaire and artifact creatures, creatures you control can't attack");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
} }
@ -78,20 +82,3 @@ public class AkronLegionnaire extends CardImpl {
return new AkronLegionnaire(this); return new AkronLegionnaire(this);
} }
} }
class AkronLegionairePredicate implements Predicate<Card> {
public AkronLegionairePredicate() {
}
@Override
public boolean apply(Card input, Game game) {
return !input.getCardType().contains(CardType.ARTIFACT)
|| !input.getName().contains("Akron Legionaire");
}
@Override
public String toString() {
return "";
}
}

View file

@ -41,7 +41,7 @@ public class ManaFlareTest extends CardTestPlayerBase {
@Test @Test
public void testIsland() { public void testIsland() {
// {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a multicolored spell. // Whenever a player taps a land for mana, that player adds one mana to his or her mana pool of any type that land produced.
addCard(Zone.BATTLEFIELD, playerA, "Mana Flare", 1); addCard(Zone.BATTLEFIELD, playerA, "Mana Flare", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 1); addCard(Zone.BATTLEFIELD, playerA, "Island", 1);

View file

@ -0,0 +1,71 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.restriction;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class CantAttackTest extends CardTestPlayerBase {
/**
* Tests "If all other elves get the Forestwalk ability and can't be blockt from creatures whose controler has a forest in game"
*/
@Test
public void testAttack() {
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2
addCard(Zone.BATTLEFIELD, playerA, "Myr Enforcer"); // 4/4
addCard(Zone.BATTLEFIELD, playerB, "Akron Legionnaire"); // 8/4
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Myr Enforcer"); // 4/4
attack(2, playerB, "Akron Legionnaire");
attack(2, playerB, "Silvercoat Lion");
attack(2, playerB, "Myr Enforcer");
attack(3, playerA, "Silvercoat Lion");
attack(3, playerA, "Myr Enforcer");
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 8); // 8 + 4
assertLife(playerB, 14); // 4 + 2
}
}