Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added attack vectors to martial arts techniques #53954

Merged
merged 23 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
359 changes: 240 additions & 119 deletions data/json/techniques.json

Large diffs are not rendered by default.

90 changes: 60 additions & 30 deletions data/mods/MMA/techniques.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"name": "Burning Blade",
"messages": [ "You unleash a fiery attack against %s", "<npcname> unleash a fiery attack against %s" ],
"melee_allowed": true,
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 3.0 } ]
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 3.0 } ],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -15,7 +16,8 @@
"skill_requirements": [ { "name": "melee", "level": 1 } ],
"melee_allowed": true,
"crit_tec": true,
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ]
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -26,7 +28,8 @@
"melee_allowed": true,
"crit_ok": true,
"aoe": "impale",
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ]
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 7.0 } ],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -40,7 +43,8 @@
"melee_allowed": true,
"crit_tec": true,
"aoe": "spin",
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 10.0 } ]
"flat_bonuses": [ { "stat": "damage", "type": "heat", "scale": 10.0 } ],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -49,7 +53,8 @@
"messages": [ "You carve an arc through %s and those nearby", "<npcname> carve an arc through %s and those nearby" ],
"skill_requirements": [ { "name": "melee", "level": 2 } ],
"melee_allowed": true,
"aoe": "wide"
"aoe": "wide",
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -58,7 +63,8 @@
"messages": [ "You spot %s's weakpoint and strike", "<npcname> spot %s's weakpoint and strike" ],
"skill_requirements": [ { "name": "melee", "level": 1 } ],
"melee_allowed": true,
"flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 0.5 } ]
"flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 0.5 } ],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -68,7 +74,8 @@
"skill_requirements": [ { "name": "melee", "level": 4 } ],
"melee_allowed": true,
"crit_tec": true,
"flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 1.0 } ]
"flat_bonuses": [ { "stat": "damage", "type": "stab", "scaling-stat": "int", "scale": 1.0 } ],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -82,7 +89,8 @@
"melee_allowed": true,
"required_buffs_all": [ "mma_buff_hylian_onpause" ],
"crit_ok": true,
"aoe": "spin"
"aoe": "spin",
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -96,15 +104,17 @@
"melee_allowed": true,
"required_buffs_all": [ "mma_buff_hylian_onpause" ],
"crit_ok": true,
"aoe": "wide"
"aoe": "wide",
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
"id": "mma_tec_iron_heart_disarm",
"name": "Disarming Strike",
"messages": [ "You skillfully disarm %s", "<npcname> skillfully disarms %s" ],
"unarmed_allowed": true,
"disarms": true
"disarms": true,
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -114,7 +124,8 @@
"skill_requirements": [ { "name": "melee", "level": 1 } ],
"melee_allowed": true,
"defensive": true,
"miss_recovery": true
"miss_recovery": true,
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -129,7 +140,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.25 },
{ "stat": "damage", "type": "cut", "scale": 1.25 },
{ "stat": "damage", "type": "stab", "scale": 1.25 }
]
],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -144,7 +156,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.4 },
{ "stat": "damage", "type": "cut", "scale": 1.4 },
{ "stat": "damage", "type": "stab", "scale": 1.4 }
]
],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -156,7 +169,8 @@
],
"skill_requirements": [ { "name": "melee", "level": 3 } ],
"melee_allowed": true,
"aoe": "wide"
"aoe": "wide",
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -171,7 +185,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.25 },
{ "stat": "damage", "type": "cut", "scale": 1.25 },
{ "stat": "damage", "type": "stab", "scale": 1.25 }
]
],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -185,7 +200,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.2 },
{ "stat": "damage", "type": "cut", "scale": 1.2 },
{ "stat": "damage", "type": "stab", "scale": 1.2 }
]
],
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -208,7 +224,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.5 },
{ "stat": "damage", "type": "cut", "scale": 1.5 },
{ "stat": "damage", "type": "stab", "scale": 1.5 }
]
],
"attack_vectors": [ "WEAPON", "HAND" ]
},
{
"type": "technique",
Expand All @@ -224,7 +241,8 @@
{ "stat": "damage", "type": "bash", "scale": 0.66 },
{ "stat": "damage", "type": "cut", "scale": 0.66 },
{ "stat": "damage", "type": "stab", "scale": 0.66 }
]
],
"attack_vectors": [ "WEAPON", "HAND" ]
},
{
"type": "technique",
Expand All @@ -238,7 +256,8 @@
{ "stat": "damage", "type": "bash", "scale": 2.0 },
{ "stat": "damage", "type": "cut", "scale": 2.0 },
{ "stat": "damage", "type": "stab", "scale": 2.0 }
]
],
"attack_vectors": [ "FOOT" ]
},
{
"type": "technique",
Expand All @@ -252,7 +271,8 @@
{ "stat": "arpen", "type": "bash", "scaling-stat": "str", "scale": 1.5 },
{ "stat": "arpen", "type": "cut", "scaling-stat": "str", "scale": 1.5 },
{ "stat": "arpen", "type": "stab", "scaling-stat": "str", "scale": 1.5 }
]
],
"attack_vectors": [ "ARM" ]
},
{
"type": "technique",
Expand All @@ -262,7 +282,8 @@
"skill_requirements": [ { "name": "unarmed", "level": 3 } ],
"unarmed_allowed": true,
"crit_ok": true,
"flat_bonuses": [ { "stat": "hit", "scale": 5.0 } ]
"flat_bonuses": [ { "stat": "hit", "scale": 5.0 } ],
"attack_vectors_random": [ "HAND", "FOOT", "HEAD", "TORSO", "HEAD" ]
},
{
"type": "technique",
Expand All @@ -272,7 +293,8 @@
"skill_requirements": [ { "name": "unarmed", "level": 3 } ],
"unarmed_allowed": true,
"crit_ok": true,
"down_dur": 1
"down_dur": 1,
"attack_vectors_random": [ "FOOT", "LOWER_LEG" ]
},
{
"type": "technique",
Expand All @@ -283,7 +305,8 @@
"melee_allowed": true,
"unarmed_allowed": true,
"crit_tec": true,
"stun_dur": 1
"stun_dur": 1,
"attack_vectors": [ "WEAPON", "HAND" ]
},
{
"type": "technique",
Expand All @@ -300,7 +323,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.33 },
{ "stat": "damage", "type": "cut", "scale": 1.33 },
{ "stat": "damage", "type": "stab", "scale": 1.33 }
]
],
"attack_vectors": [ "THOW" ]
},
{
"type": "technique",
Expand All @@ -320,7 +344,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.5 },
{ "stat": "damage", "type": "cut", "scale": 1.5 },
{ "stat": "damage", "type": "stab", "scale": 1.5 }
]
],
"attack_vectors": [ "THROW" ]
},
{
"type": "technique",
Expand All @@ -330,7 +355,8 @@
"skill_requirements": [ { "name": "melee", "level": 2 } ],
"melee_allowed": true,
"crit_ok": true,
"disarms": true
"disarms": true,
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -340,7 +366,8 @@
"skill_requirements": [ { "name": "melee", "level": 5 } ],
"melee_allowed": true,
"crit_ok": true,
"aoe": "wide"
"aoe": "wide",
"attack_vectors": [ "WEAPON" ]
},
{
"type": "technique",
Expand All @@ -357,7 +384,8 @@
{ "stat": "arpen", "type": "bash", "scaling-stat": "str", "scale": 0.5 },
{ "stat": "arpen", "type": "cut", "scaling-stat": "str", "scale": 0.5 },
{ "stat": "arpen", "type": "stab", "scaling-stat": "str", "scale": 0.5 }
]
],
"attack_vectors": [ "WEAPON", "HAND" ]
},
{
"type": "technique",
Expand All @@ -368,7 +396,8 @@
"melee_allowed": true,
"unarmed_allowed": true,
"crit_tec": true,
"stun_dur": 1
"stun_dur": 1,
"attack_vectors": [ "WEAPON", "HAND" ]
},
{
"type": "technique",
Expand All @@ -385,7 +414,8 @@
{ "stat": "damage", "type": "bash", "scale": 1.3 },
{ "stat": "damage", "type": "cut", "scale": 1.3 },
{ "stat": "damage", "type": "stab", "scale": 1.3 }
]
],
"attack_vectors": [ "WEAPON", "HAND" ]
},
{
"type": "technique",
Expand Down
5 changes: 5 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -966,18 +966,23 @@ class Character : public Creature, public visitable
// If average == true, adds expected values of random rolls instead of rolling.
/** Adds all 3 types of physical damage to instance */
void roll_all_damage( bool crit, damage_instance &di, bool average, const item &weap,
std::string attack_vector,
const Creature *target, const bodypart_id &bp ) const;
/** Adds player's total bash damage to the damage instance */
void roll_bash_damage( bool crit, damage_instance &di, bool average, const item &weap,
std::string attack_vector,
float crit_mod ) const;
/** Adds player's total cut damage to the damage instance */
void roll_cut_damage( bool crit, damage_instance &di, bool average, const item &weap,
std::string attack_vector,
float crit_mod ) const;
/** Adds player's total stab damage to the damage instance */
void roll_stab_damage( bool crit, damage_instance &di, bool average, const item &weap,
std::string attack_vector,
float crit_mod ) const;
/** Adds player's total non-bash, non-cut, non-stab damage to the damage instance */
void roll_other_damage( bool crit, damage_instance &di, bool average, const item &weap,
std::string attack_vector,
float crit_mod ) const;

/** Returns true if the player should be dead */
Expand Down
5 changes: 5 additions & 0 deletions src/character_martial_arts.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class character_martial_arts
/** Fires all kill-triggered martial arts events */
void ma_onkill_effects( Character &owner );

/** Returns an attack vector that the player can use */
std::string get_valid_attack_vector( const Character &user,
std::vector<std::string> attack_vectors ) const;
/** Returns true if the player is able to use the given attack vector */
bool can_use_attack_vector( const Character &user, std::string av ) const;
/** Returns true if the player has the leg block technique available */
bool can_leg_block( const Character &owner ) const;
/** Returns true if the player has the arm block technique available */
Expand Down
8 changes: 4 additions & 4 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ double item::effective_dps( const Character &guy, Creature &mon ) const
Creature *temp_mon = &mon;
double subtotal_damage = 0;
damage_instance base_damage;
guy.roll_all_damage( crit, base_damage, true, *this, &mon, bp );
guy.roll_all_damage( crit, base_damage, true, *this, "WEAPON", &mon, bp );
damage_instance dealt_damage = base_damage;
// TODO: Modify DPS calculation to consider weakpoints.
resistances r = resistances( *static_cast<monster *>( temp_mon ) );
Expand All @@ -1868,7 +1868,7 @@ double item::effective_dps( const Character &guy, Creature &mon ) const
if( has_technique( RAPID ) ) {
Creature *temp_rs_mon = &mon;
damage_instance rs_base_damage;
guy.roll_all_damage( crit, rs_base_damage, true, *this, &mon, bp );
guy.roll_all_damage( crit, rs_base_damage, true, *this, "WEAPON", &mon, bp );
damage_instance dealt_rs_damage = rs_base_damage;
for( damage_unit &dmg_unit : dealt_rs_damage.damage_units ) {
dmg_unit.damage_multiplier *= 0.66;
Expand Down Expand Up @@ -4768,9 +4768,9 @@ void item::melee_combat_info( std::vector<iteminfo> &info, const iteminfo_query
( dmg_bash || dmg_cut || dmg_stab || type->m_to_hit > 0 ) ) || debug_mode ) {
bodypart_id bp = bodypart_id( "torso" );
damage_instance non_crit;
player_character.roll_all_damage( false, non_crit, true, *this, nullptr, bp );
player_character.roll_all_damage( false, non_crit, true, *this, "WEAPON", nullptr, bp );
damage_instance crit;
player_character.roll_all_damage( true, crit, true, *this, nullptr, bp );
player_character.roll_all_damage( true, crit, true, *this, "WEAPON", nullptr, bp );
int attack_cost = player_character.attack_speed( *this );
insert_separation_line( info );
if( parts->test( iteminfo_parts::DESCRIPTION_MELEEDMG ) ) {
Expand Down
Loading