-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ports The Hand of Midas into our tempfolder (#352)
- Loading branch information
1 parent
f29acce
commit 47ef9b8
Showing
5 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#define MOVESPEED_ID_MIDAS_BLIGHT "midas_blight_debuff" | ||
|
||
#define ACTIONSPEED_ID_MIDAS_BLIGHT "midas_blight_debuff" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// The same as gold just with a slower metabolism rate, to make using the Hand of Midas easier. | ||
/datum/reagent/gold/cursed | ||
name = "Cursed Gold" | ||
metabolization_rate = 0.2 * REAGENTS_METABOLISM | ||
|
||
/////////////////// | ||
|
||
/// Actionspeeds | ||
/datum/actionspeed_modifier/status_effect/midas_blight | ||
id = ACTIONSPEED_ID_MIDAS_BLIGHT | ||
|
||
/datum/actionspeed_modifier/status_effect/midas_blight/soft | ||
multiplicative_slowdown = 0.25 | ||
|
||
/datum/actionspeed_modifier/status_effect/midas_blight/medium | ||
multiplicative_slowdown = 0.75 | ||
|
||
/datum/actionspeed_modifier/status_effect/midas_blight/hard | ||
multiplicative_slowdown = 1.5 | ||
|
||
/datum/actionspeed_modifier/status_effect/midas_blight/gold | ||
multiplicative_slowdown = 2 | ||
|
||
/// Movementspeeds | ||
/datum/movespeed_modifier/status_effect/midas_blight | ||
id = MOVESPEED_ID_MIDAS_BLIGHT | ||
|
||
/datum/movespeed_modifier/status_effect/midas_blight/soft | ||
multiplicative_slowdown = 0.25 | ||
|
||
/datum/movespeed_modifier/status_effect/midas_blight/medium | ||
multiplicative_slowdown = 0.75 | ||
|
||
/datum/movespeed_modifier/status_effect/midas_blight/hard | ||
multiplicative_slowdown = 1.5 | ||
|
||
/datum/movespeed_modifier/status_effect/midas_blight/gold | ||
multiplicative_slowdown = 2 | ||
|
||
|
||
/////////////////// | ||
|
||
/datum/status_effect/midas_blight | ||
id = "midas_blight" | ||
alert_type = /atom/movable/screen/alert/status_effect/midas_blight | ||
status_type = STATUS_EFFECT_REPLACE | ||
tick_interval = 0.2 SECONDS | ||
remove_on_fullheal = TRUE | ||
|
||
/// The visual overlay state, helps tell both you and enemies how much gold is in your system | ||
var/midas_state = "midas_1" | ||
/// How fast the gold in a person's system scales. | ||
var/goldscale = 30 // x2.8 - Gives ~ 15u for 1 second | ||
|
||
/datum/status_effect/midas_blight/on_creation(mob/living/new_owner, duration = 1) | ||
// Duration is already input in SECONDS | ||
src.duration = duration | ||
RegisterSignal(new_owner, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(on_update_overlays)) | ||
return ..() | ||
|
||
/atom/movable/screen/alert/status_effect/midas_blight | ||
name = "Midas Blight" | ||
desc = "Your blood is being turned to gold, slowing your movements!" | ||
icon_state = "midas_blight" | ||
icon = 'maplestation_modules/temp_changes/midas_gun/midas_icons.dmi' | ||
|
||
/datum/status_effect/midas_blight/tick(seconds_between_ticks) | ||
var/mob/living/carbon/human/victim = owner | ||
// We're transmuting blood, time to lose some. | ||
if(victim.blood_volume > BLOOD_VOLUME_SURVIVE + 50 && !HAS_TRAIT(victim, TRAIT_NOBLOOD)) | ||
victim.blood_volume -= 5 * seconds_between_ticks | ||
// This has been hell to try and balance so that you'll actually get anything out of it | ||
victim.reagents.add_reagent(/datum/reagent/gold/cursed, amount = seconds_between_ticks * goldscale, no_react = TRUE) | ||
var/current_gold_amount = victim.reagents.get_reagent_amount(/datum/reagent/gold) | ||
switch(current_gold_amount) | ||
if(-INFINITY to 50) | ||
victim.add_movespeed_modifier(/datum/movespeed_modifier/status_effect/midas_blight/soft, update = TRUE) | ||
victim.add_actionspeed_modifier(/datum/actionspeed_modifier/status_effect/midas_blight/soft, update = TRUE) | ||
midas_state = "midas_1" | ||
if(50 to 100) | ||
victim.add_movespeed_modifier(/datum/movespeed_modifier/status_effect/midas_blight/medium, update = TRUE) | ||
victim.add_actionspeed_modifier(/datum/actionspeed_modifier/status_effect/midas_blight/medium, update = TRUE) | ||
midas_state = "midas_2" | ||
if(100 to 200) | ||
victim.add_movespeed_modifier(/datum/movespeed_modifier/status_effect/midas_blight/hard, update = TRUE) | ||
victim.add_actionspeed_modifier(/datum/actionspeed_modifier/status_effect/midas_blight/hard, update = TRUE) | ||
midas_state = "midas_3" | ||
if(200 to INFINITY) | ||
victim.add_movespeed_modifier(/datum/movespeed_modifier/status_effect/midas_blight/gold, update = TRUE) | ||
victim.add_actionspeed_modifier(/datum/actionspeed_modifier/status_effect/midas_blight/gold, update = TRUE) | ||
midas_state = "midas_4" | ||
victim.update_icon() | ||
if(victim.stat == DEAD) | ||
qdel(src) // Dead people stop being turned to gold. Don't want people sitting on dead bodies. | ||
|
||
/datum/status_effect/midas_blight/proc/on_update_overlays(atom/parent_atom, list/overlays) | ||
SIGNAL_HANDLER | ||
|
||
if(midas_state) | ||
var/mutable_appearance/midas_overlay = mutable_appearance('maplestation_modules/temp_changes/midas_gun/midas_icons.dmi', midas_state) | ||
midas_overlay.blend_mode = BLEND_MULTIPLY | ||
overlays += midas_overlay | ||
|
||
/datum/status_effect/midas_blight/on_remove() | ||
owner.remove_movespeed_modifier(MOVESPEED_ID_MIDAS_BLIGHT, update = TRUE) | ||
owner.remove_actionspeed_modifier(ACTIONSPEED_ID_MIDAS_BLIGHT, update = TRUE) | ||
UnregisterSignal(owner, COMSIG_ATOM_UPDATE_OVERLAYS) | ||
owner.update_icon() |
124 changes: 124 additions & 0 deletions
124
maplestation_modules/temp_changes/midas_gun/hand_of_midas.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
// Hand of Midas | ||
|
||
/obj/item/gun/magic/midas_hand | ||
name = "The Hand of Midas" | ||
desc = "An ancient Egyptian matchlock pistol imbued with the powers of the Greek King Midas. Don't question the cultural or religious implications of this." | ||
ammo_type = /obj/item/ammo_casing/magic/midas_round | ||
icon_state = "midas_hand" | ||
icon = 'maplestation_modules/temp_changes/midas_gun/midas_icons.dmi' | ||
inhand_icon_state = "gun" | ||
worn_icon_state = "gun" | ||
lefthand_file = 'icons/mob/inhands/weapons/guns_lefthand.dmi' | ||
righthand_file = 'icons/mob/inhands/weapons/guns_righthand.dmi' | ||
fire_sound = 'sound/weapons/gun/rifle/shot.ogg' | ||
pinless = TRUE | ||
max_charges = 1 | ||
can_charge = FALSE | ||
item_flags = NEEDS_PERMIT | ||
w_class = WEIGHT_CLASS_BULKY // Should fit on a belt. | ||
force = 3 | ||
trigger_guard = TRIGGER_GUARD_NORMAL | ||
antimagic_flags = NONE | ||
can_hold_up = FALSE | ||
|
||
/// The length of the Midas Blight debuff, dependant on the amount of gold reagent we've sucked up. | ||
var/gold_timer = 3 SECONDS | ||
/// The range that we can suck gold out of people's bodies | ||
var/gold_suck_range = 2 | ||
|
||
/obj/item/gun/magic/midas_hand/examine(mob/user) | ||
. = ..() | ||
var/gold_time_converted = gold_time_convert() | ||
. += span_notice("Your next shot will inflict [gold_time_converted] second[gold_time_converted == 1 ? "" : "s"] of Midas Blight.") | ||
. += span_notice("Right-Click on enemies to drain gold from their bloodstreams to reload [src].") | ||
. += span_notice("[src] can be reloaded using gold coins in a pinch.") | ||
|
||
/obj/item/gun/magic/midas_hand/shoot_with_empty_chamber(mob/living/user) | ||
. = ..() | ||
balloon_alert(user, "not enough gold") | ||
|
||
// Siphon gold from a victim, recharging our gun & removing their Midas Blight debuff in the process. | ||
/obj/item/gun/magic/midas_hand/afterattack_secondary(mob/living/victim, mob/living/user, proximity_flag, click_parameters) | ||
if(!isliving(victim) || !IN_GIVEN_RANGE(user, victim, gold_suck_range)) | ||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN | ||
if(victim == user) | ||
balloon_alert(user, "can't siphon from self") | ||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN | ||
if(!victim.reagents) | ||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN | ||
if(!victim.reagents.has_reagent(/datum/reagent/gold) && !victim.reagents.has_reagent(/datum/reagent/gold/cursed)) | ||
balloon_alert(user, "no gold in bloodstream") | ||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN | ||
var/gold_beam = user.Beam(victim, icon_state="drain_gold", icon='maplestation_modules/temp_changes/midas_gun/midas_icons.dmi') | ||
if(!do_after(user = user, delay = 1 SECONDS, target = victim, timed_action_flags = (IGNORE_USER_LOC_CHANGE | IGNORE_TARGET_LOC_CHANGE), extra_checks = CALLBACK(src, PROC_REF(check_gold_range), user, victim))) | ||
qdel(gold_beam) | ||
balloon_alert(user, "link broken") | ||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN | ||
handle_gold_charges(user, victim.reagents.get_reagent_amount(/datum/reagent/gold) + victim.reagents.get_reagent_amount(/datum/reagent/gold/cursed)) | ||
victim.reagents.remove_all_type(/datum/reagent/gold, victim.reagents.get_reagent_amount(/datum/reagent/gold) + victim.reagents.get_reagent_amount(/datum/reagent/gold/cursed), strict = FALSE) | ||
victim.remove_status_effect(/datum/status_effect/midas_blight) | ||
qdel(gold_beam) | ||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN | ||
|
||
// If we botch a shot, we have to start over again by inserting gold coins into the gun. Can only be done if it has no charges or gold. | ||
/obj/item/gun/magic/midas_hand/attackby(obj/item/I, mob/living/user, params) | ||
. = ..() | ||
if(charges || gold_timer) | ||
balloon_alert(user, "already loaded") | ||
return | ||
if(istype(I, /obj/item/coin/gold)) | ||
handle_gold_charges(user, 1.5 SECONDS) | ||
qdel(I) | ||
|
||
/// Handles recharging & inserting gold amount | ||
/obj/item/gun/magic/midas_hand/proc/handle_gold_charges(user, gold_amount) | ||
gold_timer += gold_amount | ||
var/gold_time_converted = gold_time_convert() | ||
balloon_alert(user, "[gold_time_converted] second[gold_time_converted == 1 ? "" : "s"]") | ||
if(!charges) | ||
instant_recharge() | ||
|
||
/// Converts our gold_timer to time in seconds, for various ballons/examines | ||
/obj/item/gun/magic/midas_hand/proc/gold_time_convert() | ||
return min(30 SECONDS, round(gold_timer, 0.2)) / 10 | ||
|
||
/// Checks our range to the person we're sucking gold out of. Double the initial range, so you need to get in close to start. | ||
/obj/item/gun/magic/midas_hand/proc/check_gold_range(mob/living/user, mob/living/victim) | ||
return IN_GIVEN_RANGE(user, victim, gold_suck_range*2) | ||
|
||
/obj/item/ammo_casing/magic/midas_round | ||
projectile_type = /obj/projectile/magic/midas_round | ||
|
||
|
||
/obj/projectile/magic/midas_round | ||
name = "gold pellet" | ||
desc = "A typical flintlock ball, save for the fact it's made of cursed Egyptian gold." | ||
damage_type = BRUTE | ||
damage = 10 | ||
stamina = 20 | ||
armour_penetration = 50 | ||
hitsound = 'sound/effects/coin2.ogg' | ||
icon_state = "pellet" | ||
color = "#FFD700" | ||
/// The gold charge in this pellet | ||
var/gold_charge = 0 | ||
|
||
|
||
/obj/projectile/magic/midas_round/fire(setAngle) | ||
/// Transfer the gold energy to our bullet | ||
var/obj/item/gun/magic/midas_hand/my_gun = fired_from | ||
gold_charge = my_gun.gold_timer | ||
my_gun.gold_timer = 0 | ||
..() | ||
|
||
// Gives human targets Midas Blight. | ||
/obj/projectile/magic/midas_round/on_hit(atom/target) | ||
. = ..() | ||
if(ishuman(target)) | ||
var/mob/living/carbon/human/my_guy = target | ||
if(isskeleton(my_guy)) // No cheap farming | ||
return | ||
my_guy.apply_status_effect(/datum/status_effect/midas_blight, min(30 SECONDS, round(gold_charge, 0.2))) // 100u gives 10 seconds | ||
return | ||
|
||
/// suicide_act() removed for temp_changes, due to not wanting to touch main code |
Binary file not shown.