1 |
elmex |
1.1 |
/* |
2 |
pippijn |
1.10 |
* CrossFire, A Multiplayer game for X-windows |
3 |
|
|
* |
4 |
|
|
* Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 |
|
|
* Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 |
|
|
* Copyright (C) 1992 Frank Tore Johansen |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program; if not, write to the Free Software |
20 |
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 |
|
|
* |
22 |
|
|
* The authors can be reached via e-mail at <crossfire@schmorp.de> |
23 |
|
|
*/ |
24 |
elmex |
1.1 |
|
25 |
|
|
#include <global.h> |
26 |
|
|
#include <loader.h> |
27 |
|
|
#include <sproto.h> |
28 |
|
|
|
29 |
root |
1.5 |
int |
30 |
|
|
command_cointoss (object *op, char *params) |
31 |
elmex |
1.1 |
{ |
32 |
root |
1.5 |
char buf[MAX_BUF]; |
33 |
|
|
char buf2[MAX_BUF]; |
34 |
|
|
int i; |
35 |
|
|
|
36 |
|
|
i = rndm (1, 2); |
37 |
|
|
if (i == 1) |
38 |
|
|
{ |
39 |
|
|
snprintf (buf, MAX_BUF - 1, "%s flips a coin.... Heads!", &op->name); |
40 |
|
|
snprintf (buf2, MAX_BUF - 1, "You flip a coin.... Heads!"); |
41 |
|
|
} |
42 |
|
|
else |
43 |
|
|
{ |
44 |
|
|
snprintf (buf, MAX_BUF - 1, "%s flips a coin.... Tails!", &op->name); |
45 |
|
|
snprintf (buf2, MAX_BUF - 1, "You flip a coin.... Tails!"); |
46 |
elmex |
1.1 |
} |
47 |
root |
1.5 |
new_draw_info (NDI_UNIQUE, 0, op, buf2); |
48 |
|
|
new_info_map_except (NDI_WHITE, op->map, op, buf); |
49 |
|
|
return 0; |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
static const char *const orcknuckle[7] = { "none", "beholder", "ghost", "knight", |
53 |
|
|
"princess", "dragon", "orc" |
54 |
|
|
}; |
55 |
|
|
|
56 |
|
|
int |
57 |
|
|
command_orcknuckle (object *op, char *params) |
58 |
|
|
{ |
59 |
|
|
char buf[MAX_BUF]; |
60 |
|
|
char buf2[MAX_BUF]; |
61 |
|
|
int i, j, k, l; |
62 |
|
|
|
63 |
|
|
i = rndm (1, 5); |
64 |
|
|
j = rndm (1, 5); |
65 |
|
|
k = rndm (1, 5); |
66 |
|
|
l = rndm (1, 6); |
67 |
|
|
|
68 |
|
|
snprintf (buf2, MAX_BUF - 1, "%s rolls %s, %s, %s, %s!", &op->name, orcknuckle[i], orcknuckle[j], orcknuckle[k], orcknuckle[l]); |
69 |
|
|
snprintf (buf, MAX_BUF - 1, "You roll %s, %s, %s, %s!", orcknuckle[i], orcknuckle[j], orcknuckle[k], orcknuckle[l]); |
70 |
|
|
new_draw_info (NDI_UNIQUE, 0, op, buf); |
71 |
|
|
new_info_map_except (NDI_UNIQUE, op->map, op, buf2); |
72 |
|
|
return 0; |
73 |
elmex |
1.1 |
} |