Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/uking_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -74874,7 +74874,7 @@ Address,Quality,Size,Name
0x0000007100d68ad4,U,000088,
0x0000007100d68b2c,U,000048,LifeRecoverInfo::onApplyDamage_0
0x0000007100d68b5c,U,000420,
0x0000007100d68d00,U,000084,_ZN4ksys3act15LifeRecoverInfo13onApplyDamageERi
0x0000007100d68d00,O,000084,_ZN4ksys3act15LifeRecoverInfo13onApplyDamageERi
0x0000007100d68d54,U,000064,
0x0000007100d68d94,U,000192,printLifeRecoverInfo
0x0000007100d68e54,U,000188,
Expand Down
18 changes: 18 additions & 0 deletions src/Game/DLC/aocManager.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include "Game/DLC/aocManager.h"
#include <algorithm>
#include <container/seadBuffer.h>
#include <filedevice/seadFileDeviceMgr.h>
#include <math/seadMathCalcCommon.h>
#include <prim/seadStringBuilder.h>
#include <resource/seadSharcArchiveRes.h>
#include "KingSystem/ActorSystem/actLifeRecoveryInfo.h"
#include "KingSystem/Resource/resLoadRequest.h"
#include "KingSystem/Resource/resResourceMgrTask.h"
#include "KingSystem/Utils/InitTimeInfo.h"
Expand All @@ -15,6 +18,21 @@
#include <prim/seadStringUtil.h>
#endif

namespace ksys::act {

bool LifeRecoverInfo::onApplyDamage(s32& damage) {
if (mExtraHp1 == 0)
return damage > 0;

const auto previous_extra_hp = mExtraHp1;
const auto remaining_extra_hp = std::max(previous_extra_hp - damage, 0);
damage -= previous_extra_hp - remaining_extra_hp;
mExtraHp1 = sead::Mathf::clampMax(remaining_extra_hp, mExtraHp2);
return remaining_extra_hp != previous_extra_hp;
}

} // namespace ksys::act

namespace uking::aoc {

namespace {
Expand Down
4 changes: 2 additions & 2 deletions src/KingSystem/ActorSystem/actLifeRecoveryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class LifeRecoverInfo {
f32 mCounter;
f32 mField_4;
u8 gap_8[16]; // Is this really a gap?
u32 mExtraHp1;
u32 mExtraHp2;
s32 mExtraHp1;
s32 mExtraHp2;
u32 mMaxLife;
f32 mRecoverFactor;
s32 mField_28;
Expand Down