mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 16:29:55 +00:00
Add functions to get the effect affecting resistance and weakness for another effect
This commit is contained in:
parent
d619d0fa25
commit
c5f1bbcc5f
2 changed files with 100 additions and 0 deletions
|
@ -81,6 +81,100 @@ void MagicEffect::save(ESMWriter &esm) const
|
|||
esm.writeHNOString("DESC", mDescription);
|
||||
}
|
||||
|
||||
short MagicEffect::getResistanceEffect(short effect)
|
||||
{
|
||||
// Source https://wiki.openmw.org/index.php?title=Research:Magic#Effect_attribute
|
||||
|
||||
// <Effect, Effect providing resistance against first effect>
|
||||
std::map<short, short> effects;
|
||||
effects[DisintegrateArmor] = Sanctuary;
|
||||
effects[DisintegrateWeapon] = Sanctuary;
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DrainAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DamageAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[AbsorbAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<10; ++i)
|
||||
effects[WeaknessToFire+i] = ResistMagicka;
|
||||
|
||||
effects[Burden] = ResistMagicka;
|
||||
effects[Charm] = ResistMagicka;
|
||||
effects[Silence] = ResistMagicka;
|
||||
effects[Blind] = ResistMagicka;
|
||||
effects[Sound] = ResistMagicka;
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
effects[CalmHumanoid] = ResistMagicka;
|
||||
effects[FrenzyHumanoid] = ResistMagicka;
|
||||
effects[DemoralizeHumanoid] = ResistMagicka;
|
||||
effects[RallyHumanoid] = ResistMagicka;
|
||||
}
|
||||
|
||||
effects[TurnUndead] = ResistMagicka;
|
||||
|
||||
effects[FireDamage] = ResistFire;
|
||||
effects[FrostDamage] = ResistFrost;
|
||||
effects[ShockDamage] = ResistShock;
|
||||
effects[Vampirism] = ResistCommonDisease;
|
||||
effects[Corprus] = ResistCorprusDisease;
|
||||
effects[Poison] = ResistPoison;
|
||||
effects[Paralyze] = ResistParalysis;
|
||||
|
||||
if (effects.find(effect) != effects.end())
|
||||
return effects[effect];
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
short MagicEffect::getWeaknessEffect(short effect)
|
||||
{
|
||||
std::map<short, short> effects;
|
||||
effects[DisintegrateArmor] = Sanctuary;
|
||||
effects[DisintegrateWeapon] = Sanctuary;
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DrainAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DamageAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[AbsorbAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<10; ++i)
|
||||
effects[WeaknessToFire+i] = WeaknessToMagicka;
|
||||
|
||||
effects[Burden] = WeaknessToMagicka;
|
||||
effects[Charm] = WeaknessToMagicka;
|
||||
effects[Silence] = WeaknessToMagicka;
|
||||
effects[Blind] = WeaknessToMagicka;
|
||||
effects[Sound] = WeaknessToMagicka;
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
effects[CalmHumanoid] = WeaknessToMagicka;
|
||||
effects[FrenzyHumanoid] = WeaknessToMagicka;
|
||||
effects[DemoralizeHumanoid] = WeaknessToMagicka;
|
||||
effects[RallyHumanoid] = WeaknessToMagicka;
|
||||
}
|
||||
|
||||
effects[TurnUndead] = WeaknessToMagicka;
|
||||
|
||||
effects[FireDamage] = WeaknessToFire;
|
||||
effects[FrostDamage] = WeaknessToFrost;
|
||||
effects[ShockDamage] = WeaknessToShock;
|
||||
effects[Vampirism] = WeaknessToCommonDisease;
|
||||
effects[Corprus] = WeaknessToCorprusDisease;
|
||||
effects[Poison] = WeaknessToPoison;
|
||||
|
||||
// Weakness to magicka or -1 ?
|
||||
effects[Paralyze] = WeaknessToMagicka;
|
||||
|
||||
if (effects.find(effect) != effects.end())
|
||||
return effects[effect];
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static std::map<short,std::string> genNameMap()
|
||||
{
|
||||
|
|
|
@ -58,6 +58,12 @@ struct MagicEffect
|
|||
|
||||
static const std::string &effectIdToString(short effectID);
|
||||
static short effectStringToId(const std::string &effect);
|
||||
|
||||
/// Returns the effect that provides resistance against \a effect (or -1 if there's none)
|
||||
static short getResistanceEffect(short effect);
|
||||
/// Returns the effect that induces weakness against \a effect (or -1 if there's none)
|
||||
static short getWeaknessEffect(short effect);
|
||||
|
||||
MagnitudeDisplayType getMagnitudeDisplayType() const;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue