summaryrefslogtreecommitdiff
path: root/src/map/pc.c
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/map/pc.c
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/map/pc.c')
-rw-r--r--src/map/pc.c26
1 files changed, 13 insertions, 13 deletions
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;