Implementing new Ability Factories and Card Support Code
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
Re: Considerations and Questions: Ability Factories
 by Agetian » 14 Nov 2012, 18:26
by Agetian » 14 Nov 2012, 18:26 
Yes, I'm sure it can be expanded for that as well, I'll see what I can do about that. As of right now, for some reason I'm experiencing a strange bug with the current implementation which I can't fix quite yet - the effect works for the first mana tapped (so, for the first land tapped, the limitation works fine), but if you tap a black land first, then you can pretty much tap any land after that... I'm trying to figure out what's up with that.friarsol wrote:Does have the potential to do multiple colors? Like for Soul Burn
EDIT: I think I fixed it.
P.S. Is it possible to limit the damage to creature's toughness or player's life total in script?
- Agetian
- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Considerations and Questions: Ability Factories
 by Agetian » 14 Nov 2012, 18:58
by Agetian » 14 Nov 2012, 18:58 
Some updates on this feature: a couple bugs are fixed, and multiple types of colors (e.g. SVar:XColor:BR) are confirmed to work now, e.g. for Soul Burn (so that you can spend black or red mana).
- Agetian
			
		- Agetian
- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Considerations and Questions: Ability Factories
 by Agetian » 14 Nov 2012, 19:07
by Agetian » 14 Nov 2012, 19:07 
Further update: for testing, submitted the Consume Spirit card, which is the simplest card among the kind. My tests indicate that it works fine, I also tested some other cards with normal X costs (Fireball, Blaze, etc.) to ensure I didn't break anything inadvertently, seems like it's fine, but who knows what might be up... please test and feel free to fix/change/etc. as necessary. Would be happy to know if any other cards would now be implementable from the "spend only specific color(s) of mana when paying X" kind (not sure if Drain Life would be doable now, no idea how to limit the total damage dealt per its description :\ ).
P.S. Consume Spirit is marked as RemAIDeck, no idea if the AI can already handle it or if some modifications would be necessary.
- Agetian
			
		P.S. Consume Spirit is marked as RemAIDeck, no idea if the AI can already handle it or if some modifications would be necessary.
- Agetian
- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Considerations and Questions: Ability Factories
 by friarsol » 14 Nov 2012, 19:24
by friarsol » 14 Nov 2012, 19:24 
I would think Atalya, Samite Master Crypt Rats and Crimson Hellkite would all be scriptable now.
			
		- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Considerations and Questions: Ability Factories
 by moomarc » 14 Nov 2012, 20:07
by moomarc » 14 Nov 2012, 20:07 
I think Drain Life might actually be possible using StoreSVar and then using LimitMax math function on the gain life's count method. Would need two StoreSVar abilities with conditions to differentiate whether a player or creature was targeted.
			-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: Considerations and Questions: Ability Factories
 by Agetian » 15 Nov 2012, 04:17
by Agetian » 15 Nov 2012, 04:17 
This is good news!friarsol wrote:I would think Atalya, Samite Master Crypt Rats and Crimson Hellkite would all be scriptable now.

This is good! Sadly, I looked around for StoreSVar examples but only found two cards in the current implementation of Forge that utilized it, and neither of them featured the use of LimitMax that would be based on the result of the StoreSVar... I'll check out the wiki to see if I can learn how to work with StoreSVar. EDIT: Nope, no information on the wiki.moomarc wrote:I think Drain Life might actually be possible using StoreSVar and then using LimitMax math function on the gain life's count method. Would need two StoreSVar abilities with conditions to differentiate whether a player or creature was targeted.

By the way, a rule-related question: for Drain Life, should it be legally possible to declare X more than the creature's toughness (but it'll be constrained at the value of the creature's toughness) or should it even not be possible to declare X more than that? (basically, if I use Drain Life on a 3/3 creature, should it be possible for me to declare X=5, in which case it would simply still drain only 3 life?)
- Agetian
Last edited by Agetian on 15 Nov 2012, 04:29, edited 2 times in total.
					
				
			
		- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Considerations and Questions: Ability Factories
 by friarsol » 15 Nov 2012, 04:23
