1
This commit is contained in:
parent
e1365f04b5
commit
21f2d814c5
@ -322,121 +322,6 @@ void Buff::ProcSputteringFunc(Bullet* bullet)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Buff::ProcIntervalRangeAddBuffFunc()
|
|
||||||
{
|
|
||||||
owner->room->xtimer.SetIntervalEx
|
|
||||||
(
|
|
||||||
meta->_param4 / FRAME_RATE_MS,
|
|
||||||
[this] (int event, const a8::Args* args)
|
|
||||||
{
|
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
|
||||||
owner->TraverseCreatures
|
|
||||||
(
|
|
||||||
[this] (Creature* c, bool& stop)
|
|
||||||
{
|
|
||||||
if (c->dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (owner->GetUniId() == c->GetUniId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!GetCaster().Get()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (GetCaster().Get()->team_id != c->team_id) {
|
|
||||||
if (owner->GetPos().Distance2D2(c->GetPos()) < meta->_param2) {
|
|
||||||
c->TryAddBuff(GetCaster().Get(), meta->_int_param3, skill_meta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
&xtimer_attacher
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Buff::InternalProcOnceChgAttr()
|
|
||||||
{
|
|
||||||
if (owner->dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (meta->_int_param1) {
|
|
||||||
case kHAT_Hp:
|
|
||||||
{
|
|
||||||
int real_killer_id = 0;
|
|
||||||
std::string real_killer_name;
|
|
||||||
if (caster_.Get()) {
|
|
||||||
real_killer_id = caster_.Get()->GetUniId();
|
|
||||||
real_killer_name = caster_.Get()->GetName();
|
|
||||||
}
|
|
||||||
if (meta->_int_param2 == 1) {
|
|
||||||
//绝对值
|
|
||||||
if (meta->_param3 > 0) {
|
|
||||||
owner->AddHp(meta->_param3);
|
|
||||||
} else if (meta->_param3 < 0) {
|
|
||||||
owner->over_delay_time = 100;
|
|
||||||
owner->DecHP(std::abs(meta->_param3),
|
|
||||||
VP_Buff,
|
|
||||||
"",
|
|
||||||
meta->buff_id(),
|
|
||||||
real_killer_id,
|
|
||||||
real_killer_name);
|
|
||||||
owner->over_delay_time = 0;
|
|
||||||
}
|
|
||||||
} else if (meta->_int_param2 == 2) {
|
|
||||||
//百分比
|
|
||||||
float chg_hp = owner->GetHP() * meta->_param3;
|
|
||||||
if (chg_hp > 0.0001f) {
|
|
||||||
owner->AddHp(chg_hp);
|
|
||||||
} else if (chg_hp < 0.0001f) {
|
|
||||||
owner->over_delay_time = 100;
|
|
||||||
owner->DecHP(std::abs(chg_hp),
|
|
||||||
VP_Buff,
|
|
||||||
"",
|
|
||||||
meta->buff_id(),
|
|
||||||
real_killer_id,
|
|
||||||
real_killer_name);
|
|
||||||
owner->over_delay_time = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
std::string dbg_msg = a8::Format
|
|
||||||
("buff扣血 type:%s val:%f",
|
|
||||||
{
|
|
||||||
meta->_int_param2,
|
|
||||||
meta->_int_param3,
|
|
||||||
});
|
|
||||||
owner->room->BroadcastDebugMsg(dbg_msg);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
owner->room->frame_event.AddHpChg(owner->GetWeakPtrRef());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case kHAT_SkillTime:
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (meta->int_param2 == 1) {
|
|
||||||
for (auto& pair : skill_hash_) {
|
|
||||||
pair.second->Accelerate(meta->int_param3);
|
|
||||||
}
|
|
||||||
} else if (meta->int_param2 == 2) {
|
|
||||||
for (auto& pair : skill_hash_) {
|
|
||||||
int time = pair.second->GetCd() * meta->param3;
|
|
||||||
pair.second->Accelerate(time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Buff::Activate()
|
void Buff::Activate()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -58,9 +58,7 @@ protected:
|
|||||||
void RecoverHoldWeapons();
|
void RecoverHoldWeapons();
|
||||||
|
|
||||||
void ProcSputteringFunc(Bullet* bullet);
|
void ProcSputteringFunc(Bullet* bullet);
|
||||||
void ProcIntervalRangeAddBuffFunc();
|
|
||||||
|
|
||||||
void InternalProcOnceChgAttr();
|
|
||||||
protected:
|
protected:
|
||||||
int hold_curr_weapon_idx_ = 0;
|
int hold_curr_weapon_idx_ = 0;
|
||||||
std::list<Weapon> hold_weapons_;
|
std::list<Weapon> hold_weapons_;
|
||||||
|
@ -50,3 +50,36 @@ void CallFuncBuff::Deactivate()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CallFuncBuff::ProcIntervalRangeAddBuffFunc()
|
||||||
|
{
|
||||||
|
owner->room->xtimer.SetIntervalEx
|
||||||
|
(
|
||||||
|
meta->_param4 / FRAME_RATE_MS,
|
||||||
|
[this] (int event, const a8::Args* args)
|
||||||
|
{
|
||||||
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
|
owner->TraverseCreatures
|
||||||
|
(
|
||||||
|
[this] (Creature* c, bool& stop)
|
||||||
|
{
|
||||||
|
if (c->dead) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (owner->GetUniId() == c->GetUniId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!GetCaster().Get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (GetCaster().Get()->team_id != c->team_id) {
|
||||||
|
if (owner->GetPos().Distance2D2(c->GetPos()) < meta->_param2) {
|
||||||
|
c->TryAddBuff(GetCaster().Get(), meta->_int_param3, skill_meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&xtimer_attacher
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -9,4 +9,6 @@ class CallFuncBuff : Buff
|
|||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
virtual void Deactivate() override;
|
virtual void Deactivate() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ProcIntervalRangeAddBuffFunc();
|
||||||
};
|
};
|
||||||
|
@ -11,3 +11,84 @@ void OnceChgAttrBuff::Deactivate()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnceChgAttrBuff::InternalProcOnceChgAttr()
|
||||||
|
{
|
||||||
|
if (owner->dead) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (meta->_int_param1) {
|
||||||
|
case kHAT_Hp:
|
||||||
|
{
|
||||||
|
int real_killer_id = 0;
|
||||||
|
std::string real_killer_name;
|
||||||
|
if (caster_.Get()) {
|
||||||
|
real_killer_id = caster_.Get()->GetUniId();
|
||||||
|
real_killer_name = caster_.Get()->GetName();
|
||||||
|
}
|
||||||
|
if (meta->_int_param2 == 1) {
|
||||||
|
//绝对值
|
||||||
|
if (meta->_param3 > 0) {
|
||||||
|
owner->AddHp(meta->_param3);
|
||||||
|
} else if (meta->_param3 < 0) {
|
||||||
|
owner->over_delay_time = 100;
|
||||||
|
owner->DecHP(std::abs(meta->_param3),
|
||||||
|
VP_Buff,
|
||||||
|
"",
|
||||||
|
meta->buff_id(),
|
||||||
|
real_killer_id,
|
||||||
|
real_killer_name);
|
||||||
|
owner->over_delay_time = 0;
|
||||||
|
}
|
||||||
|
} else if (meta->_int_param2 == 2) {
|
||||||
|
//百分比
|
||||||
|
float chg_hp = owner->GetHP() * meta->_param3;
|
||||||
|
if (chg_hp > 0.0001f) {
|
||||||
|
owner->AddHp(chg_hp);
|
||||||
|
} else if (chg_hp < 0.0001f) {
|
||||||
|
owner->over_delay_time = 100;
|
||||||
|
owner->DecHP(std::abs(chg_hp),
|
||||||
|
VP_Buff,
|
||||||
|
"",
|
||||||
|
meta->buff_id(),
|
||||||
|
real_killer_id,
|
||||||
|
real_killer_name);
|
||||||
|
owner->over_delay_time = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
{
|
||||||
|
std::string dbg_msg = a8::Format
|
||||||
|
("buff扣血 type:%s val:%f",
|
||||||
|
{
|
||||||
|
meta->_int_param2,
|
||||||
|
meta->_int_param3,
|
||||||
|
});
|
||||||
|
owner->room->BroadcastDebugMsg(dbg_msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
owner->room->frame_event.AddHpChg(owner->GetWeakPtrRef());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kHAT_SkillTime:
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
if (meta->int_param2 == 1) {
|
||||||
|
for (auto& pair : skill_hash_) {
|
||||||
|
pair.second->Accelerate(meta->int_param3);
|
||||||
|
}
|
||||||
|
} else if (meta->int_param2 == 2) {
|
||||||
|
for (auto& pair : skill_hash_) {
|
||||||
|
int time = pair.second->GetCd() * meta->param3;
|
||||||
|
pair.second->Accelerate(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -9,4 +9,6 @@ class OnceChgAttrBuff : Buff
|
|||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
virtual void Deactivate() override;
|
virtual void Deactivate() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void InternalProcOnceChgAttr();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user