From afcad494411995396b906f214d1c4ffcf485cc0a Mon Sep 17 00:00:00 2001 From: Haru Date: Wed, 25 Sep 2013 21:26:54 +0200 Subject: Renamed local variables that would conflict with a rename of iStatus to status Signed-off-by: Haru --- src/map/skill.c | 141 +++++++++++++++++++++++++++----------------------------- 1 file changed, 67 insertions(+), 74 deletions(-) (limited to 'src/map/skill.c') diff --git a/src/map/skill.c b/src/map/skill.c index 3669431f0..3e9817faf 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -688,7 +688,6 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint struct status_data *sstatus, *tstatus; struct status_change *sc, *tsc; - enum sc_type status; int temp; int rate; @@ -1074,9 +1073,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case LK_JOINTBEAT: - status = iStatus->skill2sc(skill_id); if (tsc->jb_flag) { - sc_start4(bl,status,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill->get_time2(skill_id,skill_lv)); + enum sc_type type = iStatus->skill2sc(skill_id); + sc_start4(bl,type,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill->get_time2(skill_id,skill_lv)); tsc->jb_flag = 0; } break; @@ -2155,8 +2154,7 @@ int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type) * flag&0x2000 is used to signal that the skill_lv should be passed as -1 to the * client (causes player characters to not scream skill name) *-------------------------------------------------------------------------*/ -int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) -{ +int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { struct Damage dmg; struct status_data *sstatus, *tstatus; struct status_change *sc; @@ -2263,11 +2261,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds dmg.damage = battle->attr_fix(bl, bl, dmg.damage, s_ele, status_get_element(bl), status_get_element_level(bl)); if( sc && sc->data[SC_ENERGYCOAT] ) { - struct status_data *status = iStatus->get_status_data(bl); - int per = 100*status->sp / status->max_sp -1; //100% should be counted as the 80~99% interval + struct status_data *st = iStatus->get_status_data(bl); + int per = 100*st->sp / st->max_sp -1; //100% should be counted as the 80~99% interval per /=20; //Uses 20% SP intervals. //SP Cost: 1% + 0.5% per every 20% SP - if (!iStatus->charge(bl, 0, (10+5*per)*status->max_sp/1000)) + if (!iStatus->charge(bl, 0, (10+5*per)*st->max_sp/1000)) status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER); //Reduction: 6% + 6% every 20% dmg.damage -= dmg.damage * (6 * (1+per)) / 100; @@ -2967,7 +2965,7 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i * &2: picked menu entry (Warp Portal, Teleport and other menu based skills) *------------------------------------------*/ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, int type) { - struct status_data *status; + struct status_data *st; struct map_session_data *sd = NULL; int i, hp, sp, hp_rate, sp_rate, state, mhp; uint16 idx; @@ -2983,7 +2981,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, case BL_MER: sd = ((TBL_MER*)bl)->master; break; } - status = iStatus->get_status_data(bl); + st = iStatus->get_status_data(bl); if( (idx = skill->get_index(skill_id)) == 0 ) return 0; @@ -2999,15 +2997,15 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, sp_rate = skill_db[idx].sp_rate[lv-1]; state = skill_db[idx].state; if( (mhp = skill_db[idx].mhp[lv-1]) > 0 ) - hp += (status->max_hp * mhp) / 100; + hp += (st->max_hp * mhp) / 100; if( hp_rate > 0 ) - hp += (status->hp * hp_rate) / 100; + hp += (st->hp * hp_rate) / 100; else - hp += (status->max_hp * (-hp_rate)) / 100; + hp += (st->max_hp * (-hp_rate)) / 100; if( sp_rate > 0 ) - sp += (status->sp * sp_rate) / 100; + sp += (st->sp * sp_rate) / 100; else - sp += (status->max_sp * (-sp_rate)) / 100; + sp += (st->max_sp * (-sp_rate)) / 100; if( bl->type == BL_HOM ) { // Intimacy Requeriments struct homun_data *hd = BL_CAST(BL_HOM, bl); @@ -3024,11 +3022,11 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, } if( !(type&2) ) { - if( hp > 0 && status->hp <= (unsigned int)hp ) { + if( hp > 0 && st->hp <= (unsigned int)hp ) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_HP_INSUFFICIENT, 0); return 0; } - if( sp > 0 && status->sp <= (unsigned int)sp ) { + if( sp > 0 && st->sp <= (unsigned int)sp ) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_SP_INSUFFICIENT, 0); return 0; } @@ -10497,14 +10495,13 @@ int skill_icewall_block(struct block_list *bl,va_list ap) { * Initializes and sets a ground skill. * flag&1 is used to determine when the skill 'morphs' (Warp portal becomes active, or Fire Pillar becomes active) *------------------------------------------*/ -struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag) -{ +struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag) { struct skill_unit_group *group; int i,limit,val1=0,val2=0,val3=0; int target,interval,range,unit_flag,req_item=0; struct s_skill_unit_layout *layout; struct map_session_data *sd; - struct status_data *status; + struct status_data *st; struct status_change *sc; int active_flag=1; int subunt=0; @@ -10527,7 +10524,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill } sd = BL_CAST(BL_PC, src); - status = iStatus->get_status_data(src); + st = iStatus->get_status_data(src); sc = iStatus->get_sc(src); // for traps, firewall and fogwall - celest switch( skill_id ) { @@ -10652,18 +10649,18 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill case BA_DISSONANCE: case DC_UGLYDANCE: - val1 = 10; //FIXME: This value is not used anywhere, what is it for? [Skotlex] + val1 = 10; //FIXME: This value is not used anywhere, what is it for? [Skotlex] break; case BA_WHISTLE: - val1 = skill_lv +status->agi/10; // Flee increase - val2 = ((skill_lv+1)/2)+status->luk/10; // Perfect dodge increase + val1 = skill_lv +st->agi/10; // Flee increase + val2 = ((skill_lv+1)/2)+st->luk/10; // Perfect dodge increase if(sd){ val1 += pc->checkskill(sd,BA_MUSICALLESSON); val2 += pc->checkskill(sd,BA_MUSICALLESSON); } break; case DC_HUMMING: - val1 = 2*skill_lv+status->dex/10; // Hit increase + val1 = 2*skill_lv+st->dex/10; // Hit increase #ifdef RENEWAL val1 *= 2; #endif @@ -10671,9 +10668,9 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill val1 += pc->checkskill(sd,DC_DANCINGLESSON); break; case BA_POEMBRAGI: - val1 = 3*skill_lv+status->dex/10; // Casting time reduction + val1 = 3*skill_lv+st->dex/10; // Casting time reduction //For some reason at level 10 the base delay reduction is 50%. - val2 = (skill_lv<10?3*skill_lv:50)+status->int_/5; // After-cast delay reduction + val2 = (skill_lv<10?3*skill_lv:50)+st->int_/5; // After-cast delay reduction if(sd){ val1 += 2*pc->checkskill(sd,BA_MUSICALLESSON); val2 += 2*pc->checkskill(sd,BA_MUSICALLESSON); @@ -10681,11 +10678,11 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill break; case DC_DONTFORGETME: #ifdef RENEWAL - val1 = status->dex/10 + 3*skill_lv; // ASPD decrease - val2 = status->agi/10 + 2*skill_lv; // Movement speed adjustment. + val1 = st->dex/10 + 3*skill_lv; // ASPD decrease + val2 = st->agi/10 + 2*skill_lv; // Movement speed adjustment. #else - val1 = status->dex/10 + 3*skill_lv + 5; // ASPD decrease - val2 = status->agi/10 + 3*skill_lv + 5; // Movement speed adjustment. + val1 = st->dex/10 + 3*skill_lv + 5; // ASPD decrease + val2 = st->agi/10 + 3*skill_lv + 5; // Movement speed adjustment. #endif if(sd){ val1 += pc->checkskill(sd,DC_DANCINGLESSON); @@ -10693,13 +10690,13 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill } break; case BA_APPLEIDUN: - val1 = 5+2*skill_lv+status->vit/10; // MaxHP percent increase + val1 = 5+2*skill_lv+st->vit/10; // MaxHP percent increase if(sd) val1 += pc->checkskill(sd,BA_MUSICALLESSON); break; case DC_SERVICEFORYOU: - val1 = 15+skill_lv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed - val2 = 20+3*skill_lv+(status->int_/10); // SP cost reduction + val1 = 15+skill_lv+(st->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed + val2 = 20+3*skill_lv+(st->int_/10); // SP cost reduction if(sd){ val1 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed val2 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value @@ -10707,17 +10704,17 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill break; case BA_ASSASSINCROSS: #ifdef RENEWAL - val1 = 10 + skill_lv + (status->agi/10); // ASPD increase + val1 = 10 + skill_lv + (st->agi/10); // ASPD increase if(sd) val1 += 4*pc->checkskill(sd,BA_MUSICALLESSON); #else - val1 = 100+(10*skill_lv)+(status->agi/10); // ASPD increase + val1 = 100+(10*skill_lv)+(st->agi/10); // ASPD increase if(sd) val1 += 5*pc->checkskill(sd,BA_MUSICALLESSON); #endif break; case DC_FORTUNEKISS: - val1 = 10+skill_lv+(status->luk/10); // Critical increase + val1 = 10+skill_lv+(st->luk/10); // Critical increase if(sd) val1 += pc->checkskill(sd,DC_DANCINGLESSON); val1*=10; //Because every 10 crit is an actual cri point. @@ -10765,7 +10762,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill { int element[5]={ELE_WIND,ELE_DARK,ELE_POISON,ELE_WATER,ELE_FIRE}; - val1 = status->rhw.ele; + val1 = st->rhw.ele; if (!val1) val1=element[rnd()%5]; @@ -12334,7 +12331,7 @@ int skill_isammotype (struct map_session_data *sd, int skill_id) } int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) { - struct status_data *status; + struct status_data *st; struct status_change *sc; struct skill_condition require; int i; @@ -12370,7 +12367,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; break; } - status = &sd->battle_status; + st = &sd->battle_status; sc = &sd->sc; if( !sc->count ) sc = NULL; @@ -12695,9 +12692,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; //Auron insists we should implement SP consumption when you are not Soul Linked. [Skotlex] //Only invoke on skill begin cast (instant cast skill). [Kevin] - if( require.sp > 0 ) - { - if (status->sp < (unsigned int)require.sp) + if( require.sp > 0 ) { + if (st->sp < (unsigned int)require.sp) clif->skill_fail(sd,skill_id,USESKILL_FAIL_SP_INSUFFICIENT,0); else status_zap(&sd->bl, 0, require.sp); @@ -12725,9 +12721,9 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case NJ_ISSEN: #ifdef RENEWAL - if (status->hp < (status->hp/100)) { + if (st->hp < (st->hp/100)) { #else - if (status->hp < 2) { + if (st->hp < 2) { #endif clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; @@ -12747,7 +12743,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } break; case PF_HPCONVERSION: - if (status->sp == status->max_sp) + if (st->sp == st->max_sp) return 0; //Unusable when at full SP. break; case AM_CALLHOMUN: //Can't summon if a hom is already out @@ -13162,7 +13158,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; } - if(require.mhp > 0 && get_percentage(status->hp, status->max_hp) > require.mhp) { + if(require.mhp > 0 && get_percentage(st->hp, st->max_hp) > require.mhp) { //mhp is the max-hp-requirement, that is, //you must have this % or less of HP to cast it. clif->skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0); @@ -13174,7 +13170,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; } - if( require.sp > 0 && status->sp < (unsigned int)require.sp) { + if( require.sp > 0 && st->sp < (unsigned int)require.sp) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_SP_INSUFFICIENT,0); return 0; } @@ -13216,10 +13212,9 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 1; } -int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) -{ +int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) { struct skill_condition require; - struct status_data *status; + struct status_data *st; int i; int index[MAX_SKILL_ITEM_REQUIRE]; @@ -13322,11 +13317,11 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, break; } - status = &sd->battle_status; + st = &sd->battle_status; require = skill->get_requirement(sd,skill_id,skill_lv); - if( require.hp > 0 && status->hp <= (unsigned int)require.hp) { + if( require.hp > 0 && st->hp <= (unsigned int)require.hp) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0); return 0; } @@ -13489,10 +13484,9 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin return 1; } -struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) -{ +struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) { struct skill_condition req; - struct status_data *status; + struct status_data *st; struct status_change *sc; int i,hp_rate,sp_rate, sp_skill_rate_bonus = 100; uint16 idx; @@ -13528,23 +13522,23 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 if( skill_lv < 1 || skill_lv > MAX_SKILL_LEVEL ) return req; - status = &sd->battle_status; + st = &sd->battle_status; req.hp = skill_db[idx].hp[skill_lv-1]; hp_rate = skill_db[idx].hp_rate[skill_lv-1]; if(hp_rate > 0) - req.hp += (status->hp * hp_rate)/100; + req.hp += (st->hp * hp_rate)/100; else - req.hp += (status->max_hp * (-hp_rate))/100; + req.hp += (st->max_hp * (-hp_rate))/100; req.sp = skill_db[idx].sp[skill_lv-1]; if((sd->skill_id_old == BD_ENCORE) && skill_id == sd->skill_id_dance) req.sp /= 2; sp_rate = skill_db[idx].sp_rate[skill_lv-1]; if(sp_rate > 0) - req.sp += (status->sp * sp_rate)/100; + req.sp += (st->sp * sp_rate)/100; else - req.sp += (status->max_sp * (-sp_rate))/100; + req.sp += (st->max_sp * (-sp_rate))/100; if( sd->dsprate != 100 ) req.sp = req.sp * sd->dsprate / 100; @@ -16018,16 +16012,15 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, /*========================================== * *------------------------------------------*/ -int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) -{ +int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) { int slot[3]; int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skill_lv = 0; int num = -1; // exclude the recipe - struct status_data *status; + struct status_data *st; struct item_data* data; nullpo_ret(sd); - status = iStatus->get_status_data(&sd->bl); + st = iStatus->get_status_data(&sd->bl); if( sd->skill_id_old == skill_id ) skill_lv = sd->skill_lv_old; @@ -16125,7 +16118,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, case BS_ENCHANTEDSTONE: // Ores & Metals Refining - skill bonuses are straight from kRO website [DracoRPG] i = pc->checkskill(sd,skill_id); - make_per = sd->status.job_level*20 + status->dex*10 + status->luk*10; //Base chance + make_per = sd->status.job_level*20 + st->dex*10 + st->luk*10; //Base chance switch(nameid){ case 998: // Iron make_per += 4000+i*500; // Temper Iron bonus: +26/+32/+38/+44/+50 @@ -16142,7 +16135,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, } break; case ASC_CDP: - make_per = (2000 + 40*status->dex + 20*status->luk); + make_per = (2000 + 40*st->dex + 20*st->luk); break; case AL_HOLYWATER: /** @@ -16157,7 +16150,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, case AM_TWILIGHT3: make_per = pc->checkskill(sd,AM_LEARNINGPOTION)*50 + pc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20 - + (status->int_/2)*10 + status->dex*10+status->luk*10; + + (st->int_/2)*10 + st->dex*10+st->luk*10; if(homun_alive(sd->hd)) {//Player got a homun int skill2_lv; if((skill2_lv=homun->checkskill(sd->hd,HVAN_INSTRUCT)) > 0) //His homun is a vanil with instruction change @@ -16205,7 +16198,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, case RK_RUNEMASTERY: { int A = 5100 + 200 * pc->checkskill(sd, skill_id); - int B = 10 * status->dex / 3 + (status->luk + sd->status.job_level); + int B = 10 * st->dex / 3 + (st->luk + sd->status.job_level); int C = 100 * cap_value(sd->itemid,0,100); //itemid depend on makerune() int D = 2500; switch (nameid) { //rune rank it_diff 9 craftable rune @@ -16252,7 +16245,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, difficulty = (620 - 20 * skill_lv);// (620 - 20 * Skill Level) - make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) + + make_per = st->int_ + st->dex/2 + st->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) + (sd->status.base_level-100) + pc->checkskill(sd, AM_LEARNINGPOTION) + pc->checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10) switch(nameid){// difficulty factor @@ -16294,7 +16287,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, { int difficulty = 30 + rnd()%120; // Random number between (30 ~ 150) - make_per = sd->status.job_level / 4 + status->luk / 2 + status->dex / 3; // (Caster?s Job Level / 4) + (Caster?s LUK / 2) + (Caster?s DEX / 3) + make_per = sd->status.job_level / 4 + st->luk / 2 + st->dex / 3; // (Caster?s Job Level / 4) + (Caster?s LUK / 2) + (Caster?s DEX / 3) qty = ~(5 + rnd()%5) + 1; switch(nameid){// difficulty factor @@ -16342,10 +16335,10 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, else make_per = 1200 * (sd->menuskill_val - 10) + 20 * (sd->status.base_level + 1) - + 20 * (status->dex + 1) + + 20 * (st->dex + 1) + 100 * (rnd()%(30+5*(sd->cook_mastery/400) - (6+sd->cook_mastery/80)) + (6+sd->cook_mastery/80)) - 400 * (skill_produce_db[idx].itemlv - 11 + 1) - - 10 * (100 - status->luk + 1) + - 10 * (100 - st->luk + 1) - 500 * (num - 1) - 100 * (rnd()%4 + 1); break; @@ -16354,7 +16347,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, break; } } else { // Weapon Forging - skill bonuses are straight from kRO website, other things from a jRO calculator [DracoRPG] - make_per = 5000 + sd->status.job_level*20 + status->dex*10 + status->luk*10; // Base + make_per = 5000 + sd->status.job_level*20 + st->dex*10 + st->luk*10; // Base make_per += pc->checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15 make_per += pc->checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? pc->checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5 make_per -= (ele?2000:0) + sc*1500 + (wlv>1?wlv*1000:0); // Element Stone: -20%, Star Crumb: -15% each, Weapon level malus: -0/-20/-30 -- cgit v1.2.3-70-g09d2