merge hero

This commit is contained in:
aozhiwei 2021-04-12 16:54:43 +08:00
commit 5677b168a5
6 changed files with 25 additions and 6 deletions

View File

@ -137,3 +137,15 @@ void Buff::InternalTimerAddBuff(Creature* caster)
break;
}
}
void Buff::ProcSummonHero(Creature* caster)
{
if (!caster->IsHuman()) {
return;
}
}
bool Buff::NeedSync(Human* hum)
{
return !meta->i->only_server() || !(meta->i->only_self() && owner == hum);
}

View File

@ -15,6 +15,7 @@ namespace cs
class MFBuff;
}
class Human;
class Creature;
class Buff
{
@ -28,11 +29,13 @@ class Buff
int GetLeftTime();
int GetLastingTime();
bool NeedSync(Human* hum);
void FillMFBuff(cs::MFBuff* buff_pb);
void ProcDelayAddBuff(Creature* caster);
void ProcIntervalAddBuff(Creature* caster);
void ProcBatchAddBuff(Creature* caster);
void ProcSummonHero(Creature* caster);
private:
void InternalTimerAddBuff(Creature* caster);

View File

@ -347,11 +347,13 @@ float Creature::GetBuffAttrRate(int attr_type)
return 0;
}
void Creature::FillBuffList(::google::protobuf::RepeatedPtrField<::cs::MFBuff>* pb_buff_list)
void Creature::FillBuffList(Human* hum, ::google::protobuf::RepeatedPtrField<::cs::MFBuff>* pb_buff_list)
{
for (auto& itr : buff_list_) {
auto buff = pb_buff_list->Add();
itr.FillMFBuff(buff);
if (itr.NeedSync(hum)) {
auto buff = pb_buff_list->Add();
itr.FillMFBuff(buff);
}
}
}
@ -830,7 +832,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
break;
case kBET_SummonHero:
{
buff->ProcSummonHero(caster);
}
break;
case kBET_Shield:

View File

@ -70,7 +70,7 @@ class Creature : public MoveableEntity
void ClearBuffList();
float GetBuffAttrAbs(int attr_id);
float GetBuffAttrRate(int attr_id);
void FillBuffList(::google::protobuf::RepeatedPtrField<::cs::MFBuff>* pb_buff_list);
void FillBuffList(Human* hum, ::google::protobuf::RepeatedPtrField<::cs::MFBuff>* pb_buff_list);
void FillSkillList(::google::protobuf::RepeatedPtrField< cs::MFSkill >* pb_skill_list);
void TriggerBuff(Skill* skill, std::set<Creature*>& target_list, BuffTriggerType_e trigger_type);
Skill* GetSkill(int skill_id);

View File

@ -203,7 +203,7 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
p->set_parachute(parachute);
}
FillBodyState(p->mutable_states());
FillBuffList(p->mutable_buff_list());
FillBuffList(hum, p->mutable_buff_list());
FillSkillList(p->mutable_skill_list());
if (dead) {
p->set_killer_name(stats.killer_name);

View File

@ -213,6 +213,8 @@ message Buff
optional float buff_valueup = 11;
required string immune_buffeffect_list = 12;
optional string post_remove_action = 13;
optional int32 only_server = 14;
optional int32 only_self = 15;
}
message Drop