Move Altar of the Pantheon to its own static (#6760)

This commit is contained in:
Hans Mackowiak
2025-01-11 15:18:17 +01:00
committed by GitHub
parent fb9770d8b9
commit 3fb07c5ead
5 changed files with 47 additions and 2 deletions

View File

@@ -1159,6 +1159,9 @@ public class GameAction {
}
}
staticAbilities.addAll(toAdd);
for (Player p : game.getPlayers()) {
p.afterStaticAbilityLayer(layer);
}
}
for (final CardCollectionView affected : affectedPerAbility.values()) {

View File

@@ -1938,8 +1938,8 @@ public class AbilityUtils {
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

View File

@@ -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;
@@ -4017,4 +4018,16 @@ public class Player extends GameEntity implements Comparable<Player> {
.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);
}
}

View File

@@ -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;
}
}

View File

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