This commit is contained in:
aozhiwei 2022-09-13 19:40:41 +08:00
parent 583111790e
commit fe4ee20929
3 changed files with 12 additions and 2 deletions

View File

@ -2146,6 +2146,8 @@ void Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& target_pos)
if (buff->meta->int_param2 > 0) {
RemoveSurplusObstacle(buff->meta->i->buff_id(), id, buff->meta->int_param2);
}
float *p_rotate = nullptr;
float rotate = 0.0f;
a8::Vec2 pos = target_pos;
if (buff->skill_meta) {
switch (buff->skill_meta->GetMagicId()) {
@ -2153,6 +2155,11 @@ void Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& target_pos)
{
if (!GetAttackDir().IsZero()) {
pos = target_pos + GetAttackDir() * 100;
rotate = GetAttackDir().CalcAngleEx(a8::Vec2::UP);
if (GetAttackDir().x > 0.00001f) {
rotate = -rotate;
}
p_rotate = &rotate;
}
}
break;
@ -2169,6 +2176,9 @@ void Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& target_pos)
obstacle->SetTeamId(room, team_id);
obstacle->SetMasterId(room, GetUniId());
obstacle->Active();
if (p_rotate) {
obstacle->SetRotate(*p_rotate);
}
obstacle->context_ability = context_ability;
slave_things_.push_back(std::make_tuple(buff->meta->i->buff_id(), obstacle));
#ifdef DEBUG

View File

@ -227,7 +227,7 @@ void Obstacle::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_d
}
}
if (std::abs(rotate_) > 0.000001) {
p->set_rotate(rotate_);
p->set_rotate(rotate_ * 180);
}
}

View File

@ -71,7 +71,7 @@ void SkillHelper::Init()
for (int i = MAGIC_NONE; i < MAGIC_END; ++i) {
if (i != 0) {
int skill_id = GetMagicSkillId(i);
if (skill_id != 0) {
if (skill_id == 0) {
abort();
}
magic_skill_hash_[i] = skill_id;