From 08d160aaac8cdd286bbafb32532abe42b8a42376 Mon Sep 17 00:00:00 2001 From: Jittapan Pluemsumran Date: Tue, 17 Sep 2019 14:48:29 +0700 Subject: [PATCH] Added multi-hit critical damage display support (#2982) * Fixed #1788. * Double Attack and Fear Breeze can now critically strike. --- db/pre-re/skill_db.txt | 11 ++++++----- db/re/skill_db.txt | 15 ++++++++------- src/map/battle.cpp | 16 +++++++++++----- src/map/clif.cpp | 7 ++++++- src/map/clif.hpp | 1 + src/map/skill.cpp | 2 +- src/map/skill.hpp | 5 +++-- 7 files changed, 36 insertions(+), 21 deletions(-) diff --git a/db/pre-re/skill_db.txt b/db/pre-re/skill_db.txt index ea402c6a71..f007e9a8a5 100644 --- a/db/pre-re/skill_db.txt +++ b/db/pre-re/skill_db.txt @@ -16,6 +16,7 @@ // 0x20 - Skill ignores target's defense (misc type always ignores) // 0x40 - Skill ignores target's flee (magic type always ignores) // 0x80 - Skill ignores target's def cards +// 0x100 - Skill can critical // 07 splash/effect range // -1 - for screen-wide // 0 - no splash @@ -160,7 +161,7 @@ 58,-4,6,1,-1,0x2,0,10,1,no,0,0x40000,0,weapon,6,0x0, KN_SPEARSTAB,Spear Stab 59,3:5:7:9:11,6,1,-1,0,0,5,1,no,0,0,0,weapon,0,0x0, KN_SPEARBOOMERANG,Spear Boomerang 60,0,6,4,0,0x1,0,10,1,no,0,0,0,weapon,0,0x0, KN_TWOHANDQUICKEN,Twohand Quicken -61,0,6,4,-1,0x20,0,5,1,no,0,0,0,weapon,0,0x0, KN_AUTOCOUNTER,Counter Attack +61,0,6,4,-1,0x120,0,5,1,no,0,0,0,weapon,0,0x0, KN_AUTOCOUNTER,Counter Attack 62,-2,6,1,-1,0x2,1,10,1,no,0,0x40000,0,weapon,1,0x0, KN_BOWLINGBASH,Bowling Bash 63,0,0,0,0,0,0,1,0,no,0,0,0,weapon,0,0x0, KN_RIDING,Peco Peco Riding 64,0,0,0,0,0,0,5,0,no,0,0,0,weapon,0,0x0, KN_CAVALIERMASTERY,Cavalier Mastery @@ -558,7 +559,7 @@ // Sniper 380,0,6,4,0,0x1,0,10,1,no,0,0,0,weapon,0,0x0, SN_SIGHT,Falcon Eyes 381,9,8,1,0,0x40,0,5,1,yes,0,0,0,misc,0,0x0, SN_FALCONASSAULT,Falcon Assault -382,9,8,1,-1,0,1,5,1,yes,0,0x40000,14,weapon,0,0x0, SN_SHARPSHOOTING,Focused Arrow Strike +382,9,8,1,-1,0x100,1,5,1,yes,0,0x40000,14,weapon,0,0x0, SN_SHARPSHOOTING,Focused Arrow Strike 383,0,6,4,0,0x3,-1,10,1,yes,0,0,0,weapon,0,0x0, SN_WINDWALK,Wind Walker //**** @@ -741,7 +742,7 @@ 508,-9,6,1,-1,0x1,0,1,1,no,0,0,0,weapon,0,0x0, GS_CRACKER,Cracker 509,0,0,0,0,0,0,10,0,no,0,0,0,none,0,0x0, GS_SINGLEACTION,Single Action 510,0,0,0,0,0,0,10,0,no,0,0,0,none,0,0x0, GS_SNAKEEYE,Snake Eye -511,-9,8,0,-1,0,0,10,2,no,0,0,0,weapon,0,0x0, GS_CHAINACTION,Chain Action +511,-9,8,0,-1,0x100,0,10,2,no,0,0,0,weapon,0,0x0, GS_CHAINACTION,Chain Action 512,-9,6,1,-1,0,0,10,1,yes,0,0,0,weapon,0,0x0, GS_TRACKING,Tracking 513,-9,6,1,-1,0,0,5,1,no,0,0,0,weapon,0,0x0, GS_DISARM,Disarm 514,-9,6,1,-1,0x20,0,5,1,no,0,0,0,weapon,0,0x100, GS_PIERCINGSHOT,Piercing Shot @@ -763,7 +764,7 @@ 527,0,6,4,-1,0,0,5,1,no,0,0,0,weapon,3,0x0, NJ_TATAMIGAESHI,Improvised Defense 528,-1,6,1,-1,0,0,10,1,no,0,0,0,weapon,0,0x0, NJ_KASUMIKIRI,Vanishing Slash 529,7:9:11:13:15,6,2,0,0x1,0,5,1,no,0,0,0,none,0,0x4, NJ_SHADOWJUMP,Shadow Leap -530,7:9:11:13:15,6,1,-1,0,0,5,1,no,0,0,0,weapon,0,0x204, NJ_KIRIKAGE,Shadow Slash +530,7:9:11:13:15,6,1,-1,0x100,0,5,1,no,0,0,0,weapon,0,0x204, NJ_KIRIKAGE,Shadow Slash 531,0,6,4,0,0x1,0,5,1,no,0,0,0,none,7,0x0, NJ_UTSUSEMI,Cicada Skin Sheeding 532,0,6,4,0,0x1,0,10,1,yes,0,0,0,magic,0,0x0, NJ_BUNSINJYUTSU,Mirror Image 533,0,0,0,0,0,0,10,0,no,0,0,0,none,0,0x0, NJ_NINPOU,Spirit of the Blade @@ -1469,7 +1470,7 @@ 8212,3,6,2,1,0x42,1,5,1,no,0,0x80,0,weapon,0,0x3800, MA_FREEZINGTRAP,Freezing_Trap 8213,2,6,32,0,0x1,0,1,1,no,0,0x40000,0,misc,0,0x0, MA_REMOVETRAP,Remove_Trap 8214,-9,6,1,-1,0x2,0,1,1,no,0,0x1,0,weapon,6,0x80, MA_CHARGEARROW,Arrow_Repel -8215,9,8,1,-1,0,1,5,1,yes,0,0x40000,14,weapon,0,0x0, MA_SHARPSHOOTING,Focused_Arrow_Strike +8215,9,8,1,-1,0x100,1,5,1,yes,0,0x40000,14,weapon,0,0x0, MA_SHARPSHOOTING,Focused_Arrow_Strike 8216,-2,8,1,-1,0,0,10,3,no,0,0,0,weapon,0,0x0, ML_PIERCE,Pierce 8217,-2,6,1,-1,0x1,2,10,1,no,0,0,5,weapon,2,0x20000, ML_BRANDISH,Brandish_Spear 8218,5,8,1,-1,0x20,0,5,5,no,0,0x40000,0,weapon,0,0x20000, ML_SPIRALPIERCE,Spiral_Pierce diff --git a/db/re/skill_db.txt b/db/re/skill_db.txt index 72742754ec..f36fe4208c 100644 --- a/db/re/skill_db.txt +++ b/db/re/skill_db.txt @@ -16,6 +16,7 @@ // 0x20 - Skill ignores target's defense (misc type always ignores) // 0x40 - Skill ignores target's flee (magic type always ignores) // 0x80 - Skill ignores target's def cards +// 0x100 - Skill can critical // 07 splash/effect range // -1 - for screen-wide // 0 - no splash @@ -143,7 +144,7 @@ //**** // Thief -48,-1,8,0,-1,0,0,10,2,no,0,0,0,weapon,0,0x0, TF_DOUBLE,Double Attack +48,-1,8,0,-1,0x100,0,10,2,no,0,0,0,weapon,0,0x0, TF_DOUBLE,Double Attack 49,0,0,0,0,0,0,10,0,no,0,0,0,weapon,0,0x0, TF_MISS,Improve Dodge 50,1,6,1,0,1,0,10,1,no,0,0,0,weapon,0,0x0, TF_STEAL,Steal 51,1,6,4,0,1,0,10,1,no,0,0,0,none,0,0x80044, TF_HIDING,Hiding @@ -160,7 +161,7 @@ 58,-4,6,1,-1,0x2,0,10,1,no,0,0x40000,0,weapon,6,0x0, KN_SPEARSTAB,Spear Stab 59,3:5:7:9:11,6,1,-1,0,0,5,1,no,0,0,0,weapon,0,0x0, KN_SPEARBOOMERANG,Spear Boomerang 60,0,6,4,0,0x1,0,10,1,no,0,0,0,weapon,0,0x0, KN_TWOHANDQUICKEN,Twohand Quicken -61,0,6,4,-1,0,0,5,1,no,0,0,0,weapon,0,0x0, KN_AUTOCOUNTER,Counter Attack +61,0,6,4,-1,0x100,0,5,1,no,0,0,0,weapon,0,0x0, KN_AUTOCOUNTER,Counter Attack 62,-2,6,1,-1,0x2,1,10,1,no,0,0x40000,0,weapon,1,0x0, KN_BOWLINGBASH,Bowling Bash 63,0,0,0,0,0,0,1,0,no,0,0,0,weapon,0,0x0, KN_RIDING,Peco Peco Riding 64,0,0,0,0,0,0,5,0,no,0,0,0,weapon,0,0x0, KN_CAVALIERMASTERY,Cavalier Mastery @@ -558,7 +559,7 @@ // Sniper 380,0,6,4,0,0x1,0,10,1,no,0,0,0,weapon,0,0x0, SN_SIGHT,Falcon Eyes 381,9,8,1,0,0xC0,0,5,1,yes,0,0,0,misc,0,0x0, SN_FALCONASSAULT,Falcon Assault -382,9,8,1,-1,0,1,5,1,yes,0,0x40000,14,weapon,0,0x0, SN_SHARPSHOOTING,Focused Arrow Strike +382,9,8,1,-1,0x100,1,5,1,yes,0,0x40000,14,weapon,0,0x0, SN_SHARPSHOOTING,Focused Arrow Strike 383,0,6,4,0,0x3,-1,10,1,yes,0,0,0,weapon,0,0x0, SN_WINDWALK,Wind Walker //**** @@ -741,7 +742,7 @@ 508,-9,6,1,-1,0x1,0,1,1,no,0,0,0,weapon,0,0x0, GS_CRACKER,Cracker 509,0,0,0,0,0,0,10,0,no,0,0,0,none,0,0x0, GS_SINGLEACTION,Single Action 510,0,0,0,0,0,0,10,0,no,0,0,0,none,0,0x0, GS_SNAKEEYE,Snake Eye -511,-9,8,0,-1,0,0,10,2,no,0,0,0,weapon,0,0x0, GS_CHAINACTION,Chain Action +511,-9,8,0,-1,0x100,0,10,2,no,0,0,0,weapon,0,0x0, GS_CHAINACTION,Chain Action 512,-9,6,1,-1,0,0,10,1,yes,0,0,0,weapon,0,0x0, GS_TRACKING,Tracking 513,-9,6,1,-1,0,0,5,1,no,0,0,0,weapon,0,0x0, GS_DISARM,Disarm 514,-9,6,1,-1,0x20,0,5,1,no,0,0,0,weapon,0,0x100, GS_PIERCINGSHOT,Piercing Shot @@ -763,7 +764,7 @@ 527,0,6,4,-1,0,0,5,1,no,0,0,0,weapon,4,0x0, NJ_TATAMIGAESHI,Improvised Defense 528,-1,6,1,-1,0,0,10,1,no,0,0,0,weapon,0,0x0, NJ_KASUMIKIRI,Vanishing Slash 529,7:9:11:13:15,6,2,0,0x1,0,5,1,no,0,0,0,none,0,0x4, NJ_SHADOWJUMP,Shadow Leap -530,7:9:11:13:15,6,1,-1,0,0,5,1,no,0,0,0,weapon,0,0x204, NJ_KIRIKAGE,Shadow Slash +530,7:9:11:13:15,6,1,-1,0x100,0,5,1,no,0,0,0,weapon,0,0x204, NJ_KIRIKAGE,Shadow Slash 531,0,6,4,0,0x1,0,5,1,no,0,0,0,none,7,0x0, NJ_UTSUSEMI,Cicada Skin Sheeding 532,0,6,4,0,0x1,0,10,1,yes,0,0,0,magic,0,0x0, NJ_BUNSINJYUTSU,Mirror Image 533,0,0,0,0,0,0,10,0,no,0,0,0,none,0,0x0, NJ_NINPOU,Spirit of the Blade @@ -1032,7 +1033,7 @@ //**** // RA Ranger 2233,9,8,1,-1,0x2,3:3:3:3:3:4:4:4:4:5,10,-3,yes,0,0,0,weapon,0,0x80, RA_ARROWSTORM,Arrow Storm -2234,0,6,4,0,0,0,5,1,yes,0,0,0,none,0,0x0, RA_FEARBREEZE,Fear Breeze +2234,0,6,4,0,0x100,0,5,1,yes,0,0,0,none,0,0x0, RA_FEARBREEZE,Fear Breeze 2235,0,0,0,0,0,0,10,0,no,0,0,0,none,0,0x0, RA_RANGERMAIN,Ranger Main 2236,9,8,1,-1,0,0,10,1,yes,0,0,0,weapon,0,0x80, RA_AIMEDBOLT,Aimed Bolt 2237,9,6,2,0,0x3,3,1,1,no,0,0x40000,0,none,0,0x2000, RA_DETONATOR,Detonator @@ -1523,7 +1524,7 @@ 8212,3,6,2,1,0x42,1,5,1,no,0,0x80,0,weapon,0,0x3800, MA_FREEZINGTRAP,Freezing_Trap 8213,2,6,32,0,0x1,0,1,1,no,0,0x40000,0,misc,0,0x0, MA_REMOVETRAP,Remove_Trap 8214,-9,6,1,-1,0x2,0,1,1,no,0,0x1,0,weapon,6,0x80, MA_CHARGEARROW,Arrow_Repel -8215,9,8,1,-1,0,1,5,1,yes,0,0x40000,14,weapon,0,0x0, MA_SHARPSHOOTING,Focused_Arrow_Strike +8215,9,8,1,-1,0x100,1,5,1,yes,0,0x40000,14,weapon,0,0x0, MA_SHARPSHOOTING,Focused_Arrow_Strike 8216,-2,8,1,-1,0,0,10,3,no,0,0,0,weapon,0,0x0, ML_PIERCE,Pierce 8217,-2,6,1,-1,0x1,2,10,1,no,0,0,5,weapon,2,0x20000, ML_BRANDISH,Brandish_Spear 8218,5,8,1,-1,0,0,5,5,no,0,0x40000,0,weapon,0,0x20000, ML_SPIRALPIERCE,Spiral_Pierce diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 109a5b1e6c..1f14c5a4f0 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -2382,14 +2382,12 @@ static bool is_attack_critical(struct Damage* wd, struct block_list *src, struct struct map_session_data *tsd = BL_CAST(BL_PC, target); if (!first_call) - return (wd->type == DMG_CRITICAL); + return (wd->type == DMG_CRITICAL || wd->type == DMG_MULTI_HIT_CRITICAL); if (skill_id == NPC_CRITICALSLASH || skill_id == LG_PINPOINTATTACK) //Always critical skills return true; - if( !(wd->type&DMG_MULTI_HIT) && sstatus->cri && (!skill_id || - skill_id == KN_AUTOCOUNTER || skill_id == SN_SHARPSHOOTING || - skill_id == MA_SHARPSHOOTING || skill_id == NJ_KIRIKAGE)) + if( sstatus->cri && ( !skill_id || skill_get_nk(skill_id)&NK_CRITICAL ) ) { short cri = sstatus->cri; @@ -5359,8 +5357,16 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl battle_calc_multi_attack(&wd, src, target, skill_id, skill_lv); // crit check is next since crits always hit on official [helvetica] - if (is_attack_critical(&wd, src, target, skill_id, skill_lv, true)) + if (is_attack_critical(&wd, src, target, skill_id, skill_lv, true)) { +#if PACKETVER >= 20161207 + if (wd.type&DMG_MULTI_HIT) + wd.type = DMG_MULTI_HIT_CRITICAL; + else + wd.type = DMG_CRITICAL; +#else wd.type = DMG_CRITICAL; +#endif + } // check if we're landing a hit if(!is_attack_hitting(&wd, src, target, skill_id, skill_lv, true)) diff --git a/src/map/clif.cpp b/src/map/clif.cpp index f521fdbde2..b65f29f4d4 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -4784,6 +4784,7 @@ static int clif_hallucination_damage() /// 10 = critical hit /// 11 = lucky dodge /// 12 = (touch skill?) +/// 13 = multi-hit critical int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage) { unsigned char buf[34]; @@ -4804,7 +4805,8 @@ int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int nullpo_ret(src); nullpo_ret(dst); - type = clif_calc_delay(type,div,damage+damage2,ddelay); + if (type != DMG_MULTI_HIT_CRITICAL) + type = clif_calc_delay(type,div,damage+damage2,ddelay); sc = status_get_sc(dst); if(sc && sc->count) { if(sc->data[SC_HALLUCINATION]) { @@ -4866,6 +4868,9 @@ int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int if(src == dst) { unit_setdir(src, unit_getdir(src)); } + + // In case this assignment is bypassed by DMG_MULTI_HIT_CRITICAL + type = clif_calc_delay(type, div, damage + damage2, ddelay); //Return adjusted can't walk delay for further processing. return clif_calc_walkdelay(dst, ddelay, type, damage+damage2, div); } diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 82240fe1c9..d19af27cca 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -547,6 +547,7 @@ enum e_damage_type : uint8_t { DMG_CRITICAL, /// critical hit DMG_LUCY_DODGE, /// lucky dodge DMG_TOUCH, /// (touch skill?) + DMG_MULTI_HIT_CRITICAL /// multi-hit with critical }; enum class e_pet_evolution_result : uint32 { diff --git a/src/map/skill.cpp b/src/map/skill.cpp index 1c417d9466..10d69968d1 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -21059,7 +21059,7 @@ static bool skill_parse_row_skilldb(char* split[], int columns, int current) skill_db[idx]->hit = atoi(split[2]); skill_db[idx]->inf = atoi(split[3]); skill_split_atoi(split[4],skill_db[idx]->element); - skill_db[idx]->nk = (uint8)strtol(split[5], NULL, 0); + skill_db[idx]->nk = static_cast(strtol(split[5], NULL, 0)); skill_split_atoi(split[6],skill_db[idx]->splash); skill_db[idx]->max = atoi(split[7]); skill_split_atoi(split[8],skill_db[idx]->num); diff --git a/src/map/skill.hpp b/src/map/skill.hpp index 4a5ac6f8d6..8fe8fabcdc 100644 --- a/src/map/skill.hpp +++ b/src/map/skill.hpp @@ -38,7 +38,7 @@ extern DBMap* skilldb_name2id; /// Constants to identify a skill's nk value (damage properties) /// The NK value applies only to non INF_GROUND_SKILL skills /// when determining skill castend function to invoke. -enum e_skill_nk { +enum e_skill_nk : uint16 { NK_NO_DAMAGE = 0x01, NK_SPLASH = 0x02|0x04, // 0x4 = splash & split NK_SPLASHSPLIT = 0x04, @@ -47,6 +47,7 @@ enum e_skill_nk { NK_IGNORE_DEF = 0x20, NK_IGNORE_FLEE = 0x40, NK_NO_CARDFIX_DEF = 0x80, + NK_CRITICAL = 0x100, }; /// Constants to identify the skill's inf value: @@ -181,7 +182,7 @@ struct s_skill_db { int8 hit; ///< Hit type uint8 inf; ///< Inf: 0- passive, 1- enemy, 2- place, 4- self, 16- friend, 32- trap int element[MAX_SKILL_LEVEL]; ///< Element - uint8 nk; ///< Damage properties + uint16 nk; ///< Damage properties int splash[MAX_SKILL_LEVEL]; ///< Splash effect uint8 max; ///< Max level int num[MAX_SKILL_LEVEL]; ///< Number of hit