CardFactoryUtil: add Ascend for non-permanent Spell

This commit is contained in:
Hanmac
2018-01-10 07:30:03 +01:00
parent 941e25d7a7
commit 052fb65518
5 changed files with 33 additions and 3 deletions

View File

@@ -8,9 +8,11 @@ import forge.game.ability.effects.ManaEffect;
import forge.game.ability.effects.ManaReflectedEffect; import forge.game.ability.effects.ManaReflectedEffect;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.cost.Cost; import forge.game.cost.Cost;
import forge.game.player.Player;
import forge.game.spellability.AbilityManaPart; import forge.game.spellability.AbilityManaPart;
import forge.game.spellability.Spell; import forge.game.spellability.Spell;
import forge.game.spellability.TargetRestrictions; import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
public class SpellApiBased extends Spell { public class SpellApiBased extends Spell {
private static final long serialVersionUID = -6741797239508483250L; private static final long serialVersionUID = -6741797239508483250L;
@@ -52,6 +54,14 @@ public class SpellApiBased extends Spell {
*/ */
@Override @Override
public void resolve() { 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); effect.resolve(this);
getActivatingPlayer().getAchievementTracker().onSpellResolve(this); getActivatingPlayer().getAchievementTracker().onSpellResolve(this);
} }

View File

@@ -2084,8 +2084,6 @@ public class Card extends GameEntity implements Comparable<Card> {
sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); 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"); 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")) { } else if (keyword.equals("Delve")) {
if (sb.toString().endsWith("\r\n\r\n")) { if (sb.toString().endsWith("\r\n\r\n")) {
sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3);
@@ -2107,7 +2105,8 @@ public class Card extends GameEntity implements Comparable<Card> {
sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); 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"); 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() + ")"); sb.append(keyword + " (" + inst.getReminderText() + ")");
} else if (keyword.startsWith("Presence")) { } else if (keyword.startsWith("Presence")) {
sb.append(inst.getReminderText()); sb.append(inst.getReminderText());

View File

@@ -2108,6 +2108,11 @@ public class CardFactoryUtil {
trigger.setOverridingAbility(AbilityFactory.getAbility(effect, card)); trigger.setOverridingAbility(AbilityFactory.getAbility(effect, card));
inst.addTrigger(trigger); inst.addTrigger(trigger);
} else {
SpellAbility sa = card.getFirstSpellAbility();
if (sa != null && sa.isSpell()) {
sa.setBlessing(true);
}
} }
} else if (keyword.startsWith("Bushido")) { } else if (keyword.startsWith("Bushido")) {
final String[] k = keyword.split(" ", 2); final String[] k = keyword.split(" ", 2);

View File

@@ -103,6 +103,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
private boolean manifestUp = false; private boolean manifestUp = false;
private boolean cumulativeupkeep = false; private boolean cumulativeupkeep = false;
private boolean outlast = false; private boolean outlast = false;
private boolean blessing = false;
private SplitSide splitSide = null; private SplitSide splitSide = null;
enum SplitSide { LEFT, RIGHT }; enum SplitSide { LEFT, RIGHT };
private int totalManaSpent = 0; private int totalManaSpent = 0;
@@ -757,6 +758,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
outlast = outlast0; outlast = outlast0;
} }
public boolean isBlessing() {
return blessing;
}
public void setBlessing(boolean blessing0) {
blessing = blessing0;
}
public StaticAbility getMayPlay() { public StaticAbility getMayPlay() {
return mayPlay; return mayPlay;
} }

View File

@@ -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.