mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Added Panglacial Wurm
This commit is contained in:
@@ -12,7 +12,9 @@ import forge.game.cost.Cost;
|
||||
import forge.game.mana.ManaCostBeingPaid;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.AbilitySub;
|
||||
import forge.game.spellability.Spell;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.SpellAbilityRestriction;
|
||||
import forge.game.spellability.SpellAbilityStackInstance;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Expressions;
|
||||
@@ -1484,4 +1486,24 @@ public class AbilityUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final List<SpellAbility> getBasicSpellsFromPlayEffect(final Card tgtCard, final Player controller) {
|
||||
List<SpellAbility> sas = new ArrayList<SpellAbility>();
|
||||
for (SpellAbility s : tgtCard.getBasicSpells()) {
|
||||
final Spell newSA = (Spell) s.copy();
|
||||
newSA.setActivatingPlayer(controller);
|
||||
SpellAbilityRestriction res = new SpellAbilityRestriction();
|
||||
// timing restrictions still apply
|
||||
res.setPlayerTurn(s.getRestrictions().getPlayerTurn());
|
||||
res.setOpponentTurn(s.getRestrictions().getOpponentTurn());
|
||||
res.setPhases(s.getRestrictions().getPhases());
|
||||
res.setZone(null);
|
||||
newSA.setRestrictions(res);
|
||||
// timing restrictions still apply
|
||||
if (res.checkTimingRestrictions(tgtCard, newSA) && newSA.checkOtherRestrictions()) {
|
||||
sas.add(newSA);
|
||||
}
|
||||
}
|
||||
return sas;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -677,23 +677,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined && changeType != null)
|
||||
fetchList = AbilityUtils.filterListByType(fetchList, sa.getParam("ChangeType"), sa);
|
||||
|
||||
if (searchedLibrary) {
|
||||
if (decider.equals(player)) {
|
||||
// should only count the number of searching player's own library
|
||||
decider.incLibrarySearched();
|
||||
}
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Player", decider);
|
||||
runParams.put("Target", Lists.newArrayList(player));
|
||||
decider.getGame().getTriggerHandler().runTrigger(TriggerType.SearchedLibrary, runParams, false);
|
||||
}
|
||||
|
||||
if (!defined) {
|
||||
if (origin.contains(ZoneType.Library) && !defined && !sa.hasParam("NoLooking") && !decider.hasKeyword("CantSearchLibrary")) {
|
||||
if (origin.contains(ZoneType.Library) && searchedLibrary) {
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
List<Card> shown = !decider.hasKeyword("LimitSearchLibrary") ? player.getCardsIn(ZoneType.Library) : player.getCardsIn(ZoneType.Library, fetchNum);
|
||||
// Look at whole library before moving onto choosing a card
|
||||
@@ -707,6 +693,37 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
|
||||
}
|
||||
|
||||
if (searchedLibrary) {
|
||||
if (decider.equals(player)) {
|
||||
// should only count the number of searching player's own library
|
||||
decider.incLibrarySearched();
|
||||
// Panglacial Wurm
|
||||
List<Card> canCastWhileSearching = CardLists.getKeyword(fetchList,
|
||||
"While you're searching your library, you may cast CARDNAME from your library.");
|
||||
for (final Card tgtCard : canCastWhileSearching) {
|
||||
List<SpellAbility> sas = AbilityUtils.getBasicSpellsFromPlayEffect(tgtCard, decider);
|
||||
if (sas.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
SpellAbility tgtSA = decider.getController().getAbilityToPlay(sas);
|
||||
if (!decider.getController().confirmAction(tgtSA, null, "Do you want to play " + tgtCard + "?")) {
|
||||
continue;
|
||||
}
|
||||
// if played, that card cannot be found
|
||||
if (decider.getController().playSaFromPlayEffect(tgtSA)) {
|
||||
fetchList.remove(tgtCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Player", decider);
|
||||
runParams.put("Target", Lists.newArrayList(player));
|
||||
decider.getGame().getTriggerHandler().runTrigger(TriggerType.SearchedLibrary, runParams, false);
|
||||
}
|
||||
|
||||
if (!defined && changeType != null)
|
||||
fetchList = AbilityUtils.filterListByType(fetchList, sa.getParam("ChangeType"), sa);
|
||||
|
||||
if (sa.hasParam("NoShuffle")) {
|
||||
shuffleMandatory = false;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.cost.Cost;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.Spell;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.SpellAbilityRestriction;
|
||||
import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.item.PaperCard;
|
||||
@@ -179,22 +177,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// get basic spells (no flashback, etc.)
|
||||
ArrayList<SpellAbility> sas = new ArrayList<SpellAbility>();
|
||||
for (SpellAbility s : tgtCard.getBasicSpells()) {
|
||||
final Spell newSA = (Spell) s.copy();
|
||||
newSA.setActivatingPlayer(controller);
|
||||
SpellAbilityRestriction res = new SpellAbilityRestriction();
|
||||
// timing restrictions still apply
|
||||
res.setPlayerTurn(s.getRestrictions().getPlayerTurn());
|
||||
res.setOpponentTurn(s.getRestrictions().getOpponentTurn());
|
||||
res.setPhases(s.getRestrictions().getPhases());
|
||||
res.setZone(null);
|
||||
newSA.setRestrictions(res);
|
||||
// timing restrictions still apply
|
||||
if (res.checkTimingRestrictions(tgtCard, newSA) && newSA.checkOtherRestrictions()) {
|
||||
sas.add(newSA);
|
||||
}
|
||||
}
|
||||
List<SpellAbility> sas = AbilityUtils.getBasicSpellsFromPlayEffect(tgtCard, controller);
|
||||
if (sas.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user