FANDOM


Created by Taz.

Using "RC_Core.rcm"
; Morgance Online 0.1
; Date/Time: 3:36:34 PM on 7/21/2012
; Dan Seguin on TAZCO-PC
;Saber cat maul 2 hits


Function Main()

Player = Actor()
Target = ContextActor()

PLvl% = ActorLevel(Player)
Tlvl% = ActorLevel(Target)
PEnergy% = Attribute(Player, "Energy")
EnergyCost% = 35
TotEnergyCost% = PEnergy - EnergyCost
IsSaber% = ActorHasEffect(Player, "Saber Cat")

    If (PEnergy < EnergyCost) ;tell player they dont have enough energy to do this ability
        OutPUt(Player, "You do not have enough energy, for this ability.")
       Return 
     EndIf
 
 
 
 PMelee% = Attribute(Player, "Melee")
 PStr% = Attribute(Player, "Strength")
 PAgi% = Attribute(Player, "Agility")
 TArmor% = Tlvl + Attribute(Target, "Toughness") + ItemArmor(ActorChest(Target)) + ItemArmor(ActorHat(Target)) + ItemArmor(ActorShield(Target)) * .04
 
     If (IsSaber = 0) ;tell player they need to be in saber cat form.    
        OutPut(Player, "You need to be in saber cat form, to use this ability.")
        Return
     EndIf
 
 
     Dmg% = PLvl + PMelee + PStr + PAgi + AbilityLevel(Player, "Saber Maul")
    OtherDmg% = Dmg + Rand(50, 70)
    ExtraDmg% = Rand(Dmg, OtherDmg) + Dmg
    SecondDmgAmount% = Dmg + Rand(25, 45)
    TotalDmg% = ExtraDmg + SecondDmgAmount - TArmor


        If (TotalDmg <= 0) ;give min dmg
            TotalDmg% = Dmg        
        EndIf
         
    If (Target = 0) ; Check target is valid

 		Output(Player, "Select a target!")
 		Return
    EndIf  
         
         
          If (Result > 10)  ;check distance of target.
            Output(Player, "You are to far away!")
            Return	
         EndIf
  
 
 SetAttribute(Player, "Energy", TotEnergyCost) ; take energy from player   
 AnimateActor(Player, "SAttack", 1.2, 2) ;show spin attack animation
 CreateEmitter(Target, "Blood", 12, 200)
 CreateFloatingNumber(Target, TotalDmg, 70, 50, 255) ;red normal attack
 DoEvents(200)
 CreateEmitter(Target, "Blood", 12, 60)
 DoEvents(50)
 CreateEmitter(Target, "Blood", 12, 50) 
 DoEvents(1000)
 CreateFloatingNumber(Target, SecondDmgAmount, 70, 50, 255) ;red normal attack       
 TargetHp% = Attribute(Target, "Health")
 
 CreateFloatingNumber(Target, TotalDmg, 70, 50, 255) ;red normal attack
  
     DmgToHP% = TargetHp - TotalDmg ;- dmg for total health
    
     If (DmgToHp <= 0) ;player is dead.
    
          HumanTarget% = ActorIsHuman(Player)
     
                      If (HumanTarget = 1)
                             ;send target to pvp kill tracker
                            ThreadExecute("Pvp_Kill_Tracker", "Main", Player, 0, Target)  
               ;---------Rep Check-------------------------------
                         TargetNotHuman% = ActorIsHuman(Target)
                        If (TargetNotHuman = 1 ) 
                     ;Get target rep to pass on to rep check.
                      ;----------------------------------------------
                           TarRep% = ActorGlobal(Target, 6)
                
                      ;OutPut(Player, "DEBUG ------ target rep is " + TarRep, 230, 145, 23)
                      ;----------------------------------------------
                            ThreadExecute("Rep_Tag_neg-pos_check", "Main", Player, 0, TarRep) ; send to check player tags	
                        EndIf 
                ;---------------------------------------------------------------------------------------
               
       ;---------------------------------------------------------
                                ;if target killed is a youg lion send player, Lion tamer Achievement
                                YLName$ = "Young Lion"
                                  TName$ = Name(Target)
                            If (TName = YLName)
                                ; OutPut(Player, "----- Debug ----- You have killed a young lion", 230, 145, 23)
                                ThreadExecute("In-game Achievements", "LionMain", Player, 0) ;send to young lion Achievement
                            EndIf
    ;---------------------------------------------------------
                     
               
                     EndIf 
    
     SetAttribute(Target, "Health", 0)
    ;-----------------------------------------------------------------------------------------------------------------------    
	;Output(Player, "You have killed " + TName, 255, 0, 0)
    Output(Target, "You have been killed by " + PName + "!", 255, 0, 0)
          ;------------------------------------------------------   
       ;Give custom xp
         ;Set Actor health to 0 on death so that custom xp can be used.
         SetAttribute(Target, "Health", 0)
         ;give custom xp 
         XpCalc% =  PlayerLevel * 3  ;xp formula
         Xpgiven% = 0
         
          If (TargetLevel >= PlayerLevel + 5)
          ;if target level is higher then player, give extra xp
          ExtraXp% = Rnd(17, 25) + TargetLevel + XpCalc 
          GiveXP(Player, ExtraXp)
          Xpgiven% = 5
         EndIf 
           
          If (PlayerLevel >= TargetLevel + 5)
          ;if Player level is higher then target, give emin xp
          ExtraXp% = Rnd(1, 2)
          GiveXP(Player, ExtraXp)
          Xpgiven% = 5
         EndIf
           
          If (Xpgiven = 0)
          ExtraXp% = Rnd(5, 7) + TargetLevel + XpCalc 
          GiveXP(Player, ExtraXp) 
         EndIf 
           
          ;End Custom xp     
       ;---------------------CUSTOM XP---------------------------------
       
             TName$ = Name(Target) ;name of target
            ThreadExecute("Custom_Loot", "Main", Player, 0, TName) ;send player to CUSTOM_LOOT to recive there loot.
            Doevents(250)
    Doevents(500)
    SetActorGlobal(Player, 5, 1) ;Player out of combat
    Return
 
     EndIf
     
     DoubleHitDmg% = DmgToHP + DmgToHP
    
 SetAttribute(Target, "Health", DoubleHitDmg) ;take dmg from targets health
 
 End Function