merge test

This commit is contained in:
aozhiwei 2021-07-16 19:32:23 +08:00
commit 4737b5e3f4
20 changed files with 279 additions and 71 deletions

9
README.md Normal file
View File

@ -0,0 +1,9 @@
* 击杀情况
1、自杀击按钮
2、自杀主动离开
3、子弹击杀
4、毒圈
5、爆炸
6、buff

View File

@ -39,7 +39,7 @@ float Ability::GetAttrAbs(int attr_id)
float Ability::GetAttrRate(int attr_id) float Ability::GetAttrRate(int attr_id)
{ {
float attr_rate_val = GetBuffAttrRate(attr_id); float attr_rate_val = GetBuffAttrRate(attr_id) / 100.0f;
return attr_rate_val; return attr_rate_val;
} }

View File

@ -29,6 +29,7 @@ struct xtimer_list;
class Buff class Buff
{ {
public: public:
int buff_uniid = 0;
Creature* owner = nullptr; Creature* owner = nullptr;
MetaData::Buff* meta = nullptr; MetaData::Buff* meta = nullptr;
MetaData::Skill* skill_meta = nullptr; MetaData::Skill* skill_meta = nullptr;

View File

@ -343,22 +343,37 @@ float Bullet::GetExplosionRange()
void Bullet::Check(float distance) void Bullet::Check(float distance)
{ {
int c_hit_num = 0;
int t_hit_num = 0;
std::set<Entity*> objects; std::set<Entity*> objects;
room->grid_service->TraverseCreatures room->grid_service->TraverseCreatures
(room->GetRoomIdx(), (room->GetRoomIdx(),
GetGridList(), GetGridList(),
[this, &objects] (Creature* c, bool& stop) [this, &objects, &c_hit_num] (Creature* c, bool& stop)
{ {
if (sender.Get()->IsProperTarget(c)) { if (sender.Get()->IsProperTarget(c)) {
if (gun_meta->i->ispenetrate() &&
hit_objects_.find(c->GetUniId()) != hit_objects_.end()) {
//穿人
return;
}
AabbCollider aabb_box; AabbCollider aabb_box;
c->GetHitAabbBox(aabb_box); c->GetHitAabbBox(aabb_box);
if (c != sender.Get() && !c->dead && TestCollision(room, &aabb_box)) { if (c != sender.Get() && !c->dead && TestCollision(room, &aabb_box)) {
if (meta->i->_inventory_slot() == IS_C4) { if (meta->i->_inventory_slot() == IS_C4) {
if (!c->IsHuman()) { if (!c->IsHuman()) {
objects.insert(c); objects.insert(c);
if (gun_meta->i->ispenetrate()) {
++c_hit_num;
hit_objects_.insert(c->GetUniId());
}
} }
} else { } else {
objects.insert(c); objects.insert(c);
if (gun_meta->i->ispenetrate()) {
++c_hit_num;
hit_objects_.insert(c->GetUniId());
}
} }
} }
} }
@ -369,9 +384,18 @@ void Bullet::Check(float distance)
for (ColliderComponent* collider : colliders) { for (ColliderComponent* collider : colliders) {
if (collider->owner->IsEntityType(ET_Obstacle)) { if (collider->owner->IsEntityType(ET_Obstacle)) {
Obstacle* obstacle = (Obstacle*)collider->owner; Obstacle* obstacle = (Obstacle*)collider->owner;
if (gun_meta->i->is_penetrate_thing() &&
hit_objects_.find(obstacle->GetUniId()) != hit_objects_.end()) {
//穿物件
continue;
}
if (!obstacle->CanThroughable(this)) { if (!obstacle->CanThroughable(this)) {
if (TestCollision(room, collider)) { if (TestCollision(room, collider)) {
objects.insert(collider->owner); objects.insert(collider->owner);
if (gun_meta->i->is_penetrate_thing()) {
++t_hit_num;
hit_objects_.insert(collider->owner->GetUniId());
}
} }
} }
} }
@ -390,8 +414,18 @@ void Bullet::Check(float distance)
if (!objects.empty()) { if (!objects.empty()) {
OnHit(objects); OnHit(objects);
} }
room->RemoveObjectLater(this); bool need_remove = true;
later_removed_ = true; if (distance < bullet_range) {
if (!gun_meta->i->is_penetrate_thing() && t_hit_num > 0 ||
!gun_meta->i->ispenetrate() && c_hit_num > 0) {
} else {
need_remove = false;
}
}
if (need_remove) {
room->RemoveObjectLater(this);
later_removed_ = true;
}
} }
} }
} }

View File

@ -66,6 +66,7 @@ private:
bool later_removed_ = false; bool later_removed_ = false;
std::shared_ptr<Ability> ability_; std::shared_ptr<Ability> ability_;
bool is_curr_weapon = false; bool is_curr_weapon = false;
std::set<int> hit_objects_;
friend class EntityFactory; friend class EntityFactory;
}; };

View File

@ -304,6 +304,14 @@ bool ColliderComponent::CalcSafePointEx(const a8::Vec2& a_pos, ColliderComponent
return false; return false;
} }
void AabbCollider::MoveCenter(float x, float y)
{
_min.x += x;
_min.y += y;
_max.x += x;
_max.y += y;
}
void DestoryCollider(ColliderComponent* collider) void DestoryCollider(ColliderComponent* collider)
{ {
switch (collider->type) { switch (collider->type) {

View File

@ -32,6 +32,7 @@ public:
a8::Vec2 _max; a8::Vec2 _max;
AabbCollider() { type = CT_Aabb; }; AabbCollider() { type = CT_Aabb; };
void MoveCenter(float x, float y);
}; };
class CircleCollider : public ColliderComponent class CircleCollider : public ColliderComponent

View File

@ -111,6 +111,12 @@ enum InventorySlot_e
IS_END IS_END
}; };
enum SkillType_e
{
kActiveSkill = 1,
kPassiveSkill = 2
};
enum BuffTriggerType_e enum BuffTriggerType_e
{ {
kBTT_UseSkill = 1, //技能释放时触发 kBTT_UseSkill = 1, //技能释放时触发

View File

@ -15,6 +15,7 @@ const int kInMountainTopBuffId = 7014;
const int kDownBuffId = 7015; const int kDownBuffId = 7015;
const int kPoisioningBuffId = 7016; const int kPoisioningBuffId = 7016;
const int kRescueBuffId = 7017; const int kRescueBuffId = 7017;
const int kVertigoBuffId = 7018;
enum BuffEffectType_e enum BuffEffectType_e
{ {

View File

@ -13,6 +13,84 @@
#include "trigger.h" #include "trigger.h"
#include "car.h" #include "car.h"
struct BulletInfo
{
CreatureWeakPtr c;
MetaData::Equip* weapon_meta = nullptr;
MetaData::EquipUpgrade* weapon_upgrade_meta = nullptr;
MetaData::Equip* bullet_meta = nullptr;
a8::Vec2 bullet_born_pos;
a8::Vec2 bullet_dir;
float fly_distance = 0;
bool is_tank_skin = false;
int weapon_lv = 0;
int delay_time = 0;
int invincible_buff_uniid = 0;
};
static void InternalCreateBullet(BulletInfo& bullet_info)
{
if (!bullet_info.c.Get()) {
return;
}
Creature* c = bullet_info.c.Get();
if (c->dead) {
return;
}
if (c->downed) {
return;
}
if (bullet_info.delay_time <= 0) {
int bullet_uniid = 0;
if (c->room->BattleStarted() ||
(c->room->GetGasData().gas_mode == GasJump &&
!c->HasBuffEffect(kBET_Jump))) {
bullet_uniid = c->room->CreateBullet
(c,
c->shot_passenger,
bullet_info.weapon_meta,
bullet_info.weapon_upgrade_meta,
bullet_info.bullet_meta,
bullet_info.bullet_born_pos,
bullet_info.bullet_dir,
bullet_info.fly_distance,
bullet_info.is_tank_skin);
}
if (bullet_uniid == 0) {
bullet_uniid = c->room->AllocUniid();
}
c->room->frame_event.AddBullet
(bullet_uniid,
c->GetWeakPtrRef(),
bullet_info.weapon_meta,
bullet_info.weapon_lv,
bullet_info.bullet_born_pos,
bullet_info.bullet_dir,
bullet_info.fly_distance);
} else {
BulletInfo* info_copy = new BulletInfo();
*info_copy = bullet_info;
bullet_info.c.Get()->room->xtimer.AddDeadLineTimerAndAttach
(
bullet_info.delay_time / FRAME_RATE_MS,
a8::XParams()
.SetSender(info_copy),
[] (const a8::XParams& param)
{
BulletInfo* info_copy = (BulletInfo*)param.sender.GetUserData();
info_copy->delay_time = 0;
InternalCreateBullet(*info_copy);
},
&bullet_info.c.Get()->xtimer_attacher.timer_list_,
[] (const a8::XParams& param)
{
BulletInfo* info_copy = (BulletInfo*)param.sender.GetUserData();
delete info_copy;
}
);
}
}
void InternalShot(Creature* c, void InternalShot(Creature* c,
MetaData::Equip* weapon_meta, MetaData::Equip* weapon_meta,
MetaData::EquipUpgrade* weapon_upgrade_meta, MetaData::EquipUpgrade* weapon_upgrade_meta,
@ -47,6 +125,14 @@ void InternalShot(Creature* c,
if (skill_id == 0) { if (skill_id == 0) {
c->room->frame_event.AddShot(c->GetWeakPtrRef()); c->room->frame_event.AddShot(c->GetWeakPtrRef());
} }
int invincible_buff_uniid = 0;
if (weapon_meta->lock_time > 0) {
int buff_uniid = c->TryAddBuff(c, kVertigoBuffId);
Buff* buff = c->GetBuffByUniId(buff_uniid);
if (buff && buff->remover_timer) {
c->room->xtimer.ModifyTimer(buff->remover_timer, weapon_meta->lock_time / FRAME_RATE_MS);
}
}
for (auto& tuple : weapon_meta->bullet_born_offset) { for (auto& tuple : weapon_meta->bullet_born_offset) {
a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple)); a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple));
bullet_born_offset.Rotate(c->GetAttackDir().CalcAngle(a8::Vec2::UP)); bullet_born_offset.Rotate(c->GetAttackDir().CalcAngle(a8::Vec2::UP));
@ -60,31 +146,21 @@ void InternalShot(Creature* c,
} }
} }
bullet_dir.Rotate(bullet_angle / 180.0f); bullet_dir.Rotate(bullet_angle / 180.0f);
int bullet_uniid = 0; {
if (c->room->BattleStarted() || BulletInfo bullet_info;
(c->room->GetGasData().gas_mode == GasJump && bullet_info.c = c->GetWeakPtrRef();
!c->HasBuffEffect(kBET_Jump))) { bullet_info.weapon_meta = weapon_meta;
bullet_uniid = c->room->CreateBullet bullet_info.weapon_upgrade_meta = weapon_upgrade_meta;
(c, bullet_info.bullet_meta = bullet_meta;
c->shot_passenger, bullet_info.bullet_born_pos = bullet_born_pos;
weapon_meta, bullet_info.bullet_dir = bullet_dir;
weapon_upgrade_meta, bullet_info.fly_distance = fly_distance;
bullet_meta, bullet_info.is_tank_skin = is_tank_skin;
bullet_born_pos, bullet_info.weapon_lv = weapon_lv;
bullet_dir, bullet_info.delay_time = std::get<3>(tuple);
fly_distance, bullet_info.invincible_buff_uniid = invincible_buff_uniid;
is_tank_skin); InternalCreateBullet(bullet_info);
} }
if (bullet_uniid == 0) {
bullet_uniid = c->room->AllocUniid();
}
c->room->frame_event.AddBullet(bullet_uniid,
c->GetWeakPtrRef(),
weapon_meta,
weapon_lv,
bullet_born_pos,
bullet_dir,
fly_distance);
} }
c->GetTrigger()->Shot(weapon_meta); c->GetTrigger()->Shot(weapon_meta);
if (weapon_meta->i->recoil_force() > 0.000001) { if (weapon_meta->i->recoil_force() > 0.000001) {
@ -170,6 +246,16 @@ Buff* Creature::GetBuffById(int buff_id)
return nullptr; return nullptr;
} }
Buff* Creature::GetBuffByUniId(int buff_uniid)
{
for (Buff& buff : buff_list_) {
if (buff.buff_uniid == buff_uniid) {
return &buff;
}
}
return nullptr;
}
int Creature::GetBuffNum(int buff_id) int Creature::GetBuffNum(int buff_id)
{ {
int num = 0; int num = 0;
@ -181,14 +267,14 @@ int Creature::GetBuffNum(int buff_id)
return num; return num;
} }
void Creature::AddBuff(Creature* caster, int Creature::AddBuff(Creature* caster,
MetaData::Buff* buff_meta, MetaData::Buff* buff_meta,
int skill_lv, int skill_lv,
MetaData::Skill* buff_skill_meta) MetaData::Skill* buff_skill_meta)
{ {
if (buff_meta->i->buff_interval() > 0) { if (buff_meta->i->buff_interval() > 0) {
if (buff_interval_hash_.find(buff_meta->i->buff_id()) != buff_interval_hash_.end()) { if (buff_interval_hash_.find(buff_meta->i->buff_id()) != buff_interval_hash_.end()) {
return; return 0;
} }
buff_interval_hash_[buff_meta->i->buff_id()] = room->GetFrameNo(); buff_interval_hash_[buff_meta->i->buff_id()] = room->GetFrameNo();
room->xtimer.AddDeadLineTimerAndAttach room->xtimer.AddDeadLineTimerAndAttach
@ -206,14 +292,14 @@ void Creature::AddBuff(Creature* caster,
} }
if (buff_meta->i->coexist_num() > 0){ if (buff_meta->i->coexist_num() > 0){
if (GetBuffNum(buff_meta->i->buff_id()) >= buff_meta->i->coexist_num()) { if (GetBuffNum(buff_meta->i->buff_id()) >= buff_meta->i->coexist_num()) {
return; return 0;
} }
} }
if (IsImmuneBuffEffect(buff_meta->i->buff_effect())) { if (IsImmuneBuffEffect(buff_meta->i->buff_effect())) {
return; return 0;
} }
if (buff_meta->i->depend_effect() != 0 && !HasBuffEffect(buff_meta->i->depend_effect())) { if (buff_meta->i->depend_effect() != 0 && !HasBuffEffect(buff_meta->i->depend_effect())) {
return; return 0;
} }
if (!buff_meta->EffectCanStack()) { if (!buff_meta->EffectCanStack()) {
Buff* buff = GetBuffByEffectId(buff_meta->i->buff_effect()); Buff* buff = GetBuffByEffectId(buff_meta->i->buff_effect());
@ -224,7 +310,10 @@ void Creature::AddBuff(Creature* caster,
if (buff_meta->i->buff_effect() == kBET_OnceChgAttr) { if (buff_meta->i->buff_effect() == kBET_OnceChgAttr) {
ProcOnceChgAttrBuff(buff_meta); ProcOnceChgAttrBuff(buff_meta);
} }
++buff_uniid_;
int new_buff_uniid = buff_uniid_;
Buff* buff = &a8::FastAppend(buff_list_); Buff* buff = &a8::FastAppend(buff_list_);
buff->buff_uniid = new_buff_uniid;
buff->SetCaster(caster); buff->SetCaster(caster);
buff->skill_lv = skill_lv; buff->skill_lv = skill_lv;
buff->owner = this; buff->owner = this;
@ -274,6 +363,7 @@ void Creature::AddBuff(Creature* caster,
} }
} }
} }
return new_buff_uniid;
#ifdef DEBUG #ifdef DEBUG
SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d", SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d",
{ {
@ -299,21 +389,22 @@ bool Creature::IsImmuneBuffEffect(int buff_effect)
return false; return false;
} }
void Creature::MustBeAddBuff(Creature* caster, int buff_id) int Creature::MustBeAddBuff(Creature* caster, int buff_id)
{ {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id); MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
if (!buff_meta) { if (!buff_meta) {
abort(); abort();
} }
AddBuff(caster, buff_meta, 1); return AddBuff(caster, buff_meta, 1);
} }
void Creature::TryAddBuff(Creature* caster, int buff_id) int Creature::TryAddBuff(Creature* caster, int buff_id)
{ {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id); MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
if (buff_meta) { if (buff_meta) {
AddBuff(caster, buff_meta, 1); return AddBuff(caster, buff_meta, 1);
} }
return -1;
} }
void Creature::RemoveBuffById(int buff_id) void Creature::RemoveBuffById(int buff_id)
@ -512,10 +603,12 @@ void Creature::AddPassiveSkill(int skill_id)
skill->Initialzie(); skill->Initialzie();
passive_skill_hash_[skill_meta->i->skill_id()] = skill; passive_skill_hash_[skill_meta->i->skill_id()] = skill;
skill->AddPassiveSkillBuff(); skill->AddPassiveSkillBuff();
#if 0
if (skill_meta->i->skill_cd() > 10000) { if (skill_meta->i->skill_cd() > 10000) {
//永久被动被动技能 //永久被动被动技能
skill->AddPassiveSkillBuff(); skill->AddPassiveSkillBuff();
} }
#endif
} }
} }
@ -1332,7 +1425,7 @@ void Creature::UpdatePoisoning()
} else { } else {
dmg = room->GetGasData().old_area_meta->i->hurt(); dmg = room->GetGasData().old_area_meta->i->hurt();
} }
dmg *= 1 - GetAbility()->GetAttrRate(kHAT_PoisoningReduction); dmg *= 1 + GetAbility()->GetAttrRate(kHAT_PoisoningReduction);
dmg = std::max(10.0f, dmg); dmg = std::max(10.0f, dmg);
DecHP(dmg, VP_SafeArea, TEXT("battle_server_killer_gas", "毒圈"), VW_SafeArea); DecHP(dmg, VP_SafeArea, TEXT("battle_server_killer_gas", "毒圈"), VW_SafeArea);
if (dead) { if (dead) {

View File

@ -92,14 +92,15 @@ class Creature : public MoveableEntity
bool HasBuffEffect(int buff_effect_id); bool HasBuffEffect(int buff_effect_id);
Buff* GetBuffByEffectId(int effect_id); Buff* GetBuffByEffectId(int effect_id);
Buff* GetBuffById(int buff_id); Buff* GetBuffById(int buff_id);
Buff* GetBuffByUniId(int buff_uniid);
int GetBuffNum(int buff_id); int GetBuffNum(int buff_id);
void AddBuff(Creature* caster, int AddBuff(Creature* caster,
MetaData::Buff* buff_meta, MetaData::Buff* buff_meta,
int skill_lv, int skill_lv,
MetaData::Skill* buff_skill_meta = nullptr); MetaData::Skill* buff_skill_meta = nullptr);
bool IsImmuneBuffEffect(int buff_effect); bool IsImmuneBuffEffect(int buff_effect);
void MustBeAddBuff(Creature* caster, int buff_id); int MustBeAddBuff(Creature* caster, int buff_id);
void TryAddBuff(Creature* caster, int buff_id); int TryAddBuff(Creature* caster, int buff_id);
void RemoveBuffById(int buff_id); void RemoveBuffById(int buff_id);
void ClearBuffById(int buff_id); void ClearBuffById(int buff_id);
void RecalcBuffAttr(); void RecalcBuffAttr();
@ -252,6 +253,7 @@ private:
CreatureWeakPtrChunk weak_ptr_chunk_; CreatureWeakPtrChunk weak_ptr_chunk_;
HumanAbility ability; HumanAbility ability;
std::shared_ptr<Ability> ability_; std::shared_ptr<Ability> ability_;
int buff_uniid_ = 1000;
std::array<list_head, kBET_End> buff_effect_ = {}; std::array<list_head, kBET_End> buff_effect_ = {};
std::array<list_head, kBET_End> depend_effect_ = {}; std::array<list_head, kBET_End> depend_effect_ = {};
std::array<list_head, kCondBuffEnd> cond_buffs_ = {}; std::array<list_head, kCondBuffEnd> cond_buffs_ = {};

View File

@ -258,9 +258,7 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
p->set_revive_countdown(countdown); p->set_revive_countdown(countdown);
} }
} }
if (room->GetRoomMode() == kZombieMode) { p->set_charid(meta->i->id());
p->set_charid(meta->i->id());
}
if (GetCar()) { if (GetCar()) {
p->set_car_uniid(GetCar()->car_uniid); p->set_car_uniid(GetCar()->car_uniid);
p->set_car_seat(GetSeat()); p->set_car_seat(GetSeat());
@ -357,11 +355,14 @@ void Human::GetAabbBox(AabbCollider& aabb_box)
aabb_box._min.y = -GetCar()->meta->i->rad(); aabb_box._min.y = -GetCar()->meta->i->rad();
aabb_box._max.x = GetCar()->meta->i->rad(); aabb_box._max.x = GetCar()->meta->i->rad();
aabb_box._max.y = GetCar()->meta->i->rad(); aabb_box._max.y = GetCar()->meta->i->rad();
aabb_box.MoveCenter(GetCar()->hero_meta_->i->move_offset_x(),
GetCar()->hero_meta_->i->move_offset_y());
} else { } else {
aabb_box._min.x = -meta->i->radius(); aabb_box._min.x = -meta->i->radius();
aabb_box._min.y = -meta->i->radius(); aabb_box._min.y = -meta->i->radius();
aabb_box._max.x = meta->i->radius(); aabb_box._max.x = meta->i->radius();
aabb_box._max.y = meta->i->radius(); aabb_box._max.y = meta->i->radius();
aabb_box.MoveCenter(meta->i->move_offset_x(), meta->i->move_offset_y());
} }
} }
@ -642,6 +643,8 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
{ {
if (this != member) { if (this != member) {
member->FillMFTeamData(msg.add_team_data(), true); member->FillMFTeamData(msg.add_team_data(), true);
cs::MFPlayerStats* p = msg.add_player_stats();
member->FillMFPlayerStats(p);
} }
return true; return true;
}); });
@ -3351,11 +3354,14 @@ void Human::GetHitAabbBox(AabbCollider& aabb_box)
aabb_box._min.y = -GetCar()->meta->i->rad(); aabb_box._min.y = -GetCar()->meta->i->rad();
aabb_box._max.x = GetCar()->meta->i->rad(); aabb_box._max.x = GetCar()->meta->i->rad();
aabb_box._max.y = GetCar()->meta->i->rad(); aabb_box._max.y = GetCar()->meta->i->rad();
aabb_box.MoveCenter(GetCar()->hero_meta_->i->hit_offset_x(),
GetCar()->hero_meta_->i->hit_offset_y());
} else { } else {
aabb_box._min.x = -GetHitRadius(); aabb_box._min.x = -GetHitRadius();
aabb_box._min.y = -GetHitRadius(); aabb_box._min.y = -GetHitRadius();
aabb_box._max.x = GetHitRadius(); aabb_box._max.x = GetHitRadius();
aabb_box._max.y = GetHitRadius(); aabb_box._max.y = GetHitRadius();
aabb_box.MoveCenter(meta->i->hit_offset_x(), meta->i->hit_offset_y());
} }
} }
@ -3533,11 +3539,6 @@ void Human::OnBulletHit(Bullet* bullet)
finaly_dmg = std::max(finaly_dmg, 0.0f); finaly_dmg = std::max(finaly_dmg, 0.0f);
#if 0 #if 0
sender->stats.damage_amount_out += finaly_dmg; sender->stats.damage_amount_out += finaly_dmg;
#endif
#ifdef DEBUG
if (App::Instance()->HasFlag(1) && IsPlayer()) {
return;
}
#endif #endif
if (bullet->meta->buff_meta) { if (bullet->meta->buff_meta) {
MustBeAddBuff(this, bullet->meta->i->buffid()); MustBeAddBuff(this, bullet->meta->i->buffid());

View File

@ -189,12 +189,15 @@ namespace MetaData
std::vector<std::string> strings2; std::vector<std::string> strings2;
a8::Split(str, strings2, ':'); a8::Split(str, strings2, ':');
assert(strings2.size() >= 2); assert(strings2.size() >= 2);
bullet_born_offset.push_back(std::make_tuple( bullet_born_offset.push_back
a8::XValue(strings2[0]).GetDouble(), (std::make_tuple(
a8::XValue(strings2[1]).GetDouble(), a8::XValue(strings2[0]).GetDouble(),
strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0 a8::XValue(strings2[1]).GetDouble(),
) strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0,
); strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0
)
);
lock_time += strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0;
} }
} }
{ {
@ -749,15 +752,29 @@ namespace MetaData
} }
} }
} }
}
void Skill::Init2()
{
int skill_id = i->skill_id();
if (!(i->skill_type() == kActiveSkill || i->skill_type() == kPassiveSkill)) {
abort();
}
#if 0
if (!(i->use_method() == 1 || i->use_method() == 2 || i->use_method() == 3)) {
abort();
}
#endif
{ {
for (int buff_id : buff_list) { for (int buff_id : buff_list) {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id); MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
if (!buff_meta) { if (!buff_meta) {
#if 1
continue;
#else
abort(); abort();
#endif }
if (i->skill_type() == kPassiveSkill) {
if (buff_meta->i->trigger_type() != kBTT_UseSkill) {
abort();
}
} }
auto itr = trigger_type_buffs.find(buff_meta->i->trigger_type()); auto itr = trigger_type_buffs.find(buff_meta->i->trigger_type());
if (itr != trigger_type_buffs.end()) { if (itr != trigger_type_buffs.end()) {
@ -939,11 +956,29 @@ namespace MetaData
} }
} }
if (i->buff_effect() == kBET_CondAddBuff) { if (i->buff_effect() == kBET_CondAddBuff) {
#if 0
if (!IsValidCondBuff(int_param1)) { if (!IsValidCondBuff(int_param1)) {
abort(); abort();
} }
#endif }
}
void Buff::Init2()
{
switch (i->buff_effect()) {
case kBET_ChgAttr:
{
assert(int_param2 == 1 || int_param2 == 2);
if (int_param2 == 2) {
if (i->buff_param3().find('.') != std::string::npos) {
abort();
}
}
}
break;
default:
{
}
break;
} }
} }

View File

@ -72,7 +72,8 @@ namespace MetaData
{ {
const metatable::Equip* i = nullptr; const metatable::Equip* i = nullptr;
std::vector<std::tuple<float, float, float>> bullet_born_offset; int lock_time = 0;
std::vector<std::tuple<float, float, float, int>> bullet_born_offset;
std::vector<std::tuple<int, a8::Vec2>> shoot_offsets; std::vector<std::tuple<int, a8::Vec2>> shoot_offsets;
std::array<int, IS_END> volume = {}; std::array<int, IS_END> volume = {};
int int_param1 = 0; int int_param1 = 0;
@ -195,6 +196,7 @@ namespace MetaData
const metatable::Buff* i = nullptr; const metatable::Buff* i = nullptr;
void Init(); void Init();
void Init2();
bool EffectCanStack(); bool EffectCanStack();
bool IsImmuneBuffEffect(int buff_effect); bool IsImmuneBuffEffect(int buff_effect);
bool Match(CondAddBuff_e cond, int val); bool Match(CondAddBuff_e cond, int val);
@ -241,6 +243,7 @@ namespace MetaData
const metatable::Skill* i = nullptr; const metatable::Skill* i = nullptr;
void Init(); void Init();
void Init2();
float value_up = 0.0f; float value_up = 0.0f;
std::set<int> buff_list; std::set<int> buff_list;

View File

@ -445,6 +445,15 @@ private:
} }
} }
#endif #endif
{
for (auto& skill : skill_list) {
skill.Init2();
}
for (auto& buff : buff_list) {
buff.Init2();
}
}
} }
void BindToMetaData() void BindToMetaData()

