summaryrefslogtreecommitdiff
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
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
-rw-r--r--Changelog-SVN.txt6
-rw-r--r--db/Changelog.txt2
-rw-r--r--db/item_db.txt2
-rw-r--r--src/map/battle.c10
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/pc.c35
-rw-r--r--src/map/status.c4
7 files changed, 40 insertions, 22 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt
index cfabe9225..06e094517 100644
--- a/Changelog-SVN.txt
+++ b/Changelog-SVN.txt
@@ -1,7 +1,11 @@
Date Added
-03/17
+03/18
+ * Fixed the bDamageWhenUnequip effect dealing damage when unequipping unrelated
+ items [celest]
* Fixed compile errors in SQL char.c [celest]
+
+03/17
* Added ~86 new cards. Fixed new cards bugs, optimized [Lupus] thanks to Indiona,Landarma
* Removed nullpo warning from trade.c (my prev anti-spoof protection) [Lupus]
* Added the new Einbroch/Einbech maps to maps_athena.conf [celest]
diff --git a/db/Changelog.txt b/db/Changelog.txt
index 44876c60e..44b59f0b2 100644
--- a/db/Changelog.txt
+++ b/db/Changelog.txt
@@ -6,6 +6,8 @@
Skill databases == celest working on them i believe.
03/18
+ * Fixed Incantation Samurai card reducing HP too quickly - the time should
+ be in milliseconds ^^; [celest]
* Added ~86 new cards. Fixed, optimized [Lupus]
Thanks to Indiona,Landarma. Gosh, I had to fix some bugz ^_-
03/16
diff --git a/db/item_db.txt b/db/item_db.txt
index de4ff01cb..a4135aa77 100644
--- a/db/item_db.txt
+++ b/db/item_db.txt
@@ -1299,7 +1299,7 @@
4260,Wootan_Shooter_Card,Wootan Shooter Card,6,20,0,10,,,,,,,769,,,,{},{ bonus bDef,1; bonus2 bResEff,Eff_Confusion,2000; } //OK
4261,Wootan_Fighter_Card,Wootan Fighter Card,6,20,0,10,,,,,,,769,,,,{},{ bonus bDef,1; bonus2 bResEff,Eff_Bleeding,2000; } //OK
4262,Taoist_Hermit_Card,Taoist Hermit Card,6,20,0,10,,,,,,,,,,,{},{}
-4263,Incantation_Samurai_Card,Incantation Samurai Card,6,20,0,10,,,,,,,2,,,,{},{ bonus bIgnoreDefMob,0; bonus2 bHPLossRate,300,10; bonus bDamageWhenUnequip,1000; } //??OK
+4263,Incantation_Samurai_Card,Incantation Samurai Card,6,20,0,10,,,,,,,2,,,,{},{ bonus bIgnoreDefMob,0; bonus2 bHPLossRate,300,10000; bonus bDamageWhenUnequip,1000; } //??OK
4264,Wind_Ghost_Card,Wind Ghost Card,6,20,0,10,,,,,,,136,,,,{},{ if(getskilllv(84)==10) goto JT_10; bonus3 bAutoSpell,84,3,1; JT_10: bonus3 bAutoSpell,66,10,1; } //??OK
4265,Li_Me_Mang_Ryang_Card,Li Me Mang Ryang Card,6,20,0,10,,,,,,,,,,,{},{}
4266,Eclipse_Card,Eclipse Card,6,20,0,10,,,,,,,4,,,,{},{ bonus bVit,1; if(isequipped(4006)) bonus bFlee,18; } //OK
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;