Merge pull request #6153 from Citadel-Station-13/upstream-merge-36442

[MIRROR] Refactors Spell and Martial Art Books to use Action Granters!
This commit is contained in:
deathride58
2018-04-03 08:16:11 +00:00
committed by GitHub
25 changed files with 458 additions and 363 deletions

View File

@@ -535,7 +535,6 @@
throw_speed = 2
throw_range = 5
w_class = WEIGHT_CLASS_TINY
persistence_replacement = /obj/item/spellbook/oneuse/random
var/uses = 10
var/temp = null
var/tab = null
@@ -715,198 +714,3 @@
tab = sanitize(href_list["page"])
attack_self(H)
return
//Single Use Spellbooks//
/obj/item/spellbook/oneuse
var/spell = /obj/effect/proc_holder/spell/targeted/projectile/magic_missile //just a placeholder to avoid runtimes if someone spawned the generic
var/spellname = "sandbox"
var/used = 0
name = "spellbook of "
uses = 1
desc = "This template spellbook was never meant for the eyes of man..."
persistence_replacement = null
/obj/item/spellbook/oneuse/prepare_spells()
name += spellname
/obj/item/spellbook/oneuse/attack_self(mob/user)
var/obj/effect/proc_holder/spell/S = new spell
for(var/obj/effect/proc_holder/spell/knownspell in user.mind.spell_list)
if(knownspell.type == S.type)
if(user.mind)
if(iswizard(user))
to_chat(user,"<span class='notice'>You're already far more versed in this spell than this flimsy how-to book can provide.</span>")
else
to_chat(user,"<span class='notice'>You've already read this one.</span>")
return
if(used)
recoil(user)
else
user.mind.AddSpell(S)
to_chat(user,"<span class='notice'>You rapidly read through the arcane book. Suddenly you realize you understand [spellname]!</span>")
user.log_message("<font color='orange'>learned the spell [spellname] ([S]).</font>", INDIVIDUAL_ATTACK_LOG)
onlearned(user)
/obj/item/spellbook/oneuse/proc/recoil(mob/user)
user.visible_message("<span class='warning'>[src] glows in a black light!</span>")
/obj/item/spellbook/oneuse/proc/onlearned(mob/user)
used = 1
user.visible_message("<span class='caution'>[src] glows dark for a second!</span>")
/obj/item/spellbook/oneuse/attackby()
return
/obj/item/spellbook/oneuse/fireball
spell = /obj/effect/proc_holder/spell/aimed/fireball
spellname = "fireball"
icon_state ="bookfireball"
desc = "This book feels warm to the touch."
/obj/item/spellbook/oneuse/fireball/recoil(mob/user)
..()
explosion(user.loc, -1, 0, 2, 3, 0, flame_range = 2)
qdel(src)
/obj/item/spellbook/oneuse/smoke
spell = /obj/effect/proc_holder/spell/targeted/smoke
spellname = "smoke"
icon_state ="booksmoke"
desc = "This book is overflowing with the dank arts."
/obj/item/spellbook/oneuse/smoke/lesser //Chaplain smoke book
spell = /obj/effect/proc_holder/spell/targeted/smoke/lesser
/obj/item/spellbook/oneuse/smoke/recoil(mob/user)
..()
to_chat(user,"<span class='caution'>Your stomach rumbles...</span>")
if(user.nutrition)
user.nutrition -= 200
if(user.nutrition <= 0)
user.nutrition = 0
/obj/item/spellbook/oneuse/blind
spell = /obj/effect/proc_holder/spell/targeted/trigger/blind
spellname = "blind"
icon_state ="bookblind"
desc = "This book looks blurry, no matter how you look at it."
/obj/item/spellbook/oneuse/blind/recoil(mob/user)
..()
to_chat(user,"<span class='warning'>You go blind!</span>")
user.blind_eyes(10)
/obj/item/spellbook/oneuse/mindswap
spell = /obj/effect/proc_holder/spell/targeted/mind_transfer
spellname = "mindswap"
icon_state ="bookmindswap"
desc = "This book's cover is pristine, though its pages look ragged and torn."
var/mob/stored_swap = null //Used in used book recoils to store an identity for mindswaps
/obj/item/spellbook/oneuse/mindswap/onlearned()
spellname = pick("fireball","smoke","blind","forcewall","knock","barnyard","charge")
icon_state = "book[spellname]"
name = "spellbook of [spellname]" //Note, desc doesn't change by design
..()
/obj/item/spellbook/oneuse/mindswap/recoil(mob/user)
..()
if(stored_swap in GLOB.dead_mob_list)
stored_swap = null
if(!stored_swap)
stored_swap = user
to_chat(user,"<span class='warning'>For a moment you feel like you don't even know who you are anymore.</span>")
return
if(stored_swap == user)
to_chat(user,"<span class='notice'>You stare at the book some more, but there doesn't seem to be anything else to learn...</span>")
return
var/obj/effect/proc_holder/spell/targeted/mind_transfer/swapper = new
swapper.cast(user, stored_swap, 1)
to_chat(stored_swap,"<span class='warning'>You're suddenly somewhere else... and someone else?!</span>")
to_chat(user,"<span class='warning'>Suddenly you're staring at [src] again... where are you, who are you?!</span>")
stored_swap = null
/obj/item/spellbook/oneuse/forcewall
spell = /obj/effect/proc_holder/spell/targeted/forcewall
spellname = "forcewall"
icon_state ="bookforcewall"
desc = "This book has a dedication to mimes everywhere inside the front cover."
/obj/item/spellbook/oneuse/forcewall/recoil(mob/living/user)
..()
to_chat(user,"<span class='warning'>You suddenly feel very solid!</span>")
user.Stun(40, ignore_canstun = TRUE)
user.petrify(30)
/obj/item/spellbook/oneuse/knock
spell = /obj/effect/proc_holder/spell/aoe_turf/knock
spellname = "knock"
icon_state ="bookknock"
desc = "This book is hard to hold closed properly."
/obj/item/spellbook/oneuse/knock/recoil(mob/living/user)
..()
to_chat(user,"<span class='warning'>You're knocked down!</span>")
user.Knockdown(40)
/obj/item/spellbook/oneuse/barnyard
spell = /obj/effect/proc_holder/spell/targeted/barnyardcurse
spellname = "barnyard"
icon_state ="bookhorses"
desc = "This book is more horse than your mind has room for."
/obj/item/spellbook/oneuse/barnyard/recoil(mob/living/carbon/user)
if(ishuman(user))
to_chat(user,"<font size='15' color='red'><b>HOR-SIE HAS RISEN</b></font>")
var/obj/item/clothing/mask/horsehead/magichead = new /obj/item/clothing/mask/horsehead
magichead.flags_1 |= NODROP_1 //curses!
magichead.flags_inv &= ~HIDEFACE //so you can still see their face
magichead.voicechange = 1 //NEEEEIIGHH
if(!user.dropItemToGround(user.wear_mask))
qdel(user.wear_mask)
user.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1)
qdel(src)
else
to_chat(user,"<span class='notice'>I say thee neigh</span>") //It still lives here
/obj/item/spellbook/oneuse/charge
spell = /obj/effect/proc_holder/spell/targeted/charge
spellname = "charging"
icon_state ="bookcharge"
desc = "This book is made of 100% post-consumer wizard."
/obj/item/spellbook/oneuse/charge/recoil(mob/user)
..()
to_chat(user,"<span class='warning'>[src] suddenly feels very warm!</span>")
empulse(src, 1, 1)
/obj/item/spellbook/oneuse/summonitem
spell = /obj/effect/proc_holder/spell/targeted/summonitem
spellname = "instant summons"
icon_state ="booksummons"
desc = "This book is bright and garish, very hard to miss."
/obj/item/spellbook/oneuse/summonitem/recoil(mob/user)
..()
to_chat(user,"<span class='warning'>[src] suddenly vanishes!</span>")
qdel(src)
/obj/item/spellbook/oneuse/random
icon_state = "random_book"
/obj/item/spellbook/oneuse/random/Initialize()
..()
var/static/banned_spells = list(/obj/item/spellbook/oneuse/mimery_blockade, /obj/item/spellbook/oneuse/mimery_guns)
var/real_type = pick(subtypesof(/obj/item/spellbook/oneuse) - banned_spells)
new real_type(loc)
return INITIALIZE_HINT_QDEL
/obj/item/spellbook/oneuse/sacredflame
spell = /obj/effect/proc_holder/spell/targeted/sacred_flame
spellname = "sacred flame"
icon_state ="booksacredflame"
desc = "Become one with the flames that burn within... and invite others to do so as well."

