It is currently 21 May 2025, 06:19
   
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 RedDeckWins » 10 May 2013, 22:03

I'm working on Martyrdom, and have it working pretty much (I think). The only sticking point is the final "Only you may activate this ability." Does this mean that if you lost control of the creature, the opponent could not activate this ability, and you still could? If this is the case, How would I specify that only a certain player can activate the ability. This is what I have so far:

Code: Select all
Name:Martyrdom
ManaCost:1 W W
Types:Instant
A:SP$ Pump | Cost$ 1 W W | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SubAbility$ DBAnimate | SpellDescription$ Until end of turn, target creature you control gains "0: The next 1 damage that would be dealt to target creature or player this turn is dealt to this creature instead." Only you may activate this ability.
SVar:DBAnimate:DB$Animate | Abilities$ ABRedirect | Defined$ Targeted | sVars$ SelflessCombat,SelflessNonCombat,CombatDmg,NonCombatDmg,RestDmgCombat,RestDmg,OutOfSight,ExileEffect,X,Y
SVar:ABRedirect:AB$ Effect | Name$ Daughter of Autumn's Effect | Cost$ 0 | ValidTgts$ Creature.YouCtrl,Player | TgtPrompt$ Select target creature or player to redirect damage from | ReplacementEffects$ SelflessCombat,SelflessNonCombat | Triggers$ OutOfSight | SVars$ CombatDmg,NonCombatDmg,RestDmgCombat,RestDmg,ExileEffect,X,Y | References$ SelflessCombat,SelflessNonCombat,OutOfSight,CombatDmg,NonCombatDmg,RestDmgCombat,RestDmg,ExileEffect,X,Y | RememberObjects$ Targeted | ImprintCards$ Self | SpellDescription$ The next 1 damage that would be dealt to target creature or player this turn is dealt to this creature instead.
SVar:SelflessCombat:Event$ DamageDone | ValidTarget$ Card.IsRemembered | IsCombat$ True | ReplaceWith$ CombatDmg | Description$ The next 1 damage that would be dealt to target creature or player this turn is dealt to this creature instead.
SVar:SelflessNonCombat:Event$ DamageDone | ValidTarget$ Card.IsRemembered | IsCombat$ False | ReplaceWith$ NonCombatDmg | Secondary$ True | Description$ The next 1 damage that would be dealt to target creature or player this turn is dealt to this creature instead.
SVar:CombatDmg:AB$ DealDamage | Cost$ 0 | Defined$ Imprinted | DamageSource$ ReplacedSource | CombatDamage$ True | NumDmg$ 1 | SubAbility$ RestDmgCombat | ConditionCheckSVar$ Y | ConditionSVarCompare$ GE1
SVar:NonCombatDmg:AB$ DealDamage | Cost$ 0 | Defined$ Imprinted | DamageSource$ ReplacedSource | NumDmg$ 1 | SubAbility$ RestDmg | ConditionCheckSVar$ Y | ConditionSVarCompare$ GE1
SVar:RestDmgCombat:DB$ DealDamage | Defined$ Remembered | DamageSource$ ReplacedSource | CombatDamage$ True | NumDmg$ X | SubAbility$ ExileEffect
SVar:RestDmg:DB$ DealDamage | Defined$ Remembered | DamageSource$ ReplacedSource | NumDmg$ X | SubAbility$ ExileEffect
SVar:OutOfSight:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Creature.IsRemembered | Execute$ ExileEffect | Static$ True
SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile | Static$ True
SVar:X:ReplaceCount$DamageAmount/Minus.1
SVar:Y:ReplaceCount$DamageAmount
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/martyrdom.jpg
Oracle:Until end of turn, target creature you control gains "{0}: The next 1 damage that would be dealt to target creature or player this turn is dealt to this creature instead." Only you may activate this ability.
SetInfo:ALL Common
User avatar
RedDeckWins
 
Posts: 35
Joined: 20 Apr 2013, 16:45
Has thanked: 8 times
Been thanked: 10 times

Re: Card Development Questions

Postby RedDeckWins » 11 May 2013, 04:57

Also I am working on Thrull Wizard. I have it working, but the AI for "choose generic" always chooses the first in a list. What is the protocol for checking in a card implementation that the AI might not play optimally with all the time? In this case, I think selecting the first choice actually works out, but I was curious for future reference.

