From e594484a5e83a36b47057f90245698a39320f8a0 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 27 Jul 2021 13:31:16 +0000 Subject: [PATCH] 1 --- server/gameserver/creature.cc | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 4e848b9..a44fb79 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -2072,20 +2072,22 @@ void Creature::SummonHero(Buff* buff, int num = std::get<4>(info); MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(hero_id); if (hero_meta) { - for (int i = 0; i < 4; ++i) { - a8::Vec2 born_dir = dir; - a8::Vec2 born_offset(x, y); - born_offset.Rotate(born_dir.CalcAngle(a8::Vec2::UP)); - born_offset.Rotate(i * 0.5); - a8::Vec2 hero_pos = pos + born_offset; - Hero* hero = InternalSummonHero(hero_meta, - dir, - hero_pos, - through_wall); - if (hero) { - RemoveSurplusHero(buff->meta->i->buff_id(), hero_id, num); - slave_heros_.push_back(std::make_tuple(buff->meta->i->buff_id(), hero)); - break; + for (int j = 0; j < num; ++j) { + for (int i = 0; i < 4; ++i) { + a8::Vec2 born_dir = dir; + a8::Vec2 born_offset(x, y); + born_offset.Rotate(born_dir.CalcAngle(a8::Vec2::UP)); + born_offset.Rotate(i * 0.5); + a8::Vec2 hero_pos = pos + born_offset; + Hero* hero = InternalSummonHero(hero_meta, + dir, + hero_pos, + through_wall); + if (hero) { + RemoveSurplusHero(buff->meta->i->buff_id(), hero_id, num); + slave_heros_.push_back(std::make_tuple(buff->meta->i->buff_id(), hero)); + break; + } } } }