Skip to content

Commit

Permalink
fix AllSpells
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyoko-Jeremie committed May 6, 2024
1 parent 9bcae19 commit 0aa39c9
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 7 deletions.
78 changes: 71 additions & 7 deletions src/Cheats/Full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,70 @@ class FullCheatsBase extends Choice {
})
};

// /**
// *
// * @param {string} name
// * @param {boolean} SearchEnemies
// * @returns {spell}
// */
// function KinkyDungeonFindSpell(name, SearchEnemies = false) {
// if (KDSpellMemo[name]) return KDSpellMemo[name];
// if (SearchEnemies) {
// let spell = KinkyDungeonSearchSpell(KinkyDungeonSpellListEnemies, name);
// if (spell) {
// KDSpellMemo[name] = spell;
// return spell;
// }
// }
// let spell2 = KinkyDungeonSearchSpell(KinkyDungeonSpellsStart, name);
// if (spell2) {
// KDSpellMemo[name] = spell2;
// return spell2;
// }
// for (let key in KinkyDungeonSpellList) {
// let list = KinkyDungeonSpellList[key];
// let spell = KinkyDungeonSearchSpell(list, name);
// if (spell) {
// KDSpellMemo[name] = spell;
// return spell;
// }
// }
// return KinkyDungeonSearchSpell(KinkyDungeonSpells, name);
// }
//

AllSpells = () => {
// function KinkyDungeonResetMagic() {
// KDClearChoices();
// KinkyDungeonSpellChoiceCount = 30;
// KinkyDungeonSpells = [];
// KDRefreshSpellCache = true;
// Object.assign(KinkyDungeonSpells, KinkyDungeonSpellsStart); // Copy the dictionary
KinkyDungeonSpells = [];
Object.assign(KinkyDungeonSpells, KinkyDungeonSpellsStart);
for (let k of Object.keys(KinkyDungeonSpellList)) {
for (let sp of KinkyDungeonSpellList[k]) {
KinkyDungeonSpells.push(KinkyDungeonFindSpell(sp.name));
// let KDRefreshSpellCache = true;
// function KDPushSpell(spell) {
// KinkyDungeonSpells.push(JSON.parse(JSON.stringify(spell)));
// KDRefreshSpellCache = true;
// }
//
//
// KinkyDungeonSpells = [];
// KDRefreshSpellCache = true;
// for (let spell of saveData.spells) {
// let sp = KinkyDungeonFindSpell(spell);
// if (sp) KDPushSpell(sp);
// }
if (sp) {
KDPushSpell(sp);
}
// KinkyDungeonSpells.push(JSON.parse(JSON.stringify(KinkyDungeonFindSpell(sp.name))));
}
}
KDRefreshSpellCache = true;
KDUpdateSpellCache()
};
ListAllBaseSpells = () => {
return KinkyDungeonSpellsStart;
Expand Down Expand Up @@ -119,11 +175,19 @@ class FullCheatsBase extends Choice {
};

AllHeart = () => {
for (let i = 0; i < 10; i++) {
KDSendInput("heart", {type: "AP"});
KDSendInput("heart", {type: "SP"});
KDSendInput("heart", {type: "MP"});
KDSendInput("heart", {type: "WP"});
if (typeof KinkyDungeonGrid === "undefined") {
// new version 5.0
KDMaxStatStart = 100;
KDMaxStatStartPool = 100;
KDMaxStat = 500;
} else {
// old version
for (let i = 0; i < 10; i++) {
KDSendInput("heart", {type: "AP"});
KDSendInput("heart", {type: "SP"});
KDSendInput("heart", {type: "MP"});
KDSendInput("heart", {type: "WP"});
}
}
};
// function KinkyDungeonHandleHeart() {
Expand Down Expand Up @@ -400,7 +464,7 @@ class CheatsHook extends FullCheatsBase {
duration: 100,
},
};
this._SetBuff(buffObj, remove);
this._SetBuffIfEnabled(buffObj, remove);
};
_SetBuff = (buffObj: any, remove?: boolean) => {
// KinkyDungeonApplyBuff(KinkyDungeonPlayerBuffs, {id: "EnemySense", type: "EnemySense", duration: 100});
Expand Down
8 changes: 8 additions & 0 deletions src/WindowPatch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ declare global {
var KinkyDungeonSpellsStart: spell[];
var KinkyDungeonSpellList: Record<string, spell[]>;
var KinkyDungeonFindSpell: (name: string, SearchEnemies?: boolean) => spell;
var KDPushSpell: (sp: spell) => void;
var KDUpdateSpellCache: () => void;

var KinkyDungeonInventoryAddWeapon: (Name: string) => void;
var KinkyDungeonInventoryAddLoose: (Name: string) => void;
Expand Down Expand Up @@ -507,4 +509,10 @@ declare global {

function KDGenChestTrap(guaranteed, x, y, chestType, lock, noTrap);

// Distraction -- It lowers your stamina regen
let KDMaxStat: number; // Maximum any stat can get boosted to
let KDMaxStatStart: number; // Start of stats
let KDMaxStatStartPool: number; // Start of stats

let KDRefreshSpellCache: boolean;
}

0 comments on commit 0aa39c9

Please sign in to comment.