Better use an enum for magic effect IDs

pull/16/head
scrawl 12 years ago
parent 1666bc7740
commit dd57eabc3e

@ -203,9 +203,9 @@ namespace MWClass
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (8)).mMagnitude; // feather
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Feather)).mMagnitude;
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (7)).mMagnitude; // burden
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Burden)).mMagnitude;
if (weight<0)
weight = 0;

@ -471,9 +471,9 @@ namespace MWClass
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (8)).mMagnitude; // feather
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Feather)).mMagnitude;
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (7)).mMagnitude; // burden
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Burden)).mMagnitude;
if (weight<0)
weight = 0;

@ -459,7 +459,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_PcCorprus:
return MWWorld::Class::get (player).getCreatureStats (player).
getMagicEffects().get (132).mMagnitude!=0;
getMagicEffects().get (ESM::MagicEffect::Corprus).mMagnitude!=0;
case SelectWrapper::Function_PcExpelled:
{

@ -159,7 +159,7 @@ namespace MWGui
float hourlyHealthDelta = stats.getAttribute(ESM::Attribute::Endurance).getModified() * 0.1;
bool stunted = (stats.getMagicEffects().get(MWMechanics::EffectKey(136)).mMagnitude > 0);
bool stunted = (stats.getMagicEffects().get(MWMechanics::EffectKey(ESM::MagicEffect::StuntedMagicka)).mMagnitude > 0);
float fRestMagicMult = store.get<ESM::GameSetting>().find("fRestMagicMult")->getFloat();
float hourlyMagickaDelta = fRestMagicMult * stats.getAttribute(ESM::Attribute::Intelligence).getModified();

@ -71,7 +71,7 @@ namespace MWMechanics
int endurance = creatureStats.getAttribute(5).getBase();
double magickaFactor =
creatureStats.getMagicEffects().get (EffectKey (84)).mMagnitude * 0.1 + 0.5;
creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::FortifyMaximumMagicka)).mMagnitude * 0.1 + 0.5;
DynamicStat<float> health = creatureStats.getHealth();
health.setBase (static_cast<int> (0.5 * (strength + endurance)) + creatureStats.getLevelHealthBonus ());
@ -92,8 +92,7 @@ namespace MWMechanics
if (duration == 3600)
{
// stunted magicka
bool stunted = stats.getMagicEffects ().get(MWMechanics::EffectKey(136)).mMagnitude > 0;
bool stunted = stats.getMagicEffects ().get(MWMechanics::EffectKey(ESM::MagicEffect::StuntedMagicka)).mMagnitude > 0;
int endurance = stats.getAttribute (ESM::Attribute::Endurance).getModified ();
@ -140,9 +139,9 @@ namespace MWMechanics
for (int i=0; i<8; ++i)
{
int modifier =
creatureStats.getMagicEffects().get (EffectKey (79, i)).mMagnitude;
creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::FortifyAttribute, i)).mMagnitude;
modifier -= creatureStats.getMagicEffects().get (EffectKey (17, i)).mMagnitude;
modifier -= creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::DrainAttribute, i)).mMagnitude;
creatureStats.getAttribute(i).setModifier (modifier);
}

