summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petithory <vincent.petithory@gmail.com>2012-10-06 12:51:45 +0200
committerBen Longbons <b.r.longbons@gmail.com>2012-10-14 09:00:08 -0700
commitc1a4bdbb34000dacf827cff40030f49dcb9d9ec9 (patch)
tree46b1b1dd82a1f54c3dd7afde379ca464c0a03796
parentb6f264f2c2be32746ea262cd004f7e70e2c1bc19 (diff)
downloadtmwa-c1a4bdbb34000dacf827cff40030f49dcb9d9ec9.tar.gz
tmwa-c1a4bdbb34000dacf827cff40030f49dcb9d9ec9.tar.bz2
tmwa-c1a4bdbb34000dacf827cff40030f49dcb9d9ec9.tar.xz
tmwa-c1a4bdbb34000dacf827cff40030f49dcb9d9ec9.zip
Allow negative values for the HP/SP drain percent of the SP_HP_DRAIN_RATE/SP_SP_DRAIN_RATE item bonuses.
-rw-r--r--src/map/battle.cpp28
-rw-r--r--src/map/skill.cpp24
2 files changed, 10 insertions, 42 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 818d77e..a636af4 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -5094,41 +5094,25 @@ int battle_weapon_attack (struct block_list *src, struct block_list *target,
&& (wd.damage > 0 || wd.damage2 > 0))
{
int hp = 0, sp = 0;
- if (sd->hp_drain_rate && sd->hp_drain_per > 0 && wd.damage > 0
+ if (sd->hp_drain_rate && wd.damage > 0
&& MRAND (100) < sd->hp_drain_rate)
{
hp += (wd.damage * sd->hp_drain_per) / 100;
- if (sd->hp_drain_rate > 0 && hp < 1)
- hp = 1;
- else if (sd->hp_drain_rate < 0 && hp > -1)
- hp = -1;
}
- if (sd->hp_drain_rate_ && sd->hp_drain_per_ > 0
- && wd.damage2 > 0 && MRAND (100) < sd->hp_drain_rate_)
+ if (sd->hp_drain_rate_ && wd.damage2 > 0
+ && MRAND (100) < sd->hp_drain_rate_)
{
hp += (wd.damage2 * sd->hp_drain_per_) / 100;
- if (sd->hp_drain_rate_ > 0 && hp < 1)
- hp = 1;
- else if (sd->hp_drain_rate_ < 0 && hp > -1)
- hp = -1;
}
- if (sd->sp_drain_rate && sd->sp_drain_per > 0 && wd.damage > 0
+ if (sd->sp_drain_rate && wd.damage > 0
&& MRAND (100) < sd->sp_drain_rate)
{
sp += (wd.damage * sd->sp_drain_per) / 100;
- if (sd->sp_drain_rate > 0 && sp < 1)
- sp = 1;
- else if (sd->sp_drain_rate < 0 && sp > -1)
- sp = -1;
}
- if (sd->sp_drain_rate_ && sd->sp_drain_per_ > 0
- && wd.damage2 > 0 && MRAND (100) < sd->sp_drain_rate_)
+ if (sd->sp_drain_rate_ && wd.damage2 > 0
+ && MRAND (100) < sd->sp_drain_rate_)
{
sp += (wd.damage2 * sd->sp_drain_per_) / 100;
- if (sd->sp_drain_rate_ > 0 && sp < 1)
- sp = 1;
- else if (sd->sp_drain_rate_ < 0 && sp > -1)
- sp = -1;
}
if (hp || sp)
pc_heal (sd, hp, sp);
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index dfacf8c..c7ef9fd 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -2020,41 +2020,25 @@ int skill_attack (int attack_type, struct block_list *src,
struct map_session_data *sd = (struct map_session_data *) src;
int hp = 0, sp = 0;
nullpo_retr (0, sd);
- if (sd->hp_drain_rate && sd->hp_drain_per > 0 && dmg.damage > 0
+ if (sd->hp_drain_rate && dmg.damage > 0
&& MRAND (100) < sd->hp_drain_rate)
{
hp += (dmg.damage * sd->hp_drain_per) / 100;
- if (sd->hp_drain_rate > 0 && hp < 1)
- hp = 1;
- else if (sd->hp_drain_rate < 0 && hp > -1)
- hp = -1;
}
- if (sd->hp_drain_rate_ && sd->hp_drain_per_ > 0 && dmg.damage2 > 0
+ if (sd->hp_drain_rate_ && dmg.damage2 > 0
&& MRAND (100) < sd->hp_drain_rate_)
{
hp += (dmg.damage2 * sd->hp_drain_per_) / 100;
- if (sd->hp_drain_rate_ > 0 && hp < 1)
- hp = 1;
- else if (sd->hp_drain_rate_ < 0 && hp > -1)
- hp = -1;
}
- if (sd->sp_drain_rate > 0 && sd->sp_drain_per > 0 && dmg.damage > 0
+ if (sd->sp_drain_rate > 0 && dmg.damage > 0
&& MRAND (100) < sd->sp_drain_rate)
{
sp += (dmg.damage * sd->sp_drain_per) / 100;
- if (sd->sp_drain_rate > 0 && sp < 1)
- sp = 1;
- else if (sd->sp_drain_rate < 0 && sp > -1)
- sp = -1;
}
- if (sd->sp_drain_rate_ > 0 && sd->sp_drain_per_ > 0 && dmg.damage2 > 0
+ if (sd->sp_drain_rate_ > 0 && dmg.damage2 > 0
&& MRAND (100) < sd->sp_drain_rate_)
{
sp += (dmg.damage2 * sd->sp_drain_per_) / 100;
- if (sd->sp_drain_rate_ > 0 && sp < 1)
- sp = 1;
- else if (sd->sp_drain_rate_ < 0 && sp > -1)
- sp = -1;
}
if (hp || sp)
pc_heal (sd, hp, sp);