mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
More failing tests based on bug reports
This commit is contained in:
parent
38eaef59e0
commit
519e136431
7 changed files with 194 additions and 35 deletions
|
|
@ -28,17 +28,17 @@
|
|||
|
||||
package mage.sets.magic2010;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public class HornedTurtle extends CardImpl<HornedTurtle>{
|
||||
public class HornedTurtle extends CardImpl<HornedTurtle> {
|
||||
|
||||
public HornedTurtle(UUID ownerId) {
|
||||
super(ownerId, 55, "Horned Turtle", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
|
||||
|
|
@ -46,7 +46,7 @@ public class HornedTurtle extends CardImpl<HornedTurtle>{
|
|||
this.color.setBlue(true);
|
||||
this.subtype.add("Turtle");
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
}
|
||||
|
||||
public HornedTurtle(final HornedTurtle card) {
|
||||
|
|
|
|||
|
|
@ -27,14 +27,7 @@
|
|||
*/
|
||||
package mage.sets.scarsofmirrodin;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.AttachmentType;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.PhaseStep;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.Constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -50,6 +43,8 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
|
|
@ -61,13 +56,15 @@ public class HeavyArbalest extends CardImpl<HeavyArbalest> {
|
|||
this.expansionSetCode = "SOM";
|
||||
this.subtype.add("Equipment");
|
||||
|
||||
// Equip {4}
|
||||
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(4)));
|
||||
|
||||
SimpleStaticAbility ability1 = new SimpleStaticAbility(Zone.BATTLEFIELD, new HeavyArbalestEffect());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability1, AttachmentType.EQUIPMENT)));
|
||||
|
||||
SimpleActivatedAbility ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new TapSourceCost());
|
||||
ability2.addTarget(new TargetCreatureOrPlayer());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability2, AttachmentType.EQUIPMENT)));
|
||||
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(4)));
|
||||
}
|
||||
|
||||
public HeavyArbalest(final HeavyArbalest card) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package org.mage.test.cards.abilities.equipped;
|
||||
|
||||
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 GolemSkinGauntletsTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests that creature will get +1/0 for each equipment
|
||||
*/
|
||||
@Test
|
||||
public void testBoostOnEquip() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 6);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Golem-Skin Gauntlets");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}", "Elite Vanguard");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
|
||||
Assert.assertTrue(eliteVanguard.getAttachments().size() == 2);
|
||||
Assert.assertEquals(4, eliteVanguard.getPower().getValue());
|
||||
Assert.assertEquals(1, eliteVanguard.getPower().getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package org.mage.test.cards.abilities.equipped;
|
||||
|
||||
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 HeavyArbalestTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests that creature with Heavy Arbalest will use it and won't untap
|
||||
*/
|
||||
@Test
|
||||
public void testNotUntapping() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Elves");
|
||||
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 2 damage", playerB);
|
||||
|
||||
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 18);
|
||||
|
||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
|
||||
Assert.assertTrue(eliteVanguard.getAttachments().size() > 0);
|
||||
Assert.assertTrue(eliteVanguard.isTapped());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that creature with Heavy Arbalest will use it and untap later
|
||||
*/
|
||||
@Test
|
||||
public void testUntapsLater() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Elves");
|
||||
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 2 damage", playerB);
|
||||
|
||||
setStopAt(5, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 18);
|
||||
|
||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
|
||||
Assert.assertTrue(eliteVanguard.getAttachments().size() > 0);
|
||||
Assert.assertFalse(eliteVanguard.isTapped());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package org.mage.test.cards.control;
|
||||
|
||||
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 BattlefieldTriggeredAbilitiesTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testBeguilerofWillsAndPrimevalTitan() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Primeval Titan");
|
||||
addCard(Constants.Zone.LIBRARY, playerA, "Mountain", 10);
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Beguiler of Wills");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Arrogant Bloodlord", 5);
|
||||
addCard(Constants.Zone.LIBRARY, playerB, "Mountain", 10);
|
||||
|
||||
activateAbility(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "{T}: Gain control", "Primeval Titan");
|
||||
attack(4, playerB, "Primeval Titan");
|
||||
|
||||
setStopAt(4, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 14);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerB, "Beguiler of Wills", 1);
|
||||
assertPermanentCount(playerB, "Arrogant Bloodlord", 5);
|
||||
assertPermanentCount(playerB, "Primeval Titan", 1);
|
||||
|
||||
// lands weren't added to playerA
|
||||
assertPermanentCount(playerA, "Mountain", 0);
|
||||
// but to playerB instead
|
||||
int playerACount = 0;
|
||||
int playerBCount = 0;
|
||||
for (Permanent p : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (p.getCardType().contains(Constants.CardType.LAND)) {
|
||||
if (p.getControllerId().equals(playerB.getId())) {
|
||||
playerBCount++;
|
||||
}
|
||||
if (p.getControllerId().equals(playerA.getId())) {
|
||||
playerACount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert.assertEquals(0, playerACount);
|
||||
Assert.assertEquals(2, playerBCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Contains tests for cards and game positions that causes some cards to change its controller.
|
||||
*/
|
||||
package org.mage.test.cards.control;
|
||||
|
|
@ -38,34 +38,33 @@ import mage.target.Target;
|
|||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class EquipAbility extends ActivatedAbilityImpl<EquipAbility> {
|
||||
|
||||
public EquipAbility(Outcome outcome, Cost cost) {
|
||||
this(outcome, cost, new TargetControlledCreaturePermanent());
|
||||
}
|
||||
|
||||
public EquipAbility(Outcome outcome, Cost cost, Target target) {
|
||||
super(Zone.BATTLEFIELD, new AttachEffect(outcome, "Equip"), cost);
|
||||
this.addTarget(target);
|
||||
this.timing = TimingRule.SORCERY;
|
||||
}
|
||||
|
||||
public EquipAbility(Outcome outcome, Cost cost) {
|
||||
this(outcome, cost, new TargetControlledCreaturePermanent());
|
||||
}
|
||||
|
||||
public EquipAbility(final EquipAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
public EquipAbility(Outcome outcome, Cost cost, Target target) {
|
||||
super(Zone.BATTLEFIELD, new AttachEffect(outcome, "Equip"), cost);
|
||||
this.addTarget(target);
|
||||
this.timing = TimingRule.SORCERY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipAbility copy() {
|
||||
return new EquipAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Equip " + costs.getText() + manaCosts.getText();
|
||||
}
|
||||
public EquipAbility(final EquipAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipAbility copy() {
|
||||
return new EquipAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Equip " + costs.getText() + manaCosts.getText();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue