From dc4328d040269cdb32f50c729ada4fad392499b4 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 15 Feb 2020 01:18:53 +0100 Subject: Add new field HungerDecrement to pet DB --- db/pre-re/pet_db.conf | 1 + db/re/pet_db.conf | 1 + src/map/pet.c | 8 +++++++- src/map/pet.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/db/pre-re/pet_db.conf b/db/pre-re/pet_db.conf index ea8059154..a2a143b9e 100644 --- a/db/pre-re/pet_db.conf +++ b/db/pre-re/pet_db.conf @@ -42,6 +42,7 @@ pet_db:( FoodItem: Food Id (string, defaults to "Pet_Food" (ID=537)) FoodEffectiveness: hunger points (int, defaults to 80) HungerDelay: hunger time (int, defaults to 60) + HungerDecrement: hunger points (int, defaults to 1) Intimacy: { Initial: start intimacy (int, defaults to 250) FeedIncrement: feeding intimacy (int, defaults to 10) diff --git a/db/re/pet_db.conf b/db/re/pet_db.conf index 34bb535db..9f980481b 100644 --- a/db/re/pet_db.conf +++ b/db/re/pet_db.conf @@ -42,6 +42,7 @@ pet_db:( FoodItem: Food Id (string, defaults to "Pet_Food" (ID=537)) FoodEffectiveness: hunger points (int, defaults to 80) HungerDelay: hunger time (int, defaults to 60) + HungerDecrement: hunger points (int, defaults to 1) Intimacy: { Initial: start intimacy (int, defaults to 250) FeedIncrement: feeding intimacy (int, defaults to 10) 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; -- cgit v1.2.3-70-g09d2