enderalse/source/scripts/_00e_theriantrophist_transformstorage.psc

250 lines
7.1 KiB
Plaintext
Raw Normal View History

Scriptname _00E_Theriantrophist_TransformStorage extends Quest
Form EquippedItemLeft
Form EquippedItemRight
Armor[] wornArmor
Int whatKindLeft
Int whatKindRight
Float armorRating
Float weaponDamageSpeed
Float Property DualWieldLeftHandMalus = 4.0 Autoreadonly Hidden
{The damage of a the left hand weapon is divided by this to avoid exploitation}
Perk Property _00E_Class_BladeDancer_P01_Mercenary_01 Auto ;8
Perk Property _00E_Class_BladeDancer_P01_Mercenary_02 Auto ;7
Perk Property _00E_Class_Vandal_P01_Barbarian_01 Auto ; 12
Perk Property _00E_Class_Vandal_P01_Barbarian_02 Auto ; 10
Perk Property _00E_Class_Trickster_P01_StrongBowstring_01 Auto ; 12
Perk Property _00E_Class_Trickster_P01_StrongBowstring_02 Auto ; 10
ObjectReference Property _00E_TransformStorageREF Auto
int Function GetWeaponDamage(Weapon weapID)
int iDamage
String scalingAV
float fPerkMod
Actor akplayer = Game.GetPlayer()
if weapID.IsBattleaxe() || weapID.IsGreatsword()
scalingAV = "TwoHanded"
elseif weapID.IsBow()
scalingAV = "Marksman"
else
scalingAV = "OneHanded"
endif
if scalingAV == "TwoHanded"
if akplayer.HasPerk(_00E_Class_Vandal_P01_Barbarian_01)
fPerkMod += 12
endif
if akplayer.HasPerk(_00E_Class_Vandal_P01_Barbarian_02)
fPerkMod += 10
endif
elseif scalingAV == "Marksman"
if akplayer.HasPerk(_00E_Class_Trickster_P01_StrongBowstring_01)
fPerkMod += 12
endif
if akplayer.HasPerk(_00E_Class_Trickster_P01_StrongBowstring_02)
fPerkMod += 10
endif
else
if akplayer.HasPerk(_00E_Class_BladeDancer_P01_Mercenary_01)
fPerkMod += 8
endif
if akplayer.HasPerk(_00E_Class_BladeDancer_P01_Mercenary_02)
fPerkMod += 7
endif
endif
2023-12-08 02:45:53 +00:00
iDamage = ((weapID.GetBaseDamage()*weapID.getSpeed())*(1+((akplayer.GetActorValue(scalingAV)*0.55)/100))*(1+(fPerkMod/100))) as Int
return iDamage
EndFunction
function saveEquippedItemsVanilla()
Actor PlayerRef = Game.GetForm(0x14) as Actor
EquippedItemLeft = PlayerRef.GetEquippedWeapon(true) as Form
if ! EquippedItemLeft
EquippedItemLeft = PlayerRef.GetEquippedSpell(0) as Form
endif
EquippedItemRight = PlayerRef.GetEquippedWeapon(false) as Form
if ! EquippedItemRight
EquippedItemRight = PlayerRef.GetEquippedSpell(1) as Form
endif
If !EquippedItemRight
whatKindRight = 0
ElseIf (EquippedItemRight as Weapon)
;weaponDamageSpeed += GetWeaponDamage(EquippedItemRight as Weapon)
whatKindRight = 1
ElseIf (EquippedItemRight as Spell)
whatKindRight = 2
Else
whatKindRight = 1
EndIf
If !EquippedItemLeft
whatKindLeft = 0
ElseIf (EquippedItemLeft as Weapon)
;GetWeaponDamage(EquippedItemLeft as Weapon)
whatKindLeft = 1
ElseIf (EquippedItemLeft as Spell)
whatKindLeft = 2
Else
whatKindLeft = 1
EndIf
wornArmor = new Armor[15]
wornArmor[0] = PlayerRef.GetEquippedArmorInSlot(30) as Armor
wornArmor[1] = PlayerRef.GetEquippedArmorInSlot(31) as Armor
wornArmor[2] = PlayerRef.GetEquippedArmorInSlot(32) as Armor
wornArmor[3] = PlayerRef.GetEquippedArmorInSlot(33) as Armor
wornArmor[4] = PlayerRef.GetEquippedArmorInSlot(34) as Armor
wornArmor[5] = PlayerRef.GetEquippedArmorInSlot(35) as Armor
wornArmor[6] = PlayerRef.GetEquippedArmorInSlot(36) as Armor
wornArmor[7] = PlayerRef.GetEquippedArmorInSlot(37) as Armor
wornArmor[8] = PlayerRef.GetEquippedArmorInSlot(38) as Armor
wornArmor[9] = PlayerRef.GetEquippedArmorInSlot(39) as Armor
wornArmor[10] = PlayerRef.GetEquippedArmorInSlot(40) as Armor
wornArmor[11] = PlayerRef.GetEquippedArmorInSlot(41) as Armor
wornArmor[12] = PlayerRef.GetEquippedArmorInSlot(42) as Armor
wornArmor[13] = PlayerRef.GetEquippedArmorInSlot(43) as Armor
wornArmor[13] = PlayerRef.GetEquippedArmorInSlot(47) as Armor ; backpack
endfunction
Function saveEquippedItems()
Actor PlayerRef = Game.GetForm(0x14) as Actor
EquippedItemLeft = PlayerRef.GetEquippedObject(0)
EquippedItemRight = PlayerRef.GetEquippedObject(1)
weaponDamageSpeed = 0
If !EquippedItemRight
whatKindRight = 0
ElseIf (EquippedItemRight as Weapon)
weaponDamageSpeed += GetWeaponDamage(EquippedItemRight as Weapon)
whatKindRight = 1
ElseIf (EquippedItemRight as Spell)
whatKindRight = 2
Else
whatKindRight = 1
EndIf
If !EquippedItemLeft
whatKindLeft = 0
ElseIf (EquippedItemLeft as Weapon)
GetWeaponDamage(EquippedItemLeft as Weapon)
whatKindLeft = 1
ElseIf (EquippedItemLeft as Spell)
whatKindLeft = 2
Else
whatKindLeft = 1
EndIf
wornArmor = new Armor[15]
wornArmor[0] = PlayerRef.GetWornForm(0x00000001) as Armor
wornArmor[1] = PlayerRef.GetWornForm(0x00000002) as Armor
wornArmor[2] = PlayerRef.GetWornForm(0x00000004) as Armor
wornArmor[3] = PlayerRef.GetWornForm(0x00000008) as Armor
wornArmor[4] = PlayerRef.GetWornForm(0x00000010) as Armor
wornArmor[5] = PlayerRef.GetWornForm(0x00000020) as Armor
wornArmor[6] = PlayerRef.GetWornForm(0x00000040) as Armor
wornArmor[7] = PlayerRef.GetWornForm(0x00000080) as Armor
wornArmor[8] = PlayerRef.GetWornForm(0x00000100) as Armor
wornArmor[9] = PlayerRef.GetWornForm(0x00000200) as Armor
wornArmor[10] = PlayerRef.GetWornForm(0x00000400) as Armor
wornArmor[11] = PlayerRef.GetWornForm(0x00000800) as Armor
wornArmor[12] = PlayerRef.GetWornForm(0x00001000) as Armor
wornArmor[13] = PlayerRef.GetWornForm(0x00002000) as Armor
wornArmor[13] = PlayerRef.GetWornForm(0x00004000) as Armor
wornArmor[14] = PlayerRef.GetWornForm(0x00020000) as Armor
armorRating = 0
Int i = 0
while (i < wornArmor.length)
if (wornArmor[i] != None)
armorRating += wornArmor[i].getArmorRating()
Endif
i += 1
Endwhile
endFunction
Float Function getArmorRating()
return armorRating
Endfunction
Float Function getWeaponDamageSpeed()
return weaponDamageSpeed
Endfunction
bool Function isEquippedItemRightSpell()
return whatKindRight == 2
Endfunction
bool Function isEquippedItemLeftSpell()
return whatKindLeft == 2
Endfunction
Spell Function getEquippedSpellRight()
return EquippedItemRight as Spell
EndFunction
Spell Function getEquippedSpellLeft()
return EquippedItemLeft as Spell
EndFunction
Function equipeItems()
Actor PlayerRef = Game.GetPlayer()
if whatKindRight == 2
PlayerRef.EquipSpell(EquippedItemRight as Spell, 1)
elseif EquippedItemRight && PlayerRef.GetItemCount(EquippedItemRight) > 0
if SKSE.GetVersion()
PlayerRef.EquipItemEx(EquippedItemRight, 1)
else
PlayerRef.equipitem(EquippedItemRight, false, true)
endif
endif
if whatKindLeft == 2
PlayerRef.EquipSpell(EquippedItemLeft as Spell, 0)
elseif EquippedItemLeft && PlayerRef.GetItemCount(EquippedItemLeft) > 0
if SKSE.GetVersion()
PlayerRef.EquipItemEx(EquippedItemLeft, 2)
else
PlayerRef.equipitem(EquippedItemLeft, false, true)
endif
endif
Int index = wornArmor.length
while index > 0
index -= 1
If wornArmor[index] && PlayerRef.GetItemCount(wornArmor[index]) > 0
;removing and readding items fixes the issue that set bonuses wouldn't apply properly after re-transforming
PlayerRef.RemoveItem(wornArmor[index], 1, true, _00E_TransformStorageREF)
_00E_TransformStorageREF.RemoveItem(wornArmor[index], 1, true, PlayerRef)
PlayerRef.EquipItem(wornArmor[index],false,true)
EndIf
Endwhile
endFunction