This commit is contained in:
kevinz000
2020-03-25 21:23:54 -07:00
parent 13a8e7a777
commit 825adfa29f
10 changed files with 74 additions and 45 deletions
@@ -1,8 +1,11 @@
/mob/living/carbon/human/get_blocking_items()
. = ..()
if(wear_suit)
. += wear_suit
if(!.[wear_suit])
.[wear_suit] = wear_suit.block_priority
if(w_uniform)
. += w_uniform
if(!.[wear_uniform])
.[wear_uniform] = wear_uniform.block_priority
if(wear_neck)
. += wear_neck
if(!.[wear_neck])
.[wear_neck] = wear_neck.block_priority
+21 -6
View File
@@ -51,31 +51,46 @@
if((. & BLOCK_SUCCESS) && !(. & BLOCK_CONTINUE_CHAIN))
return
var/list/obj/item/tocheck = get_blocking_items()
sortTim(tocheck, /proc/cmp_item_block_priority_asc)
sortTim(tocheck, /proc/cmp_numeric_asc, TRUE)
// i don't like this
var/block_chance_modifier = round(damage / -3)
if(real_attack)
for(var/obj/item/I in tocheck)
// i don't like this too
var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
var/results = I.run_block(src, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, return_list)
var/results
if(I == active_parry_item)
results = I.active_parry(src, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, return_list)
else if(I == active_block_item)
results = I.active_block(src, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, return_list)
else
results = I.run_block(src, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, return_list)
. |= results
if((results & BLOCK_SUCCESS) && !(results & BLOCK_CONTINUE_CHAIN))
break
else
for(var/obj/item/I in tocheck)
// i don't like this too
var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
I.check_block(src, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, return_list)
if(I == active_block_item) //block is long termed enough we give a damn. parry, not so much.
I.check_active_block(src, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, return_list)
else
var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
I.check_block(src, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, return_list)
/// Gets an unsortedlist of objects to run block checks on.
/// Gets an unsortedlist of objects to run block checks on. List must have associative values for priorities!
/mob/living/proc/get_blocking_items()
. = 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))
continue
. |= I
if(.[I]) //don't override block/parry.
continue
.[I] = I.block_priority
/obj/item
/// The 0% to 100% chance for the default implementation of random block rolls.
@@ -1,7 +1,8 @@
// yell at me later for file naming
// This file contains stuff relating to the new directional blocking and parry system.
/mob/living
var/obj/item/blocking_item
var/obj/item/active_block_item
var/obj/item/active_parry_item
var/parrying = FALSE
var/parry_frame = 0
@@ -34,7 +35,7 @@ GLOBAL_LIST_EMPTY(block_parry_data)
var/block_end_click_cd_add = 4
/// Disallow attacking during block
var/block_lock_attacking = TRUE
/// The priority we get in [mob/do_run_block()] while we're being used.
/// The priority we get in [mob/do_run_block()] while we're being used to parry.
var/block_active_priority = BLOCK_PRIORITY_ACTIVE_BLOCK
/// Amount of "free" damage blocking absorbs
@@ -66,6 +67,8 @@ GLOBAL_LIST_EMPTY(block_parry_data)
var/block_stamina_cost_per_second = 1.5
/////////// PARRYING ////////////
/// Prioriry for [mob/do_run_block()] while we're being used to parry.
var/parry_active_priority = BLOCK_PRIORITY_ACTIVE_PARRY
/// Parry windup duration in deciseconds
var/parry_time_windup = 2
/// Parry spooldown duration in deciseconds
@@ -85,24 +88,22 @@ GLOBAL_LIST_EMPTY(block_parry_data)
/// Efficiency in percent on perfect parry.
var/parry_efficiency_perfect = 120
/obj/item
/// Defense flags, see defines.
var/defense_flags = NONE
/// Our block parry data. Should be set in init, or something.
var/datum/block_parry_data/block_parry_data
/obj/item/proc/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))
return
/// Yadda yadda WIP access block/parry data...
/obj/item/Initialize(mapload)
block_parry_data = get_block_parry_data(/datum/block_parry_data)
return ..()
/// This item can be used to parry. Only a basic check used to determine if we should proceed with parry chain at all.
#define ITEM_DEFENSE_CAN_PARRY (1<<0)
/// This item can be used in the directional blocking system. Only a basic check used to determine if we should proceed with directional block handling at all.
#define ITEM_DEFENSE_CAN_BLOCK (1<<1)
/obj/item/proc/active_parry(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_PARRY))
return
/// Yadda yadda WIP access block/parry data...
/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))
return
/// Yadda yadda WIP access block/parry data...
/**
* Gets the list of directions we can block. Include DOWN to block attacks from our same tile.
@@ -1646,7 +1646,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
glass_icon_state = "pina_colada"
glass_name = "Pina Colada"
glass_desc = "If you like pina coladas, and getting caught in the rain... well, you'll like this drink."
/datum/reagent/consumable/ethanol/grasshopper
name = "Grasshopper"
description = "A fresh and sweet dessert shooter. Difficult to look manly while drinking this."
@@ -2354,7 +2354,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/hotlime_miami/on_mob_life(mob/living/carbon/M)
M.set_drugginess(50)
M.adjustStaminaLoss(-2)
return ..()
return ..()
/datum/reagent/consumable/ethanol/fruit_wine
name = "Fruit Wine"