Partial dodge and limb shielding/deflection (#89470)

Co-authored-by: Maya Granade <kevin.granade@gmail.com>
Co-authored-by: Thelis Stambolliu <110344314+FarFarLakeSea@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Tektolnes
2026-11-17 15:10:30 -05:00
committed by GitHub
parent 7d2228f85a
commit 3015a27a34
15 changed files with 538 additions and 284 deletions
+3 -3
View File
@@ -171,7 +171,7 @@
"cold_morale_mod": 2,
"fire_warmth_bonus": 150,
"squeamish_penalty": 7,
"base_hp": 60,
"base_hp": 30,
"drench_capacity": 700,
"smash_message": "You smash the %s with a firm headbutt.",
"techniques": [ "tech_base_headbutt" ],
@@ -232,7 +232,7 @@
"legacy_id": "EYES",
"//": "Shouldn't happen, but consistency is nice",
"squeamish_penalty": 8,
"base_hp": 60,
"base_hp": 30,
"drench_capacity": 100,
"flags": [ "IGNORE_TEMP", "LIMB_UPPER" ],
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
@@ -270,7 +270,7 @@
"hot_morale_mod": 2,
"cold_morale_mod": 2,
"squeamish_penalty": 9,
"base_hp": 60,
"base_hp": 30,
"drench_capacity": 100,
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
"smash_efficiency": 0.25,
+3 -3
View File
@@ -1004,7 +1004,7 @@
"fire_warmth_bonus": 0,
"squeamish_penalty": 0,
"pain_mod": 0.0,
"base_hp": 150,
"base_hp": 75,
"drench_capacity": 200,
"smash_message": "You smash the %s with a firm headbutt.",
"techniques": [ "tech_base_headbutt" ],
@@ -1077,7 +1077,7 @@
"side": "both",
"squeamish_penalty": 0,
"pain_mod": 0.0,
"base_hp": 150,
"base_hp": 75,
"drench_capacity": 30,
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
"smash_efficiency": 0.25,
@@ -1122,7 +1122,7 @@
"cold_morale_mod": 0,
"squeamish_penalty": 0,
"pain_mod": 0.0,
"base_hp": 150,
"base_hp": 75,
"drench_capacity": 30,
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
"smash_efficiency": 0.25,
+8 -8
View File
@@ -22,7 +22,7 @@
"encumbrance_limit": 75,
"//2": "Squeamish is because your head is mostly eye. Yuck!!",
"squeamish_penalty": 30,
"base_hp": 50,
"base_hp": 25,
"ugliness": 10,
"drench_capacity": 700,
"ugliness_mandatory": 6,
@@ -104,7 +104,7 @@
"cold_morale_mod": 2.0,
"fire_warmth_bonus": 0,
"squeamish_penalty": 0,
"base_hp": 60,
"base_hp": 30,
"drench_capacity": 3000,
"smash_message": "You smash the %s with a firm headbutt.",
"techniques": [ "tech_base_headbutt" ],
@@ -319,7 +319,7 @@
"limb_types": "sensor",
"side": "both",
"squeamish_penalty": 0,
"base_hp": 60,
"base_hp": 30,
"drench_capacity": 500,
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
"smash_efficiency": 0.25,
@@ -365,7 +365,7 @@
"limb_scores": [ [ "breathing", 0.9 ], [ "manip", 0.05, 0.2 ], [ "consume_liquid", 1.0 ], [ "consume_solid", 1.5 ] ],
"side": "both",
"similar_bodypart": "muzzle",
"base_hp": 75,
"base_hp": 35,
"bionic_slots": 4,
"flags": [ "LIMB_UPPER" ],
"sub_parts": [ "muzzle_bear_lips", "muzzle_bear_nose", "muzzle_bear_cheeks", "muzzle_bear_chin" ],
@@ -387,7 +387,7 @@
"limb_scores": [ [ "breathing", 1.0 ], [ "manip", 0.05, 0.2 ], [ "consume_liquid", 1.1 ], [ "consume_solid", 1.2 ] ],
"side": "both",
"similar_bodypart": "muzzle",
"base_hp": 65,
"base_hp": 30,
"bionic_slots": 4,
"flags": [ "LIMB_UPPER" ],
"sub_parts": [ "muzzle_lupine_lips", "muzzle_lupine_nose", "muzzle_lupine_cheeks", "muzzle_lupine_chin" ],
@@ -409,7 +409,7 @@
"limb_scores": [ [ "breathing", 0.8 ], [ "manip", 0.05, 0.2 ], [ "consume_liquid", 1.3 ], [ "consume_solid", 2.0 ] ],
"side": "both",
"similar_bodypart": "muzzle",
"base_hp": 75,
"base_hp": 35,
"bionic_slots": 3,
"flags": [ "LIMB_UPPER" ],
"sub_parts": [ "muzzle_long_lips", "muzzle_long_nostrils", "muzzle_long_cheeks", "muzzle_long_chin" ],
@@ -431,7 +431,7 @@
"limb_scores": [ [ "breathing", 0.95 ], [ "manip", 0.05, 0.2 ], [ "consume_liquid", 1.1 ], [ "consume_solid", 1.25 ] ],
"side": "both",
"similar_bodypart": "muzzle",
"base_hp": 75,
"base_hp": 35,
"bionic_slots": 3,
"flags": [ "LIMB_UPPER" ],
"sub_parts": [ "muzzle_rodent_lips", "muzzle_rodent_nose", "muzzle_rodent_cheeks", "muzzle_rodent_chin" ],
@@ -584,7 +584,7 @@
"hot_morale_mod": 2,
"cold_morale_mod": 2,
"squeamish_penalty": 0,
"base_hp": 60,
"base_hp": 30,
"drench_capacity": 500,
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
"smash_efficiency": 0.25,
+169 -169
View File
@@ -2,184 +2,184 @@
{
"type": "test_data",
"//": "battleaxes",
"expected_dps": { "lc_battleaxe": 25.88, "mc_battleaxe": 28.47, "hc_battleaxe": 29.72, "ch_battleaxe": 30.49, "qt_battleaxe": 31.37 }
"expected_dps": { "lc_battleaxe": 22.76, "mc_battleaxe": 25.2, "hc_battleaxe": 26.43, "ch_battleaxe": 27.08, "qt_battleaxe": 27.79 }
},
{
"type": "test_data",
"//": "mace-like weapons",
"expected_dps": { "hc_mace": 24.89, "ch_mace": 25.38, "morningstar": 26.12, "qt_mace": 28.33 }
"expected_dps": { "hc_mace": 22.78, "ch_mace": 23.22, "morningstar": 23.73, "qt_mace": 26.32 }
},
{
"type": "test_data",
"expected_dps": { "bio_claws_weapon": 16.5, "bagh_nakha": 14.0 }
"expected_dps": { "bio_claws_weapon": 14.26, "bagh_nakha": 12.74 }
},
{
"type": "test_data",
"//": "Integrated weapons, bionics, etc",
"expected_dps": { "integrated_vampire_fangs": 10.69 }
"expected_dps": { "integrated_vampire_fangs": 9.51 }
},
{
"type": "test_data",
"//": "Uncategorized improvised weapons",
"expected_dps": {
"shock_epee": 8.6,
"shock_epee": 8.01,
"shock_sabre": 7.4,
"pointy_stick_long": 5.83,
"pointy_stick": 5.89,
"fencing_sabre_sharpened": 8.03,
"sharpened_pipe": 8.8,
"fencing_epee_sharpened": 9.17
"pointy_stick_long": 4.94,
"pointy_stick": 4.99,
"fencing_sabre_sharpened": 7.47,
"sharpened_pipe": 7.82,
"fencing_epee_sharpened": 8.54
}
},
{
"type": "test_data",
"//": "Just junk items",
"expected_dps": {
"rock_sock": 5.63,
"2x4": 5.66,
"nailboard": 5.83,
"guitar_electric": 6.3,
"steel_chunk": 6.59,
"torch": 5.4,
"pipe": 8.09,
"makeshift_crowbar": 8.26,
"stick": 9.04,
"chain": 4.53
"rock_sock": 4.78,
"2x4": 4.77,
"nailboard": 4.89,
"guitar_electric": 5.52,
"steel_chunk": 5.61,
"torch": 4.45,
"pipe": 7.42,
"makeshift_crowbar": 7.51,
"stick": 7.79,
"chain": 3.79
}
},
{
"type": "test_data",
"//": "one handed knives culminating in bio blade",
"expected_dps": {
"pockknife": 5.51,
"knife_small": 5.86,
"diveknife": 8.0,
"knife_folding": 8.67,
"knife_hunting": 8.83,
"knife_huge": 10,
"switchblade": 11.7,
"knife_combat": 16.489,
"knife_combat_marine": 17.02,
"knife_rm42": 17.58,
"kukri": 18.38,
"hc_kukri": 19.35,
"ch_kukri": 20.23,
"qt_kukri": 21.42,
"bio_blade_weapon": 24.5
"pockknife": 4.48,
"knife_small": 5.15,
"diveknife": 7.25,
"knife_folding": 7.58,
"knife_hunting": 7.8,
"knife_huge": 9.12,
"switchblade": 10.46,
"knife_combat": 14.95,
"knife_combat_marine": 14.95,
"knife_rm42": 16.22,
"kukri": 16.5,
"hc_kukri": 17.41,
"ch_kukri": 18.36,
"qt_kukri": 19.39,
"bio_blade_weapon": 21.74
}
},
{
"type": "test_data",
"//": "polearms",
"expected_dps": {
"pike": 23.0,
"ch_pike": 25.67,
"qt_pike": 27.38,
"makeshift_scythe_war": 24.5,
"bill_hook": 32.4,
"spear_dory": 28.0,
"naginata_machete_temp": 28.6,
"qiang": 30.68,
"lucern_hammer": 31.5,
"glaive": 33.12,
"naginata": 33.97,
"poleaxe": 34.5,
"scythe_war": 34.59,
"ji": 35.82,
"halberd": 36.28
"pike": 20.62,
"ch_pike": 22.83,
"qt_pike": 24.43,
"makeshift_scythe_war": 21.51,
"bill_hook": 28.53,
"spear_dory": 24.73,
"naginata_machete_temp": 25.58,
"qiang": 27.57,
"lucern_hammer": 28.11,
"glaive": 29.85,
"naginata": 30.7,
"poleaxe": 31.19,
"scythe_war": 31.13,
"ji": 32.6,
"halberd": 32.9
}
},
{
"type": "test_data",
"//": "small swords",
"expected_dps": {
"survivor_machete_qt": 22.6,
"sword_cane": 20.34,
"butterfly_swords": 29.74,
"hc_scimitar": 24.0,
"cavalry_sabre": 24.2,
"mc_cavalry_sabre": 24.233,
"khopesh": 24.26,
"hc_khopesh": 26.33,
"ch_khopesh": 27.36,
"qt_khopesh": 28.3,
"hc_wakizashi": 24.6,
"ch_scimitar": 25.0,
"ch_cutlass": 25.4,
"qt_cutlass": 26.3,
"hc_cavalry_sabre": 26.5,
"ch_wakizashi": 26.64,
"qt_scimitar": 27.0,
"qt_wakizashi": 27.68,
"ch_cavalry_sabre": 27.7,
"ch_rapier": 28.3,
"qt_cavalry_sabre": 28.7,
"qt_rapier": 30.5
"survivor_machete_qt": 20.91,
"sword_cane": 19.0,
"butterfly_swords": 26.48,
"hc_scimitar": 21.48,
"cavalry_sabre": 22.64,
"mc_cavalry_sabre": 22.64,
"khopesh": 21.69,
"hc_khopesh": 23.55,
"ch_khopesh": 24.45,
"qt_khopesh": 25.34,
"hc_wakizashi": 23.06,
"ch_scimitar": 22.34,
"ch_cutlass": 22.66,
"qt_cutlass": 23.58,
"hc_cavalry_sabre": 24.86,
"ch_wakizashi": 24.96,
"qt_scimitar": 24.1,
"qt_wakizashi": 25.99,
"ch_cavalry_sabre": 25.97,
"ch_rapier": 26.74,
"qt_cavalry_sabre": 26.96,
"qt_rapier": 28.8
}
},
{
"type": "test_data",
"//": "spears",
"expected_dps": {
"javelin": 6.11,
"sharp_rebar": 10.73,
"spear_wood_simple": 11.44,
"javelin_iron": 12.3,
"spear_stone": 20.8,
"qt_aztec_spear": 23.5,
"spear_knife_proper": 20.21,
"art_trident": 25.5,
"spear_copper": 26.7,
"string_dimension_partigiana_ixwa": 28.71,
"spear_bronze": 28.83,
"spear_steel": 30.58,
"lc_spear_steel": 28.45,
"hc_spear_steel": 31.95,
"ch_spear_steel": 34.13,
"qt_spear_steel": 36.61,
"art_spear": 30.7
"javelin": 5.33,
"sharp_rebar": 9.21,
"spear_wood_simple": 10.18,
"javelin_iron": 10.86,
"spear_stone": 18.5,
"qt_aztec_spear": 20.95,
"spear_knife_proper": 17.97,
"art_trident": 22.84,
"spear_copper": 24.1,
"string_dimension_partigiana_ixwa": 25.9,
"spear_bronze": 25.64,
"spear_steel": 27.38,
"lc_spear_steel": 25.32,
"hc_spear_steel": 28.51,
"ch_spear_steel": 30.59,
"qt_spear_steel": 32.81,
"art_spear": 27.38
}
},
{
"type": "test_data",
"//": "staffs",
"expected_dps": {
"pool_cue": 7.76,
"lc_steel_staff": 20.79,
"mc_steel_staff": 21.54,
"hc_steel_staff": 21.95,
"ch_steel_staff": 22.3,
"qt_steel_staff": 22.87
"pool_cue": 6.7,
"lc_steel_staff": 19.76,
"mc_steel_staff": 20.43,
"hc_steel_staff": 20.83,
"ch_steel_staff": 21.22,
"qt_steel_staff": 21.75
}
},
{
"type": "test_data",
"//": "bigger swords",
"expected_dps": {
"arming_sword_inferior": 24.156,
"hc_talwar": 24.6,
"arming_sword": 24.6,
"broadsword": 24.605,
"mc_arming_sword": 24.648,
"jian": 25.2,
"mc_jian": 25.208,
"ch_talwar": 25.3,
"rapier": 25.302,
"hc_broadsword": 25.47,
"mc_kilij": 25.5,
"qt_talwar": 26.1,
"hc_arming_sword": 26.5,
"hc_kilij": 27.1,
"hc_jian": 27.3,
"hc_rapier": 27.4,
"ch_broadsword": 27.5,
"ch_arming_sword": 27.6,
"ch_kilij": 27.9,
"ch_jian": 28.3,
"qt_broadsword": 28.5,
"qt_kilij": 28.6,
"qt_arming_sword": 29.7,
"qt_jian": 30.8
"arming_sword_inferior": 21.77,
"hc_talwar": 22.9,
"arming_sword": 22.21,
"broadsword": 22.1,
"mc_arming_sword": 22.21,
"jian": 22.8,
"mc_jian": 22.8,
"ch_talwar": 23.63,
"rapier": 23.75,
"hc_broadsword": 22.98,
"mc_kilij": 23.9,
"qt_talwar": 24.42,
"hc_arming_sword": 23.99,
"hc_kilij": 25.44,
"hc_jian": 24.68,
"hc_rapier": 25.74,
"ch_broadsword": 24.82,
"ch_arming_sword": 24.91,
"ch_kilij": 26.18,
"ch_jian": 25.7,
"qt_broadsword": 25.81,
"qt_kilij": 26.83,
"qt_arming_sword": 26.79,
"qt_jian": 27.82
}
},
{
@@ -190,13 +190,13 @@
"test_clumsy_sword": 35.5,
"test_normal_sword": 46.66,
"test_balanced_sword": 56.85,
"mjolnir": 1935.9
"mjolnir": 1869.95
}
},
{
"type": "test_data",
"//": "Conventional tools",
"expected_dps": { "heavy_flashlight": 5.66, "crutches": 13.49, "digging_stick": 5.58 }
"expected_dps": { "heavy_flashlight": 4.65, "crutches": 11.92, "digging_stick": 4.67 }
},
{
"type": "test_data",
@@ -216,73 +216,73 @@
{
"type": "test_data",
"//": "Axe like tools/weapons",
"expected_dps": { "battleaxe": 28.47, "fire_ax": 21.2, "ax": 20.25, "brush_axe": 19.3 }
"expected_dps": { "battleaxe": 25.2, "fire_ax": 18.55, "ax": 17.4, "brush_axe": 16.88 }
},
{
"type": "test_data",
"//": "misc bludegeons",
"expected_dps": {
"club_wooden_large": 6.55,
"stick_long": 8.0,
"halligan": 14.7,
"exodii_prybar": 15.9,
"exodii_digger": 12.9,
"pulverizer": 18.11,
"hammer_sledge": 20.0,
"2h_club_kanabo_studded": 25.16,
"2h_club_kanabo_spiked": 25.65,
"warhammer": 35.64,
"lc_warhammer": 30.6,
"hc_warhammer": 35.95,
"ch_warhammer": 36.66,
"qt_warhammer": 37.1
"club_wooden_large": 5.63,
"stick_long": 6.89,
"halligan": 13.23,
"exodii_prybar": 14.26,
"exodii_digger": 11.58,
"pulverizer": 16.72,
"hammer_sledge": 18.55,
"2h_club_kanabo_studded": 23.47,
"2h_club_kanabo_spiked": 23.73,
"warhammer": 32.13,
"lc_warhammer": 26.96,
"hc_warhammer": 32.57,
"ch_warhammer": 33.15,
"qt_warhammer": 33.64
}
},
{
"type": "test_data",
"//": "flails",
"expected_dps": { "2h_flail_steel": 21.0, "2h_flail_wood": 20.4 }
"expected_dps": { "2h_flail_steel": 19.02, "2h_flail_wood": 18.44 }
},
{
"type": "test_data",
"//": "high quality swords",
"expected_dps": {
"katana": 26.0,
"mc_katana": 26.005,
"art_sword": 26.3,
"longsword": 26.3,
"mc_longsword": 26.329,
"estoc": 26.4,
"mc_estoc": 26.377,
"hc_longsword": 27.0,
"zweihander": 27.5,
"mc_zweihander": 27.512,
"mc_nodachi": 27.598,
"nodachi": 27.6,
"hc_katana": 28.0,
"hc_zweihander": 28.2,
"kriegsmesser": 28.2,
"mc_kriegsmesser": 28.2,
"ch_longsword": 28.6,
"hc_kriegsmesser": 28.9,
"hc_nodachi": 28.9,
"ch_katana": 29.0,
"hc_estoc": 29.5,
"ch_zweihander": 29.7,
"qt_katana": 29.8,
"ch_estoc": 30.2,
"qt_longsword": 30.2,
"ch_kriegsmesser": 30.4,
"ch_nodachi": 31.0,
"qt_zweihander": 31.4,
"qt_kriegsmesser": 31.9,
"qt_estoc": 32.4,
"qt_nodachi": 32.4
"katana": 24.38,
"mc_katana": 24.38,
"art_sword": 24.7,
"longsword": 24.7,
"mc_longsword": 24.7,
"estoc": 23.66,
"mc_estoc": 23.66,
"hc_longsword": 25.41,
"zweihander": 24.93,
"mc_zweihander": 24.93,
"mc_nodachi": 26.04,
"nodachi": 26.04,
"hc_katana": 26.23,
"hc_zweihander": 25.6,
"kriegsmesser": 24.99,
"mc_kriegsmesser": 24.99,
"ch_longsword": 26.91,
"hc_kriegsmesser": 25.75,
"hc_nodachi": 27.37,
"ch_katana": 27.21,
"hc_estoc": 26.55,
"ch_zweihander": 27.04,
"qt_katana": 28.05,
"ch_estoc": 27.21,
"qt_longsword": 28.49,
"ch_kriegsmesser": 27.12,
"ch_nodachi": 29.4,
"qt_zweihander": 28.61,
"qt_kriegsmesser": 28.54,
"qt_estoc": 29.29,
"qt_nodachi": 30.69
}
},
{
"type": "test_data",
"//": "'Unarmed' weapons",
"expected_dps": { "xl_knuckle_brass": 6.08, "knuckle_brass": 6.39, "xs_knuckle_brass": 6.86 }
"expected_dps": { "xl_knuckle_brass": 5.11, "knuckle_brass": 5.37, "xs_knuckle_brass": 5.76 }
}
]
+65 -5
View File
@@ -168,7 +168,8 @@
"armor": { "electric": 1 }
},
{
"id": "mon_test_zombie_only_fire",
"id": "mon_test_zombie_no_fire_resist",
"//": "IMMOBILE so that melee tests aren't flakey from partial dodge",
"type": "MONSTER",
"name": { "str": "zombie" },
"description": "A human body, swaying as it moves, an unstoppable rage visible in its oily black eyes.",
@@ -198,27 +199,86 @@
"burn_into": "mon_zombie_scorched",
"fungalize_into": "mon_zombie_fungus",
"upgrades": { "half_life": 120, "into_group": "GROUP_ZOMBIE_UPGRADE" },
"flags": [ "SEES", "HEARS", "STUMBLES", "WARM", "BASHES", "GROUP_BASH", "POISON", "NO_BREATHE", "REVIVES", "PUSH_MON", "FILTHY" ],
"flags": [
"SEES",
"HEARS",
"STUMBLES",
"WARM",
"BASHES",
"GROUP_BASH",
"POISON",
"NO_BREATHE",
"REVIVES",
"PUSH_MON",
"FILTHY",
"IMMOBILE"
],
"armor": { "electric": 1 }
},
{
"id": "mon_test_zombie_only_fire",
"//": "IMMOBILE so that melee_test isn't flakey from partial dodge",
"type": "MONSTER",
"name": { "str": "zombie" },
"description": "A human body, swaying as it moves, an unstoppable rage visible in its oily black eyes.",
"default_faction": "zombie",
"bodytype": "human",
"categories": [ "CLASSIC" ],
"species": [ "ZOMBIE", "HUMAN" ],
"volume": "62500 ml",
"weight": "81500 g",
"hp": 80,
"speed": 70,
"material": [ "flesh" ],
"symbol": "Z",
"color": "light_green",
"aggression": 100,
"morale": 100,
"melee_skill": 4,
"melee_dice": 2,
"melee_dice_sides": 3,
"melee_damage": [ { "damage_type": "cut", "amount": 0 } ],
"vision_night": 3,
"families": [ "prof_gross_anatomy", "prof_intro_biology", "prof_wp_zombie" ],
"harvest": "zombie_humanoid",
"special_attacks": [ { "id": "bite_humanoid", "cooldown": 5 }, { "id": "grab", "cooldown": 7 }, [ "scratch", 20 ] ],
"death_drops": "default_zombie_death_drops",
"burn_into": "mon_zombie_scorched",
"fungalize_into": "mon_zombie_fungus",
"flags": [
"SEES",
"HEARS",
"STUMBLES",
"WARM",
"BASHES",
"GROUP_BASH",
"POISON",
"NO_BREATHE",
"REVIVES",
"PUSH_MON",
"FILTHY",
"IMMOBILE"
],
"armor": { "bash": 10000 }
},
{
"type": "MONSTER",
"id": "mon_test_fire_resist",
"copy-from": "mon_test_zombie",
"copy-from": "mon_test_zombie_no_fire_resist",
"name": { "str": "zombie" },
"armor": { "electric": 1, "test_fire": 5 }
},
{
"type": "MONSTER",
"id": "mon_test_fire_vresist",
"copy-from": "mon_test_zombie",
"copy-from": "mon_test_zombie_no_fire_resist",
"name": { "str": "zombie" },
"armor": { "electric": 1, "test_fire": 50 }
},
{
"type": "MONSTER",
"id": "mon_test_fire_immune",
"copy-from": "mon_test_zombie",
"copy-from": "mon_test_zombie_no_fire_resist",
"name": { "str": "zombie" },
"extend": { "flags": [ "FIREPROOF" ] }
},
+146 -1
View File
@@ -147,6 +147,9 @@ static const json_character_flag json_flag_SUPPRESS_INVISIBILITY( "SUPPRESS_INVI
static const json_character_flag json_flag_TEEPSHIELD( "TEEPSHIELD" );
static const json_character_flag json_flag_TRUE_SEEING( "TRUE_SEEING" );
static const limb_score_id limb_score_block( "block" );
static const limb_score_id limb_score_reaction( "reaction" );
static const material_id material_cotton( "cotton" );
static const material_id material_flesh( "flesh" );
static const material_id material_iflesh( "iflesh" );
@@ -159,6 +162,8 @@ static const material_id material_veggy( "veggy" );
static const material_id material_wood( "wood" );
static const material_id material_wool( "wool" );
static const skill_id skill_melee( "melee" );
static const species_id species_ROBOT( "ROBOT" );
static const trait_id trait_DEBUG_CLOAK( "DEBUG_CLOAK" );
@@ -1046,6 +1051,53 @@ float Creature::get_crit_factor( const bodypart_id &bp ) const
return crit_mod;
}
// Margins that can be tuned to affect how partial dodge works.
// Below melee_miss_threshold is a total miss,
// above melee_full_force_threshold is a square hit
static constexpr int melee_miss_threshold = 25;
static constexpr int melee_full_force_threshold = 25;
float Creature::melee_damage_mult( int hit_spread )
{
return std::clamp( static_cast<float>( hit_spread + melee_miss_threshold ) /
static_cast<float>( melee_miss_threshold + melee_full_force_threshold ), 0.0f, 1.0f );
}
static constexpr float melee_glancing_below = 0.4f;
static constexpr float melee_solid_above = 0.9f;
melee_hit_quality Creature::melee_hit_quality_of( int hit_spread )
{
const float mult = melee_damage_mult( hit_spread );
if( mult < melee_glancing_below ) {
return melee_hit_quality::glancing;
} else if( mult <= melee_solid_above ) {
return melee_hit_quality::good;
} else {
return melee_hit_quality::solid;
}
}
// check and set message def for how hard the hit is
std::string Creature::hit_quality_label( int hit_spread )
{
switch( Creature::melee_hit_quality_of( hit_spread ) ) {
case melee_hit_quality::glancing:
return _( "A glancing hit." );
case melee_hit_quality::good:
return _( "A good hit." );
case melee_hit_quality::solid:
return _( "A solid hit!" );
default:
return _( "A good hit." );
}
}
bool Creature::melee_attack_hit( int hit_spread )
{
return melee_damage_mult( hit_spread ) > 0.0f;
}
int Creature::deal_melee_attack( Creature *source, int hitroll )
{
@@ -1076,6 +1128,89 @@ int Creature::deal_melee_attack( Creature *source, int hitroll )
return hit_spread;
}
// max chance to deflect a head/torso hit
static constexpr float melee_deflection_cap = 0.9f;
// fraction of cap that the worst defender in the world can get
static constexpr float melee_deflection_base = 0.3f;
// "max" value of a very good dodger i.e. 10 dex/10 dodge (dexterity/2+dodge) from get_dodge_base
static constexpr float melee_deflection_full_dodge = 15.0f;
// When a hit isn't dodged, and isn't blocked. Head hits deflect to torso or arm, torso to arm or leg, account for attacker height
bodypart_id Creature::deflect_hit_part( const bodypart_id &bp, bool can_attack_high ) const
{
const Character *ch = as_character();
if( ch == nullptr ) {
return bp;
}
// likely needs additional work to accomodate irregular mutant anatomy that can cover vital areas, but should cover most situations
std::vector<bp_type> destinations;
if( bp->has_type( bp_type::torso ) ) {
destinations = { bp_type::arm, bp_type::leg };
} else if( bp->has_type( bp_type::head ) || bp->has_type( bp_type::sensor ) ||
bp->has_type( bp_type::mouth ) ) {
destinations = { bp_type::torso, bp_type::arm };
} else {
return bp;
}
// Parts that can be used to coverup/deflect to
std::vector<std::pair<bodypart_id, float>> candidates;
float usable = 0.0f;
int eligible = 0;
for( const bp_type type : destinations ) {
for( const bodypart_id &part : get_all_body_parts_of_type( type,
get_body_part_flags::only_main ) ) {
if( !can_attack_high && part->has_flag( json_flag_LIMB_UPPER ) ) {
continue;
}
++eligible;
if( get_part_hp_cur( part ) <= 0 ) {
continue;
}
// Torso always eligible as a deflection desitnation
float score;
if( part->has_type( bp_type::torso ) ) {
score = 1.0f;
} else {
score = std::clamp( get_part( part )->get_limb_score( *this, limb_score_block ), 0.0f, 1.0f );
}
if( score <= 0.0f ) {
continue;
}
candidates.emplace_back( part, score );
usable += score;
}
}
if( candidates.empty() || eligible == 0 ) {
return bp;
}
// Fraction of limbs that can be deflected to/cover with that remains, where 1 is all
const float deflection_capability = usable / eligible;
// Dodge and block readiness. Dodge is 0 when defender can't dodge. Block is same as block_hit
const float dodge_ready = std::clamp( get_dodge() / melee_deflection_full_dodge, 0.0f, 1.0f );
const float block_ready = std::clamp( 0.2f * ch->get_skill_level( skill_melee ) *
ch->get_limb_score( limb_score_reaction ), 0.0f, 1.0f );
const float readiness = 0.5f * ( dodge_ready + block_ready );
const float chance = melee_deflection_cap * ( melee_deflection_base +
( 1.0f - melee_deflection_base ) * readiness ) * deflection_capability;
if( rng_float( 0.0f, 1.0f ) >= chance ) {
return bp;
}
// pick deflection destination, if deflected
float roll = rng_float( 0.0f, usable );
for( const std::pair<bodypart_id, float> &c : candidates ) {
roll -= c.second;
if( roll <= 0.0f ) {
return c.first;
}
}
return candidates.back().first;
}
void Creature::deal_melee_hit( Creature *source, int hit_spread, bool critical_hit,
damage_instance dam, dealt_damage_instance &dealt_dam,
const weakpoint_attack &attack, const bodypart_id *bp )
@@ -1102,9 +1237,19 @@ void Creature::deal_melee_hit( Creature *source, int hit_spread, bool critical_h
}
}
damage_instance d = dam; // copy, since we will mutate in block_hit
d.mult_damage( melee_damage_mult( hit_spread ), true ); // partial dodge
bodypart_id bp_hit = bp == nullptr ? select_body_part( -1, -1, source->can_attack_high(),
hit_spread ) : *bp;
block_hit( source, bp_hit, d );
const bool blocked = block_hit( source, bp_hit, d );
if( !blocked ) {
const bodypart_id initial_bp = bp_hit;
bp_hit = deflect_hit_part( bp_hit, source->can_attack_high() );
if( bp_hit != initial_bp ) {
add_msg_player_or_npc( m_good, _( "You use your %1$s to shield your %2$s!" ),
_( "<npcname> uses their %1$s to shield their %2$s!" ), body_part_name( bp_hit ),
body_part_name( initial_bp ) );
}
}
weakpoint_attack attack_copy = attack;
attack_copy.is_crit = critical_hit;
+14
View File
@@ -254,6 +254,8 @@ using terminating_effect = struct terminating_effect_t {
bodypart_id bp;
};
enum class melee_hit_quality { glancing, good, solid };
class Creature : public viewer
{
public:
@@ -467,6 +469,18 @@ class Creature : public viewer
// returns hit - dodge (>=0 = hit, <0 = miss)
virtual int deal_melee_attack( Creature *source, int hitroll );
// damage multiplier represnting partial dodge (hitroll-dodge).
// 0=complete miss, 1=square hit
static float melee_damage_mult( int hit_spread );
static bool melee_attack_hit( int hit_spread );
// For messaging after partial dodge
static melee_hit_quality melee_hit_quality_of( int hit_spread );
static std::string hit_quality_label( int hit_spread );
// For deflections
bodypart_id deflect_hit_part( const bodypart_id &bp, bool can_attack_high ) const;
// Distance == 1 and on the same z-level or with a clear shot up/down.
// If allow_zlev is false, don't allow attacking up/down at all.
// If allow_zlev is true, also allow distance == 1 and on different z-level
+64 -44
View File
@@ -422,9 +422,63 @@ double item::effective_dps( const Character &guy, Creature &mon ) const
100.0f );
float mon_defense = mon_dodge + mon.size_melee_penalty() / 5.0f;
constexpr double hit_trials = 10000.0;
const int rng_mean = std::max( std::min( static_cast<int>( base_hit - mon_defense ), 20 ),
-20 ) + 20;
double num_all_hits = hits_by_accuracy[ rng_mean ];
// (hit - dodge), then all of the effects of partial dodge
const int mean_spread = static_cast<int>( base_hit - mon_defense );
const auto hit_table = [&]( int mean ) {
return hits_by_accuracy[ std::max( std::min( mean, 20 ), -20 ) + 20 ];
};
constexpr int miss_threshold = 5;
constexpr int full_force_threshold =
5;
constexpr int mult_range = miss_threshold + full_force_threshold;
double num_all_hits = hit_table( mean_spread + miss_threshold );
// keep track of multipliers in a way that armor can be appropriately subtracted along the window of damage multiplied by accuracy/partial dodge
std::array < double, mult_range + 1 > bucket_hits{}; // how many hits
std::array < double, mult_range + 1 > bucket_mults{}; // damage mutlipliers
// grazing/partial damage hits
for( int i = 0; i < mult_range; i++ ) {
const int t = i - miss_threshold;
bucket_hits[i] = hit_table( mean_spread - t ) - hit_table( mean_spread - t - 1 );
bucket_mults[i] = ( i + 0.5 ) / mult_range;
}
// full damage hits
bucket_hits[mult_range] = hit_table( mean_spread - full_force_threshold );
bucket_mults[mult_range] = 1.0;
// helper to appropriately scale damage in calc_effective_damage, below
// TODO: Modify DPS calculation to consider weakpoints.
const auto mean_hit_damage = [&]( const damage_instance & base, Creature & mon,
const bodypart_id & bp ) {
if( num_all_hits <= 0 ) {
return 0.0;
}
double subtotal_damage = 0.0;
resistances r = resistances( *static_cast<monster *>( &mon ) );
for( int i = 0; i <= mult_range; i++ ) {
if( bucket_hits[i] <= 0 ) {
continue;
}
damage_instance dealt_damage = base;
dealt_damage.mult_damage( bucket_mults[i], true );
for( damage_unit &dmg_unit : dealt_damage.damage_units ) {
dmg_unit.amount -= std::min( r.get_effective_resist( dmg_unit ), dmg_unit.amount );
}
dealt_damage_instance dealt_dams;
for( const damage_unit &dmg_unit : dealt_damage.damage_units ) {
int cur_damage = 0;
int total_pain = 0;
mon.deal_damage_handle_type( effect_source::empty(), dmg_unit, bp, cur_damage, total_pain );
if( cur_damage > 0 ) {
dealt_dams.dealt_dams[dmg_unit.type] += cur_damage;
}
}
subtotal_damage += bucket_hits[i] * dealt_dams.total_damage();
}
return subtotal_damage / num_all_hits;
};
/* critical hits have two chances to occur: triple critical hits happen much less frequently,
* and double critical hits can only occur if a hit roll is more than 1.5 * monster dodge.
* Not the hit roll used to determine the attack, another one.
@@ -447,63 +501,28 @@ double item::effective_dps( const Character &guy, Creature &mon ) const
num_all_hits );
// critical hits are counted separately
double num_hits = num_all_hits - num_crits;
// sum average damage past armor and return the number of moves required to achieve
// that damage
const auto calc_effective_damage = [ &, moves_per_attack]( const double num_strikes,
const auto calc_effective_damage = [ &, moves_per_attack ]( const double num_strikes,
const bool crit, const Character & guy, Creature & mon ) {
bodypart_id bp = bodypart_id( "torso" );
Creature *temp_mon = &mon;
double subtotal_damage = 0;
damage_instance base_damage;
guy.roll_all_damage( crit, base_damage, true, *this, attack_vector_id::NULL_ID(),
sub_bodypart_str_id::NULL_ID(), &mon, bp );
damage_instance dealt_damage = base_damage;
dealt_damage = guy.modify_damage_dealt_with_enchantments( dealt_damage );
// TODO: Modify DPS calculation to consider weakpoints.
resistances r = resistances( *static_cast<monster *>( temp_mon ) );
for( damage_unit &dmg_unit : dealt_damage.damage_units ) {
dmg_unit.amount -= std::min( r.get_effective_resist( dmg_unit ), dmg_unit.amount );
}
dealt_damage_instance dealt_dams;
for( const damage_unit &dmg_unit : dealt_damage.damage_units ) {
int cur_damage = 0;
int total_pain = 0;
temp_mon->deal_damage_handle_type( effect_source::empty(), dmg_unit, bp,
cur_damage, total_pain );
if( cur_damage > 0 ) {
dealt_dams.dealt_dams[dmg_unit.type] += cur_damage;
}
}
double damage_per_hit = dealt_dams.total_damage();
subtotal_damage = damage_per_hit * num_strikes;
const double damage_per_hit = mean_hit_damage( dealt_damage, mon, bp );
double subtotal_damage = damage_per_hit * num_strikes;
double subtotal_moves = moves_per_attack * num_strikes;
if( has_technique( RAPID ) ) {
Creature *temp_rs_mon = &mon;
damage_instance rs_base_damage;
guy.roll_all_damage( crit, rs_base_damage, true, *this, attack_vector_id::NULL_ID(),
sub_bodypart_str_id::NULL_ID(), &mon, bp );
damage_instance dealt_rs_damage = rs_base_damage;
for( damage_unit &dmg_unit : dealt_rs_damage.damage_units ) {
for( damage_unit &dmg_unit : rs_base_damage.damage_units ) {
dmg_unit.damage_multiplier *= 0.66;
}
// TODO: Modify DPS calculation to consider weakpoints.
resistances rs_r = resistances( *static_cast<monster *>( temp_rs_mon ) );
for( damage_unit &dmg_unit : dealt_rs_damage.damage_units ) {
dmg_unit.amount -= std::min( rs_r.get_effective_resist( dmg_unit ), dmg_unit.amount );
}
dealt_damage_instance rs_dealt_dams;
for( const damage_unit &dmg_unit : dealt_rs_damage.damage_units ) {
int cur_damage = 0;
int total_pain = 0;
temp_rs_mon->deal_damage_handle_type( effect_source::empty(), dmg_unit, bp,
cur_damage, total_pain );
if( cur_damage > 0 ) {
rs_dealt_dams.dealt_dams[dmg_unit.type] += cur_damage;
}
}
double rs_damage_per_hit = rs_dealt_dams.total_damage();
const double rs_damage_per_hit = mean_hit_damage( rs_base_damage, mon, bp );
subtotal_moves *= 0.5;
subtotal_damage *= 0.5;
subtotal_moves += moves_per_attack * num_strikes * 0.33;
@@ -511,6 +530,7 @@ double item::effective_dps( const Character &guy, Creature &mon ) const
}
return std::make_pair( subtotal_moves, subtotal_damage );
};
std::pair<double, double> crit_summary = calc_effective_damage( num_crits, true, guy, mon );
total_moves += crit_summary.first;
total_damage += crit_summary.second;
+6 -1
View File
@@ -910,7 +910,7 @@ bool melee_actor::call( monster &z ) const
}
if( dodgeable ) {
if( hitspread < 0 ) {
if( !Creature::melee_attack_hit( hitspread ) ) {
sfx::play_variant_sound( "mon_bite", "bite_miss", sfx::get_heard_volume( z.pos_bub() ),
sfx::get_heard_angle( z.pos_bub() ) );
target->add_msg_player_or_npc( msg_type, miss_msg_u,
@@ -1036,6 +1036,11 @@ bool melee_actor::call( monster &z ) const
min_mul, max_mul );
damage.mult_damage( multiplier );
// check if it can be dodged, and by extension, partially dodged
if( dodgeable ) {
damage.mult_damage( Creature::melee_damage_mult( hitspread ), true );
}
// split the damage between all the bodyparts we gonna hit
damage.mult_damage( 1.0 / bodyparts_hit.size() );
+10 -5
View File
@@ -165,7 +165,8 @@ static const weapon_category_id weapon_category_UNARMED( "UNARMED" );
static const std::string player_base_stamina_burn_rate( "PLAYER_BASE_STAMINA_BURN_RATE" );
static void player_hit_message( Character *attacker, const std::string &message,
Creature &t, int dam, bool crit = false, bool technique = false, const std::string &wp_hit = {} );
Creature &t, int dam, bool crit = false, bool technique = false, const std::string &wp_hit = {}, int
hit_spread = INT_MIN );
static int stumble( Character &u, const item_location &weap );
static std::string melee_message( const ma_technique &tec, Character &p,
const dealt_damage_instance &ddi );
@@ -689,7 +690,7 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special,
}
}
const bool hits = hit_spread >= 0;
const bool hits = Creature::melee_attack_hit( hit_spread );
if( monster *m = t.as_monster() ) {
cata::event e = cata::event::make<event_type::character_melee_attacks_monster>( getID(),
@@ -896,7 +897,7 @@ bool Character::melee_attack_abstract( Creature &t, bool allow_special,
if( seen || player_character.sees( here, t ) ) {
std::string message = melee_message( technique, *this, dealt_dam );
player_hit_message( this, message, t, dam, critical_hit, technique.id != tec_none,
dealt_dam.wp_hit );
dealt_dam.wp_hit, hit_spread );
} else {
add_msg_player_or_npc( m_good, _( "You hit something." ),
_( "<npcname> hits something." ) );
@@ -2253,7 +2254,7 @@ void Character::perform_special_attacks( Creature &t, dealt_damage_instance &dea
// TODO: Make this hit roll use unarmed skill, not weapon skill + weapon to_hit
int hit_spread = t.deal_melee_attack( this, hit_roll() * 0.8 );
if( hit_spread >= 0 ) {
if( Creature::melee_attack_hit( hit_spread ) ) {
weakpoint_attack attack;
t.deal_melee_hit( this, hit_spread, false, att.damage, dealt_dam, attack );
if( !practiced ) {
@@ -2567,7 +2568,7 @@ std::string melee_message( const ma_technique &tec, Character &p,
// display the hit message for an attack
void player_hit_message( Character *attacker, const std::string &message,
Creature &t, int dam, bool crit, bool technique, const std::string &wp_hit )
Creature &t, int dam, bool crit, bool technique, const std::string &wp_hit, int hit_spread )
{
map &here = get_map();
const tripoint_bub_ms pos = attacker->pos_bub( here );
@@ -2616,6 +2617,10 @@ void player_hit_message( Character *attacker, const std::string &message,
}
}
if( dam > 0 && !crit && hit_spread != INT_MIN ) {
msg += " " + Creature::hit_quality_label( hit_spread );
}
if( dam > 0 && attacker->is_avatar() ) {
//player hits monster melee
SCT.add( t_pos.xy().raw(),
+11 -7
View File
@@ -2294,12 +2294,16 @@ bool monster::melee_attack( Creature &target, float accuracy )
dealt_damage_instance dealt_dam;
if( hitspread >= 0 ) {
if( Creature::melee_attack_hit( hitspread ) ) {
target.deal_melee_hit( this, hitspread, false, damage, dealt_dam );
}
const int total_dealt = dealt_dam.total_damage();
if( hitspread < 0 ) {
std::string hit_quality_msg;
if( total_dealt > 0 ) {
hit_quality_msg = " " + Creature::hit_quality_label( hitspread );
}
if( !Creature::melee_attack_hit( hitspread ) ) {
bool monster_missed = monster_hit_roll < 0.0;
// Miss
if( has_flag( mon_flag_CLUMSY_ATTACKS ) && one_in( 4 ) ) {
@@ -2339,8 +2343,8 @@ bool monster::melee_attack( Creature &target, float accuracy )
sfx::do_player_death_hurt( dynamic_cast<Character &>( target ), false );
}
//~ 1$s is attacker name, 2$s is bodypart name in accusative.
add_msg( m_bad, _( "%1$s hits your %2$s." ), u_see_me ? disp_name( true ) : _( "Something" ),
body_part_name_accusative( dealt_dam.bp_hit ) );
add_msg( m_bad, _( "%1$s hits your %2$s.%3$s" ), u_see_me ? disp_name( true ) : _( "Something" ),
body_part_name_accusative( dealt_dam.bp_hit ), hit_quality_msg );
} else if( target.is_npc() ) {
if( has_effect( effect_ridden ) && has_flag( mon_flag_RIDEABLE_MECH ) &&
pos_bub() == player_character.pos_bub() ) {
@@ -2349,9 +2353,9 @@ bool monster::melee_attack( Creature &target, float accuracy )
total_dealt );
} else {
//~ %1$s: attacker name, %2$s: target NPC name, %3$s: bodypart name in accusative
add_msg( _( "%1$s hits %2$s in the %3$s." ),
add_msg( _( "%1$s hits %2$s in the %3$s.%4$s" ),
u_see_me ? disp_name( true ) : _( "Something" ), target.disp_name(),
body_part_name_accusative( dealt_dam.bp_hit ) );
body_part_name_accusative( dealt_dam.bp_hit ), hit_quality_msg );
}
} else {
if( has_effect( effect_ridden ) && has_flag( mon_flag_RIDEABLE_MECH ) &&
@@ -2415,7 +2419,7 @@ bool monster::melee_attack( Creature &target, float accuracy )
return true;
}
if( hitspread >= 0 && !is_hallucination() ) {
if( Creature::melee_attack_hit( hitspread ) && !is_hallucination() ) {
enchantment_cache->cast_hit_you( *this, target );
}
+2 -2
View File
@@ -164,8 +164,8 @@ TEST_CASE( "effective_damage_per_second", "[effective][dps]" )
SECTION( "against an armored target" ) {
monster soldier( mon_zombie_soldier_no_weakpoints );
CHECK( clumsy_sword.effective_dps( dummy, soldier ) == Approx( 8.0f ).epsilon( 0.15f ) );
CHECK( good_sword.effective_dps( dummy, soldier ) == Approx( 15.0f ).epsilon( 0.15f ) );
CHECK( clumsy_sword.effective_dps( dummy, soldier ) == Approx( 4.89f ).epsilon( 0.15f ) );
CHECK( good_sword.effective_dps( dummy, soldier ) == Approx( 11.64f ).epsilon( 0.15f ) );
}
SECTION( "effect of STR and DEX on damage per second" ) {
+22 -22
View File
@@ -659,29 +659,29 @@ TEST_CASE( "weapon_attack_ratings_and_moves", "[iteminfo][weapon]" )
CHECK( item_info_str( rock, dps ) ==
"--\n"
"Typical damage per second:\n"
"Best: <color_c_yellow>4.92</color>"
" Vs. Agile: <color_c_yellow>2.05</color>"
" Vs. Armored: <color_c_yellow>0.15</color>\n" );
"Best: <color_c_yellow>4.68</color>"
" Vs. Agile: <color_c_yellow>2.17</color>"
" Vs. Armored: <color_c_yellow>0.07</color>\n" );
CHECK( item_info_str( halligan, dps ) ==
"--\n"
"Typical damage per second:\n"
"Best: <color_c_yellow>7.55</color>"
" Vs. Agile: <color_c_yellow>3.85</color>"
" Vs. Armored: <color_c_yellow>2.06</color>\n" );
"Best: <color_c_yellow>7.03</color>"
" Vs. Agile: <color_c_yellow>3.80</color>"
" Vs. Armored: <color_c_yellow>1.26</color>\n" );
CHECK( item_info_str( mr_pointy, dps ) ==
"--\n"
"Typical damage per second:\n"
"Best: <color_c_yellow>6.87</color>"
" Vs. Agile: <color_c_yellow>3.20</color>"
" Vs. Armored: <color_c_yellow>0.12</color>\n" );
"Best: <color_c_yellow>6.49</color>"
" Vs. Agile: <color_c_yellow>3.25</color>"
" Vs. Armored: <color_c_yellow>0.05</color>\n" );
CHECK( item_info_str( arrow, dps ) ==
"--\n"
"Typical damage per second:\n"
"Best: <color_c_yellow>3.57</color>"
" Vs. Agile: <color_c_yellow>1.47</color>"
"Best: <color_c_yellow>3.31</color>"
" Vs. Agile: <color_c_yellow>1.49</color>"
" Vs. Armored: <color_c_yellow>0.00</color>\n" );
}
@@ -727,29 +727,29 @@ TEST_CASE( "weapon_attack_ratings_and_moves", "[iteminfo][weapon]" )
CHECK( item_info_str( rock, dpstam ) ==
"--\n"
"Typical damage per stamina:\n"
"Best: <color_c_yellow>5.41</color>"
" Vs. Agile: <color_c_yellow>2.25</color>"
" Vs. Armored: <color_c_yellow>0.16</color>\n" );
"Best: <color_c_yellow>5.14</color>"
" Vs. Agile: <color_c_yellow>2.38</color>"
" Vs. Armored: <color_c_yellow>0.07</color>\n" );
CHECK( item_info_str( halligan, dpstam ) ==
"--\n"
"Typical damage per stamina:\n"
"Best: <color_c_yellow>2.75</color>"
" Vs. Agile: <color_c_yellow>1.40</color>"
" Vs. Armored: <color_c_yellow>0.75</color>\n" );
"Best: <color_c_yellow>2.56</color>"
" Vs. Agile: <color_c_yellow>1.38</color>"
" Vs. Armored: <color_c_yellow>0.46</color>\n" );
CHECK( item_info_str( mr_pointy, dpstam ) ==
"--\n"
"Typical damage per stamina:\n"
"Best: <color_c_yellow>6.48</color>"
" Vs. Agile: <color_c_yellow>3.02</color>"
" Vs. Armored: <color_c_yellow>0.11</color>\n" );
"Best: <color_c_yellow>6.13</color>"
" Vs. Agile: <color_c_yellow>3.06</color>"
" Vs. Armored: <color_c_yellow>0.04</color>\n" );
CHECK( item_info_str( arrow, dpstam ) ==
"--\n"
"Typical damage per stamina:\n"
"Best: <color_c_yellow>5.25</color>"
" Vs. Agile: <color_c_yellow>2.16</color>"
"Best: <color_c_yellow>4.87</color>"
" Vs. Agile: <color_c_yellow>2.20</color>"
" Vs. Armored: <color_c_yellow>0.00</color>\n" );
}
}
+7 -6
View File
@@ -457,24 +457,24 @@ TEST_CASE( "Damage_type_effectiveness_vs_monster_resistance", "[melee][damage][e
clear_map_without_vision();
SECTION( "Attacking a monster with no resistance to test_fire" ) {
check_damage_from_test_fire( "mon_test_zombie", 0, false, 16.f );
check_damage_from_test_fire( "mon_test_zombie_no_fire_resist", 0, false, 15.67f );
}
SECTION( "Attacking a monster with some resistance to test_fire" ) {
check_damage_from_test_fire( "mon_test_fire_resist", 5, false, 11.f );
check_damage_from_test_fire( "mon_test_fire_resist", 5, false, 10.70f );
}
SECTION( "Attacking a monster that is very resistant to test_fire" ) {
check_damage_from_test_fire( "mon_test_fire_vresist", 50, false, 8.f );
check_damage_from_test_fire( "mon_test_fire_vresist", 50, false, 7.75f );
}
SECTION( "Attacking a monster that is immune to test_fire" ) {
check_damage_from_test_fire( "mon_test_fire_immune", 0, true, 8.f );
check_damage_from_test_fire( "mon_test_fire_immune", 0, true, 7.75f );
}
SECTION( "Attacking an NPC with no resistance to test_fire" ) {
check_damage_from_test_fire( { itype_test_zentai },
body_part_torso, 0, false, 14.84f );
body_part_torso, 0, false, 13.72f );
}
SECTION( "Attacking an NPC that is resistant to test_fire" ) {
@@ -484,7 +484,7 @@ TEST_CASE( "Damage_type_effectiveness_vs_monster_resistance", "[melee][damage][e
SECTION( "Attacking an NPC that is immune to test_fire" ) {
check_damage_from_test_fire( { itype_test_zentai_immune_test_fire },
body_part_torso, 0, true, 6.87f );
body_part_torso, 0, true, 6.35f );
}
}
@@ -493,6 +493,7 @@ TEST_CASE( "Damage_type_EOCs", "[damage][eoc]" )
clear_map_without_vision();
SECTION( "Attacking a monster" ) {
// test zombie is IMMOBILE so partial dodge doesn't render test flakey
check_eocs_from_test_fire( "mon_test_zombie_only_fire" );
}
+8 -8
View File
@@ -756,17 +756,17 @@ TEST_CASE( "widgets_showing_avatar_attributes", "[widget][avatar]" )
bodypart_id head( "head" );
widget head_num_w = widget_test_hp_head_num.obj();
widget head_graph_w = widget_test_hp_head_graph.obj();
REQUIRE( ava.get_part_hp_max( head ) == 85 );
REQUIRE( ava.get_part_hp_cur( head ) == 85 );
REQUIRE( ava.get_part_hp_max( head ) == 55 );
REQUIRE( ava.get_part_hp_cur( head ) == 55 );
ava.set_part_hp_cur( head, 84 );
CHECK( head_num_w.layout( ava ) == "HEAD: 84" );
ava.set_part_hp_cur( head, 54 );
CHECK( head_num_w.layout( ava ) == "HEAD: 54" );
CHECK( head_graph_w.layout( ava ) == "HEAD: ||||\\" );
ava.set_part_hp_cur( head, 42 );
CHECK( head_num_w.layout( ava ) == "HEAD: 42" );
ava.set_part_hp_cur( head, 27 );
CHECK( head_num_w.layout( ava ) == "HEAD: 27" );
CHECK( head_graph_w.layout( ava ) == "HEAD: ||,,," );
ava.set_part_hp_cur( head, 17 );
CHECK( head_num_w.layout( ava ) == "HEAD: 17" );
ava.set_part_hp_cur( head, 11 );
CHECK( head_num_w.layout( ava ) == "HEAD: 11" );
CHECK( head_graph_w.layout( ava ) == "HEAD: |,,,," );
ava.set_part_hp_cur( head, 0 );
CHECK( head_num_w.layout( ava ) == "HEAD: 0" );