diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-15 01:18:53 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-04-05 21:20:35 +0200 |
commit | dc4328d040269cdb32f50c729ada4fad392499b4 (patch) | |
tree | f73d4a51b3bde1c821807494577fa83cce54e394 /src | |
parent | d9735f603c311a78062c9ebf4a10e1da204a5c75 (diff) | |
download | hercules-dc4328d040269cdb32f50c729ada4fad392499b4.tar.gz hercules-dc4328d040269cdb32f50c729ada4fad392499b4.tar.bz2 hercules-dc4328d040269cdb32f50c729ada4fad392499b4.tar.xz hercules-dc4328d040269cdb32f50c729ada4fad392499b4.zip |
Add new field HungerDecrement to pet DB
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pet.c | 8 | ||||
-rw-r--r-- | src/map/pet.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index 90cab5626..5f2fb429f 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -263,7 +263,7 @@ static int pet_hungry(int tid, int64 tick, int id, intptr_t data) if (pd->pet.intimate <= PET_INTIMACY_NONE) return 1; //You lost the pet already, the rest is irrelevant. - pd->pet.hungry--; + pd->pet.hungry -= pd->petDB->hunger_decrement; /* Pet Autofeed */ if (battle_config.feature_enable_pet_autofeed != 0) { if (pd->petDB->autofeed == 1 && pd->pet.autofeed == 1 && pd->pet.hungry <= PET_HUNGER_HUNGRY) { @@ -1409,6 +1409,12 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc ret = libconfig->setting_lookup_int(it, "HungerDelay", &i32); pet->db[n].hungry_delay = (ret == CONFIG_FALSE) ? 60000 : cap_value(1000 * i32, 0, INT_MAX); + ret = libconfig->setting_lookup_int(it, "HungerDecrement", &i32); + pet->db[n].hunger_decrement = (ret == CONFIG_FALSE) ? 1 : cap_value(i32, PET_HUNGER_STARVING, PET_HUNGER_STUFFED - 1); + + if (pet->db[n].hunger_decrement == PET_HUNGER_STARVING) + pet->db[n].hungry_delay = 0; + /** * Preventively set default intimacy values here, just in case that 'Intimacy' block is not defined, * or pet_read_db_sub_intimacy() fails execution. diff --git a/src/map/pet.h b/src/map/pet.h index e0a5529a6..7b653938e 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -57,6 +57,7 @@ struct s_pet_db { int defence_attack_rate; int change_target_rate; int autofeed; + int hunger_decrement; struct script_code *equip_script; struct script_code *pet_script; |