summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-14 17:51:42 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-14 17:51:42 +0000
commitde8f91ae9dcda19d7a931e67104cc8fde86d0b73 (patch)
tree533057c803e498f1456ba90d020c4d65e83910c1 /src/map/battle.c
parent3f8b52f6d673b3e5d259a9bb10004375d7647533 (diff)
downloadhercules-de8f91ae9dcda19d7a931e67104cc8fde86d0b73.tar.gz
hercules-de8f91ae9dcda19d7a931e67104cc8fde86d0b73.tar.bz2
hercules-de8f91ae9dcda19d7a931e67104cc8fde86d0b73.tar.xz
hercules-de8f91ae9dcda19d7a931e67104cc8fde86d0b73.zip
- Fixed incorrect range check in autospell2 triggers.
- Modified Wedding recall skills to behave as in officials. - Modified Arrow Shower to be a ground-based skill and work as it should on officials. - Fixed skill_additional_effect triggering every time you were being hit even if no damage was returned. - Fixed battle_calc_damage_return to make magic damage be returned by 100%, and received damage nullified git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5598 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 21aea2593..ae0c1da54 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3116,7 +3116,7 @@ struct Damage battle_calc_attack( int attack_type,
return d;
}
-int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
+int battle_calc_return_damage(struct block_list *bl, int *damage, int flag) {
struct map_session_data *sd=NULL;
struct status_change *sc;
int rdamage = 0;
@@ -3125,21 +3125,22 @@ int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
sc = status_get_sc(bl);
if(flag&BF_WEAPON) {
+ //Bounces back part of the damage.
if (flag & BF_SHORT) {
if (sd && sd->short_weapon_damage_return)
{
- rdamage += damage * sd->short_weapon_damage_return / 100;
+ rdamage += *damage * sd->short_weapon_damage_return / 100;
if(rdamage < 1) rdamage = 1;
}
if (sc && sc->data[SC_REFLECTSHIELD].timer != -1)
{
- rdamage += damage * sc->data[SC_REFLECTSHIELD].val2 / 100;
+ rdamage += *damage * sc->data[SC_REFLECTSHIELD].val2 / 100;
if (rdamage < 1) rdamage = 1;
}
} else if (flag & BF_LONG) {
if (sd && sd->long_weapon_damage_return)
{
- rdamage += damage * sd->long_weapon_damage_return / 100;
+ rdamage += *damage * sd->long_weapon_damage_return / 100;
if (rdamage < 1) rdamage = 1;
}
}
@@ -3147,10 +3148,10 @@ int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
// magic_damage_return by [AppleGirl] and [Valaris]
if(flag&BF_MAGIC)
{
- if(sd && sd->magic_damage_return > 0 )
- {
- rdamage += damage * sd->magic_damage_return / 100;
- if(rdamage < 1) rdamage = 1;
+ if(sd && sd->magic_damage_return && rand()%100 < sd->magic_damage_return)
+ { //Bounces back full damage, you take none.
+ rdamage = *damage;
+ *damage = 0;
}
}
return rdamage;
@@ -3252,11 +3253,12 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
damage = wd.damage + wd.damage2;
if (damage > 0 && src != target) {
- rdamage = battle_calc_return_damage(target, damage, wd.flag);
- if (rdamage > 0)
+ rdamage = battle_calc_return_damage(target, &damage, wd.flag);
+ if (rdamage > 0) {
clif_damage(src, src, tick, wd.amotion, wd.dmotion, rdamage, 1, 4, 0);
- //Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
- skill_additional_effect(target,src,CR_REFLECTSHIELD, 1,BF_WEAPON,tick);
+ //Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
+ skill_additional_effect(target,src,CR_REFLECTSHIELD, 1,BF_WEAPON,tick);
+ }
}
clif_damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2);