Discard random as cost
Hi there,
I'm totally new to Forge coding, but have some basic Java knowledge. I wanted to try and add a single card and just click random card on magiccards.info and got a Stormscale Anarch.
The code I did so far:
1) The discard random is not a cost but rather an effect, meaning you can cast your whole hand and still do 2 damage without discarding
2) I can't test the card for AI, because whenever I run Forge and finish a turn I have to discard my whole hand and still the AI's turn doesn't start
3) How do I commit a new card when it's finished(without breaking anything)
4) Which main type do I have to run to get into Forge Main Menu (when right-clicking and "Run As .."
I hope my questions aren't too dumb... thanks for helping in advanced.
greetings Malacath
PS: I'm looking forward to be able to contribute to Forge, hope that will happen someday ^^
I'm totally new to Forge coding, but have some basic Java knowledge. I wanted to try and add a single card and just click random card on magiccards.info and got a Stormscale Anarch.
The code I did so far:
- Code: Select all
//*************** START *********** START **************************
else if(cardName.equals("Stormscale Anarch")) {
Target tgt = new Target("TgtCP");
Ability_Cost abCost = new Ability_Cost("0", cardName, true);
final Ability_Activated ability = new Ability_Activated(card, abCost, tgt) {
/**
* ToDo: Discard as a Cost!
*/
private static final long serialVersionUID = 1L;
int damage = 2;
@Override
public void resolve() {
Player player = card.getController();
if(player.equals(AllZone.HumanPlayer)) {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer);
CardList list = new CardList(hand.getCards());
list.shuffle();
Card c = list.get(0);
c.getController().discard(c, null);
if(CardUtil.getColors(c).size() >= 2) {
if(getTargetPlayer() == null) {
getTargetCard().addDamage(damage*2, card);
}
else {
getTargetPlayer().addDamage(damage*2, card);
}
}
else {
if(getTargetPlayer() == null) {
getTargetCard().addDamage(damage, card);
}
else {
getTargetPlayer().addDamage(damage, card);
}
}
}
else {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
CardList list = new CardList(hand.getCards());
list.shuffle();
Card c = list.get(0);
c.getController().discard(c, null);
}
}//resolve()
@Override
public boolean canPlayAI() {
Card[] hand = AllZone.Computer_Hand.getCards();
return (hand.length > 0);
}
@Override
public boolean canPlay() {
Card[] hand = AllZone.Human_Hand.getCards();
return hand.length > 0 && super.canPlay();
}
};
ability.setDescription("2R, Discard a card at random: Stormscale Anarch deals 2 damage to target creature or player. If the discarded card was multicolored, Stormscale Anarch deals 4 damage to that creature or player instead.");
ability.setStackDescription(card.getName() + " - Stormscale Anarch deals 2 or 4 damage to target creature or player.");
card.addSpellAbility(ability);
}//*************** END ************ END **************************
1) The discard random is not a cost but rather an effect, meaning you can cast your whole hand and still do 2 damage without discarding
2) I can't test the card for AI, because whenever I run Forge and finish a turn I have to discard my whole hand and still the AI's turn doesn't start
3) How do I commit a new card when it's finished(without breaking anything)
4) Which main type do I have to run to get into Forge Main Menu (when right-clicking and "Run As .."
I hope my questions aren't too dumb... thanks for helping in advanced.
greetings Malacath
PS: I'm looking forward to be able to contribute to Forge, hope that will happen someday ^^