- Little updates to AI combat.

- Added Slow Motion.
This commit is contained in:
jendave
2011-08-06 13:36:42 +00:00
parent c0c19293ca
commit 625da79884
5 changed files with 20 additions and 18 deletions

View File

@@ -2,7 +2,7 @@ Name:Skulltap
ManaCost:1 B ManaCost:1 B
Types:Instant Types:Instant
Text:no text 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:RemAIDeck:True
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/skulltap.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/skulltap.jpg

View File

@@ -59,11 +59,12 @@ Darksteel Juggernaut
[Group MaxCnt=1 Percentage=3] [Group MaxCnt=1 Percentage=3]
All Is Dust All Is Dust
All Is Dust All Is Dust
Mycosynth Golem
Mycosynth Golem
Arcbound Lancer Arcbound Lancer
Darksteel Forge Darksteel Forge
Darksteel Forge Darksteel Forge
Mycosynth Golem
Mycosynth Golem
Summoning Station
[/Group] [/Group]
End End

View File

@@ -38,6 +38,7 @@ Bound in Silence
Cessation Cessation
Curse of Chains Curse of Chains
Journey to Nowhere Journey to Nowhere
Muzzle
Oblivion Ring Oblivion Ring
Pacifism Pacifism
Recumbent Bliss Recumbent Bliss

View File

@@ -473,7 +473,7 @@ public class CardFactoryUtil {
//Other good keywords //Other good keywords
if (c.hasKeyword("Deathtouch") && power > 0) value += 25; 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; && power > 0) value += 24;
value += c.getAmountOfKeyword("Exalted") * 15; value += c.getAmountOfKeyword("Exalted") * 15;
if (c.hasKeyword("First Strike") && !c.hasKeyword("Double Strike") && power > 0) value += 15; if (c.hasKeyword("First Strike") && !c.hasKeyword("Double Strike") && power > 0) value += 15;

View File

@@ -478,7 +478,6 @@ public class CombatUtil {
public static int getTotalFirstStrikeBlockPower(Card attacker, Player player) public static int getTotalFirstStrikeBlockPower(Card attacker, Player player)
{ {
final Card att = attacker; final Card att = attacker;
int i = 0;
CardList list = AllZoneUtil.getCreaturesInPlay(player); CardList list = AllZoneUtil.getCreaturesInPlay(player);
list = list.filter(new CardListFilter() list = list.filter(new CardListFilter()
@@ -508,25 +507,26 @@ public class CombatUtil {
} }
//Returns the damage unblocked attackers would deal //Returns the damage unblocked attackers would deal
private static int sumAttack(CardList attackers) private static int sumAttack(CardList attackers, Player attacked)
{ {
int sum = 0; int sum = 0;
for(int i = 0; i < attackers.size(); i++) { for(int i = 0; i < attackers.size(); i++) {
Card a = attackers.get(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; return sum;
} }
//Returns the number of poison counters unblocked attackers would deal //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; int sum = 0;
for(int i = 0; i < attackers.size(); i++) { for(int i = 0; i < attackers.size(); i++) {
Card a = attackers.get(i); Card a = attackers.get(i);
if (a.hasKeyword("Infect")) sum += getAttack(a); int damage = attacked.staticDamagePrevention(getAttack(a), a, true);
if (a.hasKeyword("Poisonous")) sum += a.getKeywordMagnitude("Poisonous"); if (a.hasKeyword("Infect")) sum += damage;
if (a.hasKeyword("Poisonous") && damage > 0) sum += a.getKeywordMagnitude("Poisonous");
} }
return sum; return sum;
@@ -558,8 +558,8 @@ public class CombatUtil {
} }
} }
damage += sumAttack(unblocked); damage += sumAttack(unblocked, AllZone.ComputerPlayer);
poison += sumPoison(unblocked); poison += sumPoison(unblocked, AllZone.ComputerPlayer);
if (combat.getPlaneswalker() == null) { if (combat.getPlaneswalker() == null) {
if (damage + 3 > AllZone.ComputerPlayer.getLife() || poison + 2 > 10 - AllZone.ComputerPlayer.getPoisonCounters()) if (damage + 3 > AllZone.ComputerPlayer.getLife() || poison + 2 > 10 - AllZone.ComputerPlayer.getPoisonCounters())
@@ -618,7 +618,7 @@ public class CombatUtil {
return defenderDamage; 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) { public static int totalShieldDamage(Card attacker, CardList defenders) {
int defenderDefense = 0; int defenderDefense = 0;
@@ -628,7 +628,7 @@ public class CombatUtil {
return defenderDefense; 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) { public static int shieldDamage(Card attacker, Card defender) {
if (!canDestroyBlocker(defender,attacker)) return 100; if (!canDestroyBlocker(defender,attacker)) return 100;
@@ -702,8 +702,8 @@ public class CombatUtil {
if(defender.getKeyword().contains("Double Strike") ) { if(defender.getKeyword().contains("Double Strike") ) {
if(defender.getKeyword().contains("Deathtouch") && defenderDamage > 0) return true; 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.") if(defender.hasStartOfKeyword("Whenever CARDNAME deals combat damage to a creature, destroy that creature")
&& defenderDamage > 0) return true; && defenderDamage > 0 && !attacker.getKeyword().contains("Indestructible")) return true;
if(defenderDamage >= attackerLife) return true; if(defenderDamage >= attackerLife) return true;
//Attacker may kill the blocker before he can deal normal (secondary) damage //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("Double Strike") ) {
if(attacker.getKeyword().contains("Deathtouch") && attackerDamage > 0) return true; 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.") if(attacker.hasStartOfKeyword("Whenever CARDNAME deals combat damage to a creature, destroy that creature")
&& attackerDamage > 0) return true; && attackerDamage > 0 && !defender.getKeyword().contains("Indestructible")) return true;
if(attackerDamage >= defenderLife) return true; if(attackerDamage >= defenderLife) return true;
//Attacker may kill the blocker before he can deal normal (secondary) damage //Attacker may kill the blocker before he can deal normal (secondary) damage