add disable times
This commit is contained in:
parent
25d9ed524a
commit
1e06c5571b
@ -197,7 +197,7 @@ void Ability::Clear()
|
||||
}
|
||||
}
|
||||
|
||||
disable_times_ = {};
|
||||
switch_times_ = {};
|
||||
immune_tags_.clear();
|
||||
}
|
||||
|
||||
@ -871,28 +871,28 @@ std::vector<std::string> Ability::GMShowAttrs()
|
||||
return strings;
|
||||
}
|
||||
|
||||
void Ability::IncDisable(int type)
|
||||
void Ability::IncSwitch(int type)
|
||||
{
|
||||
if (type >= kDisableTimeBegin && type < kDisableTimeEnd) {
|
||||
++disable_times_[type];
|
||||
if (type >= kSwitchTimeBegin && type < kSwitchTimeEnd) {
|
||||
++switch_times_[type];
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void Ability::DecDisable(int type)
|
||||
void Ability::DecSwitch(int type)
|
||||
{
|
||||
if (type >= kDisableTimeBegin && type < kDisableTimeEnd) {
|
||||
--disable_times_[type];
|
||||
if (type >= kSwitchTimeBegin && type < kSwitchTimeEnd) {
|
||||
--switch_times_[type];
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int Ability::GetDisableTimes(int type)
|
||||
int Ability::GetSwitchTimes(int type)
|
||||
{
|
||||
if (type >= kDisableTimeBegin && type < kDisableTimeEnd) {
|
||||
return disable_times_[type];
|
||||
if (type >= kSwitchTimeBegin && type < kSwitchTimeEnd) {
|
||||
return switch_times_[type];
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "attrdefine.h"
|
||||
#include "weakptr.h"
|
||||
|
||||
@ -8,15 +7,6 @@ typedef std::weak_ptr<struct AttrRuducePtr> AttrRuduceHandle;
|
||||
typedef std::weak_ptr<struct AttrAbsPtr> AttrAbsHandle;
|
||||
typedef std::weak_ptr<struct AttrRatePtr> AttrRateHandle;
|
||||
|
||||
enum DisableTimesType_e
|
||||
{
|
||||
kDisableTimeBegin,
|
||||
kDisableShotTimes,
|
||||
kDisableUseSkillTimes,
|
||||
kDisableMoveEffectTimes,
|
||||
kDisableTimeEnd,
|
||||
};
|
||||
|
||||
class Ability
|
||||
{
|
||||
public:
|
||||
@ -26,9 +16,9 @@ class Ability
|
||||
void DecImmuneTimes(int tag);
|
||||
bool CanImmune(int tag);
|
||||
bool CanImmune(const std::set<int>& tags);
|
||||
void IncDisable(int type);
|
||||
void DecDisable(int type);
|
||||
int GetDisableTimes(int type);
|
||||
void IncSwitch(int type);
|
||||
void DecSwitch(int type);
|
||||
int GetSwitchTimes(int type);
|
||||
|
||||
AttrAbsHandle AddAttrAbs(int attr_id, float value);
|
||||
void RemoveAttrAbs(AttrAbsHandle handle);
|
||||
@ -63,7 +53,7 @@ private:
|
||||
std::array<std::tuple<float, list_head>, kHAT_End> attr_dec_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHVAT_End - kHVAT_Begin> vattr_add_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHVAT_End - kHVAT_Begin> vattr_dec_ = {};
|
||||
std::array<int, kDisableTimeEnd> disable_times_ = {};
|
||||
std::array<int, kSwitchTimeEnd> switch_times_ = {};
|
||||
std::map<int, int> immune_tags_;
|
||||
|
||||
friend class PBUtils;
|
||||
|
@ -117,12 +117,12 @@ void CallFuncBuff::Activate()
|
||||
break;
|
||||
case BuffCallFunc_e::kImmuneAllMove:
|
||||
{
|
||||
owner->GetAbility()->IncDisable(kDisableMoveEffectTimes);
|
||||
owner->GetAbility()->IncSwitch(kDisableMoveEffectTimes);
|
||||
}
|
||||
break;
|
||||
case BuffCallFunc_e::kDmgForward:
|
||||
{
|
||||
DmgForward();
|
||||
owner->GetAbility()->IncSwitch(kEnableDmgForwardTimes);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -150,7 +150,12 @@ void CallFuncBuff::Deactivate()
|
||||
break;
|
||||
case BuffCallFunc_e::kImmuneAllMove:
|
||||
{
|
||||
owner->GetAbility()->DecDisable(kDisableMoveEffectTimes);
|
||||
owner->GetAbility()->DecSwitch(kDisableMoveEffectTimes);
|
||||
}
|
||||
break;
|
||||
case BuffCallFunc_e::kDmgForward:
|
||||
{
|
||||
owner->GetAbility()->DecSwitch(kEnableDmgForwardTimes);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -598,20 +603,20 @@ void CallFuncBuff::ProcSyncProp()
|
||||
|
||||
void CallFuncBuff::SummonHeroSpecPoint()
|
||||
{
|
||||
|
||||
int hero_id = meta->_int_buff_param2;
|
||||
float x = meta->GetBuffParam3(this);
|
||||
float y = meta->GetBuffParam4(this);
|
||||
float z = meta->GetBuffParam5(this);
|
||||
}
|
||||
|
||||
void CallFuncBuff::SummonHeroSpecDistance()
|
||||
{
|
||||
|
||||
int hero_id = meta->_int_buff_param2;
|
||||
float distance = meta->GetBuffParam3(this);
|
||||
}
|
||||
|
||||
void CallFuncBuff::ClearSummonHero()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CallFuncBuff::DmgForward()
|
||||
{
|
||||
|
||||
int hero_id = meta->_int_buff_param2;
|
||||
float hero_num = meta->GetBuffParam3(this);
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ class CallFuncBuff : public Buff
|
||||
void SummonHeroSpecPoint();
|
||||
void SummonHeroSpecDistance();
|
||||
void ClearSummonHero();
|
||||
void DmgForward();
|
||||
|
||||
float hold_param2_ = 0.0;
|
||||
};
|
||||
|
@ -456,6 +456,16 @@ A8_DECLARE_ENUM(WorldObjectType_e,
|
||||
kBornPointType = 4
|
||||
);
|
||||
|
||||
enum SwitchTimesType_e
|
||||
{
|
||||
kSwitchTimeBegin,
|
||||
kDisableShotTimes,
|
||||
kDisableUseSkillTimes,
|
||||
kDisableMoveEffectTimes,
|
||||
kEnableDmgForwardTimes,
|
||||
kSwitchTimeEnd,
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -254,10 +254,10 @@ int Creature::AddBuff(Creature* caster,
|
||||
IncDisableMoveDirTimes();
|
||||
}
|
||||
if (buff->meta->disable_shot()) {
|
||||
GetAbility()->IncDisable(kDisableShotTimes);
|
||||
GetAbility()->IncSwitch(kDisableShotTimes);
|
||||
}
|
||||
if (buff->meta->disable_useskill()) {
|
||||
GetAbility()->IncDisable(kDisableUseSkillTimes);
|
||||
GetAbility()->IncSwitch(kDisableUseSkillTimes);
|
||||
}
|
||||
list_add_tail(&buff->effect_entry, &buff_effect_[buff->meta->buff_effect()]);
|
||||
if (buff->meta->depend_effect() != 0 &&
|
||||
@ -641,10 +641,10 @@ void Creature::OnBuffRemove(Buff& buff)
|
||||
DecDisableMoveDirTimes();
|
||||
}
|
||||
if (buff.meta->disable_shot()) {
|
||||
GetAbility()->DecDisable(kDisableShotTimes);
|
||||
GetAbility()->DecSwitch(kDisableShotTimes);
|
||||
}
|
||||
if (buff.meta->disable_useskill()) {
|
||||
GetAbility()->DecDisable(kDisableUseSkillTimes);
|
||||
GetAbility()->DecSwitch(kDisableUseSkillTimes);
|
||||
}
|
||||
buff.Deactivate();
|
||||
if (!buff.meta->only_server()) {
|
||||
@ -795,7 +795,7 @@ bool Creature::CanUseSkill(int skill_id)
|
||||
if (!skill) {
|
||||
return false;
|
||||
}
|
||||
if (GetAbility()->GetDisableTimes(kDisableUseSkillTimes) > 0) {
|
||||
if (GetAbility()->GetSwitchTimes(kDisableUseSkillTimes) > 0) {
|
||||
return false;
|
||||
}
|
||||
if (room->GetGasData().GetGasMode() == GasInactive &&
|
||||
@ -1249,7 +1249,7 @@ void Creature::Shot(glm::vec3& target_dir, bool& shot_ok, float fly_distance, in
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetAbility()->GetDisableTimes(kDisableShotTimes) > 0) {
|
||||
if (GetAbility()->GetSwitchTimes(kDisableShotTimes) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user