This commit is contained in:
kevinz000
2020-03-25 21:06:01 -07:00
parent 0774bca2f4
commit 13a8e7a777
3 changed files with 58 additions and 52 deletions
-51
View File
@@ -255,54 +255,3 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list(
#define BULLET_ACT_BLOCK "BLOCK" //It's a blocked hit, whatever that means in the context of the thing it's hitting.
#define BULLET_ACT_FORCE_PIERCE "PIERCE" //It pierces through the object regardless of the bullet being piercing by default.
#define BULLET_ACT_TURF "TURF" //It hit us but it should hit something on the same turf too. Usually used for turfs.
/// Bitflags for check_block() and handle_block(). Meant to be combined. You can be hit and still reflect, for example, if you do not use BLOCK_SUCCESS.
/// Attack was not blocked
#define BLOCK_NONE NONE
/// Attack was blocked, do not do damage. THIS FLAG MUST BE THERE FOR DAMAGE/EFFECT PREVENTION!
#define BLOCK_SUCCESS (1<<1)
/// The below are for "metadata" on "how" the attack was blocked.
/// Attack was and should be redirected according to list argument REDIRECT_METHOD (NOTE: the SHOULD here is important, as it says "the thing blocking isn't handling the reflecting for you so do it yourself"!)
#define BLOCK_SHOULD_REDIRECT (1<<2)
/// Attack was redirected (whether by us or by SHOULD_REDIRECT flagging for automatic handling)
#define BLOCK_REDIRECTED (1<<3)
/// Attack was blocked by something like a shield.
#define BLOCK_PHYSICAL_EXTERNAL (1<<4)
/// Attack was blocked by something worn on you.
#define BLOCK_PHYSICAL_INTERNAL (1<<5)
/// Attack outright missed because the target dodged. Should usually be combined with redirection passthrough or something (see martial arts)
#define BLOCK_TARGET_DODGED (1<<7)
/// Meta-flag for run_block/do_run_block : By default, BLOCK_SUCCESS tells do_run_block() to assume the attack is completely blocked and not continue the block chain. If this is present, it will continue to check other items in the chain rather than stopping.
#define BLOCK_CONTINUE_CHAIN (1<<8)
/// For keys in associative list/block_return as we don't want to saturate our (somewhat) limited flags.
#define BLOCK_RETURN_REDIRECT_METHOD "REDIRECT_METHOD"
/// Pass through victim
#define REDIRECT_METHOD_PASSTHROUGH "passthrough"
/// Deflect at randomish angle
#define REDIRECT_METHOD_DEFLECT "deflect"
/// reverse 180 angle, basically (as opposed to "realistic" wall reflections)
#define REDIRECT_METHOD_REFLECT "reflect"
/// "do not taser the bad man with the desword" - actually aims at the firer/attacker rather than just reversing
#define REDIRECT_METHOD_RETURN_TO_SENDER "no_you"
/// These keys are generally only applied to the list if real_attack is FALSE. Used incase we want to make "smarter" mob AI in the future or something.
/// Tells the caller how likely from 0 (none) to 100 (always) we are to reflect energy projectiles
#define BLOCK_RETURN_REFLECT_PROJECTILE_CHANCE "reflect_projectile_chance"
/// Tells the caller how likely we are to block attacks from 0 to 100 in general
#define BLOCK_RETURN_NORMAL_BLOCK_CHANCE "normal_block_chance"
/// Tells the caller about how many hits we can soak on average before our blocking fails.
#define BLOCK_RETURN_BLOCK_CAPACITY "block_capacity"
/// Default if the above isn't set in the list.
#define DEFAULT_REDIRECT_METHOD_PROJECTILE REDIRECT_METHOD_DEFLECT
/// Block priorities
#define BLOCK_PRIORITY_HELD_ITEM 100
#define BLOCK_PRIORITY_CLOTHING 50
#define BLOCK_PRIORITY_WEAR_SUIT 75
#define BLOCK_PRIORITY_UNIFORM 25
#define BLOCK_PRIORITY_DEFAULT BLOCK_PRIORITY_HELD_ITEM
+54
View File
@@ -0,0 +1,54 @@
// Don't ask why there's block_parry.dm and this. This is for the run_block() system, which is the "parent" system of the directional block and parry systems.
/// Bitflags for check_block() and handle_block(). Meant to be combined. You can be hit and still reflect, for example, if you do not use BLOCK_SUCCESS.
/// Attack was not blocked
#define BLOCK_NONE NONE
/// Attack was blocked, do not do damage. THIS FLAG MUST BE THERE FOR DAMAGE/EFFECT PREVENTION!
#define BLOCK_SUCCESS (1<<1)
/// The below are for "metadata" on "how" the attack was blocked.
/// Attack was and should be redirected according to list argument REDIRECT_METHOD (NOTE: the SHOULD here is important, as it says "the thing blocking isn't handling the reflecting for you so do it yourself"!)
#define BLOCK_SHOULD_REDIRECT (1<<2)
/// Attack was redirected (whether by us or by SHOULD_REDIRECT flagging for automatic handling)
#define BLOCK_REDIRECTED (1<<3)
/// Attack was blocked by something like a shield.
#define BLOCK_PHYSICAL_EXTERNAL (1<<4)
/// Attack was blocked by something worn on you.
#define BLOCK_PHYSICAL_INTERNAL (1<<5)
/// Attack outright missed because the target dodged. Should usually be combined with redirection passthrough or something (see martial arts)
#define BLOCK_TARGET_DODGED (1<<7)
/// Meta-flag for run_block/do_run_block : By default, BLOCK_SUCCESS tells do_run_block() to assume the attack is completely blocked and not continue the block chain. If this is present, it will continue to check other items in the chain rather than stopping.
#define BLOCK_CONTINUE_CHAIN (1<<8)
/// For keys in associative list/block_return as we don't want to saturate our (somewhat) limited flags.
#define BLOCK_RETURN_REDIRECT_METHOD "REDIRECT_METHOD"
/// Pass through victim
#define REDIRECT_METHOD_PASSTHROUGH "passthrough"
/// Deflect at randomish angle
#define REDIRECT_METHOD_DEFLECT "deflect"
/// reverse 180 angle, basically (as opposed to "realistic" wall reflections)
#define REDIRECT_METHOD_REFLECT "reflect"
/// "do not taser the bad man with the desword" - actually aims at the firer/attacker rather than just reversing
#define REDIRECT_METHOD_RETURN_TO_SENDER "no_you"
/// These keys are generally only applied to the list if real_attack is FALSE. Used incase we want to make "smarter" mob AI in the future or something.
/// Tells the caller how likely from 0 (none) to 100 (always) we are to reflect energy projectiles
#define BLOCK_RETURN_REFLECT_PROJECTILE_CHANCE "reflect_projectile_chance"
/// Tells the caller how likely we are to block attacks from 0 to 100 in general
#define BLOCK_RETURN_NORMAL_BLOCK_CHANCE "normal_block_chance"
/// Tells the caller about how many hits we can soak on average before our blocking fails.
#define BLOCK_RETURN_BLOCK_CAPACITY "block_capacity"
/// Default if the above isn't set in the list.
#define DEFAULT_REDIRECT_METHOD_PROJECTILE REDIRECT_METHOD_DEFLECT
/// Block priorities. Higher means it's checked sooner.
#define BLOCK_PRIORITY_ACTIVE_PARRY 300
#define BLOCK_PRIORITY_ACTIVE_BLOCK 200
#define BLOCK_PRIORITY_HELD_ITEM 100
#define BLOCK_PRIORITY_CLOTHING 50
#define BLOCK_PRIORITY_WEAR_SUIT 75
#define BLOCK_PRIORITY_UNIFORM 25
#define BLOCK_PRIORITY_DEFAULT BLOCK_PRIORITY_HELD_ITEM
@@ -34,6 +34,8 @@ 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.
var/block_active_priority = BLOCK_PRIORITY_ACTIVE_BLOCK
/// Amount of "free" damage blocking absorbs
var/block_damage_absorption = 10
@@ -58,7 +60,7 @@ GLOBAL_LIST_EMPTY(block_parry_data)
/// Ratio of stamina incurred by blocking that goes to the arm holding the object instead of the chest. Has no effect if this is not held in hand.
var/block_stamina_limb_ratio = 0.5
/// Override stamina limb ratio, list(ATTACK_TYPE_DEFINE = absorption), see [block_stamina_limb_ratio]
var/list/block_stamina_limb_ratio
var/list/block_stamina_limb_ratio_override
/// Stamina dealt directly via adjustStaminaLoss() per SECOND of block.
var/block_stamina_cost_per_second = 1.5
@@ -90,6 +92,7 @@ GLOBAL_LIST_EMPTY(block_parry_data)
var/datum/block_parry_data/block_parry_data
/obj/item/Initialize(mapload)
block_parry_data = get_block_parry_data(/datum/block_parry_data)
return ..()