-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplugin.js
97 lines (86 loc) · 3.34 KB
/
plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/// <reference path="../../../ccloader/js/types/plugin.d.ts" />
import { ChargedOnly } from './features/chargedOnly.js';
import { Clone } from './features/clone.js';
import { Invincible } from './features/invincible.js';
import { Jetpack } from './features/jetpack.js';
import { NoDash } from './features/noDash.js';
import { NoDeath } from './features/noDeath.js';
import { NoGui } from './features/noGui.js';
import { NoShield } from './features/noShield.js';
import { Overdrive } from './features/overdrive.js';
import { RandomTime } from './features/randomTime.js';
import { RangedOnly } from './features/rangedOnly.js';
import { Tactician } from './features/tactician.js';
import { Unbalanced } from './features/unbalanced.js';
import { UiManager } from './uiManager.js';
/**
* @extends {ccloader.Plugin}
*/
export default class NewGamePlusPlus extends Plugin {
constructor() {
super();
this.uiManager = new UiManager();
this.features = [
new Jetpack(),
new Invincible(),
new ChargedOnly(),
new RangedOnly(),
new NoShield(),
new NoDash(),
new Overdrive(), // Must be after RangedOnly
new Unbalanced(),
new Clone(),
new NoDeath(),
new NoGui(),
new RandomTime(),
new Tactician(),
];
window.newGamePlusPlus = this;
}
prestart() {
this._fixSave();
this._callFeatures('prestart');
}
main() {
const cat = this.uiManager.addCategory('mods', 'Mods', 'MULTI');
cat.addEntry('jetpack', 'Jetpack', 'A jetpack that can be used with CTRL.', 2000);
cat.addEntry('invincible', 'Invincible', 'Attacks received do no damage at all.', 5000);
cat.addEntry('overdrive', 'Overdrive', 'All actions are combat arts.', 2000);
cat.addEntry('clone', 'Perfect Clone', 'Play as Shizuka.', 2000);
cat.addEntry('overload-extreme', 'Truly Unbalanced', 'Elements will overload after a single shot.', 100);
cat.addEntry('charged-only', 'Charged Only', 'It is imposible to shoot uncharged balls.', 100);
cat.addEntry('ranged-only', 'No Melee', 'Close quarter combat is not possible.', 100);
cat.addEntry('no-shield', 'No Shield', 'The shield is disabled.', 100);
cat.addEntry('no-dash', 'No Dash', 'Lea is unable to dash. Cheating is not allowed.', 100);
cat.addEntry('no-death', 'No Death', 'People die if you kill them.', 100);
cat.addEntry('no-gui', 'No GUI', 'Like nature intended it to be.', 100);
cat.addEntry('random-time', 'Broken Watch', 'Randomly speeds up and slows down time.', 100);
cat.addEntry('tactician', 'Tactician', 'Introduces a turn based combat mechanic.', 100);
this._callFeatures('main');
}
/**
* @param {string} name The name of the function to call on all features
*/
_callFeatures(name) {
for (const feature of this.features) {
if (typeof feature[name] === 'function') {
feature[name]();
}
}
}
_fixSave() {
sc.NewGamePlusModel.inject({
onStorageSave(storage) {
this.store.options = this.options; // this.store gets saved and loaded 1:1 but is barely used. Perfect for storing the modded options.
this.parent(storage);
},
onStoragePreLoad(json) {
// There is no way to know if modded options were removed so always restore them if available
if (json.newGamePlus && json.newGamePlus.options && json.newGamePlus.store.options) {
json.newGamePlus.options = json.newGamePlus.store.options;
}
this.parent(json);
},
});
}
}