summaryrefslogtreecommitdiff
path: root/src/KingSystem
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-01-09 16:59:00 +0100
committerLéo Lam <leo@leolam.fr>2021-01-09 17:23:38 +0100
commit8569722db68dc01024ffbbc852cf66e3a80a89c9 (patch)
tree5524ee40b5d898a8b29e2f8ffa0ff4ff2b485aab /src/KingSystem
parent9069c4e9f8ef1b7622f62e1f57e2a526364c9e5d (diff)
ksys/act: Start adding actInfoCommon
Diffstat (limited to 'src/KingSystem')
-rw-r--r--src/KingSystem/ActorSystem/CMakeLists.txt2
-rw-r--r--src/KingSystem/ActorSystem/actInfoCommon.cpp118
-rw-r--r--src/KingSystem/ActorSystem/actInfoCommon.h45
-rw-r--r--src/KingSystem/ActorSystem/actInfoData.cpp6
-rw-r--r--src/KingSystem/ActorSystem/actInfoData.h9
5 files changed, 174 insertions, 6 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt
index 911a3277..e7bef107 100644
--- a/src/KingSystem/ActorSystem/CMakeLists.txt
+++ b/src/KingSystem/ActorSystem/CMakeLists.txt
@@ -66,6 +66,8 @@ target_sources(uking PRIVATE
actBaseProcUnit.h
actDebug.cpp
actDebug.h
+ actInfoCommon.cpp
+ actInfoCommon.h
actInfoData.cpp
actInfoData.h
actInstParamPack.cpp
diff --git a/src/KingSystem/ActorSystem/actInfoCommon.cpp b/src/KingSystem/ActorSystem/actInfoCommon.cpp
new file mode 100644
index 00000000..e05903d9
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actInfoCommon.cpp
@@ -0,0 +1,118 @@
+#include "KingSystem/ActorSystem/actInfoCommon.h"
+#include "KingSystem/ActorSystem/actInfoData.h"
+
+namespace ksys::act {
+
+bool getSystemIsGetItemSelf(InfoData* data, const char* actor) {
+ return data->getBool(actor, "systemIsGetItemSelf");
+}
+
+bool getSystemIsGetItemSelf(const al::ByamlIter& iter) {
+ return InfoData::getBoolByKey(iter, "systemIsGetItemSelf");
+}
+
+int getGeneralLife(InfoData* data, const char* actor) {
+ return data->getInt(actor, "generalLife", 100);
+}
+
+int getGeneralLife(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "generalLife", 100);
+}
+
+int getEnemyRank(InfoData* data, const char* actor) {
+ return data->getInt(actor, "enemyRank");
+}
+
+int getAttackPower(InfoData* data, const char* actor) {
+ return data->getInt(actor, "attackPower");
+}
+
+int getWeaponCommonGuardPower(InfoData* data, const char* actor) {
+ return data->getInt(actor, "weaponCommonGuardPower");
+}
+
+float getWeaponCommonSharpWeaponPer(InfoData* data, const char* actor) {
+ return data->getFloat(actor, "weaponCommonSharpWeaponPer", 10.0);
+}
+
+int getWeaponCommonSharpWeaponAddAtkMin(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddAtkMin");
+}
+
+int getWeaponCommonSharpWeaponAddAtkMax(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddAtkMax");
+}
+
+int getWeaponCommonSharpWeaponAddLifeMin(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddLifeMin");
+}
+
+int getWeaponCommonSharpWeaponAddLifeMax(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddLifeMax");
+}
+
+bool getWeaponCommonSharpWeaponAddCrit(const al::ByamlIter& iter) {
+ return InfoData::getBoolByKey(iter, "weaponCommonSharpWeaponAddCrit");
+}
+
+int getWeaponCommonSharpWeaponAddGuardMin(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddGuardMin");
+}
+
+int getWeaponCommonSharpWeaponAddGuardMax(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddGuardMax");
+}
+
+int getWeaponCommonPoweredSharpAddAtkMin(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddAtkMin");
+}
+
+int getWeaponCommonPoweredSharpAddAtkMax(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddAtkMax");
+}
+
+int getWeaponCommonPoweredSharpAddLifeMin(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddLifeMin");
+}
+
+int getWeaponCommonPoweredSharpAddLifeMax(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddLifeMax");
+}
+
+int getWeaponCommonPoweredSharpAddGuardMin(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddGuardMin");
+}
+
+int getWeaponCommonPoweredSharpAddGuardMax(const al::ByamlIter& iter) {
+ return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddGuardMax");
+}
+
+float getWeaponCommonPoweredSharpAddThrowMin(const al::ByamlIter& iter) {
+ return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddThrowMin", 1.0);
+}
+
+float getWeaponCommonPoweredSharpAddThrowMax(const al::ByamlIter& iter) {
+ return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddThrowMax", 1.0);
+}
+
+bool getWeaponCommonPoweredSharpAddSpreadFire(const al::ByamlIter& iter) {
+ return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddSpreadFire");
+}
+
+bool getWeaponCommonPoweredSharpAddZoomRapid(const al::ByamlIter& iter) {
+ return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddZoomRapid");
+}
+
+float getWeaponCommonPoweredSharpAddRapidFireMin(const al::ByamlIter& iter) {
+ return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddRapidFireMin", 1.0);
+}
+
+float getWeaponCommonPoweredSharpAddRapidFireMax(const al::ByamlIter& iter) {
+ return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddRapidFireMax", 1.0);
+}
+
+bool getWeaponCommonPoweredSharpAddSurfMaster(const al::ByamlIter& iter) {
+ return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddSurfMaster");
+}
+
+} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actInfoCommon.h b/src/KingSystem/ActorSystem/actInfoCommon.h
new file mode 100644
index 00000000..0707b40c
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actInfoCommon.h
@@ -0,0 +1,45 @@
+#pragma once
+
+namespace al {
+class ByamlIter;
+}
+
+namespace ksys::act {
+
+class InfoData;
+
+bool getSystemIsGetItemSelf(InfoData* data, const char* actor);
+bool getSystemIsGetItemSelf(const al::ByamlIter& iter);
+
+int getGeneralLife(InfoData* data, const char* actor);
+int getGeneralLife(const al::ByamlIter& iter);
+
+int getEnemyRank(InfoData* data, const char* actor);
+int getAttackPower(InfoData* data, const char* actor);
+
+int getWeaponCommonGuardPower(InfoData* data, const char* actor);
+float getWeaponCommonSharpWeaponPer(InfoData* data, const char* actor);
+
+int getWeaponCommonSharpWeaponAddAtkMin(const al::ByamlIter& iter);
+int getWeaponCommonSharpWeaponAddAtkMax(const al::ByamlIter& iter);
+int getWeaponCommonSharpWeaponAddLifeMin(const al::ByamlIter& iter);
+int getWeaponCommonSharpWeaponAddLifeMax(const al::ByamlIter& iter);
+bool getWeaponCommonSharpWeaponAddCrit(const al::ByamlIter& iter);
+int getWeaponCommonSharpWeaponAddGuardMin(const al::ByamlIter& iter);
+int getWeaponCommonSharpWeaponAddGuardMax(const al::ByamlIter& iter);
+
+int getWeaponCommonPoweredSharpAddAtkMin(const al::ByamlIter& iter);
+int getWeaponCommonPoweredSharpAddAtkMax(const al::ByamlIter& iter);
+int getWeaponCommonPoweredSharpAddLifeMin(const al::ByamlIter& iter);
+int getWeaponCommonPoweredSharpAddLifeMax(const al::ByamlIter& iter);
+int getWeaponCommonPoweredSharpAddGuardMin(const al::ByamlIter& iter);
+int getWeaponCommonPoweredSharpAddGuardMax(const al::ByamlIter& iter);
+float getWeaponCommonPoweredSharpAddThrowMin(const al::ByamlIter& iter);
+float getWeaponCommonPoweredSharpAddThrowMax(const al::ByamlIter& iter);
+bool getWeaponCommonPoweredSharpAddSpreadFire(const al::ByamlIter& iter);
+bool getWeaponCommonPoweredSharpAddZoomRapid(const al::ByamlIter& iter);
+float getWeaponCommonPoweredSharpAddRapidFireMin(const al::ByamlIter& iter);
+float getWeaponCommonPoweredSharpAddRapidFireMax(const al::ByamlIter& iter);
+bool getWeaponCommonPoweredSharpAddSurfMaster(const al::ByamlIter& iter);
+
+} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actInfoData.cpp b/src/KingSystem/ActorSystem/actInfoData.cpp
index 9d6427cb..c23a94de 100644
--- a/src/KingSystem/ActorSystem/actInfoData.cpp
+++ b/src/KingSystem/ActorSystem/actInfoData.cpp
@@ -204,7 +204,7 @@ void InfoData::getRecipeInfo(const char* actor, InfoData::RecipeInfo& info) cons
}
}
-s32 InfoData::getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_) {
+s32 InfoData::getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_, bool) {
s32 value;
return iter.tryGetIntByKey(&value, key) ? value : default_;
}
@@ -511,12 +511,12 @@ bool InfoData::getBool(const char* actor, const char* key, bool default_, bool x
return getBoolByKey(iter, key, default_);
}
-f32 InfoData::getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_) {
+f32 InfoData::getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_, bool) {
f32 value;
return iter.tryGetFloatByKey(&value, key) ? value : default_;
}
-bool InfoData::getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_) {
+bool InfoData::getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_, bool) {
bool value;
return iter.tryGetBoolByKey(&value, key) ? value != 0 : default_;
}
diff --git a/src/KingSystem/ActorSystem/actInfoData.h b/src/KingSystem/ActorSystem/actInfoData.h
index 1827d0f1..c910c673 100644
--- a/src/KingSystem/ActorSystem/actInfoData.h
+++ b/src/KingSystem/ActorSystem/actInfoData.h
@@ -133,9 +133,12 @@ public:
f32 getFloat(const char* actor, const char* key, f32 default_ = 0, bool x = true) const;
bool getBool(const char* actor, const char* key, bool default_ = false, bool x = true) const;
- static s32 getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_ = 0);
- static f32 getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_ = 0);
- static bool getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_ = false);
+ static s32 getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_ = 0,
+ bool x = true);
+ static f32 getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_ = 0,
+ bool x = true);
+ static bool getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_ = false,
+ bool x = true);
static const char* getStringByKey(const al::ByamlIter& iter, const char* key,
const sead::SafeString& default_);