It is currently 18 Apr 2024, 23:47
   
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 swordshine » 17 May 2014, 13:18

We have a static ability "ETBTapped" which might be converted to a replacement effect.
Original:
Code: Select all
S:Mode$ ETBTapped | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl | Description$ Artifacts and creatures your opponents control enter the battlefield tapped.
Converted:
Code: Select all
R:Event$ Moved | ActiveZones$ Battlefield | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl | Destination$ Battlefield | ReplaceWith$ DBETBTap | Description$ Artifacts and creatures your opponents control enter the battlefield tapped.
SVar:DBETBTap:DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Will this conversion introduce bugs?
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby timmermac » 19 May 2014, 14:53

As regarding Razia again, what about the ability of Glarecaster? Would a modification of that enable Razia?
"I just woke up, haven't had coffee, let alone a pee in 7 days, and I find out you stole my ass and made a ...mini-me! Carter, I should be irked currently, yes?" - Jack O'Neill
User avatar
timmermac
Tester
 
Posts: 1512
Joined: 17 May 2010, 20:36
Has thanked: 18 times
Been thanked: 95 times

Re: Card Development Questions

Postby Marek14 » 19 May 2014, 15:24

I wonder, will the decks need an optional Lurking Automaton parameter added so Conspiracy draft decks could be recorded properly? :)
Marek14
Tester
 
Posts: 2759
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 296 times

Re: Card Development Questions

Postby GregBonnu » 02 Jun 2014, 16:33

Not sure if this is the right spot to post this, but it appears the card Scouting Trek does not work properly. Instead of shuffling your deck & then putting a choice number of lands on top the order is reversed. Essentially, nothing happens as the lands are pointlessly shuffled back into the deck after you select them.
GregBonnu
 
Posts: 3
Joined: 02 Jun 2014, 16:21
Has thanked: 0 time
Been thanked: 0 time

Re: Card Development Questions

Postby friarsol » 02 Jun 2014, 16:45

GregBonnu wrote:Not sure if this is the right spot to post this, but it appears the card Scouting Trek does not work properly. Instead of shuffling your deck & then putting a choice number of lands on top the order is reversed. Essentially, nothing happens as the lands are pointlessly shuffled back into the deck after you select them.
We ask that all bug reports to be posted in the thread where you downloaded your release from. Additionally, check out the link in my signature for other useful tips.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby torridus » 10 Jun 2014, 02:02

I coded a card that isn't quite working properly. For some reason, Forge won't load when the .txt file is in the cards folder. It freezes, saying it's loaded 96% of the cards.

