From 54171e7745aea6ed0637a36d74c1ceae42d2d3d4 Mon Sep 17 00:00:00 2001 From: NctimeAza <102260794+NctimeAza@users.noreply.github.com> Date: Wed, 10 Aug 2022 15:44:50 +0800 Subject: [PATCH 1/2] Killaura damage value --- cheat-library/src/user/cheat/world/KillAura.cpp | 15 ++++++++++----- cheat-library/src/user/cheat/world/KillAura.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cheat-library/src/user/cheat/world/KillAura.cpp b/cheat-library/src/user/cheat/world/KillAura.cpp index b772e69..5e03ff3 100644 --- a/cheat-library/src/user/cheat/world/KillAura.cpp +++ b/cheat-library/src/user/cheat/world/KillAura.cpp @@ -20,7 +20,8 @@ namespace cheat::feature NF(f_OnlyTargeted, "Only targeted", "KillAura", true), NF(f_Range, "Range", "KillAura", 15.0f), NF(f_AttackDelay, "Attack delay time (in ms)", "KillAura", 100), - NF(f_RepeatDelay, "Repeat delay time (in ms)", "KillAura", 1000) + NF(f_RepeatDelay, "Repeat delay time (in ms)", "KillAura", 1000), + NF(f_DamageValue, "Crash damage value", "Damage mode", 233) { events::GameUpdateEvent += MY_METHOD_HANDLER(KillAura::OnGameUpdate); HookManager::install(app::MoleMole_BaseMoveSyncPlugin_ConvertSyncTaskToMotionInfo, BaseMoveSyncPlugin_ConvertSyncTaskToMotionInfo_Hook); @@ -39,6 +40,9 @@ namespace cheat::feature ImGui::TextColored(ImColor(255, 165, 0, 255), "Choose any or both modes below."); ConfigWidget("Crash Damage Mode", f_DamageMode, "Kill aura causes crash damage for monster around you."); + if (f_DamageMode) { + ConfigWidget("Damage Value", f_DamageValue, 1, 0, 10000000, "Crash damage value"); + } ConfigWidget("Instant Death Mode", f_InstantDeathMode, "Kill aura will attempt to instagib any valid target."); ImGui::SameLine(); ImGui::TextColored(ImColor(255, 165, 0, 255), "Can get buggy with bosses like PMA and Hydro Hypo."); @@ -94,7 +98,7 @@ namespace cheat::feature auto& manager = game::EntityManager::instance(); - for (const auto& monster : manager.entities(game::filters::combined::Monsters)) + for (const auto& monster : manager.entities(game::filters::combined::Monsters)) { auto monsterID = monster->runtimeID(); @@ -150,13 +154,14 @@ namespace cheat::feature attackSet.erase(monster->runtimeID()); + int Damage = f_DamageValue * 2.5 + 2; + auto combat = monster->combat(); - auto maxHP = app::MoleMole_SafeFloat_get_Value(combat->fields._combatProperty_k__BackingField->fields.maxHP, nullptr); auto crashEvt = app::MoleMole_EventHelper_Allocate_103(*app::MoleMole_EventHelper_Allocate_103__MethodInfo); app::MoleMole_EvtCrash_Init(crashEvt, monster->runtimeID(), nullptr); - crashEvt->fields.maxHp = maxHP; - crashEvt->fields.velChange = 1000; + crashEvt->fields.maxHp = Damage; + crashEvt->fields.velChange = 10000000; crashEvt->fields.hitPos = monster->absolutePosition(); app::MoleMole_EventManager_FireEvent(eventManager, reinterpret_cast(crashEvt), false, nullptr); diff --git a/cheat-library/src/user/cheat/world/KillAura.h b/cheat-library/src/user/cheat/world/KillAura.h index 4713f5e..f42c23a 100644 --- a/cheat-library/src/user/cheat/world/KillAura.h +++ b/cheat-library/src/user/cheat/world/KillAura.h @@ -15,6 +15,8 @@ namespace cheat::feature config::Field f_Range; config::Field f_AttackDelay; config::Field f_RepeatDelay; + config::Field f_DamageValue; + static KillAura& GetInstance(); From 1c58fd942b97fd548bfd0f9d229475e3b65365a6 Mon Sep 17 00:00:00 2001 From: NctimeAza <102260794+NctimeAza@users.noreply.github.com> Date: Wed, 10 Aug 2022 17:53:23 +0800 Subject: [PATCH 2/2] Fixed inaccurate actual damage value --- .../src/user/cheat/world/KillAura.cpp | 22 ++++++++++++++----- cheat-library/src/user/cheat/world/KillAura.h | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cheat-library/src/user/cheat/world/KillAura.cpp b/cheat-library/src/user/cheat/world/KillAura.cpp index 5e03ff3..abc1280 100644 --- a/cheat-library/src/user/cheat/world/KillAura.cpp +++ b/cheat-library/src/user/cheat/world/KillAura.cpp @@ -21,7 +21,7 @@ namespace cheat::feature NF(f_Range, "Range", "KillAura", 15.0f), NF(f_AttackDelay, "Attack delay time (in ms)", "KillAura", 100), NF(f_RepeatDelay, "Repeat delay time (in ms)", "KillAura", 1000), - NF(f_DamageValue, "Crash damage value", "Damage mode", 233) + NF(f_DamageValue, "Crash damage value", "Damage mode", 233.0f) { events::GameUpdateEvent += MY_METHOD_HANDLER(KillAura::OnGameUpdate); HookManager::install(app::MoleMole_BaseMoveSyncPlugin_ConvertSyncTaskToMotionInfo, BaseMoveSyncPlugin_ConvertSyncTaskToMotionInfo_Hook); @@ -153,14 +153,26 @@ namespace cheat::feature } attackSet.erase(monster->runtimeID()); - - int Damage = f_DamageValue * 2.5 + 2; - + auto combat = monster->combat(); auto crashEvt = app::MoleMole_EventHelper_Allocate_103(*app::MoleMole_EventHelper_Allocate_103__MethodInfo); app::MoleMole_EvtCrash_Init(crashEvt, monster->runtimeID(), nullptr); - crashEvt->fields.maxHp = Damage; + + //Migita^Rin#1762: Fixed inaccurate damage caused by floating point precision(Maybe) + float FPValue; + if (f_DamageValue <= 10000000) FPValue = 27.0f; + if (f_DamageValue <= 9000000) FPValue = 22.5f; + if (f_DamageValue <= 8000000) FPValue = 20.0f; + if (f_DamageValue <= 7000000) FPValue = 17.5f; + if (f_DamageValue <= 6000000) FPValue = 15.0f; + if (f_DamageValue <= 5000000) FPValue = 12.5f; + if (f_DamageValue <= 4000000) FPValue = 10.0f; + if (f_DamageValue <= 3000000) FPValue = 7.5f; + if (f_DamageValue <= 2000000) FPValue = 5.0f; + if (f_DamageValue <= 1000000) FPValue = 2.5f; + + crashEvt->fields.maxHp = f_DamageValue /0.4f + FPValue; crashEvt->fields.velChange = 10000000; crashEvt->fields.hitPos = monster->absolutePosition(); diff --git a/cheat-library/src/user/cheat/world/KillAura.h b/cheat-library/src/user/cheat/world/KillAura.h index f42c23a..5eeee7f 100644 --- a/cheat-library/src/user/cheat/world/KillAura.h +++ b/cheat-library/src/user/cheat/world/KillAura.h @@ -15,7 +15,7 @@ namespace cheat::feature config::Field f_Range; config::Field f_AttackDelay; config::Field f_RepeatDelay; - config::Field f_DamageValue; + config::Field f_DamageValue; static KillAura& GetInstance();