spells recharge fix. #976

This commit is contained in:
Poojawa
2017-05-18 11:49:46 -05:00
committed by GitHub
parent 2f0881c0b6
commit 0419ef823b
+10 -4
View File
@@ -21,6 +21,9 @@
return
if(active)
msg = "<span class='notice'>[deactive_msg]</span>"
if(charge_type == "recharge")
var/refund_percent = current_amount/projectile_amount
charge_counter = charge_max * refund_percent
remove_ranged_ability(msg)
else
msg = "<span class='notice'>[active_msg]<B>Left-click to shoot it at a target!</B></span>"
@@ -36,12 +39,12 @@
/obj/effect/proc_holder/spell/aimed/InterceptClickOn(mob/living/caller, params, atom/target)
if(..())
return FALSE
var/ignore = (current_amount >= 1)
if(!cast_check(ignore, ranged_ability_user))
var/ran_out = (current_amount <= 0)
if(!cast_check(!ran_out, ranged_ability_user))
remove_ranged_ability()
return FALSE
var/list/targets = list(target)
perform(targets,user = ranged_ability_user)
perform(targets, ran_out, user = ranged_ability_user)
return TRUE
/obj/effect/proc_holder/spell/aimed/cast(list/targets, mob/living/user)
@@ -52,11 +55,14 @@
return FALSE
fire_projectile(user, target)
user.newtonian_move(get_dir(U, T))
if(--current_amount <= 0)
if(current_amount <= 0)
remove_ranged_ability() //Auto-disable the ability once you run out of bullets.
charge_counter = 0
start_recharge()
return TRUE
/obj/effect/proc_holder/spell/aimed/proc/fire_projectile(mob/living/user, atom/target)
current_amount--
var/obj/item/projectile/P = new projectile_type(user.loc)
P.current = get_turf(user)
P.firer = user