Code: Select all
Name:Medalliontest
ManaCost:3
Types:Artifact
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigDiscard | OptionalDecider$ You | TriggerDescription$ At the beginning of your upkeep, you may have target opponent discard a card at random.
SVar:TrigDiscard:AB$ Discard | Cost$ 0 | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | NumCards$ 1 | Mode$ Random
A:AB$ Reveal | Cost$ UB | Random$ True | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | NumCards$ 1 | SpellDescription$ Target opponent reveals a card at random from his or her hand.
References I used for coding:
Nath of the Gilt-Leaf | Open
Code: Select all
Name:Nath of the Gilt-Leaf
ManaCost:3 B G
Types:Legendary Creature Elf Warrior
PT:4/4
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigDiscard | OptionalDecider$ You | TriggerDescription$ At the beginning of your upkeep, you may have target opponent discard a card at random.
SVar:TrigDiscard:AB$ Discard | Cost$ 0 | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | NumCards$ 1 | Mode$ Random
T:Mode$ Discarded | ValidCard$ Card.OppOwn | TriggerZones$ Battlefield | Execute$ TrigToken | OptionalDecider$ You | TriggerDescription$ Whenever an opponent discards a card, you may put a 1/1 green Elf Warrior creature token onto the battlefield.
SVar:TrigToken:AB$ Token | Cost$ 0 | TokenAmount$ 1 | TokenName$ Elf Warrior | TokenTypes$ Creature,Elf,Warrior | TokenOwner$ You | TokenColors$ Green | TokenPower$ 1 | TokenToughness$ 1
SVar:Picture:http://www.wizards.com/global/images/magic/general/nath_of_the_gilt_leaf.jpg
Oracle:At the beginning of your upkeep, you may have target opponent discard a card at random.\nWhenever an opponent discards a card, you may put a 1/1 green Elf Warrior creature token onto the battlefield.
Hired Torturer | Open
Code: Select all
Name:Hired Torturer
ManaCost:2 B
Types:Creature Human Rogue
PT:2/3
K:Defender
A:AB$ LoseLife | Cost$ 3 B T | ValidTgts$ Opponent | LifeAmount$ 2 | SubAbility$ DBReveal | SpellDescription$ Target opponent loses 2 life and reveals a card at random from his or her hand.
SVar:DBReveal:DB$ Reveal | Random$ True | Defined$ Targeted
SVar:Picture:http://www.wizards.com/global/images/magic/general/hired_torturer.jpg
Oracle:Defender\n{3}{B}, {T}: Target opponent loses 2 life, then reveals a card at random from his or her hand.
Other "reveal at random" stuff includes Planeswalker's Mirth, Merfolk Spy, etc

Does "ValidTgts$ Opponent" just not work for Reveal abilities? Should I use something like Wand of Ith's code instead?
Code: Select all
A:AB$ Reveal | Cost$ 3 T | ValidTgts$ Player | TgtPrompt$ Select target player | Random$ True
torridus
 
Posts: 56
Joined: 03 Jul 2012, 12:58
Has thanked: 4 times
Been thanked: 9 times

Re: Card Development Questions

Postby swordshine » 10 Jun 2014, 13:54

torridus wrote:I coded a card that isn't quite working properly. For some reason, Forge won't load when the .txt file is in the cards folder. It freezes, saying it's loaded 96% of the cards.
Does "ValidTgts$ Opponent" just not work for Reveal abilities? Should I use something like Wand of Ith's code instead?
I added your card into my cardsfolder and it didn't freeze. I don't know what happened to you. "ValidTgts$ Opponent" is OK.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Bog Wraith » 21 Jun 2014, 20:04

Not sure if this is where to post a card request question so if it needs to be moved please do so.

The only card from MTGO's Vintage Masters not in the Forge database is Volrath's Shapeshifter. I was wondering if this card can be made or is it something that is not likley to be added in the future.
'Twas in the bogs of Cannelbrae
My mate did meet an early grave
'Twas nothing left for us to save
In the peat-filled bogs of Cannelbrae.
User avatar
Bog Wraith
Global Mod 1 (Ret)
 
Posts: 1108
Joined: 28 May 2008, 22:40
Location: Shandalar
Has thanked: 425 times
Been thanked: 153 times

Re: Card Development Questions

Postby Marek14 » 21 Jun 2014, 20:26

Bog Wraith wrote:Not sure if this is where to post a card request question so if it needs to be moved please do so.

The only card from MTGO's Vintage Masters not in the Forge database is Volrath's Shapeshifter. I was wondering if this card can be made or is it something that is not likley to be added in the future.
Volrath's Shapeshifter is strange. It has something very similar to copy ability, but it's technically classified as text changing because it has to be applied after control changes. Different layering.
Marek14
Tester
 
Posts: 2759
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 296 times

Re: Card Development Questions

Postby Bog Wraith » 23 Jun 2014, 02:58

Am I correct in inferring from your post that that this might make the card almost impossible to code into Forge?
'Twas in the bogs of Cannelbrae
My mate did meet an early grave
'Twas nothing left for us to save
In the peat-filled bogs of Cannelbrae.
User avatar
Bog Wraith
Global Mod 1 (Ret)
 
