mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Add Approach of the Second Sun
Add BranchEffect
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -350,6 +350,7 @@ forge-game/src/main/java/forge/game/ability/effects/BecomeMonarchEffect.java -te
|
|||||||
forge-game/src/main/java/forge/game/ability/effects/BecomesBlockedEffect.java -text
|
forge-game/src/main/java/forge/game/ability/effects/BecomesBlockedEffect.java -text
|
||||||
forge-game/src/main/java/forge/game/ability/effects/BidLifeEffect.java -text
|
forge-game/src/main/java/forge/game/ability/effects/BidLifeEffect.java -text
|
||||||
forge-game/src/main/java/forge/game/ability/effects/BondEffect.java -text
|
forge-game/src/main/java/forge/game/ability/effects/BondEffect.java -text
|
||||||
|
forge-game/src/main/java/forge/game/ability/effects/BranchEffect.java -text
|
||||||
forge-game/src/main/java/forge/game/ability/effects/ChangeTargetsEffect.java -text
|
forge-game/src/main/java/forge/game/ability/effects/ChangeTargetsEffect.java -text
|
||||||
forge-game/src/main/java/forge/game/ability/effects/ChangeTextEffect.java -text
|
forge-game/src/main/java/forge/game/ability/effects/ChangeTextEffect.java -text
|
||||||
forge-game/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java -text
|
forge-game/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java -text
|
||||||
@@ -16720,6 +16721,7 @@ forge-gui/res/cardsfolder/upcoming/angel_of_sanctions.txt -text
|
|||||||
forge-gui/res/cardsfolder/upcoming/angler_drake.txt -text
|
forge-gui/res/cardsfolder/upcoming/angler_drake.txt -text
|
||||||
forge-gui/res/cardsfolder/upcoming/anointed_procession.txt -text
|
forge-gui/res/cardsfolder/upcoming/anointed_procession.txt -text
|
||||||
forge-gui/res/cardsfolder/upcoming/anointer_priest.txt -text
|
forge-gui/res/cardsfolder/upcoming/anointer_priest.txt -text
|
||||||
|
forge-gui/res/cardsfolder/upcoming/approach_of_the_second_sun.txt -text
|
||||||
forge-gui/res/cardsfolder/upcoming/archfiend_of_ifnir.txt -text
|
forge-gui/res/cardsfolder/upcoming/archfiend_of_ifnir.txt -text
|
||||||
forge-gui/res/cardsfolder/upcoming/aven_initiate.txt -text
|
forge-gui/res/cardsfolder/upcoming/aven_initiate.txt -text
|
||||||
forge-gui/res/cardsfolder/upcoming/aven_wind_guide.txt -text
|
forge-gui/res/cardsfolder/upcoming/aven_wind_guide.txt -text
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public enum SpellApiToAi {
|
|||||||
.put(ApiType.BecomesBlocked, BecomesBlockedAi.class)
|
.put(ApiType.BecomesBlocked, BecomesBlockedAi.class)
|
||||||
.put(ApiType.BidLife, BidLifeAi.class)
|
.put(ApiType.BidLife, BidLifeAi.class)
|
||||||
.put(ApiType.Bond, BondAi.class)
|
.put(ApiType.Bond, BondAi.class)
|
||||||
|
.put(ApiType.Branch, AlwaysPlayAi.class)
|
||||||
.put(ApiType.ChangeTargets, ChangeTargetsAi.class)
|
.put(ApiType.ChangeTargets, ChangeTargetsAi.class)
|
||||||
.put(ApiType.ChangeZone, ChangeZoneAi.class)
|
.put(ApiType.ChangeZone, ChangeZoneAi.class)
|
||||||
.put(ApiType.ChangeZoneAll, ChangeZoneAllAi.class)
|
.put(ApiType.ChangeZoneAll, ChangeZoneAllAi.class)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public final class AbilityFactory {
|
|||||||
"WinSubAbility", "OtherwiseSubAbility", // Clash
|
"WinSubAbility", "OtherwiseSubAbility", // Clash
|
||||||
"ChooseNumberSubAbility", "Lowest", "Highest", // ChooseNumber
|
"ChooseNumberSubAbility", "Lowest", "Highest", // ChooseNumber
|
||||||
"HeadsSubAbility", "TailsSubAbility", "LoseSubAbility", // FlipCoin
|
"HeadsSubAbility", "TailsSubAbility", "LoseSubAbility", // FlipCoin
|
||||||
|
"TrueSubAbility", "FalseSubAbility", // Branch
|
||||||
"ChosenPile", "UnchosenPile", // MultiplePiles & TwoPiles
|
"ChosenPile", "UnchosenPile", // MultiplePiles & TwoPiles
|
||||||
"RepeatSubAbility", // Repeat & RepeatEach
|
"RepeatSubAbility", // Repeat & RepeatEach
|
||||||
"Execute" // DelayedTrigger
|
"Execute" // DelayedTrigger
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public enum ApiType {
|
|||||||
BecomesBlocked (BecomesBlockedEffect.class),
|
BecomesBlocked (BecomesBlockedEffect.class),
|
||||||
BidLife (BidLifeEffect.class),
|
BidLife (BidLifeEffect.class),
|
||||||
Bond (BondEffect.class),
|
Bond (BondEffect.class),
|
||||||
|
Branch (BranchEffect.class),
|
||||||
ChangeTargets (ChangeTargetsEffect.class),
|
ChangeTargets (ChangeTargetsEffect.class),
|
||||||
ChangeText (ChangeTextEffect.class),
|
ChangeText (ChangeTextEffect.class),
|
||||||
ChangeZone (ChangeZoneEffect.class),
|
ChangeZone (ChangeZoneEffect.class),
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
|
import forge.game.ability.AbilityUtils;
|
||||||
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
|
import forge.game.card.Card;
|
||||||
|
import forge.game.player.Player;
|
||||||
|
import forge.game.spellability.AbilitySub;
|
||||||
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.util.Expressions;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BranchEffect extends SpellAbilityEffect {
|
||||||
|
@Override
|
||||||
|
public void resolve(SpellAbility sa) {
|
||||||
|
final Card host = sa.getHostCard();
|
||||||
|
final Player player = host.getController();
|
||||||
|
|
||||||
|
// TODO Reuse SpellAbilityCondition and areMet() here instead of repeating each
|
||||||
|
|
||||||
|
// For now branch conditions will only be an Svar Compare
|
||||||
|
String branchSVar = sa.getParam("BranchConditionSVar");
|
||||||
|
String branchCompare = sa.getParamOrDefault("BranchConditionSVarCompare", "GE1");
|
||||||
|
|
||||||
|
String operator = branchCompare.substring(0, 2);
|
||||||
|
String operand = branchCompare.substring(2);
|
||||||
|
|
||||||
|
final int svarValue = AbilityUtils.calculateAmount(host, branchSVar, sa);
|
||||||
|
final int operandValue = AbilityUtils.calculateAmount(host, operand, sa);
|
||||||
|
|
||||||
|
AbilitySub sub = null;
|
||||||
|
if (Expressions.compare(svarValue, operator, operandValue)) {
|
||||||
|
sub = sa.getAdditonalAbility("TrueSubAbility");
|
||||||
|
} else {
|
||||||
|
sub = sa.getAdditonalAbility("FalseSubAbility");
|
||||||
|
}
|
||||||
|
if (sub != null) {
|
||||||
|
AbilityUtils.resolve(sub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3787,7 +3787,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
// Takes one argument like Permanent.Blue+withFlying
|
// Takes one argument like Permanent.Blue+withFlying
|
||||||
@Override
|
@Override
|
||||||
public final boolean isValid(final String restriction, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
public final boolean isValid(final String restriction, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||||
if (isImmutable() && !source.isRemembered(this) && !restriction.startsWith("Emblem")) { // special case exclusion
|
if (isImmutable() && !source.isRemembered(this) &&
|
||||||
|
!(restriction.startsWith("Emblem") || restriction.startsWith("Effect"))) { // special case exclusion
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Name:Approach of the Second Sun
|
||||||
|
ManaCost:6 W
|
||||||
|
Types:Sorcery
|
||||||
|
T:Mode$ SpellCast | ValidCard$ Card.Self | Static$ True | Execute$ ApproachingSuns
|
||||||
|
SVar:ApproachingSuns:DB$ Effect | Name$ ApproachingSuns | Duration$ Permanent
|
||||||
|
A:SP$ Branch | Cost$ 6 W | References$ X,Y,Z | BranchConditionSVar$ X | BranchConditionSVarCompare$ EQ3 | TrueSubAbility$ WinGame | FalseSubAbility$ GainLife | SpellDescription$ If CARDNAME was cast from your hand and you’ve cast another spell named Approach of the Second Sun this game, you win the game. Otherwise, put CARDNAME into its owner’s library seventh from the top and you gain 7 life.
|
||||||
|
SVar:WinGame:DB$ WinsGame | Defined$ You
|
||||||
|
SVar:GainLife:DB$ GainLife | LifeAmount$ 7 | Defined$ You | SubAbility$ Reapproach
|
||||||
|
SVar:Reapproach:DB$ ChangeZone | Origin$ Stack | Destination$ Library | LibraryPosition$ 6 | Defined$ Self
|
||||||
|
SVar:Y:Count$ValidCommand Effect.YouCtrl+namedApproachingSuns/LimitMax.2
|
||||||
|
SVar:Z:Count$ValidStack Card.wasCastFromHand+Self/LimitMax.1
|
||||||
|
SVar:X:SVar$Y/Plus.Z
|
||||||
|
Oracle:If Approach of the Second Sun was cast from your hand and you’ve cast another spell named Approach of the Second Sun this game, you win the game. Otherwise, put Approach of the Second Sun into its owner’s library seventh from the top and you gain 7 life.
|
||||||
Reference in New Issue
Block a user