Ports "Replaces the rpg loot datum with a component and makes some suffixes have real effects" & co

This commit is contained in:
Ghommie
2019-10-31 22:40:11 +01:00
parent d249a38489
commit b653595702
26 changed files with 766 additions and 98 deletions
+9 -72
View File
@@ -8,8 +8,11 @@
/datum/round_event/wizard/rpgloot/start()
var/upgrade_scroll_chance = 0
for(var/obj/item/I in world)
if(!istype(I.rpg_loot))
I.rpg_loot = new(I)
CHECK_TICK
if(!(I.flags_1 & INITIALIZED_1))
continue
I.AddComponent(/datum/component/fantasy)
if(istype(I, /obj/item/storage))
var/obj/item/storage/S = I
@@ -31,86 +34,20 @@
var/upgrade_amount = 1
var/can_backfire = TRUE
var/one_use = TRUE
var/uses = 1
/obj/item/upgradescroll/afterattack(obj/item/target, mob/user , proximity)
. = ..()
if(!proximity || !istype(target))
return
var/datum/rpg_loot/rpg_loot_datum = target.rpg_loot
if(!istype(rpg_loot_datum))
target.rpg_loot = rpg_loot_datum = new /datum/rpg_loot(target)
target.AddComponent(/datum/component/fantasy, upgrade_amount, null, null, can_backfire, TRUE)
var/quality = rpg_loot_datum.quality
if(can_backfire && (quality > 9 && prob((quality - 9)*10)))
to_chat(user, "<span class='danger'>[target] violently glows blue for a while, then evaporates.</span>")
target.burn()
else
to_chat(user, "<span class='notice'>[target] glows blue and seems vaguely \"better\"!</span>")
rpg_loot_datum.modify(upgrade_amount)
if(one_use)
if(--uses <= 0)
qdel(src)
/obj/item/upgradescroll/unlimited
name = "unlimited foolproof item fortification scroll"
desc = "Somehow, this piece of paper can be applied to items to make them \"better\". This scroll is made from the tongues of dead paper wizards, and can be used an unlimited number of times, with no drawbacks."
one_use = FALSE
uses = INFINITY
can_backfire = FALSE
/datum/rpg_loot
var/positive_prefix = "okay"
var/negative_prefix = "weak"
var/suffix = "something profound"
var/quality = 0
var/obj/item/attached
var/original_name
/datum/rpg_loot/New(attached_item=null)
attached = attached_item
randomise()
/datum/rpg_loot/Destroy()
attached = null
/datum/rpg_loot/proc/randomise()
var/static/list/prefixespositive = list("greater", "major", "blessed", "superior", "empowered", "honed", "true", "glorious", "robust")
var/static/list/prefixesnegative = list("lesser", "minor", "blighted", "inferior", "enfeebled", "rusted", "unsteady", "tragic", "gimped")
var/static/list/suffixes = list("orc slaying", "elf slaying", "corgi slaying", "strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma", "the forest", "the hills", "the plains", "the sea", "the sun", "the moon", "the void", "the world", "the fool", "many secrets", "many tales", "many colors", "rending", "sundering", "the night", "the day")
var/new_quality = pick(1;15, 2;14, 2;13, 2;12, 3;11, 3;10, 3;9, 4;8, 4;7, 4;6, 5;5, 5;4, 5;3, 6;2, 6;1, 6;0)
suffix = pick(suffixes)
positive_prefix = pick(prefixespositive)
negative_prefix = pick(prefixesnegative)
if(prob(50))
new_quality = -new_quality
modify(new_quality)
/datum/rpg_loot/proc/rename()
var/obj/item/I = attached
if(!original_name)
original_name = I.name
if(quality < 0)
I.name = "[negative_prefix] [original_name] of [suffix] [quality]"
else if(quality == 0)
I.name = "[original_name] of [suffix]"
else if(quality > 0)
I.name = "[positive_prefix] [original_name] of [suffix] +[quality]"
/datum/rpg_loot/proc/modify(quality_mod)
var/obj/item/I = attached
quality += quality_mod
I.force = max(0,I.force + quality_mod)
I.throwforce = max(0,I.throwforce + quality_mod)
I.armor = I.armor.modifyAllRatings(quality)
rename()
@@ -344,6 +344,7 @@
/mob/living/simple_animal/hostile/proc/AttackingTarget()
SEND_SIGNAL(src, COMSIG_HOSTILE_ATTACKINGTARGET, target)
in_melee = TRUE
if(vore_active)
if(isliving(target))
@@ -426,12 +427,13 @@
if(casingtype)
var/obj/item/ammo_casing/casing = new casingtype(startloc)
playsound(src, projectilesound, 100, 1)
casing.fire_casing(targeted_atom, src, null, null, null, ran_zone())
casing.fire_casing(targeted_atom, src, null, null, null, ran_zone(), src)
else if(projectiletype)
var/obj/item/projectile/P = new projectiletype(startloc)
playsound(src, projectilesound, 100, 1)
P.starting = startloc
P.firer = src
P.fired_from = src
P.yo = targeted_atom.y - startloc.y
P.xo = targeted_atom.x - startloc.x
if(AIStatus != AI_ON)//Don't want mindless mobs to have their movement screwed up firing in space
@@ -199,6 +199,7 @@
if(prob(35))
sparks.start()
P.firer = user ? user : src
P.fired_from = src
if(last_projectile_params)
P.p_x = last_projectile_params[2]
P.p_y = last_projectile_params[3]
@@ -1,8 +1,8 @@
/obj/item/ammo_casing/proc/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread)
/obj/item/ammo_casing/proc/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread, atom/fired_from)
distro += variance
for (var/i = max(1, pellets), i > 0, i--)
var/targloc = get_turf(target)
ready_proj(target, user, quiet, zone_override)
ready_proj(target, user, quiet, zone_override, fired_from)
if(distro) //We have to spread a pixel-precision bullet. throw_proj was called before so angles should exist by now...
if(randomspread)
spread = round((rand() - 0.5) * distro)
@@ -20,11 +20,12 @@
update_icon()
return 1
/obj/item/ammo_casing/proc/ready_proj(atom/target, mob/living/user, quiet, zone_override = "")
/obj/item/ammo_casing/proc/ready_proj(atom/target, mob/living/user, quiet, zone_override = "", fired_from)
if (!BB)
return
BB.original = target
BB.firer = user
BB.fired_from = fired_from
if (zone_override)
BB.def_zone = zone_override
else
@@ -3,7 +3,7 @@
firing_effect_type = null
heavy_metal = FALSE
/obj/item/ammo_casing/caseless/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread)
/obj/item/ammo_casing/caseless/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread, atom/fired_from)
if (..()) //successfully firing
moveToNullspace()
QDEL_NULL(src)
+2 -2
View File
@@ -233,7 +233,7 @@
else //Smart spread
sprd = round((((rand_spr/burst_size) * iteration) - (0.5 + (rand_spr * 0.25))) * (randomized_gun_spread + randomized_bonus_spread), 1)
if(!chambered.fire_casing(target, user, params, ,suppressed, zone_override, sprd))
if(!chambered.fire_casing(target, user, params, ,suppressed, zone_override, sprd, src))
shoot_with_empty_chamber(user)
firing_burst = FALSE
return FALSE
@@ -280,7 +280,7 @@
to_chat(user, "<span class='notice'> [src] is lethally chambered! You don't want to risk harming anyone...</span>")
return
sprd = round((rand() - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread))
if(!chambered.fire_casing(target, user, params, , suppressed, zone_override, sprd))
if(!chambered.fire_casing(target, user, params, , suppressed, zone_override, sprd, src))
shoot_with_empty_chamber(user)
return
else
+5
View File
@@ -17,6 +17,7 @@
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/def_zone = "" //Aiming at
var/atom/movable/firer = null//Who shot it
var/atom/fired_from = null // the atom that the projectile was fired from (gun, turret)
var/suppressed = FALSE //Attack message
var/candink = FALSE //Can this projectile play the dink sound when hitting the head?
var/yo = null
@@ -131,6 +132,8 @@
return TRUE
/obj/item/projectile/proc/on_hit(atom/target, blocked = FALSE)
if(fired_from)
SEND_SIGNAL(fired_from, COMSIG_PROJECTILE_ON_HIT, firer, target, Angle)
var/turf/target_loca = get_turf(target)
var/hitx
@@ -356,6 +359,8 @@
pixel_move(1, FALSE)
/obj/item/projectile/proc/fire(angle, atom/direct_target)
if(fired_from)
SEND_SIGNAL(fired_from, COMSIG_PROJECTILE_BEFORE_FIRE, src, original)
//If no angle needs to resolve it from xo/yo!
if(!log_override && firer && original)
log_combat(firer, original, "fired at", src, "from [get_area_name(src, TRUE)]")