summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-12-02 16:00:08 +0100
committerHaru <haru@dotalux.com>2016-12-03 15:38:56 +0100
commit76801cdf48a979728034cb81b81c989f7f655f5a (patch)
tree0c7ab7e9170515c982399df7eda3bd2577521a06 /src/map/battle.c
parentcfa4ae95efca5557d085c56815259f47e6f380fb (diff)
downloadhercules-76801cdf48a979728034cb81b81c989f7f655f5a.tar.gz
hercules-76801cdf48a979728034cb81b81c989f7f655f5a.tar.bz2
hercules-76801cdf48a979728034cb81b81c989f7f655f5a.tar.xz
hercules-76801cdf48a979728034cb81b81c989f7f655f5a.zip
Clarify some Job Class vs MapID confusion (2/2)
This commit ensures that `sd->job` and related variables only contain MapIDs (i.e. the serverside optimized values, where High Novice is MAPID_NOVICE | JOBL_UPPER) and are never checked against the client-based Job Class values. As a rule of thumb, from now on, when a variable is named `job` or `jobid`, it is intended to contain a MapID and not a Job Class ID. The type of such variable shall be an unsigned `uint16` or `uint32`. To ensure that related third party code is also verified when this commit is merged, the variable `struct map_session_data::class_ (i.e. `sd->class_`) is renamed to `job`. Some issues in related lines are also fixed, including: - The atcommand `@mount` would not check properly that the requesting character is a 2nd class Swordsman type. - `pc->addfame()` would silently accept invalid MapIDs, sending unknown values to the client (more on this in a subsequent commit). - `pc->famerank()` would not use the passed job as a bitmask, causing the caller to have to mask it beforehand (more on this in a subsequent commit). - The Soul Linker check in TK_JUMPKICK wasn't future-proof (no harm caused currently). - Gunslingers would be able to be targeted by Spiritual Bestowment (`MO_KITRANSLATION`) and Spiritual Sphere Absorption (`MO_ABSORBSPIRITS`) due to a faulty check introduced when the Rebellion class was implemented (causing unintended interaction with Coins). Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 812d588aa..bb20b94ff 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -892,7 +892,7 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
damage += damage * ratio / 100;
}
- if ((sd->class_ & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) {
+ if ((sd->job & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) {
if((skill2_lv = pc->checkskill(sd,AB_EUCHARISTICA)) > 0 &&
(tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) )
damage += damage * skill2_lv / 100;
@@ -3760,7 +3760,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
//Constant/misc additions from skills
if (skill_id == WZ_FIREPILLAR)
MATK_ADD(100+50*skill_lv);
- if (sd != NULL && (sd->class_ & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) {
+ if (sd != NULL && (sd->job & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) {
int eucharistica_level = pc->checkskill(sd,AB_EUCHARISTICA);
if (eucharistica_level > 0 && (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK))
MATK_ADDRATE(eucharistica_level);
@@ -5566,13 +5566,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
//Dual-wield
if (wd.damage) {
temp = pc->checkskill(sd,AS_RIGHT) * 10;
- if( (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO )
+ if ((sd->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO)
temp = pc->checkskill(sd,KO_RIGHT) * 10 + 20;
ATK_RATER( 50 + temp );
}
if (wd.damage2) {
temp = pc->checkskill(sd,AS_LEFT) * 10;
- if( (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO )
+ if ((sd->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO)
temp = pc->checkskill(sd,KO_LEFT) * 10 + 20;
ATK_RATEL( 30 + temp );
}
@@ -6842,8 +6842,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
const struct map_session_data *s_sd = BL_UCCAST(BL_PC, s_bl);
const struct map_session_data *t_sd = BL_UCCAST(BL_PC, t_bl);
if (
- (s_sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE ||
- (t_sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE ||
+ (s_sd->job & MAPID_UPPERMASK) == MAPID_NOVICE ||
+ (t_sd->job & MAPID_UPPERMASK) == MAPID_NOVICE ||
s_sd->status.base_level < battle_config.pk_min_level ||
t_sd->status.base_level < battle_config.pk_min_level ||
(battle_config.pk_level_range && abs(s_sd->status.base_level - t_sd->status.base_level) > battle_config.pk_level_range)