blob: fa8ad70535497c1e9588d15239e7b7cb3608e97d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#include "7w.h"
void Halicarnassus(int player) {
int focus = data_numplayers();
int cursor = 0;
int discards[150];
data_getdiscards(discards);
int numcards = 0;
while (discards[numcards++] != -1 && numcards < 50)
;
numcards /= 2;
if (numcards == 0) {
postmessage("No cards in the discard pile. Sucks to suck.");
return;
}
while (1) {
view_refresh(focus, cursor, player, 1);
switch (io_getkey()) {
case UP:
cursor--;
break;
case DOWN:
cursor++;
break;
case RIGHT:
focus++;
cursor = 0;
break;
case LEFT:
focus--;
cursor = 0;
break;
case '\t':
focus = (focus + 1) % (data_numplayers() + 1);
cursor = 0;
break;
case 'h':
posthelp();
break;
case ENTER:
if (data_hasbuiltname(player, discards[cursor * 2],
discards[cursor * 2 + 1])) {
postmessage("Cannot have two of the same card!");
} else {
data_freebuild(player, discards[cursor * 2],
discards[cursor * 2 + 1]);
data_deletediscard(discards[cursor * 2],
discards[cursor * 2 + 1]);
return;
}
break;
default:
break;
}
if (focus < 0)
focus = data_numplayers();
focus = focus % (data_numplayers() + 1);
if (focus == data_numplayers()) {
if (cursor < 0)
cursor = numcards - 1;
if (cursor >= numcards)
cursor = 0;
} else {
if (cursor < 0)
cursor = wonder_numstages((player + focus) % data_numplayers())
+ data_numbuilt(player + focus % data_numplayers()) - 1;
cursor =
cursor
% (wonder_numstages(
(player + focus) % data_numplayers())
+ data_numbuilt(
player + focus % data_numplayers()));
}
}
}
static int hal = 0;
static int oly = 0;
void special_action(int player, int wonder, int stage) {
if (wonder == 8) { //Halicarnassus
if ((stage == 2 && hal == 0) || (stage == 4 && hal == 0)
|| (stage == 5 && hal == 1) || (stage == 6 && hal == 2)) {
if (data_isai(player))
; //TODO: Implement this!
else
Halicarnassus(player);
hal++;
}
}
if (wonder == 7) { //Olympia
if (stage == 2 && !oly) {
data_setfreebuild(player);
oly = 1;
}
}
}
|