public ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info) { int max = 1; if (info.IsExpertMode) { max++; } if (FargoSoulsWorld.EternityMode) { max++; } List <int> enchesToDrop = new List <int>(dropIds); while (enchesToDrop.Count > max) { enchesToDrop.RemoveAt(info.rng.Next(enchesToDrop.Count)); } foreach (int itemType in enchesToDrop) { CommonCode.DropItemFromNPC(info.npc, itemType, 1); } return(new ItemDropAttemptResult() { State = ItemDropAttemptResultState.Success }); }
public override ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info) { bool flag = Roll(info); if (!flag && info.rng.NextFloat() < rerollChance) { flag = Roll(info); } ItemDropAttemptResult result; if (flag) { CommonCode.DropItemFromNPC(info.npc, itemId, info.rng.Next(amountDroppedMinimum, amountDroppedMaximum + 1)); result = default(ItemDropAttemptResult); result.State = ItemDropAttemptResultState.Success; return(result); } result = default(ItemDropAttemptResult); result.State = ItemDropAttemptResultState.FailedRandomRoll; return(result); bool Roll(DropAttemptInfo info) { return(info.player.RollLuck(chanceDenominator) < chanceNumerator); } }
public override ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info) { ItemDropAttemptResult result; if (info.rng.Next(_dropsOutOfY) < _dropsXoutOfY) { CommonCode.DropItemFromNPC(info.npc, _itemId, info.rng.Next(_amtDroppedMinimum, _amtDroppedMaximum + 1)); result = default(ItemDropAttemptResult); result.State = ItemDropAttemptResultState.Success; return(result); } result = default(ItemDropAttemptResult); result.State = ItemDropAttemptResultState.FailedRandomRoll; return(result); }
public override ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info) { if (info.rng.Next(this._dropsOutOfY) < this._dropsXoutOfY) { CommonCode.DropItemFromNPC(info.npc, this._itemId, info.rng.Next(this._amtDroppedMinimum, this._amtDroppedMaximum + 1), false); return(new ItemDropAttemptResult() { State = ItemDropAttemptResultState.Success }); } return(new ItemDropAttemptResult() { State = ItemDropAttemptResultState.FailedRandomRoll }); }