It is currently 22 May 2025, 16:44
   
Text Size

Card Development Questions

Post MTG Forge Related Programming Questions Here

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

Re: Card Development Questions

Postby friarsol » 09 Feb 2013, 19:24

moomarc wrote:I'm not booted up or anything so can't test, but don't you just need to add an UnlessPayer$You parameter? Maybe it defaults to the opponent?
Doesn't seem like it. If that were the case and it came into play untapped, I should have gotten a dialog box telling me what the AI revealed?

Anyway, adding the parameter gives me an NPE (I'm not sure why that would even come up here)

NPE | Open
java.lang.NullPointerException
at forge.card.abilityfactory.SpellEffect.getStackDescriptionWithSubs(SpellEffect.java:61)
at forge.card.abilityfactory.CommonDrawback.getStackDescription(CommonDrawback.java:63)
at forge.card.abilityfactory.SpellEffect.getStackDescriptionWithSubs(SpellEffect.java:83)
at forge.card.abilityfactory.CommonDrawback.getStackDescription(CommonDrawback.java:63)
at forge.game.GameActionUtil.payCostDuringAbilityResolve(GameActionUtil.java:435)
at forge.card.abilityfactory.AbilityFactory.passUnlessCost(AbilityFactory.java:1481)
at forge.card.abilityfactory.AbilityFactory.resolve(AbilityFactory.java:1530)
at forge.game.GameActionPlay.playSpellAbilityNoStack(GameActionPlay.java:447)
at forge.card.replacement.ReplacementHandler.executeReplacement(ReplacementHandler.java:240)
at forge.card.replacement.ReplacementHandler.run(ReplacementHandler.java:147)
at forge.card.replacement.ReplacementHandler.run(ReplacementHandler.java:67)
at forge.game.GameAction.changeZone(GameAction.java:182)
at forge.game.GameAction.moveTo(GameAction.java:359)
at forge.game.GameAction.moveTo(GameAction.java:340)
at forge.game.player.Player.playLand(Player.java:1932)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Max mtg » 09 Feb 2013, 22:57

Please review my commit r19500 (+19501) - converted Power Sink to script, added ManaBurn effect - currently has an only parameter meaning should mana that was taken from pool deal damage or not.
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

Postby friarsol » 09 Feb 2013, 23:16

Max mtg wrote:Please review my commit r19500 (+19501) - converted Power Sink to script, added ManaBurn effect - currently has an only parameter meaning should mana that was taken from pool deal damage or not.
Not sure why you created this effect.

It's a) a poor name, since Power Sink doesn't actually "mana burn" anything and no card effects deal damage this way and
b) repetition of an AF effect that already exists that is used by Mana Short.

A:SP$ TapAll | Cost$ 2 U | ValidTgts$ Player | TgtPrompt$ Select target player | ValidCards$ Land | SubAbility$ DrainMana | SpellDescription$ Tap all lands target player controls and empty his or her mana pool.
SVar:DrainMana:DB$ DrainMana | Defined$ Targeted

Should be pretty straightforward to change your SubAbility to DrainMana. Thanks for attempting to convert cards.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Max mtg » 10 Feb 2013, 08:17

Thanks for your feedback.

I've got a new edition of Power Sink: r19505

New features include: UnlessResolveSubs$ - indicates when subabilities should be resolved. By default they are resolved at all times. That's useful for cards like Disrupt, but Power Sink should resolve its "tap all lands" and DrainMana only if X cost is not paid. So specify "UnlessResolveSubs$ WhenNotPaid" and you'll get the intended behaviour.

Stack Descriptions now may contain other varaibles besides CARDNAME. When a spell is put onto stack its targets are alredy known, so thay can be substituted in description. For instance
Code: Select all
SVar:TapLands:DB$ TapAll | ValidCards$ Land.hasManaAbility | Defined$ TargetedController | SubAbility$ ManaLose| StackDescription$ If {p:TargetedController} doesn't, that player taps all lands with mana abilities he or she controls and (subability text will get appended here)
And there's a little explaination how the text inside braces is parsed.
how it works | Open
Code: Select all
if ( isPlainText )
    sb.append(t.replace("CARDNAME", sa.getSourceCard().getName()));
else {
    List<?> objs = null;
    if ( t.startsWith("p:") )
        objs = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), t.substring(2), sa);
    else if ( t.startsWith("s:"))
        objs = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), t.substring(2), sa);
    else if ( t.startsWith("c:"))
        objs = AbilityFactory.getDefinedCards(sa.getSourceCard(), t.substring(2), sa);
    else
        objs = AbilityFactory.getDefinedObjects(sa.getSourceCard(), t, sa);
           
    sb.append(StringUtils.join(objs, ", "));
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

Postby PowerClaws » 10 Feb 2013, 13:14

Are there any ways to do boolean comparisons? Im looking at Volley of Boulders, and going, "if you could set a way to check if the number of times that the targets have been chosen could be compared to the total number of times it needs to trigger, and then have scripts set up to see if it damages a player or creature and either tap or give that player an emblem or something then you could almost have Aurelia's Fury and a few similar cards"
Yes, i know its quite complex, but it *seems* like it could be a way to do it, but, of course, i dunno how, or if, Forge supports that type of check.
PowerClaws
 
