From 0723399ed463e46b2d803910898ce5a998ca3e5c Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sat, 30 May 2020 20:55:33 -0700 Subject: [PATCH] render --- code/__DEFINES/combat/attack_types.dm | 9 ++ .../mob/living/living_blocking_parrying.dm | 103 ++++++------------ 2 files changed, 42 insertions(+), 70 deletions(-) diff --git a/code/__DEFINES/combat/attack_types.dm b/code/__DEFINES/combat/attack_types.dm index 2d001089f0..a401c0f2ee 100644 --- a/code/__DEFINES/combat/attack_types.dm +++ b/code/__DEFINES/combat/attack_types.dm @@ -21,3 +21,12 @@ #define TEXT_ATTACK_TYPE_THROWN "8" #define TEXT_ATTACK_TYPE_TACKLE "16" #define TEXT_ATTACK_TYPE_PARRY_COUNTERATTACK "32" + +GLOBAL_LIST_INIT(attack_type_names, list( + TEXT_ATTACK_TYPE_MELEE = "Melee", + TEXT_ATTACK_TYPE_PROJECTILE = "Projectile", + TEXT_ATTACK_TYPE_UNARMED = "Unarmed", + TEXT_ATTACK_TYPE_THROWN = "Thrown", + TEXT_ATTACK_TYPE_TACKLE = "Tackle", + TEXT_ATTACK_TYPE_PARRY_COUNTERATTACK = "Parry Counterattack" +)) diff --git a/code/modules/mob/living/living_blocking_parrying.dm b/code/modules/mob/living/living_blocking_parrying.dm index 1792b4b404..a50a6f5fd5 100644 --- a/code/modules/mob/living/living_blocking_parrying.dm +++ b/code/modules/mob/living/living_blocking_parrying.dm @@ -160,7 +160,11 @@ GLOBAL_LIST_EMPTY(block_parry_data) return total/div //groan #define RENDER_VARIABLE_SIMPLE(varname, desc) dat += "[#varname]
[desc][varname]" -#define RENDER_OVERRIDE_LIST +#define RENDER_OVERRIDE_LIST(varname, desc) \ + +#define RENDER_ATTACK_TYPES(varname, desc) dat += "[#varname]
[desc][english_list(bitfield2list(varname, GLOB.attack_type_names))]" +#define RENDER_BLOCK_DIRECTIONS(varname, desc) \ + /** * Generates a HTML render of this datum for self-documentation * Maybe make this tgui-next someday haha @@ -171,9 +175,8 @@ GLOBAL_LIST_EMPTY(block_parry_data) if(block_data) dat += "

Block Stats

" // can_block_directions - dat += " - // can_block_attack_types - dat += " + RENDER_BLOCK_DIRECTIONS(can_block_directions, "Which directions this can block in.") + RENDER_ATTACK_TYPES(can_block_attack_types, "The kinds of attacks this can block.") RENDER_VARIABLE_SIMPLE(block_slowdown, "How much slowdown is applied to the user while blocking. Lower is better.") RENDER_VARIABLE_SIMPLE(block_end_click_cd_add, "How much click delay in deciseconds is applied to the user when blocking ends. Lower is better.") RENDER_VARIABLE_SIMPLE(block_lock_attacking, "Whether or not (1 or 0) the user is locked from atacking and/or item usage while blocking.") @@ -189,81 +192,41 @@ GLOBAL_LIST_EMPTY(block_parry_data) RENDER_OVERRIDE_LIST(block_stamina_efficiency_override, "Overrides for the above for each attack type.") RENDER_VARIABLE_SIMPLE(block_stamina_limb_ratio, "The ratio of stamina that is applied to the limb holding this object (if applicable) rather than whole body/chest.") RENDER_VARIABLE_SIMPLE(block_stamina_buffer_ratio, "The ratio of stamina incurred by chest/whole body that is buffered rather than direct (buffer = your stamina buffer, direct = direct stamina damage like from a disabler.)") - - + RENDER_VARIABLE_SIMPLE(block_stamina_cost_per_second, "The buffered stamina damage the user incurs per second of block. Lower is better.") + RENDER_ATTACK_TYPES(block_resting_attack_types_anydir, "The kinds of attacks you can block while resting/otherwise knocked to the floor from any direction. can_block_attack_types takes precedence.") + RENDER_ATTACK_TYPES(block_resting_attack_types_directional, "The kinds of attacks you can block wihle resting/otherwise knocked to the floor that are directional only. can_block_attack_types takes precedence.") + RENDER_VARIABLE_SIMPLE(block_resting_stamina_penalty_multiplier, "Multiplier to stamina damage incurred from blocking while downed. Lower is better.") + RENDER_OVERRIDE_LIST(block_resting_stamina_penalty_multiplier, "Overrides for the above for each attack type.") dat += "
Name/DescriptionValue
" if(parry_data) dat += "

Parry Stats

" + RENDER_VARIABLE_SIMPLE(parry_respect_clickdelay, "Whether or not (1 or 0) you can only parry if your attack cooldown isn't in effect.") + RENDER_VARIABLE_SIMPLE(parry_stamina_cost, "Buffered stamina damage incurred by you for parrying with this.") + RENDER_ATTACK_TYPES(parry_attack_types, "Attack types you can parry.") + // parry_flags + dat += "" + RENDER_VARIABLE_SIMPLE(parry_time_windup, "Deciseconds of parry windup.") + RENDER_VARIABLE_SIMPLE(parry_time_spindown, "Deciseconds of parry spindown.") + RENDER_VARIABLE_SIMPLE(parry_time_active, "Deciseconds of active parry window - This is the ONLY time your parry is active.") + RENDER_VARIABLE_SIMPLE(parry_time_windup_visual_override, "Visual effect length override") + RENDER_VARIABLE_SIMPLE(parry_time_spindown_visual_override, "Visual effect length override") + RENDER_VARIABLE_SIMPLE(parry_time_active_visual_override, "Visual effect length override") + RENDER_VARIABLE_SIMPLE(parry_time_perfect, "Deciseconds into the active window considered the 'center' of the perfect period.") + RENDER_VARIABLE_SIMPLE(parry_time_perfect_leeway, "Leeway on both sides of the perfect period's center still considered perfect.") + RENDER_OVERRIDE_LIST(parry_time_perfect_leeway_override, "Override for the above for each attack type") + RENDER_VARIABLE_SIMPLE(parry_imperfect_falloff_percent, "Linear falloff in percent per decisecond for attacks parried outside of perfect window.") + RENDER_OVERRIDE_LIST(parry_imperfect_falloff_percent_override, "Override for the above for each attack type") + RENDER_VARIABLE_SIMPLE(parry_efficiency_perfect, "Efficiency in percentage a parry in the perfect window is considered.") + // parry_data + dat += "" dat += "
Name/DescriptionValue
" return dat.Join("") #undef RENDER_VARIABLE_SIMPLE #undef RENDER_OVERRIDE_LIST +#undef RENDER_ATTACK_TYPES +#undef RENDER_BLOCK_DIRECTIONS - /// NOTE: FOR ATTACK_TYPE_DEFINE, you MUST wrap it in "[DEFINE_HERE]"! The defines are bitflags, and therefore, NUMBERS! - - /// See defines. Point of reference is someone facing north. - var/can_block_directions = BLOCK_DIR_NORTH | BLOCK_DIR_NORTHEAST | BLOCK_DIR_NORTHWEST - /// Attacks we can block - var/can_block_attack_types = ALL - - /// Stamina dealt directly via adjustStaminaLossBuffered() per SECOND of block. - var/block_stamina_cost_per_second = 1.5 - - /// Bitfield for attack types that we can block while down. This will work in any direction. - var/block_resting_attack_types_anydir = ATTACK_TYPE_MELEE | ATTACK_TYPE_UNARMED | ATTACK_TYPE_TACKLE - /// Bitfield for attack types that we can block while down but only in our normal directions. - var/block_resting_attack_types_directional = ATTACK_TYPE_PROJECTILE | ATTACK_TYPE_THROWN - /// Multiplier to stamina damage taken for attacks blocked while downed. - var/block_resting_stamina_penalty_multiplier = 1.5 - /// Override list for multiplier to stamina damage taken for attacks blocked while down. list("[ATTACK_TYPE_DEFINE]" = multiplier_number) - var/list/block_resting_stamina_penalty_multiplier_override - - /// Sounds for blocking - var/list/block_sounds = list('sound/block_parry/block_metal1.ogg' = 1, 'sound/block_parry/block_metal1.ogg' = 1) - - /////////// PARRYING //////////// - /// Prioriry for [mob/do_run_block()] while we're being used to parry. - // None - Parry is always highest priority! - /// Parry doesn't work if you aren't able to otherwise attack due to clickdelay - var/parry_respect_clickdelay = TRUE - /// Parry stamina cost - var/parry_stamina_cost = 5 - /// Attack types we can block - var/parry_attack_types = ALL - /// Parry flags - var/parry_flags = PARRY_DEFAULT_HANDLE_FEEDBACK | PARRY_LOCK_ATTACKING - - /// Parry windup duration in deciseconds. 0 to this is windup, afterwards is main stage. - var/parry_time_windup = 2 - /// Parry spindown duration in deciseconds. main stage end to this is the spindown stage, afterwards the parry fully ends. - var/parry_time_spindown = 3 - /// Main parry window in deciseconds. This is between [parry_time_windup] and [parry_time_spindown] - var/parry_time_active = 5 - // Visual overrides - /// If set, overrides visual duration of windup - var/parry_time_windup_visual_override - /// If set, overrides visual duration of active period - var/parry_time_active_visual_override - /// If set, overrides visual duration of spindown - var/parry_time_spindown_visual_override - /// Perfect parry window in deciseconds from the start of the main window. 3 with main 5 = perfect on third decisecond of main window. - var/parry_time_perfect = 2.5 - /// Time on both sides of perfect parry that still counts as part of the perfect window. - var/parry_time_perfect_leeway = 1 - /// [parry_time_perfect_leeway] override for attack types, list("[ATTACK_TYPE_DEFINE]" = deciseconds) - var/list/parry_time_perfect_leeway_override - /// Parry "efficiency" falloff in percent per decisecond once perfect window is over. - var/parry_imperfect_falloff_percent = 20 - /// [parry_imperfect_falloff_percent] override for attack types, list("[ATTACK_TYPE_DEFINE]" = deciseconds) - var/list/parry_imperfect_falloff_percent_override - /// Efficiency in percent on perfect parry. - var/parry_efficiency_perfect = 120 - /// Parry effect data. - var/list/parry_data = list( - PARRY_REFLEX_COUNTERATTACK = PARRY_COUNTERATTACK_MELEE_ATTACK_CHAIN - ) - /// Efficiency must be at least this to be considered successful var/parry_efficiency_considered_successful = 0.1 /// Efficiency must be at least this to run automatic counterattack var/parry_efficiency_to_counterattack = 0.1