Selaa lähdekoodia

Fixed #219
* Manhole effect (SC__MANHOLE & UNT_MANHOLE) is ignore player's knockback immunity at GVG/BG maps (only if target is BL_PC).

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh 10 vuotta sitten
vanhempi
commit
73bd593055
4 muutettua tiedostoa jossa 15 lisäystä ja 10 poistoa
  1. 4 2
      src/map/skill.c
  2. 4 1
      src/map/status.c
  3. 6 6
      src/map/unit.c
  4. 1 1
      src/map/unit.h

+ 4 - 2
src/map/skill.c

@@ -2388,7 +2388,7 @@ static int skill_area_temp[8];
 short skill_blown(struct block_list* src, struct block_list* target, char count, int8 dir, unsigned char flag)
 {
 	int dx = 0, dy = 0;
-	int reason = 0, checkflag = 0;
+	uint8 reason = 0, checkflag = 0;
 
 	nullpo_ret(src);
 	nullpo_ret(target);
@@ -12895,7 +12895,9 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
 
 					if( td )
 						sec = DIFF_TICK(td->tick, tick);
-					if( !unit_blown_immune(bl,0x1) ) {
+					if( (sg->unit_id == UNT_MANHOLE && bl->type == BL_PC)
+						|| !unit_blown_immune(bl,0x1) )
+					{
 						unit_movepos(bl, unit->bl.x, unit->bl.y, 0, 0);
 						clif_fixpos(bl);
 					}

+ 4 - 1
src/map/status.c

@@ -10052,7 +10052,6 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 		case SC_ELECTRICSHOCKER:
 		case SC_BITE:
 		case SC_THORNSTRAP:
-		case SC__MANHOLE:
 		//case SC__CHAOS:
 		case SC_CRYSTALIZE:
 		case SC_CURSEDCIRCLE_ATKER:
@@ -10067,6 +10066,10 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 			if (!unit_blown_immune(bl,0x1))
 				unit_stop_walking(bl,1);
 			break;
+		case SC__MANHOLE:
+			if (bl->type == BL_PC || !unit_blown_immune(bl,0x1))
+				unit_stop_walking(bl,1);
+			break;
 		case SC_HIDING:
 		case SC_CLOAKING:
 		case SC_CLOAKINGEXCEED:

+ 6 - 6
src/map/unit.c

@@ -1097,9 +1097,10 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
  *		5 - target has 'special_state.no_knockback';
  *		6 - target is trap that cannot be knocked back
  */
-int unit_blown_immune(struct block_list* bl, int flag)
+uint8 unit_blown_immune(struct block_list* bl, uint8 flag)
 {
-	if ((flag&0x1) && (map_flag_gvg(bl->m) || map[bl->m].flag.battleground)
+	if ((flag&0x1)
+		&& (map_flag_gvg(bl->m) || map[bl->m].flag.battleground)
 		&& ((flag&0x2) || !(battle_config.skill_trap_type&0x1)))
 		return 1; // No knocking back in WoE / BG
 
@@ -1118,16 +1119,15 @@ int unit_blown_immune(struct block_list* bl, int flag)
 		case BL_PC: {
 				struct map_session_data *sd = BL_CAST(BL_PC, bl);
 				// Basilica caster can't be knocked-back by normal monsters.
-				if( sd->sc.data[SC_BASILICA] && sd->sc.data[SC_BASILICA]->val4 == sd->bl.id && !(flag&0x4))
+				if( !(flag&0x4) && &sd->sc && sd->sc.data[SC_BASILICA] && sd->sc.data[SC_BASILICA]->val4 == sd->bl.id)
 					return 4;
 				// Target has special_state.no_knockback (equip)
-				if( (flag&0x1) && (flag&0x2) && sd->special_state.no_knockback )
+				if( (flag&(0x1|0x2)) && sd->special_state.no_knockback )
 					return 5;
 			}
 			break;
 		case BL_SKILL: {
-				struct skill_unit* su = NULL;
-				su = (struct skill_unit *)bl;
+				struct skill_unit* su = (struct skill_unit *)bl;
 				// Trap cannot be knocked back
 				if (su && su->group && skill_get_unit_flag(su->group->skill_id)&UF_NOKNOCKBACK)
 					return 6;

+ 1 - 1
src/map/unit.h

@@ -100,7 +100,7 @@ int unit_warp(struct block_list *bl, short map, short x, short y, clr_type type)
 int unit_setdir(struct block_list *bl, unsigned char dir);
 uint8 unit_getdir(struct block_list *bl);
 int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag);
-int unit_blown_immune(struct block_list* bl, int flag);
+uint8 unit_blown_immune(struct block_list* bl, uint8 flag);
 
 // Can-reach checks
 bool unit_can_reach_pos(struct block_list *bl,int x,int y,int easy);