Skip to content

Commit

Permalink
Updated Kyomu effect and Magic Reflection effect
Browse files Browse the repository at this point in the history
* All skills have a chance of failing at 25%, not just Shield Reflect and Reflect Damage.
* Kaite, Magic Mirror, and Shield Spell - Defense are not nullified by Kyomu.
* Item-based and Magic Mirror reflection damage Boss monsters, Kaite does not.
  • Loading branch information
aleos89 committed Feb 26, 2016
1 parent 6f74f67 commit 1b9a0b5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/map/battle.c
Expand Up @@ -6735,7 +6735,7 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
#endif
}

if( sc && sc->data[SC_KYOMU] ) // Nullify reflecting ability
if (sc && sc->data[SC_KYOMU] && (!ssc || !ssc->data[SC_SHIELDSPELL_DEF])) // Nullify reflecting ability except for Shield Spell - Def
rdamage = 0;

return cap_value(min(rdamage,max_damage),INT_MIN,INT_MAX);
Expand Down
27 changes: 11 additions & 16 deletions src/map/skill.c
Expand Up @@ -2576,11 +2576,14 @@ static int skill_magic_reflect(struct block_list* src, struct block_list* bl, in
struct status_change *sc = status_get_sc(bl);
struct map_session_data* sd = BL_CAST(BL_PC, bl);

if( sc && sc->data[SC_KYOMU] ) // Nullify reflecting ability
return 0;
if (!sc || !sc->data[SC_KYOMU]) { // Kyomu doesn't reflect
// Item-based reflection - Bypasses Boss check
if (sd && sd->bonus.magic_damage_return && type && rnd()%100 < sd->bonus.magic_damage_return)
return 1;
}

// item-based reflection
if( sd && sd->bonus.magic_damage_return && type && rnd()%100 < sd->bonus.magic_damage_return )
// Magic Mirror reflection - Bypasses Boss check
if (sc && sc->data[SC_MAGICMIRROR] && rnd()%100 < sc->data[SC_MAGICMIRROR]->val2)
return 1;

if( is_boss(src) )
Expand All @@ -2590,11 +2593,10 @@ static int skill_magic_reflect(struct block_list* src, struct block_list* bl, in
if( !sc || sc->count == 0 )
return 0;

if( sc->data[SC_MAGICMIRROR] && rnd()%100 < sc->data[SC_MAGICMIRROR]->val2 )
return 1;

if( sc->data[SC_KAITE] && (src->type == BL_PC || status_get_lv(src) <= 80) )
{// Kaite only works against non-players if they are low-level.
// Kaite reflection - Does not bypass Boss check
if( sc->data[SC_KAITE] && (src->type == BL_PC || status_get_lv(src) <= 80) ) {
// Kaite only works against non-players if they are low-level.
// Kyomu doesn't disable Kaite, but the "skill fail chance" part of Kyomu applies to it.
clif_specialeffect(bl, 438, AREA);
if( --sc->data[SC_KAITE]->val2 <= 0 )
status_change_end(bl, SC_KAITE, INVALID_TIMER);
Expand Down Expand Up @@ -15117,13 +15119,6 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
return false;
}
break;
case LG_REFLECTDAMAGE:
case CR_REFLECTSHIELD:
if( sc && sc->data[SC_KYOMU] && rnd()%100 < 30){
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return false;
}
break;
case KO_JYUMONJIKIRI:
if (sd->weapontype1 && (sd->weapontype2 || sd->status.shield))
return true;
Expand Down
5 changes: 4 additions & 1 deletion src/map/status.c
Expand Up @@ -1939,7 +1939,10 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui
if (sc->data[SC_ALL_RIDING])
return false; //You can't use skills while in the new mounts (The client doesn't let you, this is to make cheat-safe)

if (flag == 1 && sc->data[SC_ASH] && rnd()%2 && !(status->mode&MD_BOSS)) {
if (flag == 1 && !(status->mode&MD_BOSS) && ( // Applies to after cast completion only and doesn't apply to Boss monsters.
(sc->data[SC_ASH] && rnd()%2) || // Volcanic Ash has a 50% chance of causing skills to fail.
(sc->data[SC_KYOMU] && rnd()%100 < 25) // Kyomu has a 25% chance of causing skills fail.
)) {
if (src->type == BL_PC)
clif_skill_fail((TBL_PC*)src,skill_id,USESKILL_FAIL_LEVEL,0);
return false;
Expand Down

0 comments on commit 1b9a0b5

Please sign in to comment.