- Adding second ability for Animation Module, marking it not for AI since PutCounters needs AI for new mode AND chooseCounters needs some AI depending on the target.

This commit is contained in:
Sol
2016-09-24 14:01:08 +00:00
parent 9e7b4a477e
commit 619b4ce3fa
2 changed files with 48 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -29,7 +30,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
final Card card = sa.getHostCard();
final boolean dividedAsYouChoose = sa.hasParam("DividedAsYouChoose");
final CounterType cType = CounterType.valueOf(sa.getParam("CounterType"));
final int amount = AbilityUtils.calculateAmount(card, sa.getParam("CounterNum"), sa);
if (sa.hasParam("Bolster")) {
sb.append("Bolster ").append(amount);
@@ -43,7 +44,16 @@ public class CountersPutEffect extends SpellAbilityEffect {
if (sa.hasParam("UpTo")) {
sb.append("up to ");
}
sb.append(amount).append(" ").append(cType.getName()).append(" counter");
sb.append(amount).append(" ");
String type = sa.getParam("CounterType");
if (type.equals("ExistingCounter")) {
sb.append("of an existing counter");
} else {
sb.append( CounterType.valueOf(type).getName()).append(" counter");
}
if (amount != 1) {
sb.append("s");
}
@@ -77,13 +87,17 @@ public class CountersPutEffect extends SpellAbilityEffect {
final Card card = sa.getHostCard();
final Player activator = sa.getActivatingPlayer();
CounterType counterType;
String strTyp = sa.getParam("CounterType");
CounterType counterType = null;
boolean existingCounter = strTyp.equals("ExistingCounter");
try {
counterType = AbilityUtils.getCounterType(sa.getParam("CounterType"), sa);
} catch (Exception e) {
System.out.println("Counter type doesn't match, nor does an SVar exist with the type name.");
return;
if (!existingCounter) {
try {
counterType = AbilityUtils.getCounterType(strTyp, sa);
} catch (Exception e) {
System.out.println("Counter type doesn't match, nor does an SVar exist with the type name.");
return;
}
}
final boolean etbcounter = sa.hasParam("ETB");
@@ -108,6 +122,30 @@ public class CountersPutEffect extends SpellAbilityEffect {
}
for (final GameObject obj : tgtObjects) {
if (existingCounter) {
final List<CounterType> choices = new ArrayList<CounterType>();
if (obj instanceof Card) {
for (final CounterType ct : ((Card) obj).getCounters().keySet()) {
if (((Card) obj).getCounters(ct) > 0) {
choices.add(ct);
}
}
}
else if (obj instanceof Player) {
for (final CounterType ct : ((Player) obj).getCounters().keySet()) {
if (((Player) obj).getCounters(ct) > 0) {
choices.add(ct);
}
}
}
if (choices.isEmpty()) {
continue;
}
counterType = choices.size() == 1 ? choices.get(0) : activator.getController().chooseCounterType(choices, sa, "Select counter type to add");
}
if (obj instanceof Card) {
Card tgtCard = (Card) obj;
counterAmount = sa.usesTargeting() && sa.hasParam("DividedAsYouChoose") ? sa.getTargetRestrictions().getDividedValue(tgtCard) : counterAmount;

View File

@@ -3,6 +3,8 @@ ManaCost:1
Types:Artifact
T:Mode$ CounterAddedOnce | ValidCard$ Permanent.YouCtrl | TriggerZones$ Battlefield | CounterType$ P1P1 | Execute$ TrigToken | TriggerDescription$ Whenever one or more +1/+1 counters are placed on a permanent you control, you may pay {1}. If you do, create a 1/1 colorless Servo artifact creature token.
SVar:TrigToken:AB$ Token | Cost$ 1 | TokenAmount$ 1 | TokenName$ Servo | TokenTypes$ Artifact,Creature,Servo | TokenOwner$ You | TokenColors$ Colorless | TokenPower$ 1 | TokenToughness$ 1 | TokenImage$ c 1 1 servo | TokenAltImages$ c_1_1_servo2,c_1_1_servo3
A:AB$ PutCounter | Cost$ 3 T | ValidTgts$ Permanent,Player | TgtPrompt$ Select target player or permanent | CounterType$ ExistingCounter | CounterNum$ 1 | SpellDescription$ Choose a counter on target permanent or player. Give that permanent or player another counter of that kind.
DeckHints:Ability$Counters
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/animation_module.jpg
Oracle:Whenever one or more +1/+1 counters are placed on a permanent you control, you may pay {1}. If you do, create a 1/1 colorless Servo artifact creature token.\n{3}, {T}: Choose a counter on target permanent or player. Give that permanent or player another counter of that kind.