From 6209d458f98c0f5e730e83ffdf9969078ff32d1b Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 18:54:20 +0300 Subject: [PATCH] A camera may contain a picture-painting demon Original patch by Leon Arnott --- doc/fixes35.0 | 1 + include/extern.h | 1 + src/dothrow.c | 18 ++++++++++++++++++ src/uhitm.c | 1 + 4 files changed, 21 insertions(+) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 0900fd8b7..ae084f321 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -898,6 +898,7 @@ cloned creatures (of any type) don't deathdrop items pudding corpses behave somewhat differently than before mithril armor should have silver color lichen corpse is an acid indicator +camera may contain a picture-painting demon Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 997885882..227396f54 100644 --- a/include/extern.h +++ b/include/extern.h @@ -497,6 +497,7 @@ E int FDECL(omon_adj, (struct monst *,struct obj *,BOOLEAN_P)); E int FDECL(thitmonst, (struct monst *,struct obj *)); E int FDECL(hero_breaks, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P)); E int FDECL(breaks, (struct obj *,XCHAR_P,XCHAR_P)); +E void FDECL(release_camera_demon, (struct obj *, XCHAR_P,XCHAR_P)); E void FDECL(breakobj, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P,BOOLEAN_P)); E boolean FDECL(breaktest, (struct obj *)); E boolean FDECL(walk_path, (coord *, coord *, boolean (*)(genericptr_t,int,int), genericptr_t)); diff --git a/src/dothrow.c b/src/dothrow.c index ab4b96497..679d49a6e 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1665,6 +1665,21 @@ xchar x, y; /* object location (ox, oy may not be right) */ return 1; } +void +release_camera_demon(obj, x,y) +struct obj *obj; +xchar x,y; +{ + struct monst *mtmp; + if (!rn2(3) && (mtmp = makemon(&mons[rn2(3) ? PM_HOMUNCULUS : PM_IMP],x,y, NO_MM_FLAGS)) != 0) { + if (canspotmon(mtmp)) + pline("%s is released!", Hallucination ? + An(rndmonnam(NULL)) : "The picture-painting demon"); + mtmp->mpeaceful = !obj->cursed; + set_malign(mtmp); + } +} + /* * Unconditionally break an object. Assumes all resistance checks * and break messages have been delivered prior to getting here. @@ -1707,6 +1722,9 @@ boolean from_invent; } /* monster breathing isn't handled... [yet?] */ break; + case EXPENSIVE_CAMERA: + release_camera_demon(obj, x,y); + break; case EGG: /* breaking your own eggs is bad luck */ if (hero_caused && obj->spe && obj->corpsenm >= LOW_PM) diff --git a/src/uhitm.c b/src/uhitm.c index 2bf963c94..50c0523f6 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -741,6 +741,7 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */ case EXPENSIVE_CAMERA: You("succeed in destroying %s. Congratulations!", ysimple_name(obj)); + release_camera_demon(obj, u.ux, u.uy); useup(obj); return(TRUE); /*NOTREACHED*/