Advertisement
Guest User

NetHack ice cream patch

a guest
Oct 15th, 2023
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 9.70 KB | None | 0 0
  1. diff --git a/src/dig.c b/src/dig.c
  2. index 9b91f98..4efc489 100644
  3. --- a/src/dig.c
  4. +++ b/src/dig.c
  5. @@ -1869,7 +1869,7 @@ boolean *dealloced;
  6.       * Start a rot on organic material.  Not corpses -- they
  7.       * are already handled.
  8.       */
  9. -    if (otmp->otyp == CORPSE) {
  10. +    if (otmp->otyp == CORPSE || otmp->otyp == ICE_CREAM) {
  11.          ; /* should cancel timer if under_ice */
  12.      } else if ((under_ice ? otmp->oclass == POTION_CLASS : is_organic(otmp))
  13.                 && !obj_resists(otmp, 5, 95)) {
  14. @@ -2001,10 +2001,15 @@ long timeout;
  15.          y = obj->oy;
  16.      } else if (in_invent) {
  17.          if (flags.verbose) {
  18. -            char *cname = corpse_xname(obj, (const char *) 0, CXN_NO_PFX);
  19. +            char *cname;
  20. +            if (obj->otyp == CORPSE)
  21. +                cname = corpse_xname(obj, (const char *) 0, CXN_NO_PFX);
  22. +            else
  23. +                cname = xname(obj);
  24.  
  25.              Your("%s%s %s away%c", obj == uwep ? "wielded " : "", cname,
  26. -                 otense(obj, "rot"), obj == uwep ? '!' : '.');
  27. +                 otense(obj, obj->otyp == ICE_CREAM ? "melt" : "rot"),
  28. +                 obj == uwep ? '!' : '.');
  29.          }
  30.          if (obj == uwep) {
  31.              uwepgone(); /* now bare handed */
  32. diff --git a/src/dog.c b/src/dog.c
  33. index 5c50eb6..c68dd24 100644
  34. --- a/src/dog.c
  35. +++ b/src/dog.c
  36. @@ -827,6 +827,10 @@ register struct obj *obj;
  37.                        : (herbi || starving)
  38.                           ? ACCFOOD
  39.                           : MANFOOD;
  40. +        case ICE_CREAM:
  41. +            if (carni && resists_cold(mon))
  42. +                return DOGFOOD;
  43. +            /* else fallthrough */
  44.          default:
  45.              if (starving)
  46.                  return ACCFOOD;
  47. diff --git a/src/eat.c b/src/eat.c
  48. index 5e2aa1a..654776d 100644
  49. --- a/src/eat.c
  50. +++ b/src/eat.c
  51. @@ -333,6 +333,9 @@ struct obj *otmp;
  52.      } else if (otmp->otyp == CRAM_RATION) {
  53.          if (maybe_polyd(is_dwarf(youmonst.data), Race_if(PM_DWARF)))
  54.              nut += nut / 6; /* 600 -> 700 */
  55. +    } else if (otmp->otyp == ICE_CREAM) {
  56. +        if (Cold_resistance)
  57. +            nut += nut / 4; /* 200 -> 250 */
  58.      }
  59.      return nut;
  60.  }
  61. @@ -2665,13 +2668,16 @@ doeat()
  62.          default:
  63.              if (otmp->otyp == PANCAKE || otmp->otyp == FORTUNE_COOKIE /*eggs*/
  64.                  || otmp->otyp == CREAM_PIE || otmp->otyp == CANDY_BAR /*milk*/
  65. +                || otmp->otyp == ICE_CREAM /* both */
  66.                  || otmp->otyp == LUMP_OF_ROYAL_JELLY)
  67.                  u.uconduct.unvegan++;
  68.              break;
  69.          }
  70.  
  71.          context.victual.reqtime = objects[otmp->otyp].oc_delay;
  72. -        if (otmp->otyp != FORTUNE_COOKIE
  73. +        if (otmp->otyp == ICE_CREAM && Cold_resistance)
  74. +            context.victual.reqtime /= 2;
  75. +        if (otmp->otyp != FORTUNE_COOKIE && otmp->otyp != ICE_CREAM
  76.              && (otmp->cursed || (!nonrotting_food(otmp->otyp)
  77.                                   && (monstermoves - otmp->age)
  78.                                          > (otmp->blessed ? 50L : 30L)
  79. diff --git a/src/mklev.c b/src/mklev.c
  80. index 7493042..0881619 100644
  81. --- a/src/mklev.c
  82. +++ b/src/mklev.c
  83. @@ -989,6 +989,7 @@ mklev()
  84.  {
  85.      struct mkroom *croom;
  86.      int ridx;
  87. +    short ice_cream_prob;
  88.  
  89.      reseed_random(rn2);
  90.      reseed_random(rn2_on_display_rng);
  91. @@ -998,10 +999,16 @@ mklev()
  92.          return;
  93.  
  94.      in_mklev = TRUE;
  95. +    /* no ice cream on the floor, as realistically it'd melt */
  96. +    ice_cream_prob = objects[ICE_CREAM].oc_prob;
  97. +    objects[ICE_CREAM].oc_prob = 0;
  98. +    objects[FOOD_RATION].oc_prob += ice_cream_prob; /* rations instead */
  99.      makelevel();
  100.      bound_digging();
  101.      mineralize(-1, -1, -1, -1, FALSE);
  102.      in_mklev = FALSE;
  103. +    objects[ICE_CREAM].oc_prob = ice_cream_prob; /* restore */
  104. +    objects[FOOD_RATION].oc_prob -= ice_cream_prob;
  105.      /* has_morgue gets cleared once morgue is entered; graveyard stays
  106.         set (graveyard might already be set even when has_morgue is clear
  107.         [see fixup_special()], so don't update it unconditionally) */
  108. diff --git a/src/mkobj.c b/src/mkobj.c
  109. index 17265ff..a0b8ece 100644
  110. --- a/src/mkobj.c
  111. +++ b/src/mkobj.c
  112. @@ -308,7 +308,7 @@ struct obj *box;
  113.  
  114.      for (n = rn2(n + 1); n > 0; n--) {
  115.          if (box->otyp == ICE_BOX) {
  116. -            otmp = mksobj(CORPSE, TRUE, TRUE);
  117. +            otmp = mksobj(rn2(10) ? CORPSE : ICE_CREAM, TRUE, TRUE);
  118.              /* Note: setting age to 0 is correct.  Age has a different
  119.               * from usual meaning for objects stored in ice boxes. -KAA
  120.               */
  121. @@ -1089,6 +1089,8 @@ boolean artif;
  122.      /* case TIN: */
  123.          set_corpsenm(otmp, otmp->corpsenm);
  124.          break;
  125. +    case ICE_CREAM:
  126. +        (void) start_timer(200 + rnz(10), TIMER_OBJECT, ROT_CORPSE, obj_to_any(otmp));
  127.      case POT_OIL:
  128.          otmp->age = MAX_OIL_IN_FLASK; /* amount of oil */
  129.          /*FALLTHRU*/
  130. @@ -1856,7 +1858,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
  131.      boolean buried = (otmp->where == OBJ_BURIED);
  132.  
  133.      /* Check for corpses just placed on or in ice */
  134. -    if (otmp->otyp == CORPSE && (on_floor || buried) && is_ice(x, y)) {
  135. +    if ((otmp->otyp == CORPSE || otmp->otyp == ICE_CREAM)
  136. +        && (on_floor || buried) && is_ice(x, y)) {
  137.          tleft = stop_timer(action, obj_to_any(otmp));
  138.          if (tleft == 0L) {
  139.              action = REVIVE_MON;
  140. @@ -1882,7 +1885,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
  141.          }
  142.  
  143.      /* Check for corpses coming off ice */
  144. -    } else if (force < 0 || (otmp->otyp == CORPSE && otmp->on_ice
  145. +    } else if (force < 0 || ((otmp->otyp == CORPSE || otmp->otyp == ICE_CREAM)
  146. +                             && otmp->on_ice
  147.                               && !((on_floor || buried) && is_ice(x, y)))) {
  148.          tleft = stop_timer(action, obj_to_any(otmp));
  149.          if (tleft == 0L) {
  150. diff --git a/src/objects.c b/src/objects.c
  151. index fcca3b0..b2657e7 100644
  152. --- a/src/objects.c
  153. +++ b/src/objects.c
  154. @@ -771,12 +771,14 @@ FOOD("slime mold",           75,  1,  5, 0, VEGGY, 250, HI_ORGANIC),
  155.  /* people food */
  156.  FOOD("lump of royal jelly",   0,  1,  2, 0, VEGGY, 200, CLR_YELLOW),
  157.  FOOD("cream pie",            25,  1, 10, 0, VEGGY, 100, CLR_WHITE),
  158. +/* ice cream becomes 1 delay and 250 nutrition with cold resistance */
  159. +FOOD("ice cream",            30,  2,  2, 0, VEGGY, 200, CLR_WHITE),
  160.  FOOD("candy bar",            13,  1,  2, 0, VEGGY, 100, CLR_BROWN),
  161.  FOOD("fortune cookie",       55,  1,  1, 0, VEGGY,  40, CLR_YELLOW),
  162.  FOOD("pancake",              25,  2,  2, 0, VEGGY, 200, CLR_YELLOW),
  163.  FOOD("lembas wafer",         20,  2,  5, 0, VEGGY, 800, CLR_WHITE),
  164.  FOOD("cram ration",          20,  3, 15, 0, VEGGY, 600, HI_ORGANIC),
  165. -FOOD("food ration",         380,  5, 20, 0, VEGGY, 800, HI_ORGANIC),
  166. +FOOD("food ration",         350,  5, 20, 0, VEGGY, 800, HI_ORGANIC),
  167.  FOOD("K-ration",              0,  1, 10, 0, VEGGY, 400, HI_ORGANIC),
  168.  FOOD("C-ration",              0,  1, 10, 0, VEGGY, 300, HI_ORGANIC),
  169.  /* tins have type specified by obj->spe (+1 for spinach, other implies
  170. diff --git a/src/pickup.c b/src/pickup.c
  171. index 76f35aa..c0e3f64 100644
  172. --- a/src/pickup.c
  173. +++ b/src/pickup.c
  174. @@ -2218,7 +2218,7 @@ register struct obj *obj;
  175.      if (Icebox && !age_is_relative(obj)) {
  176.          obj->age = monstermoves - obj->age; /* actual age */
  177.          /* stop any corpse timeouts when frozen */
  178. -        if (obj->otyp == CORPSE && obj->timed) {
  179. +        if ((obj->otyp == CORPSE || obj->otyp == ICE_CREAM) && obj->timed) {
  180.              long rot_alarm = stop_timer(ROT_CORPSE, obj_to_any(obj));
  181.  
  182.              (void) stop_timer(REVIVE_MON, obj_to_any(obj));
  183. diff --git a/src/u_init.c b/src/u_init.c
  184. index 77e7445..ee23744 100644
  185. --- a/src/u_init.c
  186. +++ b/src/u_init.c
  187. @@ -191,6 +191,8 @@ static struct trobj Leash[] = { { LEASH, 0, TOOL_CLASS, 1, 0 },
  188.                                  { 0, 0, 0, 0, 0 } };
  189.  static struct trobj Towel[] = { { TOWEL, 0, TOOL_CLASS, 1, 0 },
  190.                                  { 0, 0, 0, 0, 0 } };
  191. +static struct trobj Icecream[] = { { ICE_CREAM, 0, FOOD_CLASS, 1, 0 },
  192. +                                   { 0, 0, 0, 0, 0 } };
  193.  static struct trobj Wishing[] = { { WAN_WISHING, 3, WAND_CLASS, 1, 0 },
  194.                                    { 0, 0, 0, 0, 0 } };
  195.  static struct trobj Money[] = { { GOLD_PIECE, 0, COIN_CLASS, 1, 0 },
  196. @@ -782,6 +784,8 @@ u_init()
  197.          ini_inv(Valkyrie);
  198.          if (!rn2(6))
  199.              ini_inv(Lamp);
  200. +        else if (!rn2(5))
  201. +            ini_inv(Icecream);
  202.          knows_class(WEAPON_CLASS);
  203.          knows_class(ARMOR_CLASS);
  204.          skill_init(Skill_V);
  205. diff --git a/src/zap.c b/src/zap.c
  206. index 1c7a5de..bf531d8 100644
  207. --- a/src/zap.c
  208. +++ b/src/zap.c
  209. @@ -4858,7 +4858,7 @@ int osym, dmgtyp;
  210.              dmg = 1;
  211.              break;
  212.          case FOOD_CLASS:
  213. -            if (obj->otyp == GLOB_OF_GREEN_SLIME) {
  214. +            if (obj->otyp == GLOB_OF_GREEN_SLIME || obj->otyp == ICE_CREAM) {
  215.                  dindx = 1; /* boil and explode */
  216.                  dmg = (obj->owt + 19) / 20;
  217.              } else {
  218. diff --git a/win/share/objects.txt b/win/share/objects.txt
  219. index 15c6181..39a0336 100644
  220. --- a/win/share/objects.txt
  221. +++ b/win/share/objects.txt
  222. @@ -5062,6 +5062,25 @@ Z = (195, 195, 195)
  223.    ................
  224.    ................
  225.  }
  226. +# tile 265 (ice cream)
  227. +{
  228. +  ................
  229. +  ......NNM.......
  230. +  ....MNNNNMO.....
  231. +  ...MNNNNNNMO....
  232. +  ...MNNNNNNNMA...
  233. +  ...NLHLHLHLMQ...
  234. +  ....HLHLHLHA....
  235. +  ....LHLHLHAQ....
  236. +  .....LHLHLA.....
  237. +  .....HLHLHA.....
  238. +  .....LHLHAQ.....
  239. +  ......LHLA......
  240. +  ......HLHA......
  241. +  ......LHA.......
  242. +  .......LA.......
  243. +  .......A........
  244. +}
  245.  # tile 265 (candy bar)
  246.  {
  247.    ................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement