1
This commit is contained in:
parent
cdb2bfb5fc
commit
e22ede9fce
@ -2078,24 +2078,12 @@ void Creature::SummonHero(Buff* buff,
|
||||
born_offset.Rotate(born_dir.CalcAngle(a8::Vec2::UP));
|
||||
born_offset.Rotate(i * 0.5);
|
||||
a8::Vec2 hero_pos = pos + born_offset;
|
||||
CircleCollider collider;
|
||||
collider.pos = hero_pos;
|
||||
collider.rad = hero_meta->i->radius();
|
||||
if (!room->map_service->CollisionDetection
|
||||
(
|
||||
room,
|
||||
through_wall,
|
||||
hero_pos,
|
||||
&collider
|
||||
)) {
|
||||
Hero* hero = InternalSummonHero(hero_meta,
|
||||
dir,
|
||||
hero_pos,
|
||||
through_wall);
|
||||
if (hero) {
|
||||
RemoveSurplusHero(buff->meta->i->buff_id(), hero_id, num);
|
||||
Hero* hero = room->CreateHero
|
||||
(this,
|
||||
hero_meta,
|
||||
hero_pos,
|
||||
dir,
|
||||
team_id
|
||||
);
|
||||
slave_heros_.push_back(std::make_tuple(buff->meta->i->buff_id(), hero));
|
||||
break;
|
||||
}
|
||||
@ -2528,3 +2516,27 @@ void Creature::TraverseBuff(std::function<void (Buff*, bool&)> func)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Hero* Creature::InternalSummonHero(MetaData::Player* hero_meta, a8::Vec2 dir, a8::Vec2 born_pos, bool through_wall)
|
||||
{
|
||||
CircleCollider collider;
|
||||
collider.pos = born_pos;
|
||||
collider.rad = hero_meta->i->radius();
|
||||
if (!room->map_service->CollisionDetection
|
||||
(
|
||||
room,
|
||||
through_wall,
|
||||
born_pos,
|
||||
&collider
|
||||
)) {
|
||||
Hero* hero = room->CreateHero
|
||||
(this,
|
||||
hero_meta,
|
||||
born_pos,
|
||||
dir,
|
||||
team_id
|
||||
);
|
||||
return hero;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -232,6 +232,7 @@ private:
|
||||
void RemoveSurplusObstacle(int buff_id, int id, int num);
|
||||
void CheckAbilityUsed();
|
||||
void ProcOnceChgAttrBuff(MetaData::Buff* buff_meta);
|
||||
Hero* InternalSummonHero(MetaData::Player* hero_meta, a8::Vec2 dir, a8::Vec2 born_pos, bool through_wall );
|
||||
|
||||
protected:
|
||||
RaceType_e race_ = kHumanRace;
|
||||
|
Loading…
x
Reference in New Issue
Block a user