FANDOM


Created by Taz.

Using "RC_Core.rcm"
; Define entry function 'Main'

Function Main()
Player = Actor()
Target = ContextActor()
PName$ = Name(Player)
TName$ = Name(Target)

TargetX = ActorX(Target)
TargetY = ActorY(Target)
TargetZ = ActorZ(Target)

Plevel% = ActorLevel(Player)
Tlevel% = ActorLevel(Target)
;-------------------------Damage Formula-----------------------------------------------------------
Damage% = Plevel + Tlevel * 20
THealth% = Attribute(Target, "Health")
FinalDamage% = THealth - Damage

If (FinalDamage < 0)
	FinalDamage% = 0
EndIf
;-------------------------End DamageFormula---------------------------------------------------------

VampBlood% = Attribute(Player, "Blood")
AbilityCost% = 15

TotBloodCost% = VampBlood - AbilityCost

    If (VampBlood < AbilityCost)
        OutPut(Player, "You do not have enough blood for that.", 255, 0, 0)
        Return
     Endif
 
 
 
 ;----------------------------------------------------------------------------------------------------
   If (Target = 0) ; Check target is valid

  		Output(Player, "Select a target for your pet to attack!")
 		Return
    EndIf
 ;----------------------------------------------------------------------------------------------------
;--------------------------------Vampire Check--------------------------------------------------------
 ;If vamp dont tell player they cant use a pet in this form            
                IsVamp% = ActorId("Vampire", "Form")
                PRace$ = Race(Player)     
                PClass$ = Class(Player)
                PlayerID% =ActorID(PRace, PClass)
                
                If Not (IsVamp = PlayerID) ;if player is a vampire
                    OutPut(Player, "You can not use a vampire ability in human form.", 255, 34, 12)
                    Return
                EndIf
;----------------------------End Vampire Check--------------------------------------------------------
			Result% = ActorDistance(Player, Target)
					 If (Result > 140)  ;check distance of target.
							Output(Player, "Your to far away, from your target!")
							PetFound = 1
							Return
						
					 EndIf
			 PetSpeed% = Attribute(Player, "Speed")
			 ChargeSpeed% = PetSpeed + 18
			 SetAttribute(Player, "Speed", ChargeSpeed)
		     BubbleOutPut(Player, "CHARGE!!")
			  		Result2% = ActorDistance(Player, Target)
			  		MoveActor(Player,TargetX,TargetY,TargetZ,1)
			  		AnimateActor(Player, "Run", .5, 2)
			  		DoEvents(1000)
			  		If (Result2 < 8)
			  			SetAttribute(Target, "Health", FinalDamage)
			  			CreateFloatingNumber(Player, Damage, 0, 0, 0)
			  		EndIf
                    
      SetAttribute(Player, "Blood", TotBloodCost) ;take blood cost
               
                     
OldSpeed% = Attribute(Player, "MobSpeed")
SetAttribute(Player, "Speed", OldSpeed)

End Function