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 && Person::players[0]->bloodloss == 0) {
72 awards[numawards] = awardflawless;
76 for (i = 1; i < Person::players.size(); i++) {
77 if (Person::players[i]->dead != 2)
81 awards[numawards] = awardalldead;
85 for (i = 1; i < Person::players.size(); i++) {
86 if (Person::players[i]->dead != 1)
90 awards[numawards] = awardnodead;
93 if (numresponded == 0 && !numthrowkill) {
94 awards[numawards] = awardstealth;
97 if (numattacks == numstaffattack && numattacks > 0) {
98 awards[numawards] = awardbojutsu;
101 if (numattacks == numswordattack && numattacks > 0) {
102 awards[numawards] = awardswordsman;
105 if (numattacks == numknifeattack && numattacks > 0) {
106 awards[numawards] = awardknifefighter;
109 if (numattacks == numunarmedattack && numthrowkill == 0 && weapons.size() > 0) {
110 awards[numawards] = awardkungfu;
113 if (numescaped > 0) {
114 awards[numawards] = awardevasion;
117 if (numflipfail == 0 && numflipped + numwallflipped * 2 > 20) {
118 awards[numawards] = awardacrobat;
121 if (numthrowkill == Person::players.size() - 1) {
122 awards[numawards] = awardlongrange;
126 for (i = 1; i < Person::players.size(); i++) {
127 if (Person::players[i]->dead != 2)
130 if (numafterkill > 0 && alldead) {
131 awards[numawards] = awardbrutal;
134 if (numreversals > ((float)numattacks)*.8 && numreversals > 3) {
135 awards[numawards] = awardaikido;
138 if (maxalarmed == 1 && Person::players.size() > 2) {
139 awards[numawards] = awardstrategy;
142 if (numflipfail > 3) {
143 awards[numawards] = awardklutz;