mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- AI support for Polukranos, World Eater
This commit is contained in:
@@ -127,6 +127,21 @@ public class CountersPutAi extends SpellAbilityAi {
|
|||||||
amount = ComputerUtilMana.determineLeftoverMana(sa, ai);
|
amount = ComputerUtilMana.determineLeftoverMana(sa, ai);
|
||||||
source.setSVar("PayX", Integer.toString(amount));
|
source.setSVar("PayX", Integer.toString(amount));
|
||||||
}
|
}
|
||||||
|
if ("Polukranos".equals(sa.getParam("AILogic"))) {
|
||||||
|
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
|
||||||
|
//TODO how to grab target restrictions from subsequent triggered ability?
|
||||||
|
if (!humCreatures.isEmpty()){
|
||||||
|
boolean canSurvive = false;
|
||||||
|
for (Card humanCreature : humCreatures) {
|
||||||
|
if (!FightAi.canKill(humanCreature, source, 0)){
|
||||||
|
canSurvive = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!canSurvive){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// don't use it if no counters to add
|
// don't use it if no counters to add
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.ai.ability;
|
|||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import forge.ai.*;
|
import forge.ai.*;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
@@ -254,6 +255,37 @@ public class DamageDealAi extends DamageAiBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("Polukranos".equals(sa.getParam("AILogic"))) {
|
||||||
|
int dmgTaken = 0;
|
||||||
|
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
|
||||||
|
Card lastTgt = null;
|
||||||
|
humCreatures = CardLists.getTargetableCards(humCreatures, sa);
|
||||||
|
ComputerUtilCard.sortByEvaluateCreature(humCreatures);
|
||||||
|
for (Card humanCreature : humCreatures) {
|
||||||
|
if (FightAi.canKill(humanCreature, source, dmgTaken)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final int assignedDamage = ComputerUtilCombat.getEnoughDamageToKill(humanCreature, dmg, source, false, noPrevention);
|
||||||
|
if (assignedDamage <= dmg) {
|
||||||
|
tcs.add(humanCreature);
|
||||||
|
tgt.addDividedAllocation(humanCreature, assignedDamage);
|
||||||
|
lastTgt = humanCreature;
|
||||||
|
}
|
||||||
|
dmg -= assignedDamage;
|
||||||
|
if (!source.hasProtectionFrom(humanCreature)) {
|
||||||
|
dmgTaken += humanCreature.getNetAttack();
|
||||||
|
}
|
||||||
|
if (dmg <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dmg > 0 && lastTgt != null) {
|
||||||
|
tgt.addDividedAllocation(lastTgt, tgt.getDividedValue(lastTgt) + dmg);
|
||||||
|
dmg = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//fall back into generic targeting due to failure to restrict targets in CountersPutAi or change in board state
|
||||||
|
}
|
||||||
while (tcs.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
while (tcs.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
||||||
if (oppTargetsChoice && sa.getActivatingPlayer().equals(ai) && !sa.isTrigger()) {
|
if (oppTargetsChoice && sa.getActivatingPlayer().equals(ai) && !sa.isTrigger()) {
|
||||||
// canPlayAI (sa activated by ai)
|
// canPlayAI (sa activated by ai)
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ Name:Polukranos, World Eater
|
|||||||
ManaCost:2 G G
|
ManaCost:2 G G
|
||||||
Types:Legendary Creature Hydra
|
Types:Legendary Creature Hydra
|
||||||
PT:5/5
|
PT:5/5
|
||||||
K:Monstrosity X:X X G
|
K:Monstrosity X:X X G | AILogic$ Polukranos
|
||||||
T:Mode$ BecomeMonstrous | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigDmg | TriggerDescription$ When CARDNAME becomes monstrous, it deals X damage divided as you choose among any number of target creatures your opponents control. Each of those creatures deals damage equal to its power to CARDNAME.
|
T:Mode$ BecomeMonstrous | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigDmg | TriggerDescription$ When CARDNAME becomes monstrous, it deals X damage divided as you choose among any number of target creatures your opponents control. Each of those creatures deals damage equal to its power to CARDNAME.
|
||||||
SVar:TrigDmg:AB$ DealDamage | Cost$ 0 | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature your opponents control distribute damage to | NumDmg$ MonstrosityX | TargetMin$ 1 | TargetMax$ MaxTgts | DividedAsYouChoose$ MonstrosityX | References$ MonstrosityX,MaxTgts | SubAbility$ DBDmg
|
SVar:TrigDmg:AB$ DealDamage | Cost$ 0 | ValidTgts$ Creature.OppCtrl | AILogic$ Polukranos | TgtPrompt$ Select target creature your opponents control distribute damage to | NumDmg$ MonstrosityX | TargetMin$ 1 | TargetMax$ MaxTgts | DividedAsYouChoose$ MonstrosityX | References$ MonstrosityX,MaxTgts | SubAbility$ DBDmg
|
||||||
SVar:DBDmg:DB$ RepeatEach | RepeatSubAbility$ PolukranosFight | UseImprinted$ True | DefinedCards$ Targeted | StackDescription$ None
|
SVar:DBDmg:DB$ RepeatEach | RepeatSubAbility$ PolukranosFight | UseImprinted$ True | DefinedCards$ Targeted | StackDescription$ None
|
||||||
SVar:PolukranosFight:DB$ DealDamage | DamageSource$ Imprinted | NumDmg$ Y | References$ Y | Defined$ Self | StackDescription$ None
|
SVar:PolukranosFight:DB$ DealDamage | DamageSource$ Imprinted | NumDmg$ Y | References$ Y | Defined$ Self | StackDescription$ None
|
||||||
SVar:X:Count$xPaid
|
SVar:X:Count$xPaid
|
||||||
SVar:Y:Imprinted$CardPower
|
SVar:Y:Imprinted$CardPower
|
||||||
SVar:MonstrosityX:Count$MonstrosityMagnitude
|
SVar:MonstrosityX:Count$MonstrosityMagnitude
|
||||||
SVar:MaxTgts:Count$Valid Creature.OppCtrl
|
SVar:MaxTgts:Count$Valid Creature.OppCtrl
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/polukranos_world_eater.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/polukranos_world_eater.jpg
|
||||||
Oracle:{X}{X}{G}: Monstrosity X. (If this creature isn't monstrous, put X +1/+1 counters on it and it becomes monstrous.) When Polukranos, World Eater becomes monstrous, it deals X damage divided as you choose among any number of target creatures your opponents control. Each of those creatures deals damage equal to its power to Polukranos.
|
Oracle:{X}{X}{G}: Monstrosity X. (If this creature isn't monstrous, put X +1/+1 counters on it and it becomes monstrous.) When Polukranos, World Eater becomes monstrous, it deals X damage divided as you choose among any number of target creatures your opponents control. Each of those creatures deals damage equal to its power to Polukranos.
|
||||||
Reference in New Issue
Block a user