Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int auto_warTotalBattles(int plan, int remaining)
- {
- // |plan| is a 6-bit bitmask where the lowest bit is a 1
- // if we finish the first quest, etc.
- int total_battles = 0;
- int completed_quests = 0;
- void fightUntilRemaining(int target_remaining)
- {
- int to_kill = max(0, remaining-target_remaining);
- int kills_per_battle = auto_warKillsPerBattle(completed_quests);
- int battles = ceil(to_kill.to_float()/kills_per_battle);
- auto_log_warning("to_kill = " + to_kill, "red");
- auto_log_warning("kills_per_battle = " + kills_per_battle, "red");
- auto_log_warning("battles = " + battles, "red");
- total_battles += battles;
- remaining -= battles * kills_per_battle;
- auto_log_warning("remaining = " + remaining, "red");
- }
- // 3 quests are accessible simultaneously.
- completed_quests += plan&1;
- completed_quests += (plan>>1)&1;
- completed_quests += (plan>>2)&1;
- fightUntilRemaining(1000-64);
- completed_quests += (plan>>3)&1;
- fightUntilRemaining(1000-192);
- completed_quests += (plan>>4)&1;
- fightUntilRemaining(1000-458);
- completed_quests += (plan>>5)&1;
- fightUntilRemaining(0);
- return total_battles;
- }
- int auto_warTotalBattles(int plan)
- {
- return auto_warTotalBattles(plan, auto_warEnemiesRemaining());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement