diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-05 19:27:00 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-05 19:27:00 +0000 |
commit | 227241c01c9b1a8f22bd75f670c8d97c273a1e9b (patch) | |
tree | f8a9e12d8b1bac9b4410830b84a67cd196bf5a1c /src | |
parent | 7e0f93b9fc2b11674d6488b5fd10e638552209ce (diff) | |
download | hercules-227241c01c9b1a8f22bd75f670c8d97c273a1e9b.tar.gz hercules-227241c01c9b1a8f22bd75f670c8d97c273a1e9b.tar.bz2 hercules-227241c01c9b1a8f22bd75f670c8d97c273a1e9b.tar.xz hercules-227241c01c9b1a8f22bd75f670c8d97c273a1e9b.zip |
- Added a define list for weapon types in pc.h
- Cleaned up pc_checkallowskill and moved the Gatling fever check to it.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5912 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 78 | ||||
-rw-r--r-- | src/map/pc.c | 88 | ||||
-rw-r--r-- | src/map/pc.h | 26 | ||||
-rw-r--r-- | src/map/skill.c | 23 | ||||
-rw-r--r-- | src/map/status.c | 53 | ||||
-rw-r--r-- | src/map/status.h | 2 |
6 files changed, 140 insertions, 130 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 278ecc1db..bdaf7171a 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -485,9 +485,9 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i if(sc->data[SC_REJECTSWORD].timer!=-1 && flag&BF_WEAPON &&
// Fixed the condition check [Aalye]
- (src->type==BL_MOB || (src->type==BL_PC && (((struct map_session_data *)src)->status.weapon == 1 ||
- ((struct map_session_data *)src)->status.weapon == 2 ||
- ((struct map_session_data *)src)->status.weapon == 3)))){
+ (src->type==BL_MOB || (src->type==BL_PC && (((struct map_session_data *)src)->status.weapon == W_DAGGER ||
+ ((struct map_session_data *)src)->status.weapon == W_1HSWORD ||
+ ((struct map_session_data *)src)->status.weapon == W_2HSWORD)))){
if(rand()%100 < (15*sc->data[SC_REJECTSWORD].val1)){
damage = damage*50/100;
clif_damage(bl,src,gettick(),0,0,damage,0,0,0);
@@ -685,8 +685,8 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int weapon = sd->weapontype2;
switch(weapon)
{
- case 0x01: // Knife
- case 0x02: // 1HS
+ case W_DAGGER:
+ case W_1HSWORD:
{
// 剣?C練(+4 ?` +40) 片手剣 短剣含む
if((skill = pc_checkskill(sd,SM_SWORD)) > 0) {
@@ -694,7 +694,7 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int }
break;
}
- case 0x03: // 2HS
+ case W_2HSWORD:
{
// 両手剣?C練(+4 ?` +40) 両手剣
if((skill = pc_checkskill(sd,SM_TWOHAND)) > 0) {
@@ -702,8 +702,8 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int }
break;
}
- case 0x04: // 1HL
- case 0x05: // 2HL
+ case W_1HSPEAR:
+ case W_2HSPEAR:
{
// 槍?C練(+4 ?` +40,+5 ?` +50) 槍
if((skill = pc_checkskill(sd,KN_SPEARMASTERY)) > 0) {
@@ -714,36 +714,30 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int }
break;
}
- case 0x06: // 1H Axe
- case 0x07: // 2H Axe by Tato
+ case W_1HAXE:
+ case W_2HAXE:
{
if((skill = pc_checkskill(sd,AM_AXEMASTERY)) > 0) {
damage += (skill * 3);
}
break;
}
- case 0x08: // Maces
+ case W_MACE:
{
if((skill = pc_checkskill(sd,PR_MACEMASTERY)) > 0) {
damage += (skill * 3);
}
break;
}
- case 0x09: // なし?
- break;
- case 0x0a: // Staffs
- break;
- case 0x0b: // Bows
- break;
- case 0x00: // Bare Hands
- case 0x0c: // Knuckles
+ case W_FIST:
+ case W_KNUCKLE:
{
if((skill = pc_checkskill(sd,MO_IRONHAND)) > 0) {
damage += (skill * 3);
}
break;
}
- case 0x0d: // Musical Instrument
+ case W_MUSICAL:
{
// 楽器の練?K(+3 ?` +30) 楽器
if((skill = pc_checkskill(sd,BA_MUSICALLESSON)) > 0) {
@@ -751,7 +745,7 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int }
break;
}
- case 0x0e: // Whips
+ case W_WHIP:
{
// Dance Lesson Skill Effect(+3 damage for every lvl = +30) 鞭
if((skill = pc_checkskill(sd,DC_DANCINGLESSON)) > 0) {
@@ -759,7 +753,7 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int }
break;
}
- case 0x0f: // Book
+ case W_BOOK:
{
// Advance Book Skill Effect(+3 damage for every lvl = +30) {
if((skill = pc_checkskill(sd,SA_ADVANCEDBOOK)) > 0) {
@@ -767,7 +761,7 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int }
break;
}
- case 0x10: // Katars
+ case W_KATAR:
{
if((skill = pc_checkskill(sd,ASC_KATAR)) > 0) {
//Advanced Katar Research by zanetheinsane
@@ -780,12 +774,6 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int }
break;
}
- case 0x11: // Revolver
- case 0x12: // Rifle
- case 0x13: // Shotgun
- case 0x14: //Gatling Gun
- case 0x15: //Grenade Launcher
- break;
}
/*//need to add this on shuriken skills.
if((skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) {
@@ -910,7 +898,7 @@ static void battle_calc_base_damage(struct block_list *src, struct block_list *t if (!(
sd->special_state.no_sizefix ||
(sc && sc->data[SC_WEAPONPERFECTION].timer!=-1) ||
- (pc_isriding(sd) && (sd->status.weapon==4 || sd->status.weapon==5) && t_size==1) ||
+ (pc_isriding(sd) && (sd->status.weapon==W_1HSPEAR || sd->status.weapon==W_2HSPEAR) && t_size==1) ||
(flag&8)
))
{
@@ -1034,12 +1022,12 @@ static struct Damage battle_calc_weapon_attack( //Set miscellaneous data that needs be filled regardless of hit/miss
if(sd) {
switch (sd->status.weapon) {
- case 11:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
+ case W_BOW:
+ case W_REVOLVER:
+ case W_RIFLE:
+ case W_SHOTGUN:
+ case W_GATLING:
+ case W_GRENADE:
wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
flag.arrow = 1;
break;
@@ -1427,7 +1415,7 @@ static struct Damage battle_calc_weapon_attack( //Add any bonuses that modify the base baseatk+watk (pre-skills)
if(sd)
{
- if (sd->status.weapon <= MAX_WEAPON_TYPE && (sd->atk_rate != 100 || sd->weapon_atk_rate[sd->status.weapon] != 0))
+ if (sd->status.weapon < MAX_WEAPON_TYPE && (sd->atk_rate != 100 || sd->weapon_atk_rate[sd->status.weapon] != 0))
ATK_RATE(sd->atk_rate + sd->weapon_atk_rate[sd->status.weapon]);
if(flag.cri && sd->crit_atk_rate)
@@ -1552,7 +1540,7 @@ static struct Damage battle_calc_weapon_attack( skillratio += 25*skill_lv;
break;
case RG_BACKSTAP:
- if(sd && sd->status.weapon == 11 && battle_config.backstab_bow_penalty)
+ if(sd && sd->status.weapon == W_BOW && battle_config.backstab_bow_penalty)
skillratio += (200+40*skill_lv)/2;
else
skillratio += 200+40*skill_lv;
@@ -1753,7 +1741,7 @@ static struct Damage battle_calc_weapon_attack( case TK_COUNTER:
case TK_JUMPKICK:
//TK_RUN kick damage bonus.
- if(sd && sd->weapontype1 == 0 && sd->weapontype2 == 0)
+ if(sd && sd->weapontype1 == W_FIST && sd->weapontype2 == W_FIST)
ATK_ADD(10*pc_checkskill(sd, TK_RUN));
break;
case GS_MAGICALBULLET:
@@ -2111,7 +2099,7 @@ static struct Damage battle_calc_weapon_attack( if(sd && !skill_num && !flag.cri)
{ //Check for double attack.
- if(( (skill_lv = 5*pc_checkskill(sd,TF_DOUBLE)) > 0 && sd->weapontype1 == 0x01) ||
+ if(( (skill_lv = 5*pc_checkskill(sd,TF_DOUBLE)) > 0 && sd->weapontype1 == W_DAGGER) ||
sd->double_rate > 0) //Success chance is not added, the higher one is used? [Skotlex]
{
if (rand()%100 < (skill_lv>sd->double_rate?skill_lv:sd->double_rate))
@@ -2120,7 +2108,7 @@ static struct Damage battle_calc_weapon_attack( damage_div_fix(wd.damage, wd.div_);
wd.type = 0x08;
}
- } else if (( (skill_lv = 5*pc_checkskill(sd,GS_CHAINACTION)) > 0 && sd->weapontype1 == 0x11) || sd->double_rate > 0)
+ } else if (( (skill_lv = 5*pc_checkskill(sd,GS_CHAINACTION)) > 0 && sd->weapontype1 == W_REVOLVER) || sd->double_rate > 0)
if (rand()%100 < (skill_lv>sd->double_rate?skill_lv:sd->double_rate))
{
wd.div_=skill_get_num(GS_CHAINACTION,skill_lv?skill_lv:1);
@@ -2157,7 +2145,7 @@ static struct Damage battle_calc_weapon_attack( wd.damage2 = wd.damage2 * (30 + (skill * 10))/100;
if(wd.damage2 < 1) wd.damage2 = 1;
}
- } else if(sd->status.weapon == 16)
+ } else if(sd->status.weapon == W_KATAR)
{ //Katars
skill = pc_checkskill(sd,TF_DOUBLE);
wd.damage2 = wd.damage * (1 + (skill * 2))/100;
@@ -2997,8 +2985,8 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, race = status_get_race(target);
ele = status_get_elem_type(target);
- if(sd && (sd->status.weapon == 11 || sd->status.weapon == 17 || sd->status.weapon == 18
- || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) {
+ if(sd && (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
+ ) {
if(sd->equip_index[10] >= 0) {
if(battle_config.arrow_decrement)
pc_delitem(sd,sd->equip_index[10],1,0);
@@ -3042,7 +3030,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, }
//Recycled the damage variable rather than use a new one... [Skotlex]
- if(sd && (damage = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0 && sd->status.weapon <= MAX_WEAPON_TYPE) // triple blow works with bows ^^ [celest]
+ if(sd && (damage = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0) // triple blow works with bows ^^ [celest]
{
int triple_rate= 30 - damage; //Base Rate
if (sc && sc->data[SC_SKILLRATE_UP].timer!=-1 && sc->data[SC_SKILLRATE_UP].val1 == MO_TRIPLEATTACK)
diff --git a/src/map/pc.c b/src/map/pc.c index 9711727c0..bda44a6a9 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -455,24 +455,24 @@ int pc_calcweapontype(struct map_session_data *sd) {
nullpo_retr(0, sd);
- if(sd->weapontype1 != 0 && sd->weapontype2 == 0)
+ if(sd->weapontype1 != W_FIST && sd->weapontype2 == W_FIST)
sd->status.weapon = sd->weapontype1;
- if(sd->weapontype1 == 0 && sd->weapontype2 != 0)// 左手武器 Only
+ else if(sd->weapontype1 == W_FIST && sd->weapontype2 != W_FIST)// 左手武器 Only
sd->status.weapon = sd->weapontype2;
- else if(sd->weapontype1 == 1 && sd->weapontype2 == 1)// ?短?
+ else if(sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_DAGGER)// ?短?
sd->status.weapon = MAX_WEAPON_TYPE+1;
- else if(sd->weapontype1 == 2 && sd->weapontype2 == 2)// ??手?
+ else if(sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_1HSWORD)// ??手?
sd->status.weapon = MAX_WEAPON_TYPE+2;
- else if(sd->weapontype1 == 6 && sd->weapontype2 == 6)// ??手斧
+ else if(sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_1HAXE)// ??手斧
sd->status.weapon = MAX_WEAPON_TYPE+3;
- else if( (sd->weapontype1 == 1 && sd->weapontype2 == 2) ||
- (sd->weapontype1 == 2 && sd->weapontype2 == 1) ) // 短? - ?手?
+ else if( (sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_1HSWORD) ||
+ (sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_DAGGER) ) // 短? - ?手?
sd->status.weapon = MAX_WEAPON_TYPE+4;
- else if( (sd->weapontype1 == 1 && sd->weapontype2 == 6) ||
- (sd->weapontype1 == 6 && sd->weapontype2 == 1) ) // 短? - 斧
+ else if( (sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_1HAXE) ||
+ (sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_DAGGER) ) // 短? - 斧
sd->status.weapon = MAX_WEAPON_TYPE+5;
- else if( (sd->weapontype1 == 2 && sd->weapontype2 == 6) ||
- (sd->weapontype1 == 6 && sd->weapontype2 == 2) ) // ?手? - 斧
+ else if( (sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_1HAXE) ||
+ (sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_1HSWORD) ) // ?手? - 斧
sd->status.weapon = MAX_WEAPON_TYPE+6;
else
sd->status.weapon = sd->weapontype1;
@@ -586,18 +586,14 @@ int pc_isequip(struct map_session_data *sd,int n) if (sd->status.base_level > 96 && item->equip & 0x022 && item->type == 4)
switch(item->look) { //In weapons, the look determines type of weapon.
- case 0x01: //Level 4 Knives are equippable.. this means all knives, I'd guess?
- case 0x02: //All 1H swords
- case 0x06: //All 1H Axes
- case 0x08: //All Maces
- case 0x0a: //All Staffs
+ case W_DAGGER: //Level 4 Knives are equippable.. this means all knives, I'd guess?
+ case W_1HSWORD: //All 1H swords
+ case W_1HAXE: //All 1H Axes
+ case W_MACE: //All Maces
+ case W_STAFF: //All Staffs
return 1;
}
}
-
- if((item->equip & 0x0002 || item->equip & 0x0020) && item->type == 4 && sd->status.weapon != 20 && sd->sc.data[SC_GATLINGFEVER].timer != -1)
- status_change_end(&sd->bl,SC_GATLINGFEVER,-1); // added to disable effects if new wepaon is not a Gatlin gun [Reddozen]
-
}
//Not equipable by class. [Skotlex]
if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
@@ -3286,39 +3282,41 @@ int pc_checkskill(struct map_session_data *sd,int skill_id) */
int pc_checkallowskill(struct map_session_data *sd)
{
+ const int scw_list[] = {
+ SC_TWOHANDQUICKEN,
+ SC_ONEHAND,
+ SC_AURABLADE,
+ SC_PARRYING,
+ SC_SPEARSQUICKEN,
+ SC_ADRENALINE,
+ SC_ADRENALINE2,
+ SC_GATLINGFEVER
+ };
+ const int scs_list[] = {
+ SC_AUTOGUARD,
+ SC_DEFENDER,
+ SC_REFLECTSHIELD
+ };
+ int i;
nullpo_retr(0, sd);
if(!sd->sc.count)
return 0;
- // Skills requiring specific weapon types
- if(sd->sc.data[SC_TWOHANDQUICKEN].timer!=-1 && !(skill_get_weapontype(KN_TWOHANDQUICKEN)&(1<<sd->status.weapon)))
- status_change_end(&sd->bl,SC_TWOHANDQUICKEN,-1);
- if(sd->sc.data[SC_ONEHAND].timer!=-1 && !(skill_get_weapontype(KN_ONEHAND)&(1<<sd->status.weapon)))
- status_change_end(&sd->bl,SC_ONEHAND,-1);
- if(sd->sc.data[SC_AURABLADE].timer!=-1 && !(skill_get_weapontype(LK_AURABLADE)&(1<<sd->status.weapon)))
- // Aura Blade requires any weapon but bare fists
- status_change_end(&sd->bl,SC_AURABLADE,-1);
- if(sd->sc.data[SC_PARRYING].timer!=-1 && !(skill_get_weapontype(LK_PARRYING)&(1<<sd->status.weapon)))
- status_change_end(&sd->bl,SC_PARRYING,-1);
- if(sd->sc.data[SC_SPEARSQUICKEN].timer!=-1 && !(skill_get_weapontype(CR_SPEARQUICKEN)&(1<<sd->status.weapon)))
- // Spear Quicken requires a Two-handed spear
- status_change_end(&sd->bl,SC_SPEARSQUICKEN,-1);
- if(sd->sc.data[SC_ADRENALINE].timer!=-1 && !(skill_get_weapontype(BS_ADRENALINE)&(1<<sd->status.weapon)))
- status_change_end(&sd->bl,SC_ADRENALINE,-1);
- if(sd->sc.data[SC_ADRENALINE2].timer!=-1 && !(skill_get_weapontype(BS_ADRENALINE2)&(1<<sd->status.weapon)))
- status_change_end(&sd->bl,SC_ADRENALINE2,-1);
- if( sd->sc.data[SC_SPURT].timer!=-1 && sd->status.weapon)
+ 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[SC_SPURT].timer!=-1 && sd->status.weapon)
// Spurt requires bare hands (feet, in fact xD)
status_change_end(&sd->bl,SC_SPURT,-1);
-
+
if(sd->status.shield <= 0) { // Skills requiring a shield
- if(sd->sc.data[SC_AUTOGUARD].timer!=-1) // Guard
- status_change_end(&sd->bl,SC_AUTOGUARD,-1);
- if(sd->sc.data[SC_DEFENDER].timer!=-1) // Defending Aura
- status_change_end(&sd->bl,SC_DEFENDER,-1);
- if(sd->sc.data[SC_REFLECTSHIELD].timer!=-1) // Shield Reflect
- status_change_end(&sd->bl,SC_REFLECTSHIELD,-1);
+ for (i = 0; i < sizeof(scs_list)/sizeof(scs_list[0]); i++)
+ if(sd->sc.data[scs_list[i]].timer!=-1) // Guard
+ status_change_end(&sd->bl,scs_list[i],-1);
}
return 0;
}
diff --git a/src/map/pc.h b/src/map/pc.h index d6b368d16..4984713a5 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -13,6 +13,32 @@ //Update this max as necessary. 53 is the value needed for Super Baby currently
#define MAX_SKILL_TREE 53
+enum {
+ W_FIST, //Bare hands
+ W_DAGGER, //1
+ W_1HSWORD, //2
+ W_2HSWORD, //3
+ W_1HSPEAR, //4
+ W_2HSPEAR, //5
+ W_1HAXE, //6
+ W_2HAXE, //7
+ W_MACE, //8
+ W_UNKNOWN, //View 9 seems unused anywhere
+ W_STAFF, //10
+ W_BOW, //11
+ W_KNUCKLE, //12
+ W_MUSICAL, //13
+ W_WHIP, //14
+ W_BOOK, //15
+ W_KATAR, //16
+ W_REVOLVER, //17
+ W_RIFLE, //18
+ W_SHOTGUN, //19
+ W_GATLING, //20
+ W_GRENADE, //21
+ MAX_WEAPON_TYPE
+} weapon_type;
+
#define pc_setdead(sd) ((sd)->state.dead_sit = (sd)->vd.dead_sit = 1)
#define pc_setsit(sd) ((sd)->state.dead_sit = (sd)->vd.dead_sit = 2)
#define pc_isdead(sd) ((sd)->state.dead_sit == 1)
diff --git a/src/map/skill.c b/src/map/skill.c index e97e4c2e0..c4d41781f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -934,13 +934,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int {
if(sd) {
// Automatic trigger of Blitz Beat
- if (pc_isfalcon(sd) && sd->status.weapon == 11 && (skill=pc_checkskill(sd,HT_BLITZBEAT))>0 &&
+ if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (skill=pc_checkskill(sd,HT_BLITZBEAT))>0 &&
rand()%1000 <= sd->paramc[5]*10/3+1 ) {
int lv=(sd->status.job_level+9)/10;
skill_castend_damage_id(src,bl,HT_BLITZBEAT,(skill<lv)?skill:lv,tick,0xf00000);
}
// Gank
- if(dstmd && !dstmd->state.steal_flag && sd->status.weapon != 11 && (skill=pc_checkskill(sd,RG_SNATCHER)) > 0 &&
+ if(dstmd && !dstmd->state.steal_flag && sd->status.weapon != W_BOW && (skill=pc_checkskill(sd,RG_SNATCHER)) > 0 &&
(skill*15 + 55) + (skill2 = pc_checkskill(sd,TF_STEAL))*10 > rand()%1000) {
if(pc_steal_item(sd,bl))
clif_skill_nodamage(src,bl,TF_STEAL,skill2,1);
@@ -1507,11 +1507,12 @@ int skill_break_equip(struct block_list *bl, unsigned short where, int rate, int rate -= rate*sd->unbreakable/100;
if (where&EQP_WEAPON) {
switch (sd->status.weapon) {
- case 0: //Bare fists should not break :P
- case 7:
- case 8: // Axes and Maces can't be broken [DracoRPG]
- case 10:
- case 15: //Rods and Books can't be broken [Skotlex]
+ case W_FIST: //Bare fists should not break :P
+ case W_1HAXE:
+ case W_2HAXE:
+ case W_MACE: // Axes and Maces can't be broken [DracoRPG]
+ case W_STAFF:
+ case W_BOOK: //Rods and Books can't be broken [Skotlex]
where &= ~EQP_WEAPON;
}
}
@@ -3567,7 +3568,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SA_LIGHTNINGLOADER:
case SA_SEISMICWEAPON:
if (dstsd) {
- if(dstsd->status.weapon == 0 ||
+ if(dstsd->status.weapon == W_FIST ||
(dstsd->sc.count && dstsd->sc.data[type].timer == -1 &&
( //Allow re-enchanting to lenghten time. [Skotlex]
dstsd->sc.data[SC_FIREWEAPON].timer != -1 ||
@@ -4526,7 +4527,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in return 1;
}
if(skillid == AM_BERSERKPITCHER) { //Does not override use-level, and cannot be used on bows.
- if (dstsd && (dstsd->status.base_level<(unsigned int)sd->inventory_data[i]->elv || dstsd->weapontype1 == 11)) {
+ if (dstsd && (dstsd->status.base_level<(unsigned int)sd->inventory_data[i]->elv || dstsd->weapontype1 == W_BOW)) {
clif_skill_fail(sd,skillid,0,0);
map_freeblock_unlock();
return 1;
@@ -7421,7 +7422,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) if (sd->status.sex != tsd->status.sex &&
(tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER &&
(skilllv = pc_checkskill(tsd, skillid)) > 0 &&
- (tsd->weapontype1==13 || tsd->weapontype1==14) &&
+ (tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) &&
sd->status.party_id && tsd->status.party_id &&
sd->status.party_id == tsd->status.party_id &&
tsd->sc.data[SC_DANCING].timer == -1)
@@ -7634,7 +7635,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ else
sp += (sd->status.max_sp * abs(sp_rate))/100;
- if (!ammo && sd->status.weapon == 11 && skill &&
+ if (!ammo && sd->status.weapon == W_BOW && skill &&
skill != HT_PHANTASMIC && skill != GS_MAGICALBULLET &&
skill_get_type(skill) == BF_WEAPON && !(skill_get_nk(skill)&NK_NO_DAMAGE)
)
diff --git a/src/map/status.c b/src/map/status.c index 398360605..f287c5c20 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -919,7 +919,7 @@ int status_calc_pc(struct map_session_data* sd,int first) if(sd->attackrange_ < 1) sd->attackrange_ = 1;
if(sd->attackrange < sd->attackrange_)
sd->attackrange = sd->attackrange_;
- if(sd->status.weapon == 11)
+ if(sd->status.weapon == W_BOW)
sd->attackrange += sd->arrow_range;
sd->double_rate += sd->double_add_rate;
sd->perfect_hit += sd->perfect_hit_add;
@@ -1082,14 +1082,14 @@ int status_calc_pc(struct map_session_data* sd,int first) // Basic Base ATK value
switch(sd->status.weapon){
- case 11: // Bows
- case 13: // Musical Instruments
- case 14: // Whips
- case 17: // Revolver
- case 18: // Rifle
- case 19: // Shotgun
- case 20: //Gatling Gun
- case 21: //Grenade Launcher
+ case W_BOW:
+ case W_MUSICAL:
+ case W_WHIP:
+ case W_REVOLVER:
+ case W_RIFLE:
+ case W_SHOTGUN:
+ case W_GATLING:
+ case W_GRENADE:
str = sd->paramc[4];
dex = sd->paramc[0];
break;
@@ -1177,16 +1177,17 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->hit += skill*2;
if((skill=pc_checkskill(sd,AC_VULTURE))>0){
sd->hit += skill;
- if(sd->status.weapon == 11)
+ if(sd->status.weapon == W_BOW)
sd->attackrange += skill;
}
- if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18
- || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21))
- sd->hit += 2*skill;
- if((skill=pc_checkskill(sd,GS_SNAKEEYE))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18
- || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) {
- sd->hit += skill;
- sd->attackrange += skill;
+ if(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)
+ {
+ if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0)
+ sd->hit += 2*skill;
+ if((skill=pc_checkskill(sd,GS_SNAKEEYE))>0) {
+ sd->hit += skill;
+ sd->attackrange += skill;
+ }
}
// Absolute, then relative modifiers from status changes (shared between PC and NPC)
@@ -1345,7 +1346,7 @@ int status_calc_pc(struct map_session_data* sd,int first) // Unlike other stats, ASPD rate modifiers from skills/SCs/items/etc are first all added together, then the final modifier is applied
// Basic ASPD value
- if (sd->status.weapon <= MAX_WEAPON_TYPE)
+ if (sd->status.weapon < MAX_WEAPON_TYPE)
sd->aspd += aspd_base[sd->status.class_][sd->status.weapon]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[sd->status.class_][sd->status.weapon]/1000;
else
sd->aspd += (
@@ -1354,18 +1355,16 @@ int status_calc_pc(struct map_session_data* sd,int first) ) *2/3; //From what I read in rodatazone, 2/3 should be more accurate than 0.7 -> 140 / 200; [Skotlex]
// Relative modifiers from passive skills
- if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0)
+ if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
sd->aspd_rate -= (skill/2);
if((skill = pc_checkskill(sd,SG_DEVIL)) > 0 && !pc_nextjobexp(sd))
sd->aspd_rate -= (skill*3);
-
+ if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 &&
+ (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
+ sd->aspd_rate -= (skill/2);
if(pc_isriding(sd))
sd->aspd_rate += 50-10*pc_checkskill(sd,KN_CAVALIERMASTERY);
-
- if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18
- || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21))
- sd->aspd_rate -= (int)(skill / 2);
-
+
// Relative modifiers from status changes (shared between PC and NPC)
sd->aspd_rate = status_calc_aspd_rate(&sd->bl,sd->aspd_rate);
@@ -2198,7 +2197,7 @@ int status_calc_aspd_rate(struct block_list *bl, int aspd_rate) aspd_rate -= (sc->data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)?30:20;
else if(sc->data[SC_SPEARSQUICKEN].timer!=-1)
aspd_rate -= sc->data[SC_SPEARSQUICKEN].val2;
- else if(sc->data[SC_ASSNCROS].timer!=-1 && (bl->type!=BL_PC || ((struct map_session_data*)bl)->status.weapon != 11))
+ else if(sc->data[SC_ASSNCROS].timer!=-1 && (bl->type!=BL_PC || ((struct map_session_data*)bl)->status.weapon != W_BOW))
aspd_rate -= sc->data[SC_ASSNCROS].val2;
}
if(sc->data[SC_BERSERK].timer!=-1)
@@ -2701,7 +2700,7 @@ int status_get_batk(struct block_list *bl) if(bl->type==BL_PC) {
batk = ((struct map_session_data *)bl)->base_atk;
- if (((struct map_session_data *)bl)->status.weapon <= MAX_WEAPON_TYPE)
+ if (((struct map_session_data *)bl)->status.weapon < MAX_WEAPON_TYPE)
batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon];
} else {
int str,dstr;
diff --git a/src/map/status.h b/src/map/status.h index faf395b2f..321724f53 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -544,8 +544,6 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int #define MAX_REFINE 10
extern int percentrefinery[5][MAX_REFINE+1]; //The last slot always has a 0% success chance [Skotlex]
-#define MAX_WEAPON_TYPE 22
-
int status_readdb(void);
int do_init_status(void);
|