2 Copyright (C) 2010 - Lugaru authors
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 float startbonustotal;
33 static const int bonus_values[bonus_count] = {
34 #define DECLARE_BONUS(id, name, value, ...) value,
35 #include "Bonuses.def"
40 award_bonus(int playerid, int bonusid, int alt_value)
46 bonusvalue = alt_value ? alt_value : bonus_values[bonusid];
49 // FIXME: make these per-player
68 int award_awards(int *awards)
71 if (damagetaken == 0 && player[0].bloodloss == 0) {
72 awards[numawards] = awardflawless;
76 for (i = 1; i < numplayers; i++) {
77 if (player[i].dead != 2)alldead = 0;
80 awards[numawards] = awardalldead;
84 for (i = 1; i < numplayers; i++) {
85 if (player[i].dead != 1)alldead = 0;
88 awards[numawards] = awardnodead;
91 if (numresponded == 0 && !numthrowkill) {
92 awards[numawards] = awardstealth;
95 if (numattacks == numstaffattack && numattacks > 0) {
96 awards[numawards] = awardbojutsu;
99 if (numattacks == numswordattack && numattacks > 0) {
100 awards[numawards] = awardswordsman;
103 if (numattacks == numknifeattack && numattacks > 0) {
104 awards[numawards] = awardknifefighter;
107 if (numattacks == numunarmedattack && numthrowkill == 0 && weapons.size() > 0) {
108 awards[numawards] = awardkungfu;
111 if (numescaped > 0) {
112 awards[numawards] = awardevasion;
115 if (numflipfail == 0 && numflipped + numwallflipped * 2 > 20) {
116 awards[numawards] = awardacrobat;
119 if (numthrowkill == numplayers - 1) {
120 awards[numawards] = awardlongrange;
124 for (i = 1; i < numplayers; i++) {
125 if (player[i].dead != 2)alldead = 0;
127 if (numafterkill > 0 && alldead) {
128 awards[numawards] = awardbrutal;
131 if (numreversals > ((float)numattacks)*.8 && numreversals > 3) {
132 awards[numawards] = awardaikido;
135 if (maxalarmed == 1 && numplayers > 2) {
136 awards[numawards] = awardstrategy;
139 if (numflipfail > 3) {
140 awards[numawards] = awardklutz;