From ec28fdbe925a0a6d2ca18d2689ba2ae5a7405597 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Wed, 6 Aug 2014 16:08:06 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/map/battle.c | 32 +++++------ src/map/pc.c | 70 ++++++++++++------------ src/map/pc.h | 8 +-- src/map/skill.c | 162 +++++++++++++++++++++++++++---------------------------- src/map/status.c | 34 ++++++------ src/map/status.h | 2 +- 6 files changed, 154 insertions(+), 154 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index a83767728..82095b1cd 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1693,15 +1693,15 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block if( sc && sc->data[SC_CURSED_SOIL_OPTION] ) skillratio += sc->data[SC_CURSED_SOIL_OPTION]->val3; break; - case GN_DEMONIC_FIRE: { - int fire_expansion_lv = skill_lv / 100; - skill_lv = skill_lv % 100; - skillratio = 110 + 20 * skill_lv; - if ( fire_expansion_lv == 1 ) - skillratio += status_get_int(src) + (sd?sd->status.job_level:50); - else if ( fire_expansion_lv == 2 ) - skillratio += status_get_int(src) * 10; - } + case GN_DEMONIC_FIRE: { + int fire_expansion_lv = skill_lv / 100; + skill_lv = skill_lv % 100; + skillratio = 110 + 20 * skill_lv; + if ( fire_expansion_lv == 1 ) + skillratio += status_get_int(src) + (sd?sd->status.job_level:50); + else if ( fire_expansion_lv == 2 ) + skillratio += status_get_int(src) * 10; + } break; // Magical Elemental Spirits Attack Skills case EL_FIRE_MANTLE: @@ -5299,11 +5299,11 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl } else // Some skills like Weaponry Research will cause damage even if attack is dodged d.dmg_lv = ATK_DEF; - if(sd && d.damage+d.damage2>1) { - if(sd->bonus.sp_vanish_rate && sd->bonus.sp_vanish_trigger && rnd()%10000bonus.sp_vanish_rate && - ( (d.flag&sd->bonus.sp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.sp_vanish_trigger&BF_RANGEMASK) - || (d.flag&sd->bonus.sp_vanish_trigger&BF_SKILLMASK) )) - status_percent_damage(&sd->bl,target,0,-sd->bonus.sp_vanish_per,false); + if(sd && d.damage+d.damage2>1) { + if(sd->bonus.sp_vanish_rate && sd->bonus.sp_vanish_trigger && rnd()%10000bonus.sp_vanish_rate && + ( (d.flag&sd->bonus.sp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.sp_vanish_trigger&BF_RANGEMASK) + || (d.flag&sd->bonus.sp_vanish_trigger&BF_SKILLMASK) )) + status_percent_damage(&sd->bl,target,0,-sd->bonus.sp_vanish_per,false); } return d; } @@ -5529,8 +5529,8 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama } } - if (sd->bonus.sp_vanish_rate && rnd()%1000 < sd->bonus.sp_vanish_rate && !sd->bonus.sp_vanish_trigger) - status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->bonus.sp_vanish_per, false); + if (sd->bonus.sp_vanish_rate && rnd()%1000 < sd->bonus.sp_vanish_rate && !sd->bonus.sp_vanish_trigger) + status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->bonus.sp_vanish_per, false); if( sd->sp_gain_race_attack[race] ) tsp += sd->sp_gain_race_attack[race]; diff --git a/src/map/pc.c b/src/map/pc.c index 58a066edf..5a21c7df0 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2945,12 +2945,12 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->left_weapon.sp_drain[RC_BOSS].type = val; } break; - case SP_SP_VANISH_RATE: - if(sd->state.lr_flag != 2) { - sd->bonus.sp_vanish_rate += type2; - sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,val); - sd->bonus.sp_vanish_trigger=0; - } + case SP_SP_VANISH_RATE: + if(sd->state.lr_flag != 2) { + sd->bonus.sp_vanish_rate += type2; + sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,val); + sd->bonus.sp_vanish_trigger=0; + } break; case SP_GET_ZENY_NUM: if(sd->state.lr_flag != 2 && sd->bonus.get_zeny_rate < val) { @@ -3435,12 +3435,12 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) if (sd->state.lr_flag != 2) pc_bonus_subele(sd, (unsigned char)type2, type3, val); break; - case SP_SP_VANISH_RATE: - if(sd->state.lr_flag != 2) { - sd->bonus.sp_vanish_rate += type2; - sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,type3); - sd->bonus.sp_vanish_trigger=val; - } + case SP_SP_VANISH_RATE: + if(sd->state.lr_flag != 2) { + sd->bonus.sp_vanish_rate += type2; + sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,type3); + sd->bonus.sp_vanish_trigger=val; + } break; default: @@ -3483,28 +3483,28 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4 pc->bonus_addeff_onskill(sd->addeff3, ARRAYLENGTH(sd->addeff3), (sc_type)type3, type4, type2, val); break; - case SP_SET_DEF_RACE: //bonus4 bSetDefRace,n,x,r,y; - if( type2 > RC_MAX ) { - ShowWarning("pc_bonus4 (DEF_SET): %d is not supported.\n", type2); - break; - } - if(sd->state.lr_flag == 2) - break; - sd->def_set_race[type2].rate = type3; - sd->def_set_race[type2].tick = type4; - sd->def_set_race[type2].value = val; - break; - - case SP_SET_MDEF_RACE: //bonus4 bSetMDefRace,n,x,r,y; - if( type2 > RC_MAX ) { - ShowWarning("pc_bonus4 (MDEF_SET): %d is not supported.\n", type2); - break; - } - if(sd->state.lr_flag == 2) - break; - sd->mdef_set_race[type2].rate = type3; - sd->mdef_set_race[type2].tick = type4; - sd->mdef_set_race[type2].value = val; + case SP_SET_DEF_RACE: //bonus4 bSetDefRace,n,x,r,y; + if( type2 > RC_MAX ) { + ShowWarning("pc_bonus4 (DEF_SET): %d is not supported.\n", type2); + break; + } + if(sd->state.lr_flag == 2) + break; + sd->def_set_race[type2].rate = type3; + sd->def_set_race[type2].tick = type4; + sd->def_set_race[type2].value = val; + break; + + case SP_SET_MDEF_RACE: //bonus4 bSetMDefRace,n,x,r,y; + if( type2 > RC_MAX ) { + ShowWarning("pc_bonus4 (MDEF_SET): %d is not supported.\n", type2); + break; + } + if(sd->state.lr_flag == 2) + break; + sd->mdef_set_race[type2].rate = type3; + sd->mdef_set_race[type2].tick = type4; + sd->mdef_set_race[type2].value = val; break; default: @@ -9551,7 +9551,7 @@ int map_night_timer(int tid, int64 tick, int id, intptr_t data) { void pc_setstand(struct map_session_data *sd) { nullpo_retv(sd); - + status_change_end(&sd->bl, SC_TENSIONRELAX, INVALID_TIMER); clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_SIT); //Reset sitting tick. diff --git a/src/map/pc.h b/src/map/pc.h index aa92baf17..bec4522df 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -311,9 +311,9 @@ struct map_session_data { short flag, rate; unsigned char ele; } subele2[MAX_PC_BONUS]; - struct { - short value; - int rate, tick; + struct { + short value; + int rate, tick; } def_set_race[RC_MAX], mdef_set_race[RC_MAX]; // zeroed structures end here // manually zeroed structures start here. @@ -348,7 +348,7 @@ struct map_session_data { short add_heal_rate, add_heal2_rate; short sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value; short sp_vanish_rate; - short sp_vanish_per, sp_vanish_trigger; + short sp_vanish_per, sp_vanish_trigger; unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] unsigned short unbreakable_equip; //100% break resistance on certain equipment unsigned short unstripable_equip; diff --git a/src/map/skill.c b/src/map/skill.c index e31e8f61e..ca93a51aa 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -439,8 +439,8 @@ int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* b else if( sd->sc.data[SC__REPRODUCE] && !skill->reproduce_db[skill->get_index(skill_id)] ) return 0; - //Never copy new 3rd class skills By OmegaRed - if(skill_id >= GC_DARKCROW && skill_id <= ALL_FULL_THROTTLE) + //Never copy new 3rd class skills By OmegaRed + if(skill_id >= GC_DARKCROW && skill_id <= ALL_FULL_THROTTLE) return 0; return 1; @@ -1388,13 +1388,13 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 if( rate ) skill->break_equip(bl, EQP_ARMOR, rate, BCT_ENEMY); } - if (sd && !skill_id && bl->type == BL_PC) { // This effect does not work with skills. - if (sd->def_set_race[tstatus->race].rate) - status->change_start(src,bl, SC_DEFSET, sd->def_set_race[tstatus->race].rate, sd->def_set_race[tstatus->race].value, - 0, 0, 0, sd->def_set_race[tstatus->race].tick, 2); - if (sd->def_set_race[tstatus->race].rate) - status->change_start(src,bl, SC_MDEFSET, sd->mdef_set_race[tstatus->race].rate, sd->mdef_set_race[tstatus->race].value, - 0, 0, 0, sd->mdef_set_race[tstatus->race].tick, 2); + if (sd && !skill_id && bl->type == BL_PC) { // This effect does not work with skills. + if (sd->def_set_race[tstatus->race].rate) + status->change_start(src,bl, SC_DEFSET, sd->def_set_race[tstatus->race].rate, sd->def_set_race[tstatus->race].value, + 0, 0, 0, sd->def_set_race[tstatus->race].tick, 2); + if (sd->def_set_race[tstatus->race].rate) + status->change_start(src,bl, SC_MDEFSET, sd->mdef_set_race[tstatus->race].rate, sd->mdef_set_race[tstatus->race].value, + 0, 0, 0, sd->mdef_set_race[tstatus->race].tick, 2); } } @@ -3858,78 +3858,78 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); break; - case KN_BOWLINGBASH: - case MS_BOWLINGBASH: - { - int min_x,max_x,min_y,max_y,i,c,dir,tx,ty; - // Chain effect and check range gets reduction by recursive depth, as this can reach 0, we don't use blowcount - c = (skill_lv-(flag&0xFFF)+1)/2; - // Determine the Bowling Bash area depending on configuration - if (battle_config.bowling_bash_area == 0) { - // Gutter line system - min_x = ((src->x)-c) - ((src->x)-c)%40; - if(min_x < 0) min_x = 0; - max_x = min_x + 39; - min_y = ((src->y)-c) - ((src->y)-c)%40; - if(min_y < 0) min_y = 0; - max_y = min_y + 39; - } else if (battle_config.bowling_bash_area == 1) { - // Gutter line system without demi gutter bug - min_x = src->x - (src->x)%40; - max_x = min_x + 39; - min_y = src->y - (src->y)%40; - max_y = min_y + 39; - } else { - // Area around caster - min_x = src->x - battle_config.bowling_bash_area; - max_x = src->x + battle_config.bowling_bash_area; - min_y = src->y - battle_config.bowling_bash_area; - max_y = src->y + battle_config.bowling_bash_area; - } - // Initialization, break checks, direction - if((flag&0xFFF) > 0) { - // Ignore monsters outside area - if(bl->x < min_x || bl->x > max_x || bl->y < min_y || bl->y > max_y) - break; - // Ignore monsters already in list - if(idb_exists(skill->bowling_db, bl->id)) - break; - // Random direction - dir = rnd()%8; - } else { - // Create an empty list of already hit targets - db_clear(skill->bowling_db); - // Direction is walkpath - dir = (unit->getdir(src)+4)%8; - } - // Add current target to the list of already hit targets - idb_put(skill->bowling_db, bl->id, bl); - // Keep moving target in direction square by square - tx = bl->x; - ty = bl->y; - for(i=0;igetcell(bl->m,tx,ty,CELL_CHKWALL)) - break; - skill_blown(src,bl,1,dir,0); - // Splash around target cell, but only cells inside area; we first have to check the area is not negative - if((max(min_x,tx-1) <= min(max_x,tx+1)) && - (max(min_y,ty-1) <= min(max_y,ty+1)) && - (map->foreachinarea(skill->area_sub, bl->m, max(min_x,tx-1), max(min_y,ty-1), min(max_x,tx+1), min(max_y,ty+1), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->area_sub_count))) { - // Recursive call - map->foreachinarea(skill->area_sub, bl->m, max(min_x,tx-1), max(min_y,ty-1), min(max_x,tx+1), min(max_y,ty+1), splash_target(src), src, skill_id, skill_lv, tick, (flag|BCT_ENEMY)+1, skill->castend_damage_id); - // Self-collision - if(bl->x >= min_x && bl->x <= max_x && bl->y >= min_y && bl->y <= max_y) - skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,(flag&0xFFF)>0?SD_ANIMATION:0); - break; - } - } - // Original hit or chain hit depending on flag - skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,(flag&0xFFF)>0?SD_ANIMATION:0); - } + case KN_BOWLINGBASH: + case MS_BOWLINGBASH: + { + int min_x,max_x,min_y,max_y,i,c,dir,tx,ty; + // Chain effect and check range gets reduction by recursive depth, as this can reach 0, we don't use blowcount + c = (skill_lv-(flag&0xFFF)+1)/2; + // Determine the Bowling Bash area depending on configuration + if (battle_config.bowling_bash_area == 0) { + // Gutter line system + min_x = ((src->x)-c) - ((src->x)-c)%40; + if(min_x < 0) min_x = 0; + max_x = min_x + 39; + min_y = ((src->y)-c) - ((src->y)-c)%40; + if(min_y < 0) min_y = 0; + max_y = min_y + 39; + } else if (battle_config.bowling_bash_area == 1) { + // Gutter line system without demi gutter bug + min_x = src->x - (src->x)%40; + max_x = min_x + 39; + min_y = src->y - (src->y)%40; + max_y = min_y + 39; + } else { + // Area around caster + min_x = src->x - battle_config.bowling_bash_area; + max_x = src->x + battle_config.bowling_bash_area; + min_y = src->y - battle_config.bowling_bash_area; + max_y = src->y + battle_config.bowling_bash_area; + } + // Initialization, break checks, direction + if((flag&0xFFF) > 0) { + // Ignore monsters outside area + if(bl->x < min_x || bl->x > max_x || bl->y < min_y || bl->y > max_y) + break; + // Ignore monsters already in list + if(idb_exists(skill->bowling_db, bl->id)) + break; + // Random direction + dir = rnd()%8; + } else { + // Create an empty list of already hit targets + db_clear(skill->bowling_db); + // Direction is walkpath + dir = (unit->getdir(src)+4)%8; + } + // Add current target to the list of already hit targets + idb_put(skill->bowling_db, bl->id, bl); + // Keep moving target in direction square by square + tx = bl->x; + ty = bl->y; + for(i=0;igetcell(bl->m,tx,ty,CELL_CHKWALL)) + break; + skill_blown(src,bl,1,dir,0); + // Splash around target cell, but only cells inside area; we first have to check the area is not negative + if((max(min_x,tx-1) <= min(max_x,tx+1)) && + (max(min_y,ty-1) <= min(max_y,ty+1)) && + (map->foreachinarea(skill->area_sub, bl->m, max(min_x,tx-1), max(min_y,ty-1), min(max_x,tx+1), min(max_y,ty+1), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->area_sub_count))) { + // Recursive call + map->foreachinarea(skill->area_sub, bl->m, max(min_x,tx-1), max(min_y,ty-1), min(max_x,tx+1), min(max_y,ty+1), splash_target(src), src, skill_id, skill_lv, tick, (flag|BCT_ENEMY)+1, skill->castend_damage_id); + // Self-collision + if(bl->x >= min_x && bl->x <= max_x && bl->y >= min_y && bl->y <= max_y) + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,(flag&0xFFF)>0?SD_ANIMATION:0); + break; + } + } + // Original hit or chain hit depending on flag + skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,(flag&0xFFF)>0?SD_ANIMATION:0); + } break; case KN_SPEARSTAB: diff --git a/src/map/status.c b/src/map/status.c index df0f65fd7..5ad096c1d 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1002,7 +1002,7 @@ void initChangeTables(void) { status->ChangeFlagTable[SC_VITATA_500] |= SCB_REGEN; status->ChangeFlagTable[SC_EXTRACT_SALAMINE_JUICE] |= SCB_ASPD; status->ChangeFlagTable[SC_REBOUND] |= SCB_SPEED|SCB_REGEN; - status->ChangeFlagTable[SC_DEFSET] |= SCB_DEF|SCB_DEF2; + status->ChangeFlagTable[SC_DEFSET] |= SCB_DEF|SCB_DEF2; status->ChangeFlagTable[SC_MDEFSET] |= SCB_MDEF|SCB_MDEF2; status->ChangeFlagTable[SC_ALL_RIDING] = SCB_SPEED; @@ -2516,7 +2516,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { + sizeof(sd->skillfixcast) + sizeof(sd->skillvarcast) + sizeof(sd->skillfixcastrate) - + sizeof(sd->def_set_race) + + sizeof(sd->def_set_race) + sizeof(sd->mdef_set_race) ); @@ -4937,7 +4937,7 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def def += 2 * sc->data[SC_GENTLETOUCH_REVITALIZE]->val4; if( sc->data[SC_FORCEOFVANGUARD] ) def += def * 2 * sc->data[SC_FORCEOFVANGUARD]->val1 / 100; - if(sc->data[SC_DEFSET]) + if(sc->data[SC_DEFSET]) return sc->data[SC_DEFSET]->val1; return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX); } @@ -5013,7 +5013,7 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def if(status_get_race(bl)==RC_PLANT) def /= 2; } - if(sc->data[SC_UNLIMIT]) + if(sc->data[SC_UNLIMIT]) return 1; return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX); @@ -5036,7 +5036,7 @@ signed short status_calc_def2(struct block_list *bl, struct status_change *sc, i #endif if( sc && sc->data[SC_CAMOUFLAGE] ) def2 -= def2 * 5 * (10-sc->data[SC_CAMOUFLAGE]->val4) / 100; - if(sc->data[SC_DEFSET]) + if(sc->data[SC_DEFSET]) return sc->data[SC_DEFSET]->val1; #ifdef RENEWAL return (short)cap_value(def2,SHRT_MIN,SHRT_MAX); @@ -5084,7 +5084,7 @@ signed short status_calc_def2(struct block_list *bl, struct status_change *sc, i } if (sc->data[SC_NEEDLE_OF_PARALYZE]) def2 -= def2 * sc->data[SC_NEEDLE_OF_PARALYZE]->val2 / 100; - if (sc->data[SC_UNLIMIT]) + if (sc->data[SC_UNLIMIT]) return 1; #ifdef RENEWAL return (short)cap_value(def2,SHRT_MIN,SHRT_MAX); @@ -5101,7 +5101,7 @@ defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int md if( !viewable ){ /* some statuses that are hidden in the status window */ - if(sc->data[SC_MDEFSET]) + if(sc->data[SC_MDEFSET]) return sc->data[SC_MDEFSET]->val1; return (defType)cap_value(mdef,DEFTYPE_MIN,DEFTYPE_MAX); } @@ -5159,7 +5159,7 @@ signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, if( !viewable ){ /* some statuses that are hidden in the status window */ - if(sc->data[SC_MDEFSET]) + if(sc->data[SC_MDEFSET]) return sc->data[SC_MDEFSET]->val1; if(sc->data[SC_MINDBREAKER]) mdef2 -= mdef2 * sc->data[SC_MINDBREAKER]->val3/100; @@ -9001,11 +9001,11 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if(val2 == MH_MD_FIGHTING) val2 = MH_MD_GRAPPLING; else val2 = MH_MD_FIGHTING; break; - case SC_FULL_THROTTLE: + case SC_FULL_THROTTLE: status_percent_heal(bl,100,0); val2 = 7 - val1; - tick_time = 1000; - val4 = tick / tick_time; + tick_time = 1000; + val4 = tick / tick_time; break; case SC_KINGS_GRACE: val2 = 3 + val1; @@ -11253,12 +11253,12 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } break; - case SC_FULL_THROTTLE: - if( --(sce->val4) >= 0 ) { - status_percent_damage(bl, bl, 0, sce->val2, false); - sc_timer_next(1000 + tick, status->change_timer, bl->id, data); - return 0; - } + case SC_FULL_THROTTLE: + if( --(sce->val4) >= 0 ) { + status_percent_damage(bl, bl, 0, sce->val2, false); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); + return 0; + } break; case SC_KINGS_GRACE: if( --(sce->val4) > 0 ) { diff --git a/src/map/status.h b/src/map/status.h index c90efd2e0..670fce3bb 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -716,7 +716,7 @@ typedef enum sc_type { SC_FLASHCOMBO, //Vellum Weapon reductions - SC_DEFSET, + SC_DEFSET, SC_MDEFSET, SC_MAX, //Automatically updated max, used in for's to check we are within bounds. -- cgit v1.2.3-70-g09d2