mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- More work on AI logic.
This commit is contained in:
@@ -70,6 +70,7 @@ public enum AiProps { /** */
|
||||
ALWAYS_COUNTER_AURAS ("true"), /** */
|
||||
ALWAYS_COUNTER_SPELLS_FROM_NAMED_CARDS (""), /** */
|
||||
CHANCE_TO_COPY_OWN_SPELL_WHILE_ON_STACK ("30"), /** */
|
||||
ALWAYS_COPY_SPELL_IF_CMC_DIFF ("2"), /** */
|
||||
ACTIVELY_DESTROY_ARTS_AND_NONAURA_ENCHS ("true"), /** */
|
||||
ACTIVELY_DESTROY_IMMEDIATELY_UNBLOCKABLE ("false"), /** */
|
||||
DESTROY_IMMEDIATELY_UNBLOCKABLE_THRESHOLD ("2"), /** */
|
||||
|
||||
@@ -19,10 +19,24 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
|
||||
@Override
|
||||
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
|
||||
Game game = aiPlayer.getGame();
|
||||
final int chance = ((PlayerControllerAi)aiPlayer.getController()).getAi().getIntProperty(AiProps.CHANCE_TO_COPY_OWN_SPELL_WHILE_ON_STACK);
|
||||
int chance = ((PlayerControllerAi)aiPlayer.getController()).getAi().getIntProperty(AiProps.CHANCE_TO_COPY_OWN_SPELL_WHILE_ON_STACK);
|
||||
int diff = ((PlayerControllerAi)aiPlayer.getController()).getAi().getIntProperty(AiProps.ALWAYS_COPY_SPELL_IF_CMC_DIFF);
|
||||
|
||||
if (game.getStack().isEmpty()
|
||||
|| (!MyRandom.percentTrue(chance) && !"AlwaysIfViable".equals(sa.getParam("AILogic")))
|
||||
if (game.getStack().isEmpty()) {
|
||||
return sa.isMandatory();
|
||||
}
|
||||
|
||||
final SpellAbility top = game.getStack().peekAbility();
|
||||
if (top != null
|
||||
&& top.getPayCosts() != null && top.getPayCosts().getCostMana() != null
|
||||
&& sa.getPayCosts() != null && sa.getPayCosts().getCostMana() != null
|
||||
&& top.getPayCosts().getCostMana().getMana().getCMC() >= sa.getPayCosts().getCostMana().getMana().getCMC() + diff) {
|
||||
// The copied spell has a significantly higher CMC than the copy spell, consider copying
|
||||
chance = 100;
|
||||
}
|
||||
|
||||
if (!MyRandom.percentTrue(chance)
|
||||
&& !"AlwaysIfViable".equals(sa.getParam("AILogic"))
|
||||
&& !"OnceIfViable".equals(sa.getParam("AILogic"))) {
|
||||
return false;
|
||||
}
|
||||
@@ -35,7 +49,6 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
|
||||
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
if (tgt != null) {
|
||||
final SpellAbility top = game.getStack().peekAbility();
|
||||
|
||||
// Filter AI-specific targets if provided
|
||||
if ("OnlyOwned".equals(sa.getParam("AITgts"))) {
|
||||
|
||||
@@ -136,6 +136,8 @@ ALWAYS_COUNTER_SPELLS_FROM_NAMED_CARDS=None
|
||||
# Copy spell on stack logic
|
||||
# The chance that the AI will copy its own stack right after placing it there while it has priority
|
||||
CHANCE_TO_COPY_OWN_SPELL_WHILE_ON_STACK=0
|
||||
# If the copied spell costs this much more than the copy spell, the chance to copy the spell will become 100
|
||||
ALWAYS_COPY_SPELL_IF_CMC_DIFF=4
|
||||
|
||||
# Storm spell logic
|
||||
PRIORITY_REDUCTION_FOR_STORM_SPELLS=9
|
||||
|
||||
@@ -136,6 +136,8 @@ ALWAYS_COUNTER_SPELLS_FROM_NAMED_CARDS=None
|
||||
# Copy spell on stack logic
|
||||
# The chance that the AI will copy its own stack right after placing it there while it has priority
|
||||
CHANCE_TO_COPY_OWN_SPELL_WHILE_ON_STACK=30
|
||||
# If the copied spell costs this much more than the copy spell, the chance to copy the spell will become 100
|
||||
ALWAYS_COPY_SPELL_IF_CMC_DIFF=2
|
||||
|
||||
# Storm spell logic
|
||||
PRIORITY_REDUCTION_FOR_STORM_SPELLS=0
|
||||
|
||||
@@ -136,6 +136,8 @@ ALWAYS_COUNTER_SPELLS_FROM_NAMED_CARDS=None
|
||||
# Copy spell on stack logic
|
||||
# The chance that the AI will copy its own stack right after placing it there while it has priority
|
||||
CHANCE_TO_COPY_OWN_SPELL_WHILE_ON_STACK=30
|
||||
# If the copied spell costs this much more than the copy spell, the chance to copy the spell will become 100
|
||||
ALWAYS_COPY_SPELL_IF_CMC_DIFF=2
|
||||
|
||||
# Storm spell logic
|
||||
PRIORITY_REDUCTION_FOR_STORM_SPELLS=9
|
||||
|
||||
@@ -136,6 +136,8 @@ ALWAYS_COUNTER_SPELLS_FROM_NAMED_CARDS=None
|
||||
# Copy spell on stack logic
|
||||
# The chance that the AI will copy its own stack right after placing it there while it has priority
|
||||
CHANCE_TO_COPY_OWN_SPELL_WHILE_ON_STACK=50
|
||||
# If the copied spell costs this much more than the copy spell, the chance to copy the spell will become 100
|
||||
ALWAYS_COPY_SPELL_IF_CMC_DIFF=1
|
||||
|
||||
# Storm spell logic
|
||||
PRIORITY_REDUCTION_FOR_STORM_SPELLS=0
|
||||
|
||||
@@ -6,8 +6,8 @@ K:Level up:1 U
|
||||
SVar:maxLevel:4
|
||||
S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 2 | SetToughness$ 4 | AddAbility$ CopyOnce | CheckSVar$ X | SVarCompare$ EQ1 | Description$ LEVEL 2-3 2/4 CARDNAME gets U U,tap: Copy target instant or sorcery spell. You may choose new targets for the copy.
|
||||
S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 2 | SetToughness$ 5 | AddAbility$ CopyTwice | CheckSVar$ Y | SVarCompare$ EQ1 | Description$ LEVEL 4+ 2/5 CARDNAME gets U U,tap:Copy target instant or sorcery spell twice. You may choose new targets for the copies.
|
||||
SVar:CopyOnce:AB$CopySpellAbility | Cost$ U U T | ValidTgts$ Instant,Sorcery | SpellDescription$ Copy target instant or sorcery spell. You may choose new targets for the copy.
|
||||
SVar:CopyTwice:AB$CopySpellAbility | Cost$ U U T | ValidTgts$ Instant,Sorcery | Amount$ 2 | SpellDescription$ Copy target instant or sorcery spell twice. You may choose new targets for the copies.
|
||||
SVar:CopyOnce:AB$CopySpellAbility | Cost$ U U T | ValidTgts$ Instant,Sorcery | AILogic$ OnceIfViable | SpellDescription$ Copy target instant or sorcery spell. You may choose new targets for the copy.
|
||||
SVar:CopyTwice:AB$CopySpellAbility | Cost$ U U T | ValidTgts$ Instant,Sorcery | Amount$ 2 | AILogic$ OnceIfViable | SpellDescription$ Copy target instant or sorcery spell twice. You may choose new targets for the copies.
|
||||
SVar:X:Count$Valid Card.Self+counters_GE2_LEVEL+counters_LT4_LEVEL
|
||||
SVar:Y:Count$Valid Card.Self+counters_GE4_LEVEL
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/echo_mage.jpg
|
||||
|
||||
@@ -2,6 +2,7 @@ Name:Geistblast
|
||||
ManaCost:2 R
|
||||
Types:Instant
|
||||
A:SP$ DealDamage | Cost$ 2 R | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to any target.
|
||||
A:AB$ CopySpellAbility | Cost$ 2 U ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Instant.YouCtrl,Sorcery.YouCtrl | TargetType$ Spell | SpellDescription$ Copy target instant or sorcery spell you control. You may choose new targets for the copy.
|
||||
A:AB$ CopySpellAbility | Cost$ 2 U ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Instant.YouCtrl,Sorcery.YouCtrl | TargetType$ Spell | SpellDescription$ Copy target instant or sorcery spell you control. You may choose new targets for the copy.
|
||||
SVar:AIPreference:ExileFromGraveCost$Card.Self
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/geistblast.jpg
|
||||
Oracle:Geistblast deals 2 damage to any target.\n{2}{U}, Exile Geistblast from your graveyard: Copy target instant or sorcery spell you control. You may choose new targets for the copy.
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:U R
|
||||
Types:Creature Human Wizard
|
||||
PT:2/2
|
||||
A:AB$ Draw | Cost$ 3 U T | NumCards$ 1 | SpellDescription$ Draw a card.
|
||||
A:AB$ CopySpellAbility | Cost$ X R T | ValidTgts$ Instant.YouCtrl,Sorcery.YouCtrl | TargetType$ Spell | SpellDescription$ Copy target instant or sorcery spell you control with converted mana cost X. You may choose new targets for the copy.
|
||||
A:AB$ CopySpellAbility | Cost$ X R T | ValidTgts$ Instant.YouCtrl,Sorcery.YouCtrl | TargetType$ Spell | AILogic$ OnceIfViable | SpellDescription$ Copy target instant or sorcery spell you control with converted mana cost X. You may choose new targets for the copy.
|
||||
SVar:X:Targeted$CardManaCost
|
||||
DeckHints:Type$Instant|Sorcery
|
||||
Oracle:{3}{U}, {T}: Draw a card.\n{X}{R}, {T}: Copy target instant or sorcery spell you control with converted mana cost X. You may choose new targets for the copy.
|
||||
|
||||
@@ -2,6 +2,6 @@ Name:Meletis Charlatan
|
||||
ManaCost:2 U
|
||||
Types:Creature Human Wizard
|
||||
PT:2/3
|
||||
A:AB$ CopySpellAbility | Cost$ 2 U T | ValidTgts$ Instant,Sorcery | TargetType$ Spell | Controller$ TargetedController | SpellDescription$ The controller of target instant or sorcery spell copies it. That player may choose new targets for the copy.
|
||||
A:AB$ CopySpellAbility | Cost$ 2 U T | ValidTgts$ Instant,Sorcery | TargetType$ Spell | Controller$ TargetedController | AILogic$ OnceIfViable | AITgts$ OwnedOnly | SpellDescription$ The controller of target instant or sorcery spell copies it. That player may choose new targets for the copy.
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/meletis_charlatan.jpg
|
||||
Oracle:{2}{U}, {T}: The controller of target instant or sorcery spell copies it. That player may choose new targets for the copy.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Name:Mirror Sheen
|
||||
ManaCost:1 UR UR
|
||||
Types:Enchantment
|
||||
A:AB$ CopySpellAbility | Cost$ 1 UR UR | ValidTgts$ Instant,Sorcery | TargetType$ Spell | TargetValidTargeting$ You | SpellDescription$ Copy target instant or sorcery spell that targets you. You may choose new targets for the copy.
|
||||
A:AB$ CopySpellAbility | Cost$ 1 UR UR | ValidTgts$ Instant,Sorcery | TargetType$ Spell | TargetValidTargeting$ You | AILogic$ AlwaysIfViable | SpellDescription$ Copy target instant or sorcery spell that targets you. You may choose new targets for the copy.
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/mirror_sheen.jpg
|
||||
Oracle:{1}{U/R}{U/R}: Copy target instant or sorcery spell that targets you. You may choose new targets for the copy.
|
||||
|
||||
@@ -3,5 +3,5 @@ ManaCost:U R
|
||||
Types:Legendary Creature Human Artificer
|
||||
PT:1/3
|
||||
K:Haste
|
||||
A:AB$ CopySpellAbility | Cost$ U R T | TargetType$ Activated.YouCtrl,Triggered.YouCtrl | ValidTgts$ Artifact | SpellDescription$ Copy target activated or triggered ability you control from an artifact source. You may choose new targets for the copy. (Mana abilities can't be targeted.)
|
||||
A:AB$ CopySpellAbility | Cost$ U R T | TargetType$ Activated.YouCtrl,Triggered.YouCtrl | ValidTgts$ Artifact | AILogic$ OnceIfViable | SpellDescription$ Copy target activated or triggered ability you control from an artifact source. You may choose new targets for the copy. (Mana abilities can't be targeted.)
|
||||
Oracle:Haste\n{U}{R}, {T}: Copy target activated or triggered ability you control from an artifact source. You may choose new targets for the copy. (Mana abilities can't be targeted.)
|
||||
|
||||
Reference in New Issue
Block a user