This commit is contained in:
aozhiwei 2021-05-27 14:39:16 +08:00
parent 92db366545
commit 245dbfafdb
8 changed files with 109 additions and 9 deletions

View File

@ -330,3 +330,65 @@ void Buff::ProcSprint(Creature* caster)
});
}
}
void Buff::ProcSeletTargetWithSelfPos(Creature* caster)
{
std::vector<Creature*> targets;
owner->TraverseCreatures
(
[this, &targets] (Creature* c, bool& stop)
{
switch (meta->int_param1) {
case kBST_All:
{
targets.push_back(c);
}
break;
case kBST_Self:
{
if (c == owner) {
targets.push_back(c);
}
}
break;
case kBST_FriendlyIncludeSelf:
{
if (c->team_id == owner->team_id) {
targets.push_back(c);
}
}
break;
case kBST_FriendlyExcludeSelf:
{
if (c->team_id == owner->team_id && c != owner) {
targets.push_back(c);
}
}
break;
case kBST_Enemy:
{
if (c->team_id != owner->team_id) {
targets.push_back(c);
}
}
break;
case kBST_EnemyAndSelf:
{
if (c->team_id != owner->team_id || c == owner) {
targets.push_back(c);
}
}
break;
default:
{
}
break;
}
}
);
for (auto& target : targets) {
for (int buff_id : meta->param2_int_list) {
target->TryAddBuff(caster, buff_id);
}
}
}

View File

@ -45,6 +45,7 @@ class Buff
void ProcPassenger(Creature* caster);
void ProcRemovePassenger(Creature* caster);
void ProcSprint(Creature* caster);
void ProcSeletTargetWithSelfPos(Creature* caster);
private:
void InternalTimerAddBuff(Creature* caster);

View File

@ -167,6 +167,18 @@ enum SkillTarget_e
kST_SpecDir = 11
};
enum BuffSelectTarget_e
{
kBST_All = 0,
kBST_Self = 1,
kBST_FriendlyIncludeSelf = 2,
kBST_FriendlyExcludeSelf = 3,
kBST_Enemy = 5,
kBST_EnemyAndSelf = 6,
};
enum VirtualWeapon_e
{
VW_SafeArea = 9000000,

View File

@ -54,6 +54,7 @@ enum BuffEffectType_e
kBET_FlashMove = 37, //瞬间移动
kBET_Become = 38, //变身
kBET_ShotCharge = 39, //射击蓄力
kBET_SelectTargetWithSelfPos = 39, //已自己坐标为中心范围内选取目标,并且批量添加buff
kBET_FollowMaster = 49, //跟随主人
kBET_ThroughWall = 50, //穿墙

View File

@ -938,17 +938,22 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
buff->ProcBecome(caster);
}
break;
case kBET_Driver:
{
case kBET_SelectTargetWithSelfPos:
{
buff->ProcSeletTargetWithSelfPos(caster);
}
break;
case kBET_Driver:
{
buff->ProcDriver(caster);
}
break;
case kBET_Passenger:
{
}
break;
case kBET_Passenger:
{
buff->ProcPassenger(caster);
}
break;
default:
}
break;
default:
{
}
break;
@ -1136,6 +1141,13 @@ bool Creature::IsEnemy(Creature* target)
}
}
void Creature::TraverseCreatures(std::function<void (Creature*, bool&)> func)
{
room->grid_service->TraverseCreatures(room->GetRoomIdx(),
GetGridList(),
func);
}
void Creature::TraverseProperTargets(std::function<void (Creature*, bool&)> func)
{
auto callback =
@ -1780,6 +1792,9 @@ void Creature::GetHitEnemys(std::set<Creature*>& enemys)
void Creature::AddHp(float hp)
{
if (dead) {
return;
}
float old_health = GetHP();
ability.hp += hp;
ability.hp = std::min(GetHP(), GetMaxHP());

View File

@ -134,6 +134,7 @@ class Creature : public MoveableEntity
int GetActionType() { return action_type; }
int GetActionTargetId() { return action_target_id; }
void TraverseCreatures(std::function<void (Creature*, bool&)> func);
void TraverseProperTargets(std::function<void (Creature*, bool&)> func);
void TraverseProperTargetsNoTeammate(std::function<void (Creature*, bool&)> func);
CreatureWeakPtrChunk* GetWeakPtrChunk() { return &weak_ptr_chunk_; };

View File

@ -644,6 +644,10 @@ namespace MetaData
param2 = a8::XValue(i->buff_param2()).GetDouble();
param3 = a8::XValue(i->buff_param3()).GetDouble();
param4 = a8::XValue(i->buff_param4()).GetDouble();
int_param1 = a8::XValue(i->buff_param1());
int_param2 = a8::XValue(i->buff_param2());
int_param3 = a8::XValue(i->buff_param3());
int_param4 = a8::XValue(i->buff_param4());
{
std::vector<std::string> strings;
a8::Split(i->immune_buffeffect_list(), strings, '|');

View File

@ -180,6 +180,10 @@ namespace MetaData
float param2 = 0.0f;
float param3 = 0.0f;
float param4 = 0.0f;
int int_param1 = 0;
int int_param2 = 0;
int int_param3 = 0;
int int_param4 = 0;
std::vector<int> param1_int_list;
std::vector<int> param2_int_list;
std::vector<std::tuple<int, std::vector<std::tuple<int, int>>>> batch_add_list;