summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-31 17:00:34 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-31 17:00:34 +0000
commit1b31cc9de6ee1eae20f7c70615db3997797e7fb1 (patch)
treebe55fa84dc7b9fe938c5ecb82816f606a10f3384 /src/map
parentc94206403784fa42f3aff2bf5a721d9eae9e5a78 (diff)
downloadhercules-1b31cc9de6ee1eae20f7c70615db3997797e7fb1.tar.gz
hercules-1b31cc9de6ee1eae20f7c70615db3997797e7fb1.tar.bz2
hercules-1b31cc9de6ee1eae20f7c70615db3997797e7fb1.tar.xz
hercules-1b31cc9de6ee1eae20f7c70615db3997797e7fb1.zip
- PF_SOULBURN no longer ignores mdef.
- HW_GRAVITATION should now invoke auto spells. - Added function battle_calc_return_damage to unify the return damage code. - Added autospell triggering to returned damage from normal attacks. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5141 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c83
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/skill.c45
3 files changed, 67 insertions, 63 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 4bfee43f0..a00c3cbbd 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2441,10 +2441,10 @@ struct Damage battle_calc_magic_attack(
flag.imdef = 1;
break;
case PR_ASPERSIO:
- case PF_SOULBURN:
case HW_GRAVITATION:
case ASC_BREAKER:
flag.imdef = 1;
+ case PF_SOULBURN: //Does not ignores mdef
flag.elefix = 0;
flag.cardfix = 0;
break;
@@ -2932,6 +2932,46 @@ struct Damage battle_calc_attack( int attack_type,
}
return d;
}
+
+int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
+ struct map_session_data *sd=NULL;
+ struct status_change *sc_data;
+ int rdamage = 0;
+
+ if (bl->type == BL_PC) sd = (struct map_session_data*)bl;
+ sc_data = status_get_sc_data(bl);
+
+ if(flag&BF_WEAPON) {
+ if (flag & BF_SHORT) {
+ if (sd && sd->short_weapon_damage_return)
+ {
+ rdamage += damage * sd->short_weapon_damage_return / 100;
+ if(rdamage < 1) rdamage = 1;
+ }
+ if (sc_data && sc_data[SC_REFLECTSHIELD].timer != -1)
+ {
+ 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;
+ if (rdamage < 1) rdamage = 1;
+ }
+ }
+ } else
+ // 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;
+ }
+ }
+ return rdamage;
+}
/*==========================================
* ’Ê?í?UŒ‚?ˆ—?‚Ü‚Æ‚ß
*------------------------------------------
@@ -2941,7 +2981,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
{
struct map_session_data *sd = NULL, *tsd = NULL;
struct status_change *sc_data, *tsc_data;
- int race, ele, damage, rdamage = 0;
+ int race, ele, damage,rdamage=0;
struct Damage wd;
nullpo_retr(0, src);
@@ -3005,55 +3045,46 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
}
}
- //Recycled the rdamage variable rather than use a new one... [Skotlex]
- if(sd && (rdamage = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0 && sd->status.weapon <= 16) // triple blow works with bows ^^ [celest]
+ //Recycled the damage variable rather than use a new one... [Skotlex]
+ if(sd && (damage = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0 && sd->status.weapon <= 16) // triple blow works with bows ^^ [celest]
{
- int triple_rate= 30 - rdamage; //Base Rate
+ int triple_rate= 30 - damage; //Base Rate
if (sc_data && sc_data[SC_SKILLRATE_UP].timer!=-1 && sc_data[SC_SKILLRATE_UP].val1 == MO_TRIPLEATTACK)
{
triple_rate+= triple_rate*(sc_data[SC_SKILLRATE_UP].val2)/100;
status_change_end(src,SC_SKILLRATE_UP,-1);
}
- if (rand()%100 < triple_rate) return skill_attack(BF_WEAPON,src,src,target,MO_TRIPLEATTACK,rdamage,tick,0);
+ if (rand()%100 < triple_rate) return skill_attack(BF_WEAPON,src,src,target,MO_TRIPLEATTACK,damage,tick,0);
}
else if (sc_data && sc_data[SC_SACRIFICE].timer != -1)
return skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,sc_data[SC_SACRIFICE].val1,tick,0);
wd = battle_calc_weapon_attack(src,target, 0, 0,0);
-
- if ((damage = wd.damage + wd.damage2) > 0 && src != target) {
- rdamage = 0;
- if (wd.flag & BF_SHORT) {
- if (tsd && tsd->short_weapon_damage_return)
- rdamage += damage * tsd->short_weapon_damage_return / 100;
- if (tsc_data && tsc_data[SC_REFLECTSHIELD].timer != -1) {
- rdamage += damage * tsc_data[SC_REFLECTSHIELD].val2 / 100;
- if (rdamage < 1) rdamage = 1;
- }
- } else if (wd.flag & BF_LONG) {
- if (tsd && tsd->long_weapon_damage_return)
- rdamage += damage * tsd->long_weapon_damage_return / 100;
- }
+
+ damage = wd.damage + wd.damage2;
+ if (damage > 0 && src != target) {
+ 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);
}
-
clif_damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2);
//“ñ“?—¬?¶Žè‚ƃJƒ^?[ƒ‹’ÇŒ‚‚̃~ƒX•\Ž¦(–³—?‚â‚è?`)
if(sd && sd->status.weapon >= 16 && wd.damage2 == 0)
clif_damage(src, target, tick+10, wd.amotion, wd.dmotion,0, 1, 0, 0);
- if (sd && sd->splash_range > 0 && (wd.damage > 0 || wd.damage2 > 0))
+ if (sd && sd->splash_range > 0 && damage > 0)
skill_castend_damage_id(src, target, 0, -1, tick, 0);
map_freeblock_lock();
- battle_delay_damage(tick+wd.amotion, src, target, BF_WEAPON, 0, 0, (wd.damage+wd.damage2), wd.dmg_lv, 0);
+ battle_delay_damage(tick+wd.amotion, src, target, BF_WEAPON, 0, 0, damage, wd.dmg_lv, 0);
- if (wd.dmg_lv == ATK_DEF || wd.damage > 0 || wd.damage2 > 0) //Added counter effect [Skotlex]
+ if (wd.dmg_lv == ATK_DEF || damage > 0) //Added counter effect [Skotlex]
skill_counter_additional_effect(src, target, 0, 0, BF_WEAPON, tick);
- if (!status_isdead(target) && (wd.damage > 0 || wd.damage2 > 0)) {
+ if (!status_isdead(target) && damage > 0) {
if (sd) {
int boss = status_get_mode(target)&MD_BOSS;
if (
@@ -3098,7 +3129,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
}
}
if (sd) {
- if (wd.flag & BF_WEAPON && src != target && (wd.damage > 0 || wd.damage2 > 0)) {
+ if (wd.flag & BF_WEAPON && src != target && damage > 0) {
int hp = 0, sp = 0;
if (!battle_config.left_cardfix_to_right) { // “ñ“?—¬?¶ŽèƒJ?[ƒh‚Ì‹zŽûŒnŒø‰Ê‚ð‰EŽè‚ɒljÁ‚µ‚È‚¢?ê?‡
hp += battle_calc_drain(wd.damage, sd->right_weapon.hp_drain_rate, sd->right_weapon.hp_drain_per, sd->right_weapon.hp_drain_value);
diff --git a/src/map/battle.h b/src/map/battle.h
index 947b59a82..56404f0c9 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -25,6 +25,8 @@ struct block_list;
struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag);
+int battle_calc_return_damage(struct block_list *bl, int damage, int flag);
+
int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_elem);
// ƒ_ƒ[ƒWÅIŒvŽZ
diff --git a/src/map/skill.c b/src/map/skill.c
index 965c75fd6..e1f6d6715 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -560,8 +560,6 @@ const struct skill_name_db skill_names[] = {
static const int dirx[8]={0,-1,-1,-1,0,1,1,1};
static const int diry[8]={1,1,0,-1,-1,-1,0,1};
-static int rdamage;
-
/* ƒXƒLƒ‹ƒf?ƒ^ƒx?ƒX */
struct skill_db skill_db[MAX_SKILL_DB];
@@ -1641,12 +1639,11 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
struct Damage dmg;
struct status_change *sc_data;
struct map_session_data *sd=NULL, *tsd=NULL;
- int type,lv,damage;
+ int type,lv,damage,rdamage=0;
static int tmpdmg = 0;
if(skillid > 0 && skilllv <= 0) return 0;
- rdamage = 0;
nullpo_retr(0, src); //Source is the master behind the attack (player/mob/pet)
nullpo_retr(0, dsrc); //dsrc is the actual originator of the damage, can be the same as src, or a skill casted by src.
nullpo_retr(0, bl); //Target to be attacked.
@@ -1862,36 +1859,9 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
break;
} //Switch End
}
- if(attack_type&BF_WEAPON && damage > 0 && src != bl && src == dsrc)
- { //•ŠíƒXƒLƒ‹•ƒ_ƒ?ƒW‚ ‚è•Žg—pŽÒ‚Æ?ÛŽÒ‚ªˆá‚¤•src=dsrc
- if(dmg.flag&BF_SHORT) { //‹ß‹——£U?ŽžH¦
- if(tsd && tsd->short_weapon_damage_return > 0)
- { //‹ß‹——£U?’µ‚Ë•Ô‚µH¦
- rdamage += damage * tsd->short_weapon_damage_return / 100;
- if(rdamage < 1) rdamage = 1;
- }
- if(sc_data && sc_data[SC_REFLECTSHIELD].timer != -1) { //ƒŠƒtƒŒƒNƒgƒV?ƒ‹ƒhŽž
- rdamage += damage * sc_data[SC_REFLECTSHIELD].val2 / 100; //’µ‚Ë•Ô‚µŒvŽZ
- if(rdamage < 1) rdamage = 1;
- }
- }
- else if(dmg.flag&BF_LONG) { //‰“‹——£U?ŽžH¦
- if(tsd && tsd->long_weapon_damage_return > 0)
- { //‰“‹——£U?’µ‚Ë•Ô‚µH¦
- rdamage += damage * tsd->long_weapon_damage_return / 100;
- if(rdamage < 1) rdamage = 1;
- }
- }
- } else
- // magic_damage_return by [AppleGirl] and [Valaris]
- if(attack_type&BF_MAGIC && damage > 0 && src != bl && src == dsrc)
- {
- if(tsd && tsd->magic_damage_return > 0 )
- {
- rdamage += damage * tsd->magic_damage_return / 100;
- if(rdamage < 1) rdamage = 1;
- }
- }
+
+ if (damage > 0 && src != bl && src == dsrc)
+ rdamage = battle_calc_return_damage(bl, damage, dmg.flag);
//•ŠíƒXƒLƒ‹H‚±‚±‚Ü‚Å
switch(skillid){
@@ -1966,7 +1936,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
//Delayed damage must be dealt after the knockback (it needs to know actual position of target)
if ((skillid || flag) && attack_type&BF_WEAPON && skillid != ASC_BREAKER) { // do not really deal damage for ASC_BREAKER's 1st attack
- battle_delay_damage(tick+dmg.amotion,src,bl,attack_type,skillid,skilllv,damage,dmg.dmg_lv,0);
+ battle_delay_damage(tick+dmg.amotion,src,bl,attack_type,skillid,skilllv,damage,dmg.dmg_lv,0);
}
if(skillid == RG_INTIMIDATE && damage > 0 && !(status_get_mode(bl)&MD_BOSS)/* && !map_flag_gvg(src->m)*/) {
@@ -2048,7 +2018,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
map_freeblock_unlock();
- return (dmg.damage+dmg.damage2); /* ?ƒ_ƒ?‚ð•Ô‚· */
+ return damage; /* ?ƒ_ƒ?‚ð•Ô‚· */
}
/*==========================================
@@ -7416,7 +7386,8 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
break;
case UNT_GRAVITATION:
- skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+ if (skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0))
+ skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MAGIC,tick);
break;
}
if (sg->val3 == HW_MAGICPOWER && ssc_data && ssc_data[SC_MAGICPOWER].timer < 0 && ssc_data[SC_MAGICPOWER].val1 > 0)