the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 97 lines 2.8 kB view raw
1#pragma once 2using namespace std; 3 4class LivingEntity; 5class Entity; 6class Arrow; 7class Fireball; 8class Player; 9class Explosion; 10 11#include "ChatPacket.h" 12 13class DamageSource 14{ 15public: 16 static DamageSource *inFire; 17 static DamageSource *onFire; 18 static DamageSource *lava; 19 static DamageSource *inWall; 20 static DamageSource *drown; 21 static DamageSource *starve; 22 static DamageSource *cactus; 23 static DamageSource *fall; 24 static DamageSource *outOfWorld; 25 static DamageSource *genericSource; 26 static DamageSource *magic; 27 static DamageSource *dragonbreath; 28 static DamageSource *wither; 29 static DamageSource *anvil; 30 static DamageSource *fallingBlock; 31 32 static DamageSource *mobAttack(shared_ptr<LivingEntity> mob); 33 static DamageSource *playerAttack(shared_ptr<Player> player); 34 static DamageSource *arrow(shared_ptr<Arrow> arrow, shared_ptr<Entity> owner); 35 static DamageSource *fireball(shared_ptr<Fireball> fireball, shared_ptr<Entity> owner); 36 static DamageSource *thrown(shared_ptr<Entity> entity, shared_ptr<Entity> owner); 37 static DamageSource *indirectMagic(shared_ptr<Entity> entity, shared_ptr<Entity> owner); 38 static DamageSource *thorns(shared_ptr<Entity> source); 39 static DamageSource *explosion(Explosion *explosion); 40private: 41 bool _bypassArmor; 42 bool _bypassInvul; 43 // food exhastion caused by being damaged by this source 44 float exhaustion; 45 bool isFireSource; 46 bool _isProjectile; 47 bool _scalesWithDifficulty; 48 bool _isMagic; 49 bool _isExplosion; 50 51public: 52 bool isProjectile(); 53 DamageSource *setProjectile(); 54 bool isExplosion(); 55 DamageSource *setExplosion(); 56 57 bool isBypassArmor(); 58 float getFoodExhaustion(); 59 bool isBypassInvul(); 60 61 //wstring msgId; 62 ChatPacket::EChatPacketMessage m_msgId; // 4J Made int so we can localise 63 ChatPacket::EChatPacketMessage m_msgWithItemId; // 4J: Renamed from m_msgWithSourceId (it was already renamed in places, just made consistent) 64 65protected: 66 //DamageSource(const wstring &msgId); 67 DamageSource(ChatPacket::EChatPacketMessage msgId, ChatPacket::EChatPacketMessage msgWithItemId = ChatPacket::e_ChatCustom); 68 69public: 70 virtual ~DamageSource() {} 71 72 virtual shared_ptr<Entity> getDirectEntity(); 73 virtual shared_ptr<Entity> getEntity(); 74 75protected: 76 DamageSource *bypassArmor(); 77 DamageSource *bypassInvul(); 78 DamageSource *setIsFire(); 79 DamageSource *setScalesWithDifficulty(); 80 81public: 82 virtual bool scalesWithDifficulty(); 83 84 bool isMagic(); 85 DamageSource *setMagic(); 86 87 // 4J Stu - Made return a packet 88 //virtual wstring getLocalizedDeathMessage(shared_ptr<Player> player); 89 virtual shared_ptr<ChatPacket> getDeathMessagePacket(shared_ptr<LivingEntity> player); 90 91 bool isFire(); 92 ChatPacket::EChatPacketMessage getMsgId(); // 4J Stu - Used to return String 93 94 // 4J Added 95 bool equals(DamageSource *source); 96 virtual DamageSource *copy(); 97};