mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Card fixes (#2389)
* Fix AI check * Fix cards * Clean up --------- Co-authored-by: tool4EvEr <tool4EvEr@192.168.0.59>
This commit is contained in:
@@ -3161,4 +3161,14 @@ public class ComputerUtil {
|
||||
return remainingLife;
|
||||
}
|
||||
|
||||
public static boolean isETBprevented(Card c) {
|
||||
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(c);
|
||||
// don't need to bother with real LKI since this is a passive check and the card isn't going anywhere
|
||||
repParams.put(AbilityKey.CardLKI, c);
|
||||
repParams.put(AbilityKey.Origin, c.getZone().getZoneType());
|
||||
repParams.put(AbilityKey.Destination, ZoneType.Battlefield);
|
||||
List<ReplacementEffect> list = c.getGame().getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.CantHappen);
|
||||
return !list.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -673,10 +673,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (origin.equals("Graveyard")) {
|
||||
// return this card from graveyard: cards like Hammer of Bogardan
|
||||
// in general this is cool, but we should add some type of
|
||||
// restrictions
|
||||
// in general this is cool, but we should add some type of restrictions
|
||||
|
||||
// return this card from battlefield: cards like Blinking Spirit
|
||||
// in general this should only be used to protect from Imminent Harm
|
||||
@@ -713,6 +711,10 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
if (destination == ZoneType.Battlefield) {
|
||||
if (ComputerUtil.isETBprevented(retrieval.get(0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// predict whether something may put a ETBing creature below zero toughness
|
||||
// (e.g. Reassembing Skeleton + Elesh Norn, Grand Cenobite)
|
||||
for (final Card c : retrieval) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.ai.ability;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -11,7 +10,6 @@ import forge.ai.ComputerUtilCard;
|
||||
import forge.ai.ComputerUtilCost;
|
||||
import forge.ai.SpellAbilityAi;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardCollectionView;
|
||||
@@ -21,9 +19,6 @@ import forge.game.phase.PhaseHandler;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.player.PlayerActionConfirmMode;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
import forge.game.replacement.ReplacementLayer;
|
||||
import forge.game.replacement.ReplacementType;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.MyRandom;
|
||||
@@ -90,19 +85,13 @@ public class ManifestAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
static boolean shouldManyfest(final Card card, final Player ai, final SpellAbility sa) {
|
||||
final Game game = ai.getGame();
|
||||
// check to ensure that there are no replacement effects that prevent creatures ETBing from library
|
||||
// (e.g. Grafdigger's Cage)
|
||||
Card topCopy = CardUtil.getLKICopy(card);
|
||||
topCopy.turnFaceDownNoUpdate();
|
||||
topCopy.setManifested(true);
|
||||
|
||||
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(topCopy);
|
||||
repParams.put(AbilityKey.Origin, card.getZone().getZoneType());
|
||||
repParams.put(AbilityKey.Destination, ZoneType.Battlefield);
|
||||
repParams.put(AbilityKey.Source, sa.getHostCard());
|
||||
List<ReplacementEffect> list = game.getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.CantHappen);
|
||||
if (!list.isEmpty()) {
|
||||
if (ComputerUtil.isETBprevented(topCopy)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user