mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Added AI for Living Death. Marked Living Death as RemRandomDeck instead of RemAIDeck. AILogic$ LivingDeath can probably be used for other similar cards too, possibly with some adaptation.
This commit is contained in:
@@ -38,6 +38,7 @@ import forge.game.player.Player;
|
||||
import forge.game.player.PlayerPredicates;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.item.IPaperCard;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -153,6 +154,50 @@ public class SpecialCardAi {
|
||||
}
|
||||
}
|
||||
|
||||
// Living Death (and possibly other similar cards using AILogic LivingDeath)
|
||||
public static class LivingDeath {
|
||||
public static boolean consider(Player ai, SpellAbility sa) {
|
||||
int aiBattlefieldPower = 0, aiGraveyardPower = 0;
|
||||
CardCollection aiCreaturesInGY = CardLists.filter(ai.getZone(ZoneType.Graveyard).getCards(), CardPredicates.Presets.CREATURES);
|
||||
|
||||
if (aiCreaturesInGY.isEmpty()) {
|
||||
// nothing in graveyard, so cut short
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Card c : ai.getCreaturesInPlay()) {
|
||||
if (!SpellAbilityAi.isUselessCreature(ai, c)) {
|
||||
aiBattlefieldPower += ComputerUtilCard.evaluateCreature(c);
|
||||
}
|
||||
}
|
||||
for (Card c : aiCreaturesInGY) {
|
||||
aiGraveyardPower += ComputerUtilCard.evaluateCreature(c);
|
||||
}
|
||||
|
||||
int oppBattlefieldPower = 0, oppGraveyardPower = 0; //TODO: not used yet (see below)
|
||||
List<Player> opponents = ai.getOpponents(); // TODO: not used yet (see below)
|
||||
for (Player p : opponents) {
|
||||
int playerPower = 0;
|
||||
int tempGraveyardPower = 0;
|
||||
for (Card c : p.getCreaturesInPlay()) {
|
||||
playerPower += ComputerUtilCard.evaluateCreature(c);
|
||||
}
|
||||
for (Card c : CardLists.filter(p.getZone(ZoneType.Graveyard).getCards(), CardPredicates.Presets.CREATURES)) {
|
||||
tempGraveyardPower += ComputerUtilCard.evaluateCreature(c);
|
||||
}
|
||||
if (playerPower > oppBattlefieldPower) {
|
||||
oppBattlefieldPower = playerPower;
|
||||
}
|
||||
if (tempGraveyardPower > oppGraveyardPower) {
|
||||
oppGraveyardPower = tempGraveyardPower;
|
||||
}
|
||||
}
|
||||
|
||||
// if we get more value out of this than our opponent does (hopefully), go for it
|
||||
return (aiGraveyardPower - aiBattlefieldPower) > (oppGraveyardPower - oppBattlefieldPower);
|
||||
}
|
||||
}
|
||||
|
||||
// Necropotence
|
||||
public static class Necropotence {
|
||||
public static boolean consider(Player ai, SpellAbility sa) {
|
||||
|
||||
@@ -67,8 +67,13 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
|
||||
CardCollectionView computerType = ai.getCardsIn(origin);
|
||||
computerType = AbilityUtils.filterListByType(computerType, sa.getParam("ChangeType"), sa);
|
||||
|
||||
// Living Death AI
|
||||
if ("LivingDeath".equals(sa.getParam("AILogic"))) {
|
||||
return SpecialCardAi.LivingDeath.consider(ai, sa);
|
||||
}
|
||||
|
||||
// Timetwister AI
|
||||
if (source.getName().equals("Timetwister")) {
|
||||
if ("Timetwister".equals(sa.getParam("AILogic"))) {
|
||||
return SpecialCardAi.Timetwister.consider(ai, sa);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Name:Living Death
|
||||
ManaCost:3 B B
|
||||
Types:Sorcery
|
||||
A:SP$ ChangeZoneAll | Cost$ 3 B B | ChangeType$ Creature | Origin$ Graveyard | Destination$ Exile | RememberChanged$ True | ForgetOtherRemembered$ True | SubAbility$ DBSacrifice | SpellDescription$ Each player exiles all creature cards from his or her graveyard, then sacrifices all creatures he or she controls, then puts all cards he or she exiled this way onto the battlefield.
|
||||
A:SP$ ChangeZoneAll | Cost$ 3 B B | ChangeType$ Creature | Origin$ Graveyard | Destination$ Exile | RememberChanged$ True | ForgetOtherRemembered$ True | SubAbility$ DBSacrifice | AILogic$ LivingDeath | SpellDescription$ Each player exiles all creature cards from his or her graveyard, then sacrifices all creatures he or she controls, then puts all cards he or she exiled this way onto the battlefield.
|
||||
SVar:DBSacrifice:DB$SacrificeAll | ValidCards$ Creature | SubAbility$ DBReturn
|
||||
SVar:DBReturn:DB$ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Battlefield | SubAbility$ DBCleanup
|
||||
SVar:DBCleanup:DB$Cleanup | ClearRemembered$ True
|
||||
SVar:RemAIDeck:True
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/living_death.jpg
|
||||
Oracle:Each player exiles all creature cards from his or her graveyard, then sacrifices all creatures he or she controls, then puts all cards he or she exiled this way onto the battlefield.
|
||||
|
||||
Reference in New Issue
Block a user