-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateProjectiles.cs
50 lines (46 loc) · 1.84 KB
/
CreateProjectiles.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
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace niolsBuffedAccessories.Buffed
{
public class CreateProjectiles : GlobalProjectile
{
private static readonly List<int> blacklistedProjectiles = new()
{
ProjectileID.StarCloakStar,
ProjectileID.GiantBee,
ProjectileID.Bee,
ProjectileID.SporeGas,
ProjectileID.SporeGas2,
ProjectileID.SporeGas3,
ProjectileID.SporeTrap,
ProjectileID.SporeTrap2,
};
public override void ModifyHitNPC(Projectile projectile, NPC target, ref NPC.HitModifiers modifiers)
{
if (!blacklistedProjectiles.Contains(projectile.type))
{
if (AccessoryProperties.SpawnBees && SpawnProjectile(Main.LocalPlayer.HeldItem.useTime))
{
if (AccessoryProperties.StrongBees && BuffedAccessories.Ran.Next(2) == 0)
{
SpawnProjectiles.CreateBees(target, projectile.damage, true, projectile.GetSource_FromThis());
}
else SpawnProjectiles.CreateBees(target, projectile.damage, false, projectile.GetSource_FromThis());
}
if (AccessoryProperties.SpawnStars && SpawnProjectile(Main.LocalPlayer.HeldItem.useTime))
{
SpawnProjectiles.CreateStars(target, projectile.damage, projectile.GetSource_FromThis());
}
}
}
public static bool SpawnProjectile(int time)
{
return time > 25 ?
BuffedAccessories.Ran.Next(101) < Math.Pow(time, 2f) / 25f :
BuffedAccessories.Ran.Next(101) < time;
}
}
}