-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCalTestHelpersGlobalProjectile.cs
More file actions
86 lines (76 loc) · 4.2 KB
/
Copy pathCalTestHelpersGlobalProjectile.cs
File metadata and controls
86 lines (76 loc) · 4.2 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using CalamityMod;
using CalamityMod.Dusts;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss;
using Microsoft.Xna.Framework;
using Mono.Cecil;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalTestHelpers
{
public class CalTestHelpersGlobalProjectile : GlobalProjectile
{
public override void OnSpawn(Projectile projectile, IEntitySource source)
{
Player player = Main.player[projectile.owner];
if (projectile.DamageType == RogueDamageClass.Instance && player.GetModPlayer<CalTestHelpersPlayer>().CannotProcRogue)
{
projectile.Calamity().CannotProc = true;
projectile.Calamity().stealthStrike = false;
}
}
//public SCalRitualDrama ritual;
public override void AI(Projectile projectile)
{
if (projectile.type == ModContent.ProjectileType<SCalRitualDrama>() && !NPC.AnyNPCs(ModContent.NPCType<SupremeCalamitas>()) && CalTestHelperConfig.Instance.InstantBossSummoning)
{
//ritual.SummonSCal(); //This wont work outside of the file due to not being static
//If only functions worked like Python ones, gotta copy the code then
//Permision granted by Xyk
Vector2 spawnPosition = projectile.Center - new Vector2(53f, 39f);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC scal = CalamityUtils.SpawnBossBetter(spawnPosition, ModContent.NPCType<SupremeCalamitas>());
if (projectile.ai[1] == 1)
{
scal.ModNPC<SupremeCalamitas>().permafrost = true;
}
}
// Make a laugh sound and create a burst of brimstone dust.
SoundStyle SpawnSound = projectile.ai[1] == 1 ? SoundID.Item107 : SupremeCalamitas.SpawnSound;
SoundEngine.PlaySound(SpawnSound, projectile.Center);
// Make a sudden screen shake.
Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.GetLerpValue(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 16f;
// Generate a dust explosion at the ritual's position.
for (int i = 0; i < 90; i++)
{
Dust spawnDust = Dust.NewDustPerfect(projectile.Center, projectile.ai[1] == 1 ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f));
spawnDust.noGravity = true;
spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f);
}
for (int i = 0; i < 40; i++)
{
Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f);
GlowOrbParticle orb = new GlowOrbParticle(projectile.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), projectile.ai[1] == 1 ? Color.Magenta : Color.Red, true, true);
GeneralParticleHandler.SpawnParticle(orb);
}
Particle pulse = new DirectionalPulseRing(projectile.Center, Vector2.Zero, projectile.ai[1] == 1 ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 2.7f, 60);
GeneralParticleHandler.SpawnParticle(pulse);
Particle pulse2 = new DirectionalPulseRing(projectile.Center, Vector2.Zero, projectile.ai[1] == 1 ? Color.Magenta : new Color(121, 21, 77), new Vector2(2f, 2f), 0, 0f, 2.1f, 60);
GeneralParticleHandler.SpawnParticle(pulse2);
projectile.Kill();
}
//Gotta have it twice since projectiles spawning projectiles
Player player = Main.player[projectile.owner];
if (projectile.DamageType == RogueDamageClass.Instance && player.GetModPlayer<CalTestHelpersPlayer>().CannotProcRogue)
{
projectile.Calamity().CannotProc = true;
projectile.Calamity().stealthStrike = false;
}
}
}
}