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 const char *bonus_names[bonus_count] = {
34 #define DECLARE_BONUS(id, name, ...) name,
35 #include "Bonuses.def"
39 const char *award_names[award_count] = {
40 #define DECLARE_AWARD(id, name) name,
45 static const int bonus_values[bonus_count] = {
46 #define DECLARE_BONUS(id, name, value, ...) value,
47 #include "Bonuses.def"
52 award_bonus(int playerid, int bonusid, int alt_value)
58 bonusvalue = alt_value ? alt_value : bonus_values[bonusid];
61 // FIXME: make these per-player
80 int award_awards(int *awards)
83 if (damagetaken == 0 && Person::players[0]->bloodloss == 0) {
84 awards[numawards] = awardflawless;
88 for (i = 1; i < Person::players.size(); i++) {
89 if (Person::players[i]->dead != 2)
93 awards[numawards] = awardalldead;
97 for (i = 1; i < Person::players.size(); i++) {
98 if (Person::players[i]->dead != 1)
102 awards[numawards] = awardnodead;
105 if (numresponded == 0 && !numthrowkill) {
106 awards[numawards] = awardstealth;
109 if (numattacks == numstaffattack && numattacks > 0) {
110 awards[numawards] = awardbojutsu;
113 if (numattacks == numswordattack && numattacks > 0) {
114 awards[numawards] = awardswordsman;
117 if (numattacks == numknifeattack && numattacks > 0) {
118 awards[numawards] = awardknifefighter;
121 if (numattacks == numunarmedattack && numthrowkill == 0 && weapons.size() > 0) {
122 awards[numawards] = awardkungfu;
125 if (numescaped > 0) {
126 awards[numawards] = awardevasion;
129 if (numflipfail == 0 && numflipped + numwallflipped * 2 > 20) {
130 awards[numawards] = awardacrobat;
133 if (numthrowkill == Person::players.size() - 1) {
134 awards[numawards] = awardlongrange;
138 for (i = 1; i < Person::players.size(); i++) {
139 if (Person::players[i]->dead != 2)
142 if (numafterkill > 0 && alldead) {
143 awards[numawards] = awardbrutal;
146 if (numreversals > ((float)numattacks)*.8 && numreversals > 3) {
147 awards[numawards] = awardaikido;
150 if (maxalarmed == 1 && Person::players.size() > 2) {
151 awards[numawards] = awardstrategy;
154 if (numflipfail > 3) {
155 awards[numawards] = awardklutz;