1
This commit is contained in:
parent
b8b357410c
commit
c5bb28dc12
@ -216,26 +216,6 @@ int Ability::GetDefAdditionTimes()
|
|||||||
return def_addition_times_;
|
return def_addition_times_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ability::IncImmuneVertigo()
|
|
||||||
{
|
|
||||||
++immune_vertigo_times_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ability::DecImmuneVertigo()
|
|
||||||
{
|
|
||||||
--immune_vertigo_times_;
|
|
||||||
#ifdef DEBUG
|
|
||||||
if (immune_vertigo_times_ < 0) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int Ability::GetImmuneVertigoTimes()
|
|
||||||
{
|
|
||||||
return immune_vertigo_times_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ability::AddAtkAddition(float rate)
|
void Ability::AddAtkAddition(float rate)
|
||||||
{
|
{
|
||||||
atk_addition_rate_ += rate;
|
atk_addition_rate_ += rate;
|
||||||
@ -263,3 +243,41 @@ int Ability::GetAtkAdditionTimes()
|
|||||||
{
|
{
|
||||||
return atk_addition_times_;
|
return atk_addition_times_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ability::IncImmuneTimes(int tag)
|
||||||
|
{
|
||||||
|
auto itr = immune_tags_.find(tag);
|
||||||
|
if (itr != immune_tags_.end()) {
|
||||||
|
--itr->second;
|
||||||
|
if (itr->second <= 0) {
|
||||||
|
immune_tags_.erase(itr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ability::DecImmuneTimes(int tag)
|
||||||
|
{
|
||||||
|
auto itr = immune_tags_.find(tag);
|
||||||
|
if (itr != immune_tags_.end()) {
|
||||||
|
++itr->second;
|
||||||
|
} else {
|
||||||
|
immune_tags_[tag] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Ability::CanImmune(int tag)
|
||||||
|
{
|
||||||
|
return immune_tags_.find(tag) != immune_tags_.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Ability::CanImmune(const std::set<int>& tags)
|
||||||
|
{
|
||||||
|
if (!immune_tags_.empty()) {
|
||||||
|
for (int tag : tags) {
|
||||||
|
if (CanImmune(tag)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -41,9 +41,10 @@ class Ability
|
|||||||
float GetAtkAddition();
|
float GetAtkAddition();
|
||||||
int GetAtkAdditionTimes();
|
int GetAtkAdditionTimes();
|
||||||
|
|
||||||
void IncImmuneVertigo();
|
void IncImmuneTimes(int tag);
|
||||||
void DecImmuneVertigo();
|
void DecImmuneTimes(int tag);
|
||||||
int GetImmuneVertigoTimes();
|
bool CanImmune(int tag);
|
||||||
|
bool CanImmune(const std::set<int>& tags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<float, kHAT_End> buff_attr_abs_ = {};
|
std::array<float, kHAT_End> buff_attr_abs_ = {};
|
||||||
@ -65,6 +66,6 @@ class Ability
|
|||||||
int atk_addition_times_ = 0;
|
int atk_addition_times_ = 0;
|
||||||
float atk_addition_rate_ = 0;
|
float atk_addition_rate_ = 0;
|
||||||
|
|
||||||
int immune_vertigo_times_ = 0;
|
std::map<int, int> immune_tags_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1241,3 +1241,17 @@ void Buff::ProcRemoveRescuer()
|
|||||||
owner->GetTrigger()->EndRescue(target);
|
owner->GetTrigger()->EndRescue(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Buff::ProcImmune()
|
||||||
|
{
|
||||||
|
for (int tag : meta->param1_int_list) {
|
||||||
|
owner->GetAbility()->IncImmuneTimes(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Buff::ProcRemoveImmune()
|
||||||
|
{
|
||||||
|
for (int tag : meta->param1_int_list) {
|
||||||
|
owner->GetAbility()->DecImmuneTimes(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -87,6 +87,8 @@ class Buff
|
|||||||
void ProcRemoveHide();
|
void ProcRemoveHide();
|
||||||
void ProcRescuer();
|
void ProcRescuer();
|
||||||
void ProcRemoveRescuer();
|
void ProcRemoveRescuer();
|
||||||
|
void ProcImmune();
|
||||||
|
void ProcRemoveImmune();
|
||||||
|
|
||||||
void CalcPassengerShotOffset();
|
void CalcPassengerShotOffset();
|
||||||
|
|
||||||
|
@ -919,28 +919,10 @@ void Bullet::TriggerHitBuff(Entity* e)
|
|||||||
if (!e->IsDead(room) && e->IsCreature(room)) {
|
if (!e->IsDead(room) && e->IsCreature(room)) {
|
||||||
Creature* c = (Creature*)e;
|
Creature* c = (Creature*)e;
|
||||||
for (int buff_id : gun_meta->hit_buff_list) {
|
for (int buff_id : gun_meta->hit_buff_list) {
|
||||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
|
||||||
if (buff_meta) {
|
int buff_uniid = c->TryAddBuff(
|
||||||
if (c->GetAbility()->GetImmuneVertigoTimes() > 0 &&
|
|
||||||
buff_meta->i->buff_effect() == kBET_Vertigo) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
std::string dbg_msg = a8::Format
|
|
||||||
(
|
|
||||||
"免疫眩晕 target_uniid:%d ImmuneVertigoTimes:%d",
|
|
||||||
{
|
|
||||||
c->GetUniId(),
|
|
||||||
c->GetAbility()->GetImmuneVertigoTimes()
|
|
||||||
});
|
|
||||||
sender.Get()->SendDebugMsg(dbg_msg);
|
|
||||||
a8::XPrintf("%s\n", {dbg_msg});
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int buff_uniid = c->AddBuff(
|
|
||||||
sender.Get(),
|
sender.Get(),
|
||||||
buff_meta,
|
buff_id,
|
||||||
skill_meta
|
skill_meta
|
||||||
);
|
);
|
||||||
if (skill_meta && buff_uniid) {
|
if (skill_meta && buff_uniid) {
|
||||||
@ -949,7 +931,6 @@ void Bullet::TriggerHitBuff(Entity* e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool Bullet::IsFlyHook()
|
bool Bullet::IsFlyHook()
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@ const int kPeaceModeBuffId = 7019;
|
|||||||
const int kInRescueBuffId = 7020;
|
const int kInRescueBuffId = 7020;
|
||||||
const int kKeepShotAnimiBuffId = 7021;
|
const int kKeepShotAnimiBuffId = 7021;
|
||||||
const int kVertigoEffectBuffId = 7022;
|
const int kVertigoEffectBuffId = 7022;
|
||||||
|
const int kDispelEffectBuffId = 7023;
|
||||||
const int kPullToWalkableBuffId = 8003;
|
const int kPullToWalkableBuffId = 8003;
|
||||||
const int kDiveBuffId = 8054;
|
const int kDiveBuffId = 8054;
|
||||||
const int kInvincibleBuffId = 1005;
|
const int kInvincibleBuffId = 1005;
|
||||||
@ -32,7 +33,7 @@ enum BuffEffectType_e
|
|||||||
kBET_Car = 3, //骑乘
|
kBET_Car = 3, //骑乘
|
||||||
kBET_Invincible = 4, //无敌
|
kBET_Invincible = 4, //无敌
|
||||||
kBET_Camouflage = 5, //伪装
|
kBET_Camouflage = 5, //伪装
|
||||||
kBET_AdPlaying = 6, //看广告中
|
kBET_Immune = 6, //免疫
|
||||||
kBET_LordMode = 7, //上帝模式
|
kBET_LordMode = 7, //上帝模式
|
||||||
kBET_NewProtect = 8, //新手保护血量低于50%
|
kBET_NewProtect = 8, //新手保护血量低于50%
|
||||||
kBET_BePull = 9, //拉人(被拉方)
|
kBET_BePull = 9, //拉人(被拉方)
|
||||||
|
@ -119,6 +119,9 @@ int Creature::AddBuff(Creature* caster,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!buff_meta->tags.empty() && GetAbility()->CanImmune(buff_meta->tags)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (buff_meta->i->buff_interval() > 0) {
|
if (buff_meta->i->buff_interval() > 0) {
|
||||||
if (buff_interval_hash_.find(buff_meta->i->buff_id()) != buff_interval_hash_.end()) {
|
if (buff_interval_hash_.find(buff_meta->i->buff_id()) != buff_interval_hash_.end()) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -527,6 +530,11 @@ void Creature::OnBuffRemove(Buff& buff)
|
|||||||
buff.ProcRemoveRescuer();
|
buff.ProcRemoveRescuer();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kBET_Immune:
|
||||||
|
{
|
||||||
|
buff.ProcRemoveImmune();
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1245,6 +1253,11 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
|
|||||||
buff->ProcRescuer();
|
buff->ProcRescuer();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kBET_Immune:
|
||||||
|
{
|
||||||
|
buff->ProcImmune();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case kBET_SummonObstacle:
|
case kBET_SummonObstacle:
|
||||||
{
|
{
|
||||||
if (!dead || buff->meta->i->dead_valid() != 0) {
|
if (!dead || buff->meta->i->dead_valid() != 0) {
|
||||||
@ -2354,7 +2367,6 @@ bool Creature::IsInvincible()
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
HasBuffEffect(kBET_Invincible) ||
|
HasBuffEffect(kBET_Invincible) ||
|
||||||
HasBuffEffect(kBET_AdPlaying) ||
|
|
||||||
HasBuffEffect(kBET_Driver) ||
|
HasBuffEffect(kBET_Driver) ||
|
||||||
HasBuffEffect(kBET_Passenger)
|
HasBuffEffect(kBET_Passenger)
|
||||||
;
|
;
|
||||||
|
@ -743,6 +743,7 @@ void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
|||||||
|
|
||||||
void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
||||||
{
|
{
|
||||||
|
long long pre_frameno = last_cmmove_frameno_;
|
||||||
last_cmmove_frameno_ = room->GetFrameNo();
|
last_cmmove_frameno_ = room->GetFrameNo();
|
||||||
moving = false;
|
moving = false;
|
||||||
if (msg.has_move_dir()) {
|
if (msg.has_move_dir()) {
|
||||||
@ -808,9 +809,13 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if 1
|
||||||
|
moved_frames = 0;
|
||||||
|
#else
|
||||||
if (moving) {
|
if (moving) {
|
||||||
moved_frames = 0;
|
moved_frames = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//前一个状态是纯点射
|
//前一个状态是纯点射
|
||||||
if (shot_start && !shot_hold) {
|
if (shot_start && !shot_hold) {
|
||||||
|
|
||||||
@ -902,6 +907,16 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
}
|
}
|
||||||
last_cmmove_frameno = room->GetFrameNo();
|
last_cmmove_frameno = room->GetFrameNo();
|
||||||
trace_target_uniid = msg.trace_target_uniid();
|
trace_target_uniid = msg.trace_target_uniid();
|
||||||
|
#ifdef DEBUG1
|
||||||
|
a8::XPrintf("move_dir:%f %f frameno:%d %d moving:%d\n",
|
||||||
|
{
|
||||||
|
msg.move_dir().x(),
|
||||||
|
msg.move_dir().y(),
|
||||||
|
pre_frameno,
|
||||||
|
room->GetFrameNo(),
|
||||||
|
moving ? 1 : 0
|
||||||
|
});
|
||||||
|
#endif
|
||||||
#ifdef DEBUG1
|
#ifdef DEBUG1
|
||||||
if (msg.has_drop_weapon()) {
|
if (msg.has_drop_weapon()) {
|
||||||
SendDebugMsg(a8::Format("zzzzzzzz frameno:%d drop_weapon:%d", {room->GetFrameNo(), msg.drop_weapon()}));
|
SendDebugMsg(a8::Format("zzzzzzzz frameno:%d drop_weapon:%d", {room->GetFrameNo(), msg.drop_weapon()}));
|
||||||
|
@ -310,7 +310,8 @@ void Skill::ProcSJXY()
|
|||||||
bool is_immune = false;
|
bool is_immune = false;
|
||||||
if (shot_times % meta->number_meta->int_ratio == 0) {
|
if (shot_times % meta->number_meta->int_ratio == 0) {
|
||||||
if ((rnd % 100) < meta->number_meta->float_probability * 100) {
|
if ((rnd % 100) < meta->number_meta->float_probability * 100) {
|
||||||
if (target->GetAbility()->GetImmuneVertigoTimes() > 0) {
|
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(kVertigoEffectBuffId);
|
||||||
|
if (buff_meta && target->GetAbility()->CanImmune(buff_meta->tags)) {
|
||||||
is_immune = true;
|
is_immune = true;
|
||||||
} else {
|
} else {
|
||||||
auto itr = hited_objs.find(target->GetUniId());
|
auto itr = hited_objs.find(target->GetUniId());
|
||||||
@ -500,15 +501,10 @@ void Skill::ProcSWZB()
|
|||||||
}
|
}
|
||||||
int buff_id = SkillHelper::GetSwzbBuffId(skill_meta);
|
int buff_id = SkillHelper::GetSwzbBuffId(skill_meta);
|
||||||
float buff_time = SkillHelper::GetSwzbBuffTime(skill_meta);
|
float buff_time = SkillHelper::GetSwzbBuffTime(skill_meta);
|
||||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
|
||||||
if (c->GetAbility()->GetImmuneVertigoTimes() > 0 &&
|
|
||||||
buff_meta->i->buff_effect() == kBET_Vertigo) {
|
|
||||||
} else {
|
|
||||||
c->TryAddBuffAndSetTime(sender.Get(), buff_id, buff_time);
|
c->TryAddBuffAndSetTime(sender.Get(), buff_id, buff_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
e->EnemyAndObstacleAttack
|
e->EnemyAndObstacleAttack
|
||||||
(
|
(
|
||||||
@ -577,14 +573,12 @@ void Skill::ProcCMXD()
|
|||||||
dir * SkillHelper::GetCmxdDistance(skill_meta);
|
dir * SkillHelper::GetCmxdDistance(skill_meta);
|
||||||
c->PullTarget(target_pos);
|
c->PullTarget(target_pos);
|
||||||
}
|
}
|
||||||
if (c->GetAbility()->GetImmuneVertigoTimes() <= 0) {
|
|
||||||
c->TryAddBuffAndSetTime(sender.Get(),
|
c->TryAddBuffAndSetTime(sender.Get(),
|
||||||
kVertigoEffectBuffId,
|
kVertigoEffectBuffId,
|
||||||
SkillHelper::GetCmxdVertigoTime(skill_meta) * 1000);
|
SkillHelper::GetCmxdVertigoTime(skill_meta) * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
e->EnemyAndObstacleAttack
|
e->EnemyAndObstacleAttack
|
||||||
(
|
(
|
||||||
@ -629,7 +623,6 @@ void Skill::ProcMYXY()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
owner->GetAbility()->AddSpeedAddition(speed_rate);
|
owner->GetAbility()->AddSpeedAddition(speed_rate);
|
||||||
owner->GetAbility()->IncImmuneVertigo();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
owner->GetTrigger()->AddListener
|
owner->GetTrigger()->AddListener
|
||||||
@ -642,7 +635,6 @@ void Skill::ProcMYXY()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
owner->GetAbility()->DelSpeedAddition(speed_rate);
|
owner->GetAbility()->DelSpeedAddition(speed_rate);
|
||||||
owner->GetAbility()->DecImmuneVertigo();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user