Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions conf/battle/pandas.conf
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,12 @@ mob_default_damagemotion: 0
// 默认值为: yes
mob_setunitdata_persistence: yes

//是否开启0偷?
//模拟Aegis服早期的著名BUG:0偷效果
//当盗贼技能偷窃的成功率恰好为0时,有极小的几率能偷窃成功,
//此时偷窃到的物品几率分布是一个相等的平均值,
//如果偷窃到的物品指向一个不存在(物品id为0)的物品时,会获得苹果。
//0偷的成功几率(最大10000 = 100%),0 关闭
steal_special: 0

// PYHELP - BATTLECONFIG - INSERT POINT - <Section 4>
2 changes: 2 additions & 0 deletions src/config/pandas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@
// 是否启用 mob_setunitdata_persistence 配置选项及其功能 [Sola丶小克]
// 此选项用于控制是否高优先级持久化保存 setunitdata 对魔物的设置
#define Pandas_BattleConfig_Mob_SetUnitData_Persistence
// 是否开启0偷及设置几率(当偷窃几率正好为0时的特殊几率)
#define Pandas_BattleConfig_Steal_Special
// PYHELP - BATTLECONFIG - INSERT POINT - <Section 1>
#endif // Pandas_BattleConfigure

Expand Down
3 changes: 3 additions & 0 deletions src/map/battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11083,6 +11083,9 @@ static const struct _battle_data {
#ifdef Pandas_BattleConfig_Mob_SetUnitData_Persistence
{ "mob_setunitdata_persistence", &battle_config.mob_setunitdata_persistence, 1, 0, 1, },
#endif // Pandas_BattleConfig_Mob_SetUnitData_Persistence
#ifdef Pandas_BattleConfig_Steal_Special
{ "steal_special", &battle_config.steal_special, 0, 0, 10000, },
#endif // Pandas_BattleConfig_Steal_Special
// PYHELP - BATTLECONFIG - INSERT POINT - <Section 3>
#include <custom/battle_config_init.inc>
};
Expand Down
3 changes: 3 additions & 0 deletions src/map/battle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@ struct Battle_Config
#endif // Pandas_BattleConfig_MobDB_DamageMotion_Min
#ifdef Pandas_BattleConfig_Mob_SetUnitData_Persistence
int mob_setunitdata_persistence; // 是否高优先级持久化保存 setunitdata 对魔物的设置
#endif // Pandas_BattleConfig_Mob_SetUnitData_Persistence
#ifdef Pandas_BattleConfig_Steal_Special
int steal_special; // 开启0偷及设置几率
#endif // Pandas_BattleConfig_Mob_SetUnitData_Persistence
// PYHELP - BATTLECONFIG - INSERT POINT - <Section 2>
#include <custom/battle_config_struct.inc>
Expand Down
23 changes: 22 additions & 1 deletion src/map/pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7179,6 +7179,10 @@ bool pc_steal_item(map_session_data *sd,struct block_list *bl, uint16 skill_lv)
unsigned char flag = 0;
struct status_data *sd_status, *md_status;
struct mob_data *md;
//0偷几率判定值
#ifdef Pandas_BattleConfig_Steal_Special
bool rate_special;
#endif

if(!sd || !bl || bl->type!=BL_MOB)
return false;
Expand Down Expand Up @@ -7207,17 +7211,30 @@ bool pc_steal_item(map_session_data *sd,struct block_list *bl, uint16 skill_lv)
rate = (static_cast<double>(sd_status->dex) - static_cast<double>(md_status->dex)) / 2 + skill_lv * 6 + 4;
#endif // Pandas_Fix_StealItem_Formula_Overflow
rate += sd->bonus.add_steal_rate;
//偷窃几率正好为0的情况下,0偷几率
#ifdef Pandas_BattleConfig_Steal_Special
rate_special = !rate && rnd() % 10000 < battle_config.steal_special;
#endif

if( rate < 1
#ifdef RENEWAL
|| rnd()%100 >= rate
#endif
#ifdef Pandas_BattleConfig_Steal_Special //追加0偷判定
&& !rate_special
#endif
)
return false;

// 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_MOB_DROP; i++ )
#ifdef Pandas_BattleConfig_Steal_Special //0偷物品选择
if(rate_special) {
if( !md->db->dropitem[i].steal_protected && rnd() % MAX_MOB_DROP < 1)
break;
} else
#endif
if( item_db.exists(md->db->dropitem[i].nameid) && !md->db->dropitem[i].steal_protected && rnd() % 10000 < md->db->dropitem[i].rate
#ifndef RENEWAL
* rate/100.
Expand All @@ -7226,7 +7243,11 @@ bool pc_steal_item(map_session_data *sd,struct block_list *bl, uint16 skill_lv)
break;
if( i == MAX_MOB_DROP )
return false;

#ifdef Pandas_BattleConfig_Steal_Special //物品不存在的情况下偷到苹果
if (!item_db.exists(md->db->dropitem[i].nameid))
itemid = 512;
else
#endif
itemid = md->db->dropitem[i].nameid;
struct item tmp_item = {};
tmp_item.nameid = itemid;
Expand Down