Skip to content

Commit

Permalink
Fixed NPC_STONESKIN, NPC_ANTIMAGIC, NPC_MAGICMIRROR and Autocast on m…
Browse files Browse the repository at this point in the history
…agic 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)
  • Loading branch information
Playtester committed Nov 1, 2014
1 parent c3e488e commit 0d8a7c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
14 changes: 11 additions & 3 deletions src/map/battle.c
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion src/map/skill.c
Expand Up @@ -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;
Expand Down
14 changes: 2 additions & 12 deletions src/map/status.c
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 0d8a7c0

Please sign in to comment.