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)
57 bonusvalue = alt_value ? alt_value : bonus_values[bonusid];
60 // FIXME: make these per-player
79 int award_awards(int* awards)
82 if (damagetaken == 0 && Person::players[0]->bloodloss == 0) {
83 awards[numawards] = awardflawless;
87 for (unsigned i = 1; i < Person::players.size(); i++) {
88 if (Person::players[i]->dead != 2) {
93 awards[numawards] = awardalldead;
97 for (unsigned i = 1; i < Person::players.size(); i++) {
98 if (Person::players[i]->dead != 1) {
103 awards[numawards] = awardnodead;
106 if (numresponded == 0 && !numthrowkill) {
107 awards[numawards] = awardstealth;
110 if (numattacks == numstaffattack && numattacks > 0) {
111 awards[numawards] = awardbojutsu;
114 if (numattacks == numswordattack && numattacks > 0) {
115 awards[numawards] = awardswordsman;
118 if (numattacks == numknifeattack && numattacks > 0) {
119 awards[numawards] = awardknifefighter;
122 if (numattacks == numunarmedattack && numthrowkill == 0 && weapons.size() > 0) {
123 awards[numawards] = awardkungfu;
126 if (numescaped > 0) {
127 awards[numawards] = awardevasion;
130 if (numflipfail == 0 && numflipped + numwallflipped * 2 > 20) {
131 awards[numawards] = awardacrobat;
134 if (numthrowkill == (int(Person::players.size()) - 1)) {
135 awards[numawards] = awardlongrange;
139 for (unsigned i = 1; i < Person::players.size(); i++) {
140 if (Person::players[i]->dead != 2) {
144 if (numafterkill > 0 && alldead) {
145 awards[numawards] = awardbrutal;
148 if (numreversals > ((float)numattacks) * .8 && numreversals > 3) {
149 awards[numawards] = awardaikido;
152 if (maxalarmed == 1 && Person::players.size() > 2) {
153 awards[numawards] = awardstrategy;
156 if (numflipfail > 3) {
157 awards[numawards] = awardklutz;