diff options
-rw-r--r-- | Changelog-Trunk.txt | 5 | ||||
-rw-r--r-- | doc/item_bonus.txt | 2 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/pc.c | 26 | ||||
-rw-r--r-- | src/map/status.c | 1 |
6 files changed, 20 insertions, 17 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index a46017b63..790bfbc36 100644 --- a/Changelog-Trunk.txt +++ b/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] diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index d31862254..0effdff43 100644 --- a/doc/item_bonus.txt +++ b/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 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) |