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