mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Convert Goblin Charbelcher to script
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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")) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user