* Added logic to add permitting object to play/cast events.

This commit is contained in:
LevelX2 2018-05-27 23:47:57 +02:00
parent b97a443a37
commit 27ced167fb
124 changed files with 1095 additions and 964 deletions

View file

@ -39,6 +39,8 @@ public class FiendOfTheShadowsTest extends CardTestPlayerBase {
@Test
public void testCardExile1() {
// Whenever Fiend of the Shadows deals combat damage to a player, that player exiles a card from their hand. You may play that card for as long as it remains exiled.
// Sacrifice a Human: Regenerate Fiend of the Shadows.
addCard(Zone.BATTLEFIELD, playerA, "Fiend of the Shadows");
removeAllCardsFromHand(playerB);
addCard(Zone.HAND, playerB, "Swamp");

View file

@ -495,7 +495,7 @@ public class TestPlayer implements Player {
List<Permanent> manaPermsWithCost = computerPlayer.getAvailableManaProducersWithCost(game);
for (Permanent perm : manaPermsWithCost) {
for (ActivatedManaAbilityImpl manaAbility : perm.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, game)) {
if (manaAbility.toString().startsWith(groups[0]) && manaAbility.canActivate(computerPlayer.getId(), game)) {
if (manaAbility.toString().startsWith(groups[0]) && manaAbility.canActivate(computerPlayer.getId(), game).canActivate()) {
Ability newManaAbility = manaAbility.copy();
computerPlayer.activateAbility((ActivatedAbility) newManaAbility, game);
actions.remove(action);
@ -1598,13 +1598,13 @@ public class TestPlayer implements Player {
}
@Override
public boolean cast(SpellAbility ability, Game game, boolean noMana) {
return computerPlayer.cast(ability, game, noMana);
public boolean cast(SpellAbility ability, Game game, boolean noMana, MageObjectReference reference) {
return computerPlayer.cast(ability, game, noMana, reference);
}
@Override
public boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming) {
return computerPlayer.playCard(card, game, noMana, ignoreTiming);
public boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, MageObjectReference reference) {
return computerPlayer.playCard(card, game, noMana, ignoreTiming, reference);
}
@Override

View file

@ -30,6 +30,7 @@ package org.mage.test.stub;
import java.io.Serializable;
import java.util.*;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.*;
import mage.abilities.costs.AlternativeSourceCosts;
import mage.abilities.costs.Cost;
@ -564,7 +565,7 @@ public class PlayerStub implements Player {
}
@Override
public boolean cast(SpellAbility ability, Game game, boolean noMana) {
public boolean cast(SpellAbility ability, Game game, boolean noMana, MageObjectReference reference) {
return false;
}
@ -619,7 +620,7 @@ public class PlayerStub implements Player {
}
@Override
public boolean playCard(Card card, Game game, boolean noMana, boolean checkTiming) {
public boolean playCard(Card card, Game game, boolean noMana, boolean checkTiming, MageObjectReference reference) {
return false;
}