Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/cheatGUI/src/hacks/battle.ts
Views: 723
// Battle Hacks1234// BEGIN IMPORTS5import { Toast, NumberInput } from "../utils/swal"; // Import Toast and NumberInput from swal6import { category } from "../index"; // Import the Cheat GUI bases.7import Toggler from "../class/Toggler";8import Hack from "../class/Hack";9import { _, prodigy, game, VERY_LARGE_NUMBER, player } from "../utils/util"; // Import prodigy typings10// END IMPORTS11121314// BEGIN BATTLE HACKS15161718// Begin Disable Math19new Toggler(category.battle, "Disable math [PvP, PvE]", "Disable math in PvP, PvE, anywhere! This doesn't work in the Floatling town.").setEnabled(async () => {2021// Use Prodigy's debug stuff to set EDUCATION_ENABLED to false22_.constants.constants["GameConstants.Debug.EDUCATION_ENABLED"] = false;23return Toast.fire("Enabled!", "You will no longer do Math!", "success");242526}).setDisabled(async () => {2728// Use Prodigy's debug stuff to set EDUCATION_ENABLED to true29_.constants.constants["GameConstants.Debug.EDUCATION_ENABLED"] = true;30return Toast.fire("Disabled!", "You will now do Math!", "success");3132});33// End Disable Math34353637383940// Begin Instant Kill41new Toggler(category.battle, "Instant Kill [PvE]", "Makes your spells do insane damage in PvE!").setEnabled(async () => {42player.modifiers.damage = VERY_LARGE_NUMBER;43return Toast.fire("Enabled!", "You will now do insane damage in PvE!", "success");4445}).setDisabled(() => {46player.modifiers.damage = 1;47return Toast.fire("Disabled!", "You will no longer do insane damage in PvE!", "success");48});49// End Instant Kill50515253545556// Begin PvP Health57new Hack(category.battle, "PvP Health [PvP]", "Increases your HP in PvP by a hell ton.").setClick(async () => {58player.pvpHP = VERY_LARGE_NUMBER;59player.getMaxHearts = () => VERY_LARGE_NUMBER;60return Toast.fire("Success!", "You now have lots of health!", "success");61});62// End PvP Health63646566676869// Begin Escape Battle70new Hack(category.battle, "Escape Battle [PvP, PvE]", "Escape any battle, PvP or PvE!").setClick(async () => {71const currentState = game.state.current;72if (currentState === "PVP") {73Object.fromEntries(_.instance.game.state.states).PVP.endPVP();74return Toast.fire(75"Escaped!",76"You have successfully escaped from the PvP battle.",77"success"78);79} else if (currentState === "CoOp") {80prodigy.world.$(player.data.zone);81return Toast.fire(82"Escaped!",83"You have successfully escaped from the battle.",84"success"85);86} else if (!["Battle", "SecureBattle"].includes(currentState)) {87return Toast.fire(88"Invalid State.",89"You are currently not in a battle.",90"error"91);92} else {93Object.fromEntries(_.instance.game.state.states)[currentState].runAwayCallback();94return Toast.fire(95"Escaped!",96"You have successfully escaped from the PvE battle.",97"success"98);99}100});101// End Escape Battle102103104105106107// Begin Win Battle108new Hack(category.battle, "Win Battle [PvE]", "Instantly win a battle in PvE.").setClick(async () => {109110const currentState = game.state.current;111console.log("Current State: " + currentState);112113switch (currentState) {114case "PVP":115case "CoOp":116return Toast.fire(117"Invalid State.",118"PvP is not supported for this hack.",119"error"120);121case "Battle":122Object.fromEntries(_.instance.game.state.states).Battle.startVictory();123return Toast.fire(124"Victory!",125"You have successfully won the battle.",126"success"127);128case "SecureBattle":129Object.fromEntries(_.instance.game.state.states).SecureBattle.battleVictory();130return Toast.fire(131"Victory!",132"You have successfully won the battle.",133"success"134);135default:136return Toast.fire(137"Invalid State.",138"You are currently not in a battle.",139"error"140);141}142143144});145// End Win Battle146147148149150151152// Begin Set Battle Hearts153new Hack(category.battle, "Set Battle Hearts [PvP, PvE]", "Sets your hearts in battle, automatically raise your max hearts in PvP or PvE.").setClick(async () => {154const hp = await NumberInput.fire("Health Amount", "How much HP do you want?", "question");155if (hp.value === undefined) return;156player.getMaxHearts = () => +hp.value;157player.pvpHP = +hp.value;158player.data.hp = +hp.value;159return Toast.fire("Success!", "Your hearts have been set.", "success");160});161// End Set Battle Hearts162163164165166167// Begin Fill Battle Energy168new Hack(category.battle, "Fill Battle Energy [PvP, PvE]", "Fills up your battle energy, if you are in PvP or PvE.").setClick(async () => {169const state = game.state.getCurrentState();170if (!("teams" in state)) return Toast.fire("Error", "You are currently not in a battle.", "error");171state.teams[0].setEnergy(99);172return Toast.fire("Success!", "Your battle energy has been filled.", "success");173});174// End Fill Battle Energy175176177// Begin Skip enemy turn178new Toggler(category.battle, "Skip enemy turn").setEnabled(async () => {179_.constants.constants["GameConstants.Battle.SKIP_ENEMY_TURN"] = true;180return Toast.fire("Skipping!", "Enemy turns will now be skipped.", "success");181}).setDisabled(async () => {182_.constants.constants["GameConstants.Battle.SKIP_ENEMY_TURN"] = false;183return Toast.fire("Disabled", "Enemy turns will no longer be skipped.", "success");184});185// End Skip enemy turn186187188189190191192// Begin Heal Team193new Hack(category.battle, "Heal Team [PvE]", "Instantly heals you and your pets, if you are in PvE.").setClick(async () => {194195196const currentState: string = game.state.current;197198199if (currentState === "PVP" || currentState === "CoOp") {200201return Toast.fire("Invalid State.", "PvP is not supported for this hack.", "error");202203} else if (["Battle", "SecureBattle"].includes(currentState)) {204player.heal();205return Toast.fire("Success!", "Your team has been healed successfully!", "success");206} else {207return Toast.fire("Invalid State.", "Your are currently not in a battle.", "error");208}209});210// End Heal Team211212213214// END BATTLE HACKS215216217