Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SlimeBodyItemDropRule.cs
Go to the documentation of this file.
2using Terraria.ID;
3
5
7{
8 public List<IItemDropRuleChainAttempt> ChainedRules { get; private set; }
9
14
15 public bool CanDrop(DropAttemptInfo info)
16 {
17 if (info.npc.type == 1 && info.npc.ai[1] > 0f)
18 {
19 return info.npc.ai[1] < (float)ItemID.Count;
20 }
21 return false;
22 }
23
25 {
26 int itemId = (int)info.npc.ai[1];
27 GetDropInfo(itemId, out var amountDroppedMinimum, out var amountDroppedMaximum);
28 CommonCode.DropItemFromNPC(info.npc, itemId, info.rng.Next(amountDroppedMinimum, amountDroppedMaximum + 1));
30 result.State = ItemDropAttemptResultState.Success;
31 return result;
32 }
33
34 public void GetDropInfo(int itemId, out int amountDroppedMinimum, out int amountDroppedMaximum)
35 {
36 amountDroppedMinimum = 1;
37 amountDroppedMaximum = 1;
38 switch (itemId)
39 {
40 case 8:
41 amountDroppedMinimum = 5;
42 amountDroppedMaximum = 10;
43 break;
44 case 166:
45 amountDroppedMinimum = 2;
46 amountDroppedMaximum = 6;
47 break;
48 case 965:
49 amountDroppedMinimum = 20;
50 amountDroppedMaximum = 45;
51 break;
52 case 11:
53 case 12:
54 case 13:
55 case 14:
56 case 699:
57 case 700:
58 case 701:
59 case 702:
60 amountDroppedMinimum = 3;
61 amountDroppedMaximum = 13;
62 break;
63 case 71:
64 amountDroppedMinimum = 50;
65 amountDroppedMaximum = 99;
66 break;
67 case 72:
68 amountDroppedMinimum = 20;
69 amountDroppedMaximum = 99;
70 break;
71 case 73:
72 amountDroppedMinimum = 1;
73 amountDroppedMaximum = 2;
74 break;
75 case 4343:
76 case 4344:
77 amountDroppedMinimum = 2;
78 amountDroppedMaximum = 5;
79 break;
80 }
81 }
82
87}
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
ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info)
void GetDropInfo(int itemId, out int amountDroppedMinimum, out int amountDroppedMaximum)
void ReportDroprates(List< DropRateInfo > drops, DropRateInfoChainFeed ratesInfo)
static readonly short Count
Definition ItemID.cs:12138