- A simpler implementation for Tilonalli, using AITgts.

This commit is contained in:
Agetian
2018-11-15 17:16:01 +03:00
parent b3f66d2b64
commit c98ad6a097
2 changed files with 5 additions and 23 deletions

View File

@@ -905,28 +905,6 @@ public class AttachAi extends SpellAbilityAi {
});
}
// Look for triggers that will damage the creature and remove AI-owned creatures that will die
CardCollection toRemove = new CardCollection();
for (Trigger t : attachSource.getTriggers()) {
if (t.getMode() == TriggerType.ChangesZone) {
final Map<String, String> params = t.getMapParams();
if ("Card.Self".equals(params.get("ValidCard")) && "Battlefield".equals(params.get("Destination"))) {
SpellAbility trigSa = AbilityFactory.getAbility(attachSource.getSVar(params.get("Execute")), attachSource);
if (trigSa.getApi() == ApiType.DealDamage && "Enchanted".equals(trigSa.getParam("Defined"))) {
for (Card target : list) {
if (!target.getController().isOpponentOf(ai)) {
int numDmg = AbilityUtils.calculateAmount(target, trigSa.getParam("NumDmg"), trigSa);
if (target.getNetToughness() <= numDmg) {
toRemove.add(target);
}
}
}
}
}
}
}
list.removeAll(toRemove);
if (magnetList != null) {
// Look for Heroic triggers
@@ -1014,6 +992,10 @@ public class AttachAi extends SpellAbilityAi {
}
CardCollection prefList = new CardCollection(list);
// Filter AI-specific targets if provided
prefList = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, false);
if (totToughness < 0) {
// Don't kill my own stuff with Negative toughness Auras
final int tgh = totToughness;

View File

@@ -2,7 +2,7 @@ Name:Tilonalli's Crown
ManaCost:1 R
Types:Enchantment Aura
K:Enchant creature
A:SP$ Attach | Cost$ 1 R | ValidTgts$ Creature | AILogic$ Pump
A:SP$ Attach | Cost$ 1 R | ValidTgts$ Creature | AILogic$ Pump | AITgts$ Creature.YouCtrl+toughnessGT1
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigDealDamage | TriggerDescription$ When CARDNAME enters the battlefield, it deals 1 damage to enchanted creature.
SVar:TrigDealDamage:DB$ DealDamage | Defined$ Enchanted | NumDmg$ 1
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 3 | AddKeyword$ Trample | Description$ Enchanted creature gets +3/+0 and has trample.