diff options
Diffstat (limited to 'src/map/status.c')
-rw-r--r-- | src/map/status.c | 244 |
1 files changed, 136 insertions, 108 deletions
diff --git a/src/map/status.c b/src/map/status.c index 718deaefc..746ca51e2 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -677,7 +677,7 @@ void initChangeTables(void) { set_sc_with_vfx( SO_DIAMONDDUST , SC_COLD , SI_COLD , SCB_NONE ); // it does show the snow icon on mobs but doesn't affect it. set_sc( SO_CLOUD_KILL , SC_POISON , SI_CLOUDKILL , SCB_NONE ); set_sc( SO_STRIKING , SC_STRIKING , SI_STRIKING , SCB_WATK|SCB_CRI ); - set_sc( SO_WARMER , SC_WARMER , SI_WARMER , SCB_NONE ); + add_sc( SO_WARMER , SC_WARMER ); // At the moment, no icon on officials set_sc( SO_VACUUM_EXTREME , SC_VACUUM_EXTREME , SI_VACUUM_EXTREME , SCB_NONE ); set_sc( SO_ARRULLO , SC_DEEP_SLEEP , SI_DEEPSLEEP , SCB_NONE ); set_sc( SO_FIRE_INSIGNIA , SC_FIRE_INSIGNIA , SI_FIRE_INSIGNIA , SCB_MATK | SCB_BATK | SCB_WATK | SCB_ATK_ELE | SCB_REGEN ); @@ -1004,6 +1004,7 @@ void initChangeTables(void) { status->ChangeFlagTable[SC_REBOUND] |= SCB_SPEED|SCB_REGEN; status->ChangeFlagTable[SC_DEFSET] |= SCB_DEF|SCB_DEF2; status->ChangeFlagTable[SC_MDEFSET] |= SCB_MDEF|SCB_MDEF2; + status->ChangeFlagTable[SC_MYSTERIOUS_POWDER] |= SCB_MAXHP; status->ChangeFlagTable[SC_ALL_RIDING] = SCB_SPEED; status->ChangeFlagTable[SC_WEDDING] = SCB_SPEED; @@ -1789,17 +1790,10 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin //If targeting, cloak+hide protect you, otherwise only hiding does. hide_flag = flag?OPTION_HIDE:(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK); - //You cannot hide from ground skills. - if( skill->get_ele(skill_id,1) == ELE_EARTH ) //TODO: Need Skill Lv here :/ + // There is no NF for ground skills, but every earth type skill out there + // affects hidding except Stone Curse + if( skill->get_ele(skill_id,1) == ELE_EARTH && skill_id != MG_STONECURSE) hide_flag &= ~OPTION_HIDE; - else { - switch ( skill_id ) { - case MO_ABSORBSPIRITS: // it works when already casted and target suddenly hides. - case SA_DISPELL: - hide_flag &= ~OPTION_HIDE; - break; - } - } switch( target->type ) { case BL_PC: { @@ -1810,6 +1804,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin return 0; if( tsc ) { if (tsc->option&hide_flag && !is_boss && + !(flag&1 && skill->get_nk(skill_id)&NK_NO_DAMAGE) && // Buff/debuff skills that started casting before hiding still applies ((sd->special_state.perfect_hiding || !is_detect) || (tsc->data[SC_CLOAKINGEXCEED] && is_detect))) return 0; @@ -1974,6 +1969,10 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_ //Normally only players have base-atk, but homunc have a different batk // equation, hinting that perhaps non-players should use this for batk. // [Skotlex] +#ifdef RENEWAL + if (bl->type == BL_HOM) + str = (int)(floor((rstr + dex + st->luk) / 3) + floor(((TBL_HOM*)bl)->homunculus.level / 10)); +#endif dstr = str/10; str += dstr*dstr; if (bl->type == BL_PC) @@ -2010,11 +2009,16 @@ void status_calc_misc(struct block_list *bl, struct status_data *st, int level) st->cri = st->flee2 = 0; #ifdef RENEWAL // renewal formulas - st->matk_min = st->matk_max = bl->type == BL_PC ? status->base_matk(st, level) : level + st->int_; - st->hit += level + st->dex + (bl->type == BL_PC ? st->luk/3 + 175 : 150); //base level + ( every 1 dex = +1 hit ) + (every 3 luk = +1 hit) + 175 - st->flee += level + st->agi + (bl->type == BL_PC ? st->luk/5 : 0) + 100; //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100 - st->def2 += (int)(((float)level + st->vit)/2 + ( bl->type == BL_PC ? ((float)st->agi/5) : 0 )); //base level + (every 2 vit = +1 def) + (every 5 agi = +1 def) - st->mdef2 += (int)( bl->type == BL_PC ?(st->int_ + ((float)level/4) + ((float)(st->dex+st->vit)/5)):((float)(st->int_ + level)/4)); //(every 4 base level = +1 mdef) + (every 1 int = +1 mdef) + (every 5 dex = +1 mdef) + (every 5 vit = +1 mdef) + if (bl->type == BL_HOM) { + st->hit = level + st->dex + 150; //base level + dex + 150 + st->flee = level + st->agi + level/10; //base level + agi + base level/10 + } else { + st->matk_min = st->matk_max = bl->type == BL_PC ? status->base_matk(st, level) : level + st->int_; + st->hit += level + st->dex + (bl->type == BL_PC ? st->luk/3 + 175 : 150); //base level + ( every 1 dex = +1 hit ) + (every 3 luk = +1 hit) + 175 + st->flee += level + st->agi + (bl->type == BL_PC ? st->luk/5 : 0) + 100; //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100 + st->def2 += (int)(((float)level + st->vit)/2 + ( bl->type == BL_PC ? ((float)st->agi/5) : 0 )); //base level + (every 2 vit = +1 def) + (every 5 agi = +1 def) + st->mdef2 += (int)( bl->type == BL_PC ?(st->int_ + ((float)level/4) + ((float)(st->dex+st->vit)/5)):((float)(st->int_ + level)/4)); //(every 4 base level = +1 mdef) + (every 1 int = +1 mdef) + (every 5 dex = +1 mdef) + (every 5 vit = +1 mdef) + } #else // not RENEWAL st->matk_min = status_base_matk_min(st); st->matk_max = status_base_matk_max(st); @@ -2169,7 +2173,7 @@ int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) { if (flag&2 && battle_config.mob_size_influence) { // change for sized monsters [Valaris] - if (md->special_state.size==SZ_SMALL) { + if (md->special_state.size==SZ_MEDIUM) { mstatus->max_hp>>=1; mstatus->max_sp>>=1; if (!mstatus->max_hp) mstatus->max_hp = 1; @@ -2475,13 +2479,13 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { //Give them all modes except these (useful for clones) bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK); - bstatus->size = (sd->class_&JOBL_BABY)?SZ_MEDIUM:SZ_SMALL; + bstatus->size = (sd->class_&JOBL_BABY)?SZ_SMALL:SZ_MEDIUM; if (battle_config.character_size && (pc_isriding(sd) || pc_isridingdragon(sd)) ) { //[Lupus] if (sd->class_&JOBL_BABY) { if (battle_config.character_size&SZ_BIG) bstatus->size++; } else - if(battle_config.character_size&SZ_SMALL) + if(battle_config.character_size&SZ_MEDIUM) bstatus->size++; } bstatus->aspd_rate = 1000; @@ -3293,11 +3297,26 @@ int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) { hstatus->hp = 1; hstatus->sp = 1; } + + hstatus->aspd_rate = 1000; + +#ifdef RENEWAL + hstatus->def = (hstatus->vit + (hom->level / 10)) + ((hstatus->agi + (hom->level / 10)) / 2); + hstatus->mdef = hstatus->int_ + ((hstatus->int_ + hstatus->dex + hstatus->luk) / 3) + (hom->level / 10) * 2; + + amotion = (1000 -2*hstatus->agi -hstatus->dex) * hd->homunculusDB->baseASPD/1000; +#else skill_lv = hom->level/10 + hstatus->vit/5; hstatus->def = cap_value(skill_lv, 0, 99); skill_lv = hom->level/10 + hstatus->int_/5; hstatus->mdef = cap_value(skill_lv, 0, 99); + amotion = (1000 -4*hstatus->agi - hstatus->dex) * hd->homunculusDB->baseASPD/1000; +#endif + + hstatus->amotion = cap_value(amotion,battle_config.max_aspd,2000); + hstatus->adelay = hstatus->amotion; //It seems adelay = amotion for Homunculus. + hstatus->max_hp = hom->max_hp; hstatus->max_sp = hom->max_sp; @@ -3323,14 +3342,10 @@ int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) { hd->battle_status.sp = hom->sp; } +#ifndef RENEWAL hstatus->rhw.atk = hstatus->dex; hstatus->rhw.atk2 = hstatus->str + hom->level; - - hstatus->aspd_rate = 1000; - - amotion = (1000 -4*hstatus->agi -hstatus->dex) * hd->homunculusDB->baseASPD/1000; - hstatus->amotion = cap_value(amotion,battle_config.max_aspd,2000); - hstatus->adelay = hstatus->amotion; //It seems adelay = amotion for Homunculus. +#endif status->calc_misc(&hd->bl, hstatus, hom->level); @@ -3699,12 +3714,12 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { } } - if( bl->type&BL_HOM ) { + /*if( bl->type&BL_HOM ) { st->rhw.atk += (st->dex - bst->dex); st->rhw.atk2 += (st->str - bst->str); if( st->rhw.atk2 < st->rhw.atk ) st->rhw.atk2 = st->rhw.atk; - } + }*/ } if(flag&SCB_HIT) { @@ -3917,7 +3932,11 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { st->adelay = 2*st->amotion; } else if( bl->type&BL_HOM ) { +#ifdef RENEWAL + amotion = (1000 - 2*st->agi - st->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD/1000; +#else amotion = (1000 - 4*st->agi - st->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD/1000; +#endif st->aspd_rate = status->calc_aspd_rate(bl, sc, bst->aspd_rate); if(st->aspd_rate != 1000) @@ -4006,8 +4025,12 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_ca if( bl->type == BL_PET ) return; // pets are not affected by statuses - if( opt&SCO_FIRST && bl->type == BL_MOB ) + if( opt&SCO_FIRST && bl->type == BL_MOB ) { +#ifdef RENEWAL + status->update_matk(bl); // Otherwise, the mob will spawn with lower MATK values +#endif return; // assume there will be no statuses active + } status->calc_bl_main(bl, flag); @@ -4591,7 +4614,7 @@ unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, watk += sc->data[SC_SHIELDSPELL_DEF]->val2; if(sc->data[SC_INSPIRATION]) watk += sc->data[SC_INSPIRATION]->val2; - if( sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 > 0 ) + if( sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 > 1 ) watk += (10 + 10 * sc->data[SC_BANDING]->val1) * (sc->data[SC_BANDING]->val2); if( sc->data[SC_TROPIC_OPTION] ) watk += sc->data[SC_TROPIC_OPTION]->val2; @@ -4684,8 +4707,6 @@ unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, if( !viewable ){ /* some statuses that are hidden in the status window */ - if (sc->data[SC_MINDBREAKER]) - matk += matk * sc->data[SC_MINDBREAKER]->val2/100; return (unsigned short)cap_value(matk,0,USHRT_MAX); } @@ -4710,6 +4731,8 @@ unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, if (sc->data[SC_IZAYOI]) matk += 25 * sc->data[SC_IZAYOI]->val1; #endif + if (sc->data[SC_MINDBREAKER]) + matk += matk * sc->data[SC_MINDBREAKER]->val2/100; if( sc->data[SC_ZANGETSU] ) matk += sc->data[SC_ZANGETSU]->val3; if (sc->data[SC_MAGICPOWER] && sc->data[SC_MAGICPOWER]->val4) @@ -5047,7 +5070,7 @@ signed short status_calc_def2(struct block_list *bl, struct status_change *sc, i return 0; if(sc->data[SC_SUN_COMFORT]) def2 += sc->data[SC_SUN_COMFORT]->val2; - if( sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 > 0 ) + if( sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 > 1 ) def2 += (5 + sc->data[SC_BANDING]->val1) * (sc->data[SC_BANDING]->val2); if(sc->data[SC_ANGELUS]) #ifdef RENEWAL //in renewal only the VIT stat bonus is boosted by angelus @@ -5402,7 +5425,25 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl skills1 = 5; } - if((sc->data[SC_BERSERK]) && skills1 < 15) + if( sc->data[SC_ASSNCROS] && skills1 < sc->data[SC_ASSNCROS]->val2){ + if (bl->type!=BL_PC) + skills1 = sc->data[SC_ASSNCROS]->val2; + else + switch(((TBL_PC*)bl)->status.weapon) + { + case W_BOW: + case W_REVOLVER: + case W_RIFLE: + case W_GATLING: + case W_SHOTGUN: + case W_GRENADE: + break; + default: + skills1 = sc->data[SC_ASSNCROS]->val2; + } + } + + if((sc->data[SC_BERSERK]) && skills1 < 15) skills1 = 15; else if(sc->data[SC_GS_MADNESSCANCEL] && skills1 < 20) skills1 = 20; @@ -5448,7 +5489,7 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl if( sc->data[SC_PAIN_KILLER] ) skills2 -= sc->data[SC_PAIN_KILLER]->val2; - if( sc->data[SC_SWING] ) + if( sc->data[SC_SWING] ) // TODO: SC_SWING shouldn't stack with skill1 modifiers skills2 += sc->data[SC_SWING]->val3; if( sc->data[SC_DANCE_WITH_WUG] ) skills2 += sc->data[SC_DANCE_WITH_WUG]->val3; @@ -5464,23 +5505,7 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl skills2 += sc->data[SC_GS_GATLINGFEVER]->val1; if( sc->data[SC_STAR_COMFORT] ) skills2 += 3 * sc->data[SC_STAR_COMFORT]->val1; - if( sc->data[SC_ASSNCROS] && !skills1){ - if (bl->type!=BL_PC) - skills2 += sc->data[SC_ASSNCROS]->val2; - else - switch(((TBL_PC*)bl)->status.weapon) - { - case W_BOW: - case W_REVOLVER: - case W_RIFLE: - case W_GATLING: - case W_SHOTGUN: - case W_GRENADE: - break; - default: - skills2 += sc->data[SC_ASSNCROS]->val2; - } - } + return ( flag&1? (skills1 + pots) : skills2 ); #else return 0; @@ -5569,6 +5594,7 @@ short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int max = sc->data[SC_ASSNCROS]->val2; } } + aspd_rate -= max; if(sc->data[SC_BERSERK]) @@ -6285,9 +6311,12 @@ void status_change_init(struct block_list *bl) { memset(sc, 0, sizeof (struct status_change)); } -//Applies SC defense to a given status change. -//Returns the adjusted duration based on flag values. -//the flag values are the same as in status->change_start. +/** + * Applies SC defense to a given status change. + * + * @see status_change_start for the expected parameters. + * @return the adjusted duration based on flag values. + */ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag) { //Percentual resistance: 10000 = 100% Resist //Example: 50% -> sc_def=5000 -> 25%; 5000ms -> tick_def=5000 -> 2500ms @@ -6336,12 +6365,6 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ case SC_QUAGMIRE: case SC_NJ_SUITON: case SC_SWING: - case SC__ENERVATION: - case SC__GROOMY: - case SC__IGNORANCE: - case SC__LAZINESS: - case SC__UNLUCKY: - case SC__WEAKNESS: return 0; } @@ -6381,9 +6404,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ case SC_STUN: sc_def = st->vit*100; sc_def2 = st->luk*10 + SCDEF_LVL_DIFF(bl, src, 99, 10); -#ifdef RENEWAL tick_def2 = st->luk*10; -#endif break; case SC_POISON: case SC_DPOISON: @@ -6403,24 +6424,29 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ #ifdef RENEWAL sc_def = st->int_*100; sc_def2 = (st->vit + st->luk) * 5 + SCDEF_LVL_DIFF(bl, src, 99, 10); - tick_def2 = st->luk * 10; #else sc_def = st->vit*100; sc_def2 = st->luk*10 + SCDEF_LVL_DIFF(bl, src, 99, 10); #endif + tick_def2 = st->luk * 10; break; case SC_BLOODING: #ifdef RENEWAL sc_def = st->agi*100; - tick_def2 = st->luk*10; #else sc_def = st->vit*100; #endif sc_def2 = st->luk*10 + SCDEF_LVL_DIFF(bl, src, 99, 10); + tick_def2 = st->luk*10; break; case SC_SLEEP: +#ifdef RENEWAL + sc_def = st->agi*100; + sc_def2 = (st->int_ + st->luk) * 5 + SCDEF_LVL_DIFF(bl, src, 99, 10); +#else sc_def = st->int_*100; sc_def2 = st->luk*10 + SCDEF_LVL_DIFF(bl, src, 99, 10); +#endif tick_def2 = st->luk*10; break; case SC_DEEP_SLEEP: @@ -6434,7 +6460,6 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ sc_def = st->mdef*100; #ifndef RENEWAL sc_def2 = st->luk*10; - tick_def2 = 0; //No duration reduction #endif tick_def = 0; //No duration reduction break; @@ -6452,11 +6477,6 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ // Special property: immunity when luk is zero if (st->luk == 0) return 0; -#ifndef RENEWAL - // Special property: immunity when luk is greater than level - if (st->luk > status->get_lv(bl)) - return 0; -#endif sc_def = st->luk*100; sc_def2 = st->luk*10 + SCDEF_LVL_DIFF(NULL, src, 99, 10); // Curse only has a level penalty and no resistance tick_def = st->vit*100; @@ -6589,7 +6609,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ tick_def = sc_def; //Natural resistance - if (!(flag&8)) { + if (!(flag&SCFLAG_FIXEDRATE)) { rate -= rate*sc_def/10000; rate -= sc_def2; @@ -6623,7 +6643,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ if (tick < 1) return 1; //Rate reduction - if (flag&2) + if (flag&SCFLAG_FIXEDTICK) return tick; tick -= tick*tick_def/10000; @@ -6710,17 +6730,23 @@ void status_display_remove(struct map_session_data *sd, enum sc_type type) { } } } -/*========================================== -* Starts a status change. -* 'type' = type, 'val1~4' depend on the type. -* 'rate' = base success rate. 10000 = 100% -* 'tick' is base duration -* 'flag': -* &1: Cannot be avoided (it has to start) -* &2: Tick should not be reduced (by vit, luk, lv, etc) -* &4: sc_data loaded, no value has to be altered. -* &8: SI will not be sent to the client -*------------------------------------------*/ +/** + * Starts a status change. + * + * @param src Status change source bl. + * @param bl Status change target bl. + * @param type Status change type. + * @param rate Base success rate. 1 means 0.01%, 10000 means 100%. + * @param val1 Additional value (meaning depends on type). + * @param val2 Additional value (meaning depends on type). + * @param val3 Additional value (meaning depends on type). + * @param val4 Additional value (meaning depends on type). + * @param tick Base duration (milliseconds). + * @param flag Special flags (@see enum scstart_flag). + * + * @retval 0 if no status change happened. + * @retval 1 if the status change was successfully applied. + */ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int flag) { struct map_session_data *sd = NULL; struct status_change* sc; @@ -6823,7 +6849,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t sd = BL_CAST(BL_PC, bl); //Adjust tick according to status resistances - if( !(flag&(1|4)) ) { + if( !(flag&(SCFLAG_NOAVOID|SCFLAG_LOADED)) ) { tick = status->get_sc_def(src, bl, type, rate, tick, flag); if( !tick ) return 0; } @@ -6853,7 +6879,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t return 0; case SC_FREEZE: //Undead are immune to Freeze/Stone - if (undead_flag && !(flag&1)) + if (undead_flag && !(flag&SCFLAG_NOAVOID)) return 0; case SC_SLEEP: case SC_STUN: @@ -6962,7 +6988,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; //Strip skills, need to divest something or it fails. case SC_NOEQUIPWEAPON: - if (sd && !(flag&4)) { //apply sc anyway if loading saved sc_data + if (sd && !(flag&SCFLAG_LOADED)) { //apply sc anyway if loading saved sc_data int i; opt_flag = 0; //Reuse to check success condition. if(sd->bonus.unstripable_equip&EQP_WEAPON) @@ -6980,7 +7006,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_NOEQUIPSHIELD: if( val2 == 1 ) val2 = 0; //GX effect. Do not take shield off.. else - if (sd && !(flag&4)) { + if (sd && !(flag&SCFLAG_LOADED)) { int i; if(sd->bonus.unstripable_equip&EQP_SHIELD) return 0; @@ -6992,7 +7018,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC break; case SC_NOEQUIPARMOR: - if (sd && !(flag&4)) { + if (sd && !(flag&SCFLAG_LOADED)) { int i; if(sd->bonus.unstripable_equip&EQP_ARMOR) return 0; @@ -7004,7 +7030,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC break; case SC_NOEQUIPHELM: - if (sd && !(flag&4)) { + if (sd && !(flag&SCFLAG_LOADED)) { int i; if(sd->bonus.unstripable_equip&EQP_HELM) return 0; @@ -7117,7 +7143,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t } //Check for BOSS resistances - if(st->mode&MD_BOSS && !(flag&1)) { + if(st->mode&MD_BOSS && !(flag&SCFLAG_NOAVOID)) { if (type>=SC_COMMON_MIN && type <= SC_COMMON_MAX) return 0; switch (type) { @@ -7515,7 +7541,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t vd = status->get_viewdata(bl); calc_flag = status->ChangeFlagTable[type]; - if(!(flag&4)) { //&4 - Do not parse val settings when loading SCs + if(!(flag&SCFLAG_LOADED)) { // Do not parse val settings when loading SCs switch(type) { case SC_ADORAMUS: sc_start(src,bl,SC_BLIND,100,val1,skill->get_time(status->sc2skill(type),val1)); @@ -7526,16 +7552,16 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_ENDURE: val2 = 7; // Hit-count [Celest] - if( !(flag&1) && (bl->type&(BL_PC|BL_MER)) && !map_flag_gvg(bl->m) && !map->list[bl->m].flag.battleground && !val4 ) { + if( !(flag&SCFLAG_NOAVOID) && (bl->type&(BL_PC|BL_MER)) && !map_flag_gvg(bl->m) && !map->list[bl->m].flag.battleground && !val4 ) { struct map_session_data *tsd; if( sd ) { int i; for( i = 0; i < 5; i++ ) { if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) ) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, 9); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL); } } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, 9); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL); } //val4 signals infinite endure (if val4 == 2 it is infinite endure from Berserk) if( val4 ) @@ -7623,16 +7649,16 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_REFLECTSHIELD: val2=10+val1*3; // %Dmg reflected - if( !(flag&1) && (bl->type&(BL_PC|BL_MER)) ) { + if( !(flag&SCFLAG_NOAVOID) && (bl->type&(BL_PC|BL_MER)) ) { struct map_session_data *tsd; if( sd ) { int i; for( i = 0; i < 5; i++ ) { if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) ) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 9); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); } } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 9); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); } break; case SC_NOEQUIPWEAPON: @@ -7875,7 +7901,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_AUTOGUARD: - if( !(flag&1) ) { + if( !(flag&SCFLAG_NOAVOID) ) { struct map_session_data *tsd; int i,t; for( i = val2 = 0; i < val1; i++) { @@ -7887,17 +7913,17 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if( sd ) { for( i = 0; i < 5; i++ ) { if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) ) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 9); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); } } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 9); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); } } break; case SC_DEFENDER: - if (!(flag&1)) { + if (!(flag&SCFLAG_NOAVOID)) { val2 = 5 + 15*val1; //Damage reduction val3 = 0; // unused, previously speed adjustment val4 = 250 - 50*val1; //Aspd adjustment @@ -7908,7 +7934,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t for (i = 0; i < 5; i++) { //See if there are devoted characters, and pass the status to them. [Skotlex] if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i]))) - status->change_start(bl, &tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1); + status->change_start(bl, &tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,SCFLAG_NOAVOID); } } } @@ -8035,7 +8061,9 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t while( i >= 0 ) { type2 = types[i]; if( d_sc->data[type2] ) - status->change_start(bl, bl, type2, 10000, d_sc->data[type2]->val1, 0, 0, 0, skill->get_time(status->sc2skill(type2),d_sc->data[type2]->val1), (type2 != SC_DEFENDER) ? 8 : 0); + status->change_start(bl, bl, type2, 10000, d_sc->data[type2]->val1, 0, 0, 0, + skill->get_time(status->sc2skill(type2),d_sc->data[type2]->val1), + (type2 != SC_DEFENDER) ? SCFLAG_NOICON : SCFLAG_NONE); i--; } } @@ -8434,7 +8462,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t tick_time = 4000; // [GodLesZ] tick time break; case SC_PYREXIA: - status->change_start(src, bl,SC_BLIND,10000,val1,0,0,0,30000,3); // Blind status that last for 30 seconds + status->change_start(src, bl,SC_BLIND,10000,val1,0,0,0,30000,SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATE); // Blind status that last for 30 seconds val4 = tick / 3000; tick_time = 3000; // [GodLesZ] tick time break; @@ -8753,7 +8781,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t struct block_list * src2; val3 = st->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] % if( (src2 = map->id2bl(val2)) ){ - val4 = ( 200/status_get_int(src2) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level] + val4 = ( 200/status_get_int(src2)?status_get_int(src2):1 ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level] val2 = ( status_get_dex(src2)/4 + status_get_str(src2)/2 ) * val1 / 5; // ATK increase: ATK [{(Caster DEX / 4) + (Caster STR / 2)} x Skill Level / 5] } } @@ -9032,7 +9060,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t } } - /* values that must be set regardless of flag&4 e.g. val_flag */ + /* values that must be set regardless of SCFLAG_LOADED e.g. val_flag */ switch(type) { case SC_FIGHTINGSPIRIT: val_flag |= 1|2; @@ -9444,7 +9472,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t calc_flag&=~SCB_DYE; } - if(!(flag&8) && !(flag&4 && status->DisplayType[type])) + if(!(flag&SCFLAG_NOICON) && !(flag&SCFLAG_LOADED && status->DisplayType[type])) clif->status_change(bl,status->IconChangeTable[type],1,tick,(val_flag&1)?val1:1,(val_flag&2)?val2:0,(val_flag&4)?val3:0); /** @@ -11637,7 +11665,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) { data.val2 = sc->data[i]->val2; data.val3 = sc->data[i]->val3; data.val4 = sc->data[i]->val4; - status->change_start(src,bl,(sc_type)i,10000,data.val1,data.val2,data.val3,data.val4,data.tick,1|2); + status->change_start(src,bl,(sc_type)i,10000,data.val1,data.val2,data.val3,data.val4,data.tick,SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATE); flag = 1; } } |