Adjusted pet walk speed (#4083)

* Added battle config pet_walk_speed.
* Resolves some pets walking too slow.
This commit is contained in:
Aleos 2019-04-11 18:49:07 -04:00 committed by GitHub
parent 9aa5f7d834
commit 06020502b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 5 deletions

View File

@ -78,3 +78,9 @@ pet_master_dead: no
// Send auto-feed notice even if the client setting is OFF (Note 1)
// Official: yes
pet_autofeed_always: yes
// Pet walk speed.
// 1: Master's walk speed (official)
// 2: DEFAULT_WALK_SPEED value
// 3: Mob database walk speed
pet_walk_speed: 1

View File

@ -8521,6 +8521,7 @@ static const struct _battle_data {
{ "min_shop_buy", &battle_config.min_shop_buy, 1, 0, INT_MAX, },
{ "min_shop_sell", &battle_config.min_shop_sell, 0, 0, INT_MAX, },
{ "feature.equipswitch", &battle_config.feature_equipswitch, 1, 0, 1, },
{ "pet_walk_speed", &battle_config.pet_walk_speed, 1, 1, 3, },
#include "../custom/battle_config_init.inc"
};

View File

@ -659,6 +659,7 @@ struct Battle_Config
int min_shop_buy;
int min_shop_sell;
int feature_equipswitch;
int pet_walk_speed;
#include "../custom/battle_config_struct.inc"
};

View File

@ -824,7 +824,7 @@ static TIMER_FUNC(pet_hungry){
if( pd->pet.intimate <= PET_INTIMATE_NONE ) {
pd->pet.intimate = PET_INTIMATE_NONE;
pd->status.speed = pd->db->status.speed;
pd->status.speed = pd->get_pet_walk_speed();
}
status_calc_pet(pd,SCO_NONE);
@ -1523,7 +1523,7 @@ int pet_food(struct map_session_data *sd, struct pet_data *pd)
if (pd->pet.intimate <= PET_INTIMATE_NONE) {
pd->pet.intimate = PET_INTIMATE_NONE;
pet_stop_attack(pd);
pd->status.speed = pd->db->status.speed;
pd->status.speed = pd->get_pet_walk_speed();
}
}
else {
@ -1668,11 +1668,11 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, t_t
}
// Return speed to normal.
if (pd->status.speed != pd->db->status.speed) {
if (pd->status.speed != pd->get_pet_walk_speed()) {
if (pd->ud.walktimer != INVALID_TIMER)
return 0; // Wait until the pet finishes walking back to master.
pd->status.speed = pd->db->status.speed;
pd->status.speed = pd->get_pet_walk_speed();
pd->ud.state.change_walk_target = pd->ud.state.speed_changed = 1;
}

View File

@ -9,6 +9,9 @@
#include "../common/mmo.hpp"
#include "../common/timer.hpp"
#include "battle.hpp"
#include "mob.hpp"
#include "pc.hpp"
#include "script.hpp"
#include "status.hpp"
#include "unit.hpp"
@ -167,6 +170,18 @@ struct pet_data {
std::shared_ptr<s_pet_db> get_pet_db() {
return pet_db.find(this->pet.class_);
}
int get_pet_walk_speed() {
switch (battle_config.pet_walk_speed) {
default:
case 1: // Master
return this->master->battle_status.speed;
case 2: // DEFAULT_WALK_SPEED
return DEFAULT_WALK_SPEED;
case 3: // Mob database
return this->db->status.speed;
}
}
};
bool pet_create_egg(struct map_session_data *sd, unsigned short item_id);

View File

@ -2969,7 +2969,7 @@ void status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt)
memcpy(&pd->status, &pd->db->status, sizeof(struct status_data));
pd->status.mode = MD_CANMOVE; // Pets discard all modes, except walking
pd->status.class_ = CLASS_NORMAL;
pd->status.speed = pd->db->status.speed;
pd->status.speed = pd->get_pet_walk_speed();
if(battle_config.pet_attack_support || battle_config.pet_damage_support) {
// Attack support requires the pet to be able to attack