Posts: 131
Joined: 30 Jan 2012, 11:33
Has thanked: 28 times
Been thanked: 8 times

Re: Card Development Questions

Postby Rooger » 11 Feb 2013, 02:02

Hey guys, i've coded Temporal Extortion, made a couple of games with dev mode to test it and it worked fine, opponent with 20 life at first turn payed the life cost, i cast it again from dev menu and now with 10 life he made the decision to not pay the cost, wise decision hehe, i played the next turn also, so it's working properly, here is the code so you guys can test it if you want.

Code: Select all
Name:Temporal Extortion
ManaCost:B B B B
Types:Sorcery
Text:no text
T:Mode$ SpellCast | ValidCard$ Card.Self | Execute$ TrigCounter | TriggerDescription$ When you play CARDNAME, any player may pay half his or her life, rounded up. If a player does, counter CARDNAME.
SVar:TrigCounter:DB$ Counter | Cost$ 0 | UnlessCost$ PayLife<X> | Defined$ TriggeredSpellAbility | UnlessPayer$ Player | UnlessSwitched$ True
SVar:X:Count$YourLifeTotal/HalfUp
A:SP$ AddTurn | Cost$ B B B B | NumTurns$ 1 | SpellDescription$ Take an extra turn after this one.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/temporal_extortion.jpg
SetInfo:PLC|Rare|http://magiccards.info/scans/en/pc/81.jpg
Oracle:When you cast Temporal Extortion, any player may pay half his or her life, rounded up. If a player does, counter Temporal Extortion.\nTake an extra turn after this one.
End
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Card Development Questions

Postby friarsol » 11 Feb 2013, 02:23

Rooger wrote:Hey guys, i've coded Temporal Extortion, made a couple of games with dev mode to test it and it worked fine, opponent with 20 life at first turn payed the life cost, i cast it again from dev menu and now with 10 life he made the decision to not pay the cost, wise decision hehe, i played the next turn also, so it's working properly, here is the code so you guys can test it if you want.
Script looks fine to me. How did it work in multiplayer? We may want to hold off on actually putting it in until the AI gets a bit smarter about considering losing half it's life versus allowing an extra turn.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby swordshine » 11 Feb 2013, 03:11

B B B B is a huge cost for an additional turn, I suggest add "UnlessAI$ Never"
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby friarsol » 11 Feb 2013, 03:51

swordshine wrote:B B B B is a huge cost for an additional turn, I suggest add "UnlessAI$ Never"
That's not that huge if you are mono black. But I'm not talking about casting the spell, I'm talking about reacting when the Human casts the spell. Sometimes letting an extra turn isn't horrible especially if it seems like you won't be taking more than half your life in combat damage. But other times, letting up an extra turn could easily be death.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Rooger » 11 Feb 2013, 07:33

Didn't test it in multiplayer yet but your point is valid, it's a big hit going from 20 to 10 just like that, but the ai did decided that it was a good decision. Prehaps there is a way to warn the ai that it could be a risky move if it decides to pay the cost but i don't know how to do it.

Another question, anyone know if Flickerform is codable? Don't know if it's possible to exile a enchanted creature and return it to the battlefield with the enchantments attached to it...
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Card Development Questions

Postby moomarc » 11 Feb 2013, 08:28

Looks fantastic Rooger. Any chance you could send me the open photoshop file for the background so I can modify it for a 4:3 resolution?
-Marc
User avatar
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

Postby swordshine » 11 Feb 2013, 09:17

Currently AI always pays the unlessplaylife cost if its life is more than 5 after paid. This halfup life cost is too powerful. If ai has 10 life, a 5-damage burn for only BBBB is still dangerous for ai to survive. In mono black decks, using ritual to have BBBB in turn one or two is possible, but you should use more than two cards to have this additional turn. In the next turn, the storm does not count. So in most cases I think it is better for ai not to pay the life.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby swordshine » 11 Feb 2013, 09:23

For Flickerform, remember the enchanted creature and all auras attached, then use an effect to trigger at the end step.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Sloth » 11 Feb 2013, 19:32

friarsol wrote:
swordshine wrote:B B B B is a huge cost for an additional turn, I suggest add "UnlessAI$ Never"
That's not that huge if you are mono black. But I'm not talking about casting the spell, I'm talking about reacting when the Human casts the spell. Sometimes letting an extra turn isn't horrible especially if it seems like you won't be taking more than half your life in combat damage. But other times, letting up an extra turn could easily be death.
swordshine had the right idea. "UnlessAI$ Never" will tell the AI to never pay the life, which is fine because a Temporal Manipulation for BBBB is good, but not broken.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Development Questions

Postby Max mtg » 11 Feb 2013, 19:45

What about making a separate api for unless? It gets more and more parameters
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 17 guests


Who is online

In total there are 17 users online :: 0 registered, 0 hidden and 17 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 17 guests

Login Form