magowiz / Castle-Age-Autoplayer

Auto player for Castle Age game on Facebook.
http://caaplayer.freeforums.org
20 stars 30 forks source link

Google Sheets and Damage-based GB Target Selection #205

Closed Artifice closed 9 years ago

Artifice commented 9 years ago

Google Sheet Config settings Added google sheets master settings panel functionality. I found it time consuming to update the settings for all of my toons, especially when some of them are rotating through the same browser using the hypervisor, so I added functionality for managing configurations with a publicly URL-accessable google sheet. Here's an example of one here: https://docs.google.com/spreadsheets/d/18Z14iWOp1GokZInKXjO_c1L-WH1EGR-ePKyv7z2HK3o/edit?usp=sharing

The configuration of this is done through the Chrome extensions Castle Age options button. There you can enter the google sheet ID. '18Z14iWOp1GokZInKXjO_c1L-WH1EGR-ePKyv7z2HK3o' for the above example. You'll need to make your own. Also, you can enter any string including double-byte characters to use as a salt for the hash to identify your toons. I thought it would be bad to have a publicly accessible list of the FB IDs of all of my toons, so I've hashed and salted them. After you enter the salt string into the options, you can see the salted has for your toons come up in the logs, like this: gsheet: Loading google data sheet ID 18Z14iWOp1GokZInKXjO_c1L-WH1EGR-ePKyv7z2HK3o with hash 5982f989cb856661846febdeb458a7

Enter the hash 5982f989cb856661846febdeb458a7 into your spreadsheet under the mds column and put whatever config variables you want to enter into the top row, and CAAP will set those variables when it loads.

Guild Battlea Previously, attack or heal moves would be largely based on the win chance or level of the target. This could cause some moves that weren't strategic, like doing a whirlwind on a low healtah target with stunned neighbors when there were three full health targets lined up lower on the tower. I've rewritten all of the attack routines to estimate the amount of damage your attack will do, both against the direct target and secondary and tertiary targets in the case of whirlwind, fireball, and mass heal. This damage estimate is then multiplied against your estimated chance to beat that opponent, and then scaled to a number from 0 - 100. This gives a smarter target selection, and a lot of old modifiers, such as poison, guardian, stunned, healed, etc. are no longer necessary for attacks. You don't need to tell CAAP any more that whirlwind is a better attack than duel. It already knows. :D

The battle damage estimate is based off the formulas on this page, https://docs.google.com/spreadsheets/d/1qFnyxCNBULkUjkJns_k77AUasKkM4Am5QG8H8dK_6Xw/edit#gid=0 plus some tests to confirm how fireball and mass heal etc. work. They take into account your damage rune, any class specific generals you use, rune generals like Deianira, target poison or guardian status, class bonuses like rogue damage, tower splash or heal damage for mages or clerics respectively, and are rationalised to a per token benefit, i.e. fireball may do more damage, but not on a per token basis against a full tower. Not accounted for yet are Meekah, shout, and confidence.

I rewrote the loadout selection code, as well, to be more flexible and smarter about selecting loadouts. CAAP will do a scan of all your loadouts every 5 hours to see which loadout has which powers. Then, when doing that attack, if no loadout is specified or the specified loadout doesn't actually have that attack, it will use the first loadout that does have that power.

Other GB Stuff Fix for floating point health numbers. "2134.5/30000" Change to look for locked picture in towers instead of manual keep logic, to be more accurate for different levels of keeps. Swap added as a power, although not easy to use yet. Fix for using the wrong traits (guardian, poison, etc.) for targets Fix for 10v10, 100v100, and classic modifiers. It was using the internal names by mistake. Tune seal start definition from 1000 damage to 5000 damage Change class general loadout time to 15 min to 5 min before the 100v100 and 10v10 battles.

Monster Fix for 3X or 5X power attacks firing without enough stamina

Generals Move from general.getCurrent() and general.getLoadout() functions to general.current and general.loadout variables, to reduce CPU load by reducing Jquery DOM calls

Stats Add stats.runes values for the four runes Reduce the four essence Jquery DOM checks to one regex check to get all four values to reduce CPU load

Worker Fix the deletion of items not in template

Artifice commented 9 years ago

Thanks!

On Wed, Mar 18, 2015 at 2:10 PM, magowiz notifications@github.com wrote:

Merged #205 https://github.com/magowiz/Castle-Age-Autoplayer/pull/205.

— Reply to this email directly or view it on GitHub https://github.com/magowiz/Castle-Age-Autoplayer/pull/205#event-257721011 .

To avoid this the XP community uses Refactoring. Refactoring is the term used when improving the internal design of a system without changing the external behaviour. Code Rot is the reverse of this, which I call ‘Refuctoring’. -- Dave Chaplin http://www.byte-vision.com/ProductivityArticle.aspx