添加和平模式
This commit is contained in:
parent
fef73d93f8
commit
aff5f45a95
@ -7,6 +7,7 @@
|
||||
#include "room.h"
|
||||
#include "metamgr.h"
|
||||
#include "player.h"
|
||||
#include "app.h"
|
||||
|
||||
const int SHUA_RANGE = 580;
|
||||
|
||||
@ -493,6 +494,11 @@ void AndroidNewAI::UpdateThinking()
|
||||
}
|
||||
} else {
|
||||
Creature* target = GetTarget();
|
||||
#ifdef DEBUG
|
||||
if (App::Instance()->HasFlag(20)) {
|
||||
target = nullptr;
|
||||
}
|
||||
#endif
|
||||
if (target) {
|
||||
node_.target.Attach(target);
|
||||
ChangeToStateNewAI(ASE_Attack);
|
||||
|
@ -537,6 +537,16 @@ bool App::HasFlag(int flag)
|
||||
return flags.find(flag) != flags.end();
|
||||
}
|
||||
|
||||
void App::SetFlag(int flag)
|
||||
{
|
||||
flags.insert(flag);
|
||||
}
|
||||
|
||||
void App::UnSetFlag(int flag)
|
||||
{
|
||||
flags.erase(flag);
|
||||
}
|
||||
|
||||
void App::FreeSocketMsgQueue()
|
||||
{
|
||||
msg_mutex_->lock();
|
||||
|
@ -33,6 +33,8 @@ public:
|
||||
void DelContext(long long context_id);
|
||||
a8::XParams* GetContext(long long context_id);
|
||||
bool HasFlag(int flag);
|
||||
void SetFlag(int flag);
|
||||
void UnSetFlag(int flag);
|
||||
|
||||
private:
|
||||
void QuickExecute(int delta_time);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "collider.h"
|
||||
#include "skill.h"
|
||||
#include "incubator.h"
|
||||
#include "car.h"
|
||||
|
||||
int Buff::GetLeftTime()
|
||||
{
|
||||
@ -209,6 +210,29 @@ void Buff::ProcBecome(Creature* caster)
|
||||
}
|
||||
|
||||
void Buff::ProcRemoveBecome(Creature* caster)
|
||||
{
|
||||
RecoverHoldWeapons(caster);
|
||||
}
|
||||
|
||||
void Buff::ProcDriver(Creature* caster)
|
||||
{
|
||||
if (caster->IsHuman()) {
|
||||
Human* hum = (Human*)caster;
|
||||
if (hum->GetCar() && hum->GetCar()->GetCurrWeapon()) {
|
||||
hold_weapons_.push_back(hum->weapons[hum->GetCar()->GetCurrWeapon()->weapon_idx]);
|
||||
hum->weapons[hum->GetCar()->GetCurrWeapon()->weapon_idx] = *hum->GetCar()->GetCurrWeapon();
|
||||
}
|
||||
}
|
||||
caster->need_sync_active_player = true;
|
||||
caster->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
void Buff::ProcRemoveDriver(Creature* caster)
|
||||
{
|
||||
RecoverHoldWeapons(caster);
|
||||
}
|
||||
|
||||
void Buff::RecoverHoldWeapons(Creature* caster)
|
||||
{
|
||||
for (auto& weapon : hold_weapons_) {
|
||||
if (weapon.weapon_idx >= 0 &&
|
||||
|
@ -40,9 +40,12 @@ class Buff
|
||||
void ProcBeRecycle(Creature* caster);
|
||||
void ProcBecome(Creature* caster);
|
||||
void ProcRemoveBecome(Creature* caster);
|
||||
void ProcDriver(Creature* caster);
|
||||
void ProcRemoveDriver(Creature* caster);
|
||||
|
||||
private:
|
||||
void InternalTimerAddBuff(Creature* caster);
|
||||
void RecoverHoldWeapons(Creature* caster);
|
||||
|
||||
private:
|
||||
std::list<Weapon> hold_weapons_;
|
||||
|
@ -913,7 +913,12 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
|
||||
buff->ProcBecome(caster);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case kBET_Driver:
|
||||
{
|
||||
buff->ProcDriver(caster);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
@ -187,17 +187,18 @@ void Player::UpdateShot()
|
||||
if (HasBuffEffect(kBET_Vertigo)) {
|
||||
return;
|
||||
}
|
||||
if (shot_start) {
|
||||
shot_start = false;
|
||||
Shot();
|
||||
return;
|
||||
}
|
||||
if (GetCar() && GetCar()->IsDriver(this)) {
|
||||
bool shot_ok = false;
|
||||
a8::Vec2 target_dir = attack_dir;
|
||||
GetCar()->Shot(target_dir, shot_ok, fly_distance);
|
||||
shot_start = false;
|
||||
return;
|
||||
} else {
|
||||
if (shot_start) {
|
||||
shot_start = false;
|
||||
Shot();
|
||||
return;
|
||||
}
|
||||
Weapon* p_weapon = GetCurrWeapon();
|
||||
if (second_weapon.meta) {
|
||||
p_weapon = &second_weapon;
|
||||
@ -1110,6 +1111,14 @@ 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 == "setmode") {
|
||||
if (cmds.empty()) {
|
||||
App::Instance()->UnSetFlag(20);
|
||||
} else {
|
||||
if (cmds[0] == "peace") {
|
||||
App::Instance()->SetFlag(20);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "additem" && cmds.size() >= 3) {
|
||||
int item_id = a8::XValue(cmds[1]);
|
||||
int item_num = a8::XValue(cmds[2]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user