diff -Naur nethack-3.4.0-orig/src/objects.c nethack-3.4.0/src/objects.c
--- nethack-3.4.0-orig/src/objects.c 2002-03-20 18:43:12.000000000 -0500
+++ nethack-3.4.0/src/objects.c 2003-01-01 12:04:41.000000000 -0500
@@ -854,12 +854,12 @@
WAND("slow monster", "tin", 50, 150, 1, IMMEDIATE, METAL,
HI_METAL),
WAND("speed monster", "brass", 50, 150, 1, IMMEDIATE, COPPER,
HI_COPPER),
WAND("undead turning", "copper", 50, 150, 1, IMMEDIATE, COPPER,
HI_COPPER),
-WAND("polymorph", "silver", 45, 200, 1, IMMEDIATE, SILVER,
HI_SILVER),
+WAND("polymorph", "silver", 40, 200, 1, IMMEDIATE, SILVER,
HI_SILVER),
WAND("cancellation", "platinum", 45, 200, 1, IMMEDIATE, PLATINUM,
CLR_WHITE),
WAND("teleportation", "iridium", 45, 200, 1, IMMEDIATE, METAL,
CLR_BRIGHT_CYAN),
WAND("opening", "zinc", 25, 150, 1, IMMEDIATE, METAL,
HI_METAL),
WAND("locking", "aluminum", 25, 150, 1, IMMEDIATE, METAL,
HI_METAL),
-WAND("probing", "uranium", 30, 150, 1, IMMEDIATE, METAL,
HI_METAL),
+WAND("probing", "uranium", 25, 150, 1, IMMEDIATE, METAL,
HI_METAL),
WAND("digging", "iron", 55, 150, 1, RAY, IRON,
HI_METAL),
WAND("magic missile", "steel", 50, 150, 1, RAY, IRON,
HI_METAL),
WAND("fire", "hexagonal",40, 175, 1, RAY, IRON,
HI_METAL),
@@ -867,7 +867,7 @@
WAND("sleep", "runed", 50, 175, 1, RAY, IRON,
HI_METAL),
WAND("death", "long", 5, 500, 1, RAY, IRON,
HI_METAL),
WAND("lightning", "curved", 40, 175, 1, RAY, IRON,
HI_METAL),
-WAND((char *)0, "forked", 0, 150, 1, 0, WOOD,
HI_WOOD),
+WAND("untaming", "forked", 10, 150, 1, RAY, WOOD,
HI_WOOD),
WAND((char *)0, "spiked", 0, 150, 1, 0, IRON,
HI_METAL),
WAND((char *)0, "jeweled", 0, 150, 1, 0, IRON,
HI_MINERAL),
#undef WAND
diff -Naur nethack-3.4.0-orig/src/zap.c nethack-3.4.0/src/zap.c
--- nethack-3.4.0-orig/src/zap.c 2002-03-20 18:43:22.000000000 -0500
+++ nethack-3.4.0/src/zap.c 2003-01-01 12:33:07.000000000 -0500
@@ -325,6 +325,22 @@
}
}
break;
+ case WAN_UNTAMING:
+ if(mtmp->mtame){
+ if(mtmp->mpeaceful){
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ mtmp->mpeaceful = 0;
+ }
+ }else{
+ mtmp->mtame = 0;
+ mtmp->mpeaceful = (rnd(6) > Luck ? 0 : 1);
+ if(mtmp->mpeaceful){
+ pline("%s seems less docile.", Monnam(mtmp));
+ }else{
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ }
+ }
+ break;
default:
impossible("What an interesting effect (%d)", otyp);
break;
@@ -1659,6 +1675,8 @@
}
newsym(obj->ox,obj->oy);
break;
+ case WAN_UNTAMING:
+ break;
default:
impossible("What an interesting effect (%d)", otmp->otyp);
break;
@@ -2068,6 +2086,9 @@
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
break;
+ case WAN_UNTAMING:
+ You("feel restless.");
+ break;
case WAN_PROBING:
for (obj = invent; obj; obj = obj->nobj)
obj->dknown = 1;
@@ -2163,7 +2184,13 @@
(void) bhitm(u.usteed, obj);
steedhit = TRUE;
break;
-
+ case WAN_UNTAMING:
+ do{
+ struct monst *usteed = u.usteed;
+ dismount_steed(DISMOUNT_THROWN);
+ usteed->mtame = 0;
+ usteed->mpeaceful = (rnd(6) > Luck ? 0 : 1);
+ }while (0);
default:
steedhit = FALSE;
break;
@@ -2443,9 +2470,11 @@
buzz(otyp - WAN_MAGIC_MISSILE,
(otyp == WAN_MAGIC_MISSILE) ? 2 : 6,
u.ux, u.uy, u.dx, u.dy);
+ else if (otyp == WAN_UNTAMING)
+ { /* No-op */ }
else
impossible("weffects: unexpected spell or wand");
- disclose = TRUE;
+ disclose = !(otyp == WAN_UNTAMING);
}
if (disclose && was_unkn) {
makeknown(otyp);
--
Replace spamtrap with bd to reply.
Your job is being a professor and researcher: That's one hell of a good
excuse
for some of the brain-damages of minix.
(Linus Torvalds to Andrew Tanenbaum)
When adding new objects, insert them in the middle of the
list (says German Martin's writeup).
Search zap.c for WAN_LIGHTNING. You'll find one place
which hard-codes it as the very last wand, and another place which
hard-codes it as the very last simple attack wand. Your wand is
in the object list after WAN_LIGHTNING => your wand is not a wand
in all contexts.
--
Rob "did I beat Dylan?" Ellwood
>I've been trying to implement a wand of untaming with the patch below, but
>it only works when zapped down at a steed. There is no effect if zapped at
>a pet. What am I doing wrong?
>
>+WAND("untaming", "forked", 10, 150, 1, RAY, WOOD,
>HI_WOOD),
I've changed RAY to IMMEDIATE, and added mtmp->mtame=0 in the next
section, and it works.
>+ case WAN_UNTAMING:
>+ if(mtmp->mtame){
>+ if(mtmp->mpeaceful){
>+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
>+ mtmp->mpeaceful = 0;
>+ }
(Why does mtame not imply mpeaceful anyway? According to the source, it
should.)
--
Philipp Lucas
phl...@online-club.de
> On Wed, 01 Jan 2003 17:45:55 GMT, bd <spam...@bd-home-comp.no-ip.org>
> wrote:
>
>>I've been trying to implement a wand of untaming with the patch below, but
>>it only works when zapped down at a steed. There is no effect if zapped at
>>a pet. What am I doing wrong?
>>
>>+WAND("untaming", "forked", 10, 150, 1, RAY, WOOD,
>>HI_WOOD),
>
> I've changed RAY to IMMEDIATE, and added mtmp->mtame=0 in the next
> section, and it works.
Thanks. I've got it working, too, but when I zap mky starting kitten with
it, even though luck is 10 (and thus rn2(3) is less than Luck), I get:
The kitten seems less docile. The kitten hisses! The kitten bites!
When it should be peaceful. Why is this? Fixed patch follows:
diff -Naur nethack-3.4.0-orig/src/objects.c nethack-3.4.0/src/objects.c
--- nethack-3.4.0-orig/src/objects.c 2002-03-20 18:43:12.000000000 -0500
+++ nethack-3.4.0/src/objects.c 2003-01-01 14:07:44.000000000 -0500
+WAND("untaming", "forked", 10, 150, 1, IMMEDIATE, WOOD,
HI_WOOD),
WAND((char *)0, "spiked", 0, 150, 1, 0, IRON,
HI_METAL),
WAND((char *)0, "jeweled", 0, 150, 1, 0, IRON,
HI_MINERAL),
#undef WAND
diff -Naur nethack-3.4.0-orig/src/zap.c nethack-3.4.0/src/zap.c
--- nethack-3.4.0-orig/src/zap.c 2002-03-20 18:43:22.000000000 -0500
+++ nethack-3.4.0/src/zap.c 2003-01-01 14:12:49.000000000 -0500
@@ -325,6 +325,22 @@
}
}
break;
+ case WAN_UNTAMING:
+ if(!mtmp->mtame){
+ if(mtmp->mpeaceful){
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ mtmp->mpeaceful = 0;
+ }
+ }else{
+ mtmp->mtame = 0;
+ mtmp->mpeaceful = (rn2(3) > Luck ? 0 : 1);
+ if(mtmp->mpeaceful){
+ pline("%s seems less docile.", Monnam(mtmp));
+ }else{
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ }
+ usteed->mpeaceful = (rn2(3) > Luck ? 0 : 1);
+ }while (0);
default:
steedhit = FALSE;
break;
@@ -2443,9 +2470,11 @@
buzz(otyp - WAN_MAGIC_MISSILE,
(otyp == WAN_MAGIC_MISSILE) ? 2 : 6,
u.ux, u.uy, u.dx, u.dy);
+ else if (otyp == WAN_UNTAMING)
+ { /* No-op */ }
else
impossible("weffects: unexpected spell or wand");
- disclose = TRUE;
+ disclose = !(otyp == WAN_UNTAMING);
}
if (disclose && was_unkn) {
makeknown(otyp);
--
Replace spamtrap with bd to reply.
People love high ideals, but they got to be about 33-percent plausible.
-- The Best of Will Rogers
Other than calling it a wand of `untaming'?
The most obvious thing is that you defined your new wand using RAY instead of
IMMEDIATE, which is almost certainly what you wanted. I'll see what I can do
in the patch below: (not compiled)
Index: src/engrave.c
===================================================================
RCS file: /home/sam/v/cvsroot/nethack/src/engrave.c,v
retrieving revision 1.3
diff -u -r1.3 engrave.c
--- src/engrave.c 19 Oct 2002 02:21:53 -0000 1.3
+++ src/engrave.c 1 Jan 2003 18:52:44 -0000
@@ -616,6 +616,7 @@
* previous engraving even if turning to dust.
*/
case WAN_STRIKING:
+ case WAN_UNTAMING:
Strcpy(post_engr_text,
"The wand unsuccessfully fights your attempt to write!"
);
Index: src/objects.c
===================================================================
RCS file: /home/sam/v/cvsroot/nethack/src/objects.c,v
retrieving revision 1.3
diff -u -r1.3 objects.c
--- src/objects.c 19 Oct 2002 02:21:53 -0000 1.3
+++ src/objects.c 1 Jan 2003 18:41:45 -0000
@@ -854,12 +854,12 @@
WAND("slow monster", "tin", 50, 150, 1, IMMEDIATE, METAL, HI_METAL),
WAND("speed monster", "brass", 50, 150, 1, IMMEDIATE, COPPER, HI_COPPER),
WAND("undead turning", "copper", 50, 150, 1, IMMEDIATE, COPPER, HI_COPPER),
-WAND("polymorph", "silver", 45, 200, 1, IMMEDIATE, SILVER, HI_SILVER),
+WAND("polymorph", "silver", 40, 200, 1, IMMEDIATE, SILVER, HI_SILVER),
WAND("cancellation", "platinum", 45, 200, 1, IMMEDIATE, PLATINUM, CLR_WHITE),
WAND("teleportation", "iridium", 45, 200, 1, IMMEDIATE, METAL, CLR_BRIGHT_CYAN),
WAND("opening", "zinc", 25, 150, 1, IMMEDIATE, METAL, HI_METAL),
WAND("locking", "aluminum", 25, 150, 1, IMMEDIATE, METAL, HI_METAL),
-WAND("probing", "uranium", 30, 150, 1, IMMEDIATE, METAL, HI_METAL),
+WAND("probing", "uranium", 25, 150, 1, IMMEDIATE, METAL, HI_METAL),
WAND("digging", "iron", 55, 150, 1, RAY, IRON, HI_METAL),
WAND("magic missile", "steel", 50, 150, 1, RAY, IRON, HI_METAL),
WAND("fire", "hexagonal",40, 175, 1, RAY, IRON, HI_METAL),
@@ -867,7 +867,7 @@
WAND("sleep", "runed", 50, 175, 1, RAY, IRON, HI_METAL),
WAND("death", "long", 5, 500, 1, RAY, IRON, HI_METAL),
WAND("lightning", "curved", 40, 175, 1, RAY, IRON, HI_METAL),
-WAND((char *)0, "forked", 0, 150, 1, 0, WOOD, HI_WOOD),
+WAND("untaming", "forked", 10, 150, 1, IMMEDIATE, WOOD, HI_WOOD),
WAND((char *)0, "spiked", 0, 150, 1, 0, IRON, HI_METAL),
WAND((char *)0, "jeweled", 0, 150, 1, 0, IRON, HI_MINERAL),
#undef WAND
Index: src/zap.c
===================================================================
RCS file: /home/sam/v/cvsroot/nethack/src/zap.c,v
retrieving revision 1.3
diff -u -r1.3 zap.c
--- src/zap.c 19 Oct 2002 02:21:53 -0000 1.3
+++ src/zap.c 1 Jan 2003 18:53:12 -0000
@@ -325,6 +325,23 @@
}
}
break;
+ case WAN_UNTAMING:
+ if(!mtmp->mtame){
+ if(mtmp->mpeaceful){
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ mtmp->mpeaceful = 0;
+ }
+ }else{
+ mtmp->mtame = 0;
+ mtmp->mpeaceful = (rnd(6) > Luck ? 0 : 1);
+ if(mtmp->mpeaceful){
+ pline("%s seems less docile.", Monnam(mtmp));
+ }else{
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ }
+ }
+ makeknown(otmp->otyp);
+ break;
default:
impossible("What an interesting effect (%d)", otyp);
break;
@@ -1659,6 +1676,9 @@
}
newsym(obj->ox,obj->oy);
break;
+ case WAN_UNTAMING:
+ res = 0;
+ break;
default:
impossible("What an interesting effect (%d)", otmp->otyp);
break;
@@ -2068,6 +2088,9 @@
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
break;
+ case WAN_UNTAMING:
+ You("feel restless.");
+ break;
case WAN_PROBING:
for (obj = invent; obj; obj = obj->nobj)
obj->dknown = 1;
@@ -2142,6 +2165,10 @@
makeknown(obj->otyp);
steedhit = TRUE;
break;
+
+ case WAN_UNTAMING:
+ dismount_steed(DISMOUNT_THROWN);
+ /* fall through */
/* Default processing via bhitm() for these */
case SPE_CURE_SICKNESS:
--
++acr@,ka"
I was posting a patch to your patch, but I was zapped in the process,
and am no longer tame.
Hey, my hand is glowing! I can untame others! :)
hawk
--
Richard E. Hawkins, Asst. Prof. of Economics /"\ ASCII ribbon campaign
doc...@psu.edu Smeal 178 (814) 375-4700 \ / against HTML mail
These opinions will not be those of X and postings.
Penn State until it pays my retainer. / \
You need a 'wake = FALSE;' in the zap effect code. "/* wakeup() makes
the target angry */" if the monster's not tame, and the waking is
being done after the untaming.
--
: Dylan O'Donnell http://www.spod-central.org/~psmith/ :
: "And woe betide the olivador whose olive is revoltosa." :
: -- Michael Flanders, "At the Drop of Another Hat" :
> bd <spam...@bd-home-comp.no-ip.org> writes:
>> Thanks. I've got it working, too, but when I zap mky starting kitten with
>> it, even though luck is 10 (and thus rn2(3) is less than Luck), I get:
>> The kitten seems less docile. The kitten hisses! The kitten bites!
>>
>> When it should be peaceful. Why is this? Fixed patch follows:
>
> You need a 'wake = FALSE;' in the zap effect code. "/* wakeup() makes
> the target angry */" if the monster's not tame, and the waking is
> being done after the untaming.
>
Thanks, that worked.
Fixed patch is below, for anyone who wants to use it:
+++ nethack-3.4.0/src/zap.c 2003-01-01 20:23:09.000000000 -0500
@@ -325,6 +325,23 @@
}
}
break;
+ case WAN_UNTAMING:
+ if(!mtmp->mtame){
+ if(mtmp->mpeaceful){
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ mtmp->mpeaceful = 0;
+ }
+ }else{
+ mtmp->mtame = 0;
+ mtmp->mpeaceful = (rn2(3) > Luck ? 0 : 1);
+ if(mtmp->mpeaceful){
+ pline("%s seems less docile.", Monnam(mtmp));
+ }else{
+ pline("%s gets a red gleam in its eyes!", Monnam(mtmp));
+ }
+ }
+ wake = FALSE;
+ break;
default:
impossible("What an interesting effect (%d)", otyp);
break;
@@ -1659,6 +1676,8 @@
}
newsym(obj->ox,obj->oy);
break;
+ case WAN_UNTAMING:
+ break;
default:
impossible("What an interesting effect (%d)", otmp->otyp);
break;
@@ -2068,6 +2087,9 @@
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
break;
+ case WAN_UNTAMING:
+ You("feel restless.");
+ break;
case WAN_PROBING:
for (obj = invent; obj; obj = obj->nobj)
obj->dknown = 1;
@@ -2163,7 +2185,13 @@
(void) bhitm(u.usteed, obj);
steedhit = TRUE;
break;
-
+ case WAN_UNTAMING:
+ do{
+ struct monst *usteed = u.usteed;
+ dismount_steed(DISMOUNT_THROWN);
+ usteed->mtame = 0;
+ usteed->mpeaceful = (rn2(3) > Luck ? 0 : 1);
+ }while (0);
default:
steedhit = FALSE;
break;
@@ -2443,9 +2471,11 @@
buzz(otyp - WAN_MAGIC_MISSILE,
(otyp == WAN_MAGIC_MISSILE) ? 2 : 6,
u.ux, u.uy, u.dx, u.dy);
+ else if (otyp == WAN_UNTAMING)
+ { /* No-op */ }
else
impossible("weffects: unexpected spell or wand");
- disclose = TRUE;
+ disclose = !(otyp == WAN_UNTAMING);
}
if (disclose && was_unkn) {
makeknown(otyp);
--
Replace spamtrap with bd to reply.
"If John Madden steps outside on February 2, looks down, and doesn't see his
feet, we'll have 6 more weeks of Pro football."
-- Chuck Newcombe