Spieler.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #pragma once
  2. #include "Team.h"
  3. #include "Gegenstand.h"
  4. #include "Effect.h"
  5. #include <Array.h>
  6. class Spiel;
  7. #define INVENTORY_SLOTS 8
  8. class Inventar
  9. {
  10. private:
  11. GegenstandTyp slots[ INVENTORY_SLOTS ];
  12. int anzahl[ INVENTORY_SLOTS ];
  13. float abklingzeit[ INVENTORY_SLOTS ];
  14. int selected;
  15. public:
  16. Inventar();
  17. void addItem( GegenstandTyp typ, int anzahl );
  18. void setSelected( int slot );
  19. bool hatAbklingzeit( GegenstandTyp typ ) const;
  20. GegenstandTyp useItem();
  21. void tick( double zeit );
  22. bool canAddItem( GegenstandTyp typ ) const;
  23. GegenstandTyp selectedItem() const;
  24. int getItemAnzahl() const;
  25. int getItemAnzahl( GegenstandTyp typ ) const;
  26. GegenstandTyp getItemTyp( int index ) const;
  27. void removeItem( GegenstandTyp typ, int anzahl );
  28. };
  29. class Spieler : public GameObject
  30. {
  31. private:
  32. RCArray< Effect > effekte;
  33. int accountId;
  34. int spielerNummer;
  35. Team *team;
  36. bool amLeben;
  37. int maxWiederbelebungsZeit;
  38. float wiederbelebungsZeit;
  39. GegenstandTyp zuletztAufgehoben;
  40. GegenstandTyp zuletztAktiviert;
  41. float leben;
  42. int maxLeben;
  43. int level;
  44. float erfahrung;
  45. int maxErfahrung;
  46. int spawnX;
  47. int spawnY;
  48. float laufTempo;
  49. float geschossTempo;
  50. float armor;
  51. float schadensBonus;
  52. float lebensraub;
  53. float lebensRegeneration;
  54. float abklingZeitVerringerung;
  55. int color;
  56. int kills;
  57. int tode;
  58. int treffer;
  59. int getroffen;
  60. float schadenGenommen;
  61. float schadenGemacht;
  62. float lebenGeheilt;
  63. float erhalteneErfahrung;
  64. int itemsAufgehoben;
  65. int itemsVerwendet;
  66. int tunnelBenutzt;
  67. int schalterAktiviert;
  68. int geschosseGeschossen;
  69. bool tastenStand[ 256 ];
  70. Text name;
  71. Richtung ausrichtung;
  72. Inventar inv;
  73. int currentImage;
  74. double currentNext;
  75. Resource *current;
  76. int heilungImage;
  77. double heilungNext;
  78. bool showHeilung;
  79. Resource *heilungR;
  80. int schadenImage;
  81. double schadenNext;
  82. bool showSchaden;
  83. Resource *schadenR;
  84. ResourceRegistry *resources;
  85. public:
  86. Spieler( ResourceRegistry *zResources, int id, Team *team, int spawnX, int spawnY, int farbe );
  87. ~Spieler();
  88. bool setTastenStand( unsigned char taste, bool pressed );
  89. void setTeam( Team *team );
  90. void setAccount( int id );
  91. void addEffekt( Effect *e );
  92. void setLaufTempo( float pps );
  93. void addErfahrung( float anz, Spiel *zSpiel );
  94. void levelUp( Spiel *zSpiel );
  95. void levelDown( Spiel *zSpiel );
  96. void addTunnelBenutzung( Spiel *zSpiel );
  97. void addSchalterBenutzung( Spiel *zSpiel );
  98. // aktualisiert auch die team statistik
  99. void addKill();
  100. void addTreffer( Spiel *zSpiel );
  101. void addGetroffen();
  102. void move( double zeit );
  103. void wiederbelebung( Spiel *zSpiel );
  104. void tick( double zeit, Spiel *zSpiel );
  105. void render( Bild &rObj ) override;
  106. void useItem( Spiel *zSpiel );
  107. bool addItem( GegenstandTyp typ, int anz, Spiel *zSpiel );
  108. // heilt auch um den lebensraub prozentsatz
  109. void addGemachterSchaden( float schaden, Spiel *zSpiel );
  110. // zieht die rüstung ab
  111. void nimmSchaden( float schaden, Spieler *zVerursacher, Richtung r, Spiel *zSpiel );
  112. void heilung( float heal, Spiel *zSpiel, bool show = 1 );
  113. void setSchadenBonus( float bonus );
  114. void setLebensRaub( float raub );
  115. void setGeschossTempo( float tempo );
  116. void setArmor( float armor );
  117. void setLebensRegeneration( float reg );
  118. void setName( const char *name );
  119. // setzt alle eigenschafften, die mit dem level gesetzt werden entsprechend
  120. void setLevel( int level, Spiel *zSpiel );
  121. void removeItem( GegenstandTyp typ, int anzahl );
  122. void setLeben( float leben );
  123. void setMaxLeben( int leben );
  124. // steuert auch level up oder level downs bei negativer erfahrung
  125. void setErfahrung( float erf, Spiel *zSpiel );
  126. void setMaxErfahrung( int erf );
  127. void setAbklingZeitVerringerung( float verringerung );
  128. float getLebensRegenneration() const;
  129. float getArmor() const;
  130. float getGeschossTempo() const;
  131. float getLebensRaub() const;
  132. float getSchadenBonus() const;
  133. Team *zTeam() const;
  134. Team *getTeam() const;
  135. int getFarbe() const;
  136. int getAccountId() const;
  137. int getPunkte() const;
  138. bool istAmLeben() const;
  139. float getLaufTempo() const;
  140. bool isVerwundbar( Richtung r ) const;
  141. bool istBeweglich( Richtung r ) const;
  142. bool istSichtbar( Team *zTeam ) const;
  143. bool istGegenstandErlaubt( GegenstandTyp typ ) const;
  144. Richtung getAusrichtung() const;
  145. float getAbklingZeitVerringerung() const;
  146. int getId() const;
  147. int getLevel() const;
  148. float getLeben() const;
  149. int getMaxLeben() const;
  150. float getErfahrung() const;
  151. int getMaxErfahrung() const;
  152. int getTode() const;
  153. int getKills() const;
  154. int getTreffer() const;
  155. int getGetroffen() const;
  156. float getErlittenerSchaden() const;
  157. float getGemachterSchaden() const;
  158. float getGeheiltesLeben() const;
  159. int getItemsAufgehoben() const;
  160. int getItemsVerwendet() const;
  161. int getItemsInInventory() const;
  162. int getItemsInInventory( GegenstandTyp typ ) const;
  163. int getTunnelBenutzt() const;
  164. int getSchalterAktiviert() const;
  165. int getGeschossen() const;
  166. GegenstandTyp getInventorySlot( int index ) const;
  167. const char *getName() const;
  168. };
  169. class DeadPlayer : public GameObject
  170. {
  171. public:
  172. bool isFinished() const;
  173. };