Ability_Cost discussion
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
55 posts
• Page 3 of 4 • 1, 2, 3, 4
Re: Ability_Cost discussion
by zerker2000 » 17 Sep 2010, 22:13
Actually, all I meant was to refactor the keywords we have, e.g.
- Code: Select all
{1}{G}: Regenerate CARDNAME.
- Code: Select all
RegenerateMe:1 G
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Ability_Cost discussion
by zerker2000 » 19 Sep 2010, 04:09
As things stand, is there any reason not to swap Ability_Cost in for manaCost in the SpellAbility constructor?
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Ability_Cost discussion
by friarsol » 19 Sep 2010, 15:00
Backwards compatibility mostly. If we were to force all the Activated Abilities to using Ability_Cost, the ones that target would stop working unless we also wrote up a Target block for each one. Since we're trying to consolidate code here by making keywords, that is a bit counterproductive.zerker2000 wrote:As things stand, is there any reason not to swap Ability_Cost in for manaCost in the SpellAbility constructor?
However, I do see your point and will make a second constructor that takes on Ability_Cost and Target so when making an Activated Ability we don't have to remember to set the abCost once the ability is created. When all the abilities have been moved over to the new constructor we can axe the old one.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Ability_Cost discussion
by zerker2000 » 19 Sep 2010, 17:39
Why? We parse manaCost as if it were a ability cost, and then, when the time comes, run first beforePayMana(if any), and then payCost. For all new abilities, that would work, since that's what we're doing already; for all old ones, that should work, since payCost would reroute to Input_payManaCost, which is also what we're doing already. Am I missing something?friarsol wrote:Backwards compatibility mostly. If we were to force all the Activated Abilities to using Ability_Cost, the ones that target would stop working unless we also wrote up a Target block for each one.zerker2000 wrote:As things stand, is there any reason not to swap Ability_Cost in for manaCost in the SpellAbility constructor?
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Ability_Cost discussion
by Rob Cashwalker » 22 Sep 2010, 18:23
FYI:
Now naming a creature type (and storing the result) is considered a "Cost".... Whereas it previously would be done upon ETB.WoTC Sept. 2010 Oracle Update wrote:Functional Oracle Changes
Caller of the Hunt
As printed, you chose the creature type "as you play" Caller of the Hunt. This is relevant if you want to respond to it, so we're going back to that functionality. Rule 400.7c conveniently lets Caller of the Hunt reference choices made about it during its short time as a spell.
New wording
As an additional cost to cast Caller of the Hunt, choose a creature type.
Caller of the Hunt's power and toughness are each equal to the number of creatures of the chosen type on the battlefield.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Ability_Cost discussion
by Rob Cashwalker » 22 Sep 2010, 18:46
As the mana portion of the cost is being paid does abCost have any way of tracking this? Store in an SVar or dedicated property?400.7c
This rule states that abilities of permanents that require information about choices made as that permanent was cast as a spell can find the needed information. It wasn't very clear that the mana used to cast the spell was such a choice, so that's now specifically stated.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Ability_Cost discussion
by DennisBergkamp » 22 Sep 2010, 18:47
Interesting, what if it gets put onto the battlefield using something like Exhume / Elvish Piper?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Ability_Cost discussion
by friarsol » 22 Sep 2010, 19:25
It doesn't have it, but it was on the radar when I had been rewriting the Mana Pool.Rob Cashwalker wrote:As the mana portion of the cost is being paid does abCost have any way of tracking this? Store in an SVar or dedicated property?
I'm not sure how much it matters for Abilities (yet), but there are around 50 spells that care what type of mana was used to cast them. (This includes cards with Sunburst.)
Right before a spell/ability is put on the Stack we can add this information into a dedicated property. For permanent Spells, it should go on the Card itself (and be erased if it leaves the battlefield). Non-permanent spells and Abilities will remove the information as soon as they leave the stack.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Ability_Cost discussion
by Rob Cashwalker » 22 Sep 2010, 20:03
Good question...DennisBergkamp wrote:Interesting, what if it gets put onto the battlefield using something like Exhume / Elvish Piper?
Either Last-Known Information (not likely) or it doesn't have any type assigned. (more likely)
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Ability_Cost discussion
by Marek14 » 23 Sep 2010, 06:07
There's no LKI to be used here. It won't have any type assigned.
Re: Ability_Cost discussion
by slapshot5 » 28 Sep 2010, 05:44
I was looking into using this new Abilty_Cost code, but how am I supposed to use it for things without targets? I looked at the code in CardFactory: abDestroyTgt keyword. I'm fine until I get here:
I'm thinking an ability like The Hive, where you tap, pay a few mana, and a token comes into play. Can I just fudge it and force the target to be the controller of The Hive?
You can look at where I would use this code in CardFactory.java, search for "abMakeToken".
-slapshot5
- Code: Select all
final SpellAbility AbDstryTgt = new Ability_Activated(card, abCost, tgtDstryTgt)
I'm thinking an ability like The Hive, where you tap, pay a few mana, and a token comes into play. Can I just fudge it and force the target to be the controller of The Hive?
You can look at where I would use this code in CardFactory.java, search for "abMakeToken".
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Ability_Cost discussion
by friarsol » 28 Sep 2010, 13:18
Just send in null for Target, abPump doesn't have a target (it pumps itself) and the way it works is by creating a Target and then not filling out any of the required fields. I just updated the code, so the empty Target object isn't even necessary.slapshot5 wrote:I was looking into using this new Abilty_Cost code, but how am I supposed to use it for things without targets? I looked at the code in CardFactory: abDestroyTgt keyword. I'm fine until I get here:There is no Ability_Activated constructor that uses Ability_Cost that does not take a target.
- Code: Select all
final SpellAbility AbDstryTgt = new Ability_Activated(card, abCost, tgtDstryTgt)
I'm thinking an ability like The Hive, where you tap, pay a few mana, and a token comes into play. Can I just fudge it and force the target to be the controller of The Hive?
You can look at where I would use this code in CardFactory.java, search for "abMakeToken".
-slapshot5
Targeting the player would be incorrect, unless there are abilities that say "target player puts a * token into play" In that case you would need a TgtP. In the normal case, the activating player is the one who will gain the token.
abMakeToken has been on my checklist of abilities that would be handy to upgrade with abCost.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Ability_Cost discussion
by slapshot5 » 28 Sep 2010, 14:50
Thanks. That's what I thought I should do.friarsol wrote:Just send in null for Target, abPump doesn't have a target (it pumps itself) and the way it works is by creating a Target and then not filling out any of the required fields. I just updated the code, so the empty Target object isn't even necessary.
This should be done, though I haven't tested anything except the basic case of The Hive. I'll be converting more and adding tonight.friarsol wrote:abMakeToken has been on my checklist of abilities that would be handy to upgrade with abCost.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Ability_Cost discussion
by Sloth » 28 Sep 2010, 15:55
Your Cost Change fix seems to have broken something Sol.
This is what I get, when I activate the ability of Nantuko Calmer:
NoSuchMethodError: forge.Cost_Payment.changeCost()V
The card uses abDestroyTgtV.
This is what I get, when I activate the ability of Nantuko Calmer:
NoSuchMethodError: forge.Cost_Payment.changeCost()V
The card uses abDestroyTgtV.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Ability_Cost discussion
by DennisBergkamp » 28 Sep 2010, 17:34
Hmm, I can't even compile:
The method changeCost(SpellAbility) is undefined for the type Ability_Cost Cost_Payment.java /ForgeSVN5/src/forge line 385 Java Problem
The method changeCost(SpellAbility) is undefined for the type Ability_Cost Cost_Payment.java /ForgeSVN5/src/forge line 385 Java Problem
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
55 posts
• Page 3 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 91 guests