summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-05-07 12:15:14 +0000
committerInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-05-07 12:15:14 +0000
commit81a85e322a784f6237b1948c53dca39bffb42f18 (patch)
tree575dbb13c007d1b2e42881993c0cdd2ea86b4dfe /src/map/battle.c
parenta609245253626fd1d8112d4b05959471723b7d8f (diff)
downloadhercules-81a85e322a784f6237b1948c53dca39bffb42f18.tar.gz
hercules-81a85e322a784f6237b1948c53dca39bffb42f18.tar.bz2
hercules-81a85e322a784f6237b1948c53dca39bffb42f18.tar.xz
hercules-81a85e322a784f6237b1948c53dca39bffb42f18.zip
* Fixed splash damage from Baphomet Card might miss. [Inkfish]
* Check if group unit is expired before processing it. (bugreport:3054) [Inkfish] * Fixed Grand Corss outdated behavior (bugreport:1590) [Inkfish] - use new damage formula - DEF is reduced to 2/3 during cast time - block shields switching within attack duration - monsters don't damage themselves any more - intervals between hits are 300ms git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13736 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 9d6ead21e..2b9443e82 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -141,7 +141,7 @@ struct block_list* battle_getenemy(struct block_list *target, int type, int rang
return bl_list[rand()%c];
}
-// ƒ_ƒ??[ƒW‚Ì’x‰„
+// ƒ_??[ƒW‚Ì’x‰„
struct delay_damage {
struct block_list *src;
int target;
@@ -268,7 +268,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
}
/*==========================================
- * ƒ_ƒ??[ƒW?Å?IŒvŽZ
+ * ƒ_??[ƒW??IŒvŽZ
*------------------------------------------*/
int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag)
{
@@ -645,7 +645,7 @@ static int battle_calc_drain(int damage, int rate, int per)
}
/*==========================================
- * ?C—ûƒ_ƒ??[ƒW
+ * ?C—ûƒ_??[ƒW
*------------------------------------------*/
int battle_addmastery(struct map_session_data *sd,struct block_list *target,int dmg,int type)
{
@@ -1116,21 +1116,19 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
flag.hit = 1; //SG_FUSION always hit [Komurka]
flag.idef = flag.idef2 = 1; //def ignore [Komurka]
}
- if (skill_num && !flag.hit)
+ if( !flag.hit )
switch(skill_num)
{
case AS_SPLASHER:
- if (wflag) // Always hits the one exploding.
- break;
- flag.hit = 1;
+ if( !wflag ) // Always hits the one exploding.
+ flag.hit = 1;
break;
case CR_SHIELDBOOMERANG:
- if (sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_CRUSADER)
+ if( sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_CRUSADER )
flag.hit = 1;
break;
- case 0:
- //If flag, this is splash damage from Baphomet Card and it always hits.
- if (wflag)
+ case 0:
+ if( wflag ) //If flag, this is splash damage from Baphomet Card and it always hits.
flag.hit = 1;
break;
}
@@ -1888,9 +1886,6 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
else if(wd.div_ < 0) //Since the attack missed...
wd.div_ *= -1;
- if(skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS)
- return wd; //Enough, rest is not needed.
-
if(sd && (skill=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0)
ATK_ADD(skill*2);
@@ -1918,6 +1913,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
}
}
+ if(skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS)
+ return wd; //Enough, rest is not needed.
+
if (sd)
{
if (skill_num != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus.
@@ -2462,19 +2460,6 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
else
ad.damage = ad.damage * (100-mdef)/100 - mdef2;
}
-
- if(skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS)
- { //Apply the physical part of the skill's damage. [Skotlex]
- struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag);
- ad.damage = (wd.damage + ad.damage) * (100 + 40*skill_lv)/100;
- if(src==target)
- {
- if (src->type == BL_PC)
- ad.damage = ad.damage/2;
- else
- ad.damage = 0;
- }
- }
if (skill_num == NPC_EARTHQUAKE)
{ //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex]
@@ -2491,6 +2476,19 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
if (!(nk&NK_NO_ELEFIX))
ad.damage=battle_attr_fix(src, target, ad.damage, s_ele, tstatus->def_ele, tstatus->ele_lv);
+ if( skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS )
+ { //Apply the physical part of the skill's damage. [Skotlex]
+ struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag);
+ ad.damage = battle_attr_fix(src, target, wd.damage + ad.damage, s_ele, tstatus->def_ele, tstatus->ele_lv);
+ if( src == target )
+ {
+ if( src->type == BL_PC )
+ ad.damage = ad.damage/2;
+ else
+ ad.damage = 0;
+ }
+ }
+
if (sd && !(nk&NK_NO_CARDFIX_ATK)) {
short t_class = status_get_class(target);
short cardfix=1000;
@@ -2561,7 +2559,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
}
/*==========================================
- * ‚»‚Ì‘¼ƒ_ƒ??[ƒWŒvŽZ
+ * ‚»‚Ì‘¼ƒ_??[ƒWŒvŽZ
*------------------------------------------*/
struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag)
{
@@ -2797,7 +2795,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
return md;
}
/*==========================================
- * ƒ_ƒ??[ƒWŒvŽZˆêŠ‡?ˆ—?—p
+ * ƒ_??[ƒWŒvŽZˆêŠ‡?ˆ—?—p
*------------------------------------------*/
struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int count)
{
@@ -2899,7 +2897,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage,
}
/*==========================================
- * ’Ê?í?UŒ‚?ˆ—?‚Ü‚Æ‚ß
+ * ’Ê??UŒ‚?ˆ—?‚Ü‚Æ‚ß
*------------------------------------------*/
enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, unsigned int tick, int flag)
{