1
This commit is contained in:
parent
5d8d90658d
commit
c17c6e77e9
@ -68,7 +68,7 @@ void CondAddBuff::ProcBulletHit()
|
||||
(const a8::Args& args)
|
||||
{
|
||||
IBullet* bullet = args.Get<IBullet*>(0);
|
||||
Creature* c = args.Get<Creature*>(0);
|
||||
Creature* c = args.Get<Creature*>(1);
|
||||
if (context->last_hit_frameno > 0 &&
|
||||
c->room->GetFrameNo() - context->last_hit_frameno > interval_time * SERVER_FRAME_RATE) {
|
||||
context->hited_times = 0;
|
||||
|
@ -2732,6 +2732,7 @@ void Creature::OnLand()
|
||||
}
|
||||
}
|
||||
}
|
||||
gun_grasp_->Init();
|
||||
}
|
||||
|
||||
void Creature::CheckBulletHitHoldShield(IBullet* bullet, bool& eat)
|
||||
@ -3027,5 +3028,4 @@ float Creature::GetSkillRaycastDistance()
|
||||
|
||||
void Creature::NetInitOk()
|
||||
{
|
||||
gun_grasp_->Init();
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ GunGrasp::~GunGrasp()
|
||||
void GunGrasp::Init()
|
||||
{
|
||||
if (owner_->IsHuman()) {
|
||||
TakeOnWeapon(owner_->GetCurrWeapon());
|
||||
owner_->GetTrigger()->AddListener
|
||||
(
|
||||
kTakeonWeaponEvent,
|
||||
@ -33,15 +34,7 @@ void GunGrasp::Init()
|
||||
{
|
||||
Weapon* old_weapon = args.Get<Weapon*>(0);
|
||||
Weapon* new_weapon = args.Get<Weapon*>(1);
|
||||
std::set<int>* buffs = mt::Grasp::GetBuffs(owner_->AsHuman()->meta->id(),
|
||||
owner_->GetBattleContext()->GetLevel(),
|
||||
new_weapon->meta->id());
|
||||
Clear();
|
||||
if (buffs) {
|
||||
for (int buff_id : *buffs) {
|
||||
owner_->TryAddBuff(owner_, buff_id, nullptr);
|
||||
}
|
||||
}
|
||||
TakeOnWeapon(new_weapon);
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -54,3 +47,16 @@ void GunGrasp::Clear()
|
||||
}
|
||||
hold_buffs_.clear();
|
||||
}
|
||||
|
||||
void GunGrasp::TakeOnWeapon(Weapon* weapon)
|
||||
{
|
||||
std::set<int>* buffs = mt::Grasp::GetBuffs(owner_->AsHuman()->meta->id(),
|
||||
owner_->GetBattleContext()->GetLevel(),
|
||||
weapon->meta->id());
|
||||
Clear();
|
||||
if (buffs) {
|
||||
for (int buff_id : *buffs) {
|
||||
owner_->TryAddBuff(owner_, buff_id, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ class GunGrasp
|
||||
private:
|
||||
|
||||
void Clear();
|
||||
void TakeOnWeapon(Weapon* weapon);
|
||||
|
||||
private:
|
||||
Creature* owner_ = nullptr;
|
||||
|
@ -439,6 +439,9 @@ void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param)
|
||||
void Trigger::BulletHit(IBullet* bullet, Creature* target)
|
||||
{
|
||||
if (bullet->GetSender().Get()) {
|
||||
if (bullet->GetSender().Get()->IsPlayer()) {
|
||||
int i = 0;
|
||||
}
|
||||
bullet->GetSender().Get()->GetTrigger()->DispatchEvent(kBulletHitEvent, {bullet, target});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user