mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-08 20:38:27 -05:00
Add OneHit KO (#27)
This commit is contained in:
parent
b57e44afc9
commit
af5313d89e
@ -36,6 +36,7 @@ uint32_t minishLink;
|
|||||||
uint32_t gravityLevel;
|
uint32_t gravityLevel;
|
||||||
uint32_t resetLinkScale;
|
uint32_t resetLinkScale;
|
||||||
uint32_t invisibleLink;
|
uint32_t invisibleLink;
|
||||||
|
uint32_t oneHitKO;
|
||||||
|
|
||||||
static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
|
static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
|
||||||
if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) {
|
if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) {
|
||||||
@ -631,7 +632,13 @@ static bool OneHitKOHandler(std::shared_ptr<Ship::Console> Console, const std::v
|
|||||||
return CMD_FAILED;
|
return CMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
try {
|
||||||
|
oneHitKO = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
} catch (std::invalid_argument const& ex) {
|
||||||
|
SohImGui::console->SendErrorMessage("[SOH] One-hit KO value must be a number.");
|
||||||
|
return CMD_FAILED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool PacifistHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
|
static bool PacifistHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
|
||||||
@ -975,7 +982,7 @@ void DebugConsole_Init(void) {
|
|||||||
{ "value", Ship::ArgumentType::NUMBER }
|
{ "value", Ship::ArgumentType::NUMBER }
|
||||||
}});
|
}});
|
||||||
|
|
||||||
CMD_REGISTER("ohko", { OneHitKOHandler, "Activates one hit KO.", {
|
CMD_REGISTER("ohko", { OneHitKOHandler, "Activates one hit KO. Any damage kills Link and he cannot gain health in this mode.", {
|
||||||
{ "value", Ship::ArgumentType::NUMBER }
|
{ "value", Ship::ArgumentType::NUMBER }
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ extern uint32_t minishLink;
|
|||||||
extern uint32_t gravityLevel;
|
extern uint32_t gravityLevel;
|
||||||
extern uint32_t resetLinkScale;
|
extern uint32_t resetLinkScale;
|
||||||
extern uint32_t invisibleLink;
|
extern uint32_t invisibleLink;
|
||||||
|
extern uint32_t oneHitKO;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "soh/Enhancements/debugconsole.h"
|
||||||
|
|
||||||
|
|
||||||
static uint16_t _doActionTexWidth, _doActionTexHeight = -1;
|
static uint16_t _doActionTexWidth, _doActionTexHeight = -1;
|
||||||
static uint16_t DO_ACTION_TEX_WIDTH() {
|
static uint16_t DO_ACTION_TEX_WIDTH() {
|
||||||
@ -2641,6 +2643,14 @@ s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) {
|
|||||||
osSyncPrintf("***** 増減=%d (now=%d, max=%d) ***", healthChange, gSaveContext.health,
|
osSyncPrintf("***** 増減=%d (now=%d, max=%d) ***", healthChange, gSaveContext.health,
|
||||||
gSaveContext.healthCapacity);
|
gSaveContext.healthCapacity);
|
||||||
|
|
||||||
|
// If one-hit ko mode is on, any damage kills you and you cannot gain health.
|
||||||
|
if (oneHitKO) {
|
||||||
|
if (healthChange < 0)
|
||||||
|
gSaveContext.health = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
if (healthChange > 0) { Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &D_801333D4, 4,
|
if (healthChange > 0) { Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &D_801333D4, 4,
|
||||||
&D_801333E0, &D_801333E0, &D_801333E8);
|
&D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
|
@ -3607,8 +3607,7 @@ s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 modifiedDamage = damage;
|
s32 modifiedDamage = damage;
|
||||||
if (modified)
|
if (modified) {
|
||||||
{
|
|
||||||
modifiedDamage *= (1 << CVar_GetS32("gDamageMul", 0));
|
modifiedDamage *= (1 << CVar_GetS32("gDamageMul", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user