summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-31 17:22:06 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-31 17:22:06 +0000
commit8188128698408ab4caf7809e98943402bdc116cc (patch)
tree55ccd22540fa0661c7f726bd43c8e48285ad0b58 /src
parent0521cef44f741f120f3ba0e8573653a2f018c048 (diff)
downloadhercules-8188128698408ab4caf7809e98943402bdc116cc.tar.gz
hercules-8188128698408ab4caf7809e98943402bdc116cc.tar.bz2
hercules-8188128698408ab4caf7809e98943402bdc116cc.tar.xz
hercules-8188128698408ab4caf7809e98943402bdc116cc.zip
- Changed the look field of all arrows to 1.
- Added column "RequiredArrowType" to skill_require_db, set to 1 all arrow-based skills. - Added support for ArrowType requirement on skills. It checks for having an item equipped on the arrow-slot who's view has to match with the required arrow-type (works the same way it does for weapons). - Skills will automatically be ranged and arrow-types when they have a arrow-requirement. - Skills will automatically consume arrows if used with a bow and the skill is an attack weapon-based skill even if the skill_require_db doesn't specifies arrow requirements (this is for stuff like backstab used with bows) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5829 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c53
-rw-r--r--src/map/skill.c73
-rw-r--r--src/map/skill.h3
3 files changed, 40 insertions, 89 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index cc992fbc4..ba3dc6ce4 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1021,32 +1021,33 @@ static struct Damage battle_calc_weapon_attack(
}
}
//Set miscellaneous data that needs be filled regardless of hit/miss
- 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)) {
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
- flag.arrow = 1;
+ if(sd) {
+ switch (sd->status.weapon) {
+ case 11:
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
+ flag.arrow = 1;
+ break;
+ }
} else if (status_get_range(src) > 3)
wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
-
+ if(skill_num && skill_get_arrowtype(skill_num)) {
+ //Skills that require a consumable are also long-ranged arrow-types
+ wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
+ flag.arrow = 1;
+ }
+
if(skill_num){
wd.flag=(wd.flag&~BF_SKILLMASK)|BF_SKILL;
switch(skill_num)
{
- case AC_DOUBLE:
- case AC_SHOWER:
- case AC_CHARGEARROW:
- case BA_MUSICALSTRIKE:
- case DC_THROWARROW:
- case CG_ARROWVULCAN:
- case AS_VENOMKNIFE:
- case HT_POWER:
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
- flag.arrow = 1;
- break;
-
case HT_PHANTASMIC:
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
+ case GS_MAGICALBULLET:
flag.arrow = 0;
break;
@@ -1103,22 +1104,6 @@ static struct Damage battle_calc_weapon_attack(
//Until they're at right position - gs_arrow- [Vicious]
case GS_RAPIDSHOWER:
wd.div_= 5;
- case GS_BULLSEYE:
- case GS_CRACKER:
- case GS_TRACKING:
- case GS_PIERCINGSHOT:
- case GS_DUST:
- case GS_SPREADATTACK:
- case NJ_SYURIKEN:
- case NJ_KUNAI:
- case NJ_HUUMA:
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
- flag.arrow = 1;
- break;
-
- case GS_MAGICALBULLET:
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
- flag.arrow = 0;
break;
}
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 43c575e75..1e0c4b8ce 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -658,6 +658,7 @@ int skill_get_time( int id ,int lv ){ skill_get (skill_db[id].upkeep_time[lv-1],
int skill_get_time2( int id ,int lv ){ skill_get (skill_db[id].upkeep_time2[lv-1], id, lv); }
int skill_get_castdef( int id ){ skill_get (skill_db[id].cast_def_rate, id, 1); }
int skill_get_weapontype( int id ){ skill_get (skill_db[id].weapon, id, 1); }
+int skill_get_arrowtype( int id ){ skill_get (skill_db[id].arrow, id, 1); }
int skill_get_inf2( int id ){ skill_get (skill_db[id].inf2, id, 1); }
int skill_get_castcancel( int id ){ skill_get (skill_db[id].castcancel, id, 1); }
int skill_get_maxcount( int id ){ skill_get (skill_db[id].maxcount, id, 1); }
@@ -7542,9 +7543,8 @@ static int skill_check_condition_hermod_sub(struct block_list *bl,va_list ap)
*/
int skill_check_condition(struct map_session_data *sd,int skill, int lv, int type)
{
- int i,j,hp,sp,hp_rate,sp_rate,zeny,weapon,state,spiritball,mhp;
+ int i,j,hp,sp,hp_rate,sp_rate,zeny,weapon,arrow,state,spiritball,mhp;
int index[10],itemid[10],amount[10];
- int arrow_flag = 0;
int force_gem_flag = 0;
int delitem_flag = 1, checkitem_flag = 1;
@@ -7629,6 +7629,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
sp_rate = skill_db[j].sp_rate[lv-1];
zeny = skill_db[j].zeny[lv-1];
weapon = skill_db[j].weapon;
+ arrow = skill_db[j].arrow;
state = skill_db[j].state;
spiritball = skill_db[j].spiritball[lv-1];
mhp = skill_db[j].mhp[lv-1]; /* ?���HP */
@@ -7647,6 +7648,12 @@ 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 (!arrow && sd->status.weapon == 11 && skill &&
+ skill != HT_PHANTASMIC && skill != GS_MAGICALBULLET &&
+ skill_get_type(skill) == BF_WEAPON && !(skill_get_nk(skill)&NK_NO_DAMAGE)
+ ) //Assume this skill is using the weapon, therefore it requires arrows.
+ arrow = 2; //1<<1 <- look 1 (arrows) moved right 1 times.
+
switch(skill) { // Check for cost reductions due to skills & SCs
case MC_MAMMONITE:
if(pc_checkskill(sd,BS_UNFAIRLYTRICK)>0)
@@ -7871,29 +7878,6 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
case HT_POWER:
if(sd->sc.data[SC_COMBO].timer == -1 || sd->sc.data[SC_COMBO].val1 != skill)
return 0;
- case AC_DOUBLE:
- case AC_SHOWER:
- case AC_CHARGEARROW:
- case BA_MUSICALSTRIKE:
- case DC_THROWARROW:
- case SN_SHARPSHOOTING:
- case CG_ARROWVULCAN:
- arrow_flag = 1; //Venom Knife does not gets the arrow deleted because
- //it gets deleted as part of the skill requirements. [Skotlex]
- case AS_VENOMKNIFE:
- if(sd->equip_index[10] < 0) {
- clif_arrow_fail(sd,0);
- return 0;
- }
- break;
- case RG_BACKSTAP:
- if(sd->status.weapon == 11) {
- if (sd->equip_index[10] < 0) {
- clif_arrow_fail(sd,0);
- return 0;
- }
- arrow_flag = 1;
- }
break;
case HW_GANBANTEIN:
force_gem_flag = 1;
@@ -8034,12 +8018,6 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
case GS_CRACKER:
case GS_BULLSEYE:
spiritball = 1;
- if (skill != GS_MAGICALBULLET)
- arrow_flag = 1;
- if(sd->equip_index[10] < 0) {
- clif_arrow_fail(sd,0);
- return 0;
- }
break;
case GS_MADNESSCANCEL:
@@ -8058,28 +8036,6 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
spiritball = 2;
break;
- //Bullets 13200~13202
- //Nade 13203~13207
- //Shuriken 13250~13254
- //Kunai 13255~14359
- case GS_TRACKING:
- case GS_DISARM:
- case GS_PIERCINGSHOT:
- case GS_RAPIDSHOWER:
- case GS_DESPERADO:
- case GS_DUST:
- case GS_FULLBUSTER:
- case GS_SPREADATTACK:
- case GS_GROUNDDRIFT:
- case NJ_SYURIKEN:
- case NJ_KUNAI:
- //case NJ_HUUMA:
- arrow_flag = 1;
- if(sd->equip_index[10] < 0) {
- clif_arrow_fail(sd,0);
- return 0;
- }
- break;
case NJ_KAENSIN:
case NJ_BAKUENRYU:
case NJ_SUITON:
@@ -8122,6 +8078,15 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
clif_skill_fail(sd,skill,6,0);
return 0;
}
+ if(arrow) { //Skill requires arrow.
+ if((i=sd->equip_index[10]) < 0 ||
+ !sd->inventory_data[i] ||
+ !(arrow&1<<sd->inventory_data[i]->look)
+ ) {
+ clif_arrow_fail(sd,0);
+ return 0;
+ }
+ }
if( spiritball > 0 && sd->spiritball < spiritball) {
clif_skill_fail(sd,skill,0,0); // �����s��
return 0;
@@ -8251,7 +8216,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
if(index[i] >= 0)
pc_delitem(sd,index[i],amount[i],0); // �A�C�e��?���
}
- if (arrow_flag && battle_config.arrow_decrement)
+ if (arrow && battle_config.arrow_decrement)
pc_delitem(sd,sd->equip_index[10],1,0);
}
diff --git a/src/map/skill.h b/src/map/skill.h
index 174a224b4..da42198c9 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -53,7 +53,7 @@ struct skill_db {
int inf2,maxcount,skill_type;
int blewcount[MAX_SKILL_LEVEL];
int hp[MAX_SKILL_LEVEL],sp[MAX_SKILL_LEVEL],mhp[MAX_SKILL_LEVEL],hp_rate[MAX_SKILL_LEVEL],sp_rate[MAX_SKILL_LEVEL],zeny[MAX_SKILL_LEVEL];
- int weapon,state,spiritball[MAX_SKILL_LEVEL];
+ int weapon,arrow,state,spiritball[MAX_SKILL_LEVEL];
int itemid[10],amount[10];
int castnodex[MAX_SKILL_LEVEL];
int delaynodex[MAX_SKILL_LEVEL];
@@ -153,6 +153,7 @@ int skill_get_time( int id ,int lv );
int skill_get_time2( int id ,int lv );
int skill_get_castdef( int id );
int skill_get_weapontype( int id );
+int skill_get_arrowtype( int id );
int skill_get_unit_id(int id,int flag);
int skill_get_inf2( int id );
int skill_get_castcancel( int id );