mouseas / steamSummerMinigame

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

Added smarter medic logic, pumped up and resurrection policy, helper functions #61

Closed JCKE closed 9 years ago

JCKE commented 9 years ago

Added the rest of the abilities to ITEMS dictionary, and sorted it. Created helper functions to get the percentage of your total team in a lane, and to get the number of an ability active in a lane. Helpful in deciding if an ability would have the greatest impact in a lane.

Created revive ability policy, reviving if the lane has > 20% of total players and > 33% of the lane players are dead. Some sites incorrectly say revive affects all lanes, but thorough testing says otherwise. Modified medic policy to also look at the team's overall health (just looking at the 10 buckets of the histogram) and react even if the player's health is above 50%. Medic policy now looks at pumped up ability first, as it is basically a superior medic.

Things that could be tweaked/changed:

mouseas commented 9 years ago

I need 2 people to independently test this for errors and functionality.

Page- commented 9 years ago
Uncaught SyntaxError: Unexpected token =
    at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
    at Object.InjectedScript.evaluate (<anonymous>:694:21)
JCKE commented 9 years ago

@Page- Do you know what was being run at the time?

Page- commented 9 years ago

I used https://github.com/JCKE/steamSummerMinigame/blob/f500cbd3c558257c9f91678f9fecf3d2fe1ed265/autoPlay.js directly in the chrome console - sadly it mangles the lines so I couldn't comment directly on the offending line (not sure which one it is)

JCKE commented 9 years ago

@Page- In the console, beside the error in the top-right corner, it should have some sort of token error, like VM12345:6 or something. If you don't see it, you may have to click the arrow to expand the error. If you click on the tokens, one of them should take you to the spot in the code that caused the error.

Page- commented 9 years ago

Duh, yeah, been a while since I've debugged console run code:

Uncaught SyntaxError: Unexpected token =
    at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
    at Object.InjectedScript.evaluate (<anonymous>:694:21)
InjectedScript._evaluateOn @ VM276:895
InjectedScript._evaluateAndWrap @ VM276:828
InjectedScript.evaluate @ VM276:694
Page- commented 9 years ago

None of them go to anything useful though :S

JCKE commented 9 years ago

@Page- Aha, the problem seems to be with this function:

function numAbilityInLane(abilityId, lane=g_Minigame.CurrentScene().m_nExpectedLane) {
    // Checks if an ability is in use in a given lane and returns the number
    var numActive = g_Minigame.CurrentScene().m_rgLaneData[lane].abilities[abilityId];
    if (numActive === undefined)
        return 0;
    return numActive;
}

Testing in Firefox, it was fine defining an optionable parameters like this, but apparently it's the wrong way. This has basically been a crash course in JavaScript for me, so I'm not really surprised to find this haha

mouseas commented 9 years ago

Aaaand today's game is done. Looks like testing will have to halt for an hour or so.

JCKE commented 9 years ago

Darn! Well, I tested it a bit before the shutdown, so I'll commit that. In other news, my badge auto purchase system is almost ready!

winneon commented 9 years ago

You may want to add the LICENSE back.

winneon commented 9 years ago

Is this ready for merge? If so, I can fix the conflicts easily.

JCKE commented 9 years ago

I hope so; after testing it for awhile it has yet to break on me.