183 lines
5.5 KiB
Plaintext
183 lines
5.5 KiB
Plaintext
Scriptname _00E_Theriantrophist_WolfAttributes extends Quest
|
|
; script that manages the werewolf attributes, shows the current stats
|
|
; in the active effect window and resets them to the human values when the
|
|
; transformation ends
|
|
|
|
Actor Property PlayerREF Auto
|
|
MiscObject Property _00E_UpdateInventoryItem Auto
|
|
Weapon Property _00E_Theriantrophist_Claws Auto
|
|
Spell Property _00E_Theriantrophist_DisplayDamageSpell Auto
|
|
Spell Property _00E_Theriantrophist_DisplayHealthSpell Auto
|
|
Spell Property _00E_Theriantrophist_DisplayStaminaSpell Auto
|
|
Spell Property _00E_Theriantrophist_DisplayArmorSpell Auto
|
|
{this spell is not a pure display spell anymore, since it contains the shield effect that makes the wolf armor}
|
|
Spell Property _00E_Theriantrophist_DisplaySpeedMultSpell Auto
|
|
|
|
Float Property WerewolfBaseCarryCapacity = 200 AutoReadOnly Hidden
|
|
Float carryCapacityMod
|
|
|
|
; the health/stamina bonus (or malus) the wolf has in comparison to human form
|
|
Float healthMod
|
|
Float staminaMod
|
|
|
|
Float temporarySpeedMultMod
|
|
Float speedMult
|
|
Float humanSpeedMult
|
|
|
|
; the absolute damage resist/unarmed damage values the player has while in wolf form
|
|
Float damageResist
|
|
Float unarmedDamage
|
|
Float temporaryUnarmedDamageMod
|
|
|
|
Function SetInWolfForm(bool wolfForm)
|
|
if wolfForm
|
|
gotoState("WolfForm")
|
|
else
|
|
gotoState("")
|
|
Endif
|
|
EndFunction
|
|
|
|
Function RemoveDisplaySpell(Spell displaySpell)
|
|
PlayerREF.removeSpell(displaySpell)
|
|
EndFunction
|
|
|
|
Function UpdateDisplaySpell(Spell displaySpell, Float value)
|
|
RemoveDisplaySpell(displaySpell)
|
|
Endfunction
|
|
|
|
Function ModWolfHealth(Float mod)
|
|
healthMod += mod
|
|
PlayerREF.modAV("health", mod)
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplayHealthSpell, healthMod)
|
|
Endfunction
|
|
|
|
Function ModWolfStamina(Float mod)
|
|
staminaMod += mod
|
|
PlayerREF.modAV("stamina", mod)
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplayStaminaSpell, staminaMod)
|
|
EndFunction
|
|
|
|
Float Function GetWolfUnarmedDamage()
|
|
return unarmedDamage
|
|
EndFunction
|
|
|
|
Function ForceWolfUnarmedDmg(Float value)
|
|
unarmedDamage = value
|
|
|
|
_00E_Theriantrophist_Claws.setBaseDamage((unarmedDamage + temporaryUnarmedDamageMod) as int)
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplayDamageSpell, unarmedDamage)
|
|
Endfunction
|
|
|
|
Function SetWolfTempWolfUnarmedDamageMod(Float newTempMod)
|
|
temporaryUnarmedDamageMod = newTempMod
|
|
ForceWolfUnarmedDmg(unarmedDamage)
|
|
EndFunction
|
|
|
|
Function ModWolfUnarmedDmg(Float mod)
|
|
ForceWolfUnarmedDmg(unarmedDamage + mod)
|
|
Endfunction
|
|
|
|
Function ForceWolfDamageResist(Float value)
|
|
damageResist = value
|
|
; the display spell now contains a shield effect
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplayArmorSpell, value)
|
|
Endfunction
|
|
|
|
Function ModWolfDamageResist(Float mod)
|
|
ForceWolfDamageResist(damageResist + mod)
|
|
EndFunction
|
|
|
|
Function ForceWolfSpeedMult(Float value)
|
|
speedMult = value
|
|
PlayerREF.setAV("speedMult", speedMult + temporarySpeedMultMod)
|
|
updateSpeedMult()
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplaySpeedMultSpell, speedMult - 100)
|
|
EndFunction
|
|
|
|
Function SetTemporarilyWolfSpeedMultMod(Float value)
|
|
temporarySpeedMultMod = value
|
|
ForceWolfSpeedMult(speedMult)
|
|
EndFunction
|
|
|
|
Function ModWolfAV(String attribute, Float mod)
|
|
if (attribute == "health")
|
|
ModWolfHealth(mod)
|
|
elseif (attribute == "stamina")
|
|
ModWolfStamina(mod)
|
|
elseif (attribute == "unarmedDamage")
|
|
ModWolfUnarmedDmg(mod)
|
|
elseif (attribute == "damageResist")
|
|
ModWolfDamageResist(mod)
|
|
elseif (attribute == "speedMult")
|
|
ForceWolfSpeedMult(PlayerREF.getAV("speedMult") + mod)
|
|
EndIf
|
|
EndFunction
|
|
|
|
Function updateSpeedMult()
|
|
PlayerREF.additem(_00E_UpdateInventoryItem, 1, true)
|
|
PlayerREF.removeItem(_00E_UpdateInventoryItem, 1, true)
|
|
Endfunction
|
|
|
|
Function renewNotPersistentStats()
|
|
EndFunction
|
|
|
|
Function updateAfterRaceSwitch(bool toWolf)
|
|
ForceWolfSpeedMult(speedMult)
|
|
if (toWolf)
|
|
PlayerREF.modAV("CarryWeight", carryCapacityMod)
|
|
else
|
|
PlayerREF.modAV("CarryWeight", -carryCapacityMod)
|
|
Endif
|
|
EndFunction
|
|
|
|
State WolfForm
|
|
|
|
Event OnBeginState()
|
|
temporaryUnarmedDamageMod = 0
|
|
unarmedDamage = 0
|
|
damageResist = 0
|
|
healthMod = 0
|
|
staminaMod = 0
|
|
carryCapacityMod = PlayerREF.getAV("CarryWeight") - WerewolfBaseCarryCapacity
|
|
|
|
humanSpeedMult = PlayerREF.getAV("speedMult")
|
|
speedMult = humanSpeedMult
|
|
temporarySpeedMultMod = 0
|
|
renewNotPersistentStats()
|
|
Endevent
|
|
|
|
Event OnEndState()
|
|
if (healthMod > PlayerREF.getAV("health"))
|
|
PlayerREF.restoreAV("health", healthMod - PlayerREF.getAV("health") + 1)
|
|
Endif
|
|
PlayerREF.modAV("health", -healthMod)
|
|
PlayerREF.modAV("stamina", -staminaMod)
|
|
PlayerREF.setAV("speedMult", humanSpeedMult)
|
|
temporarySpeedMultMod = 0
|
|
updateSpeedMult()
|
|
|
|
RemoveDisplaySpell(_00E_Theriantrophist_DisplayDamageSpell)
|
|
RemoveDisplaySpell(_00E_Theriantrophist_DisplayHealthSpell)
|
|
RemoveDisplaySpell(_00E_Theriantrophist_DisplayStaminaSpell)
|
|
RemoveDisplaySpell(_00E_Theriantrophist_DisplayArmorSpell)
|
|
RemoveDisplaySpell(_00E_Theriantrophist_DisplaySpeedMultSpell)
|
|
Endevent
|
|
|
|
Function renewNotPersistentStats()
|
|
Utility.wait(0.5)
|
|
PlayerREF.setAV("speedMult", speedMult + temporarySpeedMultMod)
|
|
updateSpeedMult()
|
|
ForceWolfDamageResist(damageResist)
|
|
ForceWolfUnarmedDmg(unarmedDamage)
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplaySpeedMultSpell, speedMult)
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplayHealthSpell, healthMod)
|
|
UpdateDisplaySpell(_00E_Theriantrophist_DisplayStaminaSpell, staminaMod)
|
|
EndFunction
|
|
|
|
Function UpdateDisplaySpell(Spell displaySpell, Float value)
|
|
displaySpell.setNthEffectMagnitude(0, value)
|
|
PlayerREF.removeSpell(displaySpell)
|
|
PlayerREF.addSpell(displaySpell, false)
|
|
Endfunction
|
|
EndState
|