the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 54 lines 1.2 kB view raw
1#pragma once 2 3#include "SharedConstants.h" 4 5class CombatEntry; 6class LivingEntity; 7class ChatPacket; 8 9class CombatTracker 10{ 11public: 12 static const int RESET_DAMAGE_STATUS_TIME = SharedConstants::TICKS_PER_SECOND * 5; 13 static const int RESET_COMBAT_STATUS_TIME = SharedConstants::TICKS_PER_SECOND * 15; 14 15 // 4J: This enum replaces 16 enum eLOCATION 17 { 18 eLocation_GENERIC = 0, 19 eLocation_LADDER, 20 eLocation_VINES, 21 eLocation_WATER, 22 23 eLocation_COUNT, 24 }; 25 26private: 27 vector<CombatEntry *> entries; 28 LivingEntity *mob; //Owner 29 int lastDamageTime; 30 bool inCombat; 31 bool takingDamage; 32 eLOCATION nextLocation; // 4J: Location is now an enum, not a string 33 34public: 35 CombatTracker(LivingEntity *mob); 36 ~CombatTracker(); 37 38 void prepareForDamage(); 39 void recordDamage(DamageSource *source, float health, float damage); 40 shared_ptr<ChatPacket> getDeathMessagePacket(); // 4J: Changed this to return a chat packet 41 shared_ptr<LivingEntity> getKiller(); 42 43private: 44 CombatEntry *getMostSignificantFall(); 45 eLOCATION getFallLocation(CombatEntry *entry); 46 47public: 48 bool isTakingDamage(); 49 bool isInCombat(); 50 51private: 52 void resetPreparedStatus(); 53 void recheckStatus(); 54};