mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Improved AI for charm and life-gain effects and removed RemAiDeck for Ojutai's Command
This commit is contained in:
@@ -98,19 +98,27 @@ public class CharmAi extends SpellAbilityAi {
|
|||||||
return sa.getChosenList();
|
return sa.getChosenList();
|
||||||
}
|
}
|
||||||
List<AbilitySub> choices = CharmEffect.makePossibleOptions(sa);
|
List<AbilitySub> choices = CharmEffect.makePossibleOptions(sa);
|
||||||
|
AbilitySub goodChoice = null;
|
||||||
List<AbilitySub> chosenList = new ArrayList<AbilitySub>();
|
List<AbilitySub> chosenList = new ArrayList<AbilitySub>();
|
||||||
// select first n playable options
|
// select first n playable options
|
||||||
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
||||||
for (AbilitySub sub : choices) {
|
for (AbilitySub sub : choices) {
|
||||||
sub.setActivatingPlayer(ai);
|
sub.setActivatingPlayer(ai);
|
||||||
if (AiPlayDecision.WillPlay == aic.canPlaySa(sub)) {
|
if ("Good".equals(sub.getParam("AILogic")) && aic.doTrigger(sub, false)) {
|
||||||
chosenList.add(sub);
|
goodChoice = sub;
|
||||||
if (chosenList.size() == min) {
|
} else {
|
||||||
break;
|
if (AiPlayDecision.WillPlay == aic.canPlaySa(sub)) {
|
||||||
|
chosenList.add(sub);
|
||||||
|
if (chosenList.size() == min) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (chosenList.size() == min - 1 && goodChoice != null) {
|
||||||
|
chosenList.add(goodChoice);
|
||||||
|
return chosenList;
|
||||||
|
}
|
||||||
if (chosenList.size() != min) {
|
if (chosenList.size() != min) {
|
||||||
return new ArrayList<AbilitySub>();
|
return new ArrayList<AbilitySub>();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import forge.game.player.Player;
|
|||||||
import forge.game.spellability.AbilitySub;
|
import forge.game.spellability.AbilitySub;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.spellability.TargetRestrictions;
|
import forge.game.spellability.TargetRestrictions;
|
||||||
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
public class LifeGainAi extends SpellAbilityAi {
|
public class LifeGainAi extends SpellAbilityAi {
|
||||||
|
|
||||||
@@ -127,7 +128,15 @@ public class LifeGainAi extends SpellAbilityAi {
|
|||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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: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: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: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: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: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
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/dromokas_command.jpg
|
||||||
|
|||||||
@@ -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: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:DBGainLife:DB$ GainLife | LifeAmount$ 4 | SpellDescription$ You gain 4 life.
|
||||||
SVar:DBCounter:DB$ Counter | TargetType$ Spell | ValidTgts$ Creature | SpellDescription$ Counter target creature spell.
|
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:DBDraw:DB$ Draw | Defined$ You | AILogic$ Good | NumCards$ 1 | SpellDescription$ Draw a card.
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/ojutais_command.jpg
|
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.
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user