This commit is contained in:
aozhiwei 2019-04-28 17:21:18 +08:00
parent 3eaeea9686
commit 114a325b5f
6 changed files with 26 additions and 3 deletions

View File

@ -53,6 +53,7 @@ void Hero::FillMFObjectFull(cs::MFObjectFull* full_data)
p->set_helmet(helmet);
p->set_chest(chest);
weapon.ToPB(p->mutable_weapon());
p->set_energy_shield(energy_shield);
}
ColliderComponent* Hero::GetBoxBound()

View File

@ -20,6 +20,7 @@ class Hero : public Entity
int helmet = 0;
int chest = 0;
Weapon weapon;
int energy_shield = 0;
Hero();
virtual ~Hero() override;

View File

@ -875,12 +875,13 @@ void Human::OnGridListChange(std::set<GridCell*>& old_grid_list,
}
}
}
#if 0
for (GridCell* cell : dec_grid_list) {
for (Human* entity : cell->human_list) {
#if 0
if (!room->grid_service.HumanInGridList(entity, grid_list)) {
RemoveObjects(entity);
}
#endif
}
for (Entity* entity : cell->entity_list) {
if (!room->grid_service.EntityInGridList(entity, grid_list)) {
@ -888,7 +889,9 @@ void Human::OnGridListChange(std::set<GridCell*>& old_grid_list,
case ET_Building:
case ET_Obstacle:
{
#if 0
RemoveObjects(entity);
#endif
}
break;
default:
@ -899,7 +902,6 @@ void Human::OnGridListChange(std::set<GridCell*>& old_grid_list,
}
}
}
#endif
}
void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
@ -1113,12 +1115,21 @@ void Human::FillBodyState(::google::protobuf::RepeatedPtrField<::cs::MFBodyState
state->set_left_time(std::max(0, skill_meta->i->last_time() * 1000 - passed_time));
state->set_lasting_time(skill_meta->i->last_time() * 1000);
}
if (a8::HasBitFlag(status, HS_SummonHero) && skill_meta) {
int passed_time = (room->frame_no - reflect_damage_frameno_) * FRAME_RATE_MS;
cs::MFBodyState* state = states->Add();
state->set_state_type(HS_SummonHero);
state->set_left_time(std::max(0, skill_meta->i->last_time() * 1000 - passed_time));
state->set_lasting_time(skill_meta->i->last_time() * 1000);
}
}
void Human::SummonHero()
{
Hero* hero = room->CreateHero(this);
if (hero) {
hide_frameno_ = room->frame_no;
a8::SetBitFlag(status, HS_SummonHero);
room->xtimer.AddDeadLineTimerAndAttach(skill_meta->i->last_time() * SERVER_FRAME_RATE,
a8::XParams()
.SetSender(this)
@ -1134,7 +1145,12 @@ void Human::SummonHero()
if (hero && hero->entity_type == ET_Hero) {
hum->room->RemoveObjectLater(hero);
}
a8::UnSetBitFlag(hum->status, HS_SummonHero);
hum->need_sync_active_player = true;
hum->BroadcastFullState();
}
);
need_sync_active_player = true;
BroadcastFullState();
}
}

View File

@ -22,6 +22,7 @@ enum HumanStatus
HS_DefAdd = 7,
HS_RecoverHP = 8,
HS_ReflectDamage = 9,
HS_SummonHero = 10,
HS_End
};
@ -161,6 +162,7 @@ protected:
long long defadd_frameno_ = 0;
long long recover_hp_frameno_ = 0;
long long reflect_damage_frameno_ = 0;
long long summon_hero_frameno_ = 0;
a8::XTimerAttacher skill_xtimer_attacher_;
std::array<int, IS_END - 1> inventory_ = {};

View File

@ -443,6 +443,7 @@ Hero* Room::CreateHero(Human* hum)
hero->helmet = hum->helmet;
hero->chest = hum->chest;
hero->weapon = *hum->curr_weapon;
hero->energy_shield = hum->energy_shield;
hero->Initialize();
#if 1
uniid_hash_[hero->entity_uniid] = hero;

View File

@ -316,7 +316,7 @@ message MFHeroFull
optional int32 helmet = 16; //
optional int32 chest = 17; //
optional MFWeapon weapon = 18; //
optional int32 energy_shield = 19; //
}
//-
@ -485,6 +485,7 @@ message MFExplosion
optional int32 item_id = 1; //id
optional MFVector2D pos = 2; //
optional int32 player_id = 3; //id
optional int32 effect = 4; // 0 1:
}
//
@ -552,6 +553,7 @@ message MFBodyState
7:
8:
9:
10:
*/
optional int32 state_type = 1;