1 #ifndef OPENMW_ESM_MGEF_H 2 #define OPENMW_ESM_MGEF_H 3 4 #include <string> 5 #include <map> 6 7 namespace ESM 8 { 9 10 class ESMReader; 11 class ESMWriter; 12 13 struct MagicEffect 14 { 15 static unsigned int sRecordId; 16 /// Return a string descriptor for this record type. Currently used for debugging / error logs only. getRecordTypeESM::MagicEffect17 static std::string getRecordType() { return "MagicEffect"; } 18 19 std::string mId; 20 21 enum Flags 22 { 23 // Originally fixed flags (HardcodedFlags array consists of just these) 24 TargetSkill = 0x1, // Affects a specific skill, which is specified elsewhere in the effect structure. 25 TargetAttribute = 0x2, // Affects a specific attribute, which is specified elsewhere in the effect structure. 26 NoDuration = 0x4, // Has no duration. Only runs effect once on cast. 27 NoMagnitude = 0x8, // Has no magnitude. 28 Harmful = 0x10, // Counts as a negative effect. Interpreted as useful for attack, and is treated as a bad effect in alchemy. 29 ContinuousVfx = 0x20, // The effect's hit particle VFX repeats for the full duration of the spell, rather than occuring once on hit. 30 CastSelf = 0x40, // Allows range - cast on self. 31 CastTouch = 0x80, // Allows range - cast on touch. 32 CastTarget = 0x100, // Allows range - cast on target. 33 AppliedOnce = 0x1000, // An effect that is applied once it lands, instead of continuously. Allows an effect to reduce an attribute below zero; removes the normal minimum effect duration of 1 second. 34 Stealth = 0x2000, // Unused 35 NonRecastable = 0x4000, // Does not land if parent spell is already affecting target. Shows "you cannot re-cast" message for self target. 36 IllegalDaedra = 0x8000, // Unused 37 Unreflectable = 0x10000, // Cannot be reflected, the effect always lands normally. 38 CasterLinked = 0x20000, // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells. 39 40 // Originally modifiable flags 41 AllowSpellmaking = 0x200, // Can be used for spellmaking 42 AllowEnchanting = 0x400, // Can be used for enchanting 43 NegativeLight = 0x800 // Unused 44 }; 45 46 enum MagnitudeDisplayType 47 { 48 MDT_None, 49 MDT_Feet, 50 MDT_Level, 51 MDT_Percentage, 52 MDT_Points, 53 MDT_TimesInt 54 }; 55 56 struct MEDTstruct 57 { 58 int mSchool; // SpellSchool, see defs.hpp 59 float mBaseCost; 60 int mFlags; 61 // Glow color for enchanted items with this effect 62 int mRed, mGreen, mBlue; 63 64 float mUnknown1; // Called "Size X" in CS 65 float mSpeed; // Speed of fired projectile 66 float mUnknown2; // Called "Size Cap" in CS 67 }; // 36 bytes 68 69 static const std::map<short,std::string> sNames; 70 71 static const std::string &effectIdToString(short effectID); 72 static short effectStringToId(const std::string &effect); 73 74 /// Returns the effect that provides resistance against \a effect (or -1 if there's none) 75 static short getResistanceEffect(short effect); 76 /// Returns the effect that induces weakness against \a effect (or -1 if there's none) 77 static short getWeaknessEffect(short effect); 78 79 MagnitudeDisplayType getMagnitudeDisplayType() const; 80 81 82 MEDTstruct mData; 83 84 std::string mIcon, mParticle; // Textures 85 std::string mCasting, mHit, mArea; // ESM::Static 86 std::string mBolt; // ESM::Weapon 87 std::string mCastSound, mBoltSound, mHitSound, mAreaSound; // Sounds 88 std::string mDescription; 89 90 // Index of this magical effect. Corresponds to one of the 91 // hard-coded effects in the original engine: 92 // 0-136 in Morrowind 93 // 137 in Tribunal 94 // 138-140 in Bloodmoon (also changes 64?) 95 // 141-142 are summon effects introduced in bloodmoon, but not used 96 // there. They can be redefined in mods by setting the name in GMST 97 // sEffectSummonCreature04/05 creature id in 98 // sMagicCreature04ID/05ID. 99 int mIndex; 100 101 void load(ESMReader &esm, bool &isDeleted); 102 void save(ESMWriter &esm, bool isDeleted = false) const; 103 104 /// Set record to default state (does not touch the ID/index). 105 void blank(); 106 107 enum Effects 108 { 109 WaterBreathing = 0, 110 SwiftSwim = 1, 111 WaterWalking = 2, 112 Shield = 3, 113 FireShield = 4, 114 LightningShield = 5, 115 FrostShield = 6, 116 Burden = 7, 117 Feather = 8, 118 Jump = 9, 119 Levitate = 10, 120 SlowFall = 11, 121 Lock = 12, 122 Open = 13, 123 FireDamage = 14, 124 ShockDamage = 15, 125 FrostDamage = 16, 126 DrainAttribute = 17, 127 DrainHealth = 18, 128 DrainMagicka = 19, 129 DrainFatigue = 20, 130 DrainSkill = 21, 131 DamageAttribute = 22, 132 DamageHealth = 23, 133 DamageMagicka = 24, 134 DamageFatigue = 25, 135 DamageSkill = 26, 136 Poison = 27, 137 WeaknessToFire = 28, 138 WeaknessToFrost = 29, 139 WeaknessToShock = 30, 140 WeaknessToMagicka = 31, 141 WeaknessToCommonDisease = 32, 142 WeaknessToBlightDisease = 33, 143 WeaknessToCorprusDisease = 34, 144 WeaknessToPoison = 35, 145 WeaknessToNormalWeapons = 36, 146 DisintegrateWeapon = 37, 147 DisintegrateArmor = 38, 148 Invisibility = 39, 149 Chameleon = 40, 150 Light = 41, 151 Sanctuary = 42, 152 NightEye = 43, 153 Charm = 44, 154 Paralyze = 45, 155 Silence = 46, 156 Blind = 47, 157 Sound = 48, 158 CalmHumanoid = 49, 159 CalmCreature = 50, 160 FrenzyHumanoid = 51, 161 FrenzyCreature = 52, 162 DemoralizeHumanoid = 53, 163 DemoralizeCreature = 54, 164 RallyHumanoid = 55, 165 RallyCreature = 56, 166 Dispel = 57, 167 Soultrap = 58, 168 Telekinesis = 59, 169 Mark = 60, 170 Recall = 61, 171 DivineIntervention = 62, 172 AlmsiviIntervention = 63, 173 DetectAnimal = 64, 174 DetectEnchantment = 65, 175 DetectKey = 66, 176 SpellAbsorption = 67, 177 Reflect = 68, 178 CureCommonDisease = 69, 179 CureBlightDisease = 70, 180 CureCorprusDisease = 71, 181 CurePoison = 72, 182 CureParalyzation = 73, 183 RestoreAttribute = 74, 184 RestoreHealth = 75, 185 RestoreMagicka = 76, 186 RestoreFatigue = 77, 187 RestoreSkill = 78, 188 FortifyAttribute = 79, 189 FortifyHealth = 80, 190 FortifyMagicka= 81, 191 FortifyFatigue = 82, 192 FortifySkill = 83, 193 FortifyMaximumMagicka = 84, 194 AbsorbAttribute = 85, 195 AbsorbHealth = 86, 196 AbsorbMagicka = 87, 197 AbsorbFatigue = 88, 198 AbsorbSkill = 89, 199 ResistFire = 90, 200 ResistFrost = 91, 201 ResistShock = 92, 202 ResistMagicka = 93, 203 ResistCommonDisease = 94, 204 ResistBlightDisease = 95, 205 ResistCorprusDisease = 96, 206 ResistPoison = 97, 207 ResistNormalWeapons = 98, 208 ResistParalysis = 99, 209 RemoveCurse = 100, 210 TurnUndead = 101, 211 SummonScamp = 102, 212 SummonClannfear = 103, 213 SummonDaedroth = 104, 214 SummonDremora = 105, 215 SummonAncestralGhost = 106, 216 SummonSkeletalMinion = 107, 217 SummonBonewalker = 108, 218 SummonGreaterBonewalker = 109, 219 SummonBonelord = 110, 220 SummonWingedTwilight = 111, 221 SummonHunger = 112, 222 SummonGoldenSaint = 113, 223 SummonFlameAtronach = 114, 224 SummonFrostAtronach = 115, 225 SummonStormAtronach = 116, 226 FortifyAttack = 117, 227 CommandCreature = 118, 228 CommandHumanoid = 119, 229 BoundDagger = 120, 230 BoundLongsword = 121, 231 BoundMace = 122, 232 BoundBattleAxe = 123, 233 BoundSpear = 124, 234 BoundLongbow = 125, 235 ExtraSpell = 126, 236 BoundCuirass = 127, 237 BoundHelm = 128, 238 BoundBoots = 129, 239 BoundShield = 130, 240 BoundGloves = 131, 241 Corprus = 132, 242 Vampirism = 133, 243 SummonCenturionSphere = 134, 244 SunDamage = 135, 245 StuntedMagicka = 136, 246 247 // Tribunal only 248 SummonFabricant = 137, 249 250 // Bloodmoon only 251 SummonWolf = 138, 252 SummonBear = 139, 253 SummonBonewolf = 140, 254 SummonCreature04 = 141, 255 SummonCreature05 = 142, 256 257 Length 258 }; 259 260 static std::string indexToId (int index); 261 }; 262 } 263 #endif 264