Modular
- Code: Select all
private final int shouldModular(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
{
if (a.get(i).toString().startsWith("Modular"))
return i;
}
return -1;
}
- Code: Select all
while (shouldModular(card) != -1)
{
int n = shouldModular(card);
if (n != -1)
{
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
final int m = Integer.parseInt(parse.substring(8));
String t = card.getSpellText();
if (!t.equals("")) t += "\r\n";
card.setText(t + parse + " (This enters the battlefield with " + m + " +1/+1 counters on it. When it's put into a graveyard, you may put its +1/+1 counters on target artifact creature.)");//Erm help? Isn't there a normal way to do this?...
card.setComesIntoPlay(
new Command()
{
public void execute()
{
card.addCounter(Counters.P1P1, m);
}});
final SpellAbility ability = new Ability(card, "0")
{
public void resolve()
{
if (card.getController().equals(Constant.Player.Computer))
{
CardList choices = new CardList(AllZone.Computer_Play.getCards()).filter(
new CardListFilter(){public boolean addCard(Card c) {return c.isCreature() && c.isArtifact() && CardFactoryUtil.canTarget(ability, c); }});
if (choices.size() != 0)
CardFactoryUtil.AI_getBestCreature(choices).addCounter(Counters.P1P1, getSourceCard().getCounters(Counters.P1P1));
}
final SpellAbility ability=this;
AllZone.InputControl.setInput(
new Input(){
public void showMessage()
{
AllZone.Display.showMessage("Select target artifact creature");
ButtonUtil.enableOnlyCancel();
}
public void selectButtonCancel() {stop();}
public void selectCard(Card card2, PlayerZone zone)
{
if(card2.isCreature() && card2.isArtifact() && zone.is(Constant.Zone.Play) && CardFactoryUtil.canTarget(ability, card2))
{
card2.addCounter(Counters.P1P1, ability.getSourceCard().getCounters(Counters.P1P1));//combining input and resolve is skirting rules and hacky at best, but non-stackability of destroyCommand Inputs turns into a major problem when the keyword is mainly used during the simultaneous destruction of combat.
stop();
}
}
});
}//resolve()
};
card.setDestroy(new Command()
{
private static final long serialVersionUID = 304026662487997331L;
public void execute()
{
ability.setStackDescription("Put "+ card.getCounters(Counters.P1P1) +" +1/+1 counter/s from " + card + " on target artifact creature.");
AllZone.Stack.push(ability);
}
});
}
}
- Code: Select all
Arcbound Bruiser
5
Artifact Creature Golem
no text
0/0
Modular 3
Arcbound Hybrid
4
Artifact Creature Beast
no text
0/0
Haste
Modular 2
Arcbound Lancer
7
Artifact Creature Beast
no text
0/0
First Strike
Modular 4
Arcbound Stinger
2
Artifact Creature Insect
no text
0/0
Flying
Modular 1
Arcbound Worker
1
Artifact Creature Construct
no text
0/0
Modular 1
Side notes:
-I found Ashnod's Transmorgant code in my version, I remember the card working nicely, but I don't think I got around to posting it. Should I post the code, or have I already?
-Dennis, is my mpool code still resisting merging attempts? If so, would me merging it to the version you released today be productive?
-Finally, I am now officially over all eclipse problems and on top of schoolwork, and have resumed working on my to-code list. Any suggestions for further actions? Perhaps changing the manaCost code to check lands for basic land types(which should be a quick fix, but would probably interfere to some degree with merging my code), or trying to set up an InputStack/multi-targeting system? Any suggestions welcome
EDIT: added CanTarget code for AI and fixed it for human (used to say canTarget(ability, card) instead of canTarget(ability, card2)).
from Gea's Cradle, and you click on it to pay for