2 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 Lugaru 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. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
20 #include "Level/Awards.hpp"
23 #include "Objects/Person.hpp"
28 float startbonustotal;
32 const char* bonus_names[bonus_count] = {
33 #define DECLARE_BONUS(id, name, ...) name,
34 #include "Bonuses.def"
38 const char* award_names[award_count] = {
39 #define DECLARE_AWARD(id, name) name,
44 static const int bonus_values[bonus_count] = {
45 #define DECLARE_BONUS(id, name, value) value,
46 #include "Bonuses.def"
50 void award_bonus(int playerid, int bonusid, int alt_value)
56 bonusvalue = alt_value ? alt_value : bonus_values[bonusid];
59 // FIXME: make these per-player
78 int award_awards(int* awards)
81 if (damagetaken == 0 && Person::players[0]->bloodloss == 0) {
82 awards[numawards] = awardflawless;
86 for (unsigned i = 1; i < Person::players.size(); i++) {
87 if (Person::players[i]->dead != 2)
91 awards[numawards] = awardalldead;
95 for (unsigned i = 1; i < Person::players.size(); i++) {
96 if (Person::players[i]->dead != 1)
100 awards[numawards] = awardnodead;
103 if (numresponded == 0 && !numthrowkill) {
104 awards[numawards] = awardstealth;
107 if (numattacks == numstaffattack && numattacks > 0) {
108 awards[numawards] = awardbojutsu;
111 if (numattacks == numswordattack && numattacks > 0) {
112 awards[numawards] = awardswordsman;
115 if (numattacks == numknifeattack && numattacks > 0) {
116 awards[numawards] = awardknifefighter;
119 if (numattacks == numunarmedattack && numthrowkill == 0 && weapons.size() > 0) {
120 awards[numawards] = awardkungfu;
123 if (numescaped > 0) {
124 awards[numawards] = awardevasion;
127 if (numflipfail == 0 && numflipped + numwallflipped * 2 > 20) {
128 awards[numawards] = awardacrobat;
131 if (numthrowkill == (int(Person::players.size()) - 1)) {
132 awards[numawards] = awardlongrange;
136 for (unsigned i = 1; i < Person::players.size(); i++) {
137 if (Person::players[i]->dead != 2)
140 if (numafterkill > 0 && alldead) {
141 awards[numawards] = awardbrutal;
144 if (numreversals > ((float)numattacks) * .8 && numreversals > 3) {
145 awards[numawards] = awardaikido;
148 if (maxalarmed == 1 && Person::players.size() > 2) {
149 awards[numawards] = awardstrategy;
152 if (numflipfail > 3) {
153 awards[numawards] = awardklutz;