From 0aa39c9867fa46aa9c969fbbf7b05987c6e51735 Mon Sep 17 00:00:00 2001 From: LyokoJeremie Date: Mon, 6 May 2024 22:23:01 +0800 Subject: [PATCH] fix AllSpells --- src/Cheats/Full.ts | 78 ++++++++++++++++++++++++++++++++++++++++---- src/WindowPatch.d.ts | 8 +++++ 2 files changed, 79 insertions(+), 7 deletions(-) diff --git a/src/Cheats/Full.ts b/src/Cheats/Full.ts index fd932e3..4c6404d 100644 --- a/src/Cheats/Full.ts +++ b/src/Cheats/Full.ts @@ -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; @@ -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() { @@ -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}); diff --git a/src/WindowPatch.d.ts b/src/WindowPatch.d.ts index 2538a77..3c979dc 100644 --- a/src/WindowPatch.d.ts +++ b/src/WindowPatch.d.ts @@ -171,6 +171,8 @@ declare global { var KinkyDungeonSpellsStart: spell[]; var KinkyDungeonSpellList: Record; 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; @@ -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; }