26 #ifndef SAGA2_EFFECTS_H 27 #define SAGA2_EFFECTS_H 29 #include "saga2/dice.h" 84 enum effectResistTypes {
85 kResistOther = kDamageOther,
87 kResistImpact = kDamageImpact,
88 kResistSlash = kDamageSlash,
89 kResistProjectile = kDamageProjectile,
91 kResistFire = kDamageFire,
92 kResistAcid = kDamageAcid,
93 kResistHeat = kDamageHeat,
94 kResistCold = kDamageCold,
95 kResistLightning = kDamageLightning,
96 kResistPoison = kDamagePoison,
98 kResistMental = kDamageMental,
99 kResistToUndead = kDamageToUndead,
100 kResistDirMagic = kDamageDirMagic,
102 kResistStarve = kDamageStarve,
104 kResistEnergy = kDamageEnergy
112 enum effectImmuneTypes {
113 kImmuneOther = kResistOther,
115 kImmuneImpact = kResistImpact,
116 kImmuneSlash = kResistSlash,
117 kImmuneProjectile = kResistProjectile,
119 kImmuneFire = kResistFire,
120 kImmuneAcid = kResistAcid,
121 kImmuneHeat = kResistHeat,
122 kImmuneCold = kResistCold,
123 kImmuneLightning = kResistLightning,
124 kImmunePoison = kResistPoison,
126 kImmuneMental = kResistMental,
127 kImmuneToUndead = kResistToUndead,
128 kImmuneDirMagic = kResistDirMagic,
130 kImmuneStarve = kResistStarve,
132 kImmuneEnergy = kResistEnergy
140 enum effectOthersTypes {
142 kActorNoncorporeal = 1,
143 kActorWaterBreathe = 2,
149 kActorFastAttack = 7,
150 kActorSlowAttack = 8,
155 kActorParalyzed = 11,
162 kActorClairvoyant = 17,
163 kActorInvisible = 18,
164 kActorUndetectable = 19,
165 kActorDetPoison = 20,
167 kActorNoEnchant = 21,
170 kActorRepelEvil = 23,
171 kActorRepelGood = 24,
172 kActorRepelUndead = 25,
174 kActorNotDefenseless = 26,
175 kActorDisappearOnDeath = 27,
185 enum effectDrainsTypes {
203 enum effectTAGTypes {
213 enum kEffectLocationTypes {
218 kObjectOpen = (1 << 0),
219 kObjectLocked = (1 << 1),
220 kObjectImportant = (1 << 2),
221 kObjectGhosted = (1 << 3),
222 kObjectInvisible = (1 << 4),
223 kObjectObscured = (1 << 5),
224 kObjectMoving = (1 << 6),
225 kObjectScavengable = (1 << 7),
226 kObjectFloating = (1 << 8),
227 kObjectNoRecycle = (1 << 9),
228 kObjectActivated = (1 << 10),
229 kObjectAlias = (1 << 11),
230 kObjectTriggeringTAG = (1 << 12),
231 kObjectOnScreen = (1 << 13),
232 kObjectSightedByCenter = (1 << 14)
240 enum effectSpecialTypes {
241 kSpecialDispellHelpfulEnch = 1,
242 kSpecialDispellHarmfulEnch,
250 kSpecialCreateWraith,
264 inline uint16 makeEnchantmentID(uint16 type, uint16 damtyp, int16 damamt) {
267 assert(damamt < 128 && damamt > -128);
268 return ((type << 13) | (damtyp << 8)) + (damamt + 128);
276 inline uint16 makeEnchantmentID(effectResistTypes restyp,
bool damamt) {
277 return ((kEffectResist << 13) | (restyp << 8)) + (damamt + 128);
280 inline uint16 makeEnchantmentID(effectImmuneTypes immtyp,
bool damamt) {
281 return ((kEffectImmune << 13) | (immtyp << 8)) + (damamt + 128);
284 inline uint16 makeEnchantmentID(effectOthersTypes othtyp,
bool damamt) {
285 return ((kEffectOthers << 13) | (othtyp << 8)) + (damamt + 128);
288 inline uint16 makeEnchantmentID(objectFlags othtyp,
bool damamt) {
289 return ((kEffectNonActor << 13) | (othtyp << 8)) + (damamt + 128);
292 inline uint16 makeEnchantmentID(uint8 damamt) {
293 return ((kEffectPoison << 13) | (0 << 8)) + damamt;
296 inline effectTypes getEnchantmentType(uint16 eID) {
297 return (effectTypes)(eID >> 13);
300 inline uint16 getEnchantmentSubType(uint16 eID) {
301 return (eID >> 8) & 0x1F;
304 inline int16 getEnchantmentAmount(uint16 eID) {
305 return (eID & 0xFF) - 128;
311 inline bool isHarmful(uint16 enchID) {
312 int16 typ = getEnchantmentType(enchID);
313 int16 sub = getEnchantmentSubType(enchID);
314 int16 amt = getEnchantmentAmount(enchID);
315 if (typ == kEffectAttrib)
return amt < 0;
316 if (typ == kEffectOthers)
317 return (sub >= kActorSlowAttack && sub <= kActorBlind);
324 inline bool isSaveable(uint16 enchID) {
325 int16 typ = getEnchantmentType(enchID);
326 return (typ == kEffectOthers && isHarmful(enchID));
332 inline bool isMagicDamage(effectDamageTypes t) {
333 return t >= kDamageFire && t <= kDamageDirMagic;
336 #define Forever (255) 359 if (_next)
delete _next;
375 effectDamageTypes _type;
385 ProtoDamage(int8 d, int8 s, int8 sd, int8 b, effectDamageTypes t,
int,
bool afSelf =
false, int8 sb = 0) {
399 static int16 getRelevantStat(effectDamageTypes dt,
Actor *a);
408 effectDrainsTypes _type;
417 ProtoDrainage(int8 d, int8 s, int8 sd, int8 b, effectDrainsTypes t,
int,
bool afSelf =
false) {
430 static int16 currentLevel(
Actor *a, effectDrainsTypes edt);
431 static void drainLevel(
GameObject *cst,
Actor *a, effectDrainsTypes edt, int16 amt);
456 return isSaveable(_enchID);
459 static bool realSavingThrow(
Actor *a);
467 effectTAGTypes _affectBit;
509 kEffectLocationTypes _affectBit;
534 #define SPECIALSPELL(name) void name(GameObject *cst, SpellTarget *trg) 538 SPELLIMPLEMENTATION *_handler;
542 _handler = newHandler;
Definition: effects.h:407
Definition: effects.h:487
Definition: effects.h:466
Definition: objects.h:118
Definition: effects.h:508
Definition: effects.h:348
Definition: effects.h:374
Definition: speldefs.h:139
Definition: effects.h:439
Definition: effects.h:536