viewing paste Unknown #5782 | C

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
Index: src/map/battle.c
===================================================================
--- src/map/battle.c    (revision 17306)
+++ src/map/battle.c    (working copy)
@@ -4607,6 +4607,7 @@
 int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int *dmg, int flag, uint16 skill_id){
        struct map_session_data* sd;
        int rdamage = 0, damage = *dmg;
+       int max_damage = (int64)status_get_max_hp(bl);
        struct status_change* sc;
 
        sd = BL_CAST(BL_PC, bl);
@@ -4614,11 +4615,10 @@
 
        if( sc && sc->data[SC_REFLECTDAMAGE] ) {
                if( rnd()%100 <= sc->data[SC_REFLECTDAMAGE]->val1*10 + 30 ){
-                       int max_damage = (int64)status_get_max_hp(bl) * status_get_lv(bl) / 100;
+                       max_damage *= status_get_lv(bl) / 100;
                        rdamage = (int64)(*dmg) * sc->data[SC_REFLECTDAMAGE]->val2 / 100;
                        if( --(sc->data[SC_REFLECTDAMAGE]->val3) < 1)
                                status_change_end(bl,SC_REFLECTDAMAGE,INVALID_TIMER);
-                       if( rdamage > max_damage ) rdamage = max_damage;
                }
        }else if( sc && sc->data[SC_CRESCENTELBOW] && !is_boss(src) && rnd()%100 < sc->data[SC_CRESCENTELBOW]->val2 ){
                //ATK [{(Target HP / 100) x Skill Level} x Caster Base Level / 125] % + [Received damage x {1 + (Skill Level x 0.2)}]
@@ -4666,7 +4666,7 @@
        if( sc && sc->data[SC_KYOMU] ) // Nullify reflecting ability
                rdamage = 0;
 
-       return rdamage;
+       return min(rdamage,maxdamage);
 }
 
 void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss)
Viewed 454 times, submitted by unknown.