-
Notifications
You must be signed in to change notification settings - Fork 640
[Anchor] Add PVP damage multiplier #6011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| #include "soh/Network/Anchor/Anchor.h" | ||
| #include <nlohmann/json.hpp> | ||
| #include <libultraship/libultraship.h> | ||
| #include "soh/Enhancements/enhancementTypes.h" | ||
| #include "soh/Enhancements/game-interactor/GameInteractor.h" | ||
|
|
||
| extern "C" { | ||
|
|
@@ -14,6 +15,32 @@ void func_80838280(Player* player); | |
| * DAMAGE_PLAYER | ||
| */ | ||
|
|
||
| int GetPvpDamageMultiplier(const RoomState& roomState) { | ||
| uint8_t damageOption = roomState.pvpDamageMult; | ||
| switch (damageOption) { | ||
| case PVP_DAMAGE_MULT_1X: | ||
| return 1; | ||
| case PVP_DAMAGE_MULT_2X: | ||
| return 2; | ||
| case PVP_DAMAGE_MULT_4X: | ||
| return 4; | ||
| case PVP_DAMAGE_MULT_8X: | ||
| return 8; | ||
| case PVP_DAMAGE_MULT_16X: | ||
| return 16; | ||
| case PVP_DAMAGE_MULT_32X: | ||
| return 32; | ||
| case PVP_DAMAGE_MULT_64X: | ||
| return 64; | ||
| case PVP_DAMAGE_MULT_128X: | ||
| return 128; | ||
| case PVP_DAMAGE_MULT_256X: | ||
| return 256; | ||
| default: | ||
| return 1; | ||
| } | ||
| } | ||
|
|
||
| void Anchor::SendPacket_DamagePlayer(u32 clientId, u8 damageEffect, u8 damage) { | ||
| if (!IsSaveLoaded()) { | ||
| return; | ||
|
|
@@ -47,7 +74,7 @@ void Anchor::HandlePacket_DamagePlayer(nlohmann::json payload) { | |
| u8 damageEffect = payload["damageEffect"].get<u8>(); | ||
| u8 damage = payload["damage"].get<u8>(); | ||
|
|
||
| self->actor.colChkInfo.damage = damage * 8; // Arbitrary number currently, need to fine tune | ||
| self->actor.colChkInfo.damage = damage * GetPvpDamageMultiplier(roomState) * 4; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a u8, with OHKO you're going to overflow it passing damage as parameter to |
||
|
|
||
| if (damageEffect == DUMMY_PLAYER_HIT_RESPONSE_FIRE) { | ||
| for (int i = 0; i < ARRAY_COUNT(self->bodyFlameTimers); i++) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,13 @@ nlohmann::json Anchor::PrepRoomState() { | |
| if (isGlobalRoom) { | ||
| // Global room uses hardcoded settings | ||
| payload["pvpMode"] = 0; | ||
| payload["pvpDamageMult"] = 0; | ||
| payload["showLocationsMode"] = 0; | ||
| payload["teleportMode"] = 0; | ||
| payload["syncItemsAndFlags"] = 0; | ||
| } else { | ||
| payload["pvpMode"] = CVarGetInteger(CVAR_REMOTE_ANCHOR("RoomSettings.PvpMode"), 1); | ||
| payload["pvpDamageMult"] = CVarGetInteger(CVAR_REMOTE_ANCHOR("RoomSettings.PvpDamageMult"), 1); | ||
| payload["showLocationsMode"] = CVarGetInteger(CVAR_REMOTE_ANCHOR("RoomSettings.ShowLocationsMode"), 1); | ||
| payload["teleportMode"] = CVarGetInteger(CVAR_REMOTE_ANCHOR("RoomSettings.TeleportMode"), 1); | ||
| payload["syncItemsAndFlags"] = CVarGetInteger(CVAR_REMOTE_ANCHOR("RoomSettings.SyncItemsAndFlags"), 1); | ||
|
|
@@ -49,6 +51,7 @@ void Anchor::HandlePacket_UpdateRoomState(nlohmann::json payload) { | |
|
|
||
| roomState.ownerClientId = payload["state"]["ownerClientId"].get<uint32_t>(); | ||
| roomState.pvpMode = payload["state"]["pvpMode"].get<u8>(); | ||
| roomState.pvpDamageMult = payload["state"]["pvpDamageMult"].get<u8>(); | ||
|
||
| roomState.showLocationsMode = payload["state"]["showLocationsMode"].get<u8>(); | ||
| roomState.teleportMode = payload["state"]["teleportMode"].get<u8>(); | ||
| roomState.syncItemsAndFlags = payload["state"]["syncItemsAndFlags"].get<u8>(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.