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