mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
- Added AI support for pump abilities with "CARDNAME can block an additional creature.".
This commit is contained in:
@@ -5,7 +5,6 @@ Text:no text
|
|||||||
PT:1/4
|
PT:1/4
|
||||||
K:Reach
|
K:Reach
|
||||||
A:AB$ Pump | Cost$ 1 G | Defined$ Self | KW$ HIDDEN CARDNAME can block an additional creature. | SpellDescription$ CARDNAME can block an additional creature this turn.
|
A:AB$ Pump | Cost$ 1 G | Defined$ Self | KW$ HIDDEN CARDNAME can block an additional creature. | SpellDescription$ CARDNAME can block an additional creature this turn.
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Rarity:Uncommon
|
SVar:Rarity:Uncommon
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/anurid_swarmsnapper.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/anurid_swarmsnapper.jpg
|
||||||
SetInfo:JUD|Uncommon|http://magiccards.info/scans/en/ju/105.jpg
|
SetInfo:JUD|Uncommon|http://magiccards.info/scans/en/ju/105.jpg
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ Text:no text
|
|||||||
PT:1/4
|
PT:1/4
|
||||||
A:AB$ Pump | Cost$ W | Defined$ Self | NumDef$ 1 | SpellDescription$ CARDNAME gets +0/+1 until end of turn.
|
A:AB$ Pump | Cost$ W | Defined$ Self | NumDef$ 1 | SpellDescription$ CARDNAME gets +0/+1 until end of turn.
|
||||||
A:AB$ Pump | Cost$ 2 | Defined$ Self | KW$ HIDDEN CARDNAME can block an additional creature. | SpellDescription$ CARDNAME can block an additional creature this turn.
|
A:AB$ Pump | Cost$ 2 | Defined$ Self | KW$ HIDDEN CARDNAME can block an additional creature. | SpellDescription$ CARDNAME can block an additional creature this turn.
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Rarity:Uncommon
|
SVar:Rarity:Uncommon
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/luminous_guardian.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/luminous_guardian.jpg
|
||||||
SetInfo:ODY|Uncommon|http://magiccards.info/scans/en/od/31.jpg
|
SetInfo:ODY|Uncommon|http://magiccards.info/scans/en/od/31.jpg
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ Text:no text
|
|||||||
PT:2/3
|
PT:2/3
|
||||||
K:Reach
|
K:Reach
|
||||||
A:AB$ Pump | Cost$ W | Defined$ Self | KW$ HIDDEN CARDNAME can block an additional creature. | SpellDescription$ CARDNAME can block an additional creature this turn.
|
A:AB$ Pump | Cost$ W | Defined$ Self | KW$ HIDDEN CARDNAME can block an additional creature. | SpellDescription$ CARDNAME can block an additional creature this turn.
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Rarity:Common
|
SVar:Rarity:Common
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/mounted_archers.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/mounted_archers.jpg
|
||||||
SetInfo:TMP|Common|http://magiccards.info/scans/en/tp/242.jpg
|
SetInfo:TMP|Common|http://magiccards.info/scans/en/tp/242.jpg
|
||||||
|
|||||||
@@ -529,6 +529,24 @@ public class AbilityFactoryPump {
|
|||||||
|| !CombatUtil.canBlock(card)) {
|
|| !CombatUtil.canBlock(card)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (keyword.endsWith("CARDNAME can block an additional creature.")) {
|
||||||
|
if (ph.isPlayerTurn(computer)
|
||||||
|
|| !ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int canBlockNum = 1 + card.getKeywordAmount("CARDNAME can block an additional creature.");
|
||||||
|
int possibleBlockNum = 0;
|
||||||
|
for (Card attacker : AllZone.getCombat().getAttackerList()) {
|
||||||
|
if (CombatUtil.canBlock(attacker, card)) {
|
||||||
|
possibleBlockNum++;
|
||||||
|
if (possibleBlockNum > canBlockNum) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (possibleBlockNum <= canBlockNum) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if (keyword.equals("Shroud") || keyword.equals("Hexproof")) {
|
} else if (keyword.equals("Shroud") || keyword.equals("Hexproof")) {
|
||||||
if (!AbilityFactory.predictThreatenedObjects(sa.getAbilityFactory()).contains(card)) {
|
if (!AbilityFactory.predictThreatenedObjects(sa.getAbilityFactory()).contains(card)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -597,13 +615,13 @@ public class AbilityFactoryPump {
|
|||||||
// is the creature blocking and unable to destroy the attacker
|
// is the creature blocking and unable to destroy the attacker
|
||||||
// or would be destroyed itself?
|
// or would be destroyed itself?
|
||||||
if (c.isBlocking()) {
|
if (c.isBlocking()) {
|
||||||
if (CombatUtil.blockerWouldBeDestroyed(c)) {
|
if (defense > 0 && CombatUtil.blockerWouldBeDestroyed(c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
CardList blockedBy = AllZone.getCombat().getAttackersBlockedBy(c);
|
CardList blockedBy = AllZone.getCombat().getAttackersBlockedBy(c);
|
||||||
// For now, Only care the first creature blocked by a card.
|
// For now, Only care the first creature blocked by a card.
|
||||||
// TODO Add in better BlockAdditional support
|
// TODO Add in better BlockAdditional support
|
||||||
if (blockedBy.size() != 0 && !CombatUtil.attackerWouldBeDestroyed(blockedBy.get(0))) {
|
if (!blockedBy.isEmpty() && attack > 0 && !CombatUtil.attackerWouldBeDestroyed(blockedBy.get(0))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user