2 * Functions for dealing with problems of the heart
4 * @(#)romance.c 3.2 (Berkeley) 6/15/81
6 * Rogue: Exploring the Cavern of Cuties
7 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
10 * See the file LICENSE.TXT for full copyright and licensing information.
19 unsigned v
; // count bits set in this (32-bit value)
21 unsigned c
= v
- ((v
>> 1) & 0x55555555);
22 c
= ((c
>> 2) & 0x33333333) + (c
& 0x33333333);
23 c
= ((c
>> 4) + c
) & 0x0F0F0F0F;
24 c
= ((c
>> 8) + c
) & 0x00FF00FF;
25 c
= ((c
>> 16) + c
) & 0x0000FFFF;
31 * Make eyes in the given direction
37 register struct linked_list
*mob
;
38 struct object obj
= {};
42 do_motion(&obj
, ydelta
, xdelta
);
43 mvwaddch(cw
, hero
.y
, hero
.x
, PLAYER
);
44 if ((mob
= find_mons(obj
.o_pos
.y
, obj
.o_pos
.x
)) == NULL
)
46 const char *msgs
[] = {
47 "You wink at nothing in particular.",
48 "You smile suggestively at the wall.",
49 "Unprompted, you suddenly blush.",
55 register struct thing
*tp
= (struct thing
*) ldata(mob
);
56 int attr
= count_bits_set(tp
->t_stats
.s_ont
^ player
.t_stats
.s_ont
);
57 attr
+= tp
->t_stats
.s_int
- 2;
58 if (rnd(NUM_FEATURES
) < attr
)
61 const char *msgs
[] = {
62 "The %s smiles back at you.",
63 "You catch the %s staring at you out of the corner of eir eye.",
64 "The %s blushes and waves cautiously.",
66 msg(rndchoice(msgs
), killname(tp
->t_type
));
71 const char *msgs
[] = {
72 "The %s scowls at you.",
73 "The %s tells you to stop it.",
74 "The %s is sick of your crap.",
76 msg(rndchoice(msgs
), killname(tp
->t_type
));
80 const char *msgs
[] = {
81 "The %s ignores you.",
82 "The %s is completely uninterested in you.",
83 "The %s acts like it can't hear you.",
84 "The %s doesn't care.",
86 msg(rndchoice(msgs
), killname(tp
->t_type
));
94 register struct linked_list
*obj
, *nobj
;
95 register struct linked_list
*mob
;
96 register struct object
*op
;
97 register struct thing
*tp
;
100 if ((mob
= find_mons(hero
.y
+ ydelta
, hero
.x
+ xdelta
)) == NULL
)
102 msg("There's no-one around here.");
105 tp
= (struct thing
*) ldata(mob
);
107 if ((obj
= get_item("give", 0)) == NULL
)
109 op
= (struct object
*) ldata(obj
);
113 liking
= count_bits_set(
114 hash(op
->o_type
* op
->o_which
) & tp
->t_stats
.s_ont
) - 1;
115 if ((liking
== 0 || liking
== -1)
116 || liking
> 0 && tp
->t_stats
.s_int
<= MAYBE_INTERESTED
)
118 const char *msgs
[] = {
120 "The %s doesn't care for %s",
121 "The %s isn't interested in %s",
123 msg(rndchoice(msgs
), killname(tp
->t_type
), inv_name(op
, TRUE
));
128 const char *msgs
[] = {
129 "The %s accepts %s.",
130 "The %s smiles and takes %s.",
132 msg(rndchoice(msgs
), killname(tp
->t_type
), inv_name(op
, TRUE
));
133 tp
->t_stats
.s_int
+= liking
* 10;
137 const char *msgs
[] = {
138 "The %s throws away %s.",
142 msg(rndchoice(msgs
), killname(tp
->t_type
), inv_name(op
, TRUE
));
143 tp
->t_stats
.s_int
-= liking
* 2;
147 * Take it out of the pack
149 if (op
->o_count
>= 2 && op
->o_type
!= WEAPON
)
151 nobj
= new_item(sizeof *op
);
153 op
= (struct object
*) ldata(nobj
);
154 *op
= *((struct object
*) ldata(obj
));
157 if (op
->o_group
!= 0)
167 register struct thing
*tp
= NULL
;
171 for (dx
= -1; dx
<= 1; ++dx
)
173 for (dy
= -1; dy
<= 1; ++dy
)
175 register struct linked_list
*mob
;
176 if ((mob
= find_mons(hero
.y
+ dy
, hero
.x
+ dx
)))
178 register struct thing
*atp
= (struct thing
*)ldata(mob
);
179 if (!tp
|| atp
->t_stats
.s_int
> tp
->t_stats
.s_int
)
188 msg("You wrap your arms around yourself.");
191 else if (tp
->t_stats
.s_int
< READY
)
193 if (tp
->t_stats
.s_int
> 0)
194 tp
->t_stats
.s_int
/= 2;
197 msg("The %s dodges out of the way.", killname(tp
->t_type
));
203 total_winner(tp
->t_type
);
207 mostly_winner(tp
->t_type
);