1
This commit is contained in:
parent
51d2c42713
commit
34661d26d9
@ -340,8 +340,9 @@ void Car::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
room,
|
||||
GetPos(),
|
||||
meta->i->explosion_range(),
|
||||
meta->i->atk(),
|
||||
meta->i->explosion_effect());
|
||||
meta->i->explosion_effect(),
|
||||
meta->i->atk()
|
||||
);
|
||||
}
|
||||
|
||||
void Car::GetAabbBox(AabbCollider& aabb_box)
|
||||
|
@ -116,23 +116,53 @@ void FrameEvent::AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos)
|
||||
|
||||
void FrameEvent::AddExplosionEx(CreatureWeakPtr& sender, int item_id, a8::Vec2 bomb_pos, int effect)
|
||||
{
|
||||
#if 0
|
||||
if (!sender.Get()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
Player* hum = room->GetOneAlivePlayer();
|
||||
sender.Attach((Creature*)hum);
|
||||
item_id = 66001;
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("AddExplosion pos=%d,%d effect:%d\n",
|
||||
{
|
||||
bomb_pos.x,
|
||||
bomb_pos.y,
|
||||
effect
|
||||
});
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
auto& tuple = a8::FastAppend(explosions_);
|
||||
if (sender.Get()) {
|
||||
std::get<0>(tuple).Attach(sender.Get());
|
||||
}
|
||||
auto& p = std::get<1>(tuple);
|
||||
|
||||
p.set_item_id(item_id);
|
||||
TypeConvert::ToPb(bomb_pos, p.mutable_pos());
|
||||
#if 0
|
||||
p.set_player_id(sender.Get()->GetUniId());
|
||||
#endif
|
||||
p.set_effect(effect);
|
||||
}
|
||||
{
|
||||
int explosion_idx = explosions_.size() - 1;
|
||||
sender.Get()->TraverseAllLayerHumanList
|
||||
std::set<GridCell*> grid_list;
|
||||
room->grid_service->GetAllCellsByXy
|
||||
(
|
||||
room,
|
||||
bomb_pos.x,
|
||||
bomb_pos.y,
|
||||
grid_list
|
||||
);
|
||||
|
||||
int explosion_idx = explosions_.size() - 1;
|
||||
room->grid_service->TraverseAllLayerHumanList
|
||||
(
|
||||
room->GetRoomIdx(),
|
||||
grid_list,
|
||||
[explosion_idx] (Human* hum, bool& stop)
|
||||
{
|
||||
hum->explosions_.push_back(explosion_idx);
|
||||
|
@ -11,6 +11,8 @@ class Creature;
|
||||
struct FrameEvent
|
||||
{
|
||||
public:
|
||||
Room* room = nullptr;
|
||||
|
||||
void AddAirDrop(int appear_time, int box_id, a8::Vec2 box_pos);
|
||||
void AddAirRaid(int appear_time, const a8::Vec2& raid_pos, float raid_rad);
|
||||
void AddEmote(CreatureWeakPtr& sender, int emote_id);
|
||||
|
@ -117,13 +117,17 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(Human* hum)
|
||||
for (size_t idx : hum->explosions_) {
|
||||
if (idx < room->frame_event.explosions_.size()) {
|
||||
auto& tuple = room->frame_event.explosions_[idx];
|
||||
#if 1
|
||||
{
|
||||
#else
|
||||
if (std::get<0>(tuple).Get() && hum->CanSee(std::get<0>(tuple).Get())) {
|
||||
#endif
|
||||
*msg->add_explosions() = std::get<1>(tuple);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("AddExplosion %d, %s pos=%d,%d effect:%d\n",
|
||||
{
|
||||
hum->GetUniId(),
|
||||
hum->name,
|
||||
std::get<1>(tuple).pos().x(),
|
||||
std::get<1>(tuple).pos().y(),
|
||||
std::get<1>(tuple).effect()
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
for (size_t idx : hum->smokes_) {
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "skill.h"
|
||||
#include "incubator.h"
|
||||
#include "team.h"
|
||||
#include "explosion.h"
|
||||
|
||||
const int kReviveTimeAdd = 12;
|
||||
const int kSkinNum = 4;
|
||||
@ -3503,7 +3504,7 @@ void Human::OnBulletHit(Bullet* bullet)
|
||||
}
|
||||
}
|
||||
|
||||
void Human::OnExplosionHit(Explosion* explosion)
|
||||
void Human::OnExplosionHit(Explosion* e)
|
||||
{
|
||||
if (IsInvincible()) {
|
||||
return;
|
||||
@ -3511,26 +3512,21 @@ void Human::OnExplosionHit(Explosion* explosion)
|
||||
if (dead) {
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
if (target->IsInvincible()) {
|
||||
continue;
|
||||
}
|
||||
if (sender.Get()->room->GetRoomMode() == kZombieMode &&
|
||||
sender.Get()->GetRace() == target->GetRace()) {
|
||||
continue;
|
||||
}
|
||||
if (!target->dead) {
|
||||
float dmg = GetAtk() * (1 + sender.Get()->GetAttrRate(kHAT_Atk)) +
|
||||
sender.Get()->GetAttrAbs(kHAT_Atk);
|
||||
float def = target->ability.def * (1 + target->GetAttrRate(kHAT_Def)) +
|
||||
target->GetAttrAbs(kHAT_Def);
|
||||
float dmg = e->GetDmg();
|
||||
float def = ability.def * (1 + GetAttrRate(kHAT_Def)) +
|
||||
GetAttrAbs(kHAT_Def);
|
||||
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||
finaly_dmg = std::max(finaly_dmg, 0.0f);
|
||||
target->DecHP(finaly_dmg,
|
||||
#if 1
|
||||
DecHP(finaly_dmg,
|
||||
1,
|
||||
"",
|
||||
1);
|
||||
#else
|
||||
DecHP(finaly_dmg,
|
||||
sender.Get()->GetUniId(),
|
||||
sender.Get()->GetName(),
|
||||
gun_meta->i->id());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -867,8 +867,8 @@ bool Obstacle::ProcSpecEvent(Creature* c, ColliderComponent* collider)
|
||||
Die(c->room);
|
||||
ProcDieExplosion(c->room);
|
||||
BroadcastFullState(c->room);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -887,7 +887,8 @@ void Obstacle::ProcDieExplosion(Room* room)
|
||||
room,
|
||||
GetPos(),
|
||||
meta->i->damage_dia(),
|
||||
meta->i->damage(),
|
||||
meta->i->explosion_effect());
|
||||
meta->i->explosion_effect(),
|
||||
meta->i->damage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,8 @@ void Room::Init()
|
||||
xtimer.Init(RoomXGetTickCount, this, 100, 100);
|
||||
xtimer_attacher_.xtimer = &xtimer;
|
||||
|
||||
frame_event.room = this;
|
||||
|
||||
CreateSpawnPoints();
|
||||
CreateMonsterSpawnPoints();
|
||||
CreateLoots();
|
||||
|
@ -183,13 +183,16 @@ void RoomObstacle::SpecExplosion()
|
||||
bomb_born_offset.Rotate(a8::RandAngle());
|
||||
bomb_born_offset = bomb_born_offset * a8::RandEx(1, std::max(2, meta->i->explosion_float()));
|
||||
a8::Vec2 bomb_pos = GetPos() + bomb_born_offset;
|
||||
#if 0
|
||||
Explosion explosion;
|
||||
explosion.IndifferenceAttack(
|
||||
room,
|
||||
bomb_pos,
|
||||
meta->i->damage_dia(),
|
||||
meta->i->damage(),
|
||||
meta->i->explosion_effect());
|
||||
meta->i->explosion_effect(),
|
||||
meta->i->damage()
|
||||
);
|
||||
#endif
|
||||
}
|
||||
if (explosion_times_ >= meta->i->explosion_times()) {
|
||||
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
|
||||
@ -208,12 +211,16 @@ void RoomObstacle::Active()
|
||||
break;
|
||||
case kObstacleMine:
|
||||
{
|
||||
#if 0
|
||||
ActiveMine();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case kObstacleTrap:
|
||||
{
|
||||
#if 0
|
||||
ActiveTrap();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case kObstaclePosionGas:
|
||||
|
Loading…
x
Reference in New Issue
Block a user