comparison arogue5/fight.c @ 63:0ed67132cf10

Import Advanced Rogue 5.8 from the Roguelike Restoration Project (r1490)
author elwin
date Thu, 09 Aug 2012 22:58:48 +0000
parents
children 56e748983fa8
comparison
equal deleted inserted replaced
62:0ef99244acb8 63:0ed67132cf10
1 /*
2 * All the fighting gets done here
3 *
4 * Advanced Rogue
5 * Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
6 * All rights reserved.
7 *
8 * Based on "Rogue: Exploring the Dungeons of Doom"
9 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
10 * All rights reserved.
11 *
12 * See the file LICENSE.TXT for full copyright and licensing information.
13 */
14
15 #include "curses.h"
16 #include <ctype.h>
17 #include <string.h>
18 #include "rogue.h"
19
20 #define CONF_DAMAGE -1
21 #define PARAL_DAMAGE -2
22 #define DEST_DAMAGE -3
23
24 static const struct matrix att_mat[5] = {
25 /* Base Max_lvl, Factor, Offset, Range */
26 { 10, 25, 2, 1, 2 },
27 { 9, 18, 2, 1, 5 },
28 { 10, 19, 2, 1, 3 },
29 { 10, 21, 2, 1, 4 },
30 { 7, 25, 1, 0, 2 }
31 };
32
33 /*
34 * fight:
35 * The player attacks the monster.
36 */
37
38 fight(mp, weap, thrown)
39 register coord *mp;
40 struct object *weap;
41 bool thrown;
42 {
43 register struct thing *tp;
44 register struct linked_list *item;
45 register bool did_hit = TRUE;
46 bool back_stab = FALSE;
47
48 /*
49 * Find the monster we want to fight
50 */
51 if ((item = find_mons(mp->y, mp->x)) == NULL) {
52 return(FALSE); /* must have killed him already */
53 }
54 tp = THINGPTR(item);
55 /*
56 * Since we are fighting, things are not quiet so no healing takes
57 * place.
58 */
59 player.t_quiet = 0;
60 tp->t_quiet = 0;
61
62 /*
63 * if its in the wall, we can't hit it
64 */
65 if (on(*tp, ISINWALL) && off(player, CANINWALL))
66 return(FALSE);
67
68 /*
69 * Let him know it was really a mimic (if it was one).
70 */
71 if (on(*tp, ISDISGUISE) && (tp->t_type != tp->t_disguise) &&
72 off(player, ISBLIND))
73 {
74 msg("Wait! That's a %s!", monsters[tp->t_index].m_name);
75 turn_off(*tp, ISDISGUISE);
76 did_hit = thrown;
77