diff --git a/data/file_list.yml b/data/file_list.yml index 64c53263..5dc56b00 100644 --- a/data/file_list.yml +++ b/data/file_list.yml @@ -13865,50 +13865,50 @@ Boss/GolemClimb/GolemDownBreakState.o: label: - _ZN19GolemDownBreakStateC1EPKcP14IUseGolemStateP15GolemShoutState - _ZN19GolemDownBreakStateC2EPKcP14IUseGolemStateP15GolemShoutState - status: NotDecompiled + status: Matching - offset: 0x078dec size: 96 label: _ZN19GolemDownBreakState6appearEv - status: NotDecompiled + status: Matching - offset: 0x078e4c size: 60 label: _ZN19GolemDownBreakState4killEv - status: NotDecompiled + status: Matching - offset: 0x078e88 size: 104 label: _ZN19GolemDownBreakState9exeDamageEv - status: NotDecompiled + status: Matching - offset: 0x078ef0 size: 124 label: _ZN19GolemDownBreakState8exeShoutEv - status: NotDecompiled + status: Matching - offset: 0x078f6c size: 144 label: _ZN19GolemDownBreakState10exeRecoverEv - status: NotDecompiled + status: Matching - offset: 0x078ffc size: 12 label: _ZN19GolemDownBreakState10startBreakEP19GolemClimbWeakPointPKcS3_ - status: NotDecompiled + status: Matching - offset: 0x079008 size: 36 label: _ZN19GolemDownBreakStateD0Ev - status: NotDecompiled + status: Matching lazy: true - offset: 0x07902c size: 108 label: _ZNK12_GLOBAL__N_128GolemDownBreakStateNrvDamage7executeEPN2al11NerveKeeperE - status: NotDecompiled + status: Matching guess: true - offset: 0x079098 size: 128 label: _ZNK12_GLOBAL__N_127GolemDownBreakStateNrvShout7executeEPN2al11NerveKeeperE - status: NotDecompiled + status: Matching guess: true - offset: 0x079118 size: 148 label: _ZNK12_GLOBAL__N_129GolemDownBreakStateNrvRecover7executeEPN2al11NerveKeeperE - status: NotDecompiled + status: Matching guess: true Boss/GolemClimb/GolemFunction.o: '.text': diff --git a/src/Boss/GolemClimb/GolemDownBreakState.cpp b/src/Boss/GolemClimb/GolemDownBreakState.cpp new file mode 100644 index 00000000..7306f61c --- /dev/null +++ b/src/Boss/GolemClimb/GolemDownBreakState.cpp @@ -0,0 +1,72 @@ +#include "Boss/GolemClimb/GolemDownBreakState.h" + +#include "Library/LiveActor/ActorActionFunction.h" +#include "Library/LiveActor/ActorMovementFunction.h" +#include "Library/Nerve/NerveSetupUtil.h" +#include "Library/Nerve/NerveUtil.h" + +#include "Boss/GolemClimb/GolemClimbWeakPoint.h" +#include "Boss/GolemClimb/GolemShoutState.h" +#include "Boss/GolemClimb/IUseGolemState.h" + +namespace { +NERVE_IMPL(GolemDownBreakState, Damage); +NERVE_IMPL(GolemDownBreakState, Shout); +NERVE_IMPL(GolemDownBreakState, Recover); +NERVES_MAKE_NOSTRUCT(GolemDownBreakState, Damage, Shout, Recover); +} // namespace + +GolemDownBreakState::GolemDownBreakState(const char* name, IUseGolemState* golemState, + GolemShoutState* shoutState) + : al::HostStateBase(name, golemState), mShoutState(shoutState) { + initNerve(&Damage, 0); +} + +void GolemDownBreakState::appear() { + al::setVelocityZero(getHost()->getActor()); + al::startHitReaction(getHost()->getActor(), "弱点ヒット"); + al::setNerve(this, &Damage); + NerveStateBase::appear(); +} + +void GolemDownBreakState::kill() { + mWeakPoint = nullptr; + mDamageActionName = nullptr; + mRecoverActionName = nullptr; + getHost()->endPushSensor(); + NerveStateBase::kill(); +} + +void GolemDownBreakState::exeDamage() { + if (al::isFirstStep(this)) { + mWeakPoint->startBreak(); + al::startAction(getHost()->getActor(), mDamageActionName); + } + if (mWeakPoint->isBreak()) + al::setNerve(this, &Shout); +} + +void GolemDownBreakState::exeShout() { + if (al::isFirstStep(this)) + mShoutState->appear(); + mShoutState->control(); + if (al::isStep(this, 120)) { + mShoutState->kill(); + al::setNerve(this, &Recover); + } +} + +void GolemDownBreakState::exeRecover() { + if (al::isFirstStep(this)) + al::startAction(getHost()->getActor(), mRecoverActionName); + getHost()->updatePushSensor(); + if (al::isActionEnd(getHost()->getActor()) && getHost()->tryNextPushSensor()) + kill(); +} + +void GolemDownBreakState::startBreak(GolemClimbWeakPoint* weakPoint, const char* damageActionName, + const char* recoverActionName) { + mWeakPoint = weakPoint; + mDamageActionName = damageActionName; + mRecoverActionName = recoverActionName; +} diff --git a/src/Boss/GolemClimb/GolemDownBreakState.h b/src/Boss/GolemClimb/GolemDownBreakState.h new file mode 100644 index 00000000..2dfdee85 --- /dev/null +++ b/src/Boss/GolemClimb/GolemDownBreakState.h @@ -0,0 +1,27 @@ +#pragma once + +#include "Library/Nerve/NerveStateBase.h" + +class GolemClimbWeakPoint; +class GolemShoutState; +class IUseGolemState; + +class GolemDownBreakState : public al::HostStateBase { +public: + GolemDownBreakState(const char* name, IUseGolemState* golemState, GolemShoutState* shoutState); + void appear() override; + void kill() override; + void exeDamage(); + void exeShout(); + void exeRecover(); + void startBreak(GolemClimbWeakPoint* weakPoint, const char* damageActionName, + const char* recoverActionName); + +private: + GolemShoutState* mShoutState = nullptr; + GolemClimbWeakPoint* mWeakPoint = nullptr; + const char* mDamageActionName = nullptr; + const char* mRecoverActionName = nullptr; +}; + +static_assert(sizeof(GolemDownBreakState) == 0x40);