From de938dd3e7cb6906a738cc36a68e5efb25dcce62 Mon Sep 17 00:00:00 2001 From: Bug Hunter Date: Tue, 11 Jan 2022 16:21:03 +0000 Subject: [PATCH] Fix Melee --- .../src/main/java/forge/game/combat/CombatUtil.java | 9 ++++++++- .../src/main/java/forge/game/trigger/TriggerAttacks.java | 2 +- forge-gui/res/cardsfolder/a/asmira_holy_avenger.txt | 2 +- forge-gui/res/cardsfolder/c/caller_of_the_claw.txt | 2 +- forge-gui/res/cardsfolder/d/dreadmalkin.txt | 2 +- forge-gui/res/cardsfolder/f/fresh_meat.txt | 2 +- forge-gui/res/cardsfolder/r/revivify.txt | 2 +- .../res/cardsfolder/t/tevesh_szat_doom_of_fools.txt | 2 +- forge-gui/res/cardsfolder/u/urborg_justice.txt | 2 +- .../java/forge/gamemodes/match/input/InputAttack.java | 3 +-- 10 files changed, 17 insertions(+), 11 deletions(-) diff --git a/forge-game/src/main/java/forge/game/combat/CombatUtil.java b/forge-game/src/main/java/forge/game/combat/CombatUtil.java index 75f9e0d2598..35e90c30d9c 100644 --- a/forge-game/src/main/java/forge/game/combat/CombatUtil.java +++ b/forge-game/src/main/java/forge/game/combat/CombatUtil.java @@ -384,7 +384,14 @@ public class CombatUtil { runParams.put(AbilityKey.OtherAttackers, otherAttackers); runParams.put(AbilityKey.Attacked, combat.getDefenderByAttacker(c)); runParams.put(AbilityKey.DefendingPlayer, combat.getDefenderPlayerByAttacker(c)); - runParams.put(AbilityKey.Defenders, combat.getDefenders()); + // only add defenders that were attacked + final FCollection defenders = new FCollection<>(); + for (GameEntity e : combat.getDefenders()) { + if (!combat.getAttackersOf(e).isEmpty()) { + defenders.add(e); + } + } + runParams.put(AbilityKey.Defenders, defenders); game.getTriggerHandler().runTrigger(TriggerType.Attacks, runParams, false); } diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java b/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java index 061a23fab37..09372fd5db3 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java @@ -103,7 +103,7 @@ public class TriggerAttacks extends Trigger { @SuppressWarnings("unchecked") List list = (List) runParams.get(AbilityKey.Defenders); for (GameEntity e : list) { - if ((e instanceof Player) && !e.equals(attacked)) { + if (e instanceof Player && !e.equals(attacked)) { found = true; break; } diff --git a/forge-gui/res/cardsfolder/a/asmira_holy_avenger.txt b/forge-gui/res/cardsfolder/a/asmira_holy_avenger.txt index b3ffeff957b..c7aef2e258c 100644 --- a/forge-gui/res/cardsfolder/a/asmira_holy_avenger.txt +++ b/forge-gui/res/cardsfolder/a/asmira_holy_avenger.txt @@ -5,6 +5,6 @@ PT:2/3 K:Flying T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ At the beginning of each end step, put a +1/+1 counter on Asmira, Holy Avenger for each creature put into your graveyard from the battlefield this turn. SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ X -SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouCtrl +SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouOwn SVar:Picture:http://www.wizards.com/global/images/magic/general/asmira_holy_avenger.jpg Oracle:Flying\nAt the beginning of each end step, put a +1/+1 counter on Asmira, Holy Avenger for each creature put into your graveyard from the battlefield this turn. diff --git a/forge-gui/res/cardsfolder/c/caller_of_the_claw.txt b/forge-gui/res/cardsfolder/c/caller_of_the_claw.txt index aa3fa9303e5..a2881598e82 100644 --- a/forge-gui/res/cardsfolder/c/caller_of_the_claw.txt +++ b/forge-gui/res/cardsfolder/c/caller_of_the_claw.txt @@ -5,6 +5,6 @@ PT:2/2 K:Flash T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ When CARDNAME enters the battlefield, create a 2/2 green Bear creature token for each nontoken creature put into your graveyard from the battlefield this turn. SVar:TrigToken:DB$ Token | TokenAmount$ X | TokenOwner$ You | TokenScript$ g_2_2_bear | LegacyImage$ g 2 2 bear lgn -SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.nonToken+YouCtrl +SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.nonToken+YouOwn SVar:Picture:http://resources.wizards.com/magic/cards/lgn/en-us/card42187.jpg Oracle:Flash\nWhen Caller of the Claw enters the battlefield, create a 2/2 green Bear creature token for each nontoken creature put into your graveyard from the battlefield this turn. diff --git a/forge-gui/res/cardsfolder/d/dreadmalkin.txt b/forge-gui/res/cardsfolder/d/dreadmalkin.txt index 24201e37266..c5955eae7db 100644 --- a/forge-gui/res/cardsfolder/d/dreadmalkin.txt +++ b/forge-gui/res/cardsfolder/d/dreadmalkin.txt @@ -3,7 +3,7 @@ ManaCost:B Types:Creature Zombie Cat PT:1/1 K:Menace -A:AB$ PutCounter | Cost$ 2 B Sac<1/Creature.Other,Planeswalker.Other/another creature or planeswalker> | CounterType$ P1P1 | CounterNum$ 2 | AILogic$ AristocratCounters | SpellDescription$ Put two +1/+1 counters on CARDNAME. +A:AB$ PutCounter | Cost$ 2 B Sac<1/Creature.Other;Planeswalker.Other/another creature or planeswalker> | CounterType$ P1P1 | CounterNum$ 2 | AILogic$ AristocratCounters | SpellDescription$ Put two +1/+1 counters on CARDNAME. DeckHas:Ability$Counters SVar:AIPreference:SacCost$Creature.Other Oracle:Menace (This creature can't be blocked except by two or more creatures.)\n{2}{B}, Sacrifice another creature or planeswalker: Put two +1/+1 counters on Dreadmalkin. diff --git a/forge-gui/res/cardsfolder/f/fresh_meat.txt b/forge-gui/res/cardsfolder/f/fresh_meat.txt index 048f1761568..0d3101d10dd 100644 --- a/forge-gui/res/cardsfolder/f/fresh_meat.txt +++ b/forge-gui/res/cardsfolder/f/fresh_meat.txt @@ -2,7 +2,7 @@ Name:Fresh Meat ManaCost:3 G Types:Instant A:SP$ Token | Cost$ 3 G | TokenAmount$ X | TokenOwner$ You | TokenScript$ g_3_3_beast | LegacyImage$ g 3 3 beast nph | SpellDescription$ Create a 3/3 green Beast creature token for each creature put into your graveyard from the battlefield this turn. -SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouCtrl +SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouOwn AI:RemoveDeck:All SVar:Picture:http://www.wizards.com/global/images/magic/general/fresh_meat.jpg Oracle:Create a 3/3 green Beast creature token for each creature put into your graveyard from the battlefield this turn. diff --git a/forge-gui/res/cardsfolder/r/revivify.txt b/forge-gui/res/cardsfolder/r/revivify.txt index 590d19d4269..ccb67fe9495 100644 --- a/forge-gui/res/cardsfolder/r/revivify.txt +++ b/forge-gui/res/cardsfolder/r/revivify.txt @@ -4,5 +4,5 @@ Types:Instant A:SP$ RollDice | Sides$ 20 | Modifier$ X | ResultSubAbilities$ 1-14:DBToHand,Else:DBToField | SpellDescription$ Roll a d20 and add the number of creature cards in your graveyard that were put there from the battlefield this turn. SVar:DBToHand:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ValidGraveyard Creature.YouOwn+ThisTurnEnteredFrom_Battlefield | SpellDescription$ 1—14 VERT Return all creature cards in your graveyard that were put there from the battlefield this turn to your hand. SVar:DBToField:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | Defined$ ValidGraveyard Creature.YouOwn+ThisTurnEnteredFrom_Battlefield | SpellDescription$ 15+ VERT Return those cards from your graveyard to the battlefield. -SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouCtrl +SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouOwn Oracle:Roll a d20 and add the number of creature cards in your graveyard that were put there from the battlefield this turn.\n1—14 | Return all creature cards in your graveyard that were put there from the battlefield this turn to your hand.\n15+ | Return those cards from your graveyard to the battlefield. diff --git a/forge-gui/res/cardsfolder/t/tevesh_szat_doom_of_fools.txt b/forge-gui/res/cardsfolder/t/tevesh_szat_doom_of_fools.txt index 5c0adc5991d..c6774617f39 100644 --- a/forge-gui/res/cardsfolder/t/tevesh_szat_doom_of_fools.txt +++ b/forge-gui/res/cardsfolder/t/tevesh_szat_doom_of_fools.txt @@ -5,7 +5,7 @@ Loyalty:4 Text:CARDNAME can be your commander. K:Partner A:AB$ Token | Cost$ AddCounter<2/LOYALTY> | Planeswalker$ True | TokenScript$ b_0_1_thrull | TokenAmount$ 2 | SpellDescription$ Create two 0/1 black Thrull creature tokens. -A:AB$ Sacrifice | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | SacValid$ Creature,Planeswalker | SacMessage$ creature or planeswalker | Optional$ True | RememberSacrificed$ True | SubAbility$ DBDraw | SpellDescription$ You may sacrifice another creature or planeswalker. If you do, draw two cards, then draw another card if the sacrificed permanent was a commander. +A:AB$ Sacrifice | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | SacValid$ Creature.Other,Planeswalker.Other | SacMessage$ creature or planeswalker | Optional$ True | RememberSacrificed$ True | SubAbility$ DBDraw | SpellDescription$ You may sacrifice another creature or planeswalker. If you do, draw two cards, then draw another card if the sacrificed permanent was a commander. SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ 2 | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ GE1 | SubAbility$ DBDraw2 SVar:DBDraw2:DB$ Draw | Defined$ You | NumCards$ 1 | ConditionDefined$ Remembered | ConditionPresent$ Card.IsCommander | ConditionCompare$ GE1 A:AB$ GainControl | Cost$ SubCounter<10/LOYALTY> | Planeswalker$ True | Ultimate$ True | AllValid$ Card.IsCommander | NewController$ You | SubAbility$ DBChangeZone | SpellDescription$ Gain control of all commanders. Put all commanders from the commander zone onto the battlefield under your control. diff --git a/forge-gui/res/cardsfolder/u/urborg_justice.txt b/forge-gui/res/cardsfolder/u/urborg_justice.txt index 019a1f9558c..f80717a8547 100644 --- a/forge-gui/res/cardsfolder/u/urborg_justice.txt +++ b/forge-gui/res/cardsfolder/u/urborg_justice.txt @@ -2,6 +2,6 @@ Name:Urborg Justice ManaCost:B B Types:Instant A:SP$ Sacrifice | Cost$ B B | ValidTgts$ Opponent | Amount$ X | SacValid$ Creature | SacMessage$ Creature | SpellDescription$ Target opponent sacrifices a creature for each creature put into your graveyard from the battlefield this turn. -SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouCtrl +SVar:X:Count$ThisTurnEntered_Graveyard_from_Battlefield_Creature.YouOwn SVar:Picture:http://www.wizards.com/global/images/magic/general/urborg_justice.jpg Oracle:Target opponent sacrifices a creature for each creature put into your graveyard from the battlefield this turn. diff --git a/forge-gui/src/main/java/forge/gamemodes/match/input/InputAttack.java b/forge-gui/src/main/java/forge/gamemodes/match/input/InputAttack.java index 50dcea8bb78..820e42f3610 100644 --- a/forge-gui/src/main/java/forge/gamemodes/match/input/InputAttack.java +++ b/forge-gui/src/main/java/forge/gamemodes/match/input/InputAttack.java @@ -153,8 +153,7 @@ public class InputAttack extends InputSyncronizedBase { protected final void onPlayerSelected(Player selected, final ITriggerEvent triggerEvent) { if (defenders.contains(selected)) { setCurrentDefender(selected); - } - else { + } else { getController().getGui().flashIncorrectAction(); // cannot attack that player } }