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.4
  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("Queen:");
  20. console.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue + " = " + first.traits[0].trueValue > mother.traits[0].trueValue);
  21. console.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue + " = " + first.traits[1].trueValue > mother.traits[1].trueValue);
  22. console.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue + " = " + first.traits[2].trueValue > mother.traits[2].trueValue);
  23. console.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue + " = " + first.traits[3].trueValue > mother.traits[3].trueValue);
  24. console.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue + " = " + first.traits[4].trueValue > mother.traits[4].trueValue);
  25. 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) {
  26. game.Move("Mate", "Female", game, game)
  27. console.log("New Queen");
  28. } else {
  29. if (Math.random() >= 0.5) {
  30. if (game.maxArmyMoundSize() > game.armyMound().length) {
  31. game.Move("Army", "Female", game, game)
  32. console.log("New Female Army");
  33. } else {
  34. console.log("To many Army")
  35. }
  36. } else {
  37. game.Move("Worker", "Female", game, game)
  38. console.log("New Female Worker");
  39. }
  40. }
  41. }
  42.  
  43. if (game.maleMound().length > 0) {
  44. first = game.maleMound()[0];
  45. mother = game.father();
  46. consle.log("King:");
  47. console.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue + " = " + first.traits[0].trueValue > mother.traits[0].trueValue);
  48. console.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue + " = " + first.traits[1].trueValue > mother.traits[1].trueValue);
  49. console.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue + " = " + first.traits[2].trueValue > mother.traits[2].trueValue);
  50. console.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue + " = " + first.traits[3].trueValue > mother.traits[3].trueValue);
  51. console.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue + " = " + first.traits[4].trueValue > mother.traits[4].trueValue);
  52. 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) {
  53. game.Move("Mate", "Male", game, game);
  54. console.log("New King");
  55. } else {
  56. if (Math.random() >= 0.5) {
  57. if (game.maxArmyMoundSize() > game.armyMound().length) {
  58. game.Move("Army", "Male", game, game)
  59. console.log("New Male Army");
  60. } else {
  61. console.log("To many Army")
  62. }
  63. } else {
  64. game.Move("Worker", "Male", game, game)
  65. console.log("New Male Worker");
  66. }
  67. }
  68. }
  69. };
  70.  
  71. function workerCode() {
  72. this.onmessage = function (event) {
  73. }
  74.  
  75. var time = 500;
  76. setTimeout(function () { Tick() }, time);
  77.  
  78. function Tick() {
  79. postMessage("Tick");
  80. setTimeout(function () { Tick() }, time);
  81. }
  82. }
  83.  
  84. var blob = new Blob([
  85. "(" + workerCode.toString() + ")()"
  86. ], {type: "text/javascript"});
  87.  
  88. // Note: window.webkitURL.createObjectURL() in Chrome 10+.
  89. var worker = new Worker(window.URL.createObjectURL(blob));
  90. worker.onmessage = function (e) {
  91. main();
  92. };
  93. worker.postMessage("hello"); // Start the worker.
  94.  
  95. })();