[Enhancement] Unbreakable Razor Sword (#260)

* Unbreakable Razor Sword

* Update mm/2s2h/Enhancements/GameInteractor/GameInteractor.h

Co-authored-by: Garrett Cox <garrettjcox@gmail.com>

---------

Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
This commit is contained in:
aMannus
2024-05-22 09:05:03 -05:00
committed by Garrett Cox
co-authored by Garrett Cox
parent c6178683b0
commit a994c13b49
6 changed files with 22 additions and 1 deletions
+1
View File
@@ -387,6 +387,7 @@ void DrawCheatsMenu() {
UIWidgets::CVarCheckbox("Infinite Magic", "gCheats.InfiniteMagic");
UIWidgets::CVarCheckbox("Infinite Rupees", "gCheats.InfiniteRupees");
UIWidgets::CVarCheckbox("Infinite Consumables", "gCheats.InfiniteConsumables");
UIWidgets::CVarCheckbox("Unbreakable Razor Sword", "gCheats.UnbreakableRazorSword");
if (UIWidgets::CVarCheckbox("Moon Jump on L", "gCheats.MoonJumpOnL", {
.tooltip = "Holding L makes you float into the air"
})) {
@@ -0,0 +1,10 @@
#include <libultraship/bridge.h>
#include "Enhancements/GameInteractor/GameInteractor.h"
void RegisterUnbreakableRazorSword() {
REGISTER_VB_SHOULD(GI_VB_LOWER_RAZOR_SWORD_DURABILITY, {
if (CVarGetInteger("gEnhancements.Cheats.UnbreakableRazorSword", 0)) {
*should = false;
}
});
}
@@ -0,0 +1,6 @@
#ifndef CHEATS_UNBREAKABLE_RAZOR_SWORD_H
#define CHEATS_UNBREAKABLE_RAZOR_SWORD_H
void RegisterUnbreakableRazorSword();
#endif // CHEATS_UNBREAKABLE_RAZOR_SWORD_H
+1
View File
@@ -3,6 +3,7 @@
#include "Cheats/MoonJump.h"
#include "Cheats/Infinite.h"
#include "Cheats/UnbreakableRazorSword.h"
#include "Cycle/EndOfCycle.h"
#include "Masks/FierceDeityAnywhere.h"
#include "Masks/NoBlastMaskCooldown.h"
@@ -32,6 +32,7 @@ typedef enum {
GI_VB_SHOW_TITLE_CARD,
GI_VB_PLAY_ENTRANCE_CS,
GI_VB_DISABLE_FD_MASK,
GI_VB_LOWER_RAZOR_SWORD_DURABILITY,
GI_VB_SET_BLAST_MASK_COOLDOWN_TIMER,
GI_VB_PATCH_SIDEROLL,
GI_VB_PREVENT_MASK_TRANSFORMATION_CS,
@@ -10033,7 +10033,9 @@ s32 func_8083FF30(PlayState* play, Player* this) {
s32 func_8083FFEC(PlayState* play, Player* this) {
if (this->heldItemAction == PLAYER_IA_SWORD_RAZOR) {
if (gSaveContext.save.saveInfo.playerData.swordHealth > 0) {
gSaveContext.save.saveInfo.playerData.swordHealth--;
if (GameInteractor_Should(GI_VB_LOWER_RAZOR_SWORD_DURABILITY, true, NULL)) {
gSaveContext.save.saveInfo.playerData.swordHealth--;
}
if (gSaveContext.save.saveInfo.playerData.swordHealth <= 0) {
Item_Give(play, ITEM_SWORD_KOKIRI);
Player_UseItem(play, this, ITEM_SWORD_KOKIRI);