1
This commit is contained in:
parent
3b2932797d
commit
eec621edc4
@ -1225,3 +1225,19 @@ void Buff::ClearEventHandlers()
|
||||
}
|
||||
event_handlers_.clear();
|
||||
}
|
||||
|
||||
void Buff::ProcRescuer()
|
||||
{
|
||||
Human* target = owner->room->GetHumanByUniId(owner->AsHuman()->GetActionTargetId());
|
||||
if (target) {
|
||||
owner->GetTrigger()->StartRescue(target);
|
||||
}
|
||||
}
|
||||
|
||||
void Buff::ProcRemoveRescuer()
|
||||
{
|
||||
Human* target = owner->room->GetHumanByUniId(owner->AsHuman()->GetActionTargetId());
|
||||
if (target) {
|
||||
owner->GetTrigger()->EndRescue(target);
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,8 @@ class Buff
|
||||
void ProcRemoveHoldShield();
|
||||
void ProcHide();
|
||||
void ProcRemoveHide();
|
||||
void ProcRescuer();
|
||||
void ProcRemoveRescuer();
|
||||
|
||||
void CalcPassengerShotOffset();
|
||||
|
||||
|
@ -522,6 +522,11 @@ void Creature::OnBuffRemove(Buff& buff)
|
||||
int i = 0;
|
||||
}
|
||||
break;
|
||||
case kBET_Rescuer:
|
||||
{
|
||||
buff.ProcRemoveRescuer();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
@ -1235,6 +1240,11 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
|
||||
buff->ProcHide();
|
||||
}
|
||||
break;
|
||||
case kBET_Rescuer:
|
||||
{
|
||||
buff->ProcRescuer();
|
||||
}
|
||||
break;
|
||||
case kBET_SummonObstacle:
|
||||
{
|
||||
if (!dead || buff->meta->i->dead_valid() != 0) {
|
||||
|
@ -711,41 +711,42 @@ void Skill::ProcGZJS()
|
||||
|
||||
void Skill::ProcJYFH()
|
||||
{
|
||||
int buff_id = SkillHelper::GetJyfhBuffId(meta);
|
||||
float buff_time = SkillHelper::GetJyfhBuffTime(meta);
|
||||
|
||||
owner->GetTrigger()->AddListener
|
||||
(
|
||||
kStartRescueEvent,
|
||||
[this] (const std::vector<std::any>& params)
|
||||
[this, buff_id, buff_time] (const std::vector<std::any>& params)
|
||||
{
|
||||
Human* target = std::any_cast<Human*>(params.at(0));
|
||||
int buff_id = SkillHelper::GetJyfhBuffId(meta);
|
||||
float buff_time = SkillHelper::GetJyfhBuffTime(meta);
|
||||
owner->TryAddBuffAndSetTime(owner, buff_id, buff_time, meta);
|
||||
target->TryAddBuffAndSetTime(owner, buff_id, buff_time, meta);
|
||||
owner->GetTrigger()->AddListener
|
||||
(
|
||||
kEndRescueEvent,
|
||||
[this, buff_id] (const std::vector<std::any>& params)
|
||||
{
|
||||
Human* target = std::any_cast<Human*>(params.at(0));
|
||||
owner->RemoveBuffById(buff_id);
|
||||
target->RemoveBuffById(buff_id);
|
||||
}
|
||||
);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
std::string dbg_msg = a8::Format
|
||||
(
|
||||
"skill_id:%d 救援防护 time:%f",
|
||||
{
|
||||
meta->i->skill_id(),
|
||||
buff_time
|
||||
});
|
||||
owner->SendDebugMsg(dbg_msg);
|
||||
a8::XPrintf("%s\n", {dbg_msg});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
);
|
||||
owner->GetTrigger()->AddListener
|
||||
(
|
||||
kEndRescueEvent,
|
||||
[this, buff_id] (const std::vector<std::any>& params)
|
||||
{
|
||||
Human* target = std::any_cast<Human*>(params.at(0));
|
||||
owner->RemoveBuffById(buff_id);
|
||||
target->RemoveBuffById(buff_id);
|
||||
}
|
||||
);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
std::string dbg_msg = a8::Format
|
||||
(
|
||||
"skill_id:%d 救援防护 time:%f",
|
||||
{
|
||||
meta->i->skill_id(),
|
||||
buff_time
|
||||
});
|
||||
owner->SendDebugMsg(dbg_msg);
|
||||
a8::XPrintf("%s\n", {dbg_msg});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Skill::ProcFH()
|
||||
|
Loading…
x
Reference in New Issue
Block a user