by friarsol » 15 Nov 2012, 04:23 
Of course you can. If the limitation was on X itself the rules text would be different. "X cannot be greater than <blah>." Winter's Chill uses this exact text (X can't be greater than the number of snow lands you control.)Agetian wrote:By the way, a rule-related question: for Drain Life, should it be legally possible to declare X more than the creature's toughness (but it'll be constrained at the value of the creature's toughness) or should it even not be possible to declare X more than that? (basically, if I use Drain Life on a 3/3 creature, should it be possible for me to declare X=5, in which case it would simply still drain only 3 life?)
It thematically works with the card, but it is a cumbersome rule.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Considerations and Questions: Ability Factories
 by Agetian » 15 Nov 2012, 04:29
by Agetian » 15 Nov 2012, 04:29 
Thanks for confirming, Sol!
Unfortunately, couldn't find any information on StoreSVar/LimitMax on the wiki... If anyone has a bit of time for it, can you please demonstrate how StoreSVar and LimitMax can be used together to limit the X? Thanks in advance!
- Agetian
			
		Unfortunately, couldn't find any information on StoreSVar/LimitMax on the wiki... If anyone has a bit of time for it, can you please demonstrate how StoreSVar and LimitMax can be used together to limit the X? Thanks in advance!
- Agetian
- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Considerations and Questions: Ability Factories
 by moomarc » 15 Nov 2012, 08:07
by moomarc » 15 Nov 2012, 08:07 
LimitMax is a math function for the counting methods. So in Ana Sanctuary for instance you have SVar:Y:Count$Valid Permanent.Blue+YouCtrl/LimitMax.1 and in Nameless Race I used this sequence to limit the maximum available choice for the life payment:Agetian wrote:Thanks for confirming, Sol!
Unfortunately, couldn't find any information on StoreSVar/LimitMax on the wiki... If anyone has a bit of time for it, can you please demonstrate how StoreSVar and LimitMax can be used together to limit the X? Thanks in advance!
- Agetian
- Code: Select all
- SVar:X:XChoice/LimitMax.Limit
 SVar:Limit:SVar$Active/Plus.Buried
 SVar:Active:Count$Valid Permanent.White+nonToken+OppCtrl
 SVar:Buried:Count$ValidGrave Card.White+OppCtrl
I imagine you would use something like:
- Code: Select all
- ...DB$ GainLife | Defined$ You | LifeAmount$ DrainedLifeCard | Condition$ *Targeted a card* | SubAbility$ *Drained from player...
 SVar:DrainedLifeCard:Count$xPaid/LimitMax.LimitC
 SVar:LimitC:Targeted$CardPower
 SVar:DrainedLifePlayer:Count$xPaid/LimitMax.LimitP
 SVar:LimitP:TargetedPlayer$LifeAmount *Can't remember the correct function
-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: Considerations and Questions: Ability Factories
 by Agetian » 15 Nov 2012, 08:42
by Agetian » 15 Nov 2012, 08:42 
Hmm for some reason, the following crashes Forge, referring to the "X" part of the cost - I thought that maybe it had something to do with my color-limiting code, but no, even if you take out the "XColor" SVar, it still crashes:
P.S. The subability to drain from the player isn't plugged in yet, so DrainedLifePlayer and LimitP are not used in any way yet.
Thanks a lot in advance!
- Agetian
			
		- Code: Select all
- Name:Drain Life
 ManaCost:X 1 B
 Types:Sorcery
 Text:no text
 A:SP$DealDamage | Cost$ X 1 B | Tgt$ TgtCP | NumDmg$ DrainedLifeCard | SubAbility$ DBGainLife | References$ DrainedLifeCard
 SVar:XColor:B
 SVar:DBGainLife:DB$GainLife | Defined$ You | LifeAmount$ DrainedLifeCard | References$ DrainedLifeCard
 SVar:DrainedLifeCard:Count$xPaid/LimitMax.LimitC
 SVar:LimitC:Targeted$CardToughness
 SVar:DrainedLifePlayer:Count$xPaid/LimitMax.LimitP
 SVar:LimitP:TargetedPlayer$LifeAmount
 SVar:RemAIDeck:True
 SVar:Rarity:Common
 End
