Spieler.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. public:
  74. Spieler( int id, Team *team, int spawnX, int spawnY, int farbe );
  75. ~Spieler();
  76. bool setTastenStand( unsigned char taste, bool pressed );
  77. void setTeam( Team *team );
  78. void setAccount( int id );
  79. void addEffekt( Effect *e );
  80. void setLaufTempo( float pps );
  81. void addErfahrung( float anz, Spiel *zSpiel );
  82. void levelUp( Spiel *zSpiel );
  83. void levelDown( Spiel *zSpiel );
  84. void addTunnelBenutzung( Spiel *zSpiel );
  85. void addSchalterBenutzung( Spiel *zSpiel );
  86. // aktualisiert auch die team statistik
  87. void addKill();
  88. void addTreffer( Spiel *zSpiel );
  89. void addGetroffen();
  90. void move( double zeit );
  91. void wiederbelebung( Spiel *zSpiel );
  92. void tick( double zeit, Spiel *zSpiel );
  93. void useItem( Spiel *zSpiel );
  94. bool addItem( GegenstandTyp typ, int anz, Spiel *zSpiel );
  95. // heilt auch um den lebensraub prozentsatz
  96. void addGemachterSchaden( float schaden, Spiel *zSpiel );
  97. // zieht die rüstung ab
  98. void nimmSchaden( float schaden, Spieler *zVerursacher, Richtung r, Spiel *zSpiel );
  99. void heilung( float heal, Spiel *zSpiel );
  100. void setSchadenBonus( float bonus );
  101. void setLebensRaub( float raub );
  102. void setGeschossTempo( float tempo );
  103. void setArmor( float armor );
  104. void setLebensRegeneration( float reg );
  105. void setName( const char *name );
  106. // setzt alle eigenschafften, die mit dem level gesetzt werden entsprechend
  107. void setLevel( int level, Spiel *zSpiel );
  108. void removeItem( GegenstandTyp typ, int anzahl );
  109. void setLeben( float leben );
  110. void setMaxLeben( int leben );
  111. // steuert auch level up oder level downs bei negativer erfahrung
  112. void setErfahrung( float erf, Spiel *zSpiel );
  113. void setMaxErfahrung( int erf );
  114. void setAbklingZeitVerringerung( float verringerung );
  115. float getLebensRegenneration() const;
  116. float getArmor() const;
  117. float getGeschossTempo() const;
  118. float getLebensRaub() const;
  119. float getSchadenBonus() const;
  120. int getSpielerNummer() const;
  121. Team *zTeam() const;
  122. Team *getTeam() const;
  123. int getFarbe() const;
  124. int getAccountId() const;
  125. int getPunkte() const;
  126. bool istAmLeben() const;
  127. float getLaufTempo() const;
  128. bool isVerwundbar( Richtung r ) const;
  129. bool istBeweglich( Richtung r ) const;
  130. bool istSichtbar( Team *zTeam ) const;
  131. bool istGegenstandErlaubt( GegenstandTyp typ ) const;
  132. Richtung getAusrichtung() const;
  133. float getAbklingZeitVerringerung() const;
  134. int getId() const;
  135. int getLevel() const;
  136. float getLeben() const;
  137. int getMaxLeben() const;
  138. float getErfahrung() const;
  139. int getMaxErfahrung() const;
  140. int getTode() const;
  141. int getKills() const;
  142. int getTreffer() const;
  143. int getGetroffen() const;
  144. float getErlittenerSchaden() const;
  145. float getGemachterSchaden() const;
  146. float getGeheiltesLeben() const;
  147. int getItemsAufgehoben() const;
  148. int getItemsVerwendet() const;
  149. int getItemsInInventory() const;
  150. int getItemsInInventory( GegenstandTyp typ ) const;
  151. int getTunnelBenutzt() const;
  152. int getSchalterAktiviert() const;
  153. int getGeschossen() const;
  154. GegenstandTyp getInventorySlot( int index ) const;
  155. const char *getName() const;
  156. };