# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -2312,8 +2312,8 @@
 	}
 
 	if (duration) { //Possible to chain
-		if(sd) duration = DIFF_TICK(sd->ud.canact_tick, tick);
-		if (duration < 1) duration = 1;
+		if(sd && duration==1) duration = DIFF_TICK(sd->ud.canact_tick, tick); //auto calc duration
+		duration = max(1,duration);
 		sc_start4(src,src,SC_COMBO,100,skill_id,bl->id,delay,0,duration);
 		clif_combo_delay(src, duration);
 	}
@@ -2427,8 +2427,29 @@
 		 * Official Magic Reflection Behavior : damage reflected depends on gears caster wears, not target
 		 **/
 		#if MAGIC_REFLECTION_TYPE
-			if( dmg.dmg_lv != ATK_MISS )//Wiz SL cancelled and consumed fragment
-				dmg = battle_calc_attack(BF_MAGIC,bl,bl,skill_id,skill_lv,flag&0xFFF);
+			if( dmg.dmg_lv != ATK_MISS ){//Wiz SL cancelled and consumed fragment
+				short s_ele = skill_get_ele(skill_id, skill_lv);
+
+				if (s_ele == -1) // the skill takes the weapon's element
+					s_ele = sstatus->rhw.ele;
+				else if (s_ele == -2) //Use status element
+					s_ele = status_get_attack_sc_element(src,status_get_sc(src));
+				else if( s_ele == -3 ) //Use random element
+					s_ele = rnd()%ELE_MAX;
+
+				dmg.damage = battle_attr_fix(bl, bl, dmg.damage, s_ele, status_get_element(bl), status_get_element_level(bl));
+
+				if( sc && sc->data[SC_ENERGYCOAT] ) {
+					struct status_data *status = status_get_status_data(bl);
+					int per = 100*status->sp / status->max_sp -1; //100% should be counted as the 80~99% interval
+					per /=20; //Uses 20% SP intervals.
+					//SP Cost: 1% + 0.5% per every 20% SP
+					if (!status_charge(bl, 0, (10+5*per)*status->max_sp/1000))
+						status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER);
+					//Reduction: 6% + 6% every 20%
+					dmg.damage -= dmg.damage * (6 * (1+per)) / 100;
+				}
+		}
 		#endif
 		}
 		if(sc && sc->data[SC_MAGICROD] && src == dsrc) {
@@ -12901,7 +12922,7 @@
 			break;
 
 		case HT_POWER:
-			if(!(sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_id))
+			if(!(sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == AC_DOUBLE))
 				return 0;
 			break;