Skip to content

Commit

Permalink
Code Readability - Spells (#18141)
Browse files Browse the repository at this point in the history
* changed fake disintegrate to not need a permit (as far as sec bots are concerned)

* prefer boolean defines to magic numbers

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* added check

* spells

* Revert "added check"

This reverts commit 082aa40.

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
  • Loading branch information
KalevTait and AffectedArc07 authored Jul 1, 2022
1 parent 8b87691 commit d1da076
Show file tree
Hide file tree
Showing 24 changed files with 83 additions and 83 deletions.
22 changes: 11 additions & 11 deletions code/datums/spell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
name = "Spell" // Only rename this if the spell you're making is not abstract
desc = "A wizard spell"
panel = "Spells"//What panel the proc holder needs to go on.
density = 0
opacity = 0
density = FALSE
opacity = FALSE

var/school = "evocation" //not relevant at now, but may be important later if there are changes to how spells work. the ones I used for now will probably be changed... maybe spell presets? lacking flexibility but with some other benefit?

Expand All @@ -92,11 +92,11 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
var/holder_var_type = "bruteloss" //only used if charge_type equals to "holder_var"
var/holder_var_amount = 20 //same. The amount adjusted with the mob's var when the spell is used

var/ghost = 0 // Skip life check.
var/clothes_req = 1 //see if it requires clothes
var/human_req = 0 //spell can only be cast by humans
var/nonabstract_req = 0 //spell can only be cast by mobs that are physical entities
var/stat_allowed = 0 //see if it requires being conscious/alive, need to set to 1 for ghostpells
var/ghost = FALSE // Skip life check.
var/clothes_req = TRUE //see if it requires clothes
var/human_req = FALSE //spell can only be cast by humans
var/nonabstract_req = FALSE //spell can only be cast by mobs that are physical entities
var/stat_allowed = CONSCIOUS //see if it requires being conscious/alive, need to set to 1 for ghostpells
var/invocation = "HURP DURP" //what is uttered when the wizard casts the spell
var/invocation_emote_self = null
var/invocation_type = "none" //can be none, whisper and shout
Expand All @@ -110,7 +110,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
var/overlay_icon_state = "spell"
var/overlay_lifespan = 0

var/sparks_spread = 0
var/sparks_spread = FALSE
var/sparks_amt = 0 //cropped at 10
var/smoke_spread = 0 //1 - harmless, 2 - harmful
var/smoke_amt = 0 //cropped at 10
Expand Down Expand Up @@ -387,8 +387,8 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
var/obj/effect/overlay/spell = new /obj/effect/overlay(location)
spell.icon = overlay_icon
spell.icon_state = overlay_icon_state
spell.anchored = 1
spell.density = 0
spell.anchored = TRUE
spell.density = FALSE
spawn(overlay_lifespan)
qdel(spell)

Expand Down Expand Up @@ -568,7 +568,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
name = "Summon Servant"
desc = "This spell can be used to call your servant, whenever you need it."
charge_max = 100
clothes_req = 0
clothes_req = FALSE
invocation = "JE VES"
invocation_type = "whisper"
level_max = 0 //cannot be improved
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/area_teleport.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/obj/effect/proc_holder/spell/area_teleport
nonabstract_req = 1
nonabstract_req = TRUE

var/randomise_selection = 0 //if it lets the usr choose the teleport loc or picks it from the list
var/invocation_area = 1 //if the invocation appends the selected area
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/banana_touch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
school = "transmutation"

charge_max = 300
clothes_req = 1
clothes_req = TRUE
cooldown_min = 100 //50 deciseconds reduction per rank
action_icon_state = "clown"

Expand Down
8 changes: 4 additions & 4 deletions code/datums/spells/bloodcrawl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
name = "Blood Crawl"
desc = "Use pools of blood to phase out of existence."
charge_max = 0
clothes_req = 0
clothes_req = FALSE
cooldown_min = 0
should_recharge_after_cast = FALSE
overlay = null
action_icon_state = "bloodcrawl"
action_background_icon_state = "bg_demon"
panel = "Demon"
var/phased = 0
var/phased = FALSE

/obj/effect/proc_holder/spell/bloodcrawl/create_new_targeting()
var/datum/spell_targeting/targeted/T = new()
Expand All @@ -34,8 +34,8 @@
var/obj/effect/decal/cleanable/target = targets[1] // TODO Test this spell
if(phased)
if(user.phasein(target))
phased = 0
phased = FALSE
else
if(user.phaseout(target))
phased = 1
phased = TRUE
start_recharge()
16 changes: 8 additions & 8 deletions code/datums/spells/charge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
desc = "This spell can be used to recharge a variety of things in your hands, from magical artifacts to electrical components. A creative wizard can even use it to grant magical power to a fellow magic user."
school = "transmutation"
charge_max = 600
clothes_req = 0
clothes_req = FALSE
invocation = "DIRI CEL"
invocation_type = "whisper"
cooldown_min = 400 //50 deciseconds reduction per rank
Expand All @@ -16,7 +16,7 @@
for(var/mob/living/L in targets)
var/list/hand_items = list(L.get_active_hand(),L.get_inactive_hand())
var/charged_item = null
var/burnt_out = 0
var/burnt_out = FALSE

if(L.pulling && (istype(L.pulling, /mob/living)))
var/mob/living/M = L.pulling
Expand All @@ -29,7 +29,7 @@
to_chat(M, "<span class='notice'>You feel raw magical energy flowing through you, it feels good!</span>")
else
to_chat(M, "<span class='notice'>You feel very strange for a moment, but then it passes.</span>")
burnt_out = 1
burnt_out = TRUE
charged_item = M
break
for(var/obj/item in hand_items)
Expand All @@ -40,20 +40,20 @@
L.visible_message("<span class='warning'>[I] catches fire!</span>")
qdel(I)
else
I.used = 0
I.used = FALSE
charged_item = I
break
else
to_chat(L, "<span class='caution'>Glowing red letters appear on the front cover...</span>")
to_chat(L, "<span class='warning'>[pick("NICE TRY BUT NO!","CLEVER BUT NOT CLEVER ENOUGH!", "SUCH FLAGRANT CHEESING IS WHY WE ACCEPTED YOUR APPLICATION!", "CUTE!", "YOU DIDN'T THINK IT'D BE THAT EASY, DID YOU?")]</span>")
burnt_out = 1
burnt_out = TRUE
else if(istype(item, /obj/item/gun/magic))
var/obj/item/gun/magic/I = item
if(prob(80) && !I.can_charge)
I.max_charges--
if(I.max_charges <= 0)
I.max_charges = 0
burnt_out = 1
burnt_out = TRUE
I.charges = I.max_charges
if(istype(item,/obj/item/gun/magic/wand) && I.max_charges != 0)
var/obj/item/gun/magic/W = item
Expand All @@ -67,7 +67,7 @@
C.maxcharge -= 200
if(C.maxcharge <= 1) //Div by 0 protection
C.maxcharge = 1
burnt_out = 1
burnt_out = TRUE
C.charge = C.maxcharge
charged_item = C
break
Expand All @@ -81,7 +81,7 @@
C.maxcharge -= 200
if(C.maxcharge <= 1) //Div by 0 protection
C.maxcharge = 1
burnt_out = 1
burnt_out = TRUE
C.charge = C.maxcharge
item.update_icon()
charged_item = item
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/cluwne.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
school = "transmutation"

charge_max = 600
clothes_req = 1
clothes_req = TRUE
cooldown_min = 200 //100 deciseconds reduction per rank

action_icon_state = "clown"
Expand Down
14 changes: 7 additions & 7 deletions code/datums/spells/ethereal_jaunt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

school = "transmutation"
charge_max = 300
clothes_req = 1
clothes_req = TRUE
invocation = "none"
invocation_type = "none"
cooldown_min = 100 //50 deciseconds reduction per rank
nonabstract_req = 1
centcom_cancast = 0 //Prevent people from getting to centcom
nonabstract_req = TRUE
centcom_cancast = FALSE //Prevent people from getting to centcom
var/sound1 = 'sound/magic/ethereal_enter.ogg'
var/jaunt_duration = 50 //in deciseconds
var/jaunt_in_time = 5
Expand All @@ -32,14 +32,14 @@
INVOKE_ASYNC(src, .proc/do_jaunt, target)

/obj/effect/proc_holder/spell/ethereal_jaunt/proc/do_jaunt(mob/living/target)
target.notransform = 1
target.notransform = TRUE
var/turf/mobloc = get_turf(target)
var/obj/effect/dummy/spell_jaunt/holder = new jaunt_type_path(mobloc)
new jaunt_out_type(mobloc, target.dir)
target.ExtinguishMob()
target.forceMove(holder)
target.reset_perspective(holder)
target.notransform = 0 //mob is safely inside holder now, no need for protection.
target.notransform = FALSE //mob is safely inside holder now, no need for protection.
if(jaunt_water_effect)
jaunt_steam(mobloc)

Expand Down Expand Up @@ -86,8 +86,8 @@
var/reappearing = 0
var/movedelay = 0
var/movespeed = 2
density = 0
anchored = 1
density = FALSE
anchored = TRUE
invisibility = 60
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF

Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/fake_gib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

school = "evocation"
charge_max = 600
clothes_req = 0
clothes_req = FALSE
cooldown_min = 200 //100 deciseconds reduction per rank

action_icon_state = "gib"
2 changes: 1 addition & 1 deletion code/datums/spells/horsemask.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
charge_max = 150
charge_counter = 0
clothes_req = FALSE
stat_allowed = FALSE
stat_allowed = CONSCIOUS
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
invocation_type = "shout"
cooldown_min = 30 //30 deciseconds reduction per rank
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/infinite_guns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

school = "conjuration"
charge_max = 600
clothes_req = 1
clothes_req = TRUE
cooldown_min = 10 //Gun wizard
action_icon_state = "bolt_action"

Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/knock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

school = "transmutation"
charge_max = 100
clothes_req = 0
clothes_req = FALSE
invocation = "AULIE OXIN FIERA"
invocation_type = "whisper"
cooldown_min = 20 //20 deciseconds reduction per rank
Expand Down
6 changes: 3 additions & 3 deletions code/datums/spells/lichdom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
desc = "A dark necromantic pact that can forever bind your soul to an item of your choosing. So long as both your body and the item remain intact and on the same plane you can revive from death, though the time between reincarnations grows steadily with use."
school = "necromancy"
charge_max = 10
clothes_req = 0
centcom_cancast = 0
clothes_req = FALSE
centcom_cancast = FALSE
invocation = "NECREM IMORTIUM!"
invocation_type = "shout"
level_max = 0 //cannot be improved
Expand Down Expand Up @@ -113,7 +113,7 @@
desc = "Rise from the dead! You will reform at the location of your phylactery and your old body will crumble away."
charge_max = 1800 //3 minute cooldown, if you rise in sight of someone and killed again, you're probably screwed.
charge_counter = 1800
stat_allowed = 1
stat_allowed = UNCONSCIOUS
marked_item.name = "Ensouled [marked_item.name]"
marked_item.desc = "A terrible aura surrounds this item, its very existence is offensive to life itself..."
marked_item.color = "#003300"
Expand Down
14 changes: 7 additions & 7 deletions code/datums/spells/mime.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
invocation_emote_self = "<span class='notice'>You form a wall in front of yourself.</span>"
summon_lifespan = 300
charge_max = 300
clothes_req = 0
clothes_req = FALSE
cast_sound = null
human_req = 1
human_req = TRUE

action_icon_state = "mime"
action_background_icon_state = "bg_mime"
Expand All @@ -33,9 +33,9 @@
desc = "Make or break a vow of silence."
school = "mime"
panel = "Mime"
clothes_req = 0
clothes_req = FALSE
charge_max = 3000
human_req = 1
human_req = TRUE

action_icon_state = "mime_silence"
action_background_icon_state = "bg_mime"
Expand Down Expand Up @@ -93,9 +93,9 @@
desc = "Shoot lethal, silencing bullets out of your fingers! 3 bullets available per cast. Use your fingers to holster them manually."
school = "mime"
panel = "Mime"
clothes_req = 0
clothes_req = FALSE
charge_max = 300
human_req = 1
human_req = TRUE

action_icon_state = "fingergun"
action_background_icon_state = "bg_mime"
Expand Down Expand Up @@ -144,7 +144,7 @@
to_chat(user, "<span class='notice'>You flip through the pages. Nothing of interest to you.</span>")

/obj/item/spellbook/oneuse/mime/onlearned(mob/user)
used = 1
used = TRUE
if(!locate(/obj/effect/proc_holder/spell/mime/speak) in user.mind.spell_list) //add vow of silence if not known by user
user.mind.AddSpell(new /obj/effect/proc_holder/spell/mime/speak)
to_chat(user, "<span class='notice'>You have learned how to use silence to improve your performance.</span>")
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/mime_malaise.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
school = "transmutation"

charge_max = 300
clothes_req = 1
clothes_req = TRUE
cooldown_min = 100 //50 deciseconds reduction per rank
action_icon_state = "mime"

Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/mind_transfer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

school = "transmutation"
charge_max = 600
clothes_req = 0
clothes_req = FALSE
invocation = "GIN'YU CAPAN"
invocation_type = "whisper"
selection_activated_message = "<span class='notice'>You prepare to transfer your mind. Click on a target to cast the spell.</span>"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/night_vision.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
desc = "Toggle your nightvision mode."

charge_max = 10
clothes_req = 0
clothes_req = FALSE

message = "<span class='notice'>You toggle your night vision!</span>"

Expand Down
4 changes: 2 additions & 2 deletions code/datums/spells/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

var/proj_lingering = 0 //if it lingers or disappears upon hitting an obstacle
var/proj_homing = 1 //if it follows the target
var/proj_insubstantial = 0 //if it can pass through dense objects or not
var/proj_insubstantial = FALSE //if it can pass through dense objects or not
var/proj_trigger_range = 0 //the range from target at which the projectile triggers cast(target)

var/proj_lifespan = 15 //in deciseconds * proj_step_delay
Expand Down Expand Up @@ -69,7 +69,7 @@
var/obj/effect/overlay/trail = new /obj/effect/overlay(projectile.loc)
trail.icon = proj_trail_icon
trail.icon_state = proj_trail_icon_state
trail.density = 0
trail.density = FALSE
spawn(proj_trail_lifespan)
qdel(trail)

Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/rathens.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "Rathen's Secret"
desc = "Summons a powerful shockwave around you that tears the appendix and limbs off of enemies."
charge_max = 500
clothes_req = 1
clothes_req = TRUE
invocation = "APPEN NATH!"
invocation_type = "shout"
cooldown_min = 200
Expand Down
Loading

0 comments on commit d1da076

Please sign in to comment.