mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
[AVR] Favorable Winds + tests
This commit is contained in:
parent
933f094f69
commit
6cd04e3380
2 changed files with 194 additions and 0 deletions
71
Mage.Sets/src/mage/sets/avacynrestored/FavorableWinds.java
Normal file
71
Mage.Sets/src/mage/sets/avacynrestored/FavorableWinds.java
Normal 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 mage.sets.avacynrestored;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continious.BoostControlledEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class FavorableWinds extends CardImpl<FavorableWinds> {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control with flying");
|
||||
|
||||
static {
|
||||
filter.getAbilities().add(FlyingAbility.getInstance());
|
||||
}
|
||||
|
||||
public FavorableWinds(UUID ownerId) {
|
||||
super(ownerId, 51, "Favorable Winds", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
this.expansionSetCode = "AVR";
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Creatures you control with flying get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Constants.Duration.WhileOnBattlefield, filter, false)));
|
||||
}
|
||||
|
||||
public FavorableWinds(final FavorableWinds card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FavorableWinds copy() {
|
||||
return new FavorableWinds(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package org.mage.test.cards.continuous;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class FavorableWindsTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests that "Favorable Winds" boost only flying creatures and only on controller's side
|
||||
*/
|
||||
@Test
|
||||
public void testBoostForFlyingCreatures() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Favorable Winds", 1);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Merfolk Looter", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sky Spirit", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Merfolk Looter", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Sky Spirit", 2);
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
int countSkySpirit = 0;
|
||||
int countMerfolkLooter = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
|
||||
if (permanent.getName().equals("Sky Spirit")) {
|
||||
countSkySpirit++;
|
||||
// should get +1/+1, original is 2/2
|
||||
Assert.assertEquals("Power is not the same", 3, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 3, permanent.getToughness().getValue());
|
||||
} else if (permanent.getName().equals("Merfolk Looter")) {
|
||||
countMerfolkLooter++;
|
||||
// should NOT get +1/+1, original is 1/1
|
||||
Assert.assertEquals("Power is not the same", 1, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 1, permanent.getToughness().getValue());
|
||||
}
|
||||
}
|
||||
Assert.assertEquals(2, countSkySpirit);
|
||||
Assert.assertEquals(2, countMerfolkLooter);
|
||||
|
||||
countSkySpirit = 0;
|
||||
countMerfolkLooter = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerB.getId())) {
|
||||
if (permanent.getName().equals("Sky Spirit")) {
|
||||
countSkySpirit++;
|
||||
// should NOT +1/+1, original is 2/2
|
||||
Assert.assertEquals("Power is not the same", 2, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 2, permanent.getToughness().getValue());
|
||||
} else if (permanent.getName().equals("Merfolk Looter")) {
|
||||
countMerfolkLooter++;
|
||||
// should NOT get +1/+1, original is 1/1
|
||||
Assert.assertEquals("Power is not the same", 1, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 1, permanent.getToughness().getValue());
|
||||
}
|
||||
}
|
||||
Assert.assertEquals(2, countSkySpirit);
|
||||
Assert.assertEquals(2, countMerfolkLooter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests effect from several "Favorable Winds" cards
|
||||
*/
|
||||
@Test
|
||||
public void testMultiBoostForFlyingCreatures() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Favorable Winds", 3);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Merfolk Looter", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sky Spirit", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Merfolk Looter", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Sky Spirit", 2);
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
int countSkySpirit = 0;
|
||||
int countMerfolkLooter = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
|
||||
if (permanent.getName().equals("Sky Spirit")) {
|
||||
countSkySpirit++;
|
||||
// should get +1/+1, original is 2/2
|
||||
Assert.assertEquals("Power is not the same", 5, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 5, permanent.getToughness().getValue());
|
||||
} else if (permanent.getName().equals("Merfolk Looter")) {
|
||||
countMerfolkLooter++;
|
||||
// should NOT get +1/+1, original is 1/1
|
||||
Assert.assertEquals("Power is not the same", 1, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 1, permanent.getToughness().getValue());
|
||||
}
|
||||
}
|
||||
Assert.assertEquals(2, countSkySpirit);
|
||||
Assert.assertEquals(2, countMerfolkLooter);
|
||||
|
||||
countSkySpirit = 0;
|
||||
countMerfolkLooter = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerB.getId())) {
|
||||
if (permanent.getName().equals("Sky Spirit")) {
|
||||
countSkySpirit++;
|
||||
// should NOT +1/+1, original is 2/2
|
||||
Assert.assertEquals("Power is not the same", 2, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 2, permanent.getToughness().getValue());
|
||||
} else if (permanent.getName().equals("Merfolk Looter")) {
|
||||
countMerfolkLooter++;
|
||||
// should NOT get +1/+1, original is 1/1
|
||||
Assert.assertEquals("Power is not the same", 1, permanent.getPower().getValue());
|
||||
Assert.assertEquals("Toughness is not the same", 1, permanent.getToughness().getValue());
|
||||
}
|
||||
}
|
||||
Assert.assertEquals(2, countSkySpirit);
|
||||
Assert.assertEquals(2, countMerfolkLooter);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue