浏览代码

Fixed Reject Sword, bugreport:4493 it nows applies damage reduction damage properly and rejects dual-wield weapons properly as on official servers. super thanks to daegaladh for his contribution

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15700 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind 13 年之前
父节点
当前提交
e7f8a20fd7
共有 1 个文件被更改,包括 15 次插入18 次删除
  1. 15 18
      src/map/battle.c

+ 15 - 18
src/map/battle.c

@@ -564,23 +564,6 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
 			damage = damage > 10 ? damage / 10 : 1;
 		}
 #endif
-		// FIXME:
-		// So Reject Sword calculates the redirected damage before calculating WoE/BG reduction? This is weird. [Inkfish]
-		if((sce=sc->data[SC_REJECTSWORD]) && flag&BF_WEAPON &&
-			// Fixed the condition check [Aalye]
-			(src->type!=BL_PC || (
-				((TBL_PC *)src)->status.weapon == W_DAGGER ||
-				((TBL_PC *)src)->status.weapon == W_1HSWORD ||
-				((TBL_PC *)src)->status.weapon == W_2HSWORD
-			)) &&
-			rnd()%100 < sce->val2
-		){
-			damage = damage*50/100;
-			status_fix_damage(bl,src,damage,clif_damage(bl,src,gettick(),0,0,damage,0,0,0));
-			clif_skill_nodamage(bl,bl,ST_REJECTSWORD,sce->val1,1);
-			if(--(sce->val3)<=0)
-				status_change_end(bl, SC_REJECTSWORD, INVALID_TIMER);
-		}
 
 		//Finally added to remove the status of immobile when aimedbolt is used. [Jobbie]
 		if( skill_num == RA_AIMEDBOLT && (sc->data[SC_BITE] || sc->data[SC_ANKLE] || sc->data[SC_ELECTRICSHOCKER]) )
@@ -2824,7 +2807,21 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
 			wd.damage-=wd.damage2;
 		}
 	}
-
+	//Reject Sword bugreport:4493 by Daegaladh
+	if(wd.damage && tsc && tsc->data[SC_REJECTSWORD] &&
+		(src->type!=BL_PC || (
+			((TBL_PC *)src)->weapontype1 == W_DAGGER ||
+			((TBL_PC *)src)->weapontype1 == W_1HSWORD ||
+			((TBL_PC *)src)->status.weapon == W_2HSWORD
+		)) &&
+		rnd()%100 < tsc->data[SC_REJECTSWORD]->val2
+		) {
+		wd.damage = wd.damage * 50 / 100;
+		status_fix_damage(target,src,wd.damage,clif_damage(target,src,gettick(),0,0,wd.damage,0,0,0));
+		clif_skill_nodamage(target,target,ST_REJECTSWORD,tsc->data[SC_REJECTSWORD]->val1,1);
+		if( --(tsc->data[SC_REJECTSWORD]->val3) <= 0 )
+			status_change_end(target, SC_REJECTSWORD, INVALID_TIMER);
+	}
 	if(skill_num == ASC_BREAKER) {	//Breaker's int-based damage (a misc attack?)
 		struct Damage md = battle_calc_misc_attack(src, target, skill_num, skill_lv, wflag);
 		wd.damage += md.damage;