mouseas / steamSummerMinigame

Steam Summer Sale 2015 - Auto-play Optimizer
MIT License
136 stars 189 forks source link

Auto-buy upgrades #37

Closed Niedzielan closed 9 years ago

Niedzielan commented 9 years ago

Auto-buys upgrades based on a 10-click-per-second Ideally, would want some sort of timer - if idle for (5 minutes), set clickpersec to 0 Chooses best of crit, auto, and click buys HP when <10% (? when should it?) PS - do crits come from auto too? For now I assume they do.

mouseas commented 9 years ago

This doesn't include an auto-clicker, right? It just calculates according to if the player clicks 10 times/sec?

I think it should buy health upgrades when HP drops below 60%. I have a bunch of upgrades and my health never drops below 90%

Crit hits come from clicking only, not auto-attack. The "Crits" item increases your crit % by 1 permanently. Note that if the player hasn't used a Crits item yet, the "Lucky Shot" upgrade is completely useless because the base % is 0%.

Niedzielan commented 9 years ago

It doesn't include auto-clicker, though it was designed with one in mind. The 10 clicks/sec is a semi-realistic estimate of clicking. I'm not entirely sure how to find the player's current crit rate - I'll look that up in a bit.

The base crit % is 0.1

mouseas commented 9 years ago

@Niedzielan Can you change when it buys health upgrades? I think once that's done I can see about adding this in.

Niedzielan commented 9 years ago

Done, but I'll make some changes to the auto-buy crits in a sec. Edit: Done

Niedzielan commented 9 years ago

Something seems to be breaking: g_Minigame.CurrentScene().m_rgPlayerUpgrades[clickbest].cost_for_next_level I get an error (sometimes), saying it's calling .cost_for_next_level on undefined. The trouble is, that clickbest is always either 2, 10, or 22, and PlayerUpgrades is always defined there. And then I start debugging and it works perfectly.

Probably something really simple that I can't spot at 3am

mouseas commented 9 years ago

Well, I can't merge it in until that's fixed.

mouseas commented 9 years ago

This seems to have also bought a bunch of tier 1 damage upgrades instead of saving for higher tier upgrades.

sithrebel15 commented 9 years ago

I haven't read his code but there are cases where its better to buy a low tier upgrade. Ex. the second tier costs 2 million and the first tier only costs 150k

mouseas commented 9 years ago

@DarkLordJack True, I suppose. The upgrades it bought for me seem to have still been the best bang per buck for damage upgrades, even if they were tiny upgrades.

@Niedzielan can you add a bit that reserves a certain amount of cash so the player may manually chose upgrades? For example, I'd want to buy Boss Loot upgrades even though they don't improve DPS, but if the auto-buy script uses all the available money, I can't do that.

Niedzielan commented 9 years ago

How much gold to save though? Going from Boss Loot 5 to 6 costs a mere 5,153K. Going from 15 to 16 costs 13,688M. I could reserve money up to the price of the next Boss Loot, but that could be either negligible, or huge.

Niedzielan commented 9 years ago

I finally got a +crit% item. Base "crit_percentage" is 0.1 (I assumed this was the actual %, so 0.1%) Using the +1% crit rate, the "crit_percentage" goes to 0.11 (so the base is 10%!)

I'm fairly sure I wasn't getting crits every 10 clicks. Can anyone else confirm?

mouseas commented 9 years ago

@Niedzielan I think the easiest way to reserve some gold is to just multiply how much gold the script thinks it has by a number between 0 and 1. E.g. 0.5 would reserve half the player's gold, 0.75 would reserve 25% of it. I'd be happy with 20-25% of the gold being reserved.