mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix and cleanup Hideaway. Plus a typo in Praetor's Grasp.
This commit is contained in:
@@ -52,6 +52,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
String effectRemembered = null;
|
||||
String effectImprinted = null;
|
||||
Player ownerEff = null;
|
||||
boolean imprintOnHost = false;
|
||||
|
||||
if (sa.hasParam("Abilities")) {
|
||||
effectAbilities = sa.getParam("Abilities").split(",");
|
||||
@@ -85,7 +86,6 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
effectImprinted = sa.getParam("ImprintCards");
|
||||
}
|
||||
|
||||
// Effect eff = new Effect();
|
||||
String name = sa.getParam("Name");
|
||||
if (name == null) {
|
||||
name = sa.getHostCard().getName() + "'s Effect";
|
||||
@@ -97,10 +97,14 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (sa.hasParam("EffectOwner")) {
|
||||
List<Player> effectOwner = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("EffectOwner"), sa);
|
||||
final List<Player> effectOwner = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("EffectOwner"), sa);
|
||||
ownerEff = effectOwner.get(0);
|
||||
}
|
||||
|
||||
if (sa.hasParam("ImprintOnHost")) {
|
||||
imprintOnHost = true;
|
||||
}
|
||||
|
||||
final Player controller = sa.hasParam("EffectOwner") ? ownerEff : sa.getActivatingPlayer();
|
||||
final Card eff = new Card(controller.getGame().nextCardId());
|
||||
eff.setName(name);
|
||||
@@ -112,8 +116,6 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
eff.setImmutable(true);
|
||||
eff.setEffectSource(hostCard);
|
||||
|
||||
final Card e = eff;
|
||||
|
||||
// Grant SVars first in order to give references to granted abilities
|
||||
if (effectSVars != null) {
|
||||
for (final String s : effectSVars) {
|
||||
@@ -211,7 +213,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
game.getAction().exile(e);
|
||||
game.getAction().exile(eff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -233,6 +235,10 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (imprintOnHost) {
|
||||
hostCard.addImprintedCard(eff);
|
||||
}
|
||||
|
||||
// TODO: Add targeting to the effect so it knows who it's dealing with
|
||||
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
|
||||
game.getAction().moveTo(ZoneType.Command, eff);
|
||||
|
||||
@@ -2613,6 +2613,23 @@ public class CardFactoryUtil {
|
||||
card.addSpellAbility(bestow);
|
||||
card.getCurrentState().addUnparsedAbility(sbAttach.toString());
|
||||
}
|
||||
else if (keyword.equals("Hideaway")) {
|
||||
card.getCurrentState().addIntrinsicKeyword("CARDNAME enters the battlefield tapped.");
|
||||
|
||||
final Trigger hideawayTrigger = TriggerHandler.parseTrigger("Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigHideawayDig | TriggerDescription$ When CARDNAME enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.", card, true);
|
||||
card.addTrigger(hideawayTrigger);
|
||||
card.setSVar("TrigHideawayDig", "DB$ Dig | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True | SubAbility$ DBHideawayEffect");
|
||||
final Trigger gainControlTrigger = TriggerHandler.parseTrigger("Mode$ ChangesController | ValidCard$ Card.Self | Execute$ DBHideawayEffect | Static$ True", card, true);
|
||||
card.addTrigger(gainControlTrigger);
|
||||
card.setSVar("DBHideawayEffect", "DB$ Effect | StaticAbilities$ STHideawayEffectLookAtCard | Triggers$ THideawayEffectCleanup | SVars$ DBHideawayEffectExileSelf | ImprintOnHost$ True | SubAbility$ DBHideawayRemember");
|
||||
card.setSVar("STHideawayEffectLookAtCard", "Mode$ Continuous | Affected$ Card.IsRemembered | MayLookAt$ True | EffectZone$ Command | AffectedZone$ Exile | Description$ You may look at the exiled card.");
|
||||
card.setSVar("THideawayEffectCleanup", "Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Exile | Destination$ Any | TriggerZone$ Command | Execute$ DBHideawayEffectExileSelf | Static$ True");
|
||||
card.setSVar("DBHideawayEffectExileSelf", "DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile");
|
||||
final Trigger changeZoneTrigger = TriggerHandler.parseTrigger("Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Exile | Destination$ Any | TriggerZone$ Command | Execute$ DBHideawayCleanup | Static$ True", card, true);
|
||||
card.addTrigger(changeZoneTrigger);
|
||||
card.setSVar("DBHideawayRemember", "DB$ Animate | Defined$ Imprinted | RememberObjects$ Remembered | Permanent$ True");
|
||||
card.setSVar("DBHideawayCleanup", "DB$ Cleanup | ClearRemembered$ True");
|
||||
}
|
||||
}
|
||||
|
||||
// AddCost
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.game.trigger.ZCTrigger;
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PlayerZoneBattlefield extends PlayerZone {
|
||||
@@ -53,20 +54,13 @@ public class PlayerZoneBattlefield extends PlayerZone {
|
||||
super.add(c, position);
|
||||
|
||||
if (trigger) {
|
||||
if (c.hasKeyword("Hideaway")) {
|
||||
// it enters the battlefield this way, and should not fire
|
||||
// triggers
|
||||
c.setTapped(true);
|
||||
}
|
||||
else {
|
||||
// ETBTapped static abilities
|
||||
for (final Card ca : game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("ETBTapped", c)) {
|
||||
// it enters the battlefield this way, and should
|
||||
// not fire triggers
|
||||
c.setTapped(true);
|
||||
}
|
||||
// ETBTapped static abilities
|
||||
for (final Card ca : game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("ETBTapped", c)) {
|
||||
// it enters the battlefield this way, and should
|
||||
// not fire triggers
|
||||
c.setTapped(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user