This commit is contained in:
aozhiwei 2022-10-12 19:48:29 +08:00
parent 3b2932797d
commit eec621edc4
4 changed files with 55 additions and 26 deletions

View File

@ -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);
}
}

View File

@ -85,6 +85,8 @@ class Buff
void ProcRemoveHoldShield();
void ProcHide();
void ProcRemoveHide();
void ProcRescuer();
void ProcRemoveRescuer();
void CalcPassengerShotOffset();

View File

@ -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) {

View File

@ -711,16 +711,19 @@ 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,
@ -744,8 +747,6 @@ void Skill::ProcJYFH()
a8::XPrintf("%s\n", {dbg_msg});
}
#endif
}
);
}
void Skill::ProcFH()