View File

@ -3914,7 +3914,8 @@ void Room::AirRaid(int airraid_id)
} }
a8::Vec2 dir = a8::Vec2::UP; a8::Vec2 dir = a8::Vec2::UP;
dir.Rotate(a8::RandAngle()); dir.Rotate(a8::RandAngle());
a8::Vec2 center = gas_data_.pos_new + dir * (100 + rand() % gas_data_.new_area_meta->i->rad()); float rnd_rad = gas_data_.new_area_meta->i->rad() > 0 ? rand() % gas_data_.new_area_meta->i->rad() : 0;
a8::Vec2 center = gas_data_.pos_new + dir * (100 + rnd_rad);
{ {
std::vector<Player*> humans; std::vector<Player*> humans;
GetAlivePlayers(humans, GetRoomMaxPlayerNum()); GetAlivePlayers(humans, GetRoomMaxPlayerNum());

View File

@ -165,7 +165,10 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
hdr.socket_handle, hdr.socket_handle,
msg msg
); );
hum->meta = MetaMgr::Instance()->human_meta; hum->meta = MetaMgr::Instance()->GetPlayer(msg.hero_id());
if (!hum->meta) {
hum->meta = MetaMgr::Instance()->human_meta;
}
hum->room = room; hum->room = room;
room->AddPlayer(hum); room->AddPlayer(hum);
hum->ProcPrepareItems(msg.prepare_items()); hum->ProcPrepareItems(msg.prepare_items());

