Prechádzať zdrojové kódy

Small correction for SHC_SAVAGE_IMPACT and SHC_DANCING_KNIFE skills (#7496)

* Small correction for SHC_SAVAGE_IMPACT and SHC_DANCING_KNIFE skills
* SHC_SAVAGE_IMPACT should move the player from 1 cell to the target, between the target and the player
* SHC_DANCING_KNIFE shouldn't force the player to stand
* The behaviour should be the same for GC_CROSSIMPACT than SHC_SAVAGE_IMPACT

Thanks to @aleos89 @Lemongrass3110 !
Atemo 2 rokov pred
rodič
commit
b862aed75c
4 zmenil súbory, kde vykonal 37 pridanie a 8 odobranie
  1. 8 0
      src/map/path.cpp
  2. 1 0
      src/map/path.hpp
  3. 1 1
      src/map/script.cpp
  4. 27 7
      src/map/skill.cpp

+ 8 - 0
src/map/path.cpp

@@ -514,3 +514,11 @@ int distance_client(int dx, int dy)
 bool direction_diagonal( enum directions direction ){
 	return direction == DIR_NORTHWEST || direction == DIR_SOUTHWEST || direction == DIR_SOUTHEAST || direction == DIR_NORTHEAST;
 }
+
+bool direction_opposite( enum directions direction ){
+	if( direction == DIR_CENTER || direction == DIR_MAX ){
+		return direction;
+	}else{
+		return static_cast<enum directions>( ( direction + DIR_MAX / 2 ) % DIR_MAX );
+	}
+}

+ 1 - 0
src/map/path.hpp

@@ -69,6 +69,7 @@ bool check_distance_client(int dx, int dy, int distance);
 int distance_client(int dx, int dy);
 
 bool direction_diagonal( enum directions direction );
+bool direction_opposite( enum directions direction );
 
 //
 void do_init_path();

+ 1 - 1
src/map/script.cpp

@@ -22208,7 +22208,7 @@ BUILDIN_FUNC(pushpc)
 	}
 	else if(cells<0)
 	{// pushing backwards
-		dir = (dir+DIR_MAX/2)%DIR_MAX;  // turn around
+		dir = direction_opposite( static_cast<enum directions>( dir ) ); // turn around
 		cells     = -cells;
 	}
 

+ 27 - 7
src/map/skill.cpp

@@ -5709,14 +5709,22 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 						skill_id = SU_LUNATICCARROTBEAT2;
 					break;
 				case DK_SERVANT_W_PHANTOM:
-				case SHC_SAVAGE_IMPACT:
-				case SHC_FATAL_SHADOW_CROW:
 				case MT_RUSH_QUAKE:
 					// Jump to the target before attacking.
 					if (skill_check_unit_movepos(5, src, bl->x, bl->y, 0, 1))
 						skill_blown(src, src, 1, (map_calc_dir(bl, src->x, src->y) + 4) % 8, BLOWN_NONE);
 					clif_skill_nodamage(src, bl, skill_id, skill_lv, 1);// Trigger animation on servants.
 					break;
+				case SHC_SAVAGE_IMPACT:
+				case SHC_FATAL_SHADOW_CROW: {
+					uint8 dir = map_calc_dir(bl, src->x, src->y);	// dir based on target as we move player based on target location
+
+					// Move the player 1 cell near the target, between the target and the player
+					if (skill_check_unit_movepos(5, src, bl->x + dirx[dir], bl->y + diry[dir], 0, 1))
+						clif_blown(src);
+					clif_skill_nodamage(src, bl, skill_id, skill_lv, 1);// Trigger animation on servants.
+					break;
+				}
 				case AG_CRYSTAL_IMPACT_ATK:
 					if (sc && sc->getSCE(SC_CLIMAX) && sc->getSCE(SC_CLIMAX)->val1 == 5)
 						splash_size = 2;// Gives the aftershock hit a 5x5 splash AoE.
@@ -6254,16 +6262,18 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 			skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
 		}
 		break;
-	case GC_CROSSIMPACT:
-		if (skill_check_unit_movepos(0, src, bl->x, bl->y, 1, 1)) {
-			skill_blown(src, src, 1, (map_calc_dir(bl, src->x, src->y) + 4) % 8, BLOWN_IGNORE_NO_KNOCKBACK); // Target position is actually one cell next to the target
+	case GC_CROSSIMPACT: {
+		uint8 dir = map_calc_dir(bl, src->x, src->y);	// dir based on target as we move player based on target location
+
+		if (skill_check_unit_movepos(0, src, bl->x + dirx[dir], bl->y + diry[dir], 1, 1)) {
+			clif_blown(src);
 			skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag);
 		} else {
 			if (sd)
 				clif_skill_fail(sd, skill_id, USESKILL_FAIL, 0);
 		}
 		break;
-
+	}
 	case GC_PHANTOMMENACE:
 		if (flag&1) { // Only Hits Invisible Targets
 			if(tsc && (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || tsc->getSCE(SC_CAMOUFLAGE) || tsc->getSCE(SC_STEALTHFIELD))) {
@@ -8375,6 +8385,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 		break;
 
 	case SHC_DANCING_KNIFE:
+		if (flag & 1) {
+			skill_area_temp[1] = 0;
+
+			// Note: doesn't force player to stand before attacking
+			map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR | BL_SKILL, src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_LEVEL | SD_SPLASH, skill_castend_damage_id);
+		} else {
+			clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(src, bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)));
+		}
+		break;
+
 	case MT_A_MACHINE:
 		if (flag & 1) {
 			skill_area_temp[1] = 0;
@@ -8386,7 +8406,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 
 			map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR | BL_SKILL, src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_LEVEL | SD_SPLASH, skill_castend_damage_id);
 		} else {
-			if (skill_id == MT_A_MACHINE && dstsd) {
+			if (dstsd) {
 				int lv = abs( status_get_lv( src ) - status_get_lv( bl ) );
 
 				if (lv > battle_config.attack_machine_level_difference) {