forked from External/mage
-setStrictChooseMode and assertAllCommandsUsed in every test
-store filter info in GameState -put instead of putIfAbsent
This commit is contained in:
parent
7c4d86f583
commit
1dc305f329
6 changed files with 42 additions and 32 deletions
|
|
@ -10,6 +10,7 @@ import mage.cards.Card;
|
|||
import mage.cards.SplitCard;
|
||||
import mage.constants.Zone;
|
||||
import mage.designations.Designation;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.combat.Combat;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.command.Command;
|
||||
|
|
@ -38,6 +39,8 @@ import java.io.Serializable;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* <p>
|
||||
|
|
@ -96,6 +99,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
|
||||
private Map<UUID, Card> copiedCards = new HashMap<>();
|
||||
private int permanentOrderNumber;
|
||||
private Map<UUID, FilterCreaturePermanent> usePowerInsteadOfToughnessForDamageLethalityFilters = new HashMap<>();
|
||||
|
||||
private int applyEffectsCounter; // Upcounting number of each applyEffects execution
|
||||
|
||||
|
|
@ -1209,4 +1213,15 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
return applyEffectsCounter;
|
||||
}
|
||||
|
||||
public void addPowerInsteadOfToughnessForDamageLethalityFilter(UUID source, FilterCreaturePermanent filter) {
|
||||
usePowerInsteadOfToughnessForDamageLethalityFilters.put(source, filter);
|
||||
}
|
||||
|
||||
public List<FilterCreaturePermanent> getActivePowerInsteadOfToughnessForDamageLethalityFilters() {
|
||||
return usePowerInsteadOfToughnessForDamageLethalityFilters.isEmpty() ? emptyList() : getBattlefield().getAllActivePermanents().stream()
|
||||
.map(Card::getId)
|
||||
.filter(usePowerInsteadOfToughnessForDamageLethalityFilters::containsKey)
|
||||
.map(usePowerInsteadOfToughnessForDamageLethalityFilters::get)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue