Cromat
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Cromat
by zerker2000 » 01 Jul 2009, 19:20
Finally got Cromat coded . Spent a bunch of the time hunting a bug in the last ability... here's the code:
Now it's back in/to the mana pool for me .
- Code: Select all
Cromat
W U B R G
Legendary Creature Illusion
no text
5/5
KPump U R:Flying
RegenerateMe:B G
PTPump R W:+1/+1
- Code: Select all
if (cardName.equals("Cromat")){
//LibBounce Ability
final Ability a1 = new Ability(card, "G U")
{
public boolean canPlayAI() {return false;}
public void resolve()
{
if(AllZone.GameAction.isCardInPlay(card) )
{
card.setBaseAttack(5);
card.setBaseDefense(5);
card.setAssignedDamage(0);
card.setDamage(0);
card.untap();
AllZone.getZone(card).remove(card);
//put card on top of library
PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getOwner());
library.add(card, 0);
}
}//resolve()
};//SpellAbility
Input runtime1 = new Input()
{
private static final long serialVersionUID = 1469011418219527227L;
public void showMessage()
{
a1.setStackDescription("Put " +card +" on top of its owner's library");
stopSetNext(new Input_PayManaCost(a1));
}
};
a1.setDescription("G U: Put Cromat on top of its owner's library.");
a1.setStackDescription("Put Cromat on top of its owner's library.");
card.addSpellAbility(a1);
a1.setBeforePayMana(runtime1);
//Kill ability
final Ability a2 = new Ability(card, "W B"){
public boolean canPlay()
{
return (AllZone.GameAction.isCardInPlay(card) && (AllZone.Combat.isBlocked(card) || AllZone.Combat.getAllBlockers().contains(card)));
}
public boolean canPlayAI()
{
return false;
//TODO
}
public void resolve()
{
AllZone.GameAction.destroy(getTargetCard());
}//resolve()
};
Input runtime2 = new Input()
{
/**
*
*/
private static final long serialVersionUID = 1L;
public void showMessage()
{
CardList targets = new CardList();
if(AllZone.Combat.isBlocked(card) || AllZone.Combat.getAllBlockers().contains(card)){
if (AllZone.Combat.isBlocked(card)){ targets = AllZone.Combat.getBlockers(card); }
else {
targets = new CardList();
for (Card c : AllZone.Combat.getAttackers()){
if (AllZone.Combat.isBlocked(c))
if (AllZone.Combat.getBlockers(c).contains(card)) targets.add(c);
}
}
}
stopSetNext(CardFactoryUtil.input_targetSpecific(a2, targets, "Select target blocking or blocked by Cromat.", true));
}
};
card.addSpellAbility(a2);
a2.setBeforePayMana(runtime2);
a2.setDescription("W B: Destroy target creature blocking or blocked by Cromat.");
}
Now it's back in/to the mana pool for me .
Last edited by zerker2000 on 02 Jul 2009, 07:39, edited 1 time in total.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Cromat
by DennisBergkamp » 02 Jul 2009, 07:18
Nice!
But... I think something must've gone wrong in the copying and pasting of the code, since both abilities are empty?
But... I think something must've gone wrong in the copying and pasting of the code, since both abilities are empty?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Cromat
by zerker2000 » 02 Jul 2009, 07:41
OOPS!... fixed it (I think I did middle click instead of ^C or something...)
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 56 guests