移除坦克逻辑
This commit is contained in:
parent
20e2965286
commit
c66790aeb0
@ -46,11 +46,7 @@ void FrameEvent::AddShot(Human* sender)
|
||||
auto& p = std::get<1>(tuple);
|
||||
|
||||
p.set_player_id(sender->GetEntityUniId());
|
||||
if (sender->tank_weapon.meta) {
|
||||
sender->tank_weapon.ToPB(p.mutable_weapon());
|
||||
} else {
|
||||
sender->curr_weapon->ToPB(p.mutable_weapon());
|
||||
}
|
||||
sender->curr_weapon->ToPB(p.mutable_weapon());
|
||||
#if 0
|
||||
p.set_offhand(true);
|
||||
p.set_bullskin(10001);
|
||||
@ -75,23 +71,14 @@ void FrameEvent::AddBullet(Human* sender, a8::Vec2 born_pos, a8::Vec2 dir, float
|
||||
auto& p = std::get<1>(tuple);
|
||||
|
||||
p.set_player_id(sender->GetEntityUniId());
|
||||
if (sender->tank_weapon.meta) {
|
||||
p.set_bullet_id(sender->tank_weapon.meta->i->use_bullet());
|
||||
} else {
|
||||
p.set_bullet_id(sender->curr_weapon->meta->i->use_bullet());
|
||||
}
|
||||
p.set_bullet_id(sender->curr_weapon->meta->i->use_bullet());
|
||||
TypeConvert::ToPb(born_pos, p.mutable_pos());
|
||||
TypeConvert::ToPb(dir, p.mutable_dir());
|
||||
#if 0
|
||||
p.set_bulletskin(10001);
|
||||
#endif
|
||||
if (sender->tank_weapon.meta) {
|
||||
p.set_gun_id(sender->tank_weapon.meta->i->id());
|
||||
p.set_gun_lv(sender->tank_weapon.weapon_lv);
|
||||
} else {
|
||||
p.set_gun_id(sender->curr_weapon->meta->i->id());
|
||||
p.set_gun_lv(sender->curr_weapon->weapon_lv);
|
||||
}
|
||||
p.set_gun_id(sender->curr_weapon->meta->i->id());
|
||||
p.set_gun_lv(sender->curr_weapon->weapon_lv);
|
||||
p.set_fly_distance(fly_distance);
|
||||
}
|
||||
{
|
||||
@ -157,6 +144,7 @@ void FrameEvent::AddBulletNumChg(Human* hum)
|
||||
hum->chged_bullet_nums_.push_back(idx);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void FrameEvent::AddTankBulletNumChg(Human* hum)
|
||||
{
|
||||
chged_tank_bullet_nums_.push_back(hum);
|
||||
@ -177,6 +165,7 @@ void FrameEvent::AddTankOilMaxChg(Human* hum)
|
||||
int idx = chged_tank_oil_max_.size() - 1;
|
||||
hum->chged_tank_oil_max_.push_back(idx);
|
||||
}
|
||||
#endif
|
||||
|
||||
void FrameEvent::AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos)
|
||||
{
|
||||
@ -376,6 +365,7 @@ void FrameEvent::Clear()
|
||||
if (!chged_bullet_nums_.empty()) {
|
||||
chged_bullet_nums_.clear();
|
||||
}
|
||||
#if 0
|
||||
if (!chged_tank_bullet_nums_.empty()) {
|
||||
chged_tank_bullet_nums_.clear();
|
||||
}
|
||||
@ -385,6 +375,7 @@ void FrameEvent::Clear()
|
||||
if (!chged_tank_oil_max_.empty()) {
|
||||
chged_tank_oil_max_.clear();
|
||||
}
|
||||
#endif
|
||||
if (!chged_buffs_.empty()) {
|
||||
chged_buffs_.clear();
|
||||
}
|
||||
|
@ -17,9 +17,11 @@ public:
|
||||
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
||||
void AddExplosionEx(Human* sender, int item_id, a8::Vec2 bomb_pos, int effect);
|
||||
void AddBulletNumChg(Human* hum);
|
||||
#if 0
|
||||
void AddTankBulletNumChg(Human* hum);
|
||||
void AddTankOilValueChg(Human* hum);
|
||||
void AddTankOilMaxChg(Human* hum);
|
||||
#endif
|
||||
void AddHpChg(Human* hum);
|
||||
void AddWeaponAmmoChg(Human* hum);
|
||||
void AddBuff(Human* hum, Buff* buff);
|
||||
@ -44,9 +46,11 @@ private:
|
||||
std::vector<std::tuple<Human*, ::cs::MFBuffChg>> chged_buffs_;
|
||||
std::vector<std::tuple<Human*, int, int>> chged_items_;
|
||||
std::vector<Human*> chged_bullet_nums_;
|
||||
#if 0
|
||||
std::vector<Human*> chged_tank_bullet_nums_;
|
||||
std::vector<Human*> chged_tank_oil_value_;
|
||||
std::vector<Human*> chged_tank_oil_max_;
|
||||
#endif
|
||||
std::vector<std::tuple<Human*, int, int>> chged_weapon_ammo_;
|
||||
std::vector<Human*> chged_hps_;
|
||||
std::vector<Human*> chged_skillcds_;
|
||||
|
@ -98,6 +98,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
for (size_t idx : hum->chged_tank_bullet_nums_) {
|
||||
if (idx < room->frame_event.chged_tank_bullet_nums_.size()) {
|
||||
Human* target = room->frame_event.chged_tank_bullet_nums_[idx];
|
||||
@ -129,6 +130,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
p->set_value(target->tank_oil_value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (size_t idx : hum->chged_buffs_) {
|
||||
if (idx < room->frame_event.chged_buffs_.size()) {
|
||||
auto p = msg->add_chged_buff_list();
|
||||
|
@ -196,22 +196,10 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
|
||||
p->set_disconnected(disconnected);
|
||||
p->set_anim_type(anim_type);
|
||||
p->set_anim_seq(anim_seq);
|
||||
#if 1
|
||||
for (auto itr : skins) {
|
||||
auto skin = p->add_skin();
|
||||
itr.ToPB(skin);
|
||||
}
|
||||
#else
|
||||
if (skin_tank.skin_id != 0) {
|
||||
skin_tank.ToPB(p->mutable_skin());
|
||||
} else {
|
||||
if (skin_jlf.skin_id != 0) {
|
||||
skin_jlf.ToPB(p->mutable_skin());
|
||||
} else {
|
||||
skin.ToPB(p->mutable_skin());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
p->set_backpack(backpack);
|
||||
p->set_helmet(helmet);
|
||||
p->set_chest(chest);
|
||||
@ -470,29 +458,6 @@ void Human::Shot(a8::Vec2& target_dir, bool& shot_ok)
|
||||
shot_ok = true;
|
||||
}
|
||||
|
||||
void Human::TankShot(a8::Vec2& target_dir)
|
||||
{
|
||||
if (!tank_weapon.meta) {
|
||||
return;
|
||||
}
|
||||
if (tank_weapon.ammo <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
InternalShot(this,
|
||||
tank_weapon.meta,
|
||||
tank_weapon.GetUpgradeMeta(),
|
||||
tank_weapon.bullet_meta,
|
||||
tank_weapon.weapon_lv,
|
||||
0,
|
||||
5,
|
||||
true);
|
||||
|
||||
--tank_weapon.ammo;
|
||||
last_shot_frameno_ = room->GetFrameNo();
|
||||
room->frame_event.AddTankBulletNumChg(this);
|
||||
}
|
||||
|
||||
void Human::RecalcSelfCollider()
|
||||
{
|
||||
if (!self_collider_) {
|
||||
@ -501,11 +466,7 @@ void Human::RecalcSelfCollider()
|
||||
AddEntityCollider(self_collider_);
|
||||
}
|
||||
self_collider_->pos = a8::Vec2();
|
||||
if (skin_tank_meta) {
|
||||
self_collider_->rad = skin_tank_meta->i->rad();
|
||||
} else {
|
||||
self_collider_->rad = meta->i->radius();
|
||||
}
|
||||
self_collider_->rad = meta->i->radius();
|
||||
}
|
||||
|
||||
bool Human::IsCollisionInMapService()
|
||||
@ -2123,6 +2084,7 @@ void Human::ClearFrameData()
|
||||
if (!chged_bullet_nums_.empty()) {
|
||||
chged_bullet_nums_.clear();
|
||||
}
|
||||
#if 0
|
||||
if (!chged_tank_bullet_nums_.empty()) {
|
||||
chged_tank_bullet_nums_.clear();
|
||||
}
|
||||
@ -2132,6 +2094,7 @@ void Human::ClearFrameData()
|
||||
if (!chged_tank_oil_max_.empty()){
|
||||
chged_tank_oil_max_.clear();
|
||||
}
|
||||
#endif
|
||||
if (!chged_hps_.empty()) {
|
||||
chged_hps_.clear();
|
||||
}
|
||||
@ -2438,89 +2401,6 @@ void Human::SendBattleReport()
|
||||
delete params;
|
||||
}
|
||||
|
||||
void Human::ProcLootOldSkin(Loot* entity, MetaData::Equip* item_meta)
|
||||
{
|
||||
auto oil_sync_func =
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
if (hum->dead || hum->skin_tank.tank_uniid != param.param1.GetInt()) {
|
||||
hum->room->xtimer.DeleteTimer(hum->room->xtimer.GetRunningTimer());
|
||||
return;
|
||||
}
|
||||
a8::XParams* mutable_param = hum->room->xtimer.MutableParams(hum->room->xtimer.GetRunningTimer());
|
||||
if (std::abs(mutable_param->param2.GetDouble() - (double)hum->tank_oil_value) > 0.1f) {
|
||||
hum->room->frame_event.AddTankOilValueChg(hum);
|
||||
mutable_param->param2 = hum->tank_oil_value;
|
||||
}
|
||||
};
|
||||
if (item_meta->i->is_luck()) {
|
||||
if (item_meta->i->is_luck() == 2) {
|
||||
if (skin_tank.skin_id != 0) {
|
||||
int loot_uniid = room->CreateLoot(skin_tank.skin_id, GetPos(), 1, 1);
|
||||
Entity* loot_entity = room->GetEntityByUniId(loot_uniid);
|
||||
if (loot_entity && loot_entity->IsEntityType(ET_Loot)) {
|
||||
((Loot*)loot_entity)->bullet_num = tank_weapon.ammo;
|
||||
((Loot*)loot_entity)->param1 = tank_oil_value;
|
||||
((Loot*)loot_entity)->param2 = tank_oil_max;
|
||||
room->UpdateCarObject(skin_tank.tank_uniid,
|
||||
loot_entity->GetEntityUniId(),
|
||||
loot_entity->GetPos());
|
||||
}
|
||||
}
|
||||
skin_tank.tank_uniid = entity->GetEntityUniId();
|
||||
skin_tank.skin_id = item_meta->i->id();
|
||||
skin_tank.skin_lv = std::max(1, GetSkinConfigLv(skin_tank.skin_id));
|
||||
skin_tank_meta = item_meta;
|
||||
tank_oil_value = entity->param1;
|
||||
tank_oil_max = entity->param2;
|
||||
{
|
||||
tank_weapon = Weapon();
|
||||
tank_weapon.weapon_idx = 100;
|
||||
tank_weapon.weapon_id = item_meta->i->use_bullet();
|
||||
tank_weapon.weapon_lv = 1;
|
||||
tank_weapon.ammo = entity->bullet_num;
|
||||
tank_weapon.meta = MetaMgr::Instance()->GetEquip(item_meta->i->use_bullet());
|
||||
tank_weapon.Recalc();
|
||||
}
|
||||
SetPos(entity->GetPos());
|
||||
RecalcSelfCollider();
|
||||
RecalcBuffAttr();
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
room->TakeOnCarObject(skin_tank.tank_uniid);
|
||||
room->NotifyUiUpdate();
|
||||
room->frame_event.AddTankBulletNumChg(this);
|
||||
room->frame_event.AddTankOilMaxChg(this);
|
||||
room->frame_event.AddTankOilValueChg(this);
|
||||
room->xtimer.AddRepeatTimerAndAttach(
|
||||
SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(skin_tank.tank_uniid)
|
||||
.SetParam2(tank_oil_value),
|
||||
oil_sync_func,
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
} else {
|
||||
if (skin_jlf.skin_id != 0) {
|
||||
room->DropItem(GetPos(), skin_jlf.skin_id, 1, skin_jlf.skin_lv);
|
||||
}
|
||||
skin_jlf.skin_id = item_meta->i->id();
|
||||
skin_jlf.skin_lv = std::max(1, GetSkinConfigLv(skin_jlf.skin_id));
|
||||
skin_jlf_meta = MetaMgr::Instance()->GetDress(skin_jlf.skin_id);
|
||||
#if 0
|
||||
if (skin_jlf_meta) {
|
||||
skill_meta = MetaMgr::Instance()->GetSkill(skin_jlf_meta->i->skill_id());
|
||||
} else {
|
||||
skill_meta = nullptr;
|
||||
}
|
||||
#endif
|
||||
RecalcBuffAttr();
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
||||
{
|
||||
switch (item_meta->i->equip_subtype()) {
|
||||
@ -3250,16 +3130,6 @@ void Human::Revive()
|
||||
}
|
||||
}
|
||||
|
||||
void Human::ResetTankSkin()
|
||||
{
|
||||
skin_tank = Skin();
|
||||
skin_tank_meta = nullptr;
|
||||
tank_weapon = Weapon();
|
||||
tank_oil_value = 0.0f;
|
||||
tank_oil_max = 0.0f;
|
||||
RecalcSelfCollider();
|
||||
}
|
||||
|
||||
Buff* Human::GetBuffById(int buff_id)
|
||||
{
|
||||
for (Buff& buff : buff_list_) {
|
||||
|
@ -48,7 +48,6 @@ class Human : public MoveableEntity
|
||||
MetaData::Equip* helmet_meta = nullptr;
|
||||
MetaData::Equip* chest_meta = nullptr;
|
||||
MetaData::Dress* skin_jlf_meta = nullptr;
|
||||
MetaData::Equip* skin_tank_meta = nullptr;
|
||||
HumanAbility ability;
|
||||
long long last_shot_frameno_ = 0;
|
||||
|
||||
@ -73,7 +72,6 @@ class Human : public MoveableEntity
|
||||
int action_item_id = 0;
|
||||
int action_target_id = 0;
|
||||
Skin skin_jlf;
|
||||
Skin skin_tank;
|
||||
int backpack = 0;
|
||||
int helmet = 0;
|
||||
int chest = 0;
|
||||
@ -101,9 +99,6 @@ class Human : public MoveableEntity
|
||||
long long real_dead_frameno = 0;
|
||||
|
||||
Weapon default_weapon;
|
||||
Weapon tank_weapon;
|
||||
float tank_oil_value = 0.0f;
|
||||
float tank_oil_max = 0.0f;
|
||||
std::vector<Weapon> weapons;
|
||||
Weapon* curr_weapon = nullptr;
|
||||
|
||||
@ -123,8 +118,6 @@ class Human : public MoveableEntity
|
||||
|
||||
std::set<Human*>* team_members = nullptr;
|
||||
std::set<Human*> kill_humans;
|
||||
Human* last_tank_attacker = nullptr;
|
||||
long long last_tank_attack_idx = 0;
|
||||
BornPoint* born_point = nullptr;
|
||||
|
||||
bool shot_start = false;
|
||||
@ -171,7 +164,6 @@ class Human : public MoveableEntity
|
||||
long long GetRealDeadFrameNo(Room* room);
|
||||
void FillMFTeamData(cs::MFTeamData* team_data, bool is_game_over);
|
||||
void Shot(a8::Vec2& target_dir, bool& shot_ok);
|
||||
void TankShot(a8::Vec2& target_dir);
|
||||
void RecalcSelfCollider();
|
||||
bool IsCollisionInMapService();
|
||||
void FindPathInMapService();
|
||||
@ -293,11 +285,9 @@ class Human : public MoveableEntity
|
||||
|
||||
protected:
|
||||
void _InternalUpdateMove(float speed);
|
||||
void ProcLootOldSkin(Loot* entity, MetaData::Equip* item_meta);
|
||||
void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta);
|
||||
void ProcLootCar(Loot* entity, MetaData::Equip* item_meta);
|
||||
void ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta);
|
||||
void ResetTankSkin();
|
||||
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
|
||||
Buff* GetBuffById(int buff_id);
|
||||
void ProcSkillPhase(MetaData::SkillPhase* phase);
|
||||
@ -362,9 +352,11 @@ protected:
|
||||
std::vector<int> chged_buffs_;
|
||||
std::set<Human*> observers_;
|
||||
std::vector<int> chged_bullet_nums_;
|
||||
#if 0
|
||||
std::vector<int> chged_tank_bullet_nums_;
|
||||
std::vector<int> chged_tank_oil_value_;
|
||||
std::vector<int> chged_tank_oil_max_;
|
||||
#endif
|
||||
std::vector<int> chged_hps_;
|
||||
std::vector<int> chged_skillcds_;
|
||||
std::vector<int> chged_items_;
|
||||
|
@ -136,9 +136,6 @@ void Player::UpdateMove()
|
||||
moved_frames = 0;
|
||||
return;
|
||||
}
|
||||
if (tank_weapon.meta && tank_oil_value < 0.00001f) {
|
||||
return;
|
||||
}
|
||||
_UpdateMove(std::max(1, (int)GetSpeed()));
|
||||
if (GetLastCollisionDoor() && !TestCollision(room, GetLastCollisionDoor())) {
|
||||
SetLastCollisionDoor(nullptr);
|
||||
@ -172,9 +169,6 @@ void Player::UpdateShot()
|
||||
return;
|
||||
}
|
||||
Weapon* p_weapon = curr_weapon;
|
||||
if (tank_weapon.meta) {
|
||||
p_weapon = &tank_weapon;
|
||||
}
|
||||
if (shot_hold) {
|
||||
++series_shot_frames;
|
||||
if (last_shot_frameno_ == 0 ||
|
||||
@ -325,10 +319,6 @@ void Player::UpdateUseSkill()
|
||||
|
||||
void Player::Shot()
|
||||
{
|
||||
if (tank_weapon.meta) {
|
||||
TankShot(attack_dir);
|
||||
return;
|
||||
}
|
||||
if (!curr_weapon->meta) {
|
||||
return;
|
||||
}
|
||||
@ -571,7 +561,7 @@ void Player::LootInteraction(Loot* entity)
|
||||
break;
|
||||
case EQUIP_TYPE_OLDSKIN:
|
||||
{
|
||||
ProcLootOldSkin(entity, item_meta);
|
||||
abort();
|
||||
}
|
||||
break;
|
||||
case EQUIP_TYPE_SKIN:
|
||||
@ -1179,7 +1169,6 @@ void Player::_CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg)
|
||||
downed = false;
|
||||
FreeDownedTimer();
|
||||
ability.hp = GetMaxHP();
|
||||
ResetTankSkin();
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
FreeReviveTimer();
|
||||
#if 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user