1
This commit is contained in:
parent
48baafc4b0
commit
06652837e0
@ -105,6 +105,11 @@ void AndroidAI::DoMove()
|
||||
if (owner->UpdatedTimes() % 2 == 0) {
|
||||
Human* hum = (Human*)owner;
|
||||
int speed = std::max(1, (int)hum->GetSpeed());
|
||||
if (a8::HasBitFlag(hum->status, HS_NewBieNpc) &&
|
||||
hum->room->frame_no - hum->enable_frameno < SERVER_FRAME_RATE * 8) {
|
||||
hum->move_dir = hum->room->first_newbie->GetPos() - hum->GetPos();
|
||||
hum->move_dir.Normalize();
|
||||
}
|
||||
for (int i = 0; i < speed; ++i) {
|
||||
a8::Vec2 old_pos = hum->GetPos();
|
||||
hum->SetPos(hum->GetPos() + hum->move_dir);
|
||||
|
@ -75,6 +75,7 @@ class Human : public MoveableEntity
|
||||
long long poisoning_time = 0;
|
||||
int lethal_weapon = 0;
|
||||
long long join_frameno = 0;
|
||||
long long enable_frameno = 0;
|
||||
int status = 0;
|
||||
float atk_add = 0.0f;
|
||||
int emoji1 = 0;
|
||||
|
@ -358,6 +358,10 @@ DEFAULT_BORN_POINT_Y + rand() % 1500)
|
||||
|
||||
Human* Room::FindEnemy(Human* hum)
|
||||
{
|
||||
if (a8::HasBitFlag(hum->status, HS_NewBieNpc) &&
|
||||
frame_no - hum->enable_frameno < SERVER_FRAME_RATE * 8) {
|
||||
return first_newbie;
|
||||
}
|
||||
std::vector<Human*> enemys;
|
||||
enemys.reserve(50);
|
||||
EntitySubType_e sub_type = EST_Player;
|
||||
@ -1656,6 +1660,9 @@ void Room::NotifyGameStart()
|
||||
cs::SMGameStart msg;
|
||||
for (auto& pair : accountid_hash_) {
|
||||
pair.second->SendNotifyMsg(msg);
|
||||
if (room_type == RT_NewBrid) {
|
||||
first_newbie = pair.second;
|
||||
}
|
||||
}
|
||||
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 1,
|
||||
a8::XParams()
|
||||
@ -1710,6 +1717,7 @@ void Room::EnableHuman(Human* target)
|
||||
{
|
||||
if (a8::HasBitFlag(target->status, HS_Disable)) {
|
||||
a8::UnSetBitFlag(target->status, HS_Disable);
|
||||
target->enable_frameno = frame_no;
|
||||
moveable_hash_[target->entity_uniid] = target;
|
||||
grid_service->AddHuman(target);
|
||||
target->FindLocation();
|
||||
@ -1954,7 +1962,9 @@ void Room::ProcShuaAndroid(int shua_time, int shua_num)
|
||||
}
|
||||
}
|
||||
hum->SetPos(pos);
|
||||
#if 0
|
||||
a8::SetBitFlag(hum->status, HS_NewBieNpc);
|
||||
#endif
|
||||
EnableHuman(hum);
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
@ -2012,8 +2022,9 @@ void Room::ProcDieAndroid(int die_time, int die_num)
|
||||
for (size_t ii = i + 1; ii < alive_humans_copy.size(); ++ii) {
|
||||
killer = alive_humans_copy[ii];
|
||||
alive_humans.erase(alive_humans.begin() + ii);
|
||||
alive_humans_copy.erase(alive_humans_copy.begin() + ii);
|
||||
alive_humans.erase(alive_humans.begin() + i);
|
||||
alive_humans_copy.erase(alive_humans_copy.begin() + ii);
|
||||
alive_humans_copy.erase(alive_humans_copy.begin() + i);
|
||||
break;
|
||||
}
|
||||
if (killer && (rand() % 100 < 70)) {
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
std::vector<Building*>* buildings = nullptr;
|
||||
xtimer_list* shua_android_timer = nullptr;
|
||||
xtimer_list* die_android_timer = nullptr;
|
||||
Human* first_newbie = nullptr;
|
||||
|
||||
~Room();
|
||||
void Init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user