Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FromOptionsWithoutRepeatsDropRule.cs
Go to the documentation of this file.
2
4
6{
7 public int[] dropIds;
8
9 public int dropCount;
10
12
13 public List<IItemDropRuleChainAttempt> ChainedRules { get; private set; }
14
16 {
17 this.dropCount = dropCount;
18 dropIds = options;
20 }
21
22 public bool CanDrop(DropAttemptInfo info)
23 {
24 return true;
25 }
26
28 {
31 for (int i = 0; i < dropCount; i++)
32 {
34 {
35 break;
36 }
37 int index = info.rng.Next(_temporaryAvailableItems.Count);
40 }
42 result.State = ItemDropAttemptResultState.Success;
43 return result;
44 }
45
47 {
48 float parentDroprateChance = ratesInfo.parentDroprateChance;
49 int num = dropIds.Length;
50 float num2 = 1f;
51 int num3 = 0;
53 {
54 num2 *= (float)(num - 1) / (float)num;
55 num3++;
56 num--;
57 }
58 float dropRate = (1f - num2) * parentDroprateChance;
59 for (int i = 0; i < dropIds.Length; i++)
60 {
61 drops.Add(new DropRateInfo(dropIds[i], 1, 1, dropRate, ratesInfo.conditions));
62 }
64 }
65}
void Add(TKey key, TValue value)
void AddRange(IEnumerable< T > collection)
Definition List.cs:275
void RemoveAt(int index)
Definition List.cs:824
static void ReportDroprates(List< IItemDropRuleChainAttempt > ChainedRules, float personalDropRate, List< DropRateInfo > drops, DropRateInfoChainFeed ratesInfo)
Definition Chains.cs:85
static void DropItemFromNPC(NPC npc, int itemId, int stack, bool scattered=false)
Definition CommonCode.cs:9
void ReportDroprates(List< DropRateInfo > drops, DropRateInfoChainFeed ratesInfo)