Merge pull request #4401 from rsypen/fix_tests_not_passing

Fixed failing tests
Fixed ItThatBetrays and Barrin, Master Wizard broken effects, added new test for Emrakul's annihilator trigger
This commit is contained in:
Oleg Agafonov 2018-01-12 13:55:44 +04:00 committed by GitHub
commit 1067881564
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 7 deletions

1
.gitignore vendored
View file

@ -46,6 +46,7 @@ Mage.Server.Plugins/Mage.Game.FreeForAll/target
Mage.Server.Plugins/Mage.Game.MomirDuel/target
Mage.Server.Plugins/Mage.Game.MomirGame/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.TwoPlayerDuel/target
Mage.Server.Plugins/Mage.Player.AI.DraftBot/target

View file

@ -29,7 +29,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EquippedMultipleSourceCondition;

View file

@ -38,6 +38,8 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetControlledPermanent;
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.
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());
this.addAbility(ability);
}

View file

@ -29,7 +29,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;

View file

@ -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);
}
}

View file

@ -33,6 +33,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -90,7 +91,7 @@ public class AnnihilatorAbility extends TriggeredAbilityImpl {
@Override
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>";
}
@ -123,9 +124,9 @@ class AnnihilatorEffect extends OneShotEffect {
player = game.getPlayer(defendingPlayerId);
}
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) {
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)) {
while (player.canRespond()
&& target.canChoose(player.getId(), game)

View file

@ -25,7 +25,7 @@
so remove this arg with update that fixes the problem
https://jira.codehaus.org/browse/MCOMPILER-209
-->
<useIncrementalCompilation>false</useIncrementalCompilation>
<useIncrementalCompilation>true</useIncrementalCompilation>
<!-- <compilerArgument>-Xlint:all</compilerArgument> -->
</configuration>
</plugin>