1
This commit is contained in:
parent
44d5a9d6f3
commit
9e775fd0c1
@ -1888,6 +1888,57 @@ void Human::ChangeToRaceAndNotify(RaceType_e race, int level)
|
|||||||
room->frame_event.AddLevelChg(this);
|
room->frame_event.AddLevelChg(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::WinExp(Human* sender, int exp)
|
||||||
|
{
|
||||||
|
if (race_ != kHumanRace &&
|
||||||
|
race_ != kZombieRace) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
if (race_ == kHumanRace) {
|
||||||
|
exp_ += exp;
|
||||||
|
MetaData::Player* old_meta = meta;
|
||||||
|
do {
|
||||||
|
MetaData::Player* tmp_meta = MetaMgr::Instance()->GetPlayer
|
||||||
|
(
|
||||||
|
HUMAN_RACE_META_START_ID + level_
|
||||||
|
);
|
||||||
|
if (!tmp_meta) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (exp_ >= tmp_meta->i->exp()) {
|
||||||
|
meta = tmp_meta;
|
||||||
|
++level_;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(true);
|
||||||
|
if (old_meta != meta) {
|
||||||
|
room->frame_event.AddRaceChg(this);
|
||||||
|
}
|
||||||
|
} else if (race_ == kZombieRace) {
|
||||||
|
exp_ += exp;
|
||||||
|
MetaData::Player* old_meta = meta;
|
||||||
|
do {
|
||||||
|
MetaData::Player* tmp_meta = MetaMgr::Instance()->GetPlayer
|
||||||
|
(
|
||||||
|
ZOMBIE_RACE_META_START_ID + level_
|
||||||
|
);
|
||||||
|
if (!tmp_meta) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (exp_ >= tmp_meta->i->exp()) {
|
||||||
|
meta = tmp_meta;
|
||||||
|
++level_;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(true);
|
||||||
|
if (old_meta != meta) {
|
||||||
|
room->frame_event.AddRaceChg(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Human::_InternalUpdateMove(float speed)
|
void Human::_InternalUpdateMove(float speed)
|
||||||
{
|
{
|
||||||
float nx = move_dir.x * speed;
|
float nx = move_dir.x * speed;
|
||||||
|
@ -282,6 +282,7 @@ class Human : public MoveableEntity
|
|||||||
RaceType_e GetRace() { return race_; }
|
RaceType_e GetRace() { return race_; }
|
||||||
void ChangeToRace(RaceType_e race, int level);
|
void ChangeToRace(RaceType_e race, int level);
|
||||||
void ChangeToRaceAndNotify(RaceType_e race, int level);
|
void ChangeToRaceAndNotify(RaceType_e race, int level);
|
||||||
|
void WinExp(Human* sender, int exp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _InternalUpdateMove(float speed);
|
void _InternalUpdateMove(float speed);
|
||||||
|
@ -567,6 +567,17 @@ void Room::OnHumanDie(Human* hum)
|
|||||||
} else {
|
} else {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
for (auto& pair : human_hash_) {
|
||||||
|
if (pair.second != hum) {
|
||||||
|
pair.second->WinExp(hum, hum->meta->i->dead_exp());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Human* killer = GetPlayerByUniId(hum->stats.killer_id);
|
||||||
|
if (killer && killer != hum) {
|
||||||
|
killer->WinExp(hum, hum->meta->i->killer_exp());
|
||||||
|
}
|
||||||
|
}
|
||||||
NotifyUiUpdate();
|
NotifyUiUpdate();
|
||||||
} else {
|
} else {
|
||||||
--alive_count_;
|
--alive_count_;
|
||||||
@ -1807,15 +1818,25 @@ void Room::SecondRandPoint()
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (GetRoomMode() == kZombieMode) {
|
if (GetRoomMode() == kZombieMode) {
|
||||||
BornPoint* born_point = nullptr;
|
BornPoint* born_point = nullptr;
|
||||||
|
int i = 0;
|
||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
if (!born_point) {
|
if (!born_point) {
|
||||||
born_point = pair.second->born_point;
|
born_point = pair.second->born_point;
|
||||||
} else {
|
} else {
|
||||||
|
++i;
|
||||||
pair.second->born_point = born_point;
|
pair.second->born_point = born_point;
|
||||||
pair.second->SetPos(pair.second->born_point->RandPoint());
|
a8::Vec2 pos = pair.second->born_point->RandPoint();
|
||||||
|
pos.x += i * 60;
|
||||||
|
pair.second->SetPos(pos);
|
||||||
pair.second->FindLocation();
|
pair.second->FindLocation();
|
||||||
pair.second->RefreshView();
|
pair.second->RefreshView();
|
||||||
grid_service->MoveHuman(pair.second);
|
grid_service->MoveHuman(pair.second);
|
||||||
|
#if 0
|
||||||
|
if (++i > 5) {
|
||||||
|
i = 0;
|
||||||
|
born_point = nullptr;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1879,7 +1900,11 @@ ObstacleData* Room::GetPermanentObstacleData(int obstacle_uniid)
|
|||||||
long long Room::GetGasInactiveTime()
|
long long Room::GetGasInactiveTime()
|
||||||
{
|
{
|
||||||
if (room_mode_ == kZombieMode) {
|
if (room_mode_ == kZombieMode) {
|
||||||
|
#if DEBUG
|
||||||
|
return 5;
|
||||||
|
#else
|
||||||
return MetaMgr::Instance()->zbmode_gas_inactive_time;
|
return MetaMgr::Instance()->zbmode_gas_inactive_time;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (room_type_ == RT_NewBrid) {
|
if (room_type_ == RT_NewBrid) {
|
||||||
if (creator_game_times_ <= 0) {
|
if (creator_game_times_ <= 0) {
|
||||||
|
@ -196,12 +196,16 @@ void ZombieAI::UpdateAttack()
|
|||||||
//站桩
|
//站桩
|
||||||
ChangeToState(ZSE_Thinking);
|
ChangeToState(ZSE_Thinking);
|
||||||
} else {
|
} else {
|
||||||
|
#if 1
|
||||||
|
ChangeToState(ZSE_Pursuit);
|
||||||
|
#else
|
||||||
if (distance < node_->ai_meta->i->pursuit_radius()) {
|
if (distance < node_->ai_meta->i->pursuit_radius()) {
|
||||||
//追击
|
//追击
|
||||||
ChangeToState(ZSE_Pursuit);
|
ChangeToState(ZSE_Pursuit);
|
||||||
} else {
|
} else {
|
||||||
ChangeToState(ZSE_Thinking);
|
ChangeToState(ZSE_Thinking);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -393,9 +397,12 @@ Human* ZombieAI::GetTarget()
|
|||||||
node_->nearest_human = target;
|
node_->nearest_human = target;
|
||||||
node_->last_check_nearest_human_frameno = myself->room->GetFrameNo();
|
node_->last_check_nearest_human_frameno = myself->room->GetFrameNo();
|
||||||
float distance = myself->GetPos().Distance(target->GetPos());
|
float distance = myself->GetPos().Distance(target->GetPos());
|
||||||
|
#if 1
|
||||||
|
#else
|
||||||
if (distance > GetAttackRange()) {
|
if (distance > GetAttackRange()) {
|
||||||
target = nullptr;
|
target = nullptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user