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