本文档定义了怪物死亡或宝箱开启时,生成战利品的算法。核心目标是平衡“惊喜感”与“经济稳定”。
为了防止割草游戏中成千上万的怪物导致满地垃圾(性能杀手+视觉污染),我们不使用“每只怪单独Roll点”的逻辑。
Points += MonsterRarity * PlayerMF。Points >= Threshold 时,触发一次真实的掉落判定 (Roll)。掉落表是分层嵌套的。
Currency (通货): 30%Equipment (装备): 20%Consumables (消耗品): 10%Nothing (空气): 40%Weapon: 40%Armor: 40%Jewelry: 20%为了减少垃圾时间,系统会根据玩家当前职业/属性微调掉落。
Hide Normal Items, Show Legendary, Highlight 'Fire Damage'.def OnMonsterDie(monster, player):
# 1. 累积预算
player.DropBucket += monster.DropValue * (1 + player.ItemRarity)
# 2. 检查阈值
if player.DropBucket >= DROP_THRESHOLD:
player.DropBucket -= DROP_THRESHOLD
# 3. 执行掉落
LootItem item = RollLootTable(monster.Level)
# 4. 智能掉落修正
if Random() < 0.15:
item = ApplySmartLoot(item, player.Class)
SpawnItemWorldObject(item, monster.Position)