diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 6d8ba0d..d83a098 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1144,7 +1144,14 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance) int weapon_idx = GetCurrWeapon()->weapon_idx; *GetCurrWeapon() = Weapon(); GetCurrWeapon()->weapon_idx = weapon_idx; - SetCurrWeapon(ChooseNextWeapon(slot_id, SPEC1_IS_BEGIN, SPEC1_IS_END)); + Weapon* next_weapon = ChooseNextWeapon(slot_id, SPEC1_IS_BEGIN, SPEC1_IS_END); + if (!next_weapon) { + next_weapon = ChooseNextWeapon(SPEC2_IS_BEGIN, SPEC2_IS_BEGIN, SPEC2_IS_END); + } + if (!next_weapon) { + next_weapon = AutoChgWeapon(); + } + SetCurrWeapon(next_weapon); AutoLoadingBullet(); } } @@ -1165,7 +1172,14 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance) int weapon_idx = GetCurrWeapon()->weapon_idx; *GetCurrWeapon() = Weapon(); GetCurrWeapon()->weapon_idx = weapon_idx; - SetCurrWeapon(ChooseNextWeapon(slot_id, SPEC2_IS_BEGIN, SPEC2_IS_END)); + Weapon* next_weapon = ChooseNextWeapon(slot_id, SPEC2_IS_BEGIN, SPEC2_IS_END); + if (!next_weapon) { + next_weapon = ChooseNextWeapon(SPEC1_IS_BEGIN, SPEC1_IS_BEGIN, SPEC1_IS_END); + } + if (!next_weapon) { + next_weapon = AutoChgWeapon(); + } + SetCurrWeapon(next_weapon); AutoLoadingBullet(); } } @@ -1448,7 +1462,7 @@ Weapon* Creature::ChooseNextWeapon(int curr_weapon_slot_id, int begin_slot_id, i break; } } - return next_weapon ? next_weapon : AutoChgWeapon(); + return next_weapon; } void Creature::SetCurrWeapon(Weapon* weapon)