@ -705,7 +705,7 @@ namespace MWMechanics
}
}
float shield = MWWorld::Class::get(ptr).getCreatureStats(ptr).getMagicEffects().get(3).mMagnitude;
float shield = MWWorld::Class::get(ptr).getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Shield).mMagnitude;
return ratings[MWWorld::InventoryStore::Slot_Cuirass] * 0.3
+ (ratings[MWWorld::InventoryStore::Slot_CarriedLeft] + ratings[MWWorld::InventoryStore::Slot_Helmet]

@ -1259,7 +1259,7 @@ namespace MWWorld
World::isFlying(const MWWorld::Ptr &ptr) const
{
const MWWorld::Class &cls = MWWorld::Class::get(ptr);
if(cls.isActor() && cls.getCreatureStats(ptr).getMagicEffects().get(MWMechanics::EffectKey(10/*levitate*/)).mMagnitude > 0)
if(cls.isActor() && cls.getCreatureStats(ptr).getMagicEffects().get(MWMechanics::EffectKey(ESM::MagicEffect::Levitate)).mMagnitude > 0)
return true;
return false;
}

@ -66,6 +66,158 @@ struct MagicEffect
void load(ESMReader &esm);
void save(ESMWriter &esm);
enum Effects
{
WaterBreathing = 0,
SwiftSwim = 1,
WaterWalking = 2,
Shield = 3,
FireShield = 4,
LightningShield = 5,
FrostShield = 6,
Burden = 7,
Feather = 8,
Jump = 9,
Levitate = 10,
SlowFall = 11,
Lock = 12,
Open = 13,
FireDamage = 14,
ShockDamage = 15,
FrostDamage = 16,
DrainAttribute = 17,
DrainHealth = 18,
DrainMagicka = 19,
DrainFatigue = 20,
DrainSkill = 21,
DamageAttribute = 22,
DamageHealth = 23,
DamageMagicka = 24,
DamageFatigue = 25,
DamageSkill = 26,
Poison = 27,
WeaknessToFire = 28,
WeaknessToFrost = 29,
WeaknessToShock = 30,
WeaknessToMagicka = 31,
WeaknessToCommonDisease = 32,
WeaknessToBlightDisease = 33,
WeaknessToCorprusDisease = 34,
WeaknessToPoison = 35,
WeaknessToNormalWeapons = 36,
DisintegrateWeapon = 37,
DisintegrateArmor = 38,
Invisibility = 39,
Chameleon = 40,
Light = 41,
Sanctuary = 42,
NightEye = 43,
Charm = 44,
Paralyze = 45,
Silence = 46,
Blind = 47,
Sound = 48,
CalmHumanoid = 49,
CalmCreature = 50,
FrenzyHumanoid = 51,
FrenzyCreature = 52,
DemoralizeHumanoid = 53,
DemoralizeCreature = 54,
RallyHumanoid = 55,
RallyCreature = 56,
Dispel = 57,
Soultrap = 58,
Telekinesis = 59,
Mark = 60,
Recall = 61,
DivineIntervention = 62,
AlmsiviIntervention = 63,
DetectAnimal = 64,
DetectEnchantment = 65,
DetectKey = 66,
SpellAbsorption = 67,
Reflect = 68,
CureCommonDisease = 69,
CureBlightDisease = 70,
CureCorprusDisease = 71,
CurePoison = 72,
CureParalyzation = 73,
RestoreAttribute = 74,
RestoreHealth = 75,
RestoreMagicka = 76,
RestoreFatigue = 77,
RestoreSkill = 78,
FortifyAttribute = 79,
FortifyHealth = 80,
FortifyMagicka= 81,
FortifyFatigue = 82,
FortifySkill = 83,
FortifyMaximumMagicka = 84,
AbsorbAttribute = 85,
AbsorbHealth = 86,
AbsorbMagicka = 87,
AbsorbFatigue = 88,
AbsorbSkill = 89,
ResistFire = 90,
ResistFrost = 91,
ResistShock = 92,
ResistMagicka = 93,
ResistCommonDisease = 94,
ResistBlightDisease = 95,
ResistCorprusDisease = 96,
ResistPoison = 97,
ResistNormalWeapons = 98,
ResistParalysis = 99,
RemoveCurse = 100,
TurnUndead = 101,
SummonScamp = 102,
SummonClannfear = 103,
SummonDaedroth = 104,
SummonDremora = 105,
SummonAncestralGhost = 106,
SummonSkeletalMinion = 107,
SummonBonewalker = 108,
SummonGreaterBonewalker = 109,
SummonBonelord = 110,
SummonWingedTwilight = 111,
SummonHunger = 112,
SummonGoldenSaint = 113,
SummonFlameAtronach = 114,
SummonFrostAtronach = 115,
SummonStormAtronach = 116,
FortifyAttack = 117,
CommandCreature = 118,
CommandHumanoid = 119,
BoundDagger = 120,
BoundLongsword = 121,
BoundMace = 122,
BoundBattleAxe = 123,
BoundSpear = 124,
BoundLongbow = 125,
ExtraSpell = 126,
BoundCuirass = 127,
BoundHelm = 128,
BoundBoots = 129,
BoundShield = 130,
BoundGloves = 131,
Corprus = 132,
Vampirism = 133,
SummonCenturionSphere = 134,
SunDamage = 135,
StuntedMagicka = 136,
// Tribunal only
SummonFabricant = 137,
// Bloodmoon only
SummonWolf = 138,
SummonBear = 139,
SummonBonewolf = 140,
SummonCreature04 = 141,
SummonCreature05 = 142
};
};
}
#endif

Loading…
Cancel
Save