This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThaumaturgyGlobalTile.cs
67 lines (60 loc) · 1.66 KB
/
ThaumaturgyGlobalTile.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Thaumaturgy
{
public class ThaumaturgyGlobalTile : GlobalTile
{
public override bool Drop(int i, int j, int type)
{
bool baseDropped = base.Drop(i, j, type);
bool avariceActive = false;
if (Main.netMode == NetmodeID.Server)
{
foreach (Player ourPlayer in Main.player)
{
if (ourPlayer.active && (ourPlayer.HasBuff(mod.BuffType("Avarice")) || ourPlayer.buffImmune[mod.BuffType("Avarice")]))
{
avariceActive = true;
break;
}
}
}
else
{
Player ourPlayer = Main.LocalPlayer;
if (ourPlayer.HasBuff(mod.BuffType("Avarice")) || ourPlayer.buffImmune[mod.BuffType("Avarice")])
{
avariceActive = true;
}
}
// only Daring and Daredevilry provide immunity to Avarice - and they both require its elixir - so we apply the effects either way
if (avariceActive && baseDropped)
{
int extraGems = Main.rand.Next(1, 3);
switch (type)
{
case TileID.Amethyst:
Item.NewItem(i * 16, j * 16, 16, 16, ItemID.Amethyst, extraGems);
break;
case TileID.Topaz:
Item.NewItem(i * 16, j * 16, 16, 16, ItemID.Topaz, extraGems);
break;
case TileID.Emerald:
Item.NewItem(i * 16, j * 16, 16, 16, ItemID.Emerald, extraGems);
break;
case TileID.Sapphire:
Item.NewItem(i * 16, j * 16, 16, 16, ItemID.Sapphire, extraGems);
break;
case TileID.Ruby:
Item.NewItem(i * 16, j * 16, 16, 16, ItemID.Ruby, extraGems);
break;
case TileID.Diamond:
Item.NewItem(i * 16, j * 16, 16, 16, ItemID.Diamond, extraGems);
break;
}
}
return baseDropped;
}
}
}