Implement Skirmisher armor set bonus
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.Projectiles.Avali;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Players
|
||||
{
|
||||
public class AvaliSkirmisherPlayer : ModPlayer
|
||||
{
|
||||
private const int DroneCount = 2;
|
||||
private const float SpawnRadius = 60f;
|
||||
|
||||
public bool ThermalDronesActive { get; private set; }
|
||||
|
||||
public override void ResetEffects()
|
||||
{
|
||||
ThermalDronesActive = false;
|
||||
}
|
||||
|
||||
public void EnableThermalDrones()
|
||||
{
|
||||
ThermalDronesActive = true;
|
||||
}
|
||||
|
||||
public override void PostUpdate()
|
||||
{
|
||||
if (!ThermalDronesActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player.whoAmI != Main.myPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int droneType = ModContent.ProjectileType<AvaliThermalDrone>();
|
||||
int owned = Player.ownedProjectileCounts[droneType];
|
||||
if (owned >= DroneCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var source = Player.GetSource_Misc("AvaliSkirmisherSet");
|
||||
for (int i = owned; i < DroneCount; i++)
|
||||
{
|
||||
float rotationOffset = MathHelper.TwoPi * i / DroneCount;
|
||||
Vector2 spawnPos = Player.Center + rotationOffset.ToRotationVector2() * SpawnRadius;
|
||||
Projectile.NewProjectile(
|
||||
source,
|
||||
spawnPos,
|
||||
Vector2.Zero,
|
||||
droneType,
|
||||
0,
|
||||
0f,
|
||||
Player.whoAmI,
|
||||
i,
|
||||
DroneCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user