diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-10-30 16:39:25 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-10-30 16:39:25 +0800 |
commit | fe25f26ae3f2539228b93412d4bd26c769766299 (patch) | |
tree | 966ac9b4fc067bf51031cba34f863c670b9c42d7 | |
parent | 3441bba90ace14c53681e034fd82915de6924969 (diff) | |
download | pttbbs-fe25f26ae3f2539228b93412d4bd26c769766299.tar pttbbs-fe25f26ae3f2539228b93412d4bd26c769766299.tar.gz pttbbs-fe25f26ae3f2539228b93412d4bd26c769766299.tar.bz2 pttbbs-fe25f26ae3f2539228b93412d4bd26c769766299.tar.lz pttbbs-fe25f26ae3f2539228b93412d4bd26c769766299.tar.xz pttbbs-fe25f26ae3f2539228b93412d4bd26c769766299.tar.zst pttbbs-fe25f26ae3f2539228b93412d4bd26c769766299.zip |
Adjust ch.getting_old formula.
We want to fix the overflow bug in future.
But before that, we should make the whole getting old calculation more feasible
since most people can't access their pets every 6 hours. (Or, we can say,
the chicken now is different from how it was invented before - it's now a more
long-term game for most people)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5886 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/chicken.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/pttbbs/mbbsd/chicken.c b/pttbbs/mbbsd/chicken.c index 9c8c1123..5e684487 100644 --- a/pttbbs/mbbsd/chicken.c +++ b/pttbbs/mbbsd/chicken.c @@ -495,16 +495,23 @@ ch_kill(chicken_t *mychicken) static void ch_getting_old(int *hp, int *weight, int diff, int age) { - float ex = 0.9; - - if (age > 70) - ex = 0.1; - else if (age > 30) + float ex = 0.9, care_hours = 6; + + if (age > 180) { + ex = 0.1; + care_hours = 7 * 24; + } else if (age > 70) { + ex = 0.2; + care_hours = 96; + } else if (age > 45) { ex = 0.5; - else if (age > 20) - ex = 0.7; + care_hours = 48; + } else if (age > 20) { + ex = 0.8; + care_hours = 24; + } - diff /= 60 * 6; + diff /= (care_hours * 60); while (diff--) { *hp *= ex; *weight *= ex; @@ -516,7 +523,7 @@ static void time_diff(chicken_t * thechicken) { int diff; - int theage = ((now - thechicken->cbirth) / (60 * 60 * 24)); + int theage = ((now - thechicken->cbirth) / DAY_SECONDS); const short *delta = time_change[(int)thechicken->type]; thechicken->type %= NUM_KINDS; @@ -958,7 +965,7 @@ chicken_main(void) } } assert(mychicken); - age = ((now - mychicken->cbirth) / (60 * 60 * 24)); + age = ((now - mychicken->cbirth) / DAY_SECONDS); do { time_diff(mychicken); if (isdeath(mychicken, mychicken)) |