This commit is contained in:
aozhiwei 2021-04-19 14:53:39 +08:00
parent 381d4f46f1
commit 04980ae0ef
5 changed files with 22 additions and 16 deletions

View File

@ -1513,3 +1513,17 @@ void Creature::ResetAllSkillCd()
pair.second->ResetSkillCd();
}
}
void Creature::SummonHero(const a8::Vec2& pos, int hero_id, int hero_num)
{
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(hero_id);
if (hero_meta && hero_num > 0 && !dead) {
Hero* hero = room->CreateHero
(this,
hero_meta,
GetPos(),
GetMoveDir(),
team_id
);
}
}

View File

@ -132,6 +132,7 @@ class Creature : public MoveableEntity
void CheckSpecObject();
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
void SummonHero(const a8::Vec2& pos, int hero_id, int hero_num);
bool CollisonDetection();
void FillSkillCasterState(SkillCasterState* caster_state);
void RecoverSkillCasterState(SkillCasterState* caster_state);

View File

@ -1418,20 +1418,6 @@ void Human::FillBodyState(::google::protobuf::RepeatedPtrField<::cs::MFBodyState
}
}
void Human::SummonHero(int heroid)
{
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(heroid);
if (hero_meta) {
Hero* hero = room->CreateHero
(this,
hero_meta,
GetPos(),
GetMoveDir(),
team_id
);
}
}
void Human::AddObserver(Human* observer)
{
observers_.insert(observer);

View File

@ -192,7 +192,6 @@ class Human : public Creature
int GetVolume(int slot_id);
void RecoverHp(int inc_hp);
void FillBodyState(::google::protobuf::RepeatedPtrField<::cs::MFBodyState>* states);
void SummonHero(int heroid);
void AddObserver(Human* observer);
void RemoveObserver(Human* observer);
void SendUpdateMsg();

View File

@ -1102,10 +1102,16 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
std::string cmd = cmds[0];
if (cmd == "gps") {
SendDebugMsg(a8::Format("%d %d", {GetPos().x, GetPos().y}));
}else if (cmd == "additem" && cmds.size() >= 2) {
} else if (cmd == "additem" && cmds.size() >= 3) {
int item_id = a8::XValue(cmds[1]);
int item_num = a8::XValue(cmds[2]);
GMAddItem(item_id, item_num);
} else if (cmd == "addbuff" && cmds.size() >= 2) {
int buff_id = a8::XValue(cmds[1]);
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
if (buff_meta) {
MustBeAddBuff(this, buff_id);
}
}
}