Skip to content

Commit

Permalink
Fixes Charge Weapons (#1511)
Browse files Browse the repository at this point in the history
Fixing Charges
  • Loading branch information
scionalu authored Oct 15, 2023
1 parent 2defb31 commit 0f5e459
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
. += "Spend [charge]/[charge_cost] charge to [charge_effect]"

/obj/item/ego_weapon/city/charge/attack(mob/living/target, mob/living/user)
..()
. = ..()
if(!.)
return FALSE
if(charge<20 && target.stat != DEAD)
charge+=1

/obj/item/ego_weapon/city/charge/proc/release_charge(mob/living/target, mob/living/user)
if(!CanUseEgo(user))
return
charge -= charge_cost
charge = round(max(charge, 0), 1)
to_chat(user, "<span class='notice'>[release_message].</span>")
2 changes: 2 additions & 0 deletions code/game/objects/items/ego_weapons/non_abnormality/cane.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

/obj/item/ego_weapon/city/charge/cane/attack_self(mob/user)
..()
if(!CanUseEgo(user))
return FALSE
if(charge>=charge_cost)
var/target //Didn't even need new var, could literally put anything for first arg, but for consistency sake and less confusion
release_charge(target, user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
qdel(I)

/obj/item/ego_weapon/city/charge/rosespanner/attack(mob/living/target, mob/living/user)
..()
. = ..()
if(!.)
return FALSE
if(charge == 20)
overcharged = TRUE
activated = TRUE
Expand Down
8 changes: 5 additions & 3 deletions code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
to_chat(user, "<span class='notice'>You don't have enough charge.</span>")

/obj/item/ego_weapon/city/charge/wcorp/attack(mob/living/target, mob/living/user)
..()
. = ..()
if(!.)
return FALSE
if(activated)
release_charge(target, user)
activated = FALSE
Expand Down Expand Up @@ -305,9 +307,9 @@
attack_speed = 1.5

/obj/item/ego_weapon/city/charge/wcorp/shield/club/attack(mob/living/target, mob/living/user)
if(!CanUseEgo(user))
return
. = ..()
if(!.)
return FALSE
var/atom/throw_target = get_edge_target_turf(target, user.dir)
if(!target.anchored)
var/whack_speed = (prob(60) ? 1 : 4)
Expand Down
14 changes: 10 additions & 4 deletions code/game/objects/items/ego_weapons/subtype/charge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
. += "Spend [charge]/[charge_cost] charge to [charge_effect]"

/obj/item/ego_weapon/charge/attack(mob/living/target, mob/living/user)
..()
. = ..()
if(!.)
return FALSE
if((target.stat == DEAD) || (GODMODE in target.status_flags))//if the target is dead or godmode
return
return FALSE
if(charge<20)
charge+=1

Expand All @@ -38,7 +40,9 @@
to_chat(user, "<span class='notice'>You don't have enough charge.</span>")

/obj/item/ego_weapon/charge/onattack/attack(mob/living/target, mob/living/user)
..()
. = ..()
if(!.)
return FALSE
if(activated)
charge -= charge_cost
to_chat(user, "<span class='notice'>[release_message].</span>")
Expand All @@ -48,7 +52,9 @@

//On use Subtype
/obj/item/ego_weapon/charge/onuse/attack_self(mob/user)
..()
. = ..()
if(!.)
return FALSE
if(charge>=charge_cost)
charge -= charge_cost
to_chat(user, "<span class='notice'>[release_message].</span>")
Expand Down

0 comments on commit 0f5e459

Please sign in to comment.