1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
/*
Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file)
This file is part of Lugaru.
Lugaru is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Lugaru is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Level/Awards.hpp"
#include "Game.hpp"
#include "Objects/Person.hpp"
int bonus;
int bonusvalue;
int bonustotal;
int startbonustotal;
float bonustime;
float bonusnum[100];
const char* bonus_names[bonus_count] = {
#define DECLARE_BONUS(id, name, ...) name,
#include "Bonuses.def"
#undef DECLARE_BONUS
};
const char* award_names[award_count] = {
#define DECLARE_AWARD(id, name) name,
#include "Awards.def"
#undef DECLARE_AWARD
};
static const int bonus_values[bonus_count] = {
#define DECLARE_BONUS(id, name, value) value,
#include "Bonuses.def"
#undef DECLARE_BONUS
};
void award_bonus(int playerid, int bonusid, int alt_value)
{
if (playerid != 0) {
return;
}
bonus = bonusid;
bonustime = 0;
bonusvalue = alt_value ? alt_value : bonus_values[bonusid];
}
// FIXME: make these per-player
float damagetaken;
int numfalls;
int numflipfail;
int numseen;
int numresponded;
int numstaffattack;
int numswordattack;
int numknifeattack;
int numunarmedattack;
int numescaped;
int numflipped;
int numwallflipped;
int numthrowkill;
int numafterkill;
int numreversals;
int numattacks;
int maxalarmed;
int award_awards(int* awards)
{
int numawards = 0;
if (damagetaken == 0 && Person::players[0]->bloodloss == 0) {
awards[numawards] = awardflawless;
numawards++;
}
bool alldead = true;
for (unsigned i = 1; i < Person::players.size(); i++) {
if (Person::players[i]->dead != 2) {
alldead = 0;
}
}
if (alldead) {
awards[numawards] = awardalldead;
numawards++;
}
alldead = 1;
for (unsigned i = 1; i < Person::players.size(); i++) {
if (Person::players[i]->dead != 1) {
alldead = 0;
}
}
if (alldead) {
awards[numawards] = awardnodead;
numawards++;
}
if (numresponded == 0 && !numthrowkill) {
awards[numawards] = awardstealth;
numawards++;
}
if (numattacks == numstaffattack && numattacks > 0) {
awards[numawards] = awardbojutsu;
numawards++;
}
if (numattacks == numswordattack && numattacks > 0) {
awards[numawards] = awardswordsman;
numawards++;
}
if (numattacks == numknifeattack && numattacks > 0) {
awards[numawards] = awardknifefighter;
numawards++;
}
if (numattacks == numunarmedattack && numthrowkill == 0 && weapons.size() > 0) {
awards[numawards] = awardkungfu;
numawards++;
}
if (numescaped > 0) {
awards[numawards] = awardevasion;
numawards++;
}
if (numflipfail == 0 && numflipped + numwallflipped * 2 > 20) {
awards[numawards] = awardacrobat;
numawards++;
}
if (numthrowkill == (int(Person::players.size()) - 1)) {
awards[numawards] = awardlongrange;
numawards++;
}
alldead = 1;
for (unsigned i = 1; i < Person::players.size(); i++) {
if (Person::players[i]->dead != 2) {
alldead = 0;
}
}
if (numafterkill > 0 && alldead) {
awards[numawards] = awardbrutal;
numawards++;
}
if (numreversals > ((float)numattacks) * .8 && numreversals > 3) {
awards[numawards] = awardaikido;
numawards++;
}
if (maxalarmed == 1 && Person::players.size() > 2) {
awards[numawards] = awardstrategy;
numawards++;
}
if (numflipfail > 3) {
awards[numawards] = awardklutz;
numawards++;
}
return numawards;
}
|