mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 11:05:50 +01:00
Makes Technomancer use modifiers, fixes a few bugs
This commit is contained in:
@@ -13,9 +13,11 @@
|
||||
handle_embedded_objects() //Moving with objects stuck in you can cause bad times.
|
||||
|
||||
if(force_max_speed)
|
||||
return -3 // Returning -1 will actually result in a slowdown for Teshari.
|
||||
return -3
|
||||
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
if(!isnull(M.haste) && M.haste == TRUE)
|
||||
return -3 // Returning -1 will actually result in a slowdown for Teshari.
|
||||
if(!isnull(M.slowdown))
|
||||
tally += M.slowdown
|
||||
|
||||
|
||||
@@ -131,10 +131,11 @@ Please contact me on #coderbus IRC. ~Carn x
|
||||
#define LEGCUFF_LAYER 23
|
||||
#define L_HAND_LAYER 24
|
||||
#define R_HAND_LAYER 25
|
||||
#define FIRE_LAYER 26 //If you're on fire
|
||||
#define WATER_LAYER 27 //If you're submerged in water.
|
||||
#define TARGETED_LAYER 28 //BS12: Layer for the target overlay from weapon targeting system
|
||||
#define TOTAL_LAYERS 29
|
||||
#define MODIFIER_EFFECTS_LAYER 26
|
||||
#define FIRE_LAYER 27 //If you're on fire
|
||||
#define WATER_LAYER 28 //If you're submerged in water.
|
||||
#define TARGETED_LAYER 29 //BS12: Layer for the target overlay from weapon targeting system
|
||||
#define TOTAL_LAYERS 30
|
||||
//////////////////////////////////
|
||||
|
||||
/mob/living/carbon/human
|
||||
@@ -1118,6 +1119,18 @@ var/global/list/damage_icon_parts = list()
|
||||
|
||||
if(update_icons) update_icons()
|
||||
|
||||
/mob/living/carbon/human/update_modifier_visuals(var/update_icons=1)
|
||||
overlays_standing[MODIFIER_EFFECTS_LAYER] = null
|
||||
var/image/effects = new()
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
if(M.mob_overlay_state)
|
||||
var/image/I = image("icon" = 'icons/mob/modifier_effects.dmi', "icon_state" = M.mob_overlay_state)
|
||||
effects.overlays += I
|
||||
|
||||
overlays_standing[MODIFIER_EFFECTS_LAYER] = effects
|
||||
|
||||
if(update_icons)
|
||||
update_icons()
|
||||
|
||||
/mob/living/carbon/human/update_fire(var/update_icons=1)
|
||||
overlays_standing[FIRE_LAYER] = null
|
||||
|
||||
@@ -958,6 +958,11 @@ default behaviour is:
|
||||
update_icons()
|
||||
return canmove
|
||||
|
||||
// Adds overlays for specific modifiers.
|
||||
// You'll have to add your own implementation for non-humans currently, just override this proc.
|
||||
/mob/living/proc/update_modifier_visuals()
|
||||
return
|
||||
|
||||
/mob/living/proc/update_water() // Involves overlays for humans. Maybe we'll get submerged sprites for borgs in the future?
|
||||
return
|
||||
|
||||
|
||||
@@ -439,3 +439,11 @@
|
||||
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
|
||||
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1)
|
||||
client.screen += hud_used.hide_actions_toggle
|
||||
|
||||
// Returns a number to determine if something is harder or easier to hit than normal.
|
||||
/mob/living/proc/get_evasion()
|
||||
var/result = evasion // First we get the 'base' evasion. Generally this is zero.
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
if(!isnull(M.evasion))
|
||||
result += M.evasion
|
||||
return result
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
var/stacks = MODIFIER_STACK_FORBID // If true, attempts to add a second instance of this type will refresh expire_at instead.
|
||||
var/flags = 0 // Flags for the modifier, see mobs.dm defines for more details.
|
||||
|
||||
var/light_color = null // If set, the mob possessing the modifier will glow in this color. Not implemented yet.
|
||||
var/light_range = null // How far the light for the above var goes. Not implemented yet.
|
||||
var/light_intensity = null // Ditto. Not implemented yet.
|
||||
var/mob_overlay_state = null // Icon_state for an overlay to apply to a (human) mob while this exists. This is actually implemented.
|
||||
|
||||
// Now for all the different effects.
|
||||
// Percentage modifiers are expressed as a multipler. (e.g. +25% damage should be written as 1.25)
|
||||
var/max_health_flat // Adjusts max health by a flat (e.g. +20) amount. Note this is added to base health.
|
||||
@@ -29,6 +34,8 @@
|
||||
var/incoming_healing_percent // Adjusts amount of healing received.
|
||||
var/outgoing_melee_damage_percent // Adjusts melee damage inflicted by holder by a percentage. Affects attacks by melee weapons and hand-to-hand.
|
||||
var/slowdown // Negative numbers speed up, positive numbers slow down movement.
|
||||
var/haste // If set to 1, the mob will be 'hasted', which makes it ignore slowdown and go really fast.
|
||||
var/evasion // Positive numbers reduce the odds of being hit by 15% each. Negative numbers increase the odds.
|
||||
|
||||
/datum/modifier/New(var/new_holder)
|
||||
holder = new_holder
|
||||
@@ -44,12 +51,18 @@
|
||||
to_chat(holder, on_expired_text)
|
||||
on_expire()
|
||||
holder.modifiers.Remove(src)
|
||||
if(mob_overlay_state) // We do this after removing ourselves from the list so that the overlay won't remain.
|
||||
holder.update_modifier_visuals()
|
||||
qdel(src)
|
||||
|
||||
// Override this for special effects when it gets removed.
|
||||
/datum/modifier/proc/on_expire()
|
||||
return
|
||||
|
||||
// Called every Life() tick. Override for special behaviour.
|
||||
/datum/modifier/proc/tick()
|
||||
return
|
||||
|
||||
/mob/living
|
||||
var/list/modifiers = list() // A list of modifier datums, which can adjust certain mob numbers.
|
||||
|
||||
@@ -64,13 +77,16 @@
|
||||
// Get rid of anything we shouldn't have.
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
M.check_if_valid()
|
||||
// Remaining modifiers will now receive a tick(). This is in a second loop for safety in order to not tick() an expired modifier.
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
M.tick()
|
||||
|
||||
// Call this to add a modifier to a mob. First argument is the modifier type you want, second is how long it should last, in ticks.
|
||||
// The SECONDS/MINUTES macro is very helpful for this. E.g. M.add_modifier(/datum/modifier/example, 5 MINUTES)
|
||||
/mob/living/proc/add_modifier(var/modifier_type, var/expire_at = null)
|
||||
// First, check if the mob already has this modifier.
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
if(ispath(modifier_type, M.type))
|
||||
if(istype(modifier_type, M))
|
||||
switch(M.stacks)
|
||||
if(MODIFIER_STACK_FORBID)
|
||||
return // Stop here.
|
||||
@@ -89,6 +105,8 @@
|
||||
if(mod.on_created_text)
|
||||
to_chat(src, mod.on_created_text)
|
||||
modifiers.Add(mod)
|
||||
if(mod.mob_overlay_state)
|
||||
update_modifier_visuals()
|
||||
|
||||
// Removes a specific instance of modifier
|
||||
/mob/living/proc/remove_specific_modifier(var/datum/modifier/M, var/silent = FALSE)
|
||||
@@ -97,10 +115,17 @@
|
||||
// Removes all modifiers of a type
|
||||
/mob/living/proc/remove_modifiers_of_type(var/modifier_type, var/silent = FALSE)
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
if(ispath(modifier_type, M.type))
|
||||
if(istype(M, modifier_type))
|
||||
M.expire(silent)
|
||||
|
||||
// Removes all modifiers, useful if the mob's being deleted
|
||||
/mob/living/proc/remove_all_modifiers(var/silent = FALSE)
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
M.expire(silent)
|
||||
M.expire(silent)
|
||||
|
||||
// Checks if the mob has a modifier type.
|
||||
/mob/living/proc/has_modifier_of_type(var/modifier_type)
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
if(istype(M, modifier_type))
|
||||
return TRUE
|
||||
return FALSE
|
||||
@@ -173,7 +173,7 @@
|
||||
return
|
||||
|
||||
//roll to-hit
|
||||
miss_modifier = max(15*(distance-2) - round(15*accuracy) + miss_modifier + round(15*target_mob.evasion), 0)
|
||||
miss_modifier = max(15*(distance-2) - round(15*accuracy) + miss_modifier + round(15*target_mob.get_evasion()), 0)
|
||||
var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, miss_modifier, ranged_attack=(distance > 1 || original != target_mob)) //if the projectile hits a target we weren't originally aiming at then retain the chance to miss
|
||||
|
||||
var/result = PROJECTILE_FORCE_MISS
|
||||
|
||||
Reference in New Issue
Block a user