View File

@@ -260,7 +260,7 @@
new /obj/item/gun/ballistic/revolver/mateba(drop_location())
if(15)
//Random One-use spellbook
new /obj/item/spellbook/oneuse/random(drop_location())
new /obj/item/book/granter/spell/random(drop_location())
if(16)
//Servant & Servant Summon
var/mob/living/carbon/human/H = new(drop_location())

View File

@@ -477,8 +477,8 @@
name = "dungeon lite"
loot = list(/obj/item/melee/classic_baton = 11,
/obj/item/melee/classic_baton/telescopic = 12,
/obj/item/spellbook/oneuse/smoke = 10,
/obj/item/spellbook/oneuse/blind = 10,
/obj/item/book/granter/spell/smoke = 10,
/obj/item/book/granter/spell/blind = 10,
/obj/item/storage/firstaid/regular = 45,
/obj/item/storage/firstaid/toxin = 35,
/obj/item/storage/firstaid/brute = 27,
@@ -501,9 +501,9 @@
/obj/item/gun/magic/wand/fireball/inert = 3,
/obj/item/pneumatic_cannon = 15,
/obj/item/melee/transforming/energy/sword = 7,
/obj/item/spellbook/oneuse/knock = 15,
/obj/item/spellbook/oneuse/summonitem = 20,
/obj/item/spellbook/oneuse/forcewall = 17,
/obj/item/book/granter/spell/knock = 15,
/obj/item/book/granter/spell/summonitem = 20,
/obj/item/book/granter/spell/forcewall = 17,
/obj/item/storage/backpack/holding = 12,
/obj/item/grenade/spawnergrenade/manhacks = 6,
/obj/item/grenade/spawnergrenade/spesscarp = 7,
@@ -512,7 +512,7 @@
/obj/item/stack/sheet/mineral/uranium{amount = 15} = 10,
/obj/item/stack/sheet/mineral/plasma{amount = 15} = 10,
/obj/item/stack/sheet/mineral/gold{amount = 15} = 10,
/obj/item/spellbook/oneuse/barnyard = 4,
/obj/item/book/granter/spell/barnyard = 4,
/obj/item/pickaxe/drill/diamonddrill = 6,
/obj/item/borg/upgrade/vtec = 7,
/obj/item/borg/upgrade/disablercooler = 7)
@@ -530,9 +530,9 @@
/obj/item/gun/magic/wand/resurrection/inert = 15,
/obj/item/gun/magic/wand/resurrection = 10,
/obj/item/device/radio/uplink/old = 2,
/obj/item/spellbook/oneuse/charge = 12,
/obj/item/book/granter/spell/charge = 12,
/obj/item/grenade/clusterbuster/spawner_manhacks = 15,
/obj/item/spellbook/oneuse/fireball = 10,
/obj/item/book/granter/spell/fireball = 10,
/obj/item/pickaxe/drill/jackhammer = 30,
/obj/item/borg/upgrade/syndicate = 13,
/obj/item/borg/upgrade/selfrepair = 17)

