Merge branch 'master' into 'master'

Fix Sorin, Vengeful Bloodlord and implement a basic AI for it.

See merge request core-developers/forge!1818
This commit is contained in:
Michael Kamensky
2019-06-09 14:08:32 +00:00
3 changed files with 41 additions and 2 deletions

View File

@@ -1126,6 +1126,44 @@ public class SpecialCardAi {
} }
} }
// Sorin, Vengeful Bloodlord
public static class SorinVengefulBloodlord {
public static boolean consider(final Player ai, final SpellAbility sa) {
int loyalty = sa.getHostCard().getCounters(CounterType.LOYALTY);
CardCollection creaturesToGet = CardLists.filter(ai.getCardsIn(ZoneType.Graveyard),
Predicates.and(CardPredicates.Presets.CREATURES, CardPredicates.lessCMC(loyalty - 1), new Predicate<Card>() {
@Override
public boolean apply(Card card) {
final Card copy = CardUtil.getLKICopy(card);
ComputerUtilCard.applyStaticContPT(ai.getGame(), copy, null);
return copy.getNetToughness() > 0;
}
}));
CardLists.sortByCmcDesc(creaturesToGet);
if (creaturesToGet.isEmpty()) {
return false;
}
// pick the best creature that will stay on the battlefield
Card best = creaturesToGet.getFirst();
for (Card c : creaturesToGet) {
if (best != c && ComputerUtilCard.evaluateCreature(c, true, false) >
ComputerUtilCard.evaluateCreature(best, true, false)) {
best = c;
}
}
if (best != null) {
sa.resetTargets();
sa.getTargets().add(best);
return true;
}
return false;
}
}
// Survival of the Fittest // Survival of the Fittest
public static class SurvivalOfTheFittest { public static class SurvivalOfTheFittest {
public static Card considerDiscardTarget(final Player ai) { public static Card considerDiscardTarget(final Player ai) {

View File

@@ -121,6 +121,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
return SpecialCardAi.LivingDeath.consider(aiPlayer, sa); return SpecialCardAi.LivingDeath.consider(aiPlayer, sa);
} else if (aiLogic.equals("TheScarabGod")) { } else if (aiLogic.equals("TheScarabGod")) {
return SpecialCardAi.TheScarabGod.consider(aiPlayer, sa); return SpecialCardAi.TheScarabGod.consider(aiPlayer, sa);
} else if (aiLogic.equals("SorinVengefulBloodlord")) {
return SpecialCardAi.SorinVengefulBloodlord.consider(aiPlayer, sa);
} else if (aiLogic.equals("Intuition")) { } else if (aiLogic.equals("Intuition")) {
// This logic only fills the multiple cards array, the decision to play is made // This logic only fills the multiple cards array, the decision to play is made
// separately in hiddenOriginCanPlayAI later. // separately in hiddenOriginCanPlayAI later.

View File

@@ -5,8 +5,7 @@ Loyalty:4
S:Mode$ Continuous | Affected$ Creature.YouCtrl,Planeswalker.YouCtrl | AddKeyword$ Lifelink | Condition$ PlayerTurn | Description$ As long as it's your turn, creatures and planeswalkers you control have lifelink. S:Mode$ Continuous | Affected$ Creature.YouCtrl,Planeswalker.YouCtrl | AddKeyword$ Lifelink | Condition$ PlayerTurn | Description$ As long as it's your turn, creatures and planeswalkers you control have lifelink.
SVar:NonStackingEffect:True SVar:NonStackingEffect:True
A:AB$ DealDamage | Cost$ AddCounter<2/LOYALTY> | Planeswalker$ True | ValidTgts$ Player,Planeswalker | TgtPrompt$ Select target player or planeswalker | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target player or planeswalker. A:AB$ DealDamage | Cost$ AddCounter<2/LOYALTY> | Planeswalker$ True | ValidTgts$ Player,Planeswalker | TgtPrompt$ Select target player or planeswalker | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target player or planeswalker.
A:AB$ ChangeZone | Cost$ SubCounter<X/LOYALTY> | Planeswalker$ True | Origin$ Graveyard | Destination$ Battlefield | Announce$ X | References$ X | ValidTgts$ Creature.YouOwn | TgtPrompt$ Select target creature with converted mana cost X from your graveyard | SubAbility$ Animate | SpellDescription$ Return target creature card with converted mana cost X from your graveyard to the battlefield. That creature is a Vampire in addition to its other types. A:AB$ ChangeZone | Cost$ SubCounter<X/LOYALTY> | Planeswalker$ True | Origin$ Graveyard | Destination$ Battlefield | References$ X | ValidTgts$ Creature.YouOwn | AILogic$ SorinVengefulBloodlord | TgtPrompt$ Select target creature with converted mana cost X from your graveyard | SubAbility$ Animate | SpellDescription$ Return target creature card with converted mana cost X from your graveyard to the battlefield. That creature is a Vampire in addition to its other types.
SVar:Animate:DB$ Animate | Defined$ Targeted | Types$ Vampire | Permanent$ True SVar:Animate:DB$ Animate | Defined$ Targeted | Types$ Vampire | Permanent$ True
SVar:X:Targeted$CardManaCost SVar:X:Targeted$CardManaCost
AI:RemoveDeck:All
Oracle:As long as it's your turn, creatures and planeswalkers you control have lifelink.\n[+2]: Sorin, Vengeful Bloodlord deals 1 damage to target player or planeswalker.\n-X: Return target creature card with converted mana cost X from your graveyard to the battlefield. That creature is a Vampire in addition to its other types. Oracle:As long as it's your turn, creatures and planeswalkers you control have lifelink.\n[+2]: Sorin, Vengeful Bloodlord deals 1 damage to target player or planeswalker.\n-X: Return target creature card with converted mana cost X from your graveyard to the battlefield. That creature is a Vampire in addition to its other types.