This commit is contained in:
kevinz000
2020-03-26 13:08:05 -07:00
parent 4391fc3714
commit 135ca27281
6 changed files with 48 additions and 9 deletions
-1
View File
@@ -53,7 +53,6 @@
/// Block priorities. Higher means it's checked sooner.
// THESE MUST NEVER BE 0! Block code uses ! instead of isnull for the speed boost.
#define BLOCK_PRIORITY_ACTIVE_PARRY 300
#define BLOCK_PRIORITY_ACTIVE_BLOCK 200
#define BLOCK_PRIORITY_HELD_ITEM 100
#define BLOCK_PRIORITY_CLOTHING 50
+10
View File
@@ -22,3 +22,13 @@ GLOBAL_LIST_INIT(dir2blockdir, list(
))
#define DIR2BLOCKDIR(d) (GLOB.dir2blockdir["[d]"])
/// ""types"" of parry "items"
#define UNARMED_PARRY "unarmed"
#define MARTIAL_PARRY "martial"
#define ITEM_PARRY "item"
/// Parry phase we're in
#define PARRY_WINDUP "windup"
#define PARRY_ACTIVE "main"
#define PARRY_SPINDOWN "spindown"
+4
View File
@@ -10,6 +10,10 @@
var/help_verb
var/pacifism_check = TRUE //are the martial arts combos/attacks unable to be used by pacifist.
var/allow_temp_override = TRUE //if this martial art can be overridden by temporary martial arts
/// Can we be used to unarmed parry?
var/can_martial_parry = FALSE
/// Set this variable to something not null, this'll be the preferred unarmed parry in most cases if [can_martial_parry] is TRUE.
var/datum/block_parry_data/block_parry_data
/datum/martial_art/proc/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
return FALSE
@@ -126,6 +126,9 @@
. = BLOCK_CHANGE_DAMAGE
if(final_damage <= 0)
. |= BLOCK_SUCCESS //full block
owner.visible_message("<span class='warning'>[owner] blocks \the [attack_text] with [src]!</span>")
else
owner.visible_message("<span class='warning'>[owner] dampens \the [attack_text] with [src]!</span>")
/obj/item/proc/check_active_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return)
if(!CHECK_BITFIELD(item_flags, ITEM_CAN_BLOCK))
+3 -2
View File
@@ -23,6 +23,9 @@
* return_list - If something wants to grab things from what items/whatever put into list/block_return on obj/item/run_block and the comsig, pass in a list so you can grab anything put in it after block runs.
*/
/mob/living/proc/do_run_block(real_attack = TRUE, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, list/return_list = list())
. = run_parry(real_attack, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, return_list) //Parry - Highest priority!
if((. & BLOCK_SUCCESS) && !(. & BLOCK_CONTINUE_CHAIN))
return
// Component signal block runs have highest priority.. for now.
. = SEND_SIGNAL(src, COMSIG_LIVING_RUN_BLOCK, real_attack, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, return_list)
if((. & BLOCK_SUCCESS) && !(. & BLOCK_CONTINUE_CHAIN))
@@ -59,8 +62,6 @@
. = list()
if(active_block_item)
.[active_block_item] = active_block_item.block_parry_data.block_active_priority
if(active_parry_item)
.[active_parry_item] = active_parry_item.block_parry_data.parry_active_priority
for(var/obj/item/I in held_items)
// this is a bad check but i am not removing it until a better catchall is made
if(istype(I, /obj/item/clothing))
@@ -1,12 +1,18 @@
// yell at me later for file naming
// This file contains stuff relating to the new directional blocking and parry system.
/mob/living
/// Whether ot not the user is in the middle of an active parry.
/// Whether ot not the user is in the middle of an active parry. Set to [UNARMED_PARRY], [ITEM_PARRY], [MARTIAL_PARRY] if parrying.
var/parrying = FALSE
/// The itme the user is currently parrying with.
/// The itme the user is currently parrying with, if any.
var/obj/item/active_parry_item
/// world.time of parry action start
var/parry_start_time = 0
/// Whether or not we can unarmed parry
var/parry_while_unarmed = FALSE
/// Should we prioritize martial art parrying when unarmed?
var/parry_prioritize_martial = TRUE
/// Our block_parry_data for unarmed blocks/parries. Currently only used for parrying, as unarmed block isn't implemented yet.
var/datum/block_parry_data/block_parry_data
GLOBAL_LIST_EMPTY(block_parry_data)
@@ -73,11 +79,12 @@ GLOBAL_LIST_EMPTY(block_parry_data)
/////////// PARRYING ////////////
/// Prioriry for [mob/do_run_block()] while we're being used to parry.
var/parry_active_priority = BLOCK_PRIORITY_ACTIVE_PARRY
// None - Parry is always highest priority!
/// Parry windup duration in deciseconds
var/parry_time_windup = 2
/// Parry spooldown duration in deciseconds
var/parry_time_spooldown = 3
/// Parry spindown duration in deciseconds
var/parry_time_spindown = 3
/// Main parry window in deciseconds
var/parry_time_active = 5
/// Perfect parry window in deciseconds from the main window. 3 with main 5 = perfect on third decisecond of main window.
@@ -87,7 +94,7 @@ GLOBAL_LIST_EMPTY(block_parry_data)
/// [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
var/parry_time_imperfect_falloff_percent = 20
/// [parry_imperfect_falloff_percent] override for attack types, list(ATTACK_TYPE_DEFINE = deciseconds)
var/list/parry_time_imperfect_falloff_percent_override
/// Efficiency in percent on perfect parry.
@@ -98,4 +105,19 @@ GLOBAL_LIST_EMPTY(block_parry_data)
return
/// Yadda yadda WIP access block/parry data...
/// same return values as normal blocking, called with absolute highest priority in the block "chain".
/mob/living/proc/run_parry(real_attack = TRUE, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, list/return_list = list())
/// Gets the datum/block_parry_data we're going to use to parry.
/mob/living/proc/get_parry_data()
if(parrying == ITEM_PARRY)
return active_parry_item.block_parry_data
else if(parrying == UNARMED_PARRY)
return block_parry_data
else if(parrying == MARTIAL_PARRY)
return mind.martial_art.block_parry_data
#define UNARMED_PARRY
#define MARTIAL_PARRY
#define ITEM_PARRY