imported>Lisselli |
imported>Lisselli |
Line 1: |
Line 1: |
| <source lang="papyrus">
| |
| Float Function GetEffectiveSpellCost(Actor akActor, Spell[] akSpells, Spell akSpell, String asSkillName, Float[] afBaseSpellCost)
| |
|
| |
| ; Technical Notes :
| |
| ; Equipment and daul cast is not taken into account for it's difficult to get an item's enchantment magnitude.
| |
| ; Dual cast needs to be taken into account some other way as there is no script function to detect dual casting.
| |
| ; Returns the effective spell cost for the passed in spell that's been modified by skill level and perks if any.
| |
| ; Well return -1.0 if actor or spell is none or the passed in spell was not found in the spell array.
| |
|
| |
| ; = Variables =
| |
| Float fBaseCost
| |
| Float fPerkMulti = 0.50
| |
| Float fEquipMulti ; when necessary and/or is easy to figure out
| |
| Float DualCast = 2.8 ; spell cost is multliplied by this amount
| |
| Float fSkillMulti = 1 - (math.pow((akActor.GetActorValue(asSkillName) / 400), 0.65))
| |
| Int iPerkIndex
| |
| Int iPerks = akPerks.Length
| |
| ; =============
| |
|
| |
| ; = Strings ===
| |
| String sDestruction = "Destruction"
| |
| String sAlteration = "Alteration"
| |
| String sConjuration = "Conjuration"
| |
| String sIllusion = "Illusion"
| |
| String sRestoration = "Restoration"
| |
|
| |
| if (akActor == none)
| |
| return -1.0
| |
| endif
| |
|
| |
| if (akSpell == none)
| |
| return -1.0
| |
| endif
| |
|
| |
| Int i
| |
| Int index = akSpells.Length
| |
|
| |
| ; We need to get the base spell cost for the passed in spell.
| |
| if akSpells.Find(akSpell)
| |
| Int iSpellIndex = akSpells.Find(akSpell)
| |
| fBaseCost = afBaseSpellCost[iSpellIndex]
| |
| Float fEffectiveCost = fBaseCost * fSkillMulti * fPerkMulti as int ; removes the decimal.
| |
| return fEffectiveCost
| |
| else
| |
| return - 1.0
| |
| endif
| |
| EndFunction
| |
| </source>
| |
|
| |
| <br> | | <br> |
|
| |
|