/****************************************************************************
* [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame | *
* -----------------------------------------------------------| \\._.// *
* SmaugWiz (C) 1998 by Russ Pillsbury (Windows NT version) | (0...0) *
* -----------------------------------------------------------| ).:.( *
* SMAUG (C) 1994, 1995, 1996 by Derek Snider | {o o} *
* -----------------------------------------------------------| / ' ' \ *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus, |~'~.VxvxV.~'~*
* Scryn, Swordbearer, Rennard, Tricops, and Gorog. | *
* ------------------------------------------------------------------------ *
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik Staerfeldt, Tom Madsen, and Katja Nyboe. *
* ------------------------------------------------------------------------ *
* Smaug Affects Interface file *
****************************************************************************/
#ifndef AFFECT_H
#define AFFECT_H
#ifndef BITVECTOR_H
#include "BitVector.h"
#endif
// Bits for 'affected_by'.
// Used in #MOBILES.
enum AffectTypes {
AFF_BLIND, AFF_INVISIBLE, AFF_DETECT_EVIL, AFF_DETECT_INVIS,
AFF_DETECT_MAGIC, AFF_DETECT_HIDDEN, AFF_HOLD, AFF_SANCTUARY,
AFF_FAERIE_FIRE, AFF_INFRARED, AFF_CURSE, AFF_FLAMING, AFF_POISON,
AFF_PROTECT, AFF_PARALYSIS, AFF_SNEAK, AFF_HIDE, AFF_SLEEP, AFF_CHARM,
AFF_FLYING, AFF_PASS_DOOR, AFF_FLOATING, AFF_TRUESIGHT, AFF_DETECTTRAPS,
AFF_SCRYING, AFF_FIRESHIELD, AFF_SHOCKSHIELD, AFF_HAUS1, AFF_ICESHIELD,
AFF_POSSESS, AFF_BERSERK, AFF_AQUA_BREATH, AFF_RECURRINGSPELL,
AFF_CONTAGIOUS, MAX_AFFECTED_BY };
#ifdef SMAUGSERVER_CPP
const char* AffectNames [MAX_AFFECTED_BY] = {
"blind", "invisible", "detect_evil", "detect_invis", "detect_magic",
"detect_hidden", "hold", "sanctuary", "faerie_fire", "infrared", "curse",
"_flaming", "poison", "protect", "_paralysis", "sneak", "hide", "sleep",
"charm", "flying", "pass_door", "floating", "truesight", "detect_traps",
"scrying", "fireshield", "shockshield", "r1", "iceshield", "possess",
"berserk", "aqua_breath", "recurringspell", "contagious" };
#endif
extern const char* AffectNames [MAX_AFFECTED_BY];
class CAffectFlags : public CBitVector {
public:
CString PrintString () const
{ return CBitVector::PrintString (
AffectNames, DIM (AffectNames)); }
static const char* GetName (UINT bit)
{ return (bit < MAX_AFFECTED_BY) ?
AffectNames [bit] : "none"; }
static int GetVector (const char* name)
{ return get_aflag (name); }
};
// An affect.
class CAffectData {
public:
CAffectData ()
{ memset (this, 0, sizeof (CAffectData));
type = duration = bitvector = -1; }
CAffectData (const CAffectData& Af) { *this = Af; }
const char *GetVectorName ()
{ return CAffectFlags::GetName (bitvector); }
void SetVector (const char* name)
{ bitvector = CAffectFlags::GetVector (name); }
void ShowAffect (CCharacter *ch, int nItem=0, BOOL bExtra=FALSE);
// in Handler.cpp
const CAffectData& operator= (const CAffectData& Af)
{ memcpy (this, &Af, sizeof (CAffectData)); return *this; }
int type;
int duration;
int location;
int modifier;
int bitvector;
};
class CAffectList : public CPtrList {
public:
CAffectList () {}
~CAffectList () { RemoveAll (); }
void RemoveAll ()
{ while (! IsEmpty ()) delete RemoveTail ();
CPtrList::RemoveAll (); }
CAffectData *GetNext (POSITION& pos)
{ return (CAffectData*) CPtrList::GetNext (pos); }
CAffectData *GetAt (POSITION& pos)
{ return (CAffectData*) CPtrList::GetAt (pos); }
CAffectData *RemoveTail ()
{ return (CAffectData*) CPtrList::RemoveTail (); }
CAffectData *GetAffect (int loc);
};
// A SMAUG spell
class CSmaugAffect {
public:
CSmaugAffect () { memset (this, 0, sizeof (CSmaugAffect)); }
~CSmaugAffect () { delete duration; delete modifier; }
CSmaugAffect *GetNext () { return m_pNext; }
void SetNext (CSmaugAffect* n) { m_pNext = n; }
CSmaugAffect *m_pNext;
char *duration;
int location;
char *modifier;
int bitvector;
};
#endif