1/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
2#ifndef GAME_SERVER_ENTITIES_PLASMA_H
3#define GAME_SERVER_ENTITIES_PLASMA_H
4
5#include <game/server/entity.h>
6
7/**
8 * Plasma Bullets are projectiles fired from turrets at a specific target
9 *
10 * When hitting a tee, plasma bullets can either freeze or unfreeze the player
11 * Also, plasma projectiles can explode on impact. However, the player affected by the explosion is not necessarily the
12 * one the plasma collided with, but if the affected player is not a solo player, then the team-mate with the lowest
13 * ClientId within the explosion range. Furthermore, the affected player does not feel the explosion at the point of
14 * impact but at the last position of the plasma bullet. The same applies if a plasma bullet explodes due to a collision
15 * with a laser stopper or a solid block
16 * Plasma bullets move every tick in the assigned direction and then accelerate by the factor PLASMA_ACCEL
17 * Plasma bullets can explode twice if they would hit both a player and an obstacle in the next movement step
18 * Plasma bullets will stop existing as soon as:
19 * - The player they were created for do no longer exist
20 * - They have had a collision with a player, a solid block or a laser stopper
21 * - Their life time of 1.5 seconds has expired
22 */
23class CPlasma : public CEntity
24{
25 vec2 m_Core;
26 int m_Freeze;
27 bool m_Explosive;
28 int m_ForClientId;
29 int m_EvalTick;
30 int m_LifeTime;
31
32 void Move();
33 bool HitCharacter(CCharacter *pTarget);
34 bool HitObstacle(CCharacter *pTarget);
35
36public:
37 CPlasma(CGameWorld *pGameWorld, vec2 Pos, vec2 Dir, bool Freeze,
38 bool Explosive, int ForClientId);
39
40 void Reset() override;
41 void Tick() override;
42 void Snap(int SnappingClient) override;
43 void SwapClients(int Client1, int Client2) override;
44};
45
46#endif // GAME_SERVER_ENTITIES_PLASMA_H
47