Forráskód Böngészése

* Fixed the bDamageWhenUnequip effect dealing damage when unequipping unrelated items
* Fixed Incantation Samurai card reducing hp too quickly

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1248 54d463be-8e91-2dee-dedb-b68131a5f0ec

celest 20 éve
szülő
commit
96af6068fa
7 módosított fájl, 40 hozzáadás és 22 törlés
  1. 5 1
      Changelog-SVN.txt
  2. 2 0
      db/Changelog.txt
  3. 1 1
      db/item_db.txt
  4. 5 5
      src/map/battle.c
  5. 2 1
      src/map/map.h
  6. 22 13
      src/map/pc.c
  7. 3 1
      src/map/status.c

+ 5 - 1
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]

+ 2 - 0
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

+ 1 - 1
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

+ 5 - 5
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)

+ 2 - 1
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];
 

+ 22 - 13
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);

+ 3 - 1
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;