Implemented "Armored Ascension"
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
6 posts
• Page 1 of 1
Implemented "Armored Ascension"
by 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
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"
by 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.

-
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"
by Sloth » 17 Sep 2010, 10:29
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Implemented "Armored Ascension"
by mullery » 17 Sep 2010, 10:34
I thought it was automatic 
Is there something like triggers in Forge which could help me a bit ?

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"
by 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.
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.
-
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"
by 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.
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
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 42 guests