Scriptname aaaKimachuuAGoodfriendNPCSexSCH Extends ActiveMagicEffect

Spell Property aaaKimachuuAGFNSspellG1 Auto
Spell Property aaaKimachuuAGFNSspellG2 Auto
Spell Property aaaKimachuuAGFNSspellG3 Auto
MagicEffect Property aaaKimachuuAGFNSmeCT1 Auto
MagicEffect Property aaaKimachuuAGFNSmeCT2 Auto
MagicEffect Property aaaKimachuuAGFNSmeCT3 Auto
Message Property aaaKimachuuAGFNSMESGs Auto
Message Property aaaKimachuuAGFNSnoti08 Auto ;ターゲットが存在しません
Message Property aaaKimachuuAGFNSnoti09 Auto ;グループ1から削除
Message Property aaaKimachuuAGFNSnoti10 Auto ;グループ1へ追加
Message Property aaaKimachuuAGFNSnoti11 Auto ;グループ2から削除
Message Property aaaKimachuuAGFNSnoti12 Auto ;グループ2へ追加
Message Property aaaKimachuuAGFNSnoti13 Auto ;グループ3から削除
Message Property aaaKimachuuAGFNSnoti14 Auto ;グループ3へ追加

Bool s1
Bool s2
Bool s3

Int ss1
Int ss2
Int ss3

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Actor TargetRef = Game.GetCurrentCrosshairRef() as Actor

	if !TargetRef
		aaaKimachuuAGFNSnoti08.Show()
	Else
		s1 = TargetRef.HasSpell(aaaKimachuuAGFNSspellG1)
		s2 = TargetRef.HasSpell(aaaKimachuuAGFNSspellG2)
		s3 = TargetRef.HasSpell(aaaKimachuuAGFNSspellG3)

		if TargetRef.HasMagicEffect(aaaKimachuuAGFNSmeCT1)
			ss1 = 2
		Elseif s1 == true
			ss1 = 1
		Else
			ss1 = 0
		endif

		if TargetRef.HasMagicEffect(aaaKimachuuAGFNSmeCT2)
			ss2 = 2
		Elseif s2 == true
			ss2 = 1
		Else
			ss2 = 0
		endif

		if TargetRef.HasMagicEffect(aaaKimachuuAGFNSmeCT3)
			ss3 = 2
		Elseif s3 == true
			ss3 = 1
		Else
			ss3 = 0
		endif

		Int intIndex
		intIndex = aaaKimachuuAGFNSMESGs.Show(ss1, ss2, ss3)

		If intIndex == 0 ;Group1
			if TargetRef.HasSpell(aaaKimachuuAGFNSspellG1)
				TargetRef.RemoveSpell(aaaKimachuuAGFNSspellG1)
				aaaKimachuuAGFNSnoti09.Show()
			Else
				TargetRef.AddSpell(aaaKimachuuAGFNSspellG1)
				aaaKimachuuAGFNSnoti10.Show()				
			EndIf
		ElseIf intIndex == 1 ;Group2
			if TargetRef.HasSpell(aaaKimachuuAGFNSspellG2)
				TargetRef.RemoveSpell(aaaKimachuuAGFNSspellG2)
				aaaKimachuuAGFNSnoti11.Show()
			Else
				TargetRef.AddSpell(aaaKimachuuAGFNSspellG2)
				aaaKimachuuAGFNSnoti12.Show()				
			EndIf
		ElseIf intIndex == 2 ;Group3
			if TargetRef.HasSpell(aaaKimachuuAGFNSspellG3)
				TargetRef.RemoveSpell(aaaKimachuuAGFNSspellG3)
				aaaKimachuuAGFNSnoti13.Show()
			Else
				TargetRef.AddSpell(aaaKimachuuAGFNSspellG3)
				aaaKimachuuAGFNSnoti14.Show()			
			EndIf
		Else ;Cancel
			;empty
		EndIf
	EndIf
EndEvent