Ticket #1693: 0008-Add-raw-meat-to-help-offset-troll-appetite.patch

File 0008-Add-raw-meat-to-help-offset-troll-appetite.patch, 7.8 KB (added by daniel.santos, 7 years ago)
  • lib/edit/object.txt

    From bfaef7d3080844e61f6849bb9041c60c46ed36b0 Mon Sep 17 00:00:00 2001
    From: Daniel Santos <daniel.santos@pobox.com>
    Date: Sun, 21 Oct 2012 15:21:17 -0500
    Subject: [PATCH v2 08/11] Add raw meat to help offset troll appetite.
    
    Raw meat is yummy to orcs, trolls, et. al., but not so much for other
    races.  This patch actually uses a pretty poor mechanism for determining
    if the race likes this (basically, weight is over 225), but the rest is
    pretty descent.  For troll-types, it's just food.  For others, it has a
    chance to nourish if they are hungry; the hungrier they are, the greater
    the chance.  Otherwise, it will cause them to puke, but not as badly as
    salt water or some such.
    
    This also causes raw meat to occasionally drop from animals, but even
    this code is screwy (I've seen it drop from odd things).
    
    This patch adds these objects to the FOOD_FOOD tval, which it probably
    shouldn't.  I'm probably going to try to re-implement this with raw meat
    having it's own tval for simplification.
    ---
     lib/edit/object.txt    |   26 ++++++++++++++++++++++++--
     lib/pref/graf-dvg.prf  |    5 +++++
     lib/pref/graf-new.prf  |    5 +++++
     lib/pref/graf-nmd.prf  |    5 +++++
     lib/pref/graf-shb.prf  |    5 +++++
     lib/pref/graf-xxx.prf  |    5 +++++
     src/cmd-obj.c          |   17 +++++++++++++++++
     src/effects.c          |    7 +++++++
     src/list-effects.h     |    1 +
     src/monster/mon-make.c |   18 ++++++++++++++++++
     src/object/tvalsval.h  |    4 +++-
     11 files changed, 95 insertions(+), 3 deletions(-)
    
    diff --git a/lib/edit/object.txt b/lib/edit/object.txt
    index 4785f0a..837e986 100644
    a b L:7500 
    197197D:Food of the elves is always good; their waybread is no exception.  These 
    198198D: thin cakes are wrapped in leaves and keep their tastiness for months. 
    199199 
    200 # 13 
    201 # 14 
     200### Raw Meat ### 
     201 
     202N:13:& Slab~ of Meat 
     203G:,:r 
     204I:80:4 
     205W:1:0:8:2 
     206A:10:0 to 80 
     207M:50:1d3 
     208F:EASY_KNOW 
     209E:FOOD_MEAT 
     210L:5000 
     211D:A huge slab of raw meat, which most will not find palatable. 
     212 
     213N:14:& Chunk~ of Meat 
     214G:,:r 
     215I:80:5 
     216W:1:0:4:1 
     217A:10:5 to 90 
     218M:50:2d3 
     219F:EASY_KNOW 
     220E:FOOD_MEAT 
     221L:2500 
     222D:A chunk of raw meat, which most will not find palatable. 
     223 
    202224# 15 
    203225 
    204226### The shrooms, an interesting collection ### 
  • lib/pref/graf-dvg.prf

    diff --git a/lib/pref/graf-dvg.prf b/lib/pref/graf-dvg.prf
    index 8807aac..5461a7b 100644
    a b K:food:Ration of Food:0x82:0x84 
    20532053K:food:Slime Mold:0x82:0x85 
    20542054K:food:Piece of Elvish Waybread:0x82:0x86 
    20552055 
     2056### Raw Meat ### 
     2057 
     2058K:food:Slab of Meat:0x82:0x84 
     2059K:food:Chunk of Meat:0x82:0x83 
     2060 
    20562061 
    20572062### The shrooms, an interesting collection ### 
    20582063# Graphics are sourced from flavor entries in flvr-dvg.prf 
  • lib/pref/graf-new.prf

    diff --git a/lib/pref/graf-new.prf b/lib/pref/graf-new.prf
    index cf29b19..363c256 100644
    a b K:food:Ration of Food:0x8E:0x84 
    301301K:food:Slime Mold:0x8E:0x85 
    302302K:food:Piece of Elvish Waybread:0x8E:0x86 
    303303 
     304### Raw Meat ### 
     305 
     306K:food:Slab of Meat:0x8E:0x84 
     307K:food:Chunk of Meat:0x8E:0x85 
     308 
    304309 
    305310### The shrooms, an interesting collection ### 
    306311# Graphics are sourced from flavor entries in flvr-new.prf 
  • lib/pref/graf-nmd.prf

    diff --git a/lib/pref/graf-nmd.prf b/lib/pref/graf-nmd.prf
    index b4fb0b4..1b91cdc 100644
    a b K:food:Ration of Food:0x89:0x88 
    202202K:food:Slime Mold:0x89:0x89 
    203203K:food:Piece of Elvish Waybread:0x89:0x8A 
    204204 
     205### Raw Meat ### 
     206 
     207K:food:Slab of Meat:0x89:0x88 
     208K:food:Chunk of Meat:0x89:0x89 
     209 
    205210 
    206211### The shrooms, an interesting collection ### 
    207212# Graphics are sourced from flavor entries in flvr-new.prf 
  • lib/pref/graf-shb.prf

    diff --git a/lib/pref/graf-shb.prf b/lib/pref/graf-shb.prf
    index 3c5c9f2..9d47cb1 100644
    a b K:food:Ration of Food:0x82:0x84 
    167167K:food:Slime Mold:0x82:0x85 
    168168K:food:Piece of Elvish Waybread:0x82:0x86 
    169169 
     170### Raw Meat ### 
     171 
     172K:food:Slab of Meat:0x82:0x83 
     173K:food:Chunk of Meat:0x82:0x83 
     174 
    170175### The shrooms, an interesting collection ### 
    171176 
    172177# Graphics are sourced from flavor entries in flvr-dvg.prf 
  • lib/pref/graf-xxx.prf

    diff --git a/lib/pref/graf-xxx.prf b/lib/pref/graf-xxx.prf
    index 5dd2980..f23777f 100644
    a b K:food:Ration of Food:0x8B:0x82 
    320320K:food:Slime Mold:0x8A:0x9F 
    321321K:food:Piece of Elvish Waybread:0x8B:0x80 
    322322 
     323### Raw Meat ### 
     324 
     325K:food:Slab of Meat:0x8B:0x82 
     326K:food:Chunk of Meat:0x8A:0x9F 
     327 
    323328 
    324329### The shrooms, an interesting collection ### 
    325330# Graphics are sourced from flavor entries in flvr-xxx.prf 
  • src/cmd-obj.c

    diff --git a/src/cmd-obj.c b/src/cmd-obj.c
    index 9fc6ef9..50ce816 100644
    a b void do_cmd_use(cmd_code code, cmd_arg args[]) 
    643643                /* Boost damage effects if skill > difficulty */ 
    644644                boost = MAX(p_ptr->state.skills[SKILL_DEVICE] - level, 0); 
    645645 
     646                /* hack for raw meat */ 
     647                if (effect == EF_FOOD_MEAT) { 
     648                        /* Chance of normal player race stomaching raw meat depends upon 
     649                         * how hungry they are. 
     650                         * 
     651                         * FIXME: need better way of determining races who tollerates raw 
     652                         *        meat than weight 
     653                         */ 
     654                        if (p_ptr->wt < 225 && rand_range(PY_FOOD_FAINT, PY_FOOD_ALERT) < p_ptr->food) { 
     655 
     656                                /* small chance of being nourished */ 
     657                                food_value = rand_range(-(food_value * 100 / 10), 
     658                                                                                  food_value * 100 / 5); 
     659                        } else 
     660                                effect = EF_FOOD_GOOD; 
     661                } 
     662 
    646663                /* Do effect */ 
    647664                used = effect_do(effect, &ident, was_aware, dir, beam, boost); 
    648665 
  • src/effects.c

    diff --git a/src/effects.c b/src/effects.c
    index bb7e6b5..5fdddaf 100644
    a b bool effect_do(effect_type effect, bool *ident, bool aware, int dir, int beam, 
    16971697                        return TRUE; 
    16981698                } 
    16991699 
     1700                case EF_FOOD_MEAT: 
     1701                { 
     1702                        msg("The raw meat makes you vomit!"); 
     1703                        *ident = TRUE; 
     1704                        return TRUE; 
     1705                } 
     1706 
    17001707                case EF_FOOD_GOOD: 
    17011708                { 
    17021709                        msg("That tastes good."); 
  • src/list-effects.h

    diff --git a/src/list-effects.h b/src/list-effects.h
    index dbbf248..af5a903 100644
    a b EFFECT(DRINK_RUIN, FALSE, 0, "inflicts 10d10 points of damage and decreases 
    227227EFFECT(DRINK_DETONATE, FALSE,  0,       "inflicts 50d20 points of damage, severe cuts, and stunning") 
    228228EFFECT(FOOD_GOOD,      FALSE,  0,       NULL) 
    229229EFFECT(FOOD_WAYBREAD,  FALSE,  4,       "restores 4d8 hit points and neutralizes poison") 
     230EFFECT(FOOD_MEAT,      FALSE,  0,       NULL) 
    230231EFFECT(SHROOM_EMERGENCY, FALSE, 7,      "grants temporary resistance to fire and cold, cures 200HP, but also makes you hallucinate wildly") 
    231232EFFECT(SHROOM_TERROR,    FALSE, 5,      "speeds up you temporarily but also makes you mortally afraid") 
    232233EFFECT(SHROOM_STONE,     FALSE, 5,      "turns your skin to stone briefly, which grants an extra 40AC but slows you down") 
  • src/monster/mon-make.c

    diff --git a/src/monster/mon-make.c b/src/monster/mon-make.c
    index 8094140..d269d40 100644
    a b static bool mon_create_drop(int m_idx, byte origin) 
    631631                        any = TRUE; 
    632632        } 
    633633 
     634        /* hack -- sometimes drop meat for trolls & hungry players */ 
     635        if (rf_has(r_ptr->flags, RF_ANIMAL) 
     636                        && (p_ptr->wt > 225 || p_ptr->food < PY_FOOD_ALERT) 
     637                        && (randint0(100) < 5)) { 
     638                byte sval; 
     639 
     640                i_ptr = &object_type_body; 
     641                object_wipe(i_ptr); 
     642                sval = (byte)rand_range(SV_FOOD_MEAT_LARGE, SV_FOOD_MEAT_SMALL); 
     643                if(make_object(cave, i_ptr, level, 0, 0, NULL, TV_FOOD, sval)) { 
     644                        i_ptr->origin = origin; 
     645                        i_ptr->origin_depth = p_ptr->depth; 
     646                        i_ptr->origin_xtra = m_ptr->r_idx; 
     647                        if (monster_carry(m_ptr, i_ptr)) 
     648                                any = TRUE; 
     649                } 
     650        } 
     651 
    634652        return any; 
    635653} 
    636654 
  • src/object/tvalsval.h

    diff --git a/src/object/tvalsval.h b/src/object/tvalsval.h
    index 7ea4f90..7a1004a 100644
    a b enum sval_food /* tval 80 */ 
    323323{ 
    324324        SV_FOOD_RATION = 1, 
    325325        SV_FOOD_SLIME_MOLD = 2, 
    326         SV_FOOD_WAYBREAD = 3 
     326        SV_FOOD_WAYBREAD = 3, 
     327        SV_FOOD_MEAT_LARGE = 4, 
     328        SV_FOOD_MEAT_SMALL = 5 
    327329}; 
    328330 
    329331enum sval_gold /* tval 100 */