1 /* $NetBSD: spec.c,v 1.11 2012/06/19 05:35:32 dholland Exp $ */
2
3 /*
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)spec.c 8.1 (Berkeley) 5/31/93
32 */
33
34 #include "monop.h"
35 #include "deck.h"
36
37 static const char *const perc[] = {
38 "10%", "ten percent", "%", "$200", "200", 0
39 };
40
41 /*
42 * collect income tax
43 */
44 void
inc_tax(void)45 inc_tax(void)
46 {
47 int worth, com_num;
48
49 com_num = getinp("Do you wish to lose 10% of your total worth or "
50 "$200? ", perc);
51 worth = cur_p->money + prop_worth(cur_p);
52 printf("You were worth $%d", worth);
53 worth /= 10;
54 if (com_num > 2) {
55 if (worth < 200)
56 printf(". Good try, but not quite.\n");
57 else if (worth > 200)
58 lucky(".\nGood guess. ");
59 cur_p->money -= 200;
60 }
61 else {
62 printf(", so you pay $%d", worth);
63 if (worth > 200)
64 printf(" OUCH!!!!.\n");
65 else if (worth < 200)
66 lucky("\nGood guess. ");
67 cur_p->money -= worth;
68 }
69 if (worth == 200)
70 lucky("\nIt makes no difference! ");
71 }
72
73 /*
74 * move player to jail
75 */
76 void
goto_jail(void)77 goto_jail(void)
78 {
79 cur_p->loc = JAIL;
80 }
81
82 /*
83 * landing on luxury tax
84 */
85 void
lux_tax(void)86 lux_tax(void)
87 {
88 printf("You lose $75\n");
89 cur_p->money -= 75;
90 }
91
92 /*
93 * draw community chest card
94 */
95 void
cc(void)96 cc(void)
97 {
98 get_card(&CC_D);
99 }
100
101 /*
102 * draw chance card
103 */
104 void
chance(void)105 chance(void)
106 {
107 get_card(&CH_D);
108 }
109