It is currently 08 Sep 2025, 12:49
   
Text Size

Implemented "Armored Ascension"

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Implemented "Armored Ascension"

Postby mullery » 17 Sep 2010, 10:20

Hello,

I've added Armored Ascension to Forge, but I'm not able to commit my change (405 Method not allowed). I know that I should be able to commit because Dennis gave me the right but I don't know what I have to configure in eclipse to do so.

Anyway, someone could have a look at the code for the card :

//*************** START *********** START **************************
else if(cardName.equals("Armored Ascension")) {
final SpellAbility spell = new Spell(card) {

private static final long serialVersionUID = 3959966663907905001L;

@Override
public boolean canPlayAI() {
CardList list = new CardList(AllZone.Computer_Play.getCards());
list = list.getType("Creature");

if(list.isEmpty()) return false;

//else
CardListUtil.sortAttack(list);
CardListUtil.sortFlying(list);

for(int i = 0; i < list.size(); i++) {
if(CardFactoryUtil.canTarget(card, list.get(i))) {
setTargetCard(list.get(i));
return true;
}
}
return false;
}//canPlayAI()

@Override
public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
/* Put the permanent into play*/
play.add(card);

/* Select the target of the enchantment */
Card c = getTargetCard();

/* Is it possible to target the card ? */
if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
/* The target is enchanted */
card.enchantCard(c);
System.out.println("Enchanted: " +getTargetCard());
}
}//resolve()
};//SpellAbility
card.clearSpellAbility();
card.addSpellAbility(spell);

Command onEnchant = new Command() {

private static final long serialVersionUID = -2365466450520529652L;

public void execute() {
String cardController = card.getController();
PlayerZone myField = AllZone.getZone(Constant.Zone.Play, cardController);
CardList someCards = new CardList();
someCards.addAll(myField.getCards());
int x = someCards.getType("Plains").size();
if(card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
crd.addSemiPermanentAttackBoost(x);
crd.addSemiPermanentDefenseBoost(x);
}
}//execute()
};//Command


Command onUnEnchant = new Command() {

private static final long serialVersionUID = 8144460293841806556L;

public void execute() {
String cardController = card.getController();
PlayerZone myField = AllZone.getZone(Constant.Zone.Play, cardController);
CardList someCards = new CardList();
someCards.addAll(myField.getCards());
int x = someCards.getType("Plains").size();
if(card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
crd.addSemiPermanentAttackBoost(-x);
crd.addSemiPermanentDefenseBoost(-x);
}
//if(card.isEnchanting()) {
// Card crd = card.getEnchanting().get(0);
// crd.addSemiPermanentAttackBoost(2);
// crd.addSemiPermanentDefenseBoost(1);
//}

}//execute()
};//Command

Command onLeavesPlay = new Command() {

private static final long serialVersionUID = -8235558710156197207L;

public void execute() {
if(card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
card.unEnchantCard(crd);
}
}
};

card.addEnchantCommand(onEnchant);
card.addUnEnchantCommand(onUnEnchant);
card.addLeavesPlayCommand(onLeavesPlay);

spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
}//*************** END ************ END **************************


Card.txt
Armored Ascension
3 W
Enchantment Aura
Enchanted creature gets +1/+1 for each Plains you control and has flying.
Enchant creature
enPump:Flying
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/armored_ascension.jpg
mullery
 
Posts: 8
Joined: 05 Aug 2010, 20:13
Has thanked: 0 time
Been thanked: 0 time

Re: Implemented "Armored Ascension"

Postby Chris H. » 17 Sep 2010, 10:27

mullery wrote:Hello,

I've added Armored Ascension to Forge, but I'm not able to commit my change (405 Method not allowed). I know that I should be able to commit because Dennis gave me the right but I don't know what I have to configure in eclipse to do so.
`
Check your settings and make sure that it looks like this:

https://cardforge.googlecode.com/svn
`
The "https" form is required. "http" will not allow you to make a commit. :wink:
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Implemented "Armored Ascension"

Postby Sloth » 17 Sep 2010, 10:29

Sorry if I'm wrong, but it looks to me, that the boost does not adapt, if the number of Plains controlled changes after the enchantment is attached.

I think you've chosen quite a hard card to code as your first.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Implemented "Armored Ascension"

Postby mullery » 17 Sep 2010, 10:34

I thought it was automatic :)
Is there something like triggers in Forge which could help me a bit ?
mullery
 
Posts: 8
Joined: 05 Aug 2010, 20:13
Has thanked: 0 time
Been thanked: 0 time

Re: Implemented "Armored Ascension"

Postby Rob Cashwalker » 17 Sep 2010, 11:32

You will also be able to save some code by using the CardFactoryUtil.xCount method to do the counting of Plains.

You'll need to add some code to GameActionUtil to implement the part where its constantly counts Plains.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Implemented "Armored Ascension"

Postby mtgrares » 17 Sep 2010, 17:23

Search for Glorious_Anthem in GameActionUtil for an example of +1/+1 effects. You will have to recount the number of Plains each time your code is called.

Basically cut and past the Glorious Anthem code in GameActionUtil so you have a new Command object. The Command object only has one method, execute(), so you have to stick all of your code inside execute().

Static effects like Glorious Anthem are harder to do that regular spells/abilities.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 42 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 42 users online :: 0 registered, 0 hidden and 42 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 42 guests

Login Form