From 3728e926cc620c439f1523a5f18b1534685ca918 Mon Sep 17 00:00:00 2001 From: tool4ever Date: Wed, 16 Nov 2022 21:55:43 +0100 Subject: [PATCH] Some fixes (#1911) --- forge-ai/src/main/java/forge/ai/ComputerUtilCost.java | 5 ++--- forge-ai/src/main/java/forge/ai/ComputerUtilMana.java | 3 +-- forge-ai/src/main/java/forge/ai/ability/PumpAi.java | 2 +- .../src/main/java/forge/game/card/CardFactoryUtil.java | 1 - forge-game/src/main/java/forge/game/keyword/Keyword.java | 1 - forge-game/src/main/java/forge/game/player/Player.java | 2 +- forge-gui/res/cardsfolder/d/domri_anarch_of_bolas.txt | 2 +- forge-gui/res/cardsfolder/h/heavy_arbalest.txt | 2 +- forge-gui/res/cardsfolder/h/heckling_fiends.txt | 2 +- 9 files changed, 8 insertions(+), 12 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java index 6bff2cd8d01..cc1d08ef5a6 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java @@ -22,7 +22,6 @@ import forge.game.phase.PhaseType; import forge.game.player.Player; import forge.game.spellability.Spell; import forge.game.spellability.SpellAbility; -import forge.game.trigger.WrappedAbility; import forge.game.zone.ZoneType; import forge.util.MyRandom; import forge.util.TextUtil; @@ -594,7 +593,7 @@ public class ComputerUtilCost { } // Ward - will be accounted for when rechecking a targeted ability - if (!(sa instanceof WrappedAbility) && sa.usesTargeting() && !cannotBeCountered) { + if (!sa.isTrigger() && sa.usesTargeting() && (!sa.isSpell() || !cannotBeCountered)) { for (Card tgt : sa.getTargets().getTargetCards()) { if (tgt.hasKeyword(Keyword.WARD) && tgt.isInPlay() && tgt.getController().isOpponentOf(sa.getHostCard().getController())) { Cost wardCost = ComputerUtilCard.getTotalWardCost(tgt); @@ -797,7 +796,7 @@ public class ComputerUtilCost { if (ApiType.Counter.equals(sa.getApi())) { List spells = AbilityUtils.getDefinedSpellAbilities(source, sa.getParamOrDefault("Defined", "Targeted"), sa); for (SpellAbility toBeCountered : spells) { - if (sa.isSpell() && !CardFactoryUtil.isCounterable(toBeCountered.getHostCard())) { + if (toBeCountered.isSpell() && !CardFactoryUtil.isCounterable(toBeCountered.getHostCard())) { return false; } // TODO check hasFizzled diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java index 33e2e690150..b708ca1dad1 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java @@ -1406,8 +1406,7 @@ public class ComputerUtilMana { public static int getAvailableManaEstimate(final Player p, final boolean checkPlayable) { int availableMana = 0; - final CardCollectionView list = new CardCollection(p.getCardsIn(ZoneType.Battlefield)); - final List srcs = CardLists.filter(list, new Predicate() { + final List srcs = CardLists.filter(p.getCardsIn(ZoneType.Battlefield), new Predicate() { @Override public boolean apply(final Card c) { return !c.getManaAbilities().isEmpty(); diff --git a/forge-ai/src/main/java/forge/ai/ability/PumpAi.java b/forge-ai/src/main/java/forge/ai/ability/PumpAi.java index bdc92598fde..36a79cf0f22 100644 --- a/forge-ai/src/main/java/forge/ai/ability/PumpAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/PumpAi.java @@ -260,7 +260,7 @@ public class PumpAi extends PumpAiBase { // Donate step 1 - try to target an opponent, preferably one who does not have a donate target yet return SpecialCardAi.Donate.considerTargetingOpponent(ai, sa); } else if (aiLogic.equals("InfernoOfTheStarMounts")) { - int numRedMana = ComputerUtilMana.determineLeftoverMana(sa, ai, "R", false); + int numRedMana = ComputerUtilMana.determineLeftoverMana(new SpellAbility.EmptySa(source), ai, "R", false); int currentPower = source.getNetPower(); if (currentPower < 20 && currentPower + numRedMana >= 20) { return true; diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index 02fe83baf18..29d30f17027 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -2593,7 +2593,6 @@ public class CardFactoryUtil { } else if (keyword.startsWith("If CARDNAME would be put into a graveyard " + "from anywhere, reveal CARDNAME and shuffle it into its owner's library instead.")) { - StringBuilder sb = new StringBuilder("Event$ Moved | Destination$ Graveyard | ValidCard$ Card.Self "); // to show it on Nexus diff --git a/forge-game/src/main/java/forge/game/keyword/Keyword.java b/forge-game/src/main/java/forge/game/keyword/Keyword.java index fa8d31a635f..0800a10f04b 100644 --- a/forge-game/src/main/java/forge/game/keyword/Keyword.java +++ b/forge-game/src/main/java/forge/game/keyword/Keyword.java @@ -76,7 +76,6 @@ public enum Keyword { EVOKE("Evoke", KeywordWithCost.class, false, "You may cast this spell for its evoke cost. If you do, it's sacrificed when it enters the battlefield."), EVOLVE("Evolve", SimpleKeyword.class, false, "Whenever a creature enters the battlefield under your control, if that creature has greater power or toughness than this creature, put a +1/+1 counter on this creature."), EXALTED("Exalted", SimpleKeyword.class, false, "Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn."), - EXERTED("Exerted", SimpleKeyword.class, true, "This creature won't untap during your next untap step."), EXPLOIT("Exploit", SimpleKeyword.class, false, "When this creature enters the battlefield, you may sacrifice a creature."), EXTORT("Extort", SimpleKeyword.class, false, "Whenever you cast a spell, you may pay {W/B}. If you do, each opponent loses 1 life and you gain that much life."), FABRICATE("Fabricate", KeywordWithAmount.class, false, "When this creature enters the battlefield, put {%1$d:+1/+1 counter} on it, or create {%1$d:1/1 colorless Servo artifact creature token}."), diff --git a/forge-game/src/main/java/forge/game/player/Player.java b/forge-game/src/main/java/forge/game/player/Player.java index e3f3666e38e..9bbf8336666 100644 --- a/forge-game/src/main/java/forge/game/player/Player.java +++ b/forge-game/src/main/java/forge/game/player/Player.java @@ -2641,7 +2641,7 @@ public class Player extends GameEntity implements Comparable { for (Card c : list) { if (c.getDamageHistory().getCreatureAttackedThisCombat() > 0) { - c.getDamageHistory().setCreatureAttackedThisCombat(null, 0); + c.getDamageHistory().setCreatureAttackedThisCombat(null, -1); } if (c.getDamageHistory().getCreatureBlockedThisCombat()) { c.getDamageHistory().setCreatureBlockedThisCombat(false); diff --git a/forge-gui/res/cardsfolder/d/domri_anarch_of_bolas.txt b/forge-gui/res/cardsfolder/d/domri_anarch_of_bolas.txt index c75e4556a39..9fcc1ecc39c 100644 --- a/forge-gui/res/cardsfolder/d/domri_anarch_of_bolas.txt +++ b/forge-gui/res/cardsfolder/d/domri_anarch_of_bolas.txt @@ -5,7 +5,7 @@ Loyalty:3 S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddPower$ 1 | Description$ Creatures you control get +1/+0. SVar:PlayMain1:TRUE A:AB$ Mana | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | Produced$ Combo R G | Amount$ 1 | AILogic$ Always | SubAbility$ DBEffect | SpellDescription$ Add {R} or {G}. -SVar:DBEffect:DB$ Effect | Name$ Domri, Anarch of Bolas Effect | StaticAbilities$ AntiMagic | SpellDescription$ Creature spells you cast this turn can't be countered +SVar:DBEffect:DB$ Effect | StaticAbilities$ AntiMagic | SpellDescription$ Creature spells you cast this turn can't be countered SVar:AntiMagic:Mode$ Continuous | Affected$ Creature.wasCastByYou | AffectedZone$ Stack | EffectZone$ Command | AddHiddenKeyword$ CARDNAME can't be countered. A:AB$ Pump | Planeswalker$ True | Cost$ SubCounter<2/LOYALTY> | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Choose target creature you control | AILogic$ Fight | SpellDescription$ Target creature you control fights target creature you don't control. | SubAbility$ DBFight SVar:DBFight:DB$ Fight | Defined$ ParentTarget | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Select target creature you don't control diff --git a/forge-gui/res/cardsfolder/h/heavy_arbalest.txt b/forge-gui/res/cardsfolder/h/heavy_arbalest.txt index d14d8a0f436..99fd4bf273b 100644 --- a/forge-gui/res/cardsfolder/h/heavy_arbalest.txt +++ b/forge-gui/res/cardsfolder/h/heavy_arbalest.txt @@ -4,6 +4,6 @@ Types:Artifact Equipment K:Equip:4 S:Mode$ Continuous | Affected$ Card.EquippedBy | AddHiddenKeyword$ CARDNAME doesn't untap during your untap step. | Description$ Equipped creature doesn't untap during its controller's untap step. S:Mode$ Continuous | Affected$ Card.EquippedBy | AddAbility$ Damage | Description$ Equipped creature has "{T}: This creature deals 2 damage to any target." -SVar:Damage:AB$DealDamage | Cost$ T | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to any target. +SVar:Damage:AB$ DealDamage | Cost$ T | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to any target. SVar:NonStackingAttachEffect:True Oracle:Equipped creature doesn't untap during its controller's untap step.\nEquipped creature has "{T}: This creature deals 2 damage to any target."\nEquip {4} diff --git a/forge-gui/res/cardsfolder/h/heckling_fiends.txt b/forge-gui/res/cardsfolder/h/heckling_fiends.txt index c0f6e1465ee..de44618fa24 100644 --- a/forge-gui/res/cardsfolder/h/heckling_fiends.txt +++ b/forge-gui/res/cardsfolder/h/heckling_fiends.txt @@ -2,6 +2,6 @@ Name:Heckling Fiends ManaCost:2 R Types:Creature Devil PT:2/2 -A:AB$ Effect | Cost$ 2 R | ValidTgts$ Creature | RememberObjects$ Targeted | ExileOnMoved$ Battlefield | SpellDescription$ Target creature attacks this turn if able. +A:AB$ Effect | Cost$ 2 R | ValidTgts$ Creature | RememberObjects$ Targeted | ExileOnMoved$ Battlefield | StaticAbilities$ MustAttack | SpellDescription$ Target creature attacks this turn if able. SVar:MustAttack:Mode$ MustAttack | ValidCreature$ Card.IsRemembered | Description$ This creature attacks this turn if able. Oracle:{2}{R}: Target creature attacks this turn if able.