Posts: 1108
Joined: 28 May 2008, 22:40
Location: Shandalar
Has thanked: 425 times
Been thanked: 153 times

Re: Card Development Questions

Postby friarsol » 23 Jun 2014, 03:11

Bog Wraith wrote:Am I correct in inferring from your post that that this might make the card almost impossible to code into Forge?
I don't think it's as bad as Equinox, but it definitely has a chance to be in the last handful.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Bog Wraith » 23 Jun 2014, 04:38

Ok, thank you both for the info. :)
'Twas in the bogs of Cannelbrae
My mate did meet an early grave
'Twas nothing left for us to save
In the peat-filled bogs of Cannelbrae.
User avatar
Bog Wraith
Global Mod 1 (Ret)
 
Posts: 1108
Joined: 28 May 2008, 22:40
Location: Shandalar
Has thanked: 425 times
Been thanked: 153 times

Re: Card Development Questions

Postby HarePaiR » 23 Dec 2014, 16:13

Attempting to code Rock Hydra, even though you smarter folks say it can't be done! Let me know if I've run into the problem yet...I have a feeling this can be done but I'm getting null_pointer exceptions during testing.

Code: Select all
Name:Not Rock Hydra
ManaCost:X R R
Types:Creature Hydra
PT:0/0
K:etbCounter:P1P1:X
SVar:X:Count$xPaid

R:Event$ DamageDone | ActiveZones$ Battlefield | IsCombat$ True |ValidTarget$ Card.Self+counters_GE1_P1P1 | ReplaceWith$ CombatCounters | SVars$ CombatCounters,RemainingCombatDmg,Z | References$ CombatCounters,RemainingCombatDmg,Z | PreventionEffect$ True | Description$ If damage would be dealt to CARDNAME, prevent that damage and remove that many +1/+1 counters from it.
R:Event$ DamageDone | ActiveZones$ Battlefield | IsCombat$ False |ValidTarget$ Card.Self+counters_GE1_P1P1 | ReplaceWith$ NonCombatCounters | SVars$ NonCombatCounters,RemainingNonCombatDmg,Z | References$ NonCombatCounters,RemainingNonCombatDmg,Z | PreventionEffect$ True | Description$ If damage would be dealt to CARDNAME, prevent that damage and remove that many +1/+1 counters from it.
SVar:CombatCounters:AB$ RemoveCounter | Cost$ 0 | Defined$ ReplacedTarget | CounterType$ P1P1 | CounterNum$ 1 | SubAbility$ RemainingCombatDmg
SVar:NonCombatCounters:AB$ RemoveCounter | Cost$ 0 | Defined$ ReplacedTarget | CounterType$ P1P1 | CounterNum$ 1 | SubAbility$ RemainingNonCombatDmg
SVar:RemainingCombatDmg:DB$ DealDamage | Cost$ 0 | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | CombatDamage$ True | NumDmg$ Z
SVar:RemainingNonCombatDmg:DB$ DealDamage | Cost$ 0 | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | CombatDamage$ False | NumDmg$ Z
SVar:Z:ReplaceCount$DamageAmount.Minus1
SVar:Picture:http://www.wizards.com/global/images/magic/general/rock_hydra.jpg
Oracle:Rock Hydra enters the battlefield with X +1/+1 counters on it.\nFor each 1 damage that would be dealt to Rock Hydra, if it has a +1/+1 counter on it, remove a +1/+1 counter from it and prevent that 1 damage.\n{R}: Prevent the next 1 damage that would be dealt to Rock Hydra this turn.\n{R}{R}{R}: Put a +1/+1 counter on Rock Hydra. Activate this ability only during your upkeep.
I've eliminated the abilities that aren't causing problems at the moment. I'm trying to make it so you can kill the Hydra even if it is equipped with toughness boosters (I believe this is what makes its prevention effect different from Protean Hydra).

