Ver Fonte

Implemented THE official Steal skill equation and game mechanics (basically version from /stable plus a few tweaks) (see topic:116540).
Added missing bAddStealRate reference to doc/item_bonus.txt.
Removed skill_steal_rate, as it was never used in the code (see r231).
Removed skill_steal_type, it's just a one-liner source mod (see r231).

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

ultramage há 17 anos atrás
pai
commit
470a56dbea
6 ficheiros alterados com 20 adições e 17 exclusões
  1. 5 0
      Changelog-Trunk.txt
  2. 2 0
      doc/item_bonus.txt
  3. 0 1
      src/map/battle.c
  4. 0 2
      src/map/battle.h
  5. 13 13
      src/map/pc.c
  6. 0 1
      src/map/status.c

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/12/29
+	* Implemented THE official Steal skill equation and game mechanics
+	  (basically version from /stable plus a few tweaks) (see topic:116540)
+	* Added missing bAddStealRate reference to doc/item_bonus.txt
+	* Removed skill_steal_rate, as it was never used in the code (see r231)
+	* Removed skill_steal_type, it's just a one-liner source mod (see r231)
 	* Knockback now works through cells where there is a diagonal path, but
 	  no horizontal+vertical (two 90` icewalls with a gap where they 'join')
 	* Some dead code removal in path.c [ultramage]

+ 2 - 0
doc/item_bonus.txt

@@ -270,3 +270,5 @@ bonus3 bAddMonsterDropItemGroup,n,x,y;	y% chance to get an item of group type n
 
 bonus2 bWeaponComaRace,x,y;		y/100% chance to cause Coma when attacking a
 					monster of race x with a normal attack
+
+bAddStealRate,n;			n/100% increase to Steal skill success chance

+ 0 - 1
src/map/battle.c

@@ -3579,7 +3579,6 @@ static const struct _battle_data {
 	{ "mobs_level_up",                      &battle_config.mobs_level_up,                   0,      0,      1,              },
 	{ "mobs_level_up_exp_rate",             &battle_config.mobs_level_up_exp_rate,          1,      1,      INT_MAX,        },
 	{ "pk_min_level",                       &battle_config.pk_min_level,                    55,     1,      INT_MAX,        },
-	{ "skill_steal_type",                   &battle_config.skill_steal_type,                1,      0,      1,              },
 	{ "skill_steal_max_tries",              &battle_config.skill_steal_max_tries,           0,      0,      UCHAR_MAX,      },
 	{ "motd_type",                          &battle_config.motd_type,                       0,      0,      1,              },
 	{ "finding_ore_rate",                   &battle_config.finding_ore_rate,                100,    0,      INT_MAX,        },

+ 0 - 2
src/map/battle.h

@@ -351,8 +351,6 @@ extern struct Battle_Config
 	int mobs_level_up; // [Valaris]
 	int mobs_level_up_exp_rate; // [Valaris]
 	int pk_min_level; // [celest]
-	int skill_steal_type; // [celest]
-	int skill_steal_rate; // [celest]
 	int skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus]
 	int motd_type; // [celest]
 	int finding_ore_rate; // orn

+ 13 - 13
src/map/pc.c

@@ -3295,7 +3295,8 @@ int pc_show_steal(struct block_list *bl,va_list ap)
  *------------------------------------------*/
 int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
 {
-	int i,rate,itemid,flag;
+	int i,itemid,flag;
+	double rate;
 	struct status_data *sd_status, *md_status;
 	struct mob_data *md;
 	struct item tmp_item;
@@ -3320,23 +3321,22 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
 		md->state.steal_flag = UCHAR_MAX;
 		return 0;
 	}
-						
-	rate = battle_config.skill_steal_type
-		? (sd_status->dex - md_status->dex)/2 + lv*6 + 10
-		: (sd_status->dex - md_status->dex)   + lv*3 + 10;
 
-	rate += sd->add_steal_rate; //Better make the steal_Rate addition affect % rather than an absolute on top of the total drop rate. [Skotlex]
+	// base skill success chance (percentual)
+	rate = (sd_status->dex - md_status->dex)/2 + lv*6 + 4;
+	rate += sd->add_steal_rate;
 		
-	if (rate < 1)
+	if( rate < 1 )
 		return 0;
 
-	//preliminar statistical data hints at this behaviour:
-	//each steal attempt: try to steal against ONE mob drop, and no more.
-	i = rand()%(MAX_STEAL_DROP); //You can't steal from the last slot.
-
-	if(rand() % 10000 >= md->db->dropitem[i].p*rate/100)
+	// Try dropping one item, in the order from first to last possible slot.
+	// Droprate is affected by the skill success rate.
+	for( i = 0; i < MAX_STEAL_DROP; i++ )
+		if( md->db->dropitem[i].nameid > 0 && rand() % 10000 < md->db->dropitem[i].p * rate/100. )
+			break;
+	if( i == MAX_STEAL_DROP )
 		return 0;
-	
+
 	itemid = md->db->dropitem[i].nameid;
 	memset(&tmp_item,0,sizeof(tmp_item));
 	tmp_item.nameid = itemid;

+ 0 - 1
src/map/status.c

@@ -1769,7 +1769,6 @@ int status_calc_pc(struct map_session_data* sd,int first)
 		// shorts
 		+ sizeof(sd->splash_range)
 		+ sizeof(sd->splash_add_range)
-		+ sizeof(sd->add_steal_rate)
 		+ sizeof(sd->hp_gain_value)
 		+ sizeof(sd->sp_gain_value)
 		+ sizeof(sd->sp_vanish_rate)