Find
You are looking at the drunken dwarf
The drunken dwarf spends his days here in the tavern. No one knows much about him, since he doesn't speak the common language.
Created by
thorn
, last updated 01 Aug 2015
Code
if reacting to arrives then checkarrclass;
if second of gives then checkgift;
if target of hit then setwho;
##checkarrclass:
if $init_obj's class ne 'player' then donothing else amialive;
##amialive:
if $actor's health > 0 then checkown;
##checkgift:
$gmsg = "[$actor] shrugs at [$init_obj],'I can only accept gifts from my master.";
if $actor's owner ne $init_obj then giveitback else checkgiftw;
##checkgiftw:
$wrth = $actor's worth;
divide $wrth by 10;
$gmsg = "[$actor] shrugs at [$init_obj],'Sorry master, but I can not accept gifts worth more than $wrth pennies.";
if $target's worth > $wrth then giveitback else takegift;
##checkown:
if $actor's owner ne $init_obj then nothing else hello;
##hello:
// say 'msg',"[$actor] looks at [$init_obj] and says, 'Hello, master.'";
##giveitback:
say 'msg',"$gmsg";
set $target's loc to $loc;
set $target's pose to '';
say 'msg',"[$actor] drops [$target]";
relook $loc;
##takegift:
say 'msg',"[$actor] says,'Thank you, master.'";
find $actor,'pouch';
if $found_id > 0 then continue else makepouch;
set $target's loc to $found_id;
say 'msg',"[$actor] places [$target] inside [$found_id]";
##makepouch:
set $actor's pouch to 'treasure';
say 'msg',"[$actor] makes a pouch";
find $actor,'pouch';
##setwho:
set $actor's slot1 to $init_obj;
##tickloc:runsub ticked;
##tickhour2:runsub tickhoured;
##tickhoured:
if $actor's health > 0 then nothing else pretick;
##pretick:
set $actor's counter to 51;
runsub ticked;
##ticked:
$weapon is wielded by $actor;
if $weapon > 0 then keepweap else getweap;
if $actor's health > 0 then nothing else dead;
##dead:
if $actor's counter < 1 then justdied;
$cnt = $actor's counter;
add 1 to $cnt;
set $actor's counter to $cnt;
if $actor's counter > 50 then respawn;
##justdied:
$actdead = (slumps to the floor,gasps one last breath then falls,cries out in agony then is silent);
say 'msg',"[$actor] $actdead.";
find $actor,'pouch';
find $found_id,random;
if $found_id > 0 then treasure;
##respawn:
set $actor's pose to '';
set $actor's health to $actor's healthmax;
set $actor's counter to 0;
say 'msg',"[$actor] returns to life!";
call "use the wooden chair";
##treasure:
$who = $actor's slot1;
if $who > 0 then treasure1;
##treasure1:
$wrth = $found_id's worth;
copy $found_id;
set $found_id's worth to $wrth;
set $new_id's worth to $wrth;
set $new_id's loc to $loc;
set $new_id's pwd to '';
set $new_id's pose to '';
set $new_id's owner to $who;
say 'msg',"[$actor] drops [$new_id]";
relook $loc;
##keepweap:
if $actor's slot2 ne $weapon then keepweap2;
##keepweap2:
set $actor's slot2 to $weapon;
say 'msg',"[$actor] looks at [$weapon] and grins wickedly";
##getweap:
$weapon = $actor's slot2;
if $weapon > 0 then getweap2;
##getweap2:
if $weapon's loc eq $actor's loc then wieldit else whereisit;
##wieldit:
call "wield $weapon";
##whereisit:
say 'msg',"[$actor] looks around the room for [$weapon] but can't see it.";
set $actor's slot2 to '';