Skip to content

Commit

Permalink
Move Altar of the Pantheon to its own static (#6760)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanmac authored Jan 11, 2025
1 parent fb9770d commit 3fb07c5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
3 changes: 3 additions & 0 deletions forge-game/src/main/java/forge/game/GameAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,9 @@ public boolean visit(final Card c) {
}
}
staticAbilities.addAll(toAdd);
for (Player p : game.getPlayers()) {
p.afterStaticAbilityLayer(layer);
}
}

for (final CardCollectionView affected : affectedPerAbility.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1938,8 +1938,8 @@ public static int xCount(Card c, final String s, final CardTraitBase ctb) {
colorOccurrences++;
}
}
colorOccurrences += c0.getAmountOfKeyword("Your devotion to each color and each combination of colors is increased by one.");
}
colorOccurrences += player.getDevotionMod();
return doXMath(colorOccurrences, expr, c, ctb);
}
} // end ctb != null
Expand Down
13 changes: 13 additions & 0 deletions forge-game/src/main/java/forge/game/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public class Player extends GameEntity implements Comparable<Player> {
private int venturedThisTurn;
private int descended;
private int numRingTemptedYou;
private int devotionMod;
private boolean revolt = false;
private Card ringBearer, theRing;

Expand Down Expand Up @@ -4017,4 +4018,16 @@ public List<String> getUnlockedDoors() {
.flatMap(Collection::stream)
.collect(Collectors.toList());
}

public int getDevotionMod() {
return devotionMod;
}

public void afterStaticAbilityLayer(StaticAbilityLayer layer) {
if (layer != StaticAbilityLayer.TEXT) {
return;
}

devotionMod = StaticAbilityDevotion.getDevotionMod(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package forge.game.staticability;

import forge.game.Game;
import forge.game.card.Card;
import forge.game.player.Player;
import forge.game.zone.ZoneType;

public class StaticAbilityDevotion {

static String MODE = "Devotion";

public static int getDevotionMod(final Player player) {
int i = 0;
final Game game = player.getGame();
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (!stAb.checkConditions(MODE)) {
continue;
}
if (!stAb.matchesValidParam("ValidPlayer", player)) {
continue;
}
int t = Integer.parseInt(stAb.getParamOrDefault("Value", "1"));
i = i + t;
}
}
return i;
}
}
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/a/altar_of_the_pantheon.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name:Altar of the Pantheon
ManaCost:3
Types:Artifact
K:Your devotion to each color and each combination of colors is increased by one.
S:Mode$ Devotion | ValidPlayer$ You | Description$ Your devotion to each color and each combination of colors is increased by one.
A:AB$ Mana | Cost$ T | Produced$ Any | SubAbility$ DBGainLife | SpellDescription$ Add one mana of any color. If you control a God, a Demigod, or a legendary enchantment, you gain 1 life.
SVar:DBGainLife:DB$ GainLife | LifeAmount$ 1 | ConditionPresent$ God.YouCtrl,Demigod.YouCtrl,Enchantment.YouCtrl+Legendary
DeckHas:Ability$LifeGain
Expand Down

0 comments on commit 3fb07c5

Please sign in to comment.