CantVenture static

This commit is contained in:
Hans Mackowiak
2021-12-21 12:48:36 +01:00
parent f48dd467a2
commit 430dab48c0
4 changed files with 40 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ import forge.game.card.CounterType;
import forge.game.event.GameEventCardCounters;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.staticability.StaticAbilityCantVenture;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.game.trigger.WrappedAbility;
@@ -85,7 +86,7 @@ public class VentureEffect extends SpellAbilityEffect {
}
private void ventureIntoDungeon(SpellAbility sa, Player player) {
if (player.getVenturedThisTurn() >= 1 && player.hasKeyword("You can't venture into the dungeon more than once each turn.")) {
if (StaticAbilityCantVenture.cantVenture(player)) {
return;
}

View File

@@ -392,6 +392,10 @@ public class PlayerProperty {
if (player.getCreaturesAttackedThisTurn().isEmpty()) {
return false;
}
} else if (property.equals("VenturedThisTurn")) {
if (player.getVenturedThisTurn() < 1) {
return false;
}
}
return true;
}

View File

@@ -0,0 +1,33 @@
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 StaticAbilityCantVenture {
static String MODE = "CantVenture";
static public boolean cantVenture(Player player) {
final Game game = player.getGame();
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
continue;
}
if (applyCantVentureAbility(stAb, player)) {
return true;
}
}
}
return false;
}
static public boolean applyCantVentureAbility(StaticAbility stAb, Player player) {
if (!stAb.matchesValidParam("ValidPlayer", player)) {
return false;
}
return true;
}
}

View File

@@ -3,5 +3,5 @@ ManaCost:1 W
Types:Creature Human Soldier
PT:2/1
S:Mode$ Continuous | Affected$ You | AddKeyword$ Hexproof | Description$ You have hexproof. (You can't be the target of spells or abilities your opponents control.)
S:Mode$ Continuous | Affected$ Opponent | AddKeyword$ You can't venture into the dungeon more than once each turn. | Description$ Each opponent can't venture into the dungeon more than once each turn.
S:Mode$ CantVenture | ValidPlayer$ Opponent.VenturedThisTurn | Description$ Each opponent can't venture into the dungeon more than once each turn.
Oracle:You have hexproof. (You can't be the target of spells or abilities your opponents control.)\nEach opponent can't venture into the dungeon more than once each turn.