57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
using ForgottenWawiTech.Content.Projectiles.Singularity;
|
|
|
|
namespace ForgottenWawiTech.Content.Players
|
|
{
|
|
public class SingularityPlayer : ModPlayer
|
|
{
|
|
private const int OrbProjectileLimit = 1;
|
|
private const int OrbBaseDamage = 420;
|
|
private const float OrbSpawnOffset = -80f;
|
|
|
|
public bool SingularityOrbActive { get; private set; }
|
|
|
|
public override void ResetEffects()
|
|
{
|
|
SingularityOrbActive = false;
|
|
}
|
|
|
|
public void EnableSingularityOrb()
|
|
{
|
|
SingularityOrbActive = true;
|
|
}
|
|
|
|
public override void PostUpdate()
|
|
{
|
|
if (!SingularityOrbActive || Player.whoAmI != Main.myPlayer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
int orbType = ModContent.ProjectileType<SingularityOrb>();
|
|
if (Player.ownedProjectileCounts[orbType] >= OrbProjectileLimit)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var source = Player.GetSource_Misc("SingularitySet");
|
|
Vector2 spawnPos = Player.Center + new Vector2(0f, OrbSpawnOffset);
|
|
Projectile.NewProjectile(
|
|
source,
|
|
spawnPos,
|
|
Vector2.Zero,
|
|
orbType,
|
|
0,
|
|
0f,
|
|
Player.whoAmI);
|
|
}
|
|
|
|
public static int GetOrbDamage(Player player)
|
|
{
|
|
return (int)player.GetTotalDamage(DamageClass.Generic).ApplyTo(OrbBaseDamage);
|
|
}
|
|
}
|
|
}
|