forked from External/mage
Fixed ItThatBetrays and Barrin, Master Wizard broken effects, added new test for Emrakul's annihilator trigger
This commit is contained in:
parent
b353a25f57
commit
88527987cc
7 changed files with 46 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -46,6 +46,7 @@ Mage.Server.Plugins/Mage.Game.FreeForAll/target
|
||||||
Mage.Server.Plugins/Mage.Game.MomirDuel/target
|
Mage.Server.Plugins/Mage.Game.MomirDuel/target
|
||||||
Mage.Server.Plugins/Mage.Game.MomirGame/target/
|
Mage.Server.Plugins/Mage.Game.MomirGame/target/
|
||||||
Mage.Server.Plugins/Mage.Game.PennyDreadfulCommanderFreeForAll/target
|
Mage.Server.Plugins/Mage.Game.PennyDreadfulCommanderFreeForAll/target
|
||||||
|
Mage.Server.Plugins/Mage.Game.FreeformCommanderFreeForAll/target/
|
||||||
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/target
|
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/target
|
||||||
Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target
|
Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target
|
||||||
Mage.Server.Plugins/Mage.Player.AI.DraftBot/target
|
Mage.Server.Plugins/Mage.Player.AI.DraftBot/target
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ package mage.cards.b;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.common.EquippedMultipleSourceCondition;
|
import mage.abilities.condition.common.EquippedMultipleSourceCondition;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.SuperType;
|
import mage.constants.SuperType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
|
@ -59,7 +61,7 @@ public class BarrinMasterWizard extends CardImpl {
|
||||||
|
|
||||||
//{2}, Sacrifice a permanent: Return target creature to its owner's hand.
|
//{2}, Sacrifice a permanent: Return target creature to its owner's hand.
|
||||||
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{2}"));
|
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{2}"));
|
||||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent()));
|
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledPermanent())));
|
||||||
ability.addTarget(new TargetCreaturePermanent());
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ package mage.cards.b;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package org.mage.test.cards.abilities.keywords;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
public class AnnihilatorTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCardsSacrificedToAnnihilatorTrigger() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||||
|
|
||||||
|
// Annihilator 6 (Whenever this creature attacks, defending player sacrifices two permanents.)
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Emrakul, the Aeons Torn");
|
||||||
|
|
||||||
|
attack(2, playerB, "Emrakul, the Aeons Torn");
|
||||||
|
setChoice(playerA, "Island");
|
||||||
|
setChoice(playerA, "Island");
|
||||||
|
setChoice(playerA, "Island");
|
||||||
|
setChoice(playerA, "Mountain");
|
||||||
|
setChoice(playerA, "Mountain");
|
||||||
|
setChoice(playerA, "Mountain");
|
||||||
|
|
||||||
|
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 5);
|
||||||
|
assertPermanentCount(playerA, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -33,6 +33,7 @@ import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
|
@ -90,7 +91,7 @@ public class AnnihilatorAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Annihilator " + count + "<i>(Whenever this creature attacks, defending player sacrifices "
|
return "Annihilator " + count + " <i>(Whenever this creature attacks, defending player sacrifices "
|
||||||
+ (count == 1 ? "a permanent" : CardUtil.numberToText(count) + " permanents") + ".)</i>";
|
+ (count == 1 ? "a permanent" : CardUtil.numberToText(count) + " permanents") + ".)</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,9 +124,9 @@ class AnnihilatorEffect extends OneShotEffect {
|
||||||
player = game.getPlayer(defendingPlayerId);
|
player = game.getPlayer(defendingPlayerId);
|
||||||
}
|
}
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int amount = Math.min(count, game.getBattlefield().countAll(StaticFilters.FILTER_CONTROLLED_PERMANENT, player.getId(), game));
|
int amount = Math.min(count, game.getBattlefield().countAll(new FilterControlledPermanent(), player.getId(), game));
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
Target target = new TargetControlledPermanent(amount, amount, StaticFilters.FILTER_CONTROLLED_PERMANENT, true);
|
Target target = new TargetControlledPermanent(amount, amount, new FilterControlledPermanent(), true);
|
||||||
if (target.canChoose(player.getId(), game)) {
|
if (target.canChoose(player.getId(), game)) {
|
||||||
while (player.canRespond()
|
while (player.canRespond()
|
||||||
&& target.canChoose(player.getId(), game)
|
&& target.canChoose(player.getId(), game)
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -25,7 +25,7 @@
|
||||||
so remove this arg with update that fixes the problem
|
so remove this arg with update that fixes the problem
|
||||||
https://jira.codehaus.org/browse/MCOMPILER-209
|
https://jira.codehaus.org/browse/MCOMPILER-209
|
||||||
-->
|
-->
|
||||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
<useIncrementalCompilation>true</useIncrementalCompilation>
|
||||||
<!-- <compilerArgument>-Xlint:all</compilerArgument> -->
|
<!-- <compilerArgument>-Xlint:all</compilerArgument> -->
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue