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 multi-hit critical damage display support #2982

Merged
merged 1 commit into from Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions db/pre-re/skill_db.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

//****
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 8 additions & 7 deletions db/re/skill_db.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

//****
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions src/map/battle.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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))
Expand Down
7 changes: 6 additions & 1 deletion src/map/clif.cpp
Expand Up @@ -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];
Expand All @@ -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]) {
Expand Down Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this be inside an if to avoid multiple calculations for ither types?

//Return adjusted can't walk delay for further processing.
return clif_calc_walkdelay(dst, ddelay, type, damage+damage2, div);
}
Expand Down
1 change: 1 addition & 0 deletions src/map/clif.hpp
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/map/skill.cpp
Expand Up @@ -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<uint16>(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);
Expand Down
5 changes: 3 additions & 2 deletions src/map/skill.hpp
Expand Up @@ -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,
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down