mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Manifest: fixed check with worms of the earth
This commit is contained in:
@@ -268,6 +268,10 @@ public class GameAction {
|
||||
// if something would only be a land when entering the battlefield and not before
|
||||
// put it into the graveyard instead
|
||||
zoneTo = c.getOwner().getZone(ZoneType.Graveyard);
|
||||
// reset facedown
|
||||
copied.setState(CardStateName.Original, false);
|
||||
copied.setManifested(false);
|
||||
copied.updateStateForView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,9 +167,9 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
|
||||
Card movedCard = null;
|
||||
if (sa.hasParam("GainControl")) {
|
||||
c.setController(sa.getActivatingPlayer(), game.getNextTimestamp());
|
||||
movedCard = game.getAction().moveToPlay(c, sa.getActivatingPlayer(), null);
|
||||
movedCard = game.getAction().moveToPlay(c, sa.getActivatingPlayer(), sa);
|
||||
} else {
|
||||
movedCard = game.getAction().moveTo(destination, c, libraryPos, null);
|
||||
movedCard = game.getAction().moveTo(destination, c, libraryPos, sa);
|
||||
if (destination == ZoneType.Exile && !c.isToken()) {
|
||||
Card host = sa.getOriginalHost();
|
||||
if (host == null) {
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import forge.card.CardStateName;
|
||||
import forge.game.Game;
|
||||
import forge.game.GlobalRuleChange;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
public class ManifestEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
final Card source = sa.getHostCard();
|
||||
final Game game = source.getGame();
|
||||
// Usually a number leaving possibility for X, Sacrifice X land: Manifest X creatures.
|
||||
final int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(sa.getHostCard(),
|
||||
final int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(source,
|
||||
sa.getParam("Amount"), sa) : 1;
|
||||
// Most commonly "defined" is Top of Library
|
||||
final String defined = sa.hasParam("Defined") ? sa.getParam("Defined") : "TopOfLibrary";
|
||||
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
for (final Player p : getTargetPlayers(sa, "DefinedPlayer")) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
if (sa.usesTargeting() || p.canBeTargetedBy(sa)) {
|
||||
CardCollection tgtCards;
|
||||
if ("TopOfLibrary".equals(defined)) {
|
||||
tgtCards = p.getTopXCardsFromLibrary(amount);
|
||||
@@ -34,6 +40,18 @@ public class ManifestEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
for(Card c : tgtCards) {
|
||||
//check if lki would be a land entering the battlefield
|
||||
if (game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLandBattlefield)) {
|
||||
Card lki = CardUtil.getLKICopy(c);
|
||||
lki.setState(CardStateName.FaceDown, false);
|
||||
lki.setManifested(true);
|
||||
lki.setLastKnownZone(p.getZone(ZoneType.Battlefield));
|
||||
CardCollection preList = new CardCollection(lki);
|
||||
game.getAction().checkStaticAbilities(false, Sets.newHashSet(lki), preList);
|
||||
if (lki.isLand()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Card rem = c.manifest(p, sa);
|
||||
if (sa.hasParam("RememberManifested") && rem != null) {
|
||||
source.addRemembered(rem);
|
||||
|
||||
Reference in New Issue
Block a user