It is currently 15 Sep 2025, 05:55
   
Text Size

Card Contributions

Post MTG Forge Related Programming Questions Here

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

Re: Card Contributions

Postby jeffwadsworth » 06 Feb 2012, 16:54

ArsenalNut wrote:
Glint Hawk | Open
Name:Glint Hawk
ManaCost:W
Types:Creature Bird
Text:no text
PT:2/2
K:Flying
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChangeZone | TriggerDescription$ When CARDNAME enters the battlefield, sacrifice it unless you return an artifact you control to its owner's hand.
SVar:TrigChangeZone:AB$ ChangeZone | Cost$ 0 | Origin$ Battlefield | Destination$ Hand | Hidden$ True | ChangeType$ Artifact.YouCtrl | RememberChanged$ True | SubAbility$ DBSac
SVar:DBSac:DB$ Sacrifice | Cost$ 0 | Defined$ Self | SubAbility$ DBCleanup | ConditionCheckSVar$ X | ConditionSVarCompare$ LT1
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/glint_hawk.jpg
SetInfo:SOM|Common|http://magiccards.info/scans/en/som/10.jpg
Oracle:Flying\nWhen Glint Hawk enters the battlefield, sacrifice it unless you return an artifact you control to its owner's hand.
End

Any problem using this script to replace the hard coded ETB trigger that doesn't work for the computer?
Hehe. I used this same basic script for other cards, but the sacrifice would not follow the conditional...it would fire no matter what. Maybe that issue got fixed?
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Card Contributions

Postby ArsenalNut » 06 Feb 2012, 17:23

friarsol wrote:
Sloth wrote:
ArsenalNut wrote:
Jace's Archivist | Open
Name:Jace's Archivist
ManaCost:1 U U
Types:Creature Vedalken Wizard
Text:no text
PT:2/2
A:AB$ Discard | Cost$ U T | Defined$ You | CheckSVar$ HandSize | SVarCompare$ GE1 | Mode$ Hand | SubAbility$ DBOppDiscard1 | SpellDescription$ Each player discards his or her hand, then draws cards equal to the greatest number of cards a player discarded this way.
A:AB$ Discard | Cost$ U T | Defined$ You | CheckSVar$ HandSize | SVarCompare$ LT1 | RememberDiscarded$ True | Mode$ Hand | SubAbility$ DBOppDiscard2
SVar:DBOppDiscard1:DB$ Discard | Cost$ U T | Defined$ Opponent | RememberDiscarded$ True | Mode$ Hand | SubAbility$ DBDraw
SVar:DBOppDiscard2:DB$ Discard | Cost$ U T | Defined$ Opponent | Mode$ Hand | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ X | SubAbility$ DBOppDraw
SVar:DBOppDraw:DB$ Draw | Defined$ Opponent | NumCards$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
SVar:Y:Count$CardsInYourHand
SVar:HandSize:Count$CardsInOppHand/Minus.Y
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/jaces_archivist.jpg
End

Anybody see an issue with implementing Jace's Archivist like this?
If the hand size of the player with the most cards in his hand changes to be less than the hand of the other while this ability is on the stack, it miscalculates.

EDIT: Maybe it works with a condition.
Can you Remember all of the cards Discarded and take the Max of Remembered.YouCtrl and Remembered.YouDontCtrl ?
Like this?
Code: Select all
SVar:X:Remembered$Valid Card.YouCtrl/LimitMax.Y
SVar:Y:Remembered$Valid Card.YouDontCtrl
This would be much cleaner than the last script I came up with but it doesn't work. Remembered$ is handled by AbilityFactory.calculateAmount but the Y portion gets handled by CardFactoryUtil.xCount. xCount tries to count the valid cards on the battlefield that match instead. Is there a particular reason Remembered$ is handled in AbilityFactory.calculateAmount? It looks to xCount could be reworked to handle it directly.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Card Contributions

Postby moomarc » 13 Feb 2012, 08:34

Just committed Tundra Kavu.
Tundra Kavu | Open
Name:Tundra Kavu
ManaCost:2 R
Types:Creature Kavu
Text:no text
PT:2/2
A:AB$ Pump | Cost$ T | ValidTgts$ Land | TgtPrompt$ Select target land | SubAbility$ TypeChoice | StackDescription$ Target land becomes a | SpellDescription$ Target land becomes a Plains or an Island until end of turn.
SVar:TypeChoice:DB$ GenericChoice | Choices$ SVar1,SVar2 | StackDescription$ Plains or an Island until end of turn.
SVar:SVar1:DB$ Animate | Defined$ Targeted | Types$ Plains | OverwriteTypes$ True | KeepSupertypes$ True | KeepCardTypes$ True | RemoveAllAbilities$ True | ChoiceDescription$ Targeted land becomes a Plains until end of turn.
SVar:SVar2:DB$ Animate | Defined$ Targeted | Types$ Island | OverwriteTypes$ True | KeepSupertypes$ True | KeepCardTypes$ True | RemoveAllAbilities$ True | ChoiceDescription$ Targeted land becomes an Island until end of turn.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/tundra_kavu.jpg
SetInfo:APC|Common|http://magiccards.info/scans/en/ap/71.jpg
Oracle:{T}: Target land becomes a Plains or an Island until end of turn.
End
To correctly script this so that it doesn't bypass effect like the 'can't play that ability again this turn' clause on Interdict, the targeting is handled by an empty pump with a generic choice subability. I had to add the "StackDescription" param to Pump and GenericChoice to make the stack read nicely, so I would appreciate someone checking that I've slotted it in correctly. I followed the same basic pattern as in the other AFs with StackDescription, and I've tested and haven't come across any instances where it broke/changed the existing stack description, but I guess its always a good idea to check code that I've added 8-[

(Edit: The relevant code starts at ln 860 in AbilityFactoryPump.java and ln 1872 in AbilityFactoryChoose.java)
-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 Contributions

Postby moomarc » 13 Feb 2012, 10:37

I just added Ovinomancer. The AI doesn't use the bounce-to-prevent-sac even with a suitable NeedsToPlayVar stopping it from casting him too early, so I just committed with a RemAIDeck instead.
-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 Contributions

Postby moomarc » 15 Feb 2012, 09:20

Added Insist and Overmaster. I committed with RemAIDeck because I couldn't work out how to make further restrictions in TypeInYourHand work, otherwise it could work for the AI with Play main1 and the following (could tweak the Y svar for some leeway):
Code: Select all
SVar:NeedsToPlayVar:X GE1
SVar:X:Count$TypeInYourHand.Creature+cmcLEY
SVar:Y:Count$Valid Land.Untapped+YouCtrl/Minus.1
We could also just allow the AI to play it as a cheap draw-a-card for red and green, and hope that the rest of the ability helps on occasion.

(Using these as a template we can also script the Determined part of Bound // Determined when we support split cards)
-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 Contributions

Postby moomarc » 15 Feb 2012, 09:29

Added the code to support Glissa Sunseeker. The code isn't just copied directly from elsewhere for a change so would someone just check to ensure I didn't cause any damage with this (or if there's a cleaner way to do it). It all works though and doesn't break other cards that use Count$ManaPool.

New block:
Code: Select all
// Manapool
if (l[0].contains("ManaPool")) {
    final String color = l[0].split(":")[1];
    if (color.equals("All")) {
        return (AllZone.getHumanPlayer().getManaPool().getAmountOfColor(Constant.Color.WHITE)
        + AllZone.getHumanPlayer().getManaPool().getAmountOfColor(Constant.Color.BLUE)
        + AllZone.getHumanPlayer().getManaPool().getAmountOfColor(Constant.Color.BLACK)
        + AllZone.getHumanPlayer().getManaPool().getAmountOfColor(Constant.Color.RED)
        + AllZone.getHumanPlayer().getManaPool().getAmountOfColor(Constant.Color.GREEN)
        + AllZone.getHumanPlayer().getManaPool().getAmountOfColor(Constant.Color.COLORLESS));
    } else {
    return AllZone.getHumanPlayer().getManaPool().getAmountOfColor(color);
    }
}
Old block:
Code: Select all
// Manapool
if (l[0].contains("ManaPool")) {
    final String color = l[0].split(":")[1];
    return AllZone.getHumanPlayer().getManaPool().getAmountOfColor(color);
}
EDIT: Nothing important, but the comment for this commit says added support for ManaPool:Any instead of ManaPool:All and it seems that we can't revise comments.
Last edited by moomarc on 15 Feb 2012, 16:21, edited 1 time in total.
-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 Contributions

Postby friarsol » 15 Feb 2012, 15:23

I think you described this incorrectly (swapping your old block and new block), but it's much cleaner to just do this:

Code: Select all
AllZone.getHumanPlayer().getManaPool().totalMana()
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Contributions

Postby moomarc » 15 Feb 2012, 16:20

friarsol wrote:I think you described this incorrectly (swapping your old block and new block), but it's much cleaner to just do this:

Code: Select all
AllZone.getHumanPlayer().getManaPool().totalMana()
Oops. Definitely swapped them. Thanks for the clean solution. I had absolutely no knowledge of coding until I started looking deeper into Forge recently to try make some new scripts work, so I'll probably run into a few more of these along the way. One day I'll be great though :lol:
-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 Contributions

Postby friarsol » 15 Feb 2012, 16:29

Also, why is this locked into the Human's Mana Pool? Shouldn't it be based off the controller's mana pool?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Contributions

Postby moomarc » 15 Feb 2012, 16:53

friarsol wrote:Also, why is this locked into the Human's Mana Pool? Shouldn't it be based off the controller's mana pool?
I just based it on the existing block, so not sure what the reason is. But I guess its from when the AI had no mana pool.

Could I use getController or would there need to be two blocks, one for each player? (Sorry, still too new to have these things come naturally :wink: ) Also, how could I test it? I don't know of any card where the AI actually has excess mana (Isuppose in the case of Glissa Sunseeker, if the AI activates her ability he could destroy moxen and annoying 0-cost artifact creatures.

EDIT: Okay, I have that working now. Still have to keep RemAIDeck in Glissa's script because of targeting though (he'll will target the most expensive artifact you own it seems).
-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 Contributions

Postby jeffwadsworth » 15 Feb 2012, 20:25

Well, whenever and if ever the codebase gets any kind of AICheckSVar stuff going for AB's, cards like this will be quite interesting to play against.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Card Contributions

Postby squee1968 » 19 Feb 2012, 12:51

In celebration of Sloth's adding Solitary Confinement to Forge, (much thanks for that, it was the last card I needed for my Erayo deck), I've converted 4 hardcoded cards using his script.

Code: Select all
Name:Masticore
ManaCost:4
Types:Artifact Creature Masticore
Text:no text
PT:4/4
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigDiscard | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, sacrifice CARDNAME unless you discard a card.
SVar:TrigDiscard:AB$ Discard | Cost$ 0 | NumCards$ 1 | Mode$ TgtChoose | Optional$ True | RememberDiscarded$ True | SubAbility$ DBSacrifice
SVar:DBSacrifice:DB$ Sacrifice | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ0 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
A:AB$ Regenerate | Cost$ 2 | SpellDescription$ Regenerate CARDNAME.
A:AB$ DealDamage | Cost$ 2 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/masticore.jpg
SetInfo:UDS|Rare|http://magiccards.info/scans/en/ud/134.jpg
Oracle:At the beginning of your upkeep, sacrifice Masticore unless you discard a card.\n{2}: Masticore deals 1 damage to target creature.\n{2}: Regenerate Masticore.
End
Code: Select all
Name:Molten-Tail Masticore
ManaCost:4
Types:Artifact Creature Masticore
Text:no text
PT:4/4
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigDiscard | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, sacrifice CARDNAME unless you discard a card.
SVar:TrigDiscard:AB$ Discard | Cost$ 0 | NumCards$ 1 | Mode$ TgtChoose | Optional$ True | RememberDiscarded$ True | SubAbility$ DBSacrifice
SVar:DBSacrifice:DB$ Sacrifice | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ0 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
A:AB$DealDamage | Cost$ 4 ExileFromGrave<1/Creature> | NumDmg$ 4 | Tgt$ TgtCP | SpellDescription$ CARDNAME deals 4 damage to target creature or player.
A:AB$Regenerate | Cost$ 2 | SpellDescription$ Regenerate CARDNAME.
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/molten_tail_masticore.jpg
SetInfo:SOM|Mythic|http://magiccards.info/scans/en/som/177.jpg
Oracle:At the beginning of your upkeep, sacrifice Molten-Tail Masticore unless you discard a card.\n{4}, Exile a creature card from your graveyard: Molten-Tail Masticore deals 4 damage to target creature or player.\n{2}: Regenerate Molten-Tail Masticore.
End
Code: Select all
Name:Razormane Masticore
ManaCost:5
Types:Artifact Creature Masticore
Text:no text
PT:5/5
K:First Strike
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigDiscard | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, sacrifice CARDNAME unless you discard a card.
SVar:TrigDiscard:AB$ Discard | Cost$ 0 | NumCards$ 1 | Mode$ TgtChoose | Optional$ True | RememberDiscarded$ True | SubAbility$ DBSacrifice
SVar:DBSacrifice:DB$ Sacrifice | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ0 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
T:Mode$ Phase | Phase$ Draw | ValidPlayer$ You | OptionalDecider$ You | Execute$ TrigDealDamage | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your draw step, you may have CARDNAME deal 3 damage to target creature.
SVar:TrigDealDamage:AB$DealDamage | Cost$ 0 | Tgt$ TgtC | NumDmg$ 3
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/razormane_masticore.jpg
SetInfo:5DN|Rare|http://magiccards.info/scans/en/5dn/146.jpg
SetInfo:10E|Rare|http://magiccards.info/scans/en/10e/340.jpg
Oracle:First strike (This creature deals combat damage before creatures without first strike.)\nAt the beginning of your upkeep, sacrifice Razormane Masticore unless you discard a card.\nAt the beginning of your draw step, you may have Razormane Masticore deal 3 damage to target creature.
End
Code: Select all
Name:Eldrazi Monument
ManaCost:5
Types:Artifact
Text:no text
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ At the beginning of your upkeep, sacrifice a creature. If you can't, sacrifice CARDNAME.
SVar:TrigSac:AB$Sacrifice | Cost$ 0 | Defined$ You | SacValid$ Creature | SubAbility$ DBSacSelf | RememberSacrificed$ True
SVar:DBSacSelf:DB$ Sacrifice | Cost$ 0 | Defined$ Self | SubAbility$ DBCleanup | ConditionCheckSVar$ X | ConditionSVarCompare$ LT1 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:RememberDBSacSelfed$Amount
S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddPower$ 1 | AddToughness$ 1 | AddKeyword$ Flying | AddHiddenKeyword$ HIDDEN Indestructible | Description$ Creatures you control get +1/+1, have flying, and are indestructible.
SVar:PlayMain1:TRUE
SVar:RemAIDeck:True
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/eldrazi_monument.jpg
SetInfo:ZEN|Mythic|http://magiccards.info/scans/en/zen/199.jpg
Oracle:Creatures you control get +1/+1, have flying, and are indestructible.\nAt the beginning of your upkeep, sacrifice a creature. If you can't, sacrifice Eldrazi Monument.
End
1 question about Eldrazi Monument. The SubAbility$ DBSacSelf doesn't match the SVar:DBSac: Shouldn't it be SVar:DBSacSelf: ?? I figured I'd keep it like this as it was copied from Lithophage and Sacred Mesa. I'm guessing that Self is the default, but it's confusing.

EDIT: Fixed the SVar to SVar:DBSacSelf: as per friarsol's instructions. Looks like Lithophage and Sacred Mesa will have to be fixed as well. Someone should check similar cards for this error.
Last edited by squee1968 on 19 Feb 2012, 14:48, edited 1 time in total.
squee1968
 
Posts: 254
Joined: 18 Nov 2011, 03:28
Has thanked: 110 times
Been thanked: 45 times

Re: Card Contributions

Postby friarsol » 19 Feb 2012, 14:34

Squee,

That's the name of the Variable that's being called, there is no "default" it needs to match exactly.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Contributions

Postby squee1968 » 04 Mar 2012, 15:49

Thanks to Sloth's conversion of Triangle of War to script, I can now add the last card of my Beast deck: Contested Cliffs.

Code: Select all
Name:Contested Cliffs
ManaCost:no cost
Types:Land
Text:no text
A:AB$ Mana | Cost$ T | Produced$ 1 | SpellDescription$ Add 1 to your mana pool.
A:AB$ Fight | Cost$ R G T | ValidTgts$ Creature.Beast+YouCtrl | TgtPrompt$ Choose target Beast creature you control | TargetsFromDifferentZone$ True | TargetMin$ 2 | TargetMax$ 2 | SpellDescription$ Choose target Beast creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its power to the other.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/contested_cliffs.jpg
SetInfo:ONS|Rare|http://magiccards.info/scans/on/en/314.jpg
Oracle:{T}: Add {1} to your mana pool.\n{R{}G}, {T}: Choose target Beast creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its power to the other.
End
squee1968
 
Posts: 254
Joined: 18 Nov 2011, 03:28
Has thanked: 110 times
Been thanked: 45 times

Re: Card Contributions

Postby friarsol » 04 Mar 2012, 15:53

squee1968 wrote:Thanks to Sloth's conversion of Triangle of War to script, I can now add the last card of my Beast deck: Contested Cliffs.

Code: Select all
Name:Contested Cliffs
ManaCost:no cost
Types:Land
Text:no text
A:AB$ Mana | Cost$ T | Produced$ 1 | SpellDescription$ Add 1 to your mana pool.
A:AB$ Fight | Cost$ R G T | ValidTgts$ Creature.Beast+YouCtrl | TgtPrompt$ Choose target Beast creature you control | TargetsFromDifferentZone$ True | TargetMin$ 2 | TargetMax$ 2 | SpellDescription$ Choose target Beast creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its power to the other.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/contested_cliffs.jpg
SetInfo:ONS|Rare|http://magiccards.info/scans/on/en/314.jpg
Oracle:{T}: Add {1} to your mana pool.\n{R{}G}, {T}: Choose target Beast creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its power to the other.
End
I'm not sure if that works Squee. It looks like you won't be able to target anything for the second Target, and even without the +YouCtrl you would be forced to target a Beast your opponent controls.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 32 guests

cron

Main Menu

User Menu

Our Partners


Who is online

In total there are 32 users online :: 0 registered, 0 hidden and 32 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 32 guests

Login Form