Spieler.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. float getSchadenBonus() const;
  93. Klient *zKlient() const;
  94. int getSpielerNummer() const;
  95. Team *zTeam() const;
  96. int getFarbe() const;
  97. int getAccountId() const;
  98. int getPunkte() const;
  99. bool istAmLeben() const;
  100. float getLaufTempo() const;
  101. bool isVerwundbar( Richtung r ) const;
  102. bool istBeweglich( Richtung r ) const;
  103. bool istSichtbar( Team *zTeam ) const;
  104. bool istGegenstandErlaubt( GegenstandTyp typ ) const;
  105. Richtung getAusrichtung() const;
  106. };