add weapon_id
This commit is contained in:
parent
e1ac7b4f58
commit
5efdcf722c
@ -108,11 +108,11 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
float def = hum->def + hum->buff.def_add;
|
||||
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||
player->stats.damage_amount_out += finaly_dmg;
|
||||
hum->DecHP(finaly_dmg, player->entity_uniid, player->name);
|
||||
hum->DecHP(finaly_dmg, player->entity_uniid, player->name, gun_meta->i->id());
|
||||
if (a8::HasBitFlag(hum->status, HS_ReflectDamage) && hum->skill_meta) {
|
||||
float reflect_dmg = finaly_dmg * hum->skill_meta->i->value1();
|
||||
if (reflect_dmg > 1.0f) {
|
||||
player->DecHP(reflect_dmg, hum->entity_uniid, hum->name);
|
||||
player->DecHP(reflect_dmg, hum->entity_uniid, hum->name, gun_meta->i->id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,18 @@ enum SkillCond_e
|
||||
SC_Passive = 2
|
||||
};
|
||||
|
||||
enum VirtualWeapon_e
|
||||
{
|
||||
VW_SafeArea = 9000000,
|
||||
VW_Spectate = 9000001,
|
||||
VW_SelfDetonate = 9000002,
|
||||
};
|
||||
|
||||
enum VirtualPlayer_e
|
||||
{
|
||||
VP_SafeArea = 9000000,
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -331,9 +331,9 @@ void Human::UpdatePoisoning()
|
||||
bool need_notify = poisoning_time > 1000;
|
||||
while (poisoning_time > 1000) {
|
||||
if (room->gas_data.is_last_gas) {
|
||||
DecHP(room->gas_data.new_area_meta->i->hurt(), -1, "安全区");
|
||||
DecHP(room->gas_data.new_area_meta->i->hurt(), VP_SafeArea, "安全区", VW_SafeArea);
|
||||
} else {
|
||||
DecHP(room->gas_data.old_area_meta->i->hurt(), -1, "安全区");
|
||||
DecHP(room->gas_data.old_area_meta->i->hurt(), VP_SafeArea, "安全区", VW_SafeArea);
|
||||
}
|
||||
if (dead) {
|
||||
poisoning_time = 0;
|
||||
@ -448,7 +448,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
|
||||
FillMFPlayerStats(p);
|
||||
}
|
||||
|
||||
void Human::BeKill(int killer_id, const std::string& killer_name)
|
||||
void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
{
|
||||
if (!dead && !room->game_over) {
|
||||
Entity* hum = room->GetEntityByUniId(killer_id);
|
||||
@ -474,7 +474,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name)
|
||||
}
|
||||
}
|
||||
|
||||
void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name)
|
||||
void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
||||
{
|
||||
auto downed_func = [] (const a8::XParams& param)
|
||||
{
|
||||
@ -487,11 +487,11 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name)
|
||||
return;
|
||||
}
|
||||
if (!hum->HasLiveTeammate()) {
|
||||
hum->BeKill(param.param1, param.param2);
|
||||
hum->BeKill(param.param1, param.param2, param.param3);
|
||||
return;
|
||||
}
|
||||
int dec_hp = MetaMgr::Instance()->GetSysParamAsInt("downed_dec_hp");
|
||||
hum->DecHP(dec_hp, param.param1, param.param2);
|
||||
hum->DecHP(dec_hp, param.param1, param.param2, param.param3);
|
||||
};
|
||||
if (energy_shield > 0.001f) {
|
||||
energy_shield = std::max(0.0f, energy_shield - dec_hp);
|
||||
@ -508,7 +508,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name)
|
||||
}
|
||||
downed = false;
|
||||
downed_timer = nullptr;
|
||||
BeKill(killer_id, killer_name);
|
||||
BeKill(killer_id, killer_name, weapon_id);
|
||||
} else {
|
||||
if (HasLiveTeammate()) {
|
||||
health = MetaMgr::Instance()->GetSysParamAsInt("downed_recover_hp");
|
||||
@ -518,12 +518,13 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name)
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(killer_id)
|
||||
.SetParam2(killer_name),
|
||||
.SetParam2(killer_name)
|
||||
.SetParam3(weapon_id),
|
||||
downed_func,
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
} else {
|
||||
BeKill(killer_id, killer_name);
|
||||
BeKill(killer_id, killer_name, weapon_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1270,7 +1271,25 @@ void Human::BattleReport()
|
||||
params->SetVal("rifle_kill", 0);
|
||||
params->SetVal("pistol_kill", 0);
|
||||
params->SetVal("submachine_kill", 0);
|
||||
params->SetVal("rescue_kill", 0);
|
||||
params->SetVal("coin_num", 0);
|
||||
{
|
||||
#if 0
|
||||
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(lethal_weapon);
|
||||
if (equip_meta) {
|
||||
switch (equip_meta->i->equip_subtype()) {
|
||||
case 7:
|
||||
{
|
||||
params->SetVal("snipe_kill", 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
params->SetVal("rescue_member", stats.rescue_member);
|
||||
{
|
||||
int coin_num = (rank * MetaMgr::Instance()->rank_param) + (stats.kills * MetaMgr::Instance()->kill_param);
|
||||
params->SetVal("coin_num", coin_num);
|
||||
}
|
||||
params->SetVal("score", 0);
|
||||
delete params;
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ class Human : public Entity
|
||||
int sdmg = 0;
|
||||
bool poisoning = false;
|
||||
long long poisoning_time = 0;
|
||||
int lethal_weapon = 0;
|
||||
long long dead_frameno = 0;
|
||||
long long join_frameno = 0;
|
||||
int status = 0;
|
||||
@ -95,6 +96,7 @@ class Human : public Entity
|
||||
xtimer_list* downed_timer = nullptr;
|
||||
|
||||
std::set<Human*>* team_members = nullptr;
|
||||
std::set<Human*> kill_humans;
|
||||
|
||||
long long jump_frameno = 0;
|
||||
|
||||
@ -127,8 +129,8 @@ class Human : public Entity
|
||||
void CancelAction();
|
||||
void ResetAction();
|
||||
void FillSMGameOver(cs::SMGameOver& msg);
|
||||
void BeKill(int killer_id, const std::string& killer_name);
|
||||
void DecHP(float dec_hp, int killer_id, const std::string& killer_name);
|
||||
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
|
||||
void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id);
|
||||
void AddToNewObjects(Entity* entity);
|
||||
void AddToPartObjects(Entity* entity);
|
||||
void RemoveObjects(Entity* entity);
|
||||
|
@ -94,6 +94,8 @@ public:
|
||||
MetaMgr::Instance()->gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("gas_inactive_time");
|
||||
MetaMgr::Instance()->jump_time = MetaMgr::Instance()->GetSysParamAsFloat("jump_time");
|
||||
MetaMgr::Instance()->K = MetaMgr::Instance()->GetSysParamAsFloat("K");
|
||||
MetaMgr::Instance()->kill_param = MetaMgr::Instance()->GetSysParamAsFloat("kill_parameter");
|
||||
MetaMgr::Instance()->rank_param = MetaMgr::Instance()->GetSysParamAsFloat("rank_parameter");
|
||||
if (MetaMgr::Instance()->K < 0.01f) {
|
||||
abort();
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
int gas_inactive_time = 10;
|
||||
int jump_time = 10;
|
||||
float K = 100.0f;
|
||||
float kill_param = 0.0f;
|
||||
float rank_param = 0.0f;
|
||||
|
||||
private:
|
||||
MetaDataLoader* loader_ = nullptr;
|
||||
|
@ -304,6 +304,7 @@ void Player::UpdateAction()
|
||||
room->xtimer.DeleteTimer(hum->downed_timer);
|
||||
hum->downed_timer = nullptr;
|
||||
}
|
||||
++hum->stats.rescue_member;
|
||||
hum->SyncAroundPlayers();
|
||||
}
|
||||
}
|
||||
@ -374,7 +375,7 @@ void Player::UpdateSpectate()
|
||||
spectate = false;
|
||||
return;
|
||||
}
|
||||
BeKill(entity_uniid, name);
|
||||
BeKill(entity_uniid, name, VW_Spectate);
|
||||
spectate = false;
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,8 @@ void Room::OnHumanDie(Human* hum)
|
||||
if (distance <= hum->skill_meta->i->area()) {
|
||||
pair.second->DecHP(hum->skill_meta->i->value1(),
|
||||
hum->entity_uniid,
|
||||
hum->name);
|
||||
hum->name,
|
||||
VW_SelfDetonate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ struct PlayerStats
|
||||
int damage_amount_in = 0;
|
||||
int damage_amount_out = 0;
|
||||
int heal_amount = 0;
|
||||
int rescue_member = 0;
|
||||
|
||||
int history_time_alive = 0;
|
||||
int history_kills = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user