- More Improvements of AI for Auras with "AILogic$ Curse".

This commit is contained in:
Sloth
2012-11-15 22:02:36 +00:00
parent a1b9e6cf88
commit 9c6c018061
8 changed files with 33 additions and 26 deletions

View File

@@ -3,7 +3,7 @@ ManaCost:1 W W U
Types:Instant
Text:no text
A:SP$ Pump | Cost$ 1 W W U | ValidTgts$ Creature | TgtPrompt$ Select target creature whose combat damage will be prevented | KW$ HIDDEN Prevent all combat damage that would be dealt by CARDNAME. | SubAbility$ DBPump | SpellDescription$ Prevent all combat damage target creature would deal this turn.
SVar:DBPump:DB$Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature that will have all damage dealt to it prevented | KW$ HIDDEN Prevent all damage that would be dealt to CARDNAME. | SpellDescription$ Prevent all combat damage that would be dealt to target creature this turn.
SVar:DBPump:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature that will have all damage dealt to it prevented | KW$ HIDDEN Prevent all damage that would be dealt to CARDNAME. | SpellDescription$ Prevent all combat damage that would be dealt to target creature this turn.
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/azorius_ploy.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
K:Enchant creature or land
A:SP$ Attach | Cost$ 2 B B | ValidTgts$ Creature,Land | AILogic$ Curse
T:Mode$ Taps | ValidCard$ Card.AttachedBy | Execute$ TrigDestroy | TriggerDescription$ When enchanted permanent becomes tapped, destroy it.
SVar:TrigDestroy:AB$Destroy | Cost$ 0 | Defined$ TriggeredCard
SVar:TrigDestroy:AB$ Destroy | Cost$ 0 | Defined$ TriggeredCard
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/brink_of_disaster.jpg
SetInfo:M12|Common|http://magiccards.info/scans/en/m12/84.jpg

View File

@@ -7,7 +7,7 @@ A:SP$ Attach | Cost$ 1 B | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select targe
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddTrigger$ TrigPump | AddSVar$ Pump & DBDiscard | Description$ Whenever enchanted creature attacks and isn't blocked, you may have it assign no combat damage this turn. If you do, defending player discards a card at random.
SVar:TrigPump:Mode$ AttackerUnblocked | ValidCard$ Card.Self | Execute$ Pump | OptionalDecider$ You | TriggerDescription$ Whenever enchanted creature attacks and isn't blocked, you may have it assign no combat damage this turn. If you do, defending player discards a card at random.
SVar:Pump:AB$Pump | Cost$ 0 | Defined$ Self | KW$ HIDDEN Prevent all combat damage that would be dealt by CARDNAME. | SubAbility$ DBDiscard
SVar:DBDiscard:DB$Discard | Defined$ DefendingPlayer | Mode$ Random | NumCards$ 1
SVar:DBDiscard:DB$ Discard | Defined$ DefendingPlayer | Mode$ Random | NumCards$ 1
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/cloak_of_confusion.jpg

View File

@@ -1,14 +1,14 @@
Name:Corrupted Roots
ManaCost:B
Types:Enchantment Aura
Text:no text
K:Enchant land
A:SP$ Attach | Cost$ B | ValidTgts$ Forest,Plains | TgtPrompt$ Select target Forest or Plains | AILogic$ Curse
T:Mode$ Taps | ValidCard$ Card.AttachedBy | TriggerZones$ Battlefield | Execute$ TrigLose | TriggerDescription$ Whenever enchanted land becomes tapped, its controller loses 2 life.
SVar:TrigLose:AB$LoseLife | Cost$ 0 | Defined$ TriggeredCardController | LifeAmount$ 2
SVar:RemRandomDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/corrupted_roots.jpg
Oracle:Enchant Forest or Plains\nWhenever enchanted land becomes tapped, its controller loses 2 life.
SetInfo:CFX|Uncommon|http://magiccards.info/scans/en/cfx/41.jpg
Name:Corrupted Roots
ManaCost:B
Types:Enchantment Aura
Text:no text
K:Enchant land
A:SP$ Attach | Cost$ B | ValidTgts$ Forest,Plains | TgtPrompt$ Select target Forest or Plains | AILogic$ Curse
T:Mode$ Taps | ValidCard$ Card.AttachedBy | TriggerZones$ Battlefield | Execute$ TrigLose | TriggerDescription$ Whenever enchanted land becomes tapped, its controller loses 2 life.
SVar:TrigLose:AB$ LoseLife | Cost$ 0 | Defined$ TriggeredCardController | LifeAmount$ 2
SVar:RemRandomDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/corrupted_roots.jpg
Oracle:Enchant Forest or Plains\nWhenever enchanted land becomes tapped, its controller loses 2 life.
SetInfo:CFX|Uncommon|http://magiccards.info/scans/en/cfx/41.jpg
End

View File

