From 1176af740b1fc522e74e6905af2094975786abf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 17 Sep 2020 18:38:06 +0200 Subject: [PATCH] aoc2: Add shouldApplyMasterModeDamageMultiplier --- data/uking_functions.csv | 2 +- src/Game/DLC/aoc2.cpp | 40 ++++++++++++++++++- src/Game/DLC/aoc2.h | 4 ++ .../ActorSystem/actActorConstDataAccess.h | 13 ++++++ .../ActorSystem/actActorLinkConstDataAccess.h | 2 + src/KingSystem/ActorSystem/actTag.h | 4 +- 6 files changed, 61 insertions(+), 4 deletions(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 36d1e46a..ab97daed 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -72747,7 +72747,7 @@ 0x0000007100d6d394,aoc2::nerfCookCureItemHitPointRecover,64, 0x0000007100d6d3d4,aoc2::modifyEnemyNoticeDuration,60, 0x0000007100d6d410,sub_7100D6D410,304, -0x0000007100d6d540,aoc2::shouldApplyMasterModeDamageMultiplier,6164, +0x0000007100d6d540,aoc2::shouldApplyMasterModeDamageMultiplier,6164,_ZN5uking4aoc237shouldApplyMasterModeDamageMultiplierERKN4ksys3act20ActorConstDataAccessE| 0x0000007100d6ed54,aoc2::buffDamage,40, 0x0000007100d6ed7c,aoc2::initHardModeFlag,172, 0x0000007100d6ee28,aoc2::setAocFlag2,172, diff --git a/src/Game/DLC/aoc2.cpp b/src/Game/DLC/aoc2.cpp index 22fbdad9..254ce9ea 100644 --- a/src/Game/DLC/aoc2.cpp +++ b/src/Game/DLC/aoc2.cpp @@ -2,7 +2,45 @@ namespace uking { -using namespace ksys; +bool aoc2::shouldApplyMasterModeDamageMultiplier(const ksys::act::ActorConstDataAccess& accessor) { + if (!accessor.hasProc()) + return false; + + ksys::act::ActorConstDataAccess parent; + if (accessor.hasConnectedCalcParent() && accessor.acquireConnectedCalcParent(&parent)) + return shouldApplyMasterModeDamageMultiplier(parent); + + if (accessor.hasTag(ksys::act::tags::IsMasterModeDamageMultiplierActor) || + (aoc2::instance() && aoc2::instance()->isTestOfStrengthShrine() && + accessor.hasTag(ksys::act::tags::AncientGuardTarget))) { + return true; + } + + const sead::SafeString& profile = accessor.getProfile(); + const sead::SafeString& name = accessor.getName(); + + if (profile == "LastBoss" || profile == "SiteBoss") + return true; + + if (name == "Enemy_GanonBeast" || name == "GanonShockWave" || name == "EnemyGanonShockWave" || + name == "GanonSeaOfFlame" || name == "GanonFlameBall" || name == "GanonPillarOfFlame" || + name == "GanonNormalArrow" || name == "GanonSpearForThrowing" || name == "CurseGanonBeam" || + name == "GanonBeam" || name == "GanonIceBullet" || name == "GanonThunder" || + name == "GanonIronPile" || name == "GanonTornado" || name == "GanonBeastBeam" || + name == "SiteBossSeaOfFlame" || name == "SiteBossSeaOfFlameRotate" || + name == "SiteBossFlameBall" || name == "SiteBossBigFlameBall" || + name == "SiteBossPillarOfFlame" || name == "SiteBossWearFlame" || + name == "SiteBossDrawingFlameTornado" || name == "SiteBossGaleArrow" || + name == "SiteBossNormalArrow" || name == "SiteBossSpearForThrowing" || + name == "SiteBossReflectArrow" || name == "ArrowRainChild" || + name == "SiteBossSpearIceBullet" || name == "SiteBossTornado" || + name == "LastBossThunder" || name == "Enemy_Assassin_Senior" || + name == "AssassinRockBall" || name == "AssassinIronBall") { + return true; + } + + return false; +} bool aoc2::rankUpEnemy(const sead::SafeString& actor_name, const ksys::map::Object& obj, const char** new_name) { diff --git a/src/Game/DLC/aoc2.h b/src/Game/DLC/aoc2.h index e903079c..4e806b0c 100644 --- a/src/Game/DLC/aoc2.h +++ b/src/Game/DLC/aoc2.h @@ -2,6 +2,7 @@ #include #include +#include "KingSystem/ActorSystem/actActorConstDataAccess.h" #include "KingSystem/Map/mapObject.h" namespace uking { @@ -16,6 +17,9 @@ class aoc2 { public: void init(sead::Heap* heap); + static bool + shouldApplyMasterModeDamageMultiplier(const ksys::act::ActorConstDataAccess& accessor); + bool isTestOfStrengthShrine() const; bool rankUpEnemy(const sead::SafeString& actor_name, const ksys::map::Object& obj, diff --git a/src/KingSystem/ActorSystem/actActorConstDataAccess.h b/src/KingSystem/ActorSystem/actActorConstDataAccess.h index 5b1ff203..560954bb 100644 --- a/src/KingSystem/ActorSystem/actActorConstDataAccess.h +++ b/src/KingSystem/ActorSystem/actActorConstDataAccess.h @@ -2,13 +2,19 @@ #include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" +#include "KingSystem/ActorSystem/actTag.h" +#include "KingSystem/Utils/Types.h" namespace ksys::act { class ActorConstDataAccess : public ActorLinkConstDataAccess { public: + ActorConstDataAccess() = default; + bool acquireActor(const ActorLinkConstDataAccess& other); + bool hasProc() const { return ActorLinkConstDataAccess::hasProc(); } + /// Checks whether the acquired BaseProc is `proc`. bool hasProc(BaseProc* proc) const; @@ -21,12 +27,19 @@ public: void debugLog(s32, const sead::SafeString& method_name) const; + const sead::SafeString& getProfile() const; const sead::SafeString& getName() const; + bool hasTag(const sead::SafeString& tag) const; + bool hasTag(Tag tag) const; u32 getId() const; bool acquireConnectedCalcParent(ActorLinkConstDataAccess* accessor) const; bool acquireConnectedCalcChild(ActorLinkConstDataAccess* accessor) const; bool hasConnectedCalcParent() const; + +private: + u8 _10 = 0; }; +KSYS_CHECK_SIZE_NX150(ActorConstDataAccess, 0x18); bool acquireActor(BaseProcLink* link, ActorConstDataAccess* accessor); diff --git a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h index 1a207bd7..7a58a5cf 100644 --- a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h +++ b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h @@ -23,6 +23,8 @@ public: void release() { acquire(nullptr); } + bool hasProc() const { return mProc != nullptr; } + protected: friend class ActorConstDataAccess; diff --git a/src/KingSystem/ActorSystem/actTag.h b/src/KingSystem/ActorSystem/actTag.h index 21276798..d2ecc6ba 100644 --- a/src/KingSystem/ActorSystem/actTag.h +++ b/src/KingSystem/ActorSystem/actTag.h @@ -10,8 +10,8 @@ namespace ksys::act { class Tag { public: Tag() = default; - constexpr Tag(u32 hash) : mHash(hash) {} - constexpr Tag(std::string_view name) : mHash(util::calcCrc32(name)) {} + explicit constexpr Tag(u32 hash) : mHash(hash) {} + explicit constexpr Tag(std::string_view name) : mHash(util::calcCrc32(name)) {} constexpr bool operator==(Tag other) const { return mHash == other.mHash; } constexpr bool operator!=(Tag other) const { return mHash != other.mHash; }