This commit is contained in:
aozhiwei 2022-10-11 17:02:01 +08:00
parent 1f04840ba7
commit 1dfe46058b
3 changed files with 33 additions and 3 deletions

View File

@ -3583,6 +3583,9 @@ void Human::OnBulletHit(Bullet* bullet)
}
#endif
#endif
if (bullet->sender.Get()) {
bullet->sender.Get()->GetTrigger()->BulletHit(bullet, this);
}
RemoveBuffByEffectId(kBET_PeaceMode);
if (!dead && (bullet->IsBomb() || bullet->sender.Get()->team_id != team_id)) {

View File

@ -305,9 +305,10 @@ void Skill::ProcSJXY()
++shot_times;
Bullet* bullet = std::any_cast<Bullet*>(params.at(0));
Creature* target = std::any_cast<Creature*>(params.at(1));
int rnd = rand();
bool is_hit = false;
if (shot_times % meta->number_meta->int_ratio == 0) {
if ((rand() % 100) < meta->number_meta->float_probability * 100) {
bool is_hit = false;
if ((rnd % 100) < meta->number_meta->float_probability * 100) {
auto itr = hited_objs.find(target->GetUniId());
if (itr == hited_objs.end()) {
hited_objs[target->GetUniId()] = owner->room->GetFrameNo();
@ -324,6 +325,24 @@ void Skill::ProcSJXY()
}
}
}
#ifdef DEBUG
{
std::string dbg_msg = a8::Format
(
"skill_id:%d 射击 shot_times:%d ratio:%d rand:%d probability:%f time:%f 是否眩晕:%d",
{
meta->i->skill_id(),
shot_times,
meta->number_meta->int_ratio,
rnd % 100,
meta->number_meta->float_probability,
meta->number_meta->float_time,
is_hit ? 1 :0
});
owner->SendDebugMsg(dbg_msg);
a8::XPrintf("%s\n", {dbg_msg});
}
#endif
}
);
}

View File

@ -140,12 +140,19 @@ void SkillHelper::Init()
}
}
void SkillHelper::GetMagicIdAndBaseSkillId(int skill_id, int& magic_id, int& base_skill_id)
{
magic_id = 0;
base_skill_id = 0;
for (auto& pair : skill_magic_hash_) {
#if 1
if (skill_id - pair.first >= 0 &&
skill_id - pair.first < MAX_SKILL_LV) {
magic_id = pair.second;
base_skill_id = pair.first;
break;
}
#else
if (std::abs(skill_id - pair.first) < MAX_SKILL_LV) {
magic_id = pair.second;
base_skill_id = pair.first;
@ -156,6 +163,7 @@ void SkillHelper::GetMagicIdAndBaseSkillId(int skill_id, int& magic_id, int& bas
base_skill_id = pair.first + 10000;
break;
}
#endif
}
}