P.S. The subability to drain from the player isn't plugged in yet, so DrainedLifePlayer and LimitP are not used in any way yet.
Thanks a lot in advance!
- Agetian
- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Considerations and Questions: Ability Factories
 by moomarc » 15 Nov 2012, 15:40
by moomarc » 15 Nov 2012, 15:40 
I'll sort out the script, but for your reference here's the few small issues. Firstly, the X cost has to have a plain SVar:X:Count$xPaid which is what was causing the crash. Then the damage itself isn't limited, just the life you gain from it so the DealDamage would reference the X svar. There was also no SpellDescription so no text showed up in the card info panel. Lastly, it seems I was right in thinking that the LimitMax param only takes integers in the default method. I'll fix that up then get the script committed.Agetian wrote:Hmm for some reason, the following crashes Forge, referring to the "X" part of the cost - I thought that maybe it had something to do with my color-limiting code, but no, even if you take out the "XColor" SVar, it still crashes:Can you please tell me what I'm doing wrong?
- Code: Select all
Name:Drain Life
ManaCost:X 1 B
Types:Sorcery
Text:no text
A:SP$DealDamage | Cost$ X 1 B | Tgt$ TgtCP | NumDmg$ DrainedLifeCard | SubAbility$ DBGainLife | References$ DrainedLifeCard
SVar:XColor:B
SVar:DBGainLife:DB$GainLife | Defined$ You | LifeAmount$ DrainedLifeCard | References$ DrainedLifeCard
SVar:DrainedLifeCard:Count$xPaid/LimitMax.LimitC
SVar:LimitC:Targeted$CardToughness
SVar:DrainedLifePlayer:Count$xPaid/LimitMax.LimitP
SVar:LimitP:TargetedPlayer$LifeAmount
SVar:RemAIDeck:True
SVar:Rarity:Common
End
P.S. The subability to drain from the player isn't plugged in yet, so DrainedLifePlayer and LimitP are not used in any way yet.
Thanks a lot in advance!
- Agetian
I have noticed one oversight in your new code while testing this script. You can use any mana in your mana pool to pay X, not just the specified color. Great work though. A LOT of people (and Gos's decks) have been waiting for Consume Spirit and friends. (Consume Pirit seems to top the list of cards most used by Wizards precons, appearing in 8 decks. If I recall correctly the next was a paltry 5).
-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: Implementing new Ability Factories and Card Support Code
 by Agetian » 15 Nov 2012, 16:35
by Agetian » 15 Nov 2012, 16:35 
Thanks for your help and testing, moomarc! Would be glad if you could help out with Drain Life! In the meantime, I'll work on limiting the mana pool, thanks for catching that one! 
- Agetian
			
		
- Agetian
- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Implementing new Ability Factories and Card Support Code
 by jeffwadsworth » 15 Nov 2012, 16:46
by jeffwadsworth » 15 Nov 2012, 16:46 
You can bet that Mike Long has been chomping at the bit for it also.
			
		- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Implementing new Ability Factories and Card Support Code
 by Agetian » 15 Nov 2012, 17:00
by Agetian » 15 Nov 2012, 17:00 
Hehe 
Got the bug fixed, by the way, the mana pool should now be restricted properly too!
- Agetian
			
		
Got the bug fixed, by the way, the mana pool should now be restricted properly too!

- Agetian
- Agetian
- Programmer
- Posts: 3490
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Implementing new Ability Factories and Card Support Code
 by moomarc » 15 Nov 2012, 18:57
by moomarc » 15 Nov 2012, 18:57 
In that case I give you Drain Life.Agetian wrote:Hehe
Got the bug fixed, by the way, the mana pool should now be restricted properly too!
- Agetian
 Tested in single and multiplayer, targeting creatures and players.
  Tested in single and multiplayer, targeting creatures and players.-Marc
		- 
				 
 moomarc
- Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Who is online
Users browsing this forum: No registered users and 22 guests
