Files
CalamityModPublic/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs
T
Ozzatron ae1fa7bec5 Redid DR formula so that DR applies after vanilla defense.
Also moved AEW & Sepulcher DR to vanilla damage taken multiplier, and moved flat defense reductions for Calamity debuffs into their buff files.
Unified line endings and added extensions to get CalamityGlobalNPC and CalamityGlobalProjectile.

THIS WILL REQUIRE ENORMOUS AMOUNTS OF TESTING AND REBALANCING.
2019-10-07 19:40:40 -04:00

87 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class ScourgeoftheSeasProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Moist Scourge");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 26;
projectile.height = 26;
projectile.friendly = true;
projectile.aiStyle = 113;
aiType = 598;
projectile.penetrate = 1;
projectile.extraUpdates = 1;
projectile.timeLeft = 1200;
projectile.GetGlobalProjectile<CalamityGlobalProjectile>(mod).rogue = true;
}
public override void AI()
{
if (Main.rand.Next(5) == 0)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f;
projectile.velocity.X *= 1.015f;
projectile.velocity.Y *= 1.015f;
if (projectile.velocity.X > 16f)
{
projectile.velocity.X = 16f;
}
if (projectile.velocity.Y > 16f)
{
projectile.velocity.Y = 16f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Venom, 600);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14);
for (int num621 = 0; num621 < 8; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 1f);
Main.dust[num622].velocity *= 1f;
}
if (projectile.owner == Main.myPlayer)
{
int num320 = Main.rand.Next(2, 6);
int num3;
for (int num321 = 0; num321 < num320; num321 = num3 + 1)
{
Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
vector15.Normalize();
vector15 *= (float)Main.rand.Next(10, 201) * 0.01f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("ScourgeVenomCloud"), (int)((double)projectile.damage * 0.25), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1));
num3 = num321;
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
}
}