summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-13 17:32:47 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-13 17:32:47 +0000
commit30ca43b9befcb2662d32eba4d8cff76b114203fe (patch)
tree37984b12320fc3e90536f9b506b91483da341c70 /src/map/skill.c
parentdc2e94dba8a7d0a894456ac03262f14c5a9090ca (diff)
downloadhercules-30ca43b9befcb2662d32eba4d8cff76b114203fe.tar.gz
hercules-30ca43b9befcb2662d32eba4d8cff76b114203fe.tar.bz2
hercules-30ca43b9befcb2662d32eba4d8cff76b114203fe.tar.xz
hercules-30ca43b9befcb2662d32eba4d8cff76b114203fe.zip
- Required Weapon, ammo, and skill state are now only checked on begin casting, instead of both on begin and end casting.
- Now when autoguessing ammo consumption, the amount of ammo required is always one (making it require HIT number of arrows was rather high for things like Sonic Blows, specially when things like Arrow Vulcan only consume one arrow) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9861 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index f43b318bd..de00bd7f7 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -7938,10 +7938,15 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
hp_rate = skill_db[j].hp_rate[lv-1];
sp_rate = skill_db[j].sp_rate[lv-1];
zeny = skill_db[j].zeny[lv-1];
- weapon = skill_db[j].weapon;
- ammo = skill_db[j].ammo;
- ammo_qty = skill_db[j].ammo_qty[lv-1];
- state = skill_db[j].state;
+
+ if (!type) { //These should only be checked on begin casting.
+ weapon = skill_db[j].weapon;
+ ammo = skill_db[j].ammo;
+ ammo_qty = skill_db[j].ammo_qty[lv-1];
+ state = skill_db[j].state;
+ } else
+ weapon = ammo = ammo_qty = state = 0;
+
spiritball = skill_db[j].spiritball[lv-1];
mhp = skill_db[j].mhp[lv-1];
for(i = 0; i < 10; i++) {
@@ -7963,13 +7968,15 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
else
sp += (status->max_sp * (-sp_rate))/100;
- if (!ammo && skill && skill_isammotype(sd, skill))
+ if (weapon && !ammo && skill && skill_isammotype(sd, skill))
{ //Assume this skill is using the weapon, therefore it requires arrows.
ammo = 0xFFFFFFFF; //Enable use on all ammo types.
- ammo_qty = skill_get_num(skill, lv);
- if (ammo_qty < 0) ammo_qty *= -1;
+ ammo_qty = 1;
}
+ //Can only update state when weapon/arrow info is checked.
+ if (weapon) sd->state.arrow_atk = ammo?1:0;
+
switch(skill) { // Check for cost reductions due to skills & SCs
case MC_MAMMONITE:
if(pc_checkskill(sd,BS_UNFAIRLYTRICK)>0)
@@ -8400,12 +8407,12 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
clif_skill_fail(sd,skill,1,0); /* SP不足:失敗通知 */
return 0;
}
- if( zeny>0 && sd->status.zeny < zeny) {
+ if(zeny>0 && sd->status.zeny < zeny) {
clif_skill_fail(sd,skill,5,0);
return 0;
}
- if(!pc_check_weapontype(sd,weapon)) {
+ if(weapon && !pc_check_weapontype(sd,weapon)) {
clif_skill_fail(sd,skill,6,0);
return 0;
}
@@ -8431,7 +8438,6 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
}
}
- if(!type)//States are only checked on begin-casting. [Skotlex]
switch(state) {
case ST_HIDING:
if(!(sc && sc->option&OPTION_HIDE)) {
@@ -8558,8 +8564,6 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
if(!(type&1))
return 1;
- sd->state.arrow_atk = ammo?1:0; //Update arrow-atk state on cast-end.
-
if(delitem_flag) {
for(i=0;i<10;i++) {
if(index[i] >= 0)