Card Development Questions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Development Questions
by Hellfish » 27 May 2013, 19:45
Just ran a few tests and it looks really good. Havn't found any faults as of yet. 
Mindslaver was an easy add, too.
NOTEDIT: Wrote the above before Marc posted. I'm not getting that problem at all. :/ As for the OK button, I had to enlarge the Prompt to find the OK and cancel buttons but they're there.

Mindslaver was an easy add, too.
NOTEDIT: Wrote the above before Marc posted. I'm not getting that problem at all. :/ As for the OK button, I had to enlarge the Prompt to find the OK and cancel buttons but they're there.

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Card Development Questions
by Max mtg » 27 May 2013, 20:05
Thanks, Hellfish.
Mindslaver was not supposed to be hard when you have the effect to control other player. I just wanted someone to test the very effect.
It's good to learn that the issues described by Mark are only related to vmessage layout.
Mindslaver was not supposed to be hard when you have the effect to control other player. I just wanted someone to test the very effect.
It's good to learn that the issues described by Mark are only related to vmessage layout.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Card Development Questions
by moomarc » 28 May 2013, 05:46
Okay, all seems to be working this morning and so far no issues to report.. Thanks Max. Many people are going to love you for both these cards as well as the AIvsAI/hotseat. 

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by swordshine » 29 May 2013, 15:42
Aphetto Dredging can be implemented by "Announce$ CreatureType", but I'm not familar with the annouce code.
The script might be:
The script might be:
- Aphetto Dredging | Open
- Code: Select all
Name:Aphetto Dredging
ManaCost:3 B
Types:Sorcery
A:SP$ ChangeZone | Cost$ 3 B | Announce$ CreatureType | ValidTgts$ Creature.YouCtrl+ChosenType | TargetMin$ 0 | TargetMax$ 3 | AILogic$ MostProminentInComputerGraveyard | Origin$ Graveyard | Destination$ Hand | TgtPrompt$ Choose target creature card with the chosen type in your graveyard | SpellDescription$ Return up to three target creature cards of the creature type of your choice from your graveyard to your hand.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/aphetto_dredging.jpg
- swordshine
- Posts: 682
- Joined: 11 Jul 2010, 02:37
- Has thanked: 116 times
- Been thanked: 87 times
Re: Card Development Questions
by Max mtg » 29 May 2013, 15:54
Announce wont' work this way.
You'll need to use AB$ ChooseType | Type$ Creature, and exec ChangeZone after that.
You'll need to use AB$ ChooseType | Type$ Creature, and exec ChangeZone after that.
Last edited by Max mtg on 29 May 2013, 15:56, edited 1 time in total.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Card Development Questions
by friarsol » 29 May 2013, 15:55
Except the timing isn't right for that either, since you need to Target before Spell Resolution.Max mtg wrote:Announce wont' work this way.
You'll need to use AB$ ChooseType , and append ChangeZone to it.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by moomarc » 29 May 2013, 15:57
The problem is that the targeting happens before choosing a type this way which is why the card was never implemented before. I think that's why Swordshine wanted to use announce, as the targeting could then be based on the announced type.Max mtg wrote:Announce wont' work this way.
You'll need to use AB$ ChooseType , and append ChangeZone to it.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by Max mtg » 29 May 2013, 16:00
Announce is known to work only for human - in this way:
- forge.card.spellability.HumanPlaySpellAbility.announceRequirements() | Open
- Code: Select all
private boolean announceRequirements() {
// Announcing Requirements like Choosing X or Multikicker
// SA Params as comma delimited list
String announce = ability.getParam("Announce");
if (announce != null) {
for(String aVar : announce.split(",")) {
String varName = aVar.trim();
boolean isX = "X".equalsIgnoreCase(varName);
CostPartMana manaCost = ability.getPayCosts().getCostMana();
boolean allowZero = !isX || manaCost == null || manaCost.canXbe0();
Integer value = ability.getActivatingPlayer().getController().announceRequirements(ability, varName, allowZero);
if ( null == value )
return false;
ability.setSVar(varName, value.toString());
if( "Multikicker".equals(varName) ) {
ability.getSourceCard().setKickerMagnitude(value);
} else {
ability.getSourceCard().setSVar(varName, value.toString());
}
}
}
return true;
}
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Card Development Questions
by Sloth » 29 May 2013, 17:32
The AI part is no problem. I can add it once it's commited.Max mtg wrote:Announce is known to work only for human - in this way:It's not supported by AI at all
- forge.card.spellability.HumanPlaySpellAbility.announceRequirements() | Open
- Code: Select all
private boolean announceRequirements() {
// Announcing Requirements like Choosing X or Multikicker
// SA Params as comma delimited list
String announce = ability.getParam("Announce");
if (announce != null) {
for(String aVar : announce.split(",")) {
String varName = aVar.trim();
boolean isX = "X".equalsIgnoreCase(varName);
CostPartMana manaCost = ability.getPayCosts().getCostMana();
boolean allowZero = !isX || manaCost == null || manaCost.canXbe0();
Integer value = ability.getActivatingPlayer().getController().announceRequirements(ability, varName, allowZero);
if ( null == value )
return false;
ability.setSVar(varName, value.toString());
if( "Multikicker".equals(varName) ) {
ability.getSourceCard().setKickerMagnitude(value);
} else {
ability.getSourceCard().setSVar(varName, value.toString());
}
}
}
return true;
}
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Card Development Questions
by swordshine » 30 May 2013, 00:26
- FORGE.CARD.SPELLABILITY.HUMANPLAYSPELLABILITY.ANNOUNCEREQUIREMENTS() | Open
- Code: Select all
private boolean announceRequirements() {
// Announcing Requirements like Choosing X or Multikicker
// SA Params as comma delimited list
String announce = ability.getParam("Announce");
if (announce != null) {
for(String aVar : announce.split(",")) {
String varName = aVar.trim();
if ("CreatureType".equals(varName)) {
String choice = ability.getActivatingPlayer().getController().chooseSomeType("Creature",
ability.getParam("AILogic"), CardType.getCreatureTypes(), new ArrayList<String>());
ability.getSourceCard().setChosenType(choice);
return true;
}
boolean isX = "X".equalsIgnoreCase(varName);
CostPartMana manaCost = ability.getPayCosts().getCostMana();
boolean allowZero = !isX || manaCost == null || manaCost.canXbe0();
Integer value = ability.getActivatingPlayer().getController().announceRequirements(ability, varName, allowZero);
if ( null == value )
return false;
ability.setSVar(varName, value.toString());
if( "Multikicker".equals(varName) ) {
ability.getSourceCard().setKickerMagnitude(value);
} else {
ability.getSourceCard().setSVar(varName, value.toString());
}
}
}
return true;
}
- swordshine
- Posts: 682
- Joined: 11 Jul 2010, 02:37
- Has thanked: 116 times
- Been thanked: 87 times
Re: Card Development Questions
by Hanmac » 30 May 2013, 15:28
sorry if i am wrong, but did forge ship this infos as textfiles too or was that only in older versions?
i wanted to use them for some kind of statistics
i wanted to use them for some kind of statistics
Re: Card Development Questions
by moomarc » 30 May 2013, 15:37
The card scripts are in a zip file in the beta and snapshot releases and has been that way as far back as I can remember. I think its named cardsfolder.zipHanmac wrote:sorry if i am wrong, but did forge ship this infos as textfiles too or was that only in older versions?
i wanted to use them for some kind of statistics
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by Max mtg » 31 May 2013, 00:06
* Sphinx of Jwar Isle is hardcoded now. Can I implement its ability as
: Dig 1 card ?
The only problem appears to be not to use stack for this action - could add a global parameter for all SAs to skip stack.
By the way, what if (sub)abilities marked with skipstack flag resolve right after costs are paid, and non-marked do as usual? That'll let us easily script that card that requires color before it is aded to stack

The only problem appears to be not to use stack for this action - could add a global parameter for all SAs to skip stack.
By the way, what if (sub)abilities marked with skipstack flag resolve right after costs are paid, and non-marked do as usual? That'll let us easily script that card that requires color before it is aded to stack
Last edited by Max mtg on 31 May 2013, 00:12, edited 1 time in total.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Card Development Questions
by friarsol » 31 May 2013, 00:10
I'm not sure that really helps, you should be able to do this when you don't have priority. Additionally that would not interact with things that prevented you from activating abilities, or raised cost on abilities.Max mtg wrote:* Sphinx of Jwar Isle is hardcoded now. Can I implement its ability as: Dig 1 card ?
The only problem appears to be 'skip stack' for this action.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Who is online
Users browsing this forum: No registered users and 30 guests