It is currently 12 Sep 2025, 14:54
   
Text Size

Expanding Cumulative Upkeep

Post MTG Forge Related Programming Questions Here

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

Expanding Cumulative Upkeep

Postby 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
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: Expanding Cumulative Upkeep

Postby Sloth » 24 Aug 2012, 09:58

This is the whole AI part of Cumulative upkeep:
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!
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Expanding Cumulative Upkeep

Postby moomarc » 24 Aug 2012, 10:31

Thanks a lot! Always appreciate your help!
-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: Expanding Cumulative Upkeep

Postby 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 :wink: ).

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
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: Expanding Cumulative Upkeep

Postby 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
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: Expanding Cumulative Upkeep

Postby friarsol » 25 Aug 2012, 21:33

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.
I think he already fixed them in the update after.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Expanding Cumulative Upkeep

Postby Sloth » 25 Aug 2012, 21:41

friarsol wrote:
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.
I think he already fixed them in the update after.
Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Expanding Cumulative Upkeep

Postby friarsol » 25 Aug 2012, 21:47

Sloth wrote:Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.
Now we just need cumulative upkeep paid/not paid triggers. Where did Hellfish wander off to?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Expanding Cumulative Upkeep

Postby 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
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: Expanding Cumulative Upkeep

Postby Sloth » 26 Aug 2012, 11:51

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.
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.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Expanding Cumulative Upkeep

Postby moomarc » 26 Aug 2012, 13:12

Sloth wrote:
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.
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.
Thanks Sloth. Sorry about removing them in the first place :oops: ).

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
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: Expanding Cumulative Upkeep

Postby Hellfish » 26 Aug 2012, 13:15

friarsol wrote:
Sloth wrote:Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.
Now we just need cumulative upkeep paid/not paid triggers. Where did Hellfish wander off to?
I'm in ETB replacement-land. :P
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
User avatar
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

Postby moomarc » 26 Aug 2012, 13:22

Hellfish wrote:
friarsol wrote:
Sloth wrote:Yup. And thanks for the cumulative upkeep code. "cumulative upkeep PayLife<1>" was working perfectly with your updates.
Now we just need cumulative upkeep paid/not paid triggers. Where did Hellfish wander off to?
I'm in ETB replacement-land. :P
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 :?
There's also Heart of Bogardan. :mrgreen:

Edit: Thoughtlash looks awesome for a Donate / Mill strategy. Looks like the original concept for Jace.
-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: Expanding Cumulative Upkeep

Postby 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?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Expanding Cumulative Upkeep

Postby moomarc » 26 Aug 2012, 13:35

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?
Yip. Added an hour or two ago (just before Glacial Chasm and Glacial Plating) =D>

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
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

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 56 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 56 users online :: 0 registered, 0 hidden and 56 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 56 guests

Login Form