From 5d5837abb228477b18a81179fe451b11100f5bfb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 20 Jul 2021 05:33:52 +0000 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=B0=84=E5=87=BBok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/buff.cc | 37 +++++++++++++++++++++++++++++++++++ server/gameserver/buff.h | 2 ++ server/gameserver/creature.cc | 10 ++++++++++ server/gameserver/player.cc | 8 +++++--- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/server/gameserver/buff.cc b/server/gameserver/buff.cc index 706487d..9f32895 100644 --- a/server/gameserver/buff.cc +++ b/server/gameserver/buff.cc @@ -530,6 +530,43 @@ void Buff::ProcOnceChgAttr() } +void Buff::ProcAutoShot() +{ + owner->room->xtimer.AddRepeatTimerAndAttach + ( + 1, + a8::XParams() + .SetSender(this), + [] (const a8::XParams& param) + { + Buff* buff = (Buff*)param.sender.GetUserData(); + if (buff->owner->IsHuman()) { + #if 0 + buff->owner->AsHuman()->shot_start = true; + #endif + buff->owner->AsHuman()->shot_hold = true; + buff->owner->AsHuman()->series_shot_frames = 0; + } + }, + &xtimer_attacher.timer_list_, + [] (const a8::XParams& param) + { + Buff* buff = (Buff*)param.sender.GetUserData(); + if (buff->owner->IsHuman()) { + #if 0 + buff->owner->AsHuman()->shot_start = false; + #endif + buff->owner->AsHuman()->shot_hold = false; + buff->owner->AsHuman()->series_shot_frames = 0; + } + }); +} + +void Buff::ProcBeatBack() +{ + +} + void Buff::ProcDisperse() { std::vector del_buffs; diff --git a/server/gameserver/buff.h b/server/gameserver/buff.h index 1d72ddc..150ee2b 100644 --- a/server/gameserver/buff.h +++ b/server/gameserver/buff.h @@ -69,6 +69,8 @@ class Buff void ProcSeletTargetWithSelfPos(); void ProcTurnOver(); void ProcPullToWalkable(); + void ProcAutoShot(); + void ProcBeatBack(); void ProcDisperse(); private: diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 1a5ea08..9f736d9 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1227,6 +1227,16 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff) } } break; + case kBET_AutoShot: + { + buff->ProcAutoShot(); + } + break; + case kBET_BeatBack: + { + buff->ProcBeatBack(); + } + break; case kBET_Disperse: { buff->ProcDisperse(); diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index 4ccbf2a..71b0a46 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -210,7 +210,7 @@ void Player::UpdateShot() series_shot_frames = 0; return; } - if (HasBuffEffect(kBET_Vertigo)) { + if (HasBuffEffect(kBET_Vertigo) && !HasBuffEffect(kBET_AutoShot)) { return; } if (GetCar()) { @@ -1084,8 +1084,10 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg) if (shot_start && !shot_hold) { } else { - shot_start = msg.shot_start(); - shot_hold = msg.shot_hold(); + if (!HasBuffEffect(kBET_AutoShot)) { + shot_start = msg.shot_start(); + shot_hold = msg.shot_hold(); + } } fly_distance = std::min(200.0f, msg.fly_distance()); if (!shot_hold) {