Files
CalamityModPublic/Projectiles/Summon/SolarGod.cs
T
Andrew Marheine c6619cc0f7 1 - Made Lethal Lava Burn, Warped, Whispering Death, Irradiated, Poisoned, Venom, Holy Inferno, God Slayer Inferno and Astral Infection reduce movement speed.
2 - Reduced how much Icarus' Folly and Extreme Gravity affect flight time.
3 - Reduced Tracer flight time.
4 - Reduced how many Dark Energies Ceaseless Void spawns.
5 - Spooky Breastplate gives 1 minion slot instead of 2. Moved the 1 minion slot to the Spooky set bonus.
6 - Stardust Breastplate and Leggings give 1 minion slot instead of 2. Moved the 2 minion slots to the set bonus.
7 - Increased Signus HP.
8 - Reduced the DoT of Shellfish Vore from 250 to 200.
9 - Made Solar Spirit God fire 33% more often.
2020-12-22 13:38:44 -06:00

145 lines
5.8 KiB
C#

using CalamityMod.Buffs.Summon;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class SolarGod : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Solar God");
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.width = 74;
projectile.height = 90;
projectile.netImportant = true;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.minionSlots = 1f;
projectile.timeLeft = 18000;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.timeLeft *= 5;
projectile.minion = true;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
player.AddBuff(ModContent.BuffType<SolarSpiritGod>(), 3600);
bool correctMinion = projectile.type == ModContent.ProjectileType<SolarGod>();
if (correctMinion)
{
if (player.dead)
{
modPlayer.SPG = false;
}
if (modPlayer.SPG)
{
projectile.timeLeft = 2;
}
}
projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f);
if (player.gravDir == -1f)
{
projectile.position.Y += 120f;
projectile.rotation = MathHelper.Pi;
}
else
{
projectile.rotation = 0f;
}
projectile.position.X = (int)projectile.position.X;
projectile.position.Y = (int)projectile.position.Y;
float sizeScale = (float)Main.mouseTextColor / 200f - 0.35f;
sizeScale *= 0.2f;
projectile.scale = sizeScale + 0.95f;
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f);
if (projectile.localAI[0] == 0f)
{
projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage();
projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage;
int dustAmt = 50;
for (int d = 0; d < dustAmt; d++)
{
int fire = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f);
Main.dust[fire].velocity *= 2f;
Main.dust[fire].scale *= 1.15f;
}
projectile.localAI[0] += 1f;
}
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
{
int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
projectile.Calamity().spawnedPlayerMinionDamageValue *
player.MinionDamage());
projectile.damage = damage2;
}
if (projectile.owner == Main.myPlayer)
{
if (projectile.ai[0] != 0f)
{
projectile.ai[0] -= 1f;
return;
}
Vector2 targetPos = projectile.position;
float maxDistance = 700f;
bool foundTarget = false;
if (player.HasMinionAttackTargetNPC)
{
NPC npc = Main.npc[player.MinionAttackTargetNPC];
if (npc.CanBeChasedBy(projectile, false))
{
float npcDist = Vector2.Distance(projectile.Center, npc.Center);
if (npcDist < maxDistance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
{
targetPos = npc.Center;
foundTarget = true;
}
}
}
if (!foundTarget)
{
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC npc = Main.npc[i];
if (npc.CanBeChasedBy(projectile, false))
{
float npcDist = Vector2.Distance(projectile.Center, npc.Center);
if (npcDist < maxDistance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
{
maxDistance = npcDist;
targetPos = npc.Center;
foundTarget = true;
}
}
}
}
if (foundTarget)
{
float shootSpeed = 15f;
Vector2 source = projectile.Center;
Vector2 velocity = targetPos - source;
velocity.Normalize();
velocity *= shootSpeed;
Projectile.NewProjectile(source, velocity, ModContent.ProjectileType<SolarBeam>(), projectile.damage, projectile.knockBack, projectile.owner);
projectile.ai[0] = 20f;
}
}
}
public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200);
public override bool CanDamage() => false;
}
}