mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Expanded use of dealsFirstStrikeDamage AI function.
This commit is contained in:
@@ -744,10 +744,10 @@ public class ComputerUtilCombat {
|
|||||||
|
|
||||||
// if the attacker has first strike and wither the blocker will deal
|
// if the attacker has first strike and wither the blocker will deal
|
||||||
// less damage than expected
|
// less damage than expected
|
||||||
if (ComputerUtilCombat.dealsFirstStrikeDamage(attacker, withoutAbilities)
|
if (dealsFirstStrikeDamage(attacker, withoutAbilities)
|
||||||
&& (attacker.hasKeyword("Wither") || attacker.hasKeyword("Infect"))
|
&& (attacker.hasKeyword("Wither") || attacker.hasKeyword("Infect"))
|
||||||
&& !(blocker.hasKeyword("First Strike") || blocker.hasKeyword("Double Strike") || blocker
|
&& !dealsFirstStrikeDamage(blocker, withoutAbilities)
|
||||||
.hasKeyword("CARDNAME can't have counters placed on it."))) {
|
&& !blocker.hasKeyword("CARDNAME can't have counters placed on it.")) {
|
||||||
power -= attacker.getNetCombatDamage();
|
power -= attacker.getNetCombatDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1065,8 +1065,8 @@ public class ComputerUtilCombat {
|
|||||||
if (null != blocker) {
|
if (null != blocker) {
|
||||||
if (ComputerUtilCombat.dealsFirstStrikeDamage(blocker, withoutAbilities)
|
if (ComputerUtilCombat.dealsFirstStrikeDamage(blocker, withoutAbilities)
|
||||||
&& (blocker.hasKeyword("Wither") || blocker.hasKeyword("Infect"))
|
&& (blocker.hasKeyword("Wither") || blocker.hasKeyword("Infect"))
|
||||||
&& !(attacker.hasKeyword("First Strike") || attacker.hasKeyword("Double Strike") || attacker
|
&& !ComputerUtilCombat.dealsFirstStrikeDamage(attacker, withoutAbilities)
|
||||||
.hasKeyword("CARDNAME can't have counters placed on it."))) {
|
&& !attacker.hasKeyword("CARDNAME can't have counters placed on it.")) {
|
||||||
power -= blocker.getNetCombatDamage();
|
power -= blocker.getNetCombatDamage();
|
||||||
}
|
}
|
||||||
theTriggers.addAll(blocker.getTriggers());
|
theTriggers.addAll(blocker.getTriggers());
|
||||||
@@ -1614,7 +1614,8 @@ public class ComputerUtilCombat {
|
|||||||
else { // no double strike for defender
|
else { // no double strike for defender
|
||||||
// Attacker may kill the blocker before he can deal any damage
|
// Attacker may kill the blocker before he can deal any damage
|
||||||
if (dealsFirstStrikeDamage(attacker, withoutAbilities)
|
if (dealsFirstStrikeDamage(attacker, withoutAbilities)
|
||||||
&& !defender.hasKeyword("Indestructible") && !defender.hasKeyword("First Strike")) {
|
&& !defender.hasKeyword("Indestructible")
|
||||||
|
&& !dealsFirstStrikeDamage(defender, withoutAbilities)) {
|
||||||
|
|
||||||
if (attackerDamage >= defenderLife) {
|
if (attackerDamage >= defenderLife) {
|
||||||
return false;
|
return false;
|
||||||
@@ -2093,6 +2094,16 @@ public class ComputerUtilCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!withoutAbilities) {
|
if (!withoutAbilities) {
|
||||||
|
List<String> keywords = new ArrayList<String>();
|
||||||
|
keywords.add("Double Strike");
|
||||||
|
keywords.add("First Strike");
|
||||||
|
return canGainKeyword(combatant, keywords);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static boolean canGainKeyword(final Card combatant, final List<String> keywords) {
|
||||||
for (SpellAbility ability : combatant.getAllSpellAbilities()) {
|
for (SpellAbility ability : combatant.getAllSpellAbilities()) {
|
||||||
if (!(ability instanceof AbilityActivated) || ability.getPayCosts() == null) {
|
if (!(ability instanceof AbilityActivated) || ability.getPayCosts() == null) {
|
||||||
continue;
|
continue;
|
||||||
@@ -2105,11 +2116,11 @@ public class ComputerUtilCombat {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ability.hasParam("KW")) {
|
if (!ability.hasParam("KW") || !ComputerUtilCost.canPayCost(ability, combatant.getController())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
for (String keyword : keywords) {
|
||||||
if (ability.getParam("KW").contains("First Strike") && ComputerUtilCost.canPayCost(ability, combatant.getController())) {
|
if (ability.getParam("KW").contains(keyword)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user