* Copyright (c) 1983 Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
static char sccsid
[] = "@(#)com7.c 5.3 (Berkeley) 6/1/90";
exhaustion
= CYCLE
/(snooze
- time
);
puts("You collapse exhausted, and he pulverizes your skull.");
puts("You look tired! I hope you're able to fight.");
next
= getcom(auxbuf
, LINELENGTH
, "<fight!>-: ", 0);
for (i
=0; next
&& i
< 10; i
++)
next
= getword(next
, words
[i
], -1);
switch(wordvalue
[wordnumber
]){
if (testbit(inven
,TWO_HANDED
))
hurt
= rnd(70) - 2 * card(injuries
,NUMOFINJURIES
) - ucard(wear
) - exhaustion
;
else if (testbit(inven
,SWORD
) || testbit(inven
, BROAD
))
hurt
= rnd(50)%(WEIGHT
-carrying
)-card(injuries
,NUMOFINJURIES
)-encumber
- exhaustion
;
else if (testbit(inven
,KNIFE
) || testbit(inven
,MALLET
) || testbit(inven
,CHAIN
) || testbit(inven
,MACE
) || testbit(inven
,HALBERD
))
hurt
= rnd(15) - card(injuries
,NUMOFINJURIES
) - exhaustion
;
hurt
= rnd(7) - encumber
;
puts("You swung wide and missed.");
puts("He checked your blow. CLASH! CLANG!");
puts("His filthy tunic hangs by one less thread.");
puts("A trickle of blood runs down his face.");
puts("A huge purple bruise is forming on the side of his face.");
puts("He staggers back quavering.");
puts("He jumps back with his hand over the wound.");
puts("His shirt falls open with a swath across the chest.");
printf("A bloody gash opens up on his %s side.\n",(rnd(2) ? "left" : "right"));
puts("The steel bites home and scrapes along his ribs.");
puts("You pierce him, and his breath hisses through clenched teeth.");
puts("You smite him to the ground.");
if (strength
- lifeline
> 20)
puts("But in a flurry of steel he regains his feet!");
puts("The force of your blow sends him to his knees.");
puts("His arm swings lifeless at his side.");
puts("Clutching his blood drenched shirt, he collapses stunned.");
puts("His ribs crack under your powerful swing, flooding his lungs with blood.");
puts("You shatter his upheld arm in a spray of blood. The blade continues deep");
puts("into his back, severing the spinal cord.");
puts("With a mighty lunge the steel slides in, and gasping, he falls to the ground.");
if (enemy
== DARK
&& lifeline
> strength
* 0.33){
puts("He throws you back against the rock and pummels your face.");
if (testbit(inven
,AMULET
) || testbit(wear
,AMULET
)){
printf("Lifting the amulet from you, ");
if (testbit(inven
,MEDALION
) || testbit(wear
,MEDALION
)){
puts("his power grows and the walls of\nthe earth tremble.");
puts("When he touches the medallion, your chest explodes and the foundations of the\nearth collapse.");
puts("The planet is consumed by darkness.");
if (testbit(inven
,AMULET
)){
carrying
-= objwt
[AMULET
];
encumber
-= objcumber
[AMULET
];
puts("he flees down the dark caverns.");
clearbit(location
[position
].objects
,DARK
);
puts("I'm afraid you have been killed.");
puts("You escape stunned and disoriented from the fight.");
puts("A victorious bellow echoes from the battlescene.");
if (back
&& position
!= back
)
else if (ahead
&&position
!= ahead
)
else if (left
&& position
!= left
)
else if (right
&& position
!= right
)
move(location
[position
].down
,AHEAD
);
if (testbit(inven
,LASER
)){
if (strength
- lifeline
<= 50){
printf("The %s took a direct hit!\n",objsht
[enemy
]);
puts("With his bare hand he deflects the laser blast and whips the pistol from you!");
setbit(location
[position
].objects
,LASER
);
carrying
-= objwt
[LASER
];
encumber
-= objcumber
[LASER
];
puts("Unfortunately, you don't have a blaster handy.");
puts("You don't have a chance, he is too quick.");
if (lifeline
>= strength
){
printf("You have killed the %s.\n", objsht
[enemy
]);
if (enemy
== ELF
|| enemy
== DARK
)
puts("A watery black smoke consumes his body and then vanishes with a peal of thunder!");
clearbit(location
[position
].objects
,enemy
);
hurt
= rnd(NUMOFINJURIES
) - (testbit(inven
,SHIELD
) != 0) - (testbit(wear
,MAIL
) != 0) - (testbit(wear
,HELM
) != 0);
hurt
+= (testbit(wear
,AMULET
) != 0) + (testbit(wear
,MEDALION
) != 0) + (testbit(wear
,TALISMAN
) != 0);
hurt
= hurt
< 0 ? 0 : hurt
;
hurt
= hurt
>= NUMOFINJURIES
? NUMOFINJURIES
-1 : hurt
;
printf("I'm afraid you have suffered %s.\n", ouch
[hurt
]);
puts("You emerge unscathed.");
if (injuries
[SKULL
] && injuries
[INCISE
] && injuries
[NECK
]){
puts("I'm afraid you have suffered fatal injuries.");