完成灼烧buff
This commit is contained in:
parent
1f04049994
commit
912bd0593a
@ -189,11 +189,13 @@ enum BuffEffectType_e
|
|||||||
BET_Begin = 0,
|
BET_Begin = 0,
|
||||||
BET_ChgAttr = 1, //改变属性
|
BET_ChgAttr = 1, //改变属性
|
||||||
BET_Vertigo = 2, //眩晕
|
BET_Vertigo = 2, //眩晕
|
||||||
BET_LastDmg = 3, //持续伤害
|
BET_Unuse = 3, //
|
||||||
BET_LastBurn = 4, //持续灼烧
|
BET_LastBurn = 4, //持续灼烧
|
||||||
BET_Invincible = 5, //无敌
|
BET_Invincible = 5, //无敌
|
||||||
BET_Hide = 6, //隐身
|
BET_Hide = 6, //隐身
|
||||||
BET_Dcgr = 7, //电磁干扰
|
BET_Dcgr = 7, //电磁干扰
|
||||||
|
BET_ReleaseDcgr = 8, //释放电磁干扰
|
||||||
|
BET_ReleaseFireBomb = 9, //释放燃烧弹
|
||||||
BET_End
|
BET_End
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,6 +208,20 @@ enum SkillFunc_e
|
|||||||
Skill_FuncEnd
|
Skill_FuncEnd
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum HumanAttrType_e
|
||||||
|
{
|
||||||
|
HAT_Begin = 0,
|
||||||
|
HAT_Hp = 1,
|
||||||
|
HAT_HPRecover = 2,
|
||||||
|
HAT_Atk = 3,
|
||||||
|
HAT_Def = 4,
|
||||||
|
HAT_Speed = 5,
|
||||||
|
HAT_ShotRange = 6,
|
||||||
|
HAT_ShotSpeed = 7,
|
||||||
|
HAT_ReloadSpeed = 8,
|
||||||
|
HAT_End
|
||||||
|
};
|
||||||
|
|
||||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||||
|
|
||||||
|
@ -53,3 +53,8 @@ bool IsValidBuffEffect(int buff_effect)
|
|||||||
{
|
{
|
||||||
return buff_effect > BET_Begin && buff_effect < BET_End;
|
return buff_effect > BET_Begin && buff_effect < BET_End;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsValidHumanAttr(int attr_type)
|
||||||
|
{
|
||||||
|
return attr_type > HAT_Begin && attr_type < HAT_End;
|
||||||
|
}
|
||||||
|
@ -24,3 +24,4 @@ class Global : public a8::Singleton<Global>
|
|||||||
bool IsValidSlotId(int slot_id);
|
bool IsValidSlotId(int slot_id);
|
||||||
SkillFunc_e Str2SkillFunc(const std::string& func_str);
|
SkillFunc_e Str2SkillFunc(const std::string& func_str);
|
||||||
bool IsValidBuffEffect(int buff_effect);
|
bool IsValidBuffEffect(int buff_effect);
|
||||||
|
bool IsValidHumanAttr(int attr_type);
|
||||||
|
@ -66,19 +66,22 @@ void Human::Initialize()
|
|||||||
|
|
||||||
float Human::GetSpeed()
|
float Human::GetSpeed()
|
||||||
{
|
{
|
||||||
|
float speed = 0.0f;
|
||||||
if (downed) {
|
if (downed) {
|
||||||
return meta->i->move_speed3() + ability.speed;
|
speed = meta->i->move_speed3() + ability.speed;
|
||||||
} else {
|
} else {
|
||||||
|
speed = meta->i->move_speed() + ability.speed;
|
||||||
if (shot_hold) {
|
if (shot_hold) {
|
||||||
if (curr_weapon->weapon_idx == GUN_SLOT1 ||
|
if (curr_weapon->weapon_idx == GUN_SLOT1 ||
|
||||||
curr_weapon->weapon_idx == GUN_SLOT2) {
|
curr_weapon->weapon_idx == GUN_SLOT2) {
|
||||||
if (action_type != AT_Reload) {
|
if (action_type != AT_Reload) {
|
||||||
return meta->i->shot_speed();
|
speed = meta->i->shot_speed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return meta->i->move_speed() + ability.speed;
|
|
||||||
}
|
}
|
||||||
|
speed = (speed + buff_attr_abs_[HAT_Speed]) * (1 + buff_attr_rate_[HAT_Speed]);
|
||||||
|
return std::min(speed, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Human::GetSpeed4()
|
float Human::GetSpeed4()
|
||||||
@ -581,6 +584,9 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
last_attacker_id = killer_id;
|
||||||
|
last_attacker_name = killer_name;
|
||||||
|
last_attacker_weapon_id = weapon_id;
|
||||||
SyncAroundPlayers();
|
SyncAroundPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1368,6 +1374,7 @@ void Human::AddBuff(MetaData::Buff* buff_meta)
|
|||||||
&buff->xtimer_attacher.timer_list_
|
&buff->xtimer_attacher.timer_list_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
ProcBuffEffect(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::RemoveBuff(int buff_id)
|
void Human::RemoveBuff(int buff_id)
|
||||||
@ -1389,6 +1396,60 @@ bool Human::HasBuffEffect(int buff_effect_id)
|
|||||||
return GetBuffByEffectId(buff_effect_id) != nullptr;
|
return GetBuffByEffectId(buff_effect_id) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::RecalcBuffAttr()
|
||||||
|
{
|
||||||
|
buff_attr_abs_ = {};
|
||||||
|
buff_attr_rate_ = {};
|
||||||
|
for (auto& buff : buff_list_) {
|
||||||
|
if (buff.meta->i->buff_effect() == BET_ChgAttr) {
|
||||||
|
int attr_type = (int)buff.meta->param1;
|
||||||
|
int calc_type = (int)buff.meta->param2;
|
||||||
|
if (IsValidHumanAttr(attr_type)) {
|
||||||
|
if (calc_type == 1) {
|
||||||
|
buff_attr_abs_[attr_type] += buff.meta->param3;
|
||||||
|
} else if (calc_type == 2) {
|
||||||
|
buff_attr_rate_[attr_type] += buff.meta->param3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Human::ProcBuffEffect(Buff* buff)
|
||||||
|
{
|
||||||
|
switch (buff->meta->i->buff_effect()) {
|
||||||
|
case BET_ChgAttr:
|
||||||
|
{
|
||||||
|
RecalcBuffAttr();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BET_LastBurn:
|
||||||
|
{
|
||||||
|
room->xtimer.AddRepeatTimerAndAttach(
|
||||||
|
SERVER_FRAME_RATE,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(this)
|
||||||
|
.SetParam1(buff),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Human* hum = (Human*)param.sender.GetUserData();
|
||||||
|
Buff* buff = (Buff*)param.param1.GetUserData();
|
||||||
|
if (!hum->dead) {
|
||||||
|
hum->DecHP(buff->meta->param1,
|
||||||
|
hum->last_attacker_id,
|
||||||
|
hum->last_attacker_name,
|
||||||
|
hum->last_attacker_weapon_id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&buff->xtimer_attacher.timer_list_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Human::_UpdateMove(int speed)
|
void Human::_UpdateMove(int speed)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < speed; ++i) {
|
for (int i = 0; i < speed; ++i) {
|
||||||
|
@ -50,6 +50,9 @@ class Human : public Entity
|
|||||||
MetaData::Tank* skin_jlf_meta = nullptr;
|
MetaData::Tank* skin_jlf_meta = nullptr;
|
||||||
HumanAbility ability;
|
HumanAbility ability;
|
||||||
int born_point = 0;
|
int born_point = 0;
|
||||||
|
int last_attacker_id = 0;
|
||||||
|
std::string last_attacker_name;
|
||||||
|
int last_attacker_weapon_id = 0;
|
||||||
|
|
||||||
a8::Vec2 move_dir;
|
a8::Vec2 move_dir;
|
||||||
a8::Vec2 attack_dir;
|
a8::Vec2 attack_dir;
|
||||||
@ -202,6 +205,9 @@ class Human : public Entity
|
|||||||
void AddBuff(MetaData::Buff* buff_meta);
|
void AddBuff(MetaData::Buff* buff_meta);
|
||||||
void RemoveBuff(int buff_id);
|
void RemoveBuff(int buff_id);
|
||||||
bool HasBuffEffect(int buff_effect_id);
|
bool HasBuffEffect(int buff_effect_id);
|
||||||
|
Buff* GetBuffByEffectId(int effect_id);
|
||||||
|
void RecalcBuffAttr();
|
||||||
|
void ProcBuffEffect(Buff* buff);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _UpdateMove(int speed);
|
void _UpdateMove(int speed);
|
||||||
@ -212,7 +218,6 @@ private:
|
|||||||
void Revive();
|
void Revive();
|
||||||
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
|
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
|
||||||
Buff* GetBuffById(int buff_id);
|
Buff* GetBuffById(int buff_id);
|
||||||
Buff* GetBuffByEffectId(int effect_id);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
long long last_shot_frameno_ = 0;
|
long long last_shot_frameno_ = 0;
|
||||||
@ -253,6 +258,9 @@ private:
|
|||||||
std::list<Buff> buff_list_;
|
std::list<Buff> buff_list_;
|
||||||
std::array<Buff*, BET_End> buff_effect_ = {};
|
std::array<Buff*, BET_End> buff_effect_ = {};
|
||||||
|
|
||||||
|
std::array<float, HAT_End> buff_attr_abs_ = {};
|
||||||
|
std::array<float, HAT_End> buff_attr_rate_ = {};
|
||||||
|
|
||||||
bool already_report_battle_ = false;
|
bool already_report_battle_ = false;
|
||||||
bool sent_game_end_ = false;
|
bool sent_game_end_ = false;
|
||||||
|
|
||||||
|
@ -414,6 +414,9 @@ namespace MetaData
|
|||||||
|
|
||||||
void Buff::Init()
|
void Buff::Init()
|
||||||
{
|
{
|
||||||
|
param1 = a8::XValue(i->buff_param1()).GetDouble();
|
||||||
|
param2 = a8::XValue(i->buff_param2()).GetDouble();
|
||||||
|
param3 = a8::XValue(i->buff_param3()).GetDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Buff::EffectCanStack()
|
bool Buff::EffectCanStack()
|
||||||
|
@ -132,6 +132,10 @@ namespace MetaData
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
bool EffectCanStack();
|
bool EffectCanStack();
|
||||||
|
|
||||||
|
float param1 = 0.0f;
|
||||||
|
float param2 = 0.0f;
|
||||||
|
float param3 = 0.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SkillPhase
|
struct SkillPhase
|
||||||
|
Loading…
x
Reference in New Issue
Block a user