From 68c563442e7103e2472f148d05bc8c5bd385e661 Mon Sep 17 00:00:00 2001 From: Nathan Vance Date: Thu, 12 Mar 2015 10:13:16 -0400 Subject: Bug fixes --- ai_weights.c | 4 ++++ data.c | 10 +++++----- player_turn.c | 7 ++++--- specialcards.c | 4 ++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ai_weights.c b/ai_weights.c index bd7cd0c..d559c0c 100644 --- a/ai_weights.c +++ b/ai_weights.c @@ -103,6 +103,7 @@ int weight_commercial(int era, int card, int player) if(era == 1) { if(card == 11 || card == 12) return weight_resource(era, card, player); if(card == 13 || card == 14) return weight_gold(get_special(era, card, player)[1], player); + } return 0; } @@ -111,6 +112,9 @@ int weight_buildcard(int era, int card, int player) { int weight = data_potentialvps(player, era, card); weight -= data_gettotvps(player); + if(cards_gettype(era, card) == STRUCTURE) + weight *= 3; + weight /= 2; if(cards_gettype(era, card) == MILITARY) weight += weight_military(era, card, player); if(era == 2) return weight; diff --git a/data.c b/data.c index ded022a..e3c2cd6 100644 --- a/data.c +++ b/data.c @@ -186,11 +186,11 @@ int data_getnextwonderstage(int p) int stage = data_getwonderstages(p); int wonder = data_getwonder(p); if(side == 0) { - if(stage >= 2) return -1; + if(stage >= 3) return -1; } else { - if(wonder == 3 && stage >= 1) return -1; - if(wonder != 9 && stage >= 2) return -1; - if(wonder == 9 && stage >= 3) return -1; + if(wonder == 3 && stage >= 2) return -1; + if(wonder != 9 && stage >= 3) return -1; + if(wonder == 9 && stage >= 4) return -1; } return side*3+1+stage; } @@ -410,7 +410,7 @@ int data_iscouponed(int p, int era, int card) int* coupons = cards_getcouponed(era, card); int i; for(i = 0; i < 3; i += 2) { - if(coupons[1+1]) + if(coupons[i+1]) if(data_hasbuilt(p, coupons[i], coupons[i+1])) return 1; } } diff --git a/player_turn.c b/player_turn.c index a7d13d2..aa86077 100644 --- a/player_turn.c +++ b/player_turn.c @@ -41,11 +41,12 @@ int player_build(int focus, int cursor, int player) data_addgold(3, player); return 1; } else if(choice == 2) { - if(data_canafford(player, data_getwonder(player), data_getnextwonderstage(player))) { + if(data_getnextwonderstage(player) == -1) { + postmessage("Wonder already complete."); + } else if(data_canafford(player, data_getwonder(player), data_getnextwonderstage(player))) { data_buildwonder(player, hand[cursor]); return 1; - } - else postmessage("Can't afford this!"); + } else postmessage("Can't afford this!"); } } return 0; diff --git a/specialcards.c b/specialcards.c index 20e9b24..b49e53c 100644 --- a/specialcards.c +++ b/specialcards.c @@ -44,8 +44,8 @@ int* get_special(int era, int card, int player) ret[0] = ret[1] = cardcounter(data_getbuilt(player), INDUSTRY) * 2; break; case 208: //Arena: 3 coins and 1 vp for each completed wonder stage. - ret[1] = data_getwonderstages(player); - ret[0] = 3*ret[1]; + ret[0] = data_getwonderstages(player); + ret[1] = 3*ret[1]; break; case 218: //Workers Guild: 1 vp for each resource card owned by adjacent players. ret[0] += cardcounter(data_getbuilt(data_geteast(player)), RESOURCE); -- cgit