I'm trying to use the en-Kor creatures as a template (kudos to whoever coded those!). This is sort of a recursive script...is that my problem? The idea is that when damage is dealt to the hydra, check to see if it has any counters. If so, remove a counter and deal damage-1. When no counters, just deal the damage.

Perhaps subability damage does not trigger damage Events because it doesn't use the stack?

Null pointer exception:
Description: [I was dealing damage to a 4/4 Not Rock Hydra with a Chain Lightning when this occurred.]

NullPointerException | Open
Code: Select all
Forge Version:    1.5.32-SNAPSHOT-r-1u
Operating System: Mac OS X 10.10.1 x86_64
Java Version:     1.8.0_25 Oracle Corporation

java.lang.NullPointerException
   at forge.game.ability.AbilityUtils.calculateAmount(AbilityUtils.java:646)
   at forge.game.spellability.SpellAbilityCondition.areMet(SpellAbilityCondition.java:379)
   at forge.game.ability.AbilityUtils.resolveApiAbility(AbilityUtils.java:1230)
   at forge.game.ability.AbilityUtils.resolve(AbilityUtils.java:1214)
   at forge.player.HumanPlaySpellAbility.playAbility(HumanPlaySpellAbility.java:138)
   at forge.player.HumanPlay.playSpellAbilityNoStack(HumanPlay.java:195)
   at forge.player.PlayerControllerHuman.playSpellAbilityNoStack(PlayerControllerHuman.java:223)
   at forge.game.replacement.ReplacementHandler.executeReplacement(ReplacementHandler.java:236)
   at forge.game.replacement.ReplacementHandler.run(ReplacementHandler.java:135)
   at forge.game.replacement.ReplacementHandler.run(ReplacementHandler.java:81)
   at forge.game.card.Card.preventDamage(Card.java:5441)
   at forge.game.GameEntity.addDamage(GameEntity.java:58)
   at forge.game.ability.effects.DamageDealEffect.resolve(DamageDealEffect.java:161)
   at forge.game.ability.SpellApiBased.resolve(SpellApiBased.java:50)
   at forge.game.ability.AbilityUtils.resolveApiAbility(AbilityUtils.java:1232)
   at forge.game.ability.AbilityUtils.resolve(AbilityUtils.java:1214)
   at forge.game.zone.MagicStack.resolveStack(MagicStack.java:467)
   at forge.game.phase.PhaseHandler.startFirstTurn(PhaseHandler.java:972)
   at forge.game.GameAction.startGame(GameAction.java:1379)
   at forge.game.Match.startGame(Match.java:71)
   at forge.match.MatchUtil$2.run(MatchUtil.java:201)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)
HarePaiR
 
Posts: 21
Joined: 02 Dec 2014, 11:13
Has thanked: 11 times
Been thanked: 2 times

Re: Card Development Questions

Postby Marek14 » 23 Dec 2014, 16:43

I think one problem is that the Hydra should be able to "pick and choose" which damage will be prevented and which will be not if it doesn't have enough +1/+1 counters. Most obvious application would be in combat against multiple creatures where you might want to preferrably prevent damage from a lifelinker to stop its controller from getting life. Some cards like this might be held back until damage prevention will be robust enough to handle this.
Marek14
Tester
 
Posts: 2759
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 296 times

Re: Card Development Questions

Postby HarePaiR » 23 Dec 2014, 16:54

Ah, I see. So if not all damage is being prevented, you should be able to choose which damage, among simultaneous damage sources, gets prevented. I didn't even know you could do that! I assumed there was always some order. Thanks for the rules knowledge!

Isn't that also true for all the en-Kor, though? For example, redirecting deathtouch damage from a black source to a White Knight? I guess that's rather narrow, and I quite like having the en-Kor available.
HarePaiR
 
Posts: 21
Joined: 02 Dec 2014, 11:13
Has thanked: 11 times
Been thanked: 2 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 71 guests


Who is online

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

Login Form