This commit is contained in:
aozhiwei 2021-05-08 19:59:53 +08:00
parent 3e4d2916ed
commit e1ba955bb4
2 changed files with 14 additions and 10 deletions

View File

@ -851,7 +851,8 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
break;
case kBET_SummonHero:
{
SummonHero(GetPos(),
SummonHero(buff,
GetPos(),
GetMoveDir(),
buff->meta->hero_infos);
}
@ -871,7 +872,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
if (!dead) {
a8::Vec2 target_pos = caster->GetPos() + caster->skill_dir_ * caster->skill_distance_;
target_pos = buff_vec2_param1;
SummonObstacle(buff->meta->param1, target_pos);
SummonObstacle(buff, buff->meta->param1, target_pos);
}
}
break;
@ -1388,7 +1389,7 @@ void Creature::CheckSpecObject()
#endif
}
RoomObstacle* Creature::SummonObstacle(int id, const a8::Vec2& pos)
RoomObstacle* Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& pos)
{
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
if (obstacle) {
@ -1396,7 +1397,7 @@ RoomObstacle* Creature::SummonObstacle(int id, const a8::Vec2& pos)
obstacle->SetTeamId(room, team_id);
obstacle->SetMasterId(room, GetEntityUniId());
obstacle->Active();
slave_things_.push_back(obstacle);
slave_things_.push_back(std::make_tuple(buff->meta->i->buff_id(), obstacle));
} else {
abort();
}
@ -1514,7 +1515,8 @@ void Creature::ResetAllSkillCd()
}
}
void Creature::SummonHero(const a8::Vec2& pos,
void Creature::SummonHero(Buff* buff,
const a8::Vec2& pos,
const a8::Vec2& dir,
std::vector<std::tuple<int, float, float, int>>& infos)
{
@ -1548,7 +1550,7 @@ void Creature::SummonHero(const a8::Vec2& pos,
dir,
team_id
);
slave_heros_.push_back(hero);
slave_heros_.push_back(std::make_tuple(buff->meta->i->buff_id(), hero));
break;
}
}
@ -1582,6 +1584,7 @@ void Creature::SlaveOnRemove(Entity* slave)
{
abort();
}
break;
}
}

View File

@ -135,8 +135,9 @@ class Creature : public MoveableEntity
void CheckSpecObject();
bool CollisonDetection();
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
void SummonHero(const a8::Vec2& pos,
RoomObstacle* SummonObstacle(Buff* buff, int id, const a8::Vec2& pos);
void SummonHero(Buff* buff,
const a8::Vec2& pos,
const a8::Vec2& dir,
std::vector<std::tuple<int, float, float, int>>& infos);
void FillSkillCasterState(SkillCasterState* caster_state);
@ -186,8 +187,8 @@ private:
std::array<float, kHAT_End> buff_attr_rate_ = {};
std::array<Buff*, kBET_End> buff_effect_ = {};
std::list<Buff> buff_list_;
std::list<Hero*> slave_heros_;
std::list<RoomObstacle*> slave_things_;
std::list<std::tuple<int, Hero*>> slave_heros_;
std::list<std::tuple<int, RoomObstacle*>> slave_things_;
a8::Vec2 skill_dir_;
float skill_param1 = 0;