mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Added possibility to choose resolve order of triggered abilities for tests.
This commit is contained in:
parent
17d824ca19
commit
7b28b6a545
2 changed files with 17 additions and 3 deletions
|
|
@ -56,6 +56,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.Modes;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.filter.common.FilterCreatureForCombatBlock;
|
||||
import mage.filter.common.FilterPlaneswalkerPermanent;
|
||||
import mage.game.stack.StackObject;
|
||||
|
|
@ -288,7 +289,20 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
return super.chooseTarget(outcome, target, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public TriggeredAbility chooseTriggeredAbility(List<TriggeredAbility> abilities, Game game) {
|
||||
if (!choices.isEmpty()) {
|
||||
for(TriggeredAbility ability :abilities) {
|
||||
if (choices.get(0).equals(ability.toString())) {
|
||||
choices.remove(0);
|
||||
return ability;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.chooseTriggeredAbility(abilities, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean chooseUse(Outcome outcome, String message, Game game) {
|
||||
if (!choices.isEmpty()) {
|
||||
if (choices.get(0).equals("No")) {
|
||||
|
|
@ -315,7 +329,7 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
if (groups.length > 2 && groups[2].startsWith("spellOnStack=")) {
|
||||
String spellOnStack = groups[2].substring(13);
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
if (stackObject.getName().equals(spellOnStack)) {
|
||||
if (stackObject.getStackAbility().toString().equals(spellOnStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
/**
|
||||
* Spell will only be cast, if a spell with the given name is already on the stack
|
||||
* Spell will only be cast, if a spell / ability with the given name is on the stack
|
||||
*
|
||||
* @param turnNum
|
||||
* @param step
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue