Spieler.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #pragma once
  2. #include "Team.h"
  3. #include "Gegenstand.h"
  4. #include "SSKlient.h"
  5. #include "Effect.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. GegenstandTyp useItem();
  20. void tick( double zeit );
  21. bool canAddItem( GegenstandTyp typ ) const;
  22. GegenstandTyp selectedItem() const;
  23. };
  24. class Spieler : public GameObject
  25. {
  26. private:
  27. RCArray< Effect > effekte;
  28. Klient *klient;
  29. int accountId;
  30. int spielerNummer;
  31. Team *team;
  32. bool amLeben;
  33. int maxWiederbelebungsZeit;
  34. float wiederbelebungsZeit;
  35. GegenstandTyp zuletztAufgehoben;
  36. GegenstandTyp zuletztAktiviert;
  37. float leben;
  38. int maxLeben;
  39. int level;
  40. float erfahrung;
  41. int maxErfahrung;
  42. int spawnX;
  43. int spawnY;
  44. float laufTempo;
  45. float geschossTempo;
  46. float armor;
  47. float schadensBonus;
  48. float lebensraub;
  49. float lebensRegeneration;
  50. float abklingZeitVerringerung;
  51. int color;
  52. int kills;
  53. int tode;
  54. int treffer;
  55. int getroffen;
  56. float schadenGenommen;
  57. float schadenGemacht;
  58. float lebenGeheilt;
  59. float erhalteneErfahrung;
  60. int itemsAufgehoben;
  61. int itemsVerwendet;
  62. int tunnelBenutzt;
  63. int schalterAktiviert;
  64. int geschosseGeschossen;
  65. bool tastenStand[ 256 ];
  66. Richtung ausrichtung;
  67. Inventar inv;
  68. public:
  69. Spieler( int id, Team *team, int spawnX, int spawnY, int farbe );
  70. ~Spieler();
  71. bool setTastenStand( unsigned char taste, bool pressed );
  72. void setTeam( Team *team );
  73. void setAccount( int id );
  74. void setKlient( Klient *klient );
  75. void addEffekt( Effect *e );
  76. void setLaufTempo( float pps );
  77. void addErfahrung( float anz, Spiel *zSpiel );
  78. // aktualisiert auch die team statistik
  79. void addKill();
  80. void addTreffer( Spiel *zSpiel );
  81. void addGetroffen();
  82. void move( double zeit );
  83. void wiederbelebung( Spiel *zSpiel );
  84. void tick( double zeit, Spiel *zSpiel );
  85. void useItem(Spiel *zSpiel);
  86. bool addItem( GegenstandTyp typ, int anz, Spiel *zSpiel );
  87. // heilt auch um den lebensraub prozentsatz
  88. void addGemachterSchaden( float schaden, Spiel *zSpiel );
  89. // zieht die rüstung ab
  90. void nimmSchaden( float schaden, Spieler *zVerursacher, Richtung r, Spiel *zSpiel );
  91. void heilung( float heal, Spiel *zSpiel );
  92. void setSchadenBonus( float bonus );
  93. void setLebensRaub( float raub );
  94. void setGeschossTempo( float tempo );
  95. void setArmor( float armor );
  96. void setLebensRegeneration( float reg );
  97. // setzt alle eigenschafften, die mit dem level gesetzt werden entsprechend
  98. void setLevel( int level );
  99. void removeItem( GegenstandTyp typ, int anzahl );
  100. void setLeben( float leben );
  101. void setMaxLeben( int leben );
  102. // steuert auch level up oder level downs bei negativer erfahrung
  103. void setErfahrung( float erf );
  104. void setMaxErfahrung( int erf );
  105. void setAbklingZeitVerringerung( float verringerung );
  106. float getLebensRegenneration() const;
  107. float getArmor() const;
  108. float getGeschossTempo() const;
  109. float getLebensRaub() const;
  110. float getSchadenBonus() const;
  111. Klient *zKlient() const;
  112. int getSpielerNummer() const;
  113. Team *zTeam() const;
  114. Team *getTeam() const;
  115. int getFarbe() const;
  116. int getAccountId() const;
  117. int getPunkte() const;
  118. bool istAmLeben() const;
  119. float getLaufTempo() const;
  120. bool isVerwundbar( Richtung r ) const;
  121. bool istBeweglich( Richtung r ) const;
  122. bool istSichtbar( Team *zTeam ) const;
  123. // TODO return false if abklingzeit is active
  124. bool istGegenstandErlaubt( GegenstandTyp typ ) const;
  125. Richtung getAusrichtung() const;
  126. float getAbklingZeitVerringerung() const;
  127. int getId() const;
  128. int getLevel() const;
  129. float getLeben() const;
  130. int getMaxLeben() const;
  131. float getErfahrung() const;
  132. int getMaxErfahrung() const;
  133. int getTode() const;
  134. int getKills() const;
  135. int getTreffer() const;
  136. int getGetroffen() const;
  137. float getErlittenerSchaden() const;
  138. float getGemachterSchaden() const;
  139. float getGeheiltesLeben() const;
  140. int getItemsAufgehoben() const;
  141. int getItemsVerwendet() const;
  142. int getItemsInInventory() const;
  143. int getItemsInInventory( GegenstandTyp typ ) const;
  144. int getTunnelBenutzt() const;
  145. int getSchalterAktiviert() const;
  146. int getGeschossen() const;
  147. GegenstandTyp getInventorySlot( int index ) const;
  148. const char *getName() const;
  149. };