CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
ProdigyPNP

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: ProdigyPNP/ProdigyMathGameHacking
Path: blob/master/cheatGUI/src/hacks/battle.ts
Views: 723
1
// Battle Hacks
2
3
4
5
// BEGIN IMPORTS
6
import { Toast, NumberInput } from "../utils/swal"; // Import Toast and NumberInput from swal
7
import { category } from "../index"; // Import the Cheat GUI bases.
8
import Toggler from "../class/Toggler";
9
import Hack from "../class/Hack";
10
import { _, prodigy, game, VERY_LARGE_NUMBER, player } from "../utils/util"; // Import prodigy typings
11
// END IMPORTS
12
13
14
15
// BEGIN BATTLE HACKS
16
17
18
19
// Begin Disable Math
20
new Toggler(category.battle, "Disable math [PvP, PvE]", "Disable math in PvP, PvE, anywhere! This doesn't work in the Floatling town.").setEnabled(async () => {
21
22
// Use Prodigy's debug stuff to set EDUCATION_ENABLED to false
23
_.constants.constants["GameConstants.Debug.EDUCATION_ENABLED"] = false;
24
return Toast.fire("Enabled!", "You will no longer do Math!", "success");
25
26
27
}).setDisabled(async () => {
28
29
// Use Prodigy's debug stuff to set EDUCATION_ENABLED to true
30
_.constants.constants["GameConstants.Debug.EDUCATION_ENABLED"] = true;
31
return Toast.fire("Disabled!", "You will now do Math!", "success");
32
33
});
34
// End Disable Math
35
36
37
38
39
40
41
// Begin Instant Kill
42
new Toggler(category.battle, "Instant Kill [PvE]", "Makes your spells do insane damage in PvE!").setEnabled(async () => {
43
player.modifiers.damage = VERY_LARGE_NUMBER;
44
return Toast.fire("Enabled!", "You will now do insane damage in PvE!", "success");
45
46
}).setDisabled(() => {
47
player.modifiers.damage = 1;
48
return Toast.fire("Disabled!", "You will no longer do insane damage in PvE!", "success");
49
});
50
// End Instant Kill
51
52
53
54
55
56
57
// Begin PvP Health
58
new Hack(category.battle, "PvP Health [PvP]", "Increases your HP in PvP by a hell ton.").setClick(async () => {
59
player.pvpHP = VERY_LARGE_NUMBER;
60
player.getMaxHearts = () => VERY_LARGE_NUMBER;
61
return Toast.fire("Success!", "You now have lots of health!", "success");
62
});
63
// End PvP Health
64
65
66
67
68
69
70
// Begin Escape Battle
71
new Hack(category.battle, "Escape Battle [PvP, PvE]", "Escape any battle, PvP or PvE!").setClick(async () => {
72
const currentState = game.state.current;
73
if (currentState === "PVP") {
74
Object.fromEntries(_.instance.game.state.states).PVP.endPVP();
75
return Toast.fire(
76
"Escaped!",
77
"You have successfully escaped from the PvP battle.",
78
"success"
79
);
80
} else if (currentState === "CoOp") {
81
prodigy.world.$(player.data.zone);
82
return Toast.fire(
83
"Escaped!",
84
"You have successfully escaped from the battle.",
85
"success"
86
);
87
} else if (!["Battle", "SecureBattle"].includes(currentState)) {
88
return Toast.fire(
89
"Invalid State.",
90
"You are currently not in a battle.",
91
"error"
92
);
93
} else {
94
Object.fromEntries(_.instance.game.state.states)[currentState].runAwayCallback();
95
return Toast.fire(
96
"Escaped!",
97
"You have successfully escaped from the PvE battle.",
98
"success"
99
);
100
}
101
});
102
// End Escape Battle
103
104
105
106
107
108
// Begin Win Battle
109
new Hack(category.battle, "Win Battle [PvE]", "Instantly win a battle in PvE.").setClick(async () => {
110
111
const currentState = game.state.current;
112
console.log("Current State: " + currentState);
113
114
switch (currentState) {
115
case "PVP":
116
case "CoOp":
117
return Toast.fire(
118
"Invalid State.",
119
"PvP is not supported for this hack.",
120
"error"
121
);
122
case "Battle":
123
Object.fromEntries(_.instance.game.state.states).Battle.startVictory();
124
return Toast.fire(
125
"Victory!",
126
"You have successfully won the battle.",
127
"success"
128
);
129
case "SecureBattle":
130
Object.fromEntries(_.instance.game.state.states).SecureBattle.battleVictory();
131
return Toast.fire(
132
"Victory!",
133
"You have successfully won the battle.",
134
"success"
135
);
136
default:
137
return Toast.fire(
138
"Invalid State.",
139
"You are currently not in a battle.",
140
"error"
141
);
142
}
143
144
145
});
146
// End Win Battle
147
148
149
150
151
152
153
// Begin Set Battle Hearts
154
new Hack(category.battle, "Set Battle Hearts [PvP, PvE]", "Sets your hearts in battle, automatically raise your max hearts in PvP or PvE.").setClick(async () => {
155
const hp = await NumberInput.fire("Health Amount", "How much HP do you want?", "question");
156
if (hp.value === undefined) return;
157
player.getMaxHearts = () => +hp.value;
158
player.pvpHP = +hp.value;
159
player.data.hp = +hp.value;
160
return Toast.fire("Success!", "Your hearts have been set.", "success");
161
});
162
// End Set Battle Hearts
163
164
165
166
167
168
// Begin Fill Battle Energy
169
new Hack(category.battle, "Fill Battle Energy [PvP, PvE]", "Fills up your battle energy, if you are in PvP or PvE.").setClick(async () => {
170
const state = game.state.getCurrentState();
171
if (!("teams" in state)) return Toast.fire("Error", "You are currently not in a battle.", "error");
172
state.teams[0].setEnergy(99);
173
return Toast.fire("Success!", "Your battle energy has been filled.", "success");
174
});
175
// End Fill Battle Energy
176
177
178
// Begin Skip enemy turn
179
new Toggler(category.battle, "Skip enemy turn").setEnabled(async () => {
180
_.constants.constants["GameConstants.Battle.SKIP_ENEMY_TURN"] = true;
181
return Toast.fire("Skipping!", "Enemy turns will now be skipped.", "success");
182
}).setDisabled(async () => {
183
_.constants.constants["GameConstants.Battle.SKIP_ENEMY_TURN"] = false;
184
return Toast.fire("Disabled", "Enemy turns will no longer be skipped.", "success");
185
});
186
// End Skip enemy turn
187
188
189
190
191
192
193
// Begin Heal Team
194
new Hack(category.battle, "Heal Team [PvE]", "Instantly heals you and your pets, if you are in PvE.").setClick(async () => {
195
196
197
const currentState: string = game.state.current;
198
199
200
if (currentState === "PVP" || currentState === "CoOp") {
201
202
return Toast.fire("Invalid State.", "PvP is not supported for this hack.", "error");
203
204
} else if (["Battle", "SecureBattle"].includes(currentState)) {
205
player.heal();
206
return Toast.fire("Success!", "Your team has been healed successfully!", "success");
207
} else {
208
return Toast.fire("Invalid State.", "Your are currently not in a battle.", "error");
209
}
210
});
211
// End Heal Team
212
213
214
215
// END BATTLE HACKS
216
217