FANDOM


Script created by Taz.

Using "RC_Core.rcm"
; Test
 ; Date/Time: 4:54:33 PM on 10/8/2010
; By Naddaz on TAZCO

Function Main()

	Player = Actor()
	Spellxp% = ActorGlobal(Player, 2)
	plvl% = ActorLevel(Player)
    ManaLevel% = Attribute(Player, "Mana")
    Playerhealth% = Attribute(Player, "Health")
    MagicLvl% = Attribute(Player, "Magic")


StaffHeal% = ItemAttribute(ActorWeapon(Player), "Magic")* 2 + AbilityLevel(Player, "Self Heal") ;Staff Heal 
Healamount% = MagicLvl * 3 + PLvl + StaffHeal + Rand(150, 175)

If ActorHasEffect(Player, "Casting")
OutPut(Player, "You are already casting a spell", 155, 255, 0)
Return
Endif

    If (Playerhealth = Playermaxhealth)
        OutPut(Player, "You Are full health", 250, 145, 32)
        Return
     EndIf
 
 
 	Playermaxhealth% = MaxAttribute(Player, "Health") ;using max attribute since first att number changes. so amount would have a big differance.
 
 ;----------------------------------------------------
;Mana Cost    
       MagicLvl% = Attribute(Player, "Magic")
      SpellCost% = MagicLvl + Rand(15, 20) ;spell cost calculation

;--------------------------------------------------------------------------		
   	
  
     
 ;Mana check
 	If (ManaLevel < SpellCost)
 		Output(Player, "Insufficient mana - spell failed!")
 		Return
 	EndIf
     
 	SetAttribute(Player, "Mana", Manalevel - SpellCost)
 	OutPut(Player, "Cost of this spell is " + SpellCost, 100, 210, 123)
 	  ; Particles and casting animation
     AnimateActor(Player, "Spell cast", .5, 2) ;Particles and casting animation
	CreateEmitter(Player, "Holdenemy", 10, 1000) ; casting emitter
	DoEvents(300)

PBar% = CreateProgressBar(Player, 5, 85, 155, 0.40, 0.82, 0.2, 0.04, 4, 4, "Casting Heal") ; casting bar
Ticks% = 3


Repeat


Doevents(500)
Ticks% = Ticks - 1
;updated progress bar has to be before actor hp if dead check. Progress bar will update then be deleted if player is dead.
UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar

 Playerhealth% = Attribute(Player, "Health")

    If (Playerhealth <= 1)
    DeleteProgressBar(Player, PBar) ;delete progressbar
    Return
     Endif
 
 Until (Ticks = 0)
 
 
     DeleteProgressBar(Player, PBar) ;delete progressbar
	 ; Add health
     CreateEmitter(Player, "Heal_Other", 10, 1000)
     DoEvents(400)
    CreateEmitter(Player, "HealthSpell", 10, 2000)
	Tothealth% = Attribute(Player, "Health") + Healamount
	DoEvents(500)
    CreateFloatingNumber(Player, Healamount, 0, 255, 0) ;green normal attack 
	;Output(Player, "You healed " + Healamount + " of your health", 100, 210, 123)
	SetAttribute(Player, "Health", Tothealth)
	SetActorGlobal(Player, 2, givespellXp)
    ThreadExecute("LevelUp", "Main", Player, 0) ; Done
    ScreenFlash(Player, 0, 0, 205, 255, 1000, 65535)
End Function