- 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://svn.code.sf.net/p/rathena/svn/trunk@5912 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-04-05 19:27:00 +00:00
parent 7aa1324af3
commit f3d9444348
7 changed files with 143 additions and 130 deletions

View File

@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/04/05 2006/04/05
* Added a define list for weapon types in pc.h [Skotlex]
* Cleaned up pc_checkallowskill and moved the Gatling fever check to it.
[Skotlex]
* Some cleanup of clif_parseloadendack, fixed guild-member list being sent * Some cleanup of clif_parseloadendack, fixed guild-member list being sent
on all map-changes. [Skotlex] on all map-changes. [Skotlex]
* Removed the hardcoded removal of characters who spawn in a castle. All * Removed the hardcoded removal of characters who spawn in a castle. All

View File

@ -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 && if(sc->data[SC_REJECTSWORD].timer!=-1 && flag&BF_WEAPON &&
// Fixed the condition check [Aalye] // Fixed the condition check [Aalye]
(src->type==BL_MOB || (src->type==BL_PC && (((struct map_session_data *)src)->status.weapon == 1 || (src->type==BL_MOB || (src->type==BL_PC && (((struct map_session_data *)src)->status.weapon == W_DAGGER ||
((struct map_session_data *)src)->status.weapon == 2 || ((struct map_session_data *)src)->status.weapon == W_1HSWORD ||
((struct map_session_data *)src)->status.weapon == 3)))){ ((struct map_session_data *)src)->status.weapon == W_2HSWORD)))){
if(rand()%100 < (15*sc->data[SC_REJECTSWORD].val1)){ if(rand()%100 < (15*sc->data[SC_REJECTSWORD].val1)){
damage = damage*50/100; damage = damage*50/100;
clif_damage(bl,src,gettick(),0,0,damage,0,0,0); 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; weapon = sd->weapontype2;
switch(weapon) switch(weapon)
{ {
case 0x01: // Knife case W_DAGGER:
case 0x02: // 1HS case W_1HSWORD:
{ {
// 剣?C練(+4 ?` +40) 片手剣 短剣含む // 剣?C練(+4 ?` +40) 片手剣 短剣含む
if((skill = pc_checkskill(sd,SM_SWORD)) > 0) { 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; break;
} }
case 0x03: // 2HS case W_2HSWORD:
{ {
// 両手剣?C練(+4 ?` +40) 両手剣 // 両手剣?C練(+4 ?` +40) 両手剣
if((skill = pc_checkskill(sd,SM_TWOHAND)) > 0) { 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; break;
} }
case 0x04: // 1HL case W_1HSPEAR:
case 0x05: // 2HL case W_2HSPEAR:
{ {
// 槍?C練(+4 ?` +40,+5 ?` +50) 槍 // 槍?C練(+4 ?` +40,+5 ?` +50) 槍
if((skill = pc_checkskill(sd,KN_SPEARMASTERY)) > 0) { 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; break;
} }
case 0x06: // 1H Axe case W_1HAXE:
case 0x07: // 2H Axe by Tato case W_2HAXE:
{ {
if((skill = pc_checkskill(sd,AM_AXEMASTERY)) > 0) { if((skill = pc_checkskill(sd,AM_AXEMASTERY)) > 0) {
damage += (skill * 3); damage += (skill * 3);
} }
break; break;
} }
case 0x08: // Maces case W_MACE:
{ {
if((skill = pc_checkskill(sd,PR_MACEMASTERY)) > 0) { if((skill = pc_checkskill(sd,PR_MACEMASTERY)) > 0) {
damage += (skill * 3); damage += (skill * 3);
} }
break; break;
} }
case 0x09: // ‚È‚µ? case W_FIST:
break; case W_KNUCKLE:
case 0x0a: // Staffs
break;
case 0x0b: // Bows
break;
case 0x00: // Bare Hands
case 0x0c: // Knuckles
{ {
if((skill = pc_checkskill(sd,MO_IRONHAND)) > 0) { if((skill = pc_checkskill(sd,MO_IRONHAND)) > 0) {
damage += (skill * 3); damage += (skill * 3);
} }
break; break;
} }
case 0x0d: // Musical Instrument case W_MUSICAL:
{ {
// 楽器の練?K(+3 ?` +30) 楽器 // 楽器の練?K(+3 ?` +30) 楽器
if((skill = pc_checkskill(sd,BA_MUSICALLESSON)) > 0) { 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; break;
} }
case 0x0e: // Whips case W_WHIP:
{ {
// Dance Lesson Skill Effect(+3 damage for every lvl = +30) 鞭 // Dance Lesson Skill Effect(+3 damage for every lvl = +30) 鞭
if((skill = pc_checkskill(sd,DC_DANCINGLESSON)) > 0) { 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; break;
} }
case 0x0f: // Book case W_BOOK:
{ {
// Advance Book Skill Effect(+3 damage for every lvl = +30) { // Advance Book Skill Effect(+3 damage for every lvl = +30) {
if((skill = pc_checkskill(sd,SA_ADVANCEDBOOK)) > 0) { 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; break;
} }
case 0x10: // Katars case W_KATAR:
{ {
if((skill = pc_checkskill(sd,ASC_KATAR)) > 0) { if((skill = pc_checkskill(sd,ASC_KATAR)) > 0) {
//Advanced Katar Research by zanetheinsane //Advanced Katar Research by zanetheinsane
@ -780,12 +774,6 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
} }
break; 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. /*//need to add this on shuriken skills.
if((skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) { 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 (!( if (!(
sd->special_state.no_sizefix || sd->special_state.no_sizefix ||
(sc && sc->data[SC_WEAPONPERFECTION].timer!=-1) || (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) (flag&8)
)) ))
{ {
@ -1034,12 +1022,12 @@ static struct Damage battle_calc_weapon_attack(
//Set miscellaneous data that needs be filled regardless of hit/miss //Set miscellaneous data that needs be filled regardless of hit/miss
if(sd) { if(sd) {
switch (sd->status.weapon) { switch (sd->status.weapon) {
case 11: case W_BOW:
case 17: case W_REVOLVER:
case 18: case W_RIFLE:
case 19: case W_SHOTGUN:
case 20: case W_GATLING:
case 21: case W_GRENADE:
wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG; wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
flag.arrow = 1; flag.arrow = 1;
break; break;
@ -1427,7 +1415,7 @@ static struct Damage battle_calc_weapon_attack(
//Add any bonuses that modify the base baseatk+watk (pre-skills) //Add any bonuses that modify the base baseatk+watk (pre-skills)
if(sd) 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]); ATK_RATE(sd->atk_rate + sd->weapon_atk_rate[sd->status.weapon]);
if(flag.cri && sd->crit_atk_rate) if(flag.cri && sd->crit_atk_rate)
@ -1552,7 +1540,7 @@ static struct Damage battle_calc_weapon_attack(
skillratio += 25*skill_lv; skillratio += 25*skill_lv;
break; break;
case RG_BACKSTAP: 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; skillratio += (200+40*skill_lv)/2;
else else
skillratio += 200+40*skill_lv; skillratio += 200+40*skill_lv;
@ -1753,7 +1741,7 @@ static struct Damage battle_calc_weapon_attack(
case TK_COUNTER: case TK_COUNTER:
case TK_JUMPKICK: case TK_JUMPKICK:
//TK_RUN kick damage bonus. //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)); ATK_ADD(10*pc_checkskill(sd, TK_RUN));
break; break;
case GS_MAGICALBULLET: case GS_MAGICALBULLET:
@ -2111,7 +2099,7 @@ static struct Damage battle_calc_weapon_attack(
if(sd && !skill_num && !flag.cri) if(sd && !skill_num && !flag.cri)
{ //Check for double attack. { //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] 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)) 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_); damage_div_fix(wd.damage, wd.div_);
wd.type = 0x08; 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)) 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); 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; wd.damage2 = wd.damage2 * (30 + (skill * 10))/100;
if(wd.damage2 < 1) wd.damage2 = 1; if(wd.damage2 < 1) wd.damage2 = 1;
} }
} else if(sd->status.weapon == 16) } else if(sd->status.weapon == W_KATAR)
{ //Katars { //Katars
skill = pc_checkskill(sd,TF_DOUBLE); skill = pc_checkskill(sd,TF_DOUBLE);
wd.damage2 = wd.damage * (1 + (skill * 2))/100; 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); race = status_get_race(target);
ele = status_get_elem_type(target); ele = status_get_elem_type(target);
if(sd && (sd->status.weapon == 11 || sd->status.weapon == 17 || sd->status.weapon == 18 if(sd && (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
|| sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) { ) {
if(sd->equip_index[10] >= 0) { if(sd->equip_index[10] >= 0) {
if(battle_config.arrow_decrement) if(battle_config.arrow_decrement)
pc_delitem(sd,sd->equip_index[10],1,0); 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] //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 int triple_rate= 30 - damage; //Base Rate
if (sc && sc->data[SC_SKILLRATE_UP].timer!=-1 && sc->data[SC_SKILLRATE_UP].val1 == MO_TRIPLEATTACK) if (sc && sc->data[SC_SKILLRATE_UP].timer!=-1 && sc->data[SC_SKILLRATE_UP].val1 == MO_TRIPLEATTACK)

View File

@ -455,24 +455,24 @@ int pc_calcweapontype(struct map_session_data *sd)
{ {
nullpo_retr(0, 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; sd->status.weapon = sd->weapontype1;
if(sd->weapontype1 == 0 && sd->weapontype2 != 0)// <20>¶Žè•<C3A8>Ší Only else if(sd->weapontype1 == W_FIST && sd->weapontype2 != W_FIST)// <20>¶Žè•<C3A8>Ší Only
sd->status.weapon = sd->weapontype2; sd->status.weapon = sd->weapontype2;
else if(sd->weapontype1 == 1 && sd->weapontype2 == 1)// ?Z? else if(sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_DAGGER)// ?Z?
sd->status.weapon = MAX_WEAPON_TYPE+1; 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; 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; sd->status.weapon = MAX_WEAPON_TYPE+3;
else if( (sd->weapontype1 == 1 && sd->weapontype2 == 2) || else if( (sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_1HSWORD) ||
(sd->weapontype1 == 2 && sd->weapontype2 == 1) ) // Z? - ?Žè? (sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_DAGGER) ) // Z? - ?Žè?
sd->status.weapon = MAX_WEAPON_TYPE+4; sd->status.weapon = MAX_WEAPON_TYPE+4;
else if( (sd->weapontype1 == 1 && sd->weapontype2 == 6) || else if( (sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_1HAXE) ||
(sd->weapontype1 == 6 && sd->weapontype2 == 1) ) // Z? - •€ (sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_DAGGER) ) // Z? - •€
sd->status.weapon = MAX_WEAPON_TYPE+5; sd->status.weapon = MAX_WEAPON_TYPE+5;
else if( (sd->weapontype1 == 2 && sd->weapontype2 == 6) || else if( (sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_1HAXE) ||
(sd->weapontype1 == 6 && sd->weapontype2 == 2) ) // ?Žè? - •€ (sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_1HSWORD) ) // ?Žè? - •€
sd->status.weapon = MAX_WEAPON_TYPE+6; sd->status.weapon = MAX_WEAPON_TYPE+6;
else else
sd->status.weapon = sd->weapontype1; 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) if (sd->status.base_level > 96 && item->equip & 0x022 && item->type == 4)
switch(item->look) { //In weapons, the look determines type of weapon. 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 W_DAGGER: //Level 4 Knives are equippable.. this means all knives, I'd guess?
case 0x02: //All 1H swords case W_1HSWORD: //All 1H swords
case 0x06: //All 1H Axes case W_1HAXE: //All 1H Axes
case 0x08: //All Maces case W_MACE: //All Maces
case 0x0a: //All Staffs case W_STAFF: //All Staffs
return 1; 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] //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)])) 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) 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); nullpo_retr(0, sd);
if(!sd->sc.count) if(!sd->sc.count)
return 0; return 0;
// Skills requiring specific weapon types for (i = 0; i < sizeof(scw_list)/sizeof(scw_list[0]); i++)
if(sd->sc.data[SC_TWOHANDQUICKEN].timer!=-1 && !(skill_get_weapontype(KN_TWOHANDQUICKEN)&(1<<sd->status.weapon))) { // Skills requiring specific weapon types
status_change_end(&sd->bl,SC_TWOHANDQUICKEN,-1); if(sd->sc.data[scw_list[i]].timer!=-1 && !(skill_get_weapontype(StatusSkillChangeTable[scw_list[i]])&(1<<sd->status.weapon)))
if(sd->sc.data[SC_ONEHAND].timer!=-1 && !(skill_get_weapontype(KN_ONEHAND)&(1<<sd->status.weapon))) status_change_end(&sd->bl,scw_list[i],-1);
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 if(sd->sc.data[SC_SPURT].timer!=-1 && sd->status.weapon)
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)
// Spurt requires bare hands (feet, in fact xD) // Spurt requires bare hands (feet, in fact xD)
status_change_end(&sd->bl,SC_SPURT,-1); status_change_end(&sd->bl,SC_SPURT,-1);
if(sd->status.shield <= 0) { // Skills requiring a shield if(sd->status.shield <= 0) { // Skills requiring a shield
if(sd->sc.data[SC_AUTOGUARD].timer!=-1) // Guard for (i = 0; i < sizeof(scs_list)/sizeof(scs_list[0]); i++)
status_change_end(&sd->bl,SC_AUTOGUARD,-1); if(sd->sc.data[scs_list[i]].timer!=-1) // Guard
if(sd->sc.data[SC_DEFENDER].timer!=-1) // Defending Aura status_change_end(&sd->bl,scs_list[i],-1);
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);
} }
return 0; return 0;
} }

View File

@ -13,6 +13,32 @@
//Update this max as necessary. 53 is the value needed for Super Baby currently //Update this max as necessary. 53 is the value needed for Super Baby currently
#define MAX_SKILL_TREE 53 #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_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_setsit(sd) ((sd)->state.dead_sit = (sd)->vd.dead_sit = 2)
#define pc_isdead(sd) ((sd)->state.dead_sit == 1) #define pc_isdead(sd) ((sd)->state.dead_sit == 1)

View File

@ -934,13 +934,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
{ {
if(sd) { if(sd) {
// Automatic trigger of Blitz Beat // 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 ) { rand()%1000 <= sd->paramc[5]*10/3+1 ) {
int lv=(sd->status.job_level+9)/10; int lv=(sd->status.job_level+9)/10;
skill_castend_damage_id(src,bl,HT_BLITZBEAT,(skill<lv)?skill:lv,tick,0xf00000); skill_castend_damage_id(src,bl,HT_BLITZBEAT,(skill<lv)?skill:lv,tick,0xf00000);
} }
// Gank // 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) { (skill*15 + 55) + (skill2 = pc_checkskill(sd,TF_STEAL))*10 > rand()%1000) {
if(pc_steal_item(sd,bl)) if(pc_steal_item(sd,bl))
clif_skill_nodamage(src,bl,TF_STEAL,skill2,1); 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; rate -= rate*sd->unbreakable/100;
if (where&EQP_WEAPON) { if (where&EQP_WEAPON) {
switch (sd->status.weapon) { switch (sd->status.weapon) {
case 0: //Bare fists should not break :P case W_FIST: //Bare fists should not break :P
case 7: case W_1HAXE:
case 8: // Axes and Maces can't be broken [DracoRPG] case W_2HAXE:
case 10: case W_MACE: // Axes and Maces can't be broken [DracoRPG]
case 15: //Rods and Books can't be broken [Skotlex] case W_STAFF:
case W_BOOK: //Rods and Books can't be broken [Skotlex]
where &= ~EQP_WEAPON; 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_LIGHTNINGLOADER:
case SA_SEISMICWEAPON: case SA_SEISMICWEAPON:
if (dstsd) { if (dstsd) {
if(dstsd->status.weapon == 0 || if(dstsd->status.weapon == W_FIST ||
(dstsd->sc.count && dstsd->sc.data[type].timer == -1 && (dstsd->sc.count && dstsd->sc.data[type].timer == -1 &&
( //Allow re-enchanting to lenghten time. [Skotlex] ( //Allow re-enchanting to lenghten time. [Skotlex]
dstsd->sc.data[SC_FIREWEAPON].timer != -1 || 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; return 1;
} }
if(skillid == AM_BERSERKPITCHER) { //Does not override use-level, and cannot be used on bows. 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); clif_skill_fail(sd,skillid,0,0);
map_freeblock_unlock(); map_freeblock_unlock();
return 1; 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 && if (sd->status.sex != tsd->status.sex &&
(tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && (tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER &&
(skilllv = pc_checkskill(tsd, skillid)) > 0 && (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 &&
sd->status.party_id == tsd->status.party_id && sd->status.party_id == tsd->status.party_id &&
tsd->sc.data[SC_DANCING].timer == -1) 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 else
sp += (sd->status.max_sp * abs(sp_rate))/100; 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 != HT_PHANTASMIC && skill != GS_MAGICALBULLET &&
skill_get_type(skill) == BF_WEAPON && !(skill_get_nk(skill)&NK_NO_DAMAGE) skill_get_type(skill) == BF_WEAPON && !(skill_get_nk(skill)&NK_NO_DAMAGE)
) )

View File

@ -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_ < 1) sd->attackrange_ = 1;
if(sd->attackrange < sd->attackrange_) if(sd->attackrange < sd->attackrange_)
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->attackrange += sd->arrow_range;
sd->double_rate += sd->double_add_rate; sd->double_rate += sd->double_add_rate;
sd->perfect_hit += sd->perfect_hit_add; 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 // Basic Base ATK value
switch(sd->status.weapon){ switch(sd->status.weapon){
case 11: // Bows case W_BOW:
case 13: // Musical Instruments case W_MUSICAL:
case 14: // Whips case W_WHIP:
case 17: // Revolver case W_REVOLVER:
case 18: // Rifle case W_RIFLE:
case 19: // Shotgun case W_SHOTGUN:
case 20: //Gatling Gun case W_GATLING:
case 21: //Grenade Launcher case W_GRENADE:
str = sd->paramc[4]; str = sd->paramc[4];
dex = sd->paramc[0]; dex = sd->paramc[0];
break; break;
@ -1177,16 +1177,17 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->hit += skill*2; sd->hit += skill*2;
if((skill=pc_checkskill(sd,AC_VULTURE))>0){ if((skill=pc_checkskill(sd,AC_VULTURE))>0){
sd->hit += skill; sd->hit += skill;
if(sd->status.weapon == 11) if(sd->status.weapon == W_BOW)
sd->attackrange += skill; sd->attackrange += skill;
} }
if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18 if(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)
|| sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) {
sd->hit += 2*skill; if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0)
if((skill=pc_checkskill(sd,GS_SNAKEEYE))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18 sd->hit += 2*skill;
|| sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) { if((skill=pc_checkskill(sd,GS_SNAKEEYE))>0) {
sd->hit += skill; sd->hit += skill;
sd->attackrange += skill; sd->attackrange += skill;
}
} }
// Absolute, then relative modifiers from status changes (shared between PC and NPC) // 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 // 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 // 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; 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 else
sd->aspd += ( 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] ) *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 // 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); sd->aspd_rate -= (skill/2);
if((skill = pc_checkskill(sd,SG_DEVIL)) > 0 && !pc_nextjobexp(sd)) if((skill = pc_checkskill(sd,SG_DEVIL)) > 0 && !pc_nextjobexp(sd))
sd->aspd_rate -= (skill*3); 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)) if(pc_isriding(sd))
sd->aspd_rate += 50-10*pc_checkskill(sd,KN_CAVALIERMASTERY); 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) // Relative modifiers from status changes (shared between PC and NPC)
sd->aspd_rate = status_calc_aspd_rate(&sd->bl,sd->aspd_rate); 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; aspd_rate -= (sc->data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)?30:20;
else if(sc->data[SC_SPEARSQUICKEN].timer!=-1) else if(sc->data[SC_SPEARSQUICKEN].timer!=-1)
aspd_rate -= sc->data[SC_SPEARSQUICKEN].val2; 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; aspd_rate -= sc->data[SC_ASSNCROS].val2;
} }
if(sc->data[SC_BERSERK].timer!=-1) if(sc->data[SC_BERSERK].timer!=-1)
@ -2701,7 +2700,7 @@ int status_get_batk(struct block_list *bl)
if(bl->type==BL_PC) { if(bl->type==BL_PC) {
batk = ((struct map_session_data *)bl)->base_atk; 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]; batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon];
} else { } else {
int str,dstr; int str,dstr;

View File

@ -544,8 +544,6 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
#define MAX_REFINE 10 #define MAX_REFINE 10
extern int percentrefinery[5][MAX_REFINE+1]; //The last slot always has a 0% success chance [Skotlex] 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 status_readdb(void);
int do_init_status(void); int do_init_status(void);