]> git.jsancho.org Git - lugaru.git/blob - Source/Awards.cpp
Move bonusnum too
[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 float bonusnum[100];
32
33
34 // FIXME: make these per-player
35 float damagetaken;
36 int numfalls;
37 int numflipfail;
38 int numseen;
39 int numresponded;
40 int numstaffattack;
41 int numswordattack;
42 int numknifeattack;
43 int numunarmedattack;
44 int numescaped;
45 int numflipped;
46 int numwallflipped;
47 int numthrowkill;
48 int numafterkill;
49 int numreversals;
50 int numattacks;
51 int maxalarmed;
52
53 int award_awards(int *awards)
54 {
55   int numawards = 0, i;
56   if(damagetaken==0&&player[0].bloodloss==0){
57     awards[numawards]=awardflawless;
58     numawards++;
59   }
60   bool alldead = true;
61   for(i=1;i<numplayers;i++){
62     if(player[i].dead!=2)alldead=0;
63   }
64   if(alldead){
65     awards[numawards]=awardalldead;
66     numawards++;
67   }
68   alldead=1;
69   for(i=1;i<numplayers;i++){
70     if(player[i].dead!=1)alldead=0;
71   }
72   if(alldead){
73     awards[numawards]=awardnodead;
74     numawards++;
75   }
76   if(numresponded==0&&!numthrowkill){
77     awards[numawards]=awardstealth;
78     numawards++;
79   }
80   if(numattacks==numstaffattack&&numattacks>0){
81     awards[numawards]=awardbojutsu;
82     numawards++;
83   }
84   if(numattacks==numswordattack&&numattacks>0){
85     awards[numawards]=awardswordsman;
86     numawards++;
87   }
88   if(numattacks==numknifeattack&&numattacks>0){
89     awards[numawards]=awardknifefighter;
90     numawards++;
91   }
92   if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){
93     awards[numawards]=awardkungfu;
94     numawards++;
95   }
96   if(numescaped>0){
97     awards[numawards]=awardevasion;
98     numawards++;
99   }
100   if(numflipfail==0&&numflipped+numwallflipped*2>20){
101     awards[numawards]=awardacrobat;
102     numawards++;
103   }
104   if(numthrowkill==numplayers-1){
105     awards[numawards]=awardlongrange;
106     numawards++;
107   }
108   alldead=1;
109   for(i=1;i<numplayers;i++){
110     if(player[i].dead!=2)alldead=0;
111   }
112   if(numafterkill>0&&alldead){
113     awards[numawards]=awardbrutal;
114     numawards++;
115   }
116   if(numreversals>((float)numattacks)*.8&&numreversals>3){
117     awards[numawards]=awardaikido;
118     numawards++;
119   }
120   if(maxalarmed==1&&numplayers>2){
121     awards[numawards]=awardstrategy;
122     numawards++;
123   }
124   if(numflipfail>3){
125     awards[numawards]=awardklutz;
126     numawards++;
127   }
128   return numawards;
129 }