Prechádzať zdrojové kódy

Fixed NPC_STONESKIN, NPC_ANTIMAGIC, NPC_MAGICMIRROR and Autocast on magic hit
- Fixed NPC_STONESKIN, NPC_ANTIMAGIC, NPC_MAGICMIRROR (bugreport:6118, bugreport:9375)
* Using the skills will now be 100% successful (can't be resisted)
* Fixed skills not working for players (e.g. Ulfhedinn, Mithril Magic Cape, Platinum Shield)
* Fixed level 5 and 10 not working at all
* NPC_STONESKIN and NPC_ANTIMAGIC will no longer change DEF/MDEF, instead they will increase/reduce physical/magical damage percentually, this IS official behavior
- Fixed "Autocast on magic hit" having its chance halved (bugreport:9377)

Playtester 10 rokov pred
rodič
commit
0d8a7c0313
3 zmenil súbory, kde vykonal 15 pridanie a 16 odobranie
  1. 11 3
      src/map/battle.c
  2. 2 1
      src/map/skill.c
  3. 2 12
      src/map/status.c

+ 11 - 3
src/map/battle.c

@@ -1109,11 +1109,19 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
 				damage >>= 2; //75% reduction
 		}
 
-		if( sc->data[SC_SMOKEPOWDER] ) {
+		if(sc->data[SC_ARMORCHANGE]) {
+			//On official servers, SC_ARMORCHANGE does not change DEF/MDEF but rather increases/decreases the damage
+			if(flag&BF_WEAPON)
+				DAMAGE_SUBRATE(sc->data[SC_ARMORCHANGE]->val2)
+			else if(flag&BF_MAGIC)
+				DAMAGE_SUBRATE(sc->data[SC_ARMORCHANGE]->val3)
+		}
+
+		if(sc->data[SC_SMOKEPOWDER]) {
 			if( (flag&(BF_SHORT|BF_WEAPON)) == (BF_SHORT|BF_WEAPON) )
-				damage -= 15 * damage / 100; // 15% reduction to physical melee attacks
+				DAMAGE_SUBRATE(15) // 15% reduction to physical melee attacks
 			else if( (flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON) )
-				damage -= 50 * damage / 100; // 50% reduction to physical ranged attacks
+				DAMAGE_SUBRATE(50) // 50% reduction to physical ranged attacks
 		}
 
 		// Compressed code, fixed by map.h [Epoque]

+ 2 - 1
src/map/skill.c

@@ -2142,7 +2142,8 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
 			if (autospl_skill_lv < 0) autospl_skill_lv = 1+rnd()%(-autospl_skill_lv);
 
 			autospl_rate = dstsd->autospell2[i].rate;
-			if (attack_type&BF_LONG)
+			//Physical range attacks only trigger autospells half of the time
+			if ((attack_type&(BF_WEAPON|BF_LONG)) == (BF_WEAPON|BF_LONG))
 				 autospl_rate>>=1;
 
 			dstsd->state.autocast = 1;

+ 2 - 12
src/map/status.c

@@ -5633,8 +5633,6 @@ static defType status_calc_def(struct block_list *bl, struct status_change *sc,
 	if(sc->data[SC_UNLIMIT])
 		return 1;
 
-	if(sc->data[SC_ARMORCHANGE])
-		def += (def * sc->data[SC_ARMORCHANGE]->val2) / 100;
 	if(sc->data[SC_DRUMBATTLE])
 		def += sc->data[SC_DRUMBATTLE]->val3;
 #ifndef RENEWAL
@@ -5794,8 +5792,6 @@ static defType status_calc_mdef(struct block_list *bl, struct status_change *sc,
 	if(sc->data[SC_UNLIMIT])
 		return 1;
 
-	if(sc->data[SC_ARMORCHANGE])
-		mdef += (mdef * sc->data[SC_ARMORCHANGE]->val3) / 100;
 	if(sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 3)
 		mdef += 50;
 	if(sc->data[SC_ENDURE]) // It has been confirmed that Eddga card grants 1 MDEF, not 0, not 10, but 1.
@@ -7229,12 +7225,6 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
 			tick_def2 = (status_get_lv(bl) > 150 ? 150 : status_get_lv(bl)) * 20 +
 				(sd ? (sd->status.job_level > 50 ? 50 : sd->status.job_level) * 100 : 0);
 			break;
-		case SC_MAGICMIRROR:
-		case SC_ARMORCHANGE:
-			if (sd) // Duration greatly reduced for players.
-				tick /= 15;
-			sc_def2 = status_get_lv(bl)*20 + status->vit*25 + status->agi*10; // Lineal Reduction of Rate
-			break;
 		case SC_MARSHOFABYSS:
 			// 5 second (Fixed) + 25 second - {( INT + LUK ) / 20 second }
 			tick_def2 = (status->int_ + status->luk)*50;
@@ -9138,7 +9128,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 		case SC_MAGICMIRROR:
 			// Level 1 ~ 5 & 6 ~ 10 has different duration
 			// Level 6 ~ 10 use effect of level 1 ~ 5
-			val1 %= 5;
+			val1 = 1 + ((val1-1)%5);
 		case SC_SLOWCAST:
 			val2 = 20*val1; // Magic reflection/cast rate
 			break;
@@ -9153,7 +9143,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 			}
 			// Level 1 ~ 5 & 6 ~ 10 has different duration
 			// Level 6 ~ 10 use effect of level 1 ~ 5
-			val1 %= 5;
+			val1 = 1 + ((val1-1)%5);
 			val2 *= val1; // 20% per level
 			val3 *= val1;
 			break;