Просмотр исходного кода

Corrected clif_calc_delay return type (#8940)

* type is now changed according to the attack type and the status endure of the target
* implemented DMG_SPLASH_ENDURE (14) for attack type DMG_SPLASH vs target with endure
* corrected DMG_MULTI_HIT_CRITICAL that should return DMG_ENDURE (4) vs target with endure status
* Updated clif_calc_walkdelay
Atemo 3 месяцев назад
Родитель
Сommit
82b17641f6
2 измененных файлов с 50 добавлено и 19 удалено
  1. 48 18
      src/map/clif.cpp
  2. 2 1
      src/map/clif.hpp

+ 48 - 18
src/map/clif.cpp

@@ -5112,22 +5112,55 @@ void clif_getareachar_unit( map_session_data* sd,struct block_list *bl ){
 	}
 }
 
-//Modifies the type of damage according to status changes [Skotlex]
+//Modifies the type of damage according to target status changes [Skotlex]
 //Aegis data specifies that: 4 endure against single hit sources, 9 against multi-hit.
-static enum e_damage_type clif_calc_delay(enum e_damage_type type, int32 div, int64 damage, int32 delay)
-{
-	return ( delay == 0 && damage > 0 ) ? ( div > 1 ? DMG_MULTI_HIT_ENDURE : DMG_ENDURE ) : type;
+static enum e_damage_type clif_calc_delay( block_list& bl, e_damage_type type, int32 div, int64 damage ) {
+	if (damage < 1)
+		return type;
+
+	status_change* sc = status_get_sc( &bl );
+
+	if (sc == nullptr || sc->empty())
+		return type;
+	
+	if (sc->getSCE(SC_ENDURE) == nullptr)	// !TODO: should berserk status also change the type?
+		return type;
+
+	switch( type ) {
+		case DMG_ENDURE:
+		case DMG_MULTI_HIT_ENDURE:
+		case DMG_SPLASH_ENDURE:
+			return type;
+		case DMG_NORMAL:
+		case DMG_CRITICAL:
+		case DMG_SINGLE:
+		case DMG_MULTI_HIT_CRITICAL:	// DMG_ENDURE despite div > 1
+			return DMG_ENDURE;
+		case DMG_MULTI_HIT:
+			return DMG_MULTI_HIT_ENDURE;
+		case DMG_SPLASH:
+			return DMG_SPLASH_ENDURE;
+	}
+
+	// Custom, unknown result of endure with types not listed
+	return (div > 1 ? DMG_MULTI_HIT_ENDURE : DMG_ENDURE);
 }
 
 /*==========================================
  * Estimates walk delay based on the damage criteria. [Skotlex]
  *------------------------------------------*/
-static int32 clif_calc_walkdelay(struct block_list *bl,int32 delay, char type, int64 damage, int32 div_)
-{
-	if (type == DMG_ENDURE || type == DMG_MULTI_HIT_ENDURE || damage <= 0)
+static int32 clif_calc_walkdelay( block_list &bl, int32 delay, e_damage_type type, int64 damage, int32 div_ ) {
+	if (damage < 1)
 		return 0;
 
-	if (bl->type == BL_PC) {
+	switch( type ) {
+		case DMG_ENDURE:
+		case DMG_MULTI_HIT_ENDURE:
+		case DMG_SPLASH_ENDURE:
+			return 0;
+	}
+
+	if (bl.type == BL_PC) {
 		if (battle_config.pc_walk_delay_rate != 100)
 			delay = delay*battle_config.pc_walk_delay_rate/100;
 	} else
@@ -5137,7 +5170,7 @@ static int32 clif_calc_walkdelay(struct block_list *bl,int32 delay, char type, i
 	if (div_ > 1) //Multi-hit skills mean higher delays.
 		delay += battle_config.multihit_delay*(div_-1);
 
-	return (delay > 0) ? delay:1; //Return 1 to specify there should be no noticeable delay, but you should stop walking.
+	return (delay > 0) ? delay : 1; //Return 1 to specify there should be no noticeable delay, but you should stop walking.
 }
 
 /*========================================== [Playtester]
@@ -5202,8 +5235,7 @@ int32 clif_damage(block_list& src, block_list& dst, t_tick tick, int32 sdelay, i
 	int32 damage = (int32)cap_value(sdamage,INT_MIN,INT_MAX);
 	int32 damage2 = (int32)cap_value(sdamage2,INT_MIN,INT_MAX);
 
-	if (type != DMG_MULTI_HIT_CRITICAL)
-		type = clif_calc_delay(type,div,damage+damage2,ddelay);
+	type = clif_calc_delay( dst, type, div, damage+damage2 );
 
 	damage = static_cast<decltype(damage)>(clif_hallucination_damage(dst, damage));
 	damage2 = static_cast<decltype(damage2)>(clif_hallucination_damage(dst, damage2));
@@ -5274,10 +5306,8 @@ int32 clif_damage(block_list& src, block_list& dst, t_tick tick, int32 sdelay, i
 	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);
+	return clif_calc_walkdelay(dst, ddelay, type, damage+damage2, div);
 }
 
 /*==========================================
@@ -5993,7 +6023,7 @@ void clif_skill_cooldown( map_session_data &sd, uint16 skill_id, t_tick tick ){
 /// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL)
 /// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2)
 int32 clif_skill_damage( block_list& src, block_list& dst, t_tick tick, int32 sdelay, int32 ddelay, int64 sdamage, int32 div, uint16 skill_id, uint16 skill_lv, e_damage_type type ){
-	type = clif_calc_delay( type, div, sdamage, ddelay );
+	type = clif_calc_delay( dst, type, div, sdamage );
 	sdamage = clif_hallucination_damage( dst, sdamage );
 
 	PACKET_ZC_NOTIFY_SKILL packet{};
@@ -6046,7 +6076,7 @@ int32 clif_skill_damage( block_list& src, block_list& dst, t_tick tick, int32 sd
 	}
 
 	//Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex]
-	return clif_calc_walkdelay( &dst, ddelay, type, damage, div );
+	return clif_calc_walkdelay( dst, ddelay, type, damage, div );
 }
 
 
@@ -6061,7 +6091,7 @@ int32 clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick ti
 	nullpo_ret(dst);
 
 	type = (type>DMG_NORMAL)?type:skill_get_hit(skill_id);
-	type = clif_calc_delay(type,div,damage,ddelay);
+	type = clif_calc_delay( *dst, type, div, damage );
 
 	damage = clif_hallucination_damage( *dst, damage );
 
@@ -6099,7 +6129,7 @@ int32 clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick ti
 	}
 
 	//Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex]
-	return clif_calc_walkdelay(dst,ddelay,type,damage,div);
+	return clif_calc_walkdelay(*dst,ddelay,type,damage,div);
 }
 */
 

+ 2 - 1
src/map/clif.hpp

@@ -699,7 +699,8 @@ 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
+	DMG_MULTI_HIT_CRITICAL,	/// multi-hit with critical
+	DMG_SPLASH_ENDURE,  	/// splash against target with endure status
 };
 
 enum class e_pet_evolution_result : uint32 {