viewing paste part 2 reflect | Diff

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
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 */
        }
    }
Viewed 1204 times, submitted by Guest.