mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Refactor K:Unblockable > Static (#1551)
* round 1 * round 2 * 10 more (Oct 1) * attempt to add "Pump" to EffectAi * more 10/4 * more/fixes 10/4 * more 10/4 (80 to go...) * more 10/4 (70 to go...) * 10/5 (60 to go...) * more 10/5 (50 to go...) * more 10/5 (40 to go...) * more 10/5 (30 to go...) * 10/6 (20 to go...) * more 10/6 (10 to go...) * more 10/6 (last of pump -> effect) * more 10/6 (continuous kw static > cantblockby... 30 to go) * more 10/6 (continuous > cantblockby... 20 to go) * more 10/6 (continuous > cantblockby... 10 to go) * last 10/6 (continuous > cantblockby) * Final keyword cleanup? * GameSimulationTest.testEquippedAbilities use Shroud instead of Unblockable * fish token! * CreatureEvaluator evaluate for unblockable * AttachAi evaluate for unblockable
This commit is contained in:
@@ -10,8 +10,10 @@ import forge.game.card.CounterEnumType;
|
||||
import forge.game.cost.CostPayEnergy;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.staticability.StaticAbility;
|
||||
import forge.game.staticability.StaticAbilityAssignCombatDamageAsUnblocked;
|
||||
import forge.game.staticability.StaticAbilityMustAttack;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -60,9 +62,17 @@ public class CreatureEvaluator implements Function<Card, Integer> {
|
||||
if (c.hasKeyword(Keyword.HORSEMANSHIP)) {
|
||||
value += addValue(power * 10, "horses");
|
||||
}
|
||||
if (c.hasKeyword("Unblockable")) {
|
||||
value += addValue(power * 10, "unblockable");
|
||||
} else {
|
||||
boolean unblockable = false;
|
||||
for (final Card ca : c.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantBlockBy", c, null)) {
|
||||
value += addValue(power * 10, "unblockable");
|
||||
unblockable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!unblockable) {
|
||||
if (StaticAbilityAssignCombatDamageAsUnblocked.assignCombatDamageAsUnblocked(c)
|
||||
|| StaticAbilityAssignCombatDamageAsUnblocked.assignCombatDamageAsUnblocked(c, false)) {
|
||||
value += addValue(power * 6, "thorns");
|
||||
|
||||
@@ -661,8 +661,14 @@ public class AttachAi extends SpellAbilityAi {
|
||||
if (card.hasKeyword(Keyword.HORSEMANSHIP)) {
|
||||
cardPriority += 40;
|
||||
}
|
||||
if (card.hasKeyword("Unblockable")) {
|
||||
cardPriority += 50;
|
||||
//check if card is generally unblockable
|
||||
for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantBlockBy", card, null)) {
|
||||
cardPriority += 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Prefer "tap to deal damage"
|
||||
// TODO : Skip this one if triggers on combat damage only?
|
||||
@@ -1551,7 +1557,7 @@ public class AttachAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
final boolean evasive = keyword.equals("Unblockable") || keyword.equals("Fear")
|
||||
final boolean evasive = keyword.equals("Fear")
|
||||
|| keyword.equals("Intimidate") || keyword.equals("Shadow")
|
||||
|| keyword.equals("Flying") || keyword.equals("Horsemanship")
|
||||
|| keyword.endsWith("walk") || keyword.equals("All creatures able to block CARDNAME do so.");
|
||||
|
||||
@@ -215,6 +215,10 @@ public class EffectAi extends SpellAbilityAi {
|
||||
return topStack.getActivatingPlayer().isOpponentOf(ai) && topStack.getApi() == ApiType.GainLife;
|
||||
} else if (logic.equals("Fight")) {
|
||||
return FightAi.canFightAi(ai, sa, 0, 0);
|
||||
} else if (logic.equals("Pump")) {
|
||||
if (SpellApiToAi.Converter.get(sa.getApi()).canPlayAIWithSubs(ai, sa)) {
|
||||
return true;
|
||||
}
|
||||
} else if (logic.equals("Burn")) {
|
||||
// for DamageDeal sub-abilities (eg. Wild Slash, Skullcrack)
|
||||
SpellAbility burn = sa.getSubAbility();
|
||||
|
||||
@@ -196,7 +196,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean evasive = keyword.endsWith("Unblockable") || keyword.endsWith("Shadow");
|
||||
final boolean evasive = keyword.endsWith("Shadow");
|
||||
// give evasive keywords to creatures that can or do attack
|
||||
if (evasive) {
|
||||
return !ph.isPlayerTurn(opp) && (CombatUtil.canAttack(card, opp) || (combat != null && combat.isAttacking(card)))
|
||||
|
||||
Reference in New Issue
Block a user