Scriptname VampireFeedingHotkeyScript Extends ActiveMagicEffect  
{allows the vampire to feed by pressing a hotkey}

PlayerVampireQuestScript Property PlayerVampireQuest  Auto
GlobalVariable Property VampireSneakFeed Auto
Keyword Property Vampire Auto
GlobalVariable Property VampireCustomRace Auto
Race Property DLC1VampireBeastRace Auto
Keyword Property ActorTypeNPC Auto
Keyword Property ActorTypeUndead Auto
Keyword Property ActorTypeGhost Auto
Faction Property DLC1ThrallFaction Auto
MagicEffect Property DLC1VampireMesmerizeMagicEffect Auto
MagicEffect Property PerkMasterMindAggDownFFAimed Auto
MagicEffect Property InfluenceAggDownFFAimed Auto
GlobalVariable Property VampireForceFeed Auto
dlc1vampireturnscript Property DLC1VampireTurn  Auto
GlobalVariable Property VampireFeedOffDead Auto
MagicEffect Property ParalysisFFAimedVampireSleep2 Auto
GlobalVariable Property VampireCombatBite Auto
Perk Property VampireAmaranth Auto
GlobalVariable Property VampireRank Auto 
Race Property FalmerRace Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

	;VampireFeed Perk 1 - Sneak Feeding

		If (Game.GetPlayer().IsSneaking() == 1 && VampireSneakFeed.GetValue() == 0 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000) && Game.GetPlayer().GetRace() != DLC1VampireBeastRace) && (akTarget.GetActorValue("variable08") != 9 && akTarget.HasLOS(Game.GetPlayer()) == 0 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeUndead) == 0 && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 0 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 0 && akTarget.IsDead() == 0 && akTarget.GetSleepState() != 3 && akTarget.IsInFaction(DLC1ThrallFaction) == 0 && akTarget.HasMagicEffect(DLC1VampireMesmerizeMagicEffect) == 0 && akTarget.HasMagicEffect(PerkMasterMindAggDownFFAimed) == 0 && akTarget.HasMagicEffect(InfluenceAggDownFFAimed) == 0)
		
			;Debug.Notification("Feeding")
			Game.GetPlayer().StartVampireFeed(akTarget as actor)
			PlayerVampireQuest.VampireFeed(akTarget as actor)
		
		EndIf
		
	;VampireFeed Perk 2 - Force Feeding When Bleeding Out

		If (VampireForceFeed.GetValue() == 0 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000)) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeUndead) == 0 && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 0 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 1 && akTarget.IsDead() == 0 && akTarget.GetSleepState() == 0 && akTarget.HasMagicEffect(DLC1VampireMesmerizeMagicEffect) == 0 && akTarget.HasMagicEffect(PerkMasterMindAggDownFFAimed) == 0 && akTarget.HasMagicEffect(InfluenceAggDownFFAimed) == 0)
		
			;Debug.Notification("Feeding")
			Game.GetPlayer().StartVampireFeed(akTarget as actor)
			PlayerVampireQuest.VampireFeed(akTarget as actor)
		
		EndIf
		
	;VampireFeed Perk 3 - Seduction Feeding

		If (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeUndead) == 0 && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 0 && akTarget.IsChild() == 0 && akTarget.IsDead() == 0 && akTarget.GetSleepState() == 0 && akTarget.GetSitState() == 0 && akTarget.IsInFaction(DLC1ThrallFaction) == 0 && (akTarget.HasMagicEffect(DLC1VampireMesmerizeMagicEffect) == 1 || akTarget.HasMagicEffect(PerkMasterMindAggDownFFAimed) == 1 || akTarget.HasMagicEffect(InfluenceAggDownFFAimed) == 1))
		
			;Debug.Notification("Feeding")
			DLC1VampireTurn.PlayerBitesMe(akTarget as actor)
			Game.GetPlayer().StartVampireFeed(akTarget as actor)
			PlayerVampireQuest.VampireFeed(akTarget as actor)
		
		EndIf		
		
	;VampireFeed Perk 4 - Feeding Off Dead Bodies

		If ((Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000) && VampireFeedOffDead.GetValue() < 20000) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeUndead) == 0 && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 0 && akTarget.IsChild() == 0 && akTarget.IsDead() == 1)
		
			;Debug.Notification("Feeding")
			Game.GetPlayer().StartVampireFeed(akTarget as actor)
			PlayerVampireQuest.VampireFeed(akTarget as actor)
		
		EndIf		
		
	;VampireFeed Perk 5 - Fear's Embrace Feeding

		If ((Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000) && Game.GetPlayer().GetRace() != DLC1VampireBeastRace) && (akTarget.GetActorValue("variable08") != 9 && akTarget.HasLOS(Game.GetPlayer()) == 0 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeUndead) == 0 && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 0 && akTarget.IsChild() == 0 && akTarget.IsDead() == 0 && akTarget.GetSleepState() != 3 && akTarget.HasMagicEffect(ParalysisFFAimedVampireSleep2) == 1)
		
			;Debug.Notification("Feeding")
			Game.GetPlayer().StartVampireFeed(akTarget as actor)
			PlayerVampireQuest.VampireFeed(akTarget as actor)
		
		EndIf
		
	;VampireFeed Perk 6 - Sleeping or Thrall Feeding

		If (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeUndead) == 0 && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 0 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 0 && akTarget.IsDead() == 0 && (akTarget.GetSleepState() == 3 || akTarget.IsInFaction(DLC1ThrallFaction) == 1))
		
			;Debug.Notification("Feeding")
			DLC1VampireTurn.PlayerBitesMe(akTarget as actor)
			Game.GetPlayer().StartVampireFeed(akTarget as actor)
			PlayerVampireQuest.VampireFeed(akTarget as actor)
		
		EndIf		
		
