It is currently 21 May 2025, 20:51
   
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 pufthemajicdragon » 15 Mar 2013, 22:10

I found a workaround for my planeswalker pet trouble. I used the DoubleFaced keyword to bring it in as a different card type (currently a land) and then transform it later. Transforming it still requires me to manually add the starting loyalty counters, but that's not too bad. The whole thing opens up some fun play possibilities.

Trouble: When I transform my land into the planeswalker, the planeswalker doesn't have any card image. Is there any way to give it one, as it's a transformed token?
pufthemajicdragon
 
Posts: 23
Joined: 08 Jan 2013, 04:17
Has thanked: 7 times
Been thanked: 2 times

Re: Card Development Questions

Postby Max mtg » 16 Mar 2013, 20:58

Is Land Equilibrium scriptable?
I would love to remove the hardcode related to this card and the inlined Input instance it is using
Or would you script at least that ability destroying extra land, please?

No longer actual, I've written that ability script.
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 Sloth » 16 Mar 2013, 23:33

friarsol wrote:
Sloth wrote:Yes, it is a good idea to convert these effects to Static Ability (i never liked the current implementation). I'm a bit busy at the moment, but will try to tackle it after the next beta.
No rush, just bringing it up because I was glancing at the Attach code for something else and it was bothering me as well.
I've commited the change. It's mostly like it was before. Steal Enchantment on Control Magic still doesn't work, because continuous static abilities are handled in timestamp order and the dependency rules aren't there yet. - Sigh.
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 » 03 Apr 2013, 21:01

Today Comet Storm was scripted.
The problem of simultaneous use of X and Multikicker is gone.

A similiar spell Strength of the Tajuru is now forgeable too.
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 Max mtg » 05 Apr 2013, 09:36

