Page 1 of 2

Expanding Cumulative Upkeep

PostPosted: 24 Aug 2012, 09:54
by moomarc
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?

Re: Expanding Cumulative Upkeep

PostPosted: 24 Aug 2012, 09:58
by Sloth
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!

Re: Expanding Cumulative Upkeep

PostPosted: 24 Aug 2012, 10:31
by moomarc
Thanks a lot! Always appreciate your help!

Re: Expanding Cumulative Upkeep

PostPosted: 24 Aug 2012, 16:20
by moomarc
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.

Re: Expanding Cumulative Upkeep

PostPosted: 25 Aug 2012, 21:22
by moomarc
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.

Re: Expanding Cumulative Upkeep

PostPosted: 25 Aug 2012, 21:33
by friarsol
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.

Re: Expanding Cumulative Upkeep

PostPosted: 25 Aug 2012, 21:41
by Sloth
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.

Re: Expanding Cumulative Upkeep

PostPosted: 25 Aug 2012, 21:47
by friarsol
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?

Re: Expanding Cumulative Upkeep

PostPosted: 26 Aug 2012, 11:34
by moomarc
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.

Re: Expanding Cumulative Upkeep

PostPosted: 26 Aug 2012, 11:51
by Sloth
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.

Re: Expanding Cumulative Upkeep

PostPosted: 26 Aug 2012, 13:12
by moomarc
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.

Re: Expanding Cumulative Upkeep

PostPosted: 26 Aug 2012, 13:15
by Hellfish
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 :?

Re: Expanding Cumulative Upkeep

PostPosted: 26 Aug 2012, 13:22
by moomarc
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.

Re: Expanding Cumulative Upkeep

PostPosted: 26 Aug 2012, 13:32
by friarsol
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?

Re: Expanding Cumulative Upkeep

PostPosted: 26 Aug 2012, 13:35
by moomarc
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)