viewing paste Unknown #5754 | C

Posted on the | Last edited on
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
static struct Damage battle_calc_multi_attack(struct Damage wd, struct block_list *src,struct block_list *target, uint16 skill_id, uint16 skill_lv, int wflag)
{
    struct map_session_data *sd = BL_CAST(BL_PC, src);
    struct map_session_data *tsd = BL_CAST(BL_PC, target);
    struct status_change *sc = status_get_sc(src);
    struct status_change *tsc = status_get_sc(target);
    struct status_data *sstatus = status_get_status_data(src);
    struct status_data *tstatus = status_get_status_data(target);
    int i;
 
    if( sd && !skill_id ) { //Check for double attack.
        if( ( ( skill_lv = pc_checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER )
            || ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed
            || ( sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST )) // Need confirmation
        {   //Success chance is not added, the higher one is used [Skotlex]
            if( rnd()%100 < ( 5*skill_lv > sd->bonus.double_rate ? 5*skill_lv : sc && sc->data[SC_KAGEMUSYA]?sc->data[SC_KAGEMUSYA]->val1*3:sd->bonus.double_rate ) )
            {
                wd.div_ = skill_get_num(TF_DOUBLE,skill_lv?skill_lv:1);
                wd.type = 0x08;
            }
        }
        else if( sd->weapontype1 == W_REVOLVER && (skill_lv = pc_checkskill(sd,GS_CHAINACTION)) > 0 && rnd()%100 < 5*skill_lv )
        {
            wd.div_ = skill_get_num(GS_CHAINACTION,skill_lv);
            wd.type = 0x08;
        }
        else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW
            && (i = sd->equip_index[EQI_AMMO]) >= 0 && sd->inventory_data[i] && sd->status.inventory[i].amount > 1){
                int chance = rnd()%100;
                wd.type = 0x08;
                switch(sc->data[SC_FEARBREEZE]->val1){
                    //don't break between case, used for fallback
                    case 5: if( chance < 3){ wd.div_ = 5; break; } // 3 % chance to attack 5 times.
                    case 4: if( chance < 6){ wd.div_ = 4; break; } // 6 % chance to attack 4 times.
                    case 3: if( chance < 9){ wd.div_ = 3; break; } // 9 % chance to attack 3 times.
                    case 2:
                    case 1: if( chance < 12){ wd.div_ = 2; break; } // 12 % chance to attack 2 times.
                }
                wd.div_ = min(wd.div_,sd->status.inventory[i].amount);
                sc->data[SC_FEARBREEZE]->val4 = wd.div_-1;
        }
    }
    else switch(skillid){
        case RA_AIMEDBOLT:
            if( tsc && (tsc->data[SC_BITE] || tsc->data[SC_ANKLE] || tsc->data[SC_ELECTRICSHOCKER]) )
                wd.div_ = tstatus->size + 2 + ( (rnd()%100 < 50-tstatus->size*10) ? 1 : 0 );
            break;
        case KO_JYUMONJIKIRI:
            if( tsc && tsc->data[SC_JYUMONJIKIRI] )
                wd.div_ = wd.div_ * -1;// needs more info
            break;
        case NJ_ISSEN:
            if( sc && sc->data[SC_BUNSINJYUTSU] && (i=sc->data[SC_BUNSINJYUTSU]->val2) > 0)
                wd.div_ = -( i + 2 ); // mirror image number of hits + 2
            break;
        case MH_SONIC_CRAW:{
                TBL_HOM *hd = BL_CAST(BL_HOM,src);
                wd.div_ = hd->homunculus.spiritball;
            }
            break;
        case MO_FINGEROFFENSIVE:
            if(sd) wd.div_ =  (battle_config.finger_offensive_type)?1:sd->spiritball_old;
            break;
        case KN_PIERCE:
        case ML_PIERCE:
            wd.div_= (wd.div_>0?tstatus->size+1:-(tstatus->size+1));
            break;
        default:
            wd.div_ = skill_get_num(skillid,skill_lv);
    }
    return wd;
}
Viewed 1022 times, submitted by lighta.