View File

@@ -1532,7 +1532,7 @@
/obj/item/vending_refill/coffee,
/obj/item/vending_refill/coffee,
/obj/item/vending_refill/coffee,
/obj/item/book/action_granting/drink_fling)
/obj/item/book/granter/action/drink_fling)
crate_name = "bartending supply crate"
/datum/supply_pack/organic/vending/cigarette

View File

@@ -167,7 +167,7 @@ Bartender
ears = /obj/item/device/radio/headset/headset_srv
uniform = /obj/item/clothing/under/rank/bartender
suit = /obj/item/clothing/suit/armor/vest
backpack_contents = list(/obj/item/storage/box/beanbag=1,/obj/item/book/action_granting/drink_fling=1)
backpack_contents = list(/obj/item/storage/box/beanbag=1,/obj/item/book/granter/action/drink_fling=1)
shoes = /obj/item/clothing/shoes/laceup
/*

View File

@@ -274,7 +274,7 @@
icon_state = "x2"
var/possible = list(/obj/item/ship_in_a_bottle,
/obj/item/gun/energy/pulse,
/obj/item/sleeping_carp_scroll,
/obj/item/book/granter/martial/carp,
/obj/item/melee/supermatter_sword,
/obj/item/shield/changeling,
/obj/item/lava_staff,

View File

@@ -69,7 +69,7 @@
new /obj/item/reagent_containers/food/drinks/bottle/holywater/hell(src)
new /obj/item/clothing/suit/space/hardsuit/ert/paranormal/inquisitor(src)
if(25)
new /obj/item/spellbook/oneuse/summonitem(src)
new /obj/item/book/granter/spell/summonitem(src)
if(26)
new /obj/item/book_of_babel(src)
if(27)
@@ -693,7 +693,7 @@
if(2)
new /obj/item/lava_staff(src)
if(3)
new /obj/item/spellbook/oneuse/sacredflame(src)
new /obj/item/book/granter/spell/sacredflame(src)
new /obj/item/gun/magic/wand/fireball(src)
if(4)
new /obj/item/dragons_blood(src)

View File

@@ -16,7 +16,7 @@
for(var/mob/living/L in targets)
var/list/hand_items = list(L.get_active_held_item(),L.get_inactive_held_item())
var/charged_item = null
var/burnt_out = 0
var/burnt_out = FALSE
if(L.pulling && isliving(L.pulling))
var/mob/living/M = L.pulling
@@ -34,26 +34,30 @@
break
for(var/obj/item in hand_items)
if(istype(item, /obj/item/spellbook))
if(istype(item, /obj/item/spellbook/oneuse))
var/obj/item/spellbook/oneuse/I = item
if(prob(80))
L.visible_message("<span class='warning'>[I] catches fire!</span>")
qdel(I)
else
I.used = 0
charged_item = I
break
to_chat(L, "<span class='danger'>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! VERY CUTE!", "YOU DIDN'T THINK IT'D BE THAT EASY, DID YOU?")]</span>")
burnt_out = TRUE
else if(istype(item, /obj/item/book/granter/spell))
var/obj/item/book/granter/spell/I = item
if(!I.oneuse)
to_chat(L, "<span class='notice'>This book is infinite use and can't be recharged, yet the magic has improved the book somehow...</span>")
burnt_out = TRUE
I.pages_to_mastery--
break
if(prob(80))
L.visible_message("<span class='warning'>[I] catches fire!</span>")
qdel(I)
else
to_chat(L, "<span class='danger'>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! VERY CUTE!", "YOU DIDN'T THINK IT'D BE THAT EASY, DID YOU?")]</span>")
burnt_out = 1
I.used = FALSE
charged_item = I
break
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
@@ -61,14 +65,14 @@
I.recharge_newshot()
charged_item = I
break
else if(istype(item, /obj/item/stock_parts/cell/))
else if(istype(item, /obj/item/stock_parts/cell))
var/obj/item/stock_parts/cell/C = item
if(!C.self_recharge)
if(prob(80))
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
@@ -82,7 +86,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
if(istype(C.loc, /obj/item/gun))
var/obj/item/gun/G = C.loc

View File

@@ -127,16 +127,19 @@
..()
/obj/item/spellbook/oneuse/mimery_blockade
/obj/item/book/granter/spell/mimery_blockade
spell = /obj/effect/proc_holder/spell/targeted/forcewall/mime
spellname = ""
name = "Guide to Advanced Mimery Vol 1"
desc = "The pages don't make any sound when turned."
icon_state ="bookmime"
remarks = list("...")
/obj/item/spellbook/oneuse/mimery_guns
/obj/item/book/granter/spell/mimery_guns
spell = /obj/effect/proc_holder/spell/aimed/finger_guns
spellname = ""
name = "Guide to Advanced Mimery Vol 2"
desc = "There aren't any words written..."
icon_state ="bookmime"
remarks = list("...")

View File

@@ -47,15 +47,15 @@ GLOBAL_LIST_INIT(summoned_guns, list(
/obj/item/gun/energy/gravity_gun))
GLOBAL_LIST_INIT(summoned_magic, list(
/obj/item/spellbook/oneuse/fireball,
/obj/item/spellbook/oneuse/smoke,
/obj/item/spellbook/oneuse/blind,
/obj/item/spellbook/oneuse/mindswap,
/obj/item/spellbook/oneuse/forcewall,
/obj/item/spellbook/oneuse/knock,
/obj/item/spellbook/oneuse/barnyard,
/obj/item/spellbook/oneuse/charge,
/obj/item/spellbook/oneuse/summonitem,
/obj/item/book/granter/spell/fireball,
/obj/item/book/granter/spell/smoke,
/obj/item/book/granter/spell/blind,
/obj/item/book/granter/spell/mindswap,
/obj/item/book/granter/spell/forcewall,
/obj/item/book/granter/spell/knock,
/obj/item/book/granter/spell/barnyard,
/obj/item/book/granter/spell/charge,
/obj/item/book/granter/spell/summonitem,
/obj/item/gun/magic/wand,
/obj/item/gun/magic/wand/death,
/obj/item/gun/magic/wand/resurrection,

View File

@@ -630,7 +630,7 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item))
name = "Martial Arts Scroll"
desc = "This scroll contains the secrets of an ancient martial arts technique. You will master unarmed combat, \
deflecting all ranged weapon fire, but you also refuse to use dishonorable ranged weaponry."
item = /obj/item/sleeping_carp_scroll
item = /obj/item/book/granter/martial/carp
cost = 17
surplus = 0
exclude_modes = list(/datum/game_mode/nuclear, /datum/game_mode/nuclear/clown_ops)
@@ -638,7 +638,7 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item))
/datum/uplink_item/stealthy_weapons/cqc
name = "CQC Manual"
desc = "A manual that teaches a single user tactical Close-Quarters Combat before self-destructing."
item = /obj/item/cqc_manual
item = /obj/item/book/granter/martial/cqc
include_modes = list(/datum/game_mode/nuclear, /datum/game_mode/nuclear/clown_ops)
cost = 13
surplus = 0