summaryrefslogtreecommitdiff
path: root/src/map
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
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')
-rw-r--r--src/map/battle.c12
-rw-r--r--src/map/skill.c28
2 files changed, 20 insertions, 20 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 1bd279ef3..eb20c1c43 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -809,15 +809,11 @@ void battle_consume_ammo(TBL_PC*sd, int skill, int lv)
if (skill)
{
qty = skill_get_ammo_qty(skill, lv);
- if (!qty) { //Generic skill that consumes ammo?
- qty = skill_get_num(skill, lv);
- if (qty < 0) qty *= -1;
- else
- if (qty == 0) qty = 1;
- }
+ if (!qty) qty = 1;
}
- if(sd->equip_index[10]>=0) //Qty check should have been done in skill_check_condition
- pc_delitem(sd,sd->equip_index[10],qty,0);
+
+ if(sd->equip_index[EQI_AMMO]>=0) //Qty check should have been done in skill_check_condition
+ pc_delitem(sd,sd->equip_index[EQI_AMMO],qty,0);
}
struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag);
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)