Code: Select all
Name:Thrull Wizard
ManaCost:2 B
Types:Creature Thrull Wizard
PT:1/1
A:AB$ GenericChoice | Cost$ 1 B | TgtPrompt$ Select target spell | TargetType$ Spell | ValidTgts$ Card.Black | TgtZone$ Stack | Choices$ PayB,Pay3 | Defined$ TargetedController | SpellDescription$ Counter target black spell unless that spell's controller pays B or 3
SVar:PayB:DB$ Counter | Defined$ Targeted | UnlessCost$ B | ChoiceDescription$ Counter spell unless you pay B
SVar:Pay3:DB$ Counter | Defined$ Targeted | UnlessCost$ 3 | ChoiceDescription$ Counter spell unless you pay 3
SVar:RemRandomDeck:True
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/thrull_wizard.jpg
Oracle:{1}{B}: Counter target black spell unless that spell's controller pays {B} or {3}
SetInfo:FEM Uncommon
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 » 11 May 2013, 06:49

RedDeckWins wrote:I'm working on Martyrdom, and have it working pretty much (I think). The only sticking point is the final "Only you may activate this ability." Does this mean that if you lost control of the creature, the opponent could not activate this ability, and you still could?
Yes.

RedDeckWins wrote:If this is the case, How would I specify that only a certain player can activate the ability.
We currently only have the parameters "AnyPlayer" and "AnyOpponent". This could be expanded to "DefinedActivator".
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 swordshine » 11 May 2013, 09:57

It seems the hardcoded Tarmogoyf is not characteristic defining. It's always a 0/1 creature in your hand. Shall I convert it to script?
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby friarsol » 11 May 2013, 12:15

swordshine wrote:It seems the hardcoded Tarmogoyf is not characteristic defining. It's always a 0/1 creature in your hand. Shall I convert it to script?
You had me at convert it to script. :D
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby friarsol » 11 May 2013, 12:23

RedDeckWins wrote:Also I am working on Thrull Wizard. I have it working, but the AI for "choose generic" always chooses the first in a list. What is the protocol for checking in a card implementation that the AI might not play optimally with all the time? In this case, I think selecting the first choice actually works out, but I was curious for future reference.
I think our recent push is to add AI specific script parameters that can help the AI out a bit in these cases.

The simplest way to handle that choice is to see if the AI has a black mana available. If it does, then choose the first choice. Otherwise, choose the second. Since the Thrull can only counter black stuff, it's probably just as easy to just let it choose the first thing, so it doesn't waste all it's mana trying to protect things it can't protect.
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 » 24 May 2013, 14:43

How to target a defined object? Precursor Golem and Ink-Treader Nephilim need this. Is sa.getTarget().addTarget(definedtarget) OK?
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Max mtg » 27 May 2013, 12:26

I have added Sorin Markov.
Please review the PlayerControlEffect.
If it's fine, do implement Mindslaver please.
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 Hellfish » 27 May 2013, 14:58

I never thought I'd see this effect added..
I'm on the phone so I can't test it atm, but just from looking at the svn I wonder; Does it account for the fact that you're still in control of yourself and can play your own spells as well?
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
User avatar
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

Postby Max mtg » 27 May 2013, 15:30

Hellfish wrote:I never thought I'd see this effect added..
I'm on the phone so I can't test it atm, but just from looking at the svn I wonder; Does it account for the fact that you're still in control of yourself and can play your own spells as well?
Absolutelly! You control both players while the effect lasts. It's just like hotseat game during a single turn.
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 moomarc » 27 May 2013, 16:28

Wow, thanks Max. I also can't test just yet, so just wondering: in terms of AI does the computer still see you as an opponent while controlling you? So will it use your own burn spells to damage you etc?
-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 Max mtg » 27 May 2013, 16:50

moomarc wrote:Wow, thanks Max. I also can't test just yet, so just wondering: in terms of AI does the computer still see you as an opponent while controlling you? So will it use your own burn spells to damage you etc?
So when will anyone be able to test this, and implement Mindslaver to confirm that it works?

No, I haven't provided any support for AI on this effect.
I do not develop AI algorithms, whatever I've done by now in that area was just refactoring.

Maybe Sloth could pay some attention to it. As for me it seems to be a tough job to implement logics like 'if I am mindcontrolled, try to kill myself" in AI.
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 moomarc » 27 May 2013, 17:53

I squeezed in a few minutes to try it out but there seems to be a problem with resolving targeted activated abilities (r21754). I activate either of Sorin's first two abilities and target the AI player. You can't proceed withthe game as the ability gets stuck on the stack without resolving. Tested with Prodigal Pyromancer and the same thing happens, although a Lightning Bolt resolves without issue.

So I couldn't test further for now, although I did update the script to use planeswalker ability markers and removed it from AI decks.
-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 Max mtg » 27 May 2013, 18:35

r21757 - Couldn't reproduce any problems. =( Everything worked!
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 moomarc » 27 May 2013, 19:30

Max mtg wrote:r21757 - Couldn't reproduce any problems. =( Everything worked!
Well whatever it is I also can't play with mouse only because there is no ok button to pass phases. I guess I'll just have to try a clean checkout tomorrow and see if that sorts out my problems.
-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

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