From 052fb655186e3f1e0382c82b453690d57b6e725b Mon Sep 17 00:00:00 2001 From: Hanmac Date: Wed, 10 Jan 2018 07:30:03 +0100 Subject: [PATCH] CardFactoryUtil: add Ascend for non-permanent Spell --- .../main/java/forge/game/ability/SpellApiBased.java | 10 ++++++++++ forge-game/src/main/java/forge/game/card/Card.java | 5 ++--- .../src/main/java/forge/game/card/CardFactoryUtil.java | 5 +++++ .../java/forge/game/spellability/SpellAbility.java | 8 ++++++++ .../upcoming/secrets_of_the_golden_city.txt | 8 ++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 forge-gui/res/cardsfolder/upcoming/secrets_of_the_golden_city.txt diff --git a/forge-game/src/main/java/forge/game/ability/SpellApiBased.java b/forge-game/src/main/java/forge/game/ability/SpellApiBased.java index d96401336a4..ad35740db66 100644 --- a/forge-game/src/main/java/forge/game/ability/SpellApiBased.java +++ b/forge-game/src/main/java/forge/game/ability/SpellApiBased.java @@ -8,9 +8,11 @@ import forge.game.ability.effects.ManaEffect; import forge.game.ability.effects.ManaReflectedEffect; import forge.game.card.Card; import forge.game.cost.Cost; +import forge.game.player.Player; import forge.game.spellability.AbilityManaPart; import forge.game.spellability.Spell; import forge.game.spellability.TargetRestrictions; +import forge.game.zone.ZoneType; public class SpellApiBased extends Spell { private static final long serialVersionUID = -6741797239508483250L; @@ -52,6 +54,14 @@ public class SpellApiBased extends Spell { */ @Override public void resolve() { + + if (isBlessing() && !getHostCard().isPermanent()) { + Player pl = this.getActivatingPlayer(); + if (pl != null && pl.getZone(ZoneType.Battlefield).size() >= 10) { + pl.setBlessing(true); + } + } + effect.resolve(this); getActivatingPlayer().getAchievementTracker().onSpellResolve(this); } diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index eb37ae05fe1..26c487ab31c 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -2084,8 +2084,6 @@ public class Card extends GameEntity implements Comparable { sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); } sb.append("Convoke (Your creatures can help cast this spell. Each creature you tap while casting this spell pays for {1} or one mana of that creature's color.)\r\n"); - } else if (keyword.equals("Improvise")) { - sb.append(Keyword.IMPROVISE.getDescription()).append("\r\n"); } else if (keyword.equals("Delve")) { if (sb.toString().endsWith("\r\n\r\n")) { sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); @@ -2107,7 +2105,8 @@ public class Card extends GameEntity implements Comparable { sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); } sb.append("Remove CARDNAME from your deck before playing if you're not playing for ante.\r\n"); - } else if (keyword.equals("Retrace") || keyword.equals("Changeling")) { + } else if (keyword.equals("Ascend") || keyword.equals("Changeling") + || keyword.equals("Improvise") || keyword.equals("Retrace")) { sb.append(keyword + " (" + inst.getReminderText() + ")"); } else if (keyword.startsWith("Presence")) { sb.append(inst.getReminderText()); diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index e3072404e1e..f92b88c2947 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -2108,6 +2108,11 @@ public class CardFactoryUtil { trigger.setOverridingAbility(AbilityFactory.getAbility(effect, card)); inst.addTrigger(trigger); + } else { + SpellAbility sa = card.getFirstSpellAbility(); + if (sa != null && sa.isSpell()) { + sa.setBlessing(true); + } } } else if (keyword.startsWith("Bushido")) { final String[] k = keyword.split(" ", 2); diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java index 14e90eda2f1..8fed0f8fa35 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java @@ -103,6 +103,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit private boolean manifestUp = false; private boolean cumulativeupkeep = false; private boolean outlast = false; + private boolean blessing = false; private SplitSide splitSide = null; enum SplitSide { LEFT, RIGHT }; private int totalManaSpent = 0; @@ -757,6 +758,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit outlast = outlast0; } + public boolean isBlessing() { + return blessing; + } + public void setBlessing(boolean blessing0) { + blessing = blessing0; + } + public StaticAbility getMayPlay() { return mayPlay; } diff --git a/forge-gui/res/cardsfolder/upcoming/secrets_of_the_golden_city.txt b/forge-gui/res/cardsfolder/upcoming/secrets_of_the_golden_city.txt new file mode 100644 index 00000000000..476fe0bb7ca --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/secrets_of_the_golden_city.txt @@ -0,0 +1,8 @@ +Name:Secrets of the Golden City +ManaCost:1 U U +Types:Sorcery +K:Ascend +A:SP$ Draw | Cost$ 1 U U | NumCards$ X | References$ X | StackDescription$ SpellDescription | SpellDescription$ Draw two cards. If you have the city's blessing, draw three cards instead. +SVar:X:Count$Blessing.3.2 +SVar:Picture:http://www.wizards.com/global/images/magic/general/secrets_of_the_golden_city.jpg +Oracle:Ascend (If you control ten or more permanents, you get the city's blessing for the rest of the game.)\nDraw two cards. If you have the city's blessing, draw three cards instead.