These cards require player to reveal a specific card to prevent them from ETB tapped.
Code: Select all
        else if (cardName.equals("Ancient Amphitheater") || cardName.equals("Auntie's Hovel")
                || cardName.equals("Gilt-Leaf Palace") || cardName.equals("Secluded Glen")
                || cardName.equals("Wanderwine Hub") || cardName.equals("Rustic Clachan")
                || cardName.equals("Murmuring Bosk") || cardName.equals("Primal Beyond")) {
Is there anything missing to script this ability with UnlessCost$ Reveal<1/type>?
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 » 05 Apr 2013, 12:26

Max mtg wrote:These cards require player to reveal a specific card to prevent them from ETB tapped.
Code: Select all
        else if (cardName.equals("Ancient Amphitheater") || cardName.equals("Auntie's Hovel")
                || cardName.equals("Gilt-Leaf Palace") || cardName.equals("Secluded Glen")
                || cardName.equals("Wanderwine Hub") || cardName.equals("Rustic Clachan")
                || cardName.equals("Murmuring Bosk") || cardName.equals("Primal Beyond")) {
Is there anything missing to script this ability with UnlessCost$ Reveal<1/type>?
Nope, I think it's pretty straightforward. It just needs to happen as an ETB replacement.
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 » 05 Apr 2013, 13:59

I love the changetargets effect. =D> Some widely used cards in constructed games are forgable. :mrgreen:
Some remaining issues about changetargets:
I cast Misdirection targeting Cancel on the stack, when Misdirection resolves, it cannot change target to Misdirection.
I tried to script Goblin Flectomancer, and found:
2/1/2006: If a spell has a variable number of targets (such as Electrolyze), the number of targets chosen can't be changed.
The changetargets effect can change the number of targets of Eletrolyze currently.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby friarsol » 05 Apr 2013, 14:12

swordshine wrote:I love the changetargets effect. =D> Some widely used cards in constructed games are forgable. :mrgreen:
Some remaining issues about changetargets:
I cast Misdirection targeting Cancel on the stack, when Misdirection resolves, it cannot change target to Misdirection.
I tried to script Goblin Flectomancer, and found:
2/1/2006: If a spell has a variable number of targets (such as Electrolyze), the number of targets chosen can't be changed.
The changetargets effect can change the number of targets of Eletrolyze currently.
Yea, that's why I started off with the single target ones first. Definitely the simplest use case for ChangeTargets. I'll take a look at Misdirection. It's definitely still on the stack, so I'm not sure why it wouldn't see it as a target.
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 » 05 Apr 2013, 20:16

Done, r20827, r20828 - there remains a task to teach AI how to decide on 'unless cost', and I'm sorry don't know how to do that.
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 swordshine » 12 Apr 2013, 12:20

I saw someone required Blaze of Glory, and I scripted it
Blaze of Glory | Open
Name:Blaze of Glory
ManaCost:W
Types:Instant
Text:Cast CARDNAME only during combat before blockers are declared.
A:SP$ Pump | Cost$ W | ValidTgts$ Creature.DefenderCtrl | TgtPrompt$ Select target creature defending player controls | ActivationPhases$ BeginCombat->Declare Attackers - Play Instants and Abilities | ImprintCards$ Targeted | KW$ HIDDEN CARDNAME can block any number of creatures. | StackDescription$ {c:Targeted} can block any number of creatures this turn | SubAbility$ DBRepeatEach | SpellDescription$ Target creature defending player controls can block any number of creatures this turn. It blocks each attacking creature this turn if able.
SVar:DBRepeatEach:DB$ RepeatEach | RepeatCards$ Creature.attacking | RepeatSubAbility$ DBMustBlock | SubAbility$ DBCleanupImprint
SVar:DBMustBlock:DB$ MustBlock | DefinedAttacker$ Remembered | Defined$ Imprinted
SVar:DBCleanupImprint:DB$ Cleanup | ClearImprinted$ True
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/blaze_of_glory.jpg

It seems that AI could not do correct block here. I attacked with two Abattoir Ghoul and a Abbey Gargoyles, with Blaze of Glory targeting AI's Abbey Griffin, it only blocked Abbey Gargoyles.
I attacked with two Abattoir Ghoul and a Abbey Gargoyles again, targeting AI's Abbey Matron, and it blocked two Abattoir Ghouls correctly.
The third time I attacked with the three creature, and targeted one creature AI cast last turn, it only blocked one of my Abattoir Ghoul. :?
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Max mtg » 16 Apr 2013, 20:13

Triggers and abilities now may check for alt cost used to play an ability.
This might have opened paths to script cards like Worldheart Phoenix

See revision 21038 for examples.
http://svn.slightlymagic.net/websvn/rev ... &peg=21038
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 swordshine » 17 Apr 2013, 04:02

Max mtg wrote:Triggers and abilities now may check for alt cost used to play an ability.
This might have opened paths to script cards like Worldheart Phoenix

See revision 21038 for examples.
http://svn.slightlymagic.net/websvn/rev ... &peg=21038
Worldheart Phoenix has an etb effect, the script would be a little complicated.
Edit: It would simplify the script to add an altcost condition in TriggerReplacementBase.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Max mtg » 17 Apr 2013, 04:30

swordshine wrote:Worldheart Phoenix has an etb effect, the script would be a little complicated.
Not really. Could use same clause as AEther Figmet uses
Code: Select all
K:etbCounter:P1P1:2:CheckSVar$ WasKicked:If CARDNAME was kicked, it enters the battlefield with two +1/+1 counters on it.
SVar:WasKicked:Count$Kicked.1.0
For Phoenix game should detemine if altCost was used - that is add a check similiar to one for Kicked but test condition would be
Code: Select all
c.isOptionalCostPaid(OptionalCost.AltCost)
in GameActionUtil in line 1560's area
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 RedDeckWins » 21 Apr 2013, 19:35

The Shaper Parasite morph trigger is broken.

From what I could debug, I found it was entering the first conditional (excerpted from SpellAbilityEffect) below, because tgt was not null. The desired behavior would be to return the defined player in ChooseGenericEffect.resolve() (line 44).

Code: Select all
 private List<Player> getTargetPlayers(SpellAbility sa, final boolean wantEmptyAsDefault, final boolean targetIsPreferred) {
            final Target tgt = sa.getTarget();
            final String defined = sa.getParam("Defined");
            if (tgt != null && (targetIsPreferred || (StringUtils.isEmpty(defined) && !wantEmptyAsDefault))) {
                return tgt.getTargetPlayers();
            }
            if (StringUtils.isEmpty(defined) && wantEmptyAsDefault) {
                return emptyPlayerList;
            }
            return AbilityUtils.getDefinedPlayers(sa.getSourceCard(), defined, sa);
        }
Honestly, I am still learning how this all works, but I looked at a bunch of other generic choice cards and noticed they were implemented as a SubAbility, so I took the same route here to fix the card. Here is my proposed fix. I am still too new to post links, but I can send a dropbox link to the patch if desired. I've pasted the patch contents below for now.

patch body:
Code: Select all
Index: res/cardsfolder/s/shaper_parasite.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- res/cardsfolder/s/shaper_parasite.txt   (revision 21118)
+++ res/cardsfolder/s/shaper_parasite.txt   (revision )
@@ -3,8 +3,9 @@
 Types:Creature Illusion
 PT:2/3
 K:Morph:2 U
-T:Mode$ TurnFaceUp | ValidCard$ Card.Self | Execute$ TrigChoice | TriggerZones$ Battlefield | TriggerDescription$ When CARDNAME is turned face up, target creature gets +2/-2 or -2/+2 until end of turn.
-SVar:TrigChoice:AB$ GenericChoice | ValidTgts$ Creature | TgtPrompt$ Select target creature | Cost$ 0 | Defined$ You | Choices$ TrigPump1,TrigPump2
+T:Mode$ TurnFaceUp | ValidCard$ Card.Self | Execute$ PumpTrig | TriggerZones$ Battlefield | TriggerDescription$ When CARDNAME is turned face up, target creature gets +2/-2 or -2/+2 until end of turn.
+SVar:PumpTrig:AB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature | Cost$ 0 | SubAbility$ TrigChoice
+SVar:TrigChoice:DB$ GenericChoice | Defined$ You | Choices$ TrigPump1,TrigPump2
 SVar:TrigPump1:DB$Pump | Cost$ 0 | Defined$ Targeted | NumAtt$ +2 | NumDef$ -2 | IsCurse$ True | ChoiceDescription$ +2/-2
 SVar:TrigPump2:DB$Pump | Cost$ 0 | Defined$ Targeted | NumAtt$ -2 | NumDef$ +2 | IsCurse$ True | ChoiceDescription$ -2/+2
 SVar:RemAIDeck:True
\ No newline at end of file
User avatar
RedDeckWins
 
Posts: 35
Joined: 20 Apr 2013, 16:45
Has thanked: 8 times
Been thanked: 10 times

Re: Card Development Questions

Postby Sloth » 21 Apr 2013, 21:01

RedDeckWins wrote:The Shaper Parasite morph trigger is broken.

From what I could debug, I found it was entering the first conditional (excerpted from SpellAbilityEffect) below, because tgt was not null. The desired behavior would be to return the defined player in ChooseGenericEffect.resolve() (line 44).
Yes, the Default parameter was ignored. Luckily we have a function that does it correctly. See r21119: http://svn.slightlymagic.net/websvn/log ... F&isdir=1&

Thanks for pointing it out RedDeckWins. I give green light for commit rights. Does anyone object?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 37 guests


Who is online

In total there are 37 users online :: 0 registered, 0 hidden and 37 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 37 guests

Login Form