summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-29 22:30:29 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-29 22:30:29 +0000
commit777113f0520a1b9c1e8a9caa2682218b27c8e06a (patch)
tree41896ffe011ea1e52e33082ae3483b6ad40391ca /src
parent46e72fc8f9aa45151646986aae20869749121a2a (diff)
downloadhercules-777113f0520a1b9c1e8a9caa2682218b27c8e06a.tar.gz
hercules-777113f0520a1b9c1e8a9caa2682218b27c8e06a.tar.bz2
hercules-777113f0520a1b9c1e8a9caa2682218b27c8e06a.tar.xz
hercules-777113f0520a1b9c1e8a9caa2682218b27c8e06a.zip
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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11992 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/pc.c26
-rw-r--r--src/map/status.c1
4 files changed, 13 insertions, 17 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 142db46db..5aa862c67 100644
--- a/src/map/battle.c
+++ b/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, },
diff --git a/src/map/battle.h b/src/map/battle.h
index 1b12dbd03..cc956453b 100644
--- a/src/map/battle.h
+++ b/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
diff --git a/src/map/pc.c b/src/map/pc.c
index 295bc3b3b..6a7033064 100644
--- a/src/map/pc.c
+++ b/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;
diff --git a/src/map/status.c b/src/map/status.c
index 611f7e02e..cf999e37f 100644
--- a/src/map/status.c
+++ b/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)