summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-14 08:10:34 +0100
committerHaru <haru@dotalux.com>2020-04-05 21:20:35 +0200
commitaaa017e70e6ab8258c122ce19f5033a93a4350c3 (patch)
treefcdb0bea22775373a679da021f11bd00a74f76a3 /src/map/pet.c
parentdc5c2d65e81b648908cfdd45bbe718832518a5a3 (diff)
downloadhercules-aaa017e70e6ab8258c122ce19f5033a93a4350c3.tar.gz
hercules-aaa017e70e6ab8258c122ce19f5033a93a4350c3.tar.bz2
hercules-aaa017e70e6ab8258c122ce19f5033a93a4350c3.tar.xz
hercules-aaa017e70e6ab8258c122ce19f5033a93a4350c3.zip
Adjust pet intimacy calculation when feeding
Adjusted the hunger level depending intimacy calculation when feeding the pet, to be closer to offical behaviour. (Thanks to @hemagx again.)
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index c204c8930..0f22d373e 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -840,21 +840,24 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd)
}
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME);
- if (pd->pet.hungry > PET_HUNGER_SATISFIED) {
- pet->set_intimate(pd, pd->pet.intimate - pd->petDB->r_full);
- } else {
- int add_intimate = 0;
- if (battle_config.pet_friendly_rate != 100)
- add_intimate = (pd->petDB->r_hungry * battle_config.pet_friendly_rate)/100;
- else
- add_intimate = pd->petDB->r_hungry;
- if (pd->pet.hungry > PET_HUNGER_NEUTRAL) {
- add_intimate = add_intimate >> 1;
- if (add_intimate <= 0)
- add_intimate = 1;
- }
- pet->set_intimate(pd, pd->pet.intimate + add_intimate);
- }
+ int intimacy = 0;
+
+ if (pd->pet.hungry >= PET_HUNGER_STUFFED)
+ intimacy -= pd->petDB->r_full; // Decrease intimacy by OverFeedDecrement.
+ else if (pd->pet.hungry > PET_HUNGER_SATISFIED)
+ intimacy -= pd->petDB->r_full / 2; // Decrease intimacy by 50% of OverFeedDecrement.
+ else if (pd->pet.hungry > PET_HUNGER_NEUTRAL)
+ intimacy -= pd->petDB->r_full * 5 / 100; // Decrease intimacy by 5% of OverFeedDecrement.
+ else if (pd->pet.hungry > PET_HUNGER_HUNGRY)
+ intimacy += pd->petDB->r_hungry * 75 / 100; // Increase intimacy by 75% of FeedIncrement.
+ else if (pd->pet.hungry > PET_HUNGER_VERY_HUNGRY)
+ intimacy += pd->petDB->r_hungry; // Increase intimacy by FeedIncrement.
+ else
+ intimacy += pd->petDB->r_hungry / 2; // Increase intimacy by 50% of FeedIncrement.
+
+ intimacy *= battle_config.pet_friendly_rate / 100;
+ pet->set_intimate(pd, pd->pet.intimate + intimacy);
+
if (pd->pet.intimate == PET_INTIMACY_NONE) {
pet_stop_attack(pd);
pd->status.speed = pd->db->status.speed;