;	;VampireFeed Perk 7 - Combat Biting
;
;		If (VampireCombatBite.GetValue() == 0 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000)) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeUndead) == 0 && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 0 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 0 && akTarget.IsDead() == 0 && akTarget.IsInCombat() == 1 && akTarget.GetSleepState() == 0 && akTarget.IsInFaction(DLC1ThrallFaction) == 0 && akTarget.HasMagicEffect(DLC1VampireMesmerizeMagicEffect) == 0 && akTarget.HasMagicEffect(PerkMasterMindAggDownFFAimed) == 0 && akTarget.HasMagicEffect(InfluenceAggDownFFAimed) == 0)
;		
;			Debug.Notification("Biting")
;			PlayerVampireQuest.VampireBite(akTarget as actor)
;		
;		EndIf		
		
; =====================================================================================================================================================
	
	If Game.GetPlayer().HasPerk(VampireAmaranth)
	
		; VampireAmaranth Perk 1 - Sneak Feeding on a Vampire			
	
			If (VampireRank.GetValue() >= 60000 && Game.GetPlayer().IsSneaking() == 1 && VampireSneakFeed.GetValue() == 0 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000) && Game.GetPlayer().GetRace() != DLC1VampireBeastRace) && (akTarget.GetActorValue("variable08") != 9 && akTarget.GetActorValue("variable05") != 666 && akTarget.HasLOS(Game.GetPlayer()) == 0 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 1 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 0 && akTarget.IsDead() == 0 && akTarget.GetSleepState() != 3 && akTarget.IsInFaction(DLC1ThrallFaction) == 0 && akTarget.HasMagicEffect(DLC1VampireMesmerizeMagicEffect) == 0 && akTarget.HasMagicEffect(PerkMasterMindAggDownFFAimed) == 0 && akTarget.HasMagicEffect(InfluenceAggDownFFAimed) == 0)
	
				;Debug.Notification("Feeding")
				Game.GetPlayer().StartVampireFeed(akTarget as actor)
				PlayerVampireQuest.VampireFeed(akTarget as actor)
	
			EndIf
	
		;VampireAmaranth Perk 2 - Force Feeding on a Vampire When Bleeding Out

			If (VampireRank.GetValue() >= 60000 && akTarget.GetActorValue("variable05") != 666 && VampireForceFeed.GetValue() == 0 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000)) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 1 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 1 && akTarget.IsDead() == 0 && akTarget.GetSleepState() == 0 && akTarget.HasMagicEffect(DLC1VampireMesmerizeMagicEffect) == 0 && akTarget.HasMagicEffect(PerkMasterMindAggDownFFAimed) == 0 && akTarget.HasMagicEffect(InfluenceAggDownFFAimed) == 0)
			
				;Debug.Notification("Feeding")
				Game.GetPlayer().StartVampireFeed(akTarget as actor)
				PlayerVampireQuest.VampireFeed(akTarget as actor)
			
			EndIf
	
		;VampireAmaranth Perk 4 - Feeding Off Dead Vampire Bodies

			If (VampireRank.GetValue() >= 60000 && akTarget.GetActorValue("variable05") != 666 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000) && VampireFeedOffDead.GetValue() < 20000) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 1 && akTarget.IsChild() == 0 && akTarget.IsDead() == 1)
			
				;Debug.Notification("Feeding")
				Game.GetPlayer().StartVampireFeed(akTarget as actor)
				PlayerVampireQuest.VampireFeed(akTarget as actor)
			
			EndIf			
	
		;VampireAmaranth Perk 6 - Sleeping Vampire Feeding

			If (VampireRank.GetValue() >= 60000 && akTarget.GetActorValue("variable05") != 666 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000)) && (akTarget.GetActorValue("variable08") != 9 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 1 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 0 && akTarget.IsDead() == 0 && akTarget.GetSleepState() == 3)
			
				;Debug.Notification("Feeding")
				DLC1VampireTurn.PlayerBitesMe(akTarget as actor)
				Game.GetPlayer().StartVampireFeed(akTarget as actor)
				PlayerVampireQuest.VampireFeed(akTarget as actor)
			
			EndIf			
	
;		; VampireAmaranth Perk 7 - Combat Biting		
;		
;			If (VampireRank.GetValue() >= 60000 && VampireCombatBite.GetValue() == 0 && (Game.GetPlayer().HasKeyword(Vampire) || VampireCustomRace.GetValue() == 10000)) && (akTarget.GetActorValue("variable08") != 9 && akTarget.GetActorValue("variable05") != 666 && (akTarget.HasKeyword(ActorTypeNPC) || akTarget.GetActorBase().GetRace() == FalmerRace) && akTarget.HasKeyword(ActorTypeGhost) == 0 && akTarget.IsGhost() == 0 && akTarget.HasKeyword(Vampire) == 1 && akTarget.IsChild() == 0 && akTarget.IsBleedingOut() == 0 && akTarget.IsInCombat() == 1 && akTarget.IsDead() == 0 && akTarget.GetSleepState() == 0 && akTarget.IsInFaction(DLC1ThrallFaction) == 0 && akTarget.HasMagicEffect(DLC1VampireMesmerizeMagicEffect) == 0 && akTarget.HasMagicEffect(PerkMasterMindAggDownFFAimed) == 0 && akTarget.HasMagicEffect(InfluenceAggDownFFAimed) == 0)
;
;				Debug.Notification("Biting")
;				PlayerVampireQuest.VampireBite(akTarget as actor)
;
;			EndIf	
	
	EndIf
	
EndEvent






















