if( wd->flag & BF_SHORT ) {
if ( tsd && tsd->bonus.short_weapon_damage_return ) {
NORMALIZE_RDAMAGE(damage * tsd->bonus.short_weapon_damage_return / 100);
++ rdamage = min(rdamage, status_get_hp(tsd));
rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, BDT_ENDURE);
/* is this right? rdamage as both left and right? */
battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
delay += 100;/* gradual increase so the numbers don't clip in the client */
}
if( wd->dmg_lv >= ATK_BLOCK ) {/* yes block still applies, somehow gravity thinks it makes sense. */
struct status_change *ssc;
if( sc ) {
struct status_change_entry *sce_d = sc->data[SC_DEVOTION];
struct block_list *d_bl = NULL;
if (sce_d && sce_d->val1)
d_bl = map->id2bl(sce_d->val1);
if( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION && skill_id != GS_DESPERADO
&& !(d_bl && !(wd->flag&BF_SKILL)) // It should not be a basic attack if the target is under devotion
&& !(d_bl && sce_d && !check_distance_bl(target, d_bl, sce_d->val3)) // It should not be out of range if the target is under devotion
) {
NORMALIZE_RDAMAGE(damage * sc->data[SC_REFLECTSHIELD]->val2 / 100);
++ rdamage = min(rdamage, status_get_hp(tsd));
#ifndef RENEWAL
rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, BDT_ENDURE);
#else
rdelay = clif->skill_damage(src, src, tick, delay, status_get_dmotion(src), rdamage, 1, CR_REFLECTSHIELD, 1, BDT_ENDURE);
#endif
/* is this right? rdamage as both left and right? */
if( tsd )
battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
delay += 100;/* gradual increase so the numbers don't clip in the client */
}
if( sc->data[SC_LG_REFLECTDAMAGE] && rnd()%100 < (30 + 10*sc->data[SC_LG_REFLECTDAMAGE]->val1) ) {
bool change = false;
NORMALIZE_RDAMAGE(damage * sc->data[SC_LG_REFLECTDAMAGE]->val2 / 100);
++ rdamage = min(rdamage, status_get_hp(tsd));
trdamage -= rdamage;/* wont count towards total */
if( sd && !sd->state.autocast ) {
change = true;
sd->state.autocast = 1;
}
map->foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,delay,wd->dmotion,rdamage,status_get_race(target));
if( change )
sd->state.autocast = 0;
delay += 150;/* gradual increase so the numbers don't clip in the client */
if( (--sc->data[SC_LG_REFLECTDAMAGE]->val3) <= 0 )
status_change_end(target, SC_LG_REFLECTDAMAGE, INVALID_TIMER);
}
if( sc->data[SC_SHIELDSPELL_DEF] && sc->data[SC_SHIELDSPELL_DEF]->val1 == 2 ){
NORMALIZE_RDAMAGE(damage * sc->data[SC_SHIELDSPELL_DEF]->val2 / 100);
++ rdamage = min(rdamage, status_get_hp(tsd));
rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, BDT_ENDURE);
/* is this right? rdamage as both left and right? */
if( tsd )
battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
delay += 100;/* gradual increase so the numbers don't clip in the client */
}
}
if( ( ssc = status->get_sc(src) ) ) {
if( ssc->data[SC_INSPIRATION] ) {
NORMALIZE_RDAMAGE(damage / 100);
++ rdamage = min(rdamage, status_get_hp(tsd));
rdelay = clif->delay_damage(tick+delay,target, target, status_get_amotion(target), status_get_dmotion(target), rdamage, 1, BDT_ENDURE);
/* is this right? rdamage as both left and right? */
if( sd )
battle->drain(sd, target, rdamage, rdamage, status_get_race(target), 0);
battle->delay_damage(tick, wd->amotion,src,target,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
delay += 100;/* gradual increase so the numbers don't clip in the client */
}
}
}
} else {/* long */
if ( tsd && tsd->bonus.long_weapon_damage_return ) {
NORMALIZE_RDAMAGE(damage * tsd->bonus.long_weapon_damage_return / 100);
++ rdamage = min(rdamage, status_get_hp(tsd));
rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, BDT_ENDURE);
/* is this right? rdamage as both left and right? */
battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
delay += 100;/* gradual increase so the numbers don't clip in the client */
}
}