- Improved AI for charm and life-gain effects and removed RemAiDeck for Ojutai's Command

This commit is contained in:
excessum
2015-08-17 13:01:49 +00:00
parent 368d98fd98
commit 8f90f5532b
4 changed files with 25 additions and 9 deletions

View File

@@ -98,11 +98,15 @@ public class CharmAi extends SpellAbilityAi {
return sa.getChosenList();
}
List<AbilitySub> choices = CharmEffect.makePossibleOptions(sa);
AbilitySub goodChoice = null;
List<AbilitySub> chosenList = new ArrayList<AbilitySub>();
// select first n playable options
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
for (AbilitySub sub : choices) {
sub.setActivatingPlayer(ai);
if ("Good".equals(sub.getParam("AILogic")) && aic.doTrigger(sub, false)) {
goodChoice = sub;
} else {
if (AiPlayDecision.WillPlay == aic.canPlaySa(sub)) {
chosenList.add(sub);
if (chosenList.size() == min) {
@@ -110,7 +114,11 @@ public class CharmAi extends SpellAbilityAi {
}
}
}
}
if (chosenList.size() == min - 1 && goodChoice != null) {
chosenList.add(goodChoice);
return chosenList;
}
if (chosenList.size() != min) {
return new ArrayList<AbilitySub>();
} else {

View File

@@ -11,6 +11,7 @@ import forge.game.player.Player;
import forge.game.spellability.AbilitySub;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.util.MyRandom;
public class LifeGainAi extends SpellAbilityAi {
@@ -127,7 +128,15 @@ public class LifeGainAi extends SpellAbilityAi {
return false;
}
}
// Save instant-speed life-gain unless it is really worth it
if (!SpellAbilityAi.isSorcerySpeed(sa)) {
final float value = 0.9f * lifeAmount / life;
if (value < 0.2f) {
return false;
} else {
return MyRandom.getRandom().nextFloat() < value;
}
}
return true;
}

View File

@@ -8,7 +8,7 @@ SVar:PreventDmg:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Stack | A
SVar:TargetMoved:Mode$ ChangesZone | Origin$ Stack | Destination$ Any | ValidCard$ Card.IsRemembered | Execute$ ExileEffect | TriggerZones$ Command | Static$ True
SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile
SVar:DBSacrifice:DB$ Sacrifice | ValidTgts$ Player | SacValid$ Enchantment | SacMessage$ Enchantment | SpellDescription$ Target player sacrifices an enchantment.
SVar:DBPutCounter:DB$ PutCounter | ValidTgts$ Creature | TgtPrompt$ Select target creature | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on target creature.
SVar:DBPutCounter:DB$ PutCounter | ValidTgts$ Creature | TgtPrompt$ Select target creature | AILogic$ Good | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on target creature.
SVar:DBPump:DB$ Pump | ValidTgts$ Creature.YouCtrl | AILogic$ Fight | TgtPrompt$ Choose target creature you control | StackDescription$ None | SubAbility$ DBFight | SpellDescription$ Target creature you control fights target creature you don't control.
SVar:DBFight:DB$ Fight | Defined$ ParentTarget | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Choose target creature you don't control
SVar:Picture:http://www.wizards.com/global/images/magic/general/dromokas_command.jpg

View File

@@ -5,7 +5,6 @@ A:SP$ Charm | Cost$ 2 W U | Choices$ DBReturn,DBGainLife,DBCounter,DBDraw | Char
SVar:DBReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Creature.YouCtrl+cmcLE2 | TgtPrompt$ Select target creature card with converted mana cost 2 or less | SpellDescription$ Return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.
SVar:DBGainLife:DB$ GainLife | LifeAmount$ 4 | SpellDescription$ You gain 4 life.
SVar:DBCounter:DB$ Counter | TargetType$ Spell | ValidTgts$ Creature | SpellDescription$ Counter target creature spell.
SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ 1 | SpellDescription$ Draw a card.
SVar:RemAIDeck:True
SVar:DBDraw:DB$ Draw | Defined$ You | AILogic$ Good | NumCards$ 1 | SpellDescription$ Draw a card.
SVar:Picture:http://www.wizards.com/global/images/magic/general/ojutais_command.jpg
Oracle:Choose two -\n• Return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.\n• You gain 4 life.\n• Counter target creature spell.\n• Draw a card.