View File

@ -10,12 +10,6 @@ namespace cs
class MFSkill; class MFSkill;
} }
enum SkillType_e
{
kActiveSkill = 1,
kPassiveSkill = 2
};
struct xtimer_list; struct xtimer_list;
class Creature; class Creature;
class Skill class Skill

View File

@ -268,7 +268,6 @@ message MFPlayerFull
repeated MFAttrAddition attr_addition= 61; // repeated MFAttrAddition attr_addition= 61; //
//
optional int32 charid = 44; //id optional int32 charid = 44; //id
optional float speed = 45; // optional float speed = 45; //
@ -902,6 +901,7 @@ message CMJoin
optional int32 mapid = 53; //id 0: optional int32 mapid = 53; //id 0:
repeated MFPair skill_list = 54; // key:id value:,0 repeated MFPair skill_list = 54; // key:id value:,0
optional string user_data = 60 [default = ""]; // optional string user_data = 60 [default = ""]; //
optional int32 hero_id = 61; //id
} }
//线 //线

View File

@ -137,6 +137,8 @@ message Equip
optional float average_oil = 58; optional float average_oil = 58;
optional float atk_mech = 59; optional float atk_mech = 59;
optional int32 use_scene = 60; optional int32 use_scene = 60;
optional int32 ispenetrate = 61;
optional int32 is_penetrate_thing = 62;
optional string inventory_slot = 31; // optional string inventory_slot = 31; //
optional int32 _inventory_slot = 32; // optional int32 _inventory_slot = 32; //
@ -152,6 +154,8 @@ message EquipUpgrade
message Player message Player
{ {
optional int32 id = 1; //id optional int32 id = 1; //id
optional float move_offset_x = 40;
optional float move_offset_y = 41;
optional float radius = 2; // optional float radius = 2; //
optional int32 health = 3; // optional int32 health = 3; //
optional int32 move_speed = 4; // optional int32 move_speed = 4; //
@ -175,6 +179,8 @@ message Player
optional int32 revive_time = 22; optional int32 revive_time = 22;
optional string name = 23; optional string name = 23;
optional int32 normal_skill = 24; optional int32 normal_skill = 24;
optional float hit_offset_x = 42;
optional float hit_offset_y = 43;
optional float hit_radius = 25; optional float hit_radius = 25;
optional string ai_script = 26; optional string ai_script = 26;
optional string init_buffs = 27; optional string init_buffs = 27;