add disable times
This commit is contained in:
parent
a858b1a0da
commit
072b16eaf9
@ -197,6 +197,8 @@ void Ability::Clear()
|
||||
}
|
||||
}
|
||||
|
||||
disable_times_ = {};
|
||||
immune_tags_.clear();
|
||||
}
|
||||
|
||||
void Ability::IncImmuneTimes(int tag)
|
||||
@ -237,38 +239,6 @@ bool Ability::CanImmune(const std::set<int>& tags)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Ability::IncDisableShotTimes()
|
||||
{
|
||||
++disable_shot_times_;
|
||||
}
|
||||
|
||||
void Ability::DecDisableShotTimes()
|
||||
{
|
||||
--disable_shot_times_;
|
||||
disable_shot_times_ = std::max(0, disable_shot_times_);
|
||||
}
|
||||
|
||||
int Ability::GetDisableShotTimes()
|
||||
{
|
||||
return disable_shot_times_;
|
||||
}
|
||||
|
||||
void Ability::IncDisableUseSkillTimes()
|
||||
{
|
||||
++disable_useskill_times_;
|
||||
}
|
||||
|
||||
void Ability::DecDisableUseSkillTimes()
|
||||
{
|
||||
--disable_useskill_times_;
|
||||
disable_useskill_times_ = std::max(0, disable_useskill_times_);
|
||||
}
|
||||
|
||||
int Ability::GetDisableUseSkillTimes()
|
||||
{
|
||||
return disable_useskill_times_;
|
||||
}
|
||||
|
||||
AttrAbsHandle Ability::AddAttrAbs(int attr_id, float value)
|
||||
{
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
@ -900,3 +870,31 @@ std::vector<std::string> Ability::GMShowAttrs()
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
void Ability::IncDisable(int type)
|
||||
{
|
||||
if (type >= kDisableTimeBegin && type < kDisableTimeEnd) {
|
||||
++disable_times_[type];
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void Ability::DecDisable(int type)
|
||||
{
|
||||
if (type >= kDisableTimeBegin && type < kDisableTimeEnd) {
|
||||
--disable_times_[type];
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int Ability::GetDisableTimes(int type)
|
||||
{
|
||||
if (type >= kDisableTimeBegin && type < kDisableTimeEnd) {
|
||||
return disable_times_[type];
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,6 +8,15 @@ 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:
|
||||
@ -17,12 +26,9 @@ class Ability
|
||||
void DecImmuneTimes(int tag);
|
||||
bool CanImmune(int tag);
|
||||
bool CanImmune(const std::set<int>& tags);
|
||||
void IncDisableShotTimes();
|
||||
void DecDisableShotTimes();
|
||||
int GetDisableShotTimes();
|
||||
void IncDisableUseSkillTimes();
|
||||
void DecDisableUseSkillTimes();
|
||||
int GetDisableUseSkillTimes();
|
||||
void IncDisable(int type);
|
||||
void DecDisable(int type);
|
||||
int GetDisableTimes(int type);
|
||||
|
||||
AttrAbsHandle AddAttrAbs(int attr_id, float value);
|
||||
void RemoveAttrAbs(AttrAbsHandle handle);
|
||||
@ -57,9 +63,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_ = {};
|
||||
|
||||
int disable_shot_times_ = 0;
|
||||
int disable_useskill_times_ = 0;
|
||||
std::array<int, kDisableTimeEnd> disable_times_ = {};
|
||||
std::map<int, int> immune_tags_;
|
||||
|
||||
friend class PBUtils;
|
||||
|
@ -565,3 +565,28 @@ void CallFuncBuff::ProcSyncProp()
|
||||
value,
|
||||
only_self > 0);
|
||||
}
|
||||
|
||||
void CallFuncBuff::SummonHeroSpecPoint()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CallFuncBuff::SummonHeroSpecDistance()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CallFuncBuff::ClearSummonHero()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CallFuncBuff::ImmuneAllMove()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CallFuncBuff::DmgForward()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,12 @@ A8_DECLARE_CLASS_ENUM(BuffCallFunc_e, int,
|
||||
kFlashMoveToPos = 12,
|
||||
kLightCircle = 13,
|
||||
kSyncProp = 16,
|
||||
kSetBulletBornOffset = 17
|
||||
kSetBulletBornOffset = 17,
|
||||
kSummonHeroSepcPoint = 18,
|
||||
kSummonHeroSpecDistance = 19,
|
||||
kClearSummonHero = 20,
|
||||
kImmuneAllMove = 21,
|
||||
kDmgForward = 22
|
||||
);
|
||||
|
||||
|
||||
@ -36,6 +41,11 @@ class CallFuncBuff : public Buff
|
||||
void ProcFlashMoveToPos();
|
||||
void ProcLightCircle();
|
||||
void ProcSyncProp();
|
||||
void SummonHeroSpecPoint();
|
||||
void SummonHeroSpecDistance();
|
||||
void ClearSummonHero();
|
||||
void ImmuneAllMove();
|
||||
void DmgForward();
|
||||
|
||||
float hold_param2_ = 0.0;
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ A8_DECLARE_ENUM(BuffEffectType_e,
|
||||
kBET_Begin = 0,
|
||||
kBET_SummonLoot = 1,
|
||||
kBET_TurnOver = 2, //翻滚
|
||||
kBET_UnUse3 = 3,
|
||||
kBET_Building = 3,
|
||||
kBET_Invincible = 4, //无敌
|
||||
kBET_Camouflage = 5, //伪装
|
||||
kBET_Immune = 6, //免疫
|
||||
|
@ -254,10 +254,10 @@ int Creature::AddBuff(Creature* caster,
|
||||
IncDisableMoveDirTimes();
|
||||
}
|
||||
if (buff->meta->disable_shot()) {
|
||||
GetAbility()->IncDisableShotTimes();
|
||||
GetAbility()->IncDisable(kDisableShotTimes);
|
||||
}
|
||||
if (buff->meta->disable_useskill()) {
|
||||
GetAbility()->IncDisableUseSkillTimes();
|
||||
GetAbility()->IncDisable(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()->DecDisableShotTimes();
|
||||
GetAbility()->DecDisable(kDisableShotTimes);
|
||||
}
|
||||
if (buff.meta->disable_useskill()) {
|
||||
GetAbility()->DecDisableUseSkillTimes();
|
||||
GetAbility()->DecDisable(kDisableUseSkillTimes);
|
||||
}
|
||||
buff.Deactivate();
|
||||
if (!buff.meta->only_server()) {
|
||||
@ -795,7 +795,7 @@ bool Creature::CanUseSkill(int skill_id)
|
||||
if (!skill) {
|
||||
return false;
|
||||
}
|
||||
if (GetAbility()->GetDisableUseSkillTimes() > 0) {
|
||||
if (GetAbility()->GetDisableTimes(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()->GetDisableShotTimes() > 0) {
|
||||
if (GetAbility()->GetDisableTimes(kDisableShotTimes) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1668,7 +1668,6 @@ void Creature::SummonHero(Buff* buff,
|
||||
const glm::vec3& dir
|
||||
)
|
||||
{
|
||||
#if 1
|
||||
const mt::Hero* hero_meta = mt::Hero::GetById(buff->meta->_int_buff_param1);
|
||||
if (hero_meta) {
|
||||
int life_time = 10000;
|
||||
@ -1681,54 +1680,6 @@ void Creature::SummonHero(Buff* buff,
|
||||
1,
|
||||
life_time);
|
||||
}
|
||||
#else
|
||||
for (auto& info : buff->meta->_hero_infos) {
|
||||
int through_wall = std::get<0>(info);
|
||||
float x = std::get<1>(info);
|
||||
float y = std::get<2>(info) ;
|
||||
int hero_id = std::get<3>(info);
|
||||
int num = std::get<4>(info);
|
||||
int life_time = std::get<5>(info);
|
||||
const mt::Hero* hero_meta = mt::Hero::GetById(hero_id);
|
||||
if (hero_meta) {
|
||||
for (int j = 0; j < num; ++j) {
|
||||
bool can_create = false;
|
||||
Position born_pos;
|
||||
Hero* hero = nullptr;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
glm::vec3 born_dir = dir;
|
||||
glm::vec3 born_offset(x, 0, y);
|
||||
GlmHelper::RotateY(born_offset, i * 0.5);
|
||||
born_pos = GetPos();
|
||||
born_pos.AddGlmVec3(born_offset);
|
||||
can_create = TrySummonHero(hero_meta,
|
||||
dir,
|
||||
born_pos,
|
||||
through_wall);
|
||||
if (can_create) {
|
||||
break;
|
||||
}
|
||||
}//end for i
|
||||
if (!can_create) {
|
||||
born_pos = GetPos();
|
||||
can_create = TrySummonHero(hero_meta,
|
||||
GetAttackDir(),
|
||||
born_pos,
|
||||
through_wall);
|
||||
}
|
||||
if (can_create) {
|
||||
InternalSummonHero(buff,
|
||||
hero_meta,
|
||||
GetAttackDir(),
|
||||
born_pos,
|
||||
through_wall,
|
||||
num,
|
||||
life_time);
|
||||
}
|
||||
}//end for j
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Creature::FreezeOperate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user