32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using Cielonos.MainGame.Characters;
|
|
using Cielonos.MainGame.Inventory.Collections;
|
|
|
|
namespace Cielonos.MainGame.Rewards
|
|
{
|
|
/// <summary>
|
|
/// 敌人击杀即时奖励分发器。
|
|
/// CombatRoomSubmodule 只报告敌人死亡,实际奖励规则集中放在 Reward 层,方便后续扩展额外击杀掉落。
|
|
/// </summary>
|
|
public static class EnemyDefeatRewardDispatcher
|
|
{
|
|
/// <summary>
|
|
/// 根据敌人 EnemyRank 发放击杀 RareMaterial。
|
|
/// rng 通常来自 RunState.randomizer.Channel("EnemyDrop"),确保同一 seed 下掉落顺序可复现。
|
|
/// </summary>
|
|
public static void Dispatch(CharacterBase enemy, System.Random rng)
|
|
{
|
|
if (enemy is not Enemy typedEnemy) return;
|
|
|
|
rng ??= new System.Random();
|
|
int amount = MainGameManager.Config.RollCurrency(typedEnemy.enemyRank, rng);
|
|
if (amount <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
MainGameManager.Player.inventorySc.backpackSm.ObtainItem<RareMaterial>(amount);
|
|
//Debug.Log($"[EnemyDefeatRewardDispatcher] 击杀 {typedEnemy.enemyRank} 敌人,获得稀有材料 x{amount}。");
|
|
}
|
|
}
|
|
}
|