1
This commit is contained in:
commit
02524e0f35
@ -3,6 +3,8 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
|
#include <a8/magicenum.h>
|
||||||
|
|
||||||
#include "buff.h"
|
#include "buff.h"
|
||||||
#include "human.h"
|
#include "human.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
@ -49,10 +51,50 @@ void Buff::Init()
|
|||||||
res_scale = meta->GetResScale(this);
|
res_scale = meta->GetResScale(this);
|
||||||
res_scale_frameno = owner->room->GetFrameNo();
|
res_scale_frameno = owner->room->GetFrameNo();
|
||||||
}
|
}
|
||||||
|
#ifdef MYDEBUG
|
||||||
|
switch (meta->buff_effect()) {
|
||||||
|
case kBET_InRescue:
|
||||||
|
case kBET_Rescuer:
|
||||||
|
{
|
||||||
|
a8::XPrintf("add jiuyuan role_name:%s type:%s buff_id:%d buff_effect:%\n",
|
||||||
|
{
|
||||||
|
owner->GetName(),
|
||||||
|
owner->IsPlayer() ? "player" : "android",
|
||||||
|
meta->buff_id(),
|
||||||
|
a8::GetEnumName<BuffEffectType_e>(meta->buff_effect())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buff::UnInit()
|
void Buff::UnInit()
|
||||||
{
|
{
|
||||||
|
#ifdef MYDEBUG
|
||||||
|
switch (meta->buff_effect()) {
|
||||||
|
case kBET_InRescue:
|
||||||
|
case kBET_Rescuer:
|
||||||
|
{
|
||||||
|
a8::XPrintf("remove jiuyuan role_name:%s type:%s buff_id:%d buff_effect:%\n",
|
||||||
|
{
|
||||||
|
owner->GetName(),
|
||||||
|
owner->IsPlayer() ? "player" : "android",
|
||||||
|
meta->buff_id(),
|
||||||
|
a8::GetEnumName<BuffEffectType_e>(meta->buff_effect())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
list_del_init(&effect_entry);
|
list_del_init(&effect_entry);
|
||||||
if (!list_empty(&depend_entry)) {
|
if (!list_empty(&depend_entry)) {
|
||||||
list_del_init(&depend_entry);
|
list_del_init(&depend_entry);
|
||||||
|
@ -37,6 +37,7 @@ class Buff
|
|||||||
float res_scale = 1;
|
float res_scale = 1;
|
||||||
long long res_scale_frameno = 0;
|
long long res_scale_frameno = 0;
|
||||||
std::shared_ptr<std::vector<float>> buff_vars;
|
std::shared_ptr<std::vector<float>> buff_vars;
|
||||||
|
std::shared_ptr<std::list<int>> child_buff_uniids;
|
||||||
|
|
||||||
Buff();
|
Buff();
|
||||||
virtual ~Buff();
|
virtual ~Buff();
|
||||||
|
@ -548,6 +548,12 @@ void CallFuncBuff::ProcAddEnergyShield()
|
|||||||
if (dur_time < 0.00001f) {
|
if (dur_time < 0.00001f) {
|
||||||
dur_time = 99999999;
|
dur_time = 99999999;
|
||||||
}
|
}
|
||||||
|
#if 1
|
||||||
|
if (owner->energy_shield > 0) {
|
||||||
|
owner->energy_shield = 0;
|
||||||
|
owner->GetTrigger()->DestoryEnergyShield();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (owner->energy_shield > 0) {
|
if (owner->energy_shield > 0) {
|
||||||
is_valid_ = false;
|
is_valid_ = false;
|
||||||
owner->GetTrigger()->UpdateEnergyShield(hold_param2_, dur_time);
|
owner->GetTrigger()->UpdateEnergyShield(hold_param2_, dur_time);
|
||||||
|
@ -245,7 +245,7 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
|||||||
(
|
(
|
||||||
[this] (Human* hum) -> bool
|
[this] (Human* hum) -> bool
|
||||||
{
|
{
|
||||||
a8::SetBitFlag(hum->status, CS_NoDie);
|
//a8::SetBitFlag(hum->status, CS_NoDie);
|
||||||
hum->GetMovement()->ClearPath();
|
hum->GetMovement()->ClearPath();
|
||||||
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
|
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
|
||||||
room->grid_service->MoveCreature(hum);
|
room->grid_service->MoveCreature(hum);
|
||||||
@ -519,6 +519,31 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
|||||||
for (auto& str : strings) {
|
for (auto& str : strings) {
|
||||||
SendDebugMsg("数值: " + str);
|
SendDebugMsg("数值: " + str);
|
||||||
}
|
}
|
||||||
|
} else if (cmd == "down_teammate") {
|
||||||
|
Human* target = nullptr;
|
||||||
|
GetTeam()->TraverseMembers
|
||||||
|
(
|
||||||
|
[this, &target] (Human *hum) -> bool
|
||||||
|
{
|
||||||
|
if (!hum->dead && hum != this) {
|
||||||
|
if (!target) {
|
||||||
|
target = hum;
|
||||||
|
} else if (GetPos().Distance2D2(hum->GetPos()) <
|
||||||
|
GetPos().Distance2D2(target->GetPos())) {
|
||||||
|
target = hum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if (target) {
|
||||||
|
float dmg_out = 0.0f;
|
||||||
|
target->DecHP(100000.0f, VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas,
|
||||||
|
VP_Gas,
|
||||||
|
TEXT("battle_server_killer_gas", "毒圈"),
|
||||||
|
dmg_out,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
}
|
||||||
} else if (cmd == "moba_pingju" && cmds.size() >= 0) {
|
} else if (cmd == "moba_pingju" && cmds.size() >= 0) {
|
||||||
if (room->IsMobaModeRoom() && !room->IsGameOver() && room->GetMobaOvertimeRaceFrameNo() <= 0) {
|
if (room->IsMobaModeRoom() && !room->IsGameOver() && room->GetMobaOvertimeRaceFrameNo() <= 0) {
|
||||||
room->TraverseTeams
|
room->TraverseTeams
|
||||||
@ -530,6 +555,12 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
|||||||
});
|
});
|
||||||
room->xtimer.ModifyTime(room->moba_over_timer, 0);
|
room->xtimer.ModifyTime(room->moba_over_timer, 0);
|
||||||
}
|
}
|
||||||
|
} else if (cmd == "peace_mode" && cmds.size() >= 0) {
|
||||||
|
if (cmds[1] == "1") {
|
||||||
|
room->OpenRoomSwitch(kRoomSwitchPeaceMode);
|
||||||
|
} else {
|
||||||
|
room->CloseRoomSwitch(kRoomSwitchPeaceMode);
|
||||||
|
}
|
||||||
} else if (cmd == "findpath" && cmds.size() >= 3) {
|
} else if (cmd == "findpath" && cmds.size() >= 3) {
|
||||||
float x = a8::XValue(cmds[1]).GetDouble();
|
float x = a8::XValue(cmds[1]).GetDouble();
|
||||||
float y = a8::XValue(cmds[2]).GetDouble();
|
float y = a8::XValue(cmds[2]).GetDouble();
|
||||||
|
@ -398,7 +398,18 @@ int Creature::AddBuff(Creature* caster,
|
|||||||
for (int child_buff_id : buff->meta->_child_buff_list) {
|
for (int child_buff_id : buff->meta->_child_buff_list) {
|
||||||
const mt::Buff* child_buff_meta = mt::Buff::GetById(child_buff_id);
|
const mt::Buff* child_buff_meta = mt::Buff::GetById(child_buff_id);
|
||||||
if (child_buff_meta) {
|
if (child_buff_meta) {
|
||||||
AddBuff(caster, child_buff_meta, buff_skill_meta, true, init_args, buff_vars);
|
int child_buff_uniid = AddBuff(caster,
|
||||||
|
child_buff_meta,
|
||||||
|
buff_skill_meta,
|
||||||
|
true,
|
||||||
|
init_args,
|
||||||
|
buff_vars);
|
||||||
|
if (child_buff_uniid) {
|
||||||
|
if (!buff->child_buff_uniids) {
|
||||||
|
buff->child_buff_uniids = std::make_shared<std::list<int>>();
|
||||||
|
}
|
||||||
|
buff->child_buff_uniids->push_back(child_buff_uniid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,7 +548,7 @@ void Creature::RemoveBuffById(int buff_id)
|
|||||||
void Creature::RemoveBuffByUniId(int buff_uniid)
|
void Creature::RemoveBuffByUniId(int buff_uniid)
|
||||||
{
|
{
|
||||||
int buff_id = 0;
|
int buff_id = 0;
|
||||||
std::vector<std::tuple<const mt::Buff*, Creature*>> removed_buffs;
|
std::vector<std::tuple<const mt::Buff*, Creature*, std::shared_ptr<std::list<int>>>> removed_buffs;
|
||||||
std::shared_ptr<Buff> buff;
|
std::shared_ptr<Buff> buff;
|
||||||
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
|
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
|
||||||
if ((*itr)->buff_uniid == buff_uniid) {
|
if ((*itr)->buff_uniid == buff_uniid) {
|
||||||
@ -553,7 +564,7 @@ void Creature::RemoveBuffByUniId(int buff_uniid)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
removed_buffs.push_back(std::make_tuple(buff->meta, buff->GetCaster().Get()));
|
removed_buffs.push_back(std::make_tuple(buff->meta, buff->GetCaster().Get(), buff->child_buff_uniids));
|
||||||
OnBuffRemove(*buff.get());
|
OnBuffRemove(*buff.get());
|
||||||
buff->UnInit();
|
buff->UnInit();
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
@ -578,10 +589,19 @@ void Creature::RemoveBuffByUniId(int buff_uniid)
|
|||||||
for (auto& tuple1 : removed_buffs) {
|
for (auto& tuple1 : removed_buffs) {
|
||||||
const mt::Buff* buff_meta = std::get<0>(tuple1);
|
const mt::Buff* buff_meta = std::get<0>(tuple1);
|
||||||
Creature* caster = std::get<1>(tuple1);
|
Creature* caster = std::get<1>(tuple1);
|
||||||
|
std::shared_ptr<std::list<int>> child_buff_uniids = std::get<2>(tuple1);
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if (child_buff_uniids) {
|
||||||
|
for (auto child_buff_uniid : *child_buff_uniids) {
|
||||||
|
RemoveBuffByUniId(child_buff_uniid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (int child_buff_id : buff_meta->_child_buff_list) {
|
for (int child_buff_id : buff_meta->_child_buff_list) {
|
||||||
RemoveBuffById(child_buff_id);
|
RemoveBuffById(child_buff_id);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!HasBuffEffect(buff_meta->buff_effect()) &&
|
if (!HasBuffEffect(buff_meta->buff_effect()) &&
|
||||||
!list_empty(&depend_effect_[buff_meta->buff_effect()])) {
|
!list_empty(&depend_effect_[buff_meta->buff_effect()])) {
|
||||||
|
@ -396,6 +396,12 @@ bool HeroAgent::MasterInRange(float range)
|
|||||||
|
|
||||||
behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
|
behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
|
||||||
{
|
{
|
||||||
|
#ifdef MYDEBUG
|
||||||
|
if (owner_->room->HasRoomSwitch(kRoomSwitchPeaceMode)
|
||||||
|
) {
|
||||||
|
return behaviac::BT_FAILURE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Creature* myself = owner_;
|
Creature* myself = owner_;
|
||||||
Creature* target = nullptr;
|
Creature* target = nullptr;
|
||||||
float last_distance = range + 1;
|
float last_distance = range + 1;
|
||||||
@ -435,6 +441,12 @@ behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
|
|||||||
|
|
||||||
behaviac::EBTStatus HeroAgent::SearchHumanEnemy(float range)
|
behaviac::EBTStatus HeroAgent::SearchHumanEnemy(float range)
|
||||||
{
|
{
|
||||||
|
#ifdef MYDEBUG
|
||||||
|
if (owner_->room->HasRoomSwitch(kRoomSwitchPeaceMode)
|
||||||
|
) {
|
||||||
|
return behaviac::BT_FAILURE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Creature* myself = owner_;
|
Creature* myself = owner_;
|
||||||
Creature* target = nullptr;
|
Creature* target = nullptr;
|
||||||
float last_distance = range + 1;
|
float last_distance = range + 1;
|
||||||
|
@ -894,7 +894,7 @@ void Human::UpdateAction()
|
|||||||
break;
|
break;
|
||||||
case AT_Rescue:
|
case AT_Rescue:
|
||||||
{
|
{
|
||||||
RemoveBuffByEffectId(kBET_InRescue);
|
RemoveBuffByEffectId(kBET_Rescuer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1807,7 +1807,7 @@ void Human::ProcUseItemAction()
|
|||||||
|
|
||||||
void Human::ProcReliveAction()
|
void Human::ProcReliveAction()
|
||||||
{
|
{
|
||||||
RemoveBuffByEffectId(kBET_Rescuer);
|
RemoveBuffByEffectId(kBET_InRescue);
|
||||||
Entity* entity = room->GetEntityByUniId(action_target_id);
|
Entity* entity = room->GetEntityByUniId(action_target_id);
|
||||||
if (!entity->IsEntityType(ET_Player)) {
|
if (!entity->IsEntityType(ET_Player)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1093,7 +1093,7 @@ void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
|
|||||||
a8::XPrintf("moving:%d times:%d\n", {moving ? 1 : 0, GetDisableAttackDirTimes()});
|
a8::XPrintf("moving:%d times:%d\n", {moving ? 1 : 0, GetDisableAttackDirTimes()});
|
||||||
#endif
|
#endif
|
||||||
if (moving && GetDisableAttackDirTimes() <= 0) {
|
if (moving && GetDisableAttackDirTimes() <= 0) {
|
||||||
#if 1
|
#if 0
|
||||||
SetAttackDir(GetMoveDir());
|
SetAttackDir(GetMoveDir());
|
||||||
#else
|
#else
|
||||||
if (!HasBuffEffect(kBET_HoldShield)) {
|
if (!HasBuffEffect(kBET_HoldShield)) {
|
||||||
|
@ -74,6 +74,7 @@ enum RoomSwitch_e
|
|||||||
kRoomSwitchDisableUseSkill,
|
kRoomSwitchDisableUseSkill,
|
||||||
kRoomSwitchDisableUseItem,
|
kRoomSwitchDisableUseItem,
|
||||||
kRoomSwitchDisableShot,
|
kRoomSwitchDisableShot,
|
||||||
|
kRoomSwitchPeaceMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
class Room : public std::enable_shared_from_this<Room>
|
class Room : public std::enable_shared_from_this<Room>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user