-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEnemyModifiersGlobalProj.cs
More file actions
44 lines (39 loc) · 1.3 KB
/
EnemyModifiersGlobalProj.cs
File metadata and controls
44 lines (39 loc) · 1.3 KB
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
using FargoEnemyModifiers.Modifiers;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace FargoEnemyModifiers
{
public class EnemyModifiersGlobalProj : GlobalProjectile
{
NPC owner = null;
private bool imaginary = false;
public override bool InstancePerEntity => true;
public override void OnSpawn(Projectile projectile, IEntitySource source)
{
if (source is EntitySource_Parent parent && parent.Entity is NPC parentNPC)
{
foreach (Modifier modifier in parentNPC.GetGlobalNPC<EnemyModifiersGlobalNPC>().Modifiers)
{
if (modifier.SizeMultiplier != 1)
{
projectile.scale = parentNPC.scale;
}
if (modifier.Name == "Imaginary")
{
imaginary = true;
projectile.alpha = 150;
owner = parentNPC;
}
}
}
}
public override void OnHitPlayer(Projectile projectile, Player target, Player.HurtInfo info)
{
if (imaginary)
{
Imaginary.ceaseToExist(owner, target);
}
}
}
}