修复 7 浣熊,技能埋的地雷上限为3个,当前无用

This commit is contained in:
aozhiwei 2021-06-07 19:50:25 +08:00
parent f7a217e8f0
commit 6805da5bd2
9 changed files with 85 additions and 37 deletions

View File

@ -869,10 +869,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
case kBET_SummonHero:
{
if (!dead) {
SummonHero(buff,
GetPos(),
GetMoveDir(),
buff->meta->hero_infos);
SummonHero(buff, GetPos(), GetMoveDir());
}
}
break;
@ -1509,8 +1506,12 @@ void Creature::CheckSpecObject()
#endif
}
RoomObstacle* Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& pos)
void Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& pos)
{
buff->meta->int_param2 = 2;
if (buff->meta->int_param2 > 0) {
RemoveSurplusObstacle(buff->meta->i->buff_id(), id, buff->meta->int_param2);
}
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
if (obstacle) {
obstacle->master.Attach(this);
@ -1521,7 +1522,6 @@ RoomObstacle* Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& pos)
} else {
abort();
}
return obstacle;
}
bool Creature::CollisonDetection()
@ -1645,14 +1645,15 @@ void Creature::ResetAllSkillCd()
void Creature::SummonHero(Buff* buff,
const a8::Vec2& pos,
const a8::Vec2& dir,
std::vector<std::tuple<int, float, float, int>>& infos)
const a8::Vec2& dir
)
{
for (auto& info : infos) {
for (auto& info : buff->meta->hero_infos) {
int through_wall = std::get<0>(info);
float x = std::get<1>(info);
float y = std::get<2>(info) ;
int hero_id = std::get<3>(info);
int num = std::get<4>(info);
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(hero_id);
if (hero_meta && !dead) {
for (int i = 0; i < 4; ++i) {
@ -1671,6 +1672,7 @@ void Creature::SummonHero(Buff* buff,
hero_pos,
&collider
)) {
RemoveSurplusHero(buff->meta->i->buff_id(), hero_id, num);
Hero* hero = room->CreateHero
(this,
hero_meta,

View File

@ -153,11 +153,8 @@ class Creature : public MoveableEntity
void CheckSpecObject();
bool CollisonDetection();
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 SummonObstacle(Buff* buff, int id, const a8::Vec2& pos);
void SummonHero(Buff* buff, const a8::Vec2& pos, const a8::Vec2& dir);
void FillSkillCasterState(SkillCasterState* caster_state);
void RecoverSkillCasterState(SkillCasterState* caster_state);
CreatureWeakPtr AllocWeakPtr();

View File

@ -732,9 +732,10 @@ namespace MetaData
float x = a8::XValue(strings2[1]).GetDouble();
float y = a8::XValue(strings2[2]).GetDouble();
int hero_id = a8::XValue(strings2[3]);
int num = strings2.size() > 4 ? a8::XValue(strings2[4]).GetInt() : 10000;
hero_infos.push_back
(
std::make_tuple(through_wall, x, y, hero_id)
std::make_tuple(through_wall, x, y, hero_id, num)
);
}
}

View File

@ -192,7 +192,7 @@ namespace MetaData
std::vector<std::tuple<int, std::vector<std::tuple<int, int>>>> batch_add_list;
std::vector<std::tuple<int, std::vector<int>>> post_remove_action;
std::set<int> immune_buffeffect;
std::vector<std::tuple<int, float, float, int>> hero_infos;
std::vector<std::tuple<int, float, float, int, int>> hero_infos;
};
struct SkillPhase

View File

@ -54,7 +54,7 @@ class Obstacle : public Entity
void IncDoorOpenTimes(Room* room);
float GetHealth(Room* room);
void SetHealth(Room* room, float value);
void Die(Room* room);
virtual void Die(Room* room);
int GetTeamId(Room* room);
void SetTeamId(Room* room, int team_id);
int GetMasterId(Room* room);

View File

@ -636,48 +636,65 @@ Hero* Room::CreateHero(Creature* master,
}
void Room::RemoveObjectLater(RoomEntity* entity)
{
InternalRemoveObjectLater(entity, entity->xtimer_attacher);
}
void Room::RemoveObjectLater(RoomObstacle* entity)
{
InternalRemoveObjectLater(entity, entity->xtimer_attacher);
}
void Room::InternalRemoveObjectLater(Entity* entity, a8::XTimerAttacher& xtimer_attacher)
{
auto remove_func =
[] (const a8::XParams& param)
{
RoomEntity* entity = (RoomEntity*)param.sender.GetUserData();
Entity* entity = (Entity*)param.sender.GetUserData();
Room* room = (Room*)param.param1.GetUserData();
switch (entity->GetEntityType()) {
case ET_Bullet:
{
entity->room->RemoveFromMoveableHash((Bullet*)entity);
entity->room->grid_service->DelBullet((Bullet*)entity);
room->RemoveFromMoveableHash((Bullet*)entity);
room->grid_service->DelBullet((Bullet*)entity);
}
break;
case ET_Loot:
{
entity->BroadcastDeleteState(entity->room);
entity->room->grid_service->DelRoomEntity(entity->room, entity);
entity->BroadcastDeleteState(room);
room->grid_service->DelRoomEntity(room, entity);
}
break;
case ET_Player:
{
entity->room->RemoveFromMoveableHash((Human*)entity);
entity->room->RemoveFromHuamnHash((Human*)entity);
room->RemoveFromMoveableHash((Human*)entity);
room->RemoveFromHuamnHash((Human*)entity);
}
break;
case ET_Car:
{
#if 0
entity->RemoveFromAroundPlayers(entity->room);
entity->BroadcastDeleteState(entity->room);
entity->room->grid_service->RemoveCreature((Car*)entity);
RemoveFromAroundPlayers(entity->room);
BroadcastDeleteState(entity->room);
room->grid_service->RemoveCreature((Car*)entity);
#endif
entity->room->RemoveFromMoveableHash((Car*)entity);
room->RemoveFromMoveableHash((Car*)entity);
}
break;
case ET_Hero:
{
#if 0
entity->BroadcastDeleteState(entity->room);
entity->RemoveFromAroundPlayers(entity->room);
entity->room->grid_service->RemoveCreature((Hero*)entity);
BroadcastDeleteState(entity->room);
RemoveFromAroundPlayers(entity->room);
room->grid_service->RemoveCreature((Hero*)entity);
#endif
entity->room->RemoveFromMoveableHash((Hero*)entity);
room->RemoveFromMoveableHash((Hero*)entity);
}
break;
case ET_Obstacle:
{
entity->BroadcastDeleteState(room);
room->grid_service->DelRoomEntity(room, entity);
}
break;
default:
@ -686,7 +703,7 @@ void Room::RemoveObjectLater(RoomEntity* entity)
}
break;
}
entity->room->RemoveFromEntityHash(entity);
room->RemoveFromEntityHash(entity);
#ifdef DEBUG
#if 0
a8::UdpLog::Instance()->Debug
@ -701,11 +718,12 @@ void Room::RemoveObjectLater(RoomEntity* entity)
#endif
delete entity;
};
xtimer.AddDeadLineTimerAndAttach(0,
xtimer.AddDeadLineTimerAndAttach(2,
a8::XParams()
.SetSender(entity),
.SetSender(entity)
.SetParam1(this),
remove_func,
&entity->xtimer_attacher.timer_list_);
&xtimer_attacher.timer_list_);
}
void Room::OnHumanDie(Human* hum)

View File

@ -91,6 +91,7 @@ public:
Human* FindEnemy(Human* hum);
void RemoveObjectLater(RoomEntity* entity);
void RemoveObjectLater(RoomObstacle* entity);
void FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg);
@ -261,6 +262,7 @@ private:
size_t GetRoomMaxPlayerNum();
void InitAndroidAI();
void ForwardGasRing(int n);
void InternalRemoveObjectLater(Entity* entity, a8::XTimerAttacher& entity_xtimer_attacher);
#ifdef DEBUG
void InitDebugInfo();

View File

@ -31,6 +31,12 @@ RoomObstacle::~RoomObstacle()
#endif
room->map_service->RemoveCollider(collider);
}
if (!detached_) {
if (master.Get()) {
master.Get()->SlaveOnRemove(this);
}
detached_ = true;
}
if (!grid_list_) {
A8_SAFE_DELETE(grid_list_);
}
@ -445,5 +451,25 @@ void RoomObstacle::ActivePosionGas()
void RoomObstacle::DetachFromMaster()
{
if (!detached_) {
detached_ = true;
if (master.Get()) {
xtimer_attacher.ClearTimerList();
master.Get()->SlaveOnRemove(this);
room->grid_service->DelRoomEntity(room, this);
if (!IsDead(room)) {
Die(room);
BroadcastFullState(room);
}
room->RemoveObjectLater(this);
}
}
}
void RoomObstacle::Die(Room* room)
{
if (!IsDead(room)) {
Obstacle::Die(room);
DetachFromMaster();
}
}

View File

@ -22,6 +22,7 @@ class RoomObstacle : public Obstacle
void UpdateTimerFunc();
void Active();
void DetachFromMaster();
virtual void Die(Room* room) override;
private:
void Explosion();
@ -35,6 +36,7 @@ protected:
bool temp_through_ = false;
std::set<GridCell*>* grid_list_ = nullptr;
int explosion_times_ = 0;
bool detached_ = false;
RoomObstacle();