mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-19 13:03:33 -04:00
3 kill rollstab achievement
This commit is contained in:
@@ -4564,6 +4564,7 @@ public:
|
||||
cXyz mIBChainInterpCurrHandRoot;
|
||||
bool mIBChainInterpPrevValid;
|
||||
bool mIBChainInterpCurrValid;
|
||||
bool mIsRollstab = false;
|
||||
#endif
|
||||
}; // Size: 0x385C
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
// Signals are visible to all achievement checks within the same tick, then cleared.
|
||||
void signal(const char* key);
|
||||
bool hasSignal(const char* key) const;
|
||||
int signalCount(const char* key) const;
|
||||
|
||||
std::vector<Achievement> getAchievements() const;
|
||||
|
||||
@@ -62,7 +63,7 @@ private:
|
||||
void processEntry(Entry& e);
|
||||
|
||||
std::vector<Entry> m_entries;
|
||||
std::unordered_set<std::string_view> m_signals;
|
||||
std::unordered_map<std::string_view, int> m_signals;
|
||||
bool m_loaded = false;
|
||||
bool m_dirty = false;
|
||||
};
|
||||
|
||||
@@ -1165,6 +1165,10 @@ int daAlink_c::procCutFinishInit(int i_type) {
|
||||
const daAlink_cutParamTbl* cutParams = &cutParamTable[i_type];
|
||||
BOOL is_proc_frontRoll = mProcID == PROC_FRONT_ROLL;
|
||||
|
||||
#if TARGET_PC
|
||||
mIsRollstab = (is_proc_frontRoll != FALSE) && (i_type == CUT_FINISH_PARAM_STAB);
|
||||
#endif
|
||||
|
||||
commonProcInit(PROC_CUT_FINISH);
|
||||
setCutType(cutParams->m_cutType);
|
||||
field_0x3198 = cutParams->m_recoilAnmID;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#if TARGET_PC
|
||||
#include "dusk/achievements.h"
|
||||
#include "dusk/settings.h"
|
||||
#include "d/actor/d_a_alink.h"
|
||||
#endif
|
||||
|
||||
static int plCutLRC[58] = {
|
||||
@@ -448,6 +449,10 @@ fopAc_ac_c* cc_at_check(fopAc_ac_c* i_enemy, dCcU_AtInfo* i_AtInfo) {
|
||||
#if TARGET_PC
|
||||
if (fopAcM_GetGroup(i_enemy) == fopAc_ENEMY_e) {
|
||||
dusk::AchievementSystem::get().signal("enemy_killed");
|
||||
const auto* link = static_cast<const daAlink_c*>(daPy_getPlayerActorClass());
|
||||
if (link != nullptr && link->mProcID == daAlink_c::PROC_CUT_FINISH && link->mIsRollstab) {
|
||||
dusk::AchievementSystem::get().signal("rollstab_kill");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -506,6 +506,29 @@ std::vector<AchievementSystem::Entry> AchievementSystem::makeEntries() {
|
||||
},
|
||||
{}
|
||||
},
|
||||
{
|
||||
{
|
||||
"rollstab_triple",
|
||||
"Surgical Skewer",
|
||||
"Kill 3 enemies with a single rollstab.",
|
||||
AchievementCategory::Misc,
|
||||
false, 0, 0, false
|
||||
},
|
||||
[](Achievement& a, json&) {
|
||||
static int rollstabKills = 0;
|
||||
const auto* link = static_cast<const daAlink_c*>(daPy_getPlayerActorClass());
|
||||
const bool inRollstab = link != nullptr && link->mProcID == daAlink_c::PROC_CUT_FINISH && link->mIsRollstab;
|
||||
if (!inRollstab) {
|
||||
rollstabKills = 0;
|
||||
return;
|
||||
}
|
||||
rollstabKills += AchievementSystem::get().signalCount("rollstab_kill");
|
||||
if (rollstabKills >= 3) {
|
||||
a.progress = 1;
|
||||
}
|
||||
},
|
||||
{}
|
||||
},
|
||||
// Minigame
|
||||
{
|
||||
{
|
||||
@@ -1088,11 +1111,17 @@ void AchievementSystem::clearAll() {
|
||||
}
|
||||
|
||||
void AchievementSystem::signal(const char* key) {
|
||||
m_signals.insert(key);
|
||||
m_signals[key]++;
|
||||
}
|
||||
|
||||
bool AchievementSystem::hasSignal(const char* key) const {
|
||||
return m_signals.count(key) > 0;
|
||||
const auto it = m_signals.find(key);
|
||||
return it != m_signals.end() && it->second > 0;
|
||||
}
|
||||
|
||||
int AchievementSystem::signalCount(const char* key) const {
|
||||
const auto it = m_signals.find(key);
|
||||
return it != m_signals.end() ? it->second : 0;
|
||||
}
|
||||
|
||||
void AchievementSystem::clearOne(const char* key) {
|
||||
|
||||
Reference in New Issue
Block a user