自动射击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()
{
std::vector<int> del_buffs;

View File

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

View File

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

View File

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