mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
Add ChangesZoneAll trigger in GameAction
This commit is contained in:
@@ -852,7 +852,24 @@ public class GameAction {
|
||||
}
|
||||
|
||||
public final Card exile(final Card c, SpellAbility cause) {
|
||||
return exile(c, cause, null);
|
||||
if (c == null) {
|
||||
return null;
|
||||
}
|
||||
return exile(new CardCollection(c), cause).get(0);
|
||||
}
|
||||
public final CardCollection exile(final CardCollection cards, SpellAbility cause) {
|
||||
CardZoneTable table = new CardZoneTable();
|
||||
CardCollection result = new CardCollection();
|
||||
for (Card card : cards) {
|
||||
if (cause != null) {
|
||||
table.put(card.getZone().getZoneType(), ZoneType.Exile, card);
|
||||
}
|
||||
result.add(exile(card, cause, null));
|
||||
}
|
||||
if (cause != null) {
|
||||
table.triggerChangesZoneAll(game, cause);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public final Card exile(final Card c, SpellAbility cause, Map<AbilityKey, Object> params) {
|
||||
if (game.isCardExiled(c)) {
|
||||
|
||||
@@ -15,6 +15,8 @@ import forge.game.zone.PlayerZoneBattlefield;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class MeldEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
@@ -24,8 +26,6 @@ public class MeldEffect extends SpellAbilityEffect {
|
||||
Game game = hostCard.getGame();
|
||||
Player controller = sa.getActivatingPlayer();
|
||||
|
||||
Card primary = game.getAction().exile(hostCard, sa);
|
||||
|
||||
// a creature you control and own named secondary
|
||||
CardCollection field = CardLists.filter(
|
||||
controller.getCreaturesInPlay(),
|
||||
@@ -38,7 +38,10 @@ public class MeldEffect extends SpellAbilityEffect {
|
||||
|
||||
Card secondary = controller.getController().chooseSingleEntityForEffect(field, sa, Localizer.getInstance().getMessage("lblChooseCardToMeld"), null);
|
||||
|
||||
secondary = game.getAction().exile(secondary, sa);
|
||||
CardCollection exiled = new CardCollection(Arrays.asList(hostCard, secondary));
|
||||
exiled = game.getAction().exile(exiled, sa);
|
||||
Card primary = exiled.get(0);
|
||||
secondary = exiled.get(1);
|
||||
|
||||
// cards has wrong name in exile
|
||||
if (!primary.sharesNameWith(primName) || !secondary.sharesNameWith(secName)) {
|
||||
|
||||
Reference in New Issue
Block a user