Critter Auto Script

Basic Script to Automate Critter Mound

目前為 2020-03-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Critter Auto Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.9.3
  5. // @description Basic Script to Automate Critter Mound
  6. // @author You
  7. // @match https://crittermound.com/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. var first, mother, father;
  14.  
  15. var main = function() {
  16. if (game.femaleMound().length > 0) {
  17. first = game.femaleMound()[0];
  18. mother = game.mother();
  19. consle.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue);
  20. consle.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue);
  21. consle.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue);
  22. consle.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue);
  23. consle.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue);
  24. if (first.traits[0].trueValue > mother.traits[0].trueValue && first.traits[1].trueValue > mother.traits[1].trueValue && first.traits[2].trueValue > mother.traits[2].trueValue && first.traits[3].trueValue > mother.traits[3].trueValue && first.traits[4].trueValue > mother.traits[4].trueValue) {
  25. game.Move("Mate", "Female", game, game)
  26. console.log("New Queen");
  27. } else {
  28. if (Math.random() >= 0.5) {
  29. if (game.maxArmyMoundSize() > game.armyMound().length) {
  30. game.Move("Army", "Female", game, game)
  31. console.log("New Female Army");
  32. } else {
  33. console.log("To many Army")
  34. }
  35. } else {
  36. game.Move("Worker", "Female", game, game)
  37. console.log("New Female Worker");
  38. }
  39. }
  40. }
  41.  
  42. if (game.maleMound().length > 0) {
  43. first = game.maleMound()[0];
  44. mother = game.father();
  45. consle.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue);
  46. consle.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue);
  47. consle.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue);
  48. consle.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue);
  49. consle.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue);
  50. if (first.traits[0].trueValue > mother.traits[0].trueValue && first.traits[1].trueValue > mother.traits[1].trueValue && first.traits[2].trueValue > mother.traits[2].trueValue && first.traits[3].trueValue > mother.traits[3].trueValue && first.traits[4].trueValue > mother.traits[4].trueValue) {
  51. game.Move("Mate", "Male", game, game);
  52. console.log("New King");
  53. } else {
  54. if (Math.random() >= 0.5) {
  55. if (game.maxArmyMoundSize() > game.armyMound().length) {
  56. game.Move("Army", "Male", game, game)
  57. console.log("New Male Army");
  58. } else {
  59. console.log("To many Army")
  60. }
  61. } else {
  62. game.Move("Worker", "Male", game, game)
  63. console.log("New Male Worker");
  64. }
  65. }
  66. }
  67. };
  68.  
  69. function workerCode() {
  70. this.onmessage = function (event) {
  71. }
  72.  
  73. var time = 500;
  74. setTimeout(function () { Tick() }, time);
  75.  
  76. function Tick() {
  77. postMessage("Tick");
  78. setTimeout(function () { Tick() }, time);
  79. }
  80. }
  81.  
  82. var blob = new Blob([
  83. "(" + workerCode.toString() + ")()"
  84. ], {type: "text/javascript"});
  85.  
  86. // Note: window.webkitURL.createObjectURL() in Chrome 10+.
  87. var worker = new Worker(window.URL.createObjectURL(blob));
  88. worker.onmessage = function (e) {
  89. main();
  90. };
  91. worker.postMessage("hello"); // Start the worker.
  92.  
  93. })();