Card Contributions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Contributions
by jeffwadsworth » 06 Feb 2012, 16:54
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?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?
- 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
by ArsenalNut » 06 Feb 2012, 17:23
Like this?friarsol wrote:Can you Remember all of the cards Discarded and take the Max of Remembered.YouCtrl and Remembered.YouDontCtrl ?Sloth wrote: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.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?
EDIT: Maybe it works with a condition.
- Code: Select all
SVar:X:Remembered$Valid Card.YouCtrl/LimitMax.Y
SVar:Y:Remembered$Valid Card.YouDontCtrl
So many cards, so little time
-
ArsenalNut - Posts: 512
- Joined: 08 Jul 2011, 03:49
- Has thanked: 27 times
- Been thanked: 121 times
Re: Card Contributions
by moomarc » 13 Feb 2012, 08:34
Just committed Tundra Kavu.
(Edit: The relevant code starts at ln 860 in AbilityFactoryPump.java and ln 1872 in AbilityFactoryChoose.java)
- 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

(Edit: The relevant code starts at ln 860 in AbilityFactoryPump.java and ln 1872 in AbilityFactoryChoose.java)
-Marc
-
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
by 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
-
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
by 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):
(Using these as a template we can also script the Determined part of Bound // Determined when we support split cards)
- Code: Select all
SVar:NeedsToPlayVar:X GE1
SVar:X:Count$TypeInYourHand.Creature+cmcLEY
SVar:Y:Count$Valid Land.Untapped+YouCtrl/Minus.1
(Using these as a template we can also script the Determined part of Bound // Determined when we support split cards)
-Marc
-
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
by 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:
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);
}
}
- Code: Select all
// Manapool
if (l[0].contains("ManaPool")) {
final String color = l[0].split(":")[1];
return AllZone.getHumanPlayer().getManaPool().getAmountOfColor(color);
}
Last edited by moomarc on 15 Feb 2012, 16:21, edited 1 time in total.
-Marc
-
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
by 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
by moomarc » 15 Feb 2012, 16:20
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 thoughfriarsol 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()

-Marc
-
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
by 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
by moomarc » 15 Feb 2012, 16:53
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.friarsol wrote:Also, why is this locked into the Human's Mana Pool? Shouldn't it be based off the controller's 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

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
-
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
by 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
by 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.
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.
- 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
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.
Re: Card Contributions
by 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
Re: Card Contributions
by friarsol » 04 Mar 2012, 15:53
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.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
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Who is online
Users browsing this forum: No registered users and 32 guests