summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-18 07:00:31 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-18 07:00:31 +0000
commit712ea2e956dbaae6f23229e0c7634cd95a14fe9d (patch)
treef91b0bcbfe657ffe3eff11c793c226a7c72f0335 /src/map/pc.c
parent13c7d7cbceddc381bfaeb54889364780573dd0ae (diff)
downloadhercules-712ea2e956dbaae6f23229e0c7634cd95a14fe9d.tar.gz
hercules-712ea2e956dbaae6f23229e0c7634cd95a14fe9d.tar.bz2
hercules-712ea2e956dbaae6f23229e0c7634cd95a14fe9d.tar.xz
hercules-712ea2e956dbaae6f23229e0c7634cd95a14fe9d.zip
* Fixed the bDamageWhenUnequip effect dealing damage when unequipping unrelated items
* Fixed Incantation Samurai card reducing hp too quickly git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1248 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index abd758a02..d53a4302f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1584,8 +1584,15 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
sd->hp_gain_value += val;
break;
case SP_DAMAGE_WHEN_UNEQUIP:
- if(!sd->state.lr_flag)
- sd->unequip_damage += val;
+ if(!sd->state.lr_flag && sd->current_item) {
+ int i;
+ for (i=0; i<11; i++) {
+ if (sd->current_item->equip & equip_pos[i]) {
+ sd->unequip_damage[i] += val;
+ break;
+ }
+ }
+ }
break;
default:
if(battle_config.error_log)
@@ -6069,6 +6076,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos)
*/
int pc_unequipitem(struct map_session_data *sd,int n,int flag)
{
+ short dmg = 0;
nullpo_retr(0, sd);
// -- moonsoul (if player is berserk then cannot unequip)
@@ -6083,8 +6091,13 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
if(sd->status.inventory[n].equip){
int i;
for(i=0;i<11;i++) {
- if(sd->status.inventory[n].equip & equip_pos[i])
+ if(sd->status.inventory[n].equip & equip_pos[i]) {
sd->equip_index[i] = -1;
+ if(sd->unequip_damage[i] > 0) {
+ dmg += sd->unequip_damage[i];
+ sd->unequip_damage[i] = 0;
+ }
+ }
}
if(sd->status.inventory[n].equip & 0x0002) {
sd->weapontype1 = 0;
@@ -6130,12 +6143,6 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
} else {
clif_unequipitemack(sd,n,0,0);
}
- if (sd->unequip_damage > 0) {
- short dmg = sd->unequip_damage;
- if (dmg > sd->status.hp)
- dmg = sd->status.hp;
- pc_heal(sd,-dmg,0);
- }
if(flag&1) {
status_calc_pc(sd,0);
@@ -6143,6 +6150,12 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1);
}
+ if (dmg > 0) {
+ if (dmg > sd->status.hp)
+ dmg = sd->status.hp;
+ pc_heal(sd,-dmg,0);
+ }
+
return 0;
}
@@ -7226,10 +7239,6 @@ int do_init_pc(void) {
{
int day_duration = battle_config.day_duration;
int night_duration = battle_config.night_duration;
- if (day_duration < 60000)
- day_duration = 60000;
- if (night_duration < 60000)
- night_duration = 60000;
if (battle_config.night_at_start == 0) {
night_flag = 0; // 0=day, 1=night [Yor]
day_timer_tid = add_timer_interval(gettick() + day_duration + night_duration, map_day_timer, 0, 0, day_duration + night_duration);