From ed9cbacb4395bc12e5732e5bc0fe548c8b2899a0 Mon Sep 17 00:00:00 2001 From: mcrawford620 Date: Wed, 18 Jul 2012 00:34:53 +0000 Subject: [PATCH] - AI for Pump -X/0 cards, targeting Human attackers --- res/cardsfolder/b/bewilder.txt | 1 - res/cardsfolder/c/chandras_fury.txt | 1 - res/cardsfolder/d/disorient.txt | 1 - res/cardsfolder/d/downpour.txt | 1 - res/cardsfolder/e/elvish_archdruid.txt | 2 +- res/cardsfolder/g/ghosts_of_the_damned.txt | 1 - res/cardsfolder/h/hydrosurge.txt | 1 - res/cardsfolder/h/hysterical_blindness.txt | 1 - res/cardsfolder/l/lethargy_trap.txt | 1 - res/cardsfolder/p/pradesh_gypsies.txt | 1 - res/cardsfolder/s/saltfield_recluse.txt | 1 - res/cardsfolder/s/shrink.txt | 1 - res/cardsfolder/s/sword_dancer.txt | 1 - res/cardsfolder/t/turn_the_tide.txt | 1 - .../abilityfactory/AbilityFactoryPump.java | 27 ++++++++++++++++++- 15 files changed, 27 insertions(+), 15 deletions(-) diff --git a/res/cardsfolder/b/bewilder.txt b/res/cardsfolder/b/bewilder.txt index 0ba502e6a1f..d257cd0b879 100644 --- a/res/cardsfolder/b/bewilder.txt +++ b/res/cardsfolder/b/bewilder.txt @@ -4,7 +4,6 @@ Types:Instant Text:no text A:SP$ Pump | Cost$ 2 U | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -3 | IsCurse$ True | SpellDescription$ Target creature gets -3/-0 until end of turn. | SubAbility$ DBDraw SVar:DBDraw:DB$Draw | NumCards$ 1 | SpellDescription$ Draw a card. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/bewilder.jpg SetInfo:TSP|Common|http://magiccards.info/scans/en/ts/49.jpg diff --git a/res/cardsfolder/c/chandras_fury.txt b/res/cardsfolder/c/chandras_fury.txt index 93327321910..ab46661d9d6 100644 --- a/res/cardsfolder/c/chandras_fury.txt +++ b/res/cardsfolder/c/chandras_fury.txt @@ -4,7 +4,6 @@ Types:Instant Text:no text A:SP$ DealDamage | Cost$ 4 R | ValidTgts$ Player | NumDmg$ 4 | SubAbility$ DmgAll | SpellDescription$ CARDNAME deals 4 damage to target player and 1 damage to each creature that player controls. SVar:DmgAll:DB$ DamageAll | Cost$ 0 | NumDmg$ 1 | ValidCards$ Creature.TargetedPlayerCtrl -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/chandras_fury.jpg SetInfo:M13|Common|http://magiccards.info/scans/en/m13/124.jpg diff --git a/res/cardsfolder/d/disorient.txt b/res/cardsfolder/d/disorient.txt index 53afc00bfad..5a44f33110f 100644 --- a/res/cardsfolder/d/disorient.txt +++ b/res/cardsfolder/d/disorient.txt @@ -3,7 +3,6 @@ ManaCost:3 U Types:Instant Text:no text A:SP$ Pump | Cost$ 3 U | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -7 | IsCurse$ True | SpellDescription$ Target creature gets -7/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/disorient.jpg SetInfo:M10|Common|http://magiccards.info/scans/en/m10/48.jpg diff --git a/res/cardsfolder/d/downpour.txt b/res/cardsfolder/d/downpour.txt index fde2531780b..ce815e9c258 100644 --- a/res/cardsfolder/d/downpour.txt +++ b/res/cardsfolder/d/downpour.txt @@ -3,7 +3,6 @@ ManaCost:1 U Types:Instant Text:no text A:SP$ Tap | Cost$ 1 U | ValidTgts$ Creature | TgtPrompt$ Select up to three target creatures | TargetMin$ 0 | TargetMax$ 3 | SpellDescription$ Tap up to three target creatures. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/downpour.jpg SetInfo:M13|Common|http://magiccards.info/scans/en/m13/48.jpg diff --git a/res/cardsfolder/e/elvish_archdruid.txt b/res/cardsfolder/e/elvish_archdruid.txt index f309e2d971b..15afe92de8b 100644 --- a/res/cardsfolder/e/elvish_archdruid.txt +++ b/res/cardsfolder/e/elvish_archdruid.txt @@ -6,7 +6,7 @@ PT:2/2 S:Mode$ Continuous | Affected$ Creature.Elf+Other+YouCtrl | AddPower$ 1 | AddToughness$ 1 | Description$ Other Elf creatures you control get +1/+1. A:AB$ Mana | Cost$ T | Produced$ G | Amount$ X | References$ X | SpellDescription$ Add G to your mana pool for each Elf you control. SVar:X:Count$Valid Elf.YouCtrl -SVar:RemAIDeck:True +SVar:DeckWants:Type$Elf SVar:PlayMain1:TRUE SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/elvish_archdruid.jpg diff --git a/res/cardsfolder/g/ghosts_of_the_damned.txt b/res/cardsfolder/g/ghosts_of_the_damned.txt index 6ab1aaaaf0e..882916d0ed5 100644 --- a/res/cardsfolder/g/ghosts_of_the_damned.txt +++ b/res/cardsfolder/g/ghosts_of_the_damned.txt @@ -4,7 +4,6 @@ Types:Creature Spirit Text:no text PT:0/2 A:AB$ Pump | Cost$ T | ValidTgts$ Creature | NumAtt$ -1 | IsCurse$ True | TgtPrompt$ Select target creature | SpellDescription$ Target creature gets -1/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/ghosts_of_the_damned.jpg SetInfo:LEG|Common|http://magiccards.info/scans/en/lg/12.jpg diff --git a/res/cardsfolder/h/hydrosurge.txt b/res/cardsfolder/h/hydrosurge.txt index a1596f30e7e..b989f759640 100644 --- a/res/cardsfolder/h/hydrosurge.txt +++ b/res/cardsfolder/h/hydrosurge.txt @@ -3,7 +3,6 @@ ManaCost:U Types:Instant Text:no text A:SP$ Pump | Cost$ U | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -5 | IsCurse$ True | SpellDescription$ Target creature gets -5/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/hydrosurge.jpg SetInfo:M13|Common|http://magiccards.info/scans/en/m13/54.jpg diff --git a/res/cardsfolder/h/hysterical_blindness.txt b/res/cardsfolder/h/hysterical_blindness.txt index 9aa915956b3..ce4e2a918b5 100644 --- a/res/cardsfolder/h/hysterical_blindness.txt +++ b/res/cardsfolder/h/hysterical_blindness.txt @@ -3,7 +3,6 @@ ManaCost:2 U Types:Instant Text:no text A:SP$ PumpAll | Cost$ 2 U | ValidCards$ Creature.YouDontCtrl | NumAtt$ -4 | NumDef$ 0 | IsCurse$ True |SpellDescription$ Creatures your opponents control get -4/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/hysterical_blindness.jpg SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/59.jpg diff --git a/res/cardsfolder/l/lethargy_trap.txt b/res/cardsfolder/l/lethargy_trap.txt index 57af8f9dbf1..fdda8034737 100644 --- a/res/cardsfolder/l/lethargy_trap.txt +++ b/res/cardsfolder/l/lethargy_trap.txt @@ -4,7 +4,6 @@ Types:Instant Trap Text:no text A:SP$ PumpAll | Cost$ 3 U | ValidCards$ Creature.attacking | NumAtt$ -3 | IsPresent$ Creature.attacking | PresentCompare$ LE2 | SpellDescription$ If three or more creatures are attacking, you may pay U rather than pay CARDNAME mana cost. A:SP$ PumpAll | Cost$ U | ValidCards$ Creature.attacking | NumAtt$ -3 | IsPresent$ Creature.attacking | PresentCompare$ GE3 | SpellDescription$ Attacking creatures get -3/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/lethargy_trap.jpg SetInfo:ZEN|Common|http://magiccards.info/scans/en/zen/51.jpg diff --git a/res/cardsfolder/p/pradesh_gypsies.txt b/res/cardsfolder/p/pradesh_gypsies.txt index d7b006a8e9f..4e5839b6296 100644 --- a/res/cardsfolder/p/pradesh_gypsies.txt +++ b/res/cardsfolder/p/pradesh_gypsies.txt @@ -4,7 +4,6 @@ Types:Creature Human Nomad Text:no text PT:1/1 A:AB$ Pump | Cost$ 1 G T | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -2 | IsCurse$ True | SpellDescription$ Target creature gets -2/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/pradesh_gypsies.jpg SetInfo:5ED|Common|http://magiccards.info/scans/en/5e/179.jpg diff --git a/res/cardsfolder/s/saltfield_recluse.txt b/res/cardsfolder/s/saltfield_recluse.txt index 65127359b87..be41e119be3 100644 --- a/res/cardsfolder/s/saltfield_recluse.txt +++ b/res/cardsfolder/s/saltfield_recluse.txt @@ -4,7 +4,6 @@ Types:Creature Human Rebel Cleric Text:no text PT:1/2 A:AB$ Pump | Cost$ T | NumAtt$ -2 | IsCurse$ True | ValidTgts$ Creature | TgtPrompt$ Select target creature | SpellDescription$ Target creature gets -2/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/saltfield_recluse.jpg SetInfo:PLC|Common|http://magiccards.info/scans/en/pc/16.jpg diff --git a/res/cardsfolder/s/shrink.txt b/res/cardsfolder/s/shrink.txt index 9eda0a8b4bb..b0b838caaec 100644 --- a/res/cardsfolder/s/shrink.txt +++ b/res/cardsfolder/s/shrink.txt @@ -3,7 +3,6 @@ ManaCost:G Types:Instant Text:no text A:SP$ Pump | Cost$ G | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -5 | IsCurse$ True | SpellDescription$ Target creature gets -5/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/shrink.jpg SetInfo:HML|Common|http://magiccards.info/scans/en/hl/70.jpg|2 diff --git a/res/cardsfolder/s/sword_dancer.txt b/res/cardsfolder/s/sword_dancer.txt index 09be27e0621..4d4247725ae 100644 --- a/res/cardsfolder/s/sword_dancer.txt +++ b/res/cardsfolder/s/sword_dancer.txt @@ -4,7 +4,6 @@ Types:Creature Human Rebel Text:no text PT:1/2 A:AB$ Pump | Cost$ W W | ValidTgts$ Creature.attacking | IsCurse$ True | NumAtt$ -1 | TgtPrompt$ Select target attacking creature | SpellDescription$ Target attacking creature gets -1/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/sword_dancer.jpg SetInfo:PCY|Uncommon|http://magiccards.info/scans/en/pr/25.jpg diff --git a/res/cardsfolder/t/turn_the_tide.txt b/res/cardsfolder/t/turn_the_tide.txt index 053277f1c77..874a3612ae0 100644 --- a/res/cardsfolder/t/turn_the_tide.txt +++ b/res/cardsfolder/t/turn_the_tide.txt @@ -3,7 +3,6 @@ ManaCost:1 U Types:Instant Text:no text A:SP$ PumpAll | Cost$ 1 U | ValidCards$ Creature.YouDontCtrl | IsCurse$ True | NumAtt$ -2 | SpellDescription$ Creatures your opponents control get -2/-0 until end of turn. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/turn_the_tide.jpg SetInfo:MBS|Common|http://magiccards.info/scans/en/mbs/35.jpg diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java index dad2bcbd8b3..ddd5c5e5460 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java @@ -650,6 +650,31 @@ public class AbilityFactoryPump { } }); // leaves all creatures that will be destroyed } // -X/-X end + else if ((attack < 0) && !list.isEmpty()) { + // spells that give -X/0 + Player activePlayer = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn(); + if (activePlayer.isComputer()) { + if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN)) { + // TODO: Curse creatures that will block AI's creatures, if AI is going to attack. + list = new CardList(); + } else { + list = new CardList(); + } + } else { + // Human active, only curse attacking creatures + if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)) { + list = list.filter(new CardListFilter() { + @Override + public boolean addCard(final Card c) { + return c.isAttacking(); + } + }); + } else { + list = new CardList(); + } + } + Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN); + } // -X/0 end else if (!list.isEmpty()) { final ArrayList keywords = this.keywords; final boolean addsKeywords = this.keywords.size() > 0; @@ -662,7 +687,7 @@ public class AbilityFactoryPump { } }); } else { - return new CardList(); + list = new CardList(); } }