Skip to content

Commit

Permalink
Corrected Steal Coin formulas and battle log message
Browse files Browse the repository at this point in the history
- Updated to use official formulas from Aegis (for both success chance
  and stolen zeny amount.)
- It now shows the correct stolen zeny amount in the battle log, rather
  than showing the skill level.
- Made possible thanks to Yommy and Ind.

Signed-off-by: Haru <haru@dotalux.com>
  • Loading branch information
MishimaHaruna committed Dec 3, 2013
1 parent ff57790 commit 470ab15
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
27 changes: 14 additions & 13 deletions src/map/pc.c
Expand Up @@ -4814,14 +4814,16 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
return 1;
}

/*==========================================
* Stole zeny from bl (mob)
* return
* 0 = fail
* 1 = success
*------------------------------------------*/
int pc_steal_coin(struct map_session_data *sd,struct block_list *target) {
int rate,skill_lv;
/**
* Steals zeny from a monster through the RG_STEALCOIN skill.
*
* @param sd Source character
* @param target Target monster
*
* @return Amount of stolen zeny (0 in case of failure)
**/
int pc_steal_coin(struct map_session_data *sd, struct block_list *target) {
int rate, skill_lv;
struct mob_data *md;
if(!sd || !target || target->type != BL_MOB)
return 0;
Expand All @@ -4833,15 +4835,14 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target) {
if( mob_is_treasure(md) )
return 0;

// FIXME: This formula is either custom or outdated.
skill_lv = pc->checkskill(sd,RG_STEALCOIN)*10;
rate = skill_lv + (sd->status.base_level - md->level)*3 + sd->battle_status.dex*2 + sd->battle_status.luk*2;
skill_lv = pc->checkskill(sd, RG_STEALCOIN);
rate = skill_lv*10 + (sd->status.base_level - md->level)*2 + sd->battle_status.dex/2 + sd->battle_status.luk/2;
if(rnd()%1000 < rate) {
int amount = md->level*10 + rnd()%100;
int amount = md->level * skill_lv / 10 + md->level*8 + rnd()%(md->level*2 + 1); // mob_lv * skill_lv / 10 + random [mob_lv*8; mob_lv*10]

pc->getzeny(sd, amount, LOG_TYPE_STEAL, NULL);
md->state.steal_coin_flag = 1;
return 1;
return amount;
}
return 0;
}
Expand Down
13 changes: 6 additions & 7 deletions src/map/skill.c
Expand Up @@ -6114,15 +6114,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin

case RG_STEALCOIN:
if(sd) {
if(pc->steal_coin(sd,bl))
{
int amount = pc->steal_coin(sd, bl);
if( amount > 0 ) {
dstmd->state.provoke_flag = src->id;
mob->target(dstmd, src, skill->get_range2(src,skill_id,skill_lv));
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
mob->target(dstmd, src, skill->get_range2(src, skill_id, skill_lv));
clif->skill_nodamage(src, bl, skill_id, amount, 1);

}
else
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
} else
clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
}
break;

Expand Down

0 comments on commit 470ab15

Please sign in to comment.