diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-03 04:02:17 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-03 04:02:17 +0000 |
commit | 1765c5b7f0042daf83b6b506a3680009b74c0970 (patch) | |
tree | db1dfb9d59e149dcbdb313ee762ddb8935b6f7f3 /src/map/battle.c | |
parent | c6b4414211979c7607110293f1d0f34b7c1ade5e (diff) | |
download | hercules-1765c5b7f0042daf83b6b506a3680009b74c0970.tar.gz hercules-1765c5b7f0042daf83b6b506a3680009b74c0970.tar.bz2 hercules-1765c5b7f0042daf83b6b506a3680009b74c0970.tar.xz hercules-1765c5b7f0042daf83b6b506a3680009b74c0970.zip |
- Fixed standing up not really standing you up.
- Moved battle_consume_ammo to the end of skill_castend_damage_id, skill_castend_nodamage_id and skill_castend_pos2 rather than battle_calc_weapon_attack. They will trigger when the player's arrow_atk state is active and a ground skill was not invoked. It should fix all issues with splash/ground skills consuming ammo per target rather than once per skill use.
- Added structure state to the ground skills, their fields are magic_power, into_abyss and ammo_consume to indicate the states that were previously stored in val3.
- Corrected Desperado ammo consumption (should be 10)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6455 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r-- | src/map/battle.c | 64 |
1 files changed, 16 insertions, 48 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 641e17378..d042ef75f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -947,12 +947,6 @@ void battle_consume_ammo(TBL_PC*sd, int skill, int lv) if (!battle_config.arrow_decrement)
return;
- if (skill == AC_SHOWER) {
- //Can't consume arrows this way as it triggers per target, gotta wait for the direct invocation with lv -1
- if (lv > 0)
- return;
- lv *= -1;
- }
if (skill)
{
qty = skill_get_ammo_qty(skill, lv);
@@ -1071,31 +1065,14 @@ static struct Damage battle_calc_weapon_attack( }
}
//Set miscellaneous data that needs be filled regardless of hit/miss
- if(sd) {
- if (!skill_num) //Ammo condition for weapons is lower below.
- switch (sd->status.weapon) {
- 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;
- }
- } else if (status_get_range(src) > 3)
- wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG;
-
- if(skill_num &&
- (skill_get_ammotype(skill_num) ||
- (sd && skill_isammotype(sd, skill_num)))
- ){
- //Skills that require a consumable are also long-ranged arrow-types
+ if(
+ (sd && sd->state.arrow_atk) ||
+ (!sd && ((skill_num && skill_get_ammotype(skill_num)) || status_get_range(src)>3))
+ ) {
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)
@@ -1164,11 +1141,6 @@ static struct Damage battle_calc_weapon_attack( if(is_boss(target)) //Bosses can't be knocked-back
wd.blewcount = 0;
- if (sd)
- { //Arrow consumption
- sd->state.arrow_atk = flag.arrow;
- }
-
/* Apparently counter attack no longer causes you to be critical'ed by mobs. [Skotlex]
//Check for counter
if(!skill_num)
@@ -1186,8 +1158,6 @@ static struct Damage battle_calc_weapon_attack( wd.type=0x0b;
wd.dmg_lv=ATK_LUCKY;
if (wd.div_ < 0) wd.div_*=-1;
- if (sd && flag.arrow)
- battle_consume_ammo(sd, skill_num, skill_lv);
return wd;
}
}
@@ -1376,8 +1346,6 @@ static struct Damage battle_calc_weapon_attack( if(tsd && tsd->special_state.no_weapon_damage) {
if (wd.div_ < 0) wd.div_*=-1;
- if (sd && flag.arrow)
- battle_consume_ammo(sd, skill_num, skill_lv);
return wd;
}
@@ -2144,11 +2112,8 @@ static struct Damage battle_calc_weapon_attack( if (flag.lh && (flag.hit || wd.damage2>0))
wd.damage2 = 1;
if (!(battle_config.skill_min_damage&1))
- { //Do not return if you are supposed to deal greater damage to plants than 1. [Skotlex]
- if (sd && flag.arrow)
- battle_consume_ammo(sd, skill_num, skill_lv);
+ //Do not return if you are supposed to deal greater damage to plants than 1. [Skotlex]
return wd;
- }
}
if(sd && !skill_num && !flag.cri)
@@ -2207,8 +2172,6 @@ static struct Damage battle_calc_weapon_attack( if(wd.damage > 0 && wd.damage2 < 1) wd.damage2 = 1;
flag.lh = 1;
}
- if (flag.arrow) //Consume the arrow.
- battle_consume_ammo(sd, skill_num, skill_lv);
}
if(wd.damage > 0 || wd.damage2 > 0)
@@ -3117,11 +3080,13 @@ 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 == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
- && sd->equip_index[10] < 0)
- {
- clif_arrow_fail(sd,0);
- return 0;
+ if (sd)
+ {
+ sd->state.arrow_atk = (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE));
+ if (sd->state.arrow_atk && sd->equip_index[10]<0) {
+ clif_arrow_fail(sd,0);
+ return 0;
+ }
}
if (sc && sc->data[SC_CLOAKING].timer != -1 && !sc->data[SC_CLOAKING].val4)
@@ -3175,6 +3140,9 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, wd = battle_calc_weapon_attack(src,target, 0, 0,0);
+ if (sd && sd->state.arrow_atk) //Consume arrow.
+ battle_consume_ammo(sd, 0, 0);
+
damage = wd.damage + wd.damage2;
if (damage > 0 && src != target) {
rdamage = battle_calc_return_damage(target, &damage, wd.flag);
|