自动射击ok

This commit is contained in:
aozhiwei 2021-07-20 05:33:52 +00:00
parent 3522bb307a
commit 5d5837abb2
4 changed files with 54 additions and 3 deletions

View File

@ -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() void Buff::ProcDisperse()
{ {
std::vector<int> del_buffs; std::vector<int> del_buffs;

View File

@ -69,6 +69,8 @@ class Buff
void ProcSeletTargetWithSelfPos(); void ProcSeletTargetWithSelfPos();
void ProcTurnOver(); void ProcTurnOver();
void ProcPullToWalkable(); void ProcPullToWalkable();
void ProcAutoShot();
void ProcBeatBack();
void ProcDisperse(); void ProcDisperse();
private: private:

View File

@ -1227,6 +1227,16 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
} }
} }
break; break;
case kBET_AutoShot:
{
buff->ProcAutoShot();
}
break;
case kBET_BeatBack:
{
buff->ProcBeatBack();
}
break;
case kBET_Disperse: case kBET_Disperse:
{ {
buff->ProcDisperse(); buff->ProcDisperse();

View File

@ -210,7 +210,7 @@ void Player::UpdateShot()
series_shot_frames = 0; series_shot_frames = 0;
return; return;
} }
if (HasBuffEffect(kBET_Vertigo)) { if (HasBuffEffect(kBET_Vertigo) && !HasBuffEffect(kBET_AutoShot)) {
return; return;
} }
if (GetCar()) { if (GetCar()) {
@ -1084,8 +1084,10 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
if (shot_start && !shot_hold) { if (shot_start && !shot_hold) {
} else { } else {
shot_start = msg.shot_start(); if (!HasBuffEffect(kBET_AutoShot)) {
shot_hold = msg.shot_hold(); shot_start = msg.shot_start();
shot_hold = msg.shot_hold();
}
} }
fly_distance = std::min(200.0f, msg.fly_distance()); fly_distance = std::min(200.0f, msg.fly_distance());
if (!shot_hold) { if (!shot_hold) {