diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-18 07:00:31 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-18 07:00:31 +0000 |
commit | 712ea2e956dbaae6f23229e0c7634cd95a14fe9d (patch) | |
tree | f91b0bcbfe657ffe3eff11c793c226a7c72f0335 /src | |
parent | 13c7d7cbceddc381bfaeb54889364780573dd0ae (diff) | |
download | hercules-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')
-rw-r--r-- | src/map/battle.c | 10 | ||||
-rw-r--r-- | src/map/map.h | 3 | ||||
-rw-r--r-- | src/map/pc.c | 35 | ||||
-rw-r--r-- | src/map/status.c | 4 |
4 files changed, 32 insertions, 20 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 87d4cd03a..e3980090d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4478,11 +4478,11 @@ void battle_validate_conf() { battle_config.night_at_start = 0; else if (battle_config.night_at_start > 1) // added by [Yor] battle_config.night_at_start = 1; - if (battle_config.day_duration < 0) // added by [Yor] - battle_config.day_duration = 0; - if (battle_config.night_duration < 0) // added by [Yor] - battle_config.night_duration = 0; - + if (battle_config.day_duration < 60000) // added by [Yor] + battle_config.day_duration = 60000; + if (battle_config.night_duration < 60000) // added by [Yor] + battle_config.night_duration = 60000; + if (battle_config.ban_spoof_namer < 0) // added by [Yor] battle_config.ban_spoof_namer = 0; else if (battle_config.ban_spoof_namer > 32767) diff --git a/src/map/map.h b/src/map/map.h index 1cae3dccc..15075e8dc 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -297,7 +297,8 @@ struct map_session_data { short hp_loss_value, hp_loss_type; int addrace2[6],addrace2_[6]; int subsize[3]; - short unequip_damage; + struct item_data *current_item; + short unequip_damage[11]; int itemid; int itemhealrate[6]; 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); diff --git a/src/map/status.c b/src/map/status.c index 16b489660..c5b728b73 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -521,7 +521,7 @@ int status_calc_pc(struct map_session_data* sd,int first) memset(sd->addrace2_,0,sizeof(sd->addrace2_)); sd->hp_gain_value = sd->sp_drain_type = 0; memset(sd->subsize,0,sizeof(sd->subsize)); - sd->unequip_damage = 0; + memset(sd->unequip_damage,0,sizeof(sd->unequip_damage)); if(!sd->disguiseflag && sd->disguise) { sd->disguise=0; @@ -552,6 +552,7 @@ int status_calc_pc(struct map_session_data* sd,int first) continue; if(sd->inventory_data[index]) { + sd->current_item = sd->inventory_data[index]; if(sd->inventory_data[index]->type == 4) { if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) { int j; @@ -576,6 +577,7 @@ int status_calc_pc(struct map_session_data* sd,int first) } } } + sd->current_item = NULL; } } wele = sd->atk_ele; |