From 625da798840eeea823c7b7c2d2c51304001cfee5 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 13:36:42 +0000 Subject: [PATCH] - Little updates to AI combat. - Added Slow Motion. --- res/cardsfolder/skulltap.txt | 2 +- res/quest/themes/Artifacts Colorless.thm | 5 +++-- res/quest/themes/Enchantments WG.thm | 1 + src/forge/CardFactoryUtil.java | 2 +- src/forge/CombatUtil.java | 28 ++++++++++++------------ 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/res/cardsfolder/skulltap.txt b/res/cardsfolder/skulltap.txt index 391d1b70740..353b9ff4c4e 100644 --- a/res/cardsfolder/skulltap.txt +++ b/res/cardsfolder/skulltap.txt @@ -2,7 +2,7 @@ Name:Skulltap ManaCost:1 B Types:Instant Text:no text -A:SP$Draw | Cost$ 1 B Sac<1/Creature> | NumCards$ 2 | SubAbility$ SVar=DBSac | SpellDescription$ Draw two cards. +A:SP$Draw | Cost$ 1 B Sac<1/Creature> | NumCards$ 2 | SpellDescription$ Draw two cards. SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/skulltap.jpg diff --git a/res/quest/themes/Artifacts Colorless.thm b/res/quest/themes/Artifacts Colorless.thm index 65dc502e6a8..fef40bc18cd 100644 --- a/res/quest/themes/Artifacts Colorless.thm +++ b/res/quest/themes/Artifacts Colorless.thm @@ -59,11 +59,12 @@ Darksteel Juggernaut [Group MaxCnt=1 Percentage=3] All Is Dust All Is Dust -Mycosynth Golem -Mycosynth Golem Arcbound Lancer Darksteel Forge Darksteel Forge +Mycosynth Golem +Mycosynth Golem +Summoning Station [/Group] End \ No newline at end of file diff --git a/res/quest/themes/Enchantments WG.thm b/res/quest/themes/Enchantments WG.thm index 333c4bff398..b47922d0e0e 100644 --- a/res/quest/themes/Enchantments WG.thm +++ b/res/quest/themes/Enchantments WG.thm @@ -38,6 +38,7 @@ Bound in Silence Cessation Curse of Chains Journey to Nowhere +Muzzle Oblivion Ring Pacifism Recumbent Bliss diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index 45a082ae252..aad81f26d7b 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -473,7 +473,7 @@ public class CardFactoryUtil { //Other good keywords if (c.hasKeyword("Deathtouch") && power > 0) value += 25; - if (c.hasKeyword("Whenever CARDNAME deals combat damage to a creature, destroy that creature at end of combat.") + if (c.hasStartOfKeyword("Whenever CARDNAME deals combat damage to a creature, destroy that creature") && power > 0) value += 24; value += c.getAmountOfKeyword("Exalted") * 15; if (c.hasKeyword("First Strike") && !c.hasKeyword("Double Strike") && power > 0) value += 15; diff --git a/src/forge/CombatUtil.java b/src/forge/CombatUtil.java index d4bb0e8669b..bcd474ee05c 100644 --- a/src/forge/CombatUtil.java +++ b/src/forge/CombatUtil.java @@ -478,7 +478,6 @@ public class CombatUtil { public static int getTotalFirstStrikeBlockPower(Card attacker, Player player) { final Card att = attacker; - int i = 0; CardList list = AllZoneUtil.getCreaturesInPlay(player); list = list.filter(new CardListFilter() @@ -508,25 +507,26 @@ public class CombatUtil { } //Returns the damage unblocked attackers would deal - private static int sumAttack(CardList attackers) + private static int sumAttack(CardList attackers, Player attacked) { int sum = 0; for(int i = 0; i < attackers.size(); i++) { Card a = attackers.get(i); - if (!a.hasKeyword("Infect")) sum += getAttack(a); + if (!a.hasKeyword("Infect")) sum += attacked.staticDamagePrevention(getAttack(a), a, true); } return sum; } //Returns the number of poison counters unblocked attackers would deal - private static int sumPoison(CardList attackers) + private static int sumPoison(CardList attackers, Player attacked) { int sum = 0; for(int i = 0; i < attackers.size(); i++) { Card a = attackers.get(i); - if (a.hasKeyword("Infect")) sum += getAttack(a); - if (a.hasKeyword("Poisonous")) sum += a.getKeywordMagnitude("Poisonous"); + int damage = attacked.staticDamagePrevention(getAttack(a), a, true); + if (a.hasKeyword("Infect")) sum += damage; + if (a.hasKeyword("Poisonous") && damage > 0) sum += a.getKeywordMagnitude("Poisonous"); } return sum; @@ -558,8 +558,8 @@ public class CombatUtil { } } - damage += sumAttack(unblocked); - poison += sumPoison(unblocked); + damage += sumAttack(unblocked, AllZone.ComputerPlayer); + poison += sumPoison(unblocked, AllZone.ComputerPlayer); if (combat.getPlaneswalker() == null) { if (damage + 3 > AllZone.ComputerPlayer.getLife() || poison + 2 > 10 - AllZone.ComputerPlayer.getPoisonCounters()) @@ -618,7 +618,7 @@ public class CombatUtil { return defenderDamage; } - // This calculates the amount of damage a blocker in a blockgang can take from the attacker + // This calculates the amount of damage a blocker in a blockgang can take from the attacker (for trampling attackers) public static int totalShieldDamage(Card attacker, CardList defenders) { int defenderDefense = 0; @@ -628,7 +628,7 @@ public class CombatUtil { return defenderDefense; } - // This calculates the amount of damage a blocker in a blockgang can take from the attacker + // This calculates the amount of damage a blocker in a blockgang can take from the attacker (for trampling attackers) public static int shieldDamage(Card attacker, Card defender) { if (!canDestroyBlocker(defender,attacker)) return 100; @@ -702,8 +702,8 @@ public class CombatUtil { if(defender.getKeyword().contains("Double Strike") ) { if(defender.getKeyword().contains("Deathtouch") && defenderDamage > 0) return true; - if(defender.getKeyword().contains("Whenever CARDNAME deals combat damage to a creature, destroy that creature at end of combat.") - && defenderDamage > 0) return true; + if(defender.hasStartOfKeyword("Whenever CARDNAME deals combat damage to a creature, destroy that creature") + && defenderDamage > 0 && !attacker.getKeyword().contains("Indestructible")) return true; if(defenderDamage >= attackerLife) return true; //Attacker may kill the blocker before he can deal normal (secondary) damage @@ -784,8 +784,8 @@ public class CombatUtil { if(attacker.getKeyword().contains("Double Strike") ) { if(attacker.getKeyword().contains("Deathtouch") && attackerDamage > 0) return true; - if(attacker.getKeyword().contains("Whenever CARDNAME deals combat damage to a creature, destroy that creature at end of combat.") - && attackerDamage > 0) return true; + if(attacker.hasStartOfKeyword("Whenever CARDNAME deals combat damage to a creature, destroy that creature") + && attackerDamage > 0 && !defender.getKeyword().contains("Indestructible")) return true; if(attackerDamage >= defenderLife) return true; //Attacker may kill the blocker before he can deal normal (secondary) damage