Expanding Cumulative Upkeep
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
22 posts
• Page 1 of 2 • 1, 2
Expanding Cumulative Upkeep
by moomarc » 24 Aug 2012, 09:54
I've just committed Aboroth with the initial work on supporting non-mana cumulative upkeep costs. Everything is good for the human but for now it has to have the RemAIDeck:True flag because I'm not sure where to add support for the non-mana cost payment for the AI. Can anyone point me to the right place?
-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: Expanding Cumulative Upkeep
by Sloth » 24 Aug 2012, 09:58
This is the whole AI part of Cumulative upkeep:
EDIT: Found and fixed the problem!
- Code: Select all
else { // computer
if (ComputerUtil.canPayCost(aiPaid)) {
ComputerUtil.playNoStack(aiPaid);
} else {
Singletons.getModel().getGameAction().sacrifice(c, null);
}
}
EDIT: Found and fixed the problem!
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Expanding Cumulative Upkeep
by moomarc » 24 Aug 2012, 10:31
Thanks a lot! Always appreciate your help!
-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: Expanding Cumulative Upkeep
by moomarc » 24 Aug 2012, 16:20
Perhaps you could help again. Where do I put in logic for whether or not to pay the upkeep cost. Should it be in Upkeep.java near the main AI handling of cumulative upkeep, or in canPayCost, or in a new boolean method shouldPayCost that returns true by default, but can be expanded as needed for different costs? At the moment the AI pays the upkeep if possible, but that's not so good for PayLife cumulative upkeep costs (especially not in cases like my test case where I cast Sleeper Agent, then enchanted it with Decomposition when the AI gained control of it - needless to say the AI didn't last long
).
Id like to add a logic something along the lines of: if card has SVar:SacMe:Value is greater than 2, or PayLife amount is greater than 10% (or maybe 20%) of current life total, then don't pay the upkeep life cost.

Id like to add a logic something along the lines of: if card has SVar:SacMe:Value is greater than 2, or PayLife amount is greater than 10% (or maybe 20%) of current life total, then don't pay the upkeep life cost.
-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: Expanding Cumulative Upkeep
by moomarc » 25 Aug 2012, 21:22
Sloth, I just saw on my RSS feed the two cumulative upkeep PayLife<1> cards you added. Looks like you forgot the colon divider before the description. I'm not near my pc so couldn't fix it myself. Thanks for the new 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: Expanding Cumulative Upkeep
by friarsol » 25 Aug 2012, 21:33
I think he already fixed them in the update after.moomarc wrote:Sloth, I just saw on my RSS feed the two cumulative upkeep PayLife<1> cards you added. Looks like you forgot the colon divider before the description. I'm not near my pc so couldn't fix it myself. Thanks for the new cards.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Expanding Cumulative Upkeep
by Sloth » 25 Aug 2012, 21:41
Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.friarsol wrote:I think he already fixed them in the update after.moomarc wrote:Sloth, I just saw on my RSS feed the two cumulative upkeep PayLife<1> cards you added. Looks like you forgot the colon divider before the description. I'm not near my pc so couldn't fix it myself. Thanks for the new cards.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Expanding Cumulative Upkeep
by friarsol » 25 Aug 2012, 21:47
Now we just need cumulative upkeep paid/not paid triggers. Where did Hellfish wander off to?Sloth wrote:Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Expanding Cumulative Upkeep
by moomarc » 26 Aug 2012, 11:34
I added some basic logic for whether or not the AI should pay upkeep costs via a new method ComputerUtil.shouldPayCost. At this stage it only returns false for life payment that would put the computer life below 10 or if the life cost is more than 25% of its remaining life. I've removed the remAIDeck flags from Morinfen and friends again, but suddenly had second thoughts because it may well play them even if it's below the 10 life threshold. So should I add it back or should it be fine? Either way it works well for Decomposition.
-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: Expanding Cumulative Upkeep
by Sloth » 26 Aug 2012, 11:51
I've re-added the remAIDeck flags from Morinfen and friends again. There are a lot of situations were they will be nothing more than a waste of mana, a card and some life points.moomarc wrote:I've removed the remAIDeck flags from Morinfen and friends again, but suddenly had second thoughts because it may well play them even if it's below the 10 life threshold. So should I add it back or should it be fine? Either way it works well for Decomposition.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Expanding Cumulative Upkeep
by moomarc » 26 Aug 2012, 13:12
Thanks Sloth. Sorry about removing them in the first placeSloth wrote:I've re-added the remAIDeck flags from Morinfen and friends again. There are a lot of situations were they will be nothing more than a waste of mana, a card and some life points.moomarc wrote:I've removed the remAIDeck flags from Morinfen and friends again, but suddenly had second thoughts because it may well play them even if it's below the 10 life threshold. So should I add it back or should it be fine? Either way it works well for Decomposition.

There was one other thing I wasn't sure of when I added shouldPayCost; in the conversion from string to cost, I wasn't sure whether the boolean should be true or not. Would you mind please checking the code to make sure that I didn't mess up there or make some other rookie mistake.
-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: Expanding Cumulative Upkeep
by Hellfish » 26 Aug 2012, 13:15
I'm in ETB replacement-land.friarsol wrote:Now we just need cumulative upkeep paid/not paid triggers. Where did Hellfish wander off to?Sloth wrote:Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.

I'll put it on my list. Any other cards beside Hibernation's End, Thought Lash and Balduvian Fallen that would use this? Oracle wording is inconsistent

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
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
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Expanding Cumulative Upkeep
by moomarc » 26 Aug 2012, 13:22
There's also Heart of Bogardan.Hellfish wrote:I'm in ETB replacement-land.friarsol wrote:Now we just need cumulative upkeep paid/not paid triggers. Where did Hellfish wander off to?Sloth wrote:Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.
I'll put it on my list. Any other cards beside Hibernation's End, Thought Lash and Balduvian Fallen that would use this? Oracle wording is inconsistent

Edit: Thoughtlash looks awesome for a Donate / Mill strategy. Looks like the original concept for Jace.
-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: Expanding Cumulative Upkeep
by friarsol » 26 Aug 2012, 13:32
For four cards it doesn't have to be very high on your list. I just like seeing Alliances cards get finished.
Speaking of which, moomarc did you script Dystopia yet?
Speaking of which, moomarc did you script Dystopia yet?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Expanding Cumulative Upkeep
by moomarc » 26 Aug 2012, 13:35
Yip. Added an hour or two ago (just before Glacial Chasm and Glacial Plating)friarsol wrote:For four cards it doesn't have to be very high on your list. I just like seeing Alliances cards get finished.
Speaking of which, moomarc did you script Dystopia yet?

Edit: With that there's only four sets left less than 80% implemented:
The Dark: 95 (24) / 119 = 79.83% (needs 1 more cards for 80%)
Alliances: 113 (31) / 144 = 78.47% (needs 3 more)
Visions: 131 (36) / 167 = 78.44% (needs 3 more)
Ice Age: 291 (81) / 372 = 78.23% (needs 7 more)
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
22 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 56 guests