@@ -6,7 +6,7 @@ K:Enchant creature
A:SP$ Attach | Cost$ GU W | ValidTgts$ Creature | AILogic$ Curse
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ HIDDEN CARDNAME can't attack or block. | Description$ Enchanted creature can't attack or block.
T:Mode$ BecomesTarget | ValidTarget$ Card.AttachedBy | TriggerZones$ Battlefield | Execute$ TrigExile | TriggerDescription$ When enchanted creature becomes the target of a spell or ability, exile that creature.
SVar:TrigExile:AB$ChangeZone | Cost$ 0 | Defined$ TriggeredTarget | Origin$ Battlefield | Destination$ Exile
SVar:TrigExile:AB$ ChangeZone | Cost$ 0 | Defined$ TriggeredTarget | Origin$ Battlefield | Destination$ Exile
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/crystallization.jpg
SetInfo:ARB|Common|http://magiccards.info/scans/en/arb/144.jpg

View File

@@ -5,8 +5,8 @@ Text:no text
K:Enchant creature
A:SP$ Attach | Cost$ B | ValidTgts$ Creature | AILogic$ Curse
T:Mode$ ChangesZone | ValidCard$ Card.AttachedBy | Origin$ Battlefield | Destination$ Graveyard | TriggerZones$ Battlefield | Execute$ TrigLose | TriggerDescription$ When enchanted creature dies, its controller loses life equal to its power and you gain life equal to its toughness.
SVar:TrigLose:AB$LoseLife | Cost$ 0 | Defined$ TriggeredCardController | LifeAmount$ X | SubAbility$ DBGainLife
SVar:DBGainLife:DB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ Y
SVar:TrigLose:AB$ LoseLife | Cost$ 0 | Defined$ TriggeredCardController | LifeAmount$ X | SubAbility$ DBGainLife
SVar:DBGainLife:DB$ GainLife | Cost$ 0 | Defined$ You | LifeAmount$ Y
SVar:X:TriggeredCard$CardPower
SVar:Y:TriggeredCard$CardToughness
SVar:Rarity:Common

View File

@@ -6,7 +6,7 @@ K:Enchant black creature
A:SP$ Attach | Cost$ 1 G | ValidTgts$ Creature.Black | AILogic$ Curse
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddKeyword$ Cumulative upkeep:PayLife<1>:Pay 1 life. | Description$ Enchanted creature has "Cumulative upkeep-Pay 1 life." (At the beginning of its controller's upkeep, that player puts an age counter on it, then sacrifices it unless he or she pays its upkeep cost for each age counter on it.)
T:Mode$ ChangesZone | ValidCard$ Card.AttachedBy | Origin$ Battlefield | Destination$ Graveyard | TriggerZones$ Battlefield | Execute$ TrigLose | TriggerDescription$ When enchanted creature dies, its controller loses 2 life.
SVar:TrigLose:AB$LoseLife | Cost$ 0 | Defined$ TriggeredCardController | LifeAmount$ 2
SVar:TrigLose:AB$ LoseLife | Cost$ 0 | Defined$ TriggeredCardController | LifeAmount$ 2
SVar:RemRandomDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/decomposition.jpg

View File

@@ -374,9 +374,8 @@ public class AttachAi extends SpellAiLogic {
}
int totToughness = 0;
// int totPower = 0;
int totPower = 0;
final ArrayList<String> keywords = new ArrayList<String>();
// boolean grantingAbilities = false;
for (final StaticAbility stAbility : attachSource.getStaticAbilities()) {
final Map<String, String> stabMap = stAbility.getMapParams();
@@ -392,10 +391,7 @@ public class AttachAi extends SpellAiLogic {
}
if ((affected.contains(stCheck) || affected.contains("AttachedBy"))) {
totToughness += CardFactoryUtil.parseSVar(attachSource, stabMap.get("AddToughness"));
// totPower += CardFactoryUtil.parseSVar(attachSource,
// sa.get("AddPower"));
// grantingAbilities |= sa.containsKey("AddAbility");
totPower += CardFactoryUtil.parseSVar(attachSource, stabMap.get("AddPower"));
String kws = stabMap.get("AddKeyword");
if (kws != null) {
@@ -445,6 +441,13 @@ public class AttachAi extends SpellAiLogic {
return containsUsefulCurseKeyword(keywords, c, sa);
}
});
} else if (totPower < 0){
prefList = CardLists.filter(prefList, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return CombatUtil.canAttackNextTurn(c) && c.getNetAttack() > 0;
}
});
}
c = CardFactoryUtil.getBestAI(prefList);
@@ -954,6 +957,10 @@ public class AttachAi extends SpellAiLogic {
}
}
return false;
} else if (keyword.endsWith("Prevent all combat damage that would be dealt by CARDNAME.")) {
if (!CombatUtil.canAttackNextTurn(card) || card.getNetCombatDamage() < 1) {
return false;
}
}
return true;
}