- Convert Goblin Charbelcher to script

This commit is contained in:
Sol
2012-12-03 01:28:23 +00:00
parent 4ea6b214d6
commit 9f72901b40
3 changed files with 8 additions and 85 deletions

View File

@@ -146,6 +146,7 @@ public class DigUntilEffect extends SpellEffect {
}
}
// TODO Use getOrderChoices before this moveTo call for the Human
final Iterator<Card> itr = revealed.iterator();
while (itr.hasNext()) {
final Card c = itr.next();

View File

@@ -149,91 +149,6 @@ class CardFactoryArtifacts {
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Goblin Charbelcher")) {
final Cost abCost = new Cost(card, "3 T", true);
class AbilityGoblinCharbelcher extends AbilityActivated {
public AbilityGoblinCharbelcher(final Card ca, final Cost co, final Target t) {
super(ca, co, t);
}
@Override
public AbilityActivated getCopy() {
AbilityActivated res = new AbilityGoblinCharbelcher(getSourceCard(),
getPayCosts(), getTarget() == null ? null : new Target(getTarget()));
CardFactoryUtil.copySpellAbility(this, res);
return res;
}
private static final long serialVersionUID = -840041589720758423L;
@Override
public boolean canPlayAI() {
this.getTarget().resetTargets();
final List<Card> libList = getActivatingPlayer().getCardsIn(ZoneType.Library);
return !libList.isEmpty() && ComputerUtil.targetHumanAI(this);
}
@Override
public void resolve() {
final List<Card> topOfLibrary = card.getController().getCardsIn(ZoneType.Library);
final List<Card> revealed = new ArrayList<Card>();
if (topOfLibrary.size() == 0) {
return;
}
int damage = 0;
int count = 0;
Card c = null;
Card crd;
while (c == null) {
revealed.add(topOfLibrary.get(count));
crd = topOfLibrary.get(count++);
if (crd.isLand() || (count == topOfLibrary.size())) {
c = crd;
damage = count;
if (crd.isLand()) {
damage--;
}
if (crd.isType("Mountain")) {
damage *= 2;
}
}
} // while
GuiChoose.oneOrNone("Revealed cards:", revealed);
for (final Card revealedCard : revealed) {
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(revealedCard);
}
if (this.getTargetCard() != null) {
if (this.getTargetCard().isInPlay()
&& this.getTargetCard().canBeTargetedBy(this)) {
this.getTargetCard().addDamage(damage, card);
}
} else {
this.getTargetPlayer().addDamage(damage, card);
}
}
}
final AbilityActivated ability = new AbilityGoblinCharbelcher(card, abCost, new Target(card, "TgtCP"));
final StringBuilder sb = new StringBuilder();
sb.append(abCost);
sb.append("Reveal cards from the top of your library until you reveal a land card. ");
sb.append("Goblin Charbelcher deals damage equal to the number of nonland cards revealed ");
sb.append("this way to target creature or player. If the revealed land card was a ");
sb.append("Mountain, Goblin Charbelcher deals double that damage instead. Put the ");
sb.append("revealed cards on the bottom of your library in any order.");
ability.setDescription(sb.toString());
card.addSpellAbility(ability);
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Grindstone")) {