diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-20 21:05:12 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-20 21:05:12 +0000 |
commit | 7ad5e84ef5c3c3d1192f07ee77a5a7d04a94c3bf (patch) | |
tree | 2e7149310776cfa9c9c6e55288db933f85421cd3 /src | |
parent | 2a0f10a6f77e1df9490f0181fb84f91e7591c412 (diff) | |
download | hercules-7ad5e84ef5c3c3d1192f07ee77a5a7d04a94c3bf.tar.gz hercules-7ad5e84ef5c3c3d1192f07ee77a5a7d04a94c3bf.tar.bz2 hercules-7ad5e84ef5c3c3d1192f07ee77a5a7d04a94c3bf.tar.xz hercules-7ad5e84ef5c3c3d1192f07ee77a5a7d04a94c3bf.zip |
- Added pc_check_weapontype to do a proper skill weapon check that takes into account dual-wielding. That is, if a skill can be used with daggers/axes, you'll be able to use the skill when dual-wielding them.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7779 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pc.c | 6 | ||||
-rw-r--r-- | src/map/pc.h | 3 | ||||
-rw-r--r-- | src/map/skill.c | 3 | ||||
-rw-r--r-- | src/map/status.c | 4 |
4 files changed, 11 insertions, 5 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index cfb3d86b7..75fc34b7e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3474,8 +3474,10 @@ int pc_checkallowskill(struct map_session_data *sd) for (i = 0; i < sizeof(scw_list)/sizeof(scw_list[0]); i++) { // Skills requiring specific weapon types - if(sd->sc.data[scw_list[i]].timer!=-1 && !(skill_get_weapontype(StatusSkillChangeTable[scw_list[i]])&(1<<sd->status.weapon))) - status_change_end(&sd->bl,scw_list[i],-1); + if(sd->sc.data[scw_list[i]].timer!=-1 && + !pc_check_weapontype(sd, + skill_get_weapontype(StatusSkillChangeTable[scw_list[i]]))) + status_change_end(&sd->bl,scw_list[i],-1); } if(sd->sc.data[SC_SPURT].timer!=-1 && sd->status.weapon) diff --git a/src/map/pc.h b/src/map/pc.h index b6d34a873..056aeb401 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -97,6 +97,9 @@ enum { #define pc_stop_attack(sd) { if (sd->ud.attacktimer!=-1) { unit_stop_attack(&sd->bl); sd->ud.target = 0; } }
#define pc_stop_walking(sd, type) { if (sd->ud.walktimer!=-1) unit_stop_walking(&sd->bl, type); }
+//Weapon check considering dual wielding.
+#define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \
+ 1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2)))
//Checks if the given class value corresponds to a player class. [Skotlex]
#define pcdb_checkid(class_) (class_ <= JOB_XMAS || (class_ >= JOB_NOVICE_HIGH && class_ <= JOB_SOUL_LINKER))
diff --git a/src/map/skill.c b/src/map/skill.c index 47500b7e8..34047b582 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -8362,7 +8362,8 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t clif_skill_fail(sd,skill,5,0); return 0; } - if(!(weapon & (1<<sd->status.weapon) ) ) { + + if(!pc_check_weapontype(sd,weapon)) { clif_skill_fail(sd,skill,6,0); return 0; } diff --git a/src/map/status.c b/src/map/status.c index ab0ccb0f0..8d24827ff 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4397,7 +4397,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val return 0; //Overthrust can't take effect if under Max Overthrust. [Skotlex] break; case SC_ADRENALINE: - if (sd && !(skill_get_weapontype(BS_ADRENALINE)&(1<<sd->status.weapon))) + if(sd && !pc_check_weapontype(sd,skill_get_weapontype(BS_ADRENALINE))) return 0; if (sc->data[SC_QUAGMIRE].timer!=-1 || sc->data[SC_DONTFORGETME].timer!=-1 || @@ -4406,7 +4406,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val return 0; break; case SC_ADRENALINE2: - if (sd && !(skill_get_weapontype(BS_ADRENALINE2)&(1<<sd->status.weapon))) + if(sd && !pc_check_weapontype(sd,skill_get_weapontype(BS_ADRENALINE2))) return 0; if (sc->data[SC_QUAGMIRE].timer!=-1 || sc->data[SC_DONTFORGETME].timer!=-1 || |