Update AiController.java (#5863)

* Update AiController.java

Add RepParams for AddCounter

* Update check with new required params

---------

Co-authored-by: TRT <>
This commit is contained in:
Hans Mackowiak
2024-08-07 07:17:46 +02:00
committed by GitHub
parent e978c65d35
commit 0b1acbd71d
2 changed files with 12 additions and 0 deletions

View File

@@ -529,6 +529,12 @@ public class AiController {
repParams.put(AbilityKey.Destination, ZoneType.Battlefield); repParams.put(AbilityKey.Destination, ZoneType.Battlefield);
repParams.put(AbilityKey.Source, land); repParams.put(AbilityKey.Source, land);
// add Params for AddCounter Replacements
GameEntityCounterTable table = new GameEntityCounterTable();
repParams.put(AbilityKey.EffectOnly, true);
repParams.put(AbilityKey.CounterTable, table);
repParams.put(AbilityKey.CounterMap, table.column(land));
boolean foundTapped = false; boolean foundTapped = false;
for (ReplacementEffect re : player.getGame().getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.Other)) { for (ReplacementEffect re : player.getGame().getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.Other)) {
SpellAbility reSA = re.ensureAbility(); SpellAbility reSA = re.ensureAbility();

View File

@@ -39,6 +39,7 @@ import forge.game.CardTraitPredicates;
import forge.game.Game; import forge.game.Game;
import forge.game.GameActionUtil; import forge.game.GameActionUtil;
import forge.game.GameEntity; import forge.game.GameEntity;
import forge.game.GameEntityCounterTable;
import forge.game.GameObject; import forge.game.GameObject;
import forge.game.GameType; import forge.game.GameType;
import forge.game.ability.AbilityKey; import forge.game.ability.AbilityKey;
@@ -3307,6 +3308,11 @@ public class ComputerUtil {
repParams.put(AbilityKey.CardLKI, c); repParams.put(AbilityKey.CardLKI, c);
repParams.put(AbilityKey.Origin, c.getLastKnownZone().getZoneType()); repParams.put(AbilityKey.Origin, c.getLastKnownZone().getZoneType());
repParams.put(AbilityKey.Destination, ZoneType.Battlefield); repParams.put(AbilityKey.Destination, ZoneType.Battlefield);
// add Params for AddCounter Replacements
GameEntityCounterTable table = new GameEntityCounterTable();
repParams.put(AbilityKey.EffectOnly, true);
repParams.put(AbilityKey.CounterTable, table);
repParams.put(AbilityKey.CounterMap, table.column(c));
List<ReplacementEffect> list = c.getGame().getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.CantHappen); List<ReplacementEffect> list = c.getGame().getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.CantHappen);
return !list.isEmpty(); return !list.isEmpty();
} }