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