]> git.jsancho.org Git - lugaru.git/blob - Source/Awards.cpp
Consolidate bonus externs
[lugaru.git] / Source / Awards.cpp
1 /*
2 Copyright (C) 2010 - Lugaru authors
3
4 This file is part of Lugaru.
5
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.
10
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.
14
15 See the GNU General Public License for more details.
16
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.
20 */
21
22 #include "Awards.h"
23 #include "Person.h"
24 #include "Game.h"
25
26 int bonus;
27 float bonusvalue;
28 float bonustotal;
29 float startbonustotal;
30 float bonustime;
31
32 // FIXME: make these per-player
33 float damagetaken;
34 int numfalls;
35 int numflipfail;
36 int numseen;
37 int numresponded;
38 int numstaffattack;
39 int numswordattack;
40 int numknifeattack;
41 int numunarmedattack;
42 int numescaped;
43 int numflipped;
44 int numwallflipped;
45 int numthrowkill;
46 int numafterkill;
47 int numreversals;
48 int numattacks;
49 int maxalarmed;
50
51 int award_awards(int *awards)
52 {
53   int numawards = 0, i;
54   if(damagetaken==0&&player[0].bloodloss==0){
55     awards[numawards]=awardflawless;
56     numawards++;
57   }
58   bool alldead = true;
59   for(i=1;i<numplayers;i++){
60     if(player[i].dead!=2)alldead=0;
61   }
62   if(alldead){
63     awards[numawards]=awardalldead;
64     numawards++;
65   }
66   alldead=1;
67   for(i=1;i<numplayers;i++){
68     if(player[i].dead!=1)alldead=0;
69   }
70   if(alldead){
71     awards[numawards]=awardnodead;
72     numawards++;
73   }
74   if(numresponded==0&&!numthrowkill){
75     awards[numawards]=awardstealth;
76     numawards++;
77   }
78   if(numattacks==numstaffattack&&numattacks>0){
79     awards[numawards]=awardbojutsu;
80     numawards++;
81   }
82   if(numattacks==numswordattack&&numattacks>0){
83     awards[numawards]=awardswordsman;
84     numawards++;
85   }
86   if(numattacks==numknifeattack&&numattacks>0){
87     awards[numawards]=awardknifefighter;
88     numawards++;
89   }
90   if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){
91     awards[numawards]=awardkungfu;
92     numawards++;
93   }
94   if(numescaped>0){
95     awards[numawards]=awardevasion;
96     numawards++;
97   }
98   if(numflipfail==0&&numflipped+numwallflipped*2>20){
99     awards[numawards]=awardacrobat;
100     numawards++;
101   }
102   if(numthrowkill==numplayers-1){
103     awards[numawards]=awardlongrange;
104     numawards++;
105   }
106   alldead=1;
107   for(i=1;i<numplayers;i++){
108     if(player[i].dead!=2)alldead=0;
109   }
110   if(numafterkill>0&&alldead){
111     awards[numawards]=awardbrutal;
112     numawards++;
113   }
114   if(numreversals>((float)numattacks)*.8&&numreversals>3){
115     awards[numawards]=awardaikido;
116     numawards++;
117   }
118   if(maxalarmed==1&&numplayers>2){
119     awards[numawards]=awardstrategy;
120     numawards++;
121   }
122   if(numflipfail>3){
123     awards[numawards]=awardklutz;
124     numawards++;
125   }
126   return numawards;
127 }