1. Fixed Ballistic Poison Bomb cloud velocity. 2. Fixed compile errors with Flak/Gamma Acid. 3. Fixed sentries not being able to be placed on platforms. 4. Fixed bugs with Pulse Turret. 5. Updated targetting util to check for tiles on minion targetted npcs. 6. Fixed rotational errors on cadaverous carrion. 7. Cadaverous carrion now checks for tile collision.
94 lines
3.9 KiB
C#
94 lines
3.9 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Summon
|
|
{
|
|
public class MiniSandShark : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Mini Sand Shark");
|
|
ProjectileID.Sets.MinionShot[projectile.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 32;
|
|
projectile.height = 32;
|
|
projectile.minion = true;
|
|
projectile.friendly = true;
|
|
projectile.ignoreWater = true;
|
|
projectile.alpha = 255;
|
|
projectile.minionSlots = 0f;
|
|
projectile.extraUpdates = 1;
|
|
projectile.timeLeft = 300;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
projectile.alpha -= 40;
|
|
if (projectile.alpha < 0)
|
|
{
|
|
projectile.alpha = 0;
|
|
}
|
|
if (projectile.ai[1] == 0f)
|
|
{
|
|
projectile.ai[1] = 1f;
|
|
Main.PlaySound(SoundID.NPCDeath19, projectile.position);
|
|
}
|
|
if (projectile.ai[0] >= 45f)
|
|
{
|
|
projectile.ai[0] = 45f;
|
|
projectile.velocity.Y = projectile.velocity.Y + 0.025f;
|
|
}
|
|
if (projectile.velocity.X < 0f)
|
|
{
|
|
projectile.spriteDirection = -1;
|
|
projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X);
|
|
}
|
|
else
|
|
{
|
|
projectile.spriteDirection = 1;
|
|
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
|
Texture2D texture = Main.projectileTexture[projectile.type];
|
|
Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, spriteEffects, 0f);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
projectile.position = projectile.Center;
|
|
projectile.width = projectile.height = 64;
|
|
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
|
|
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
|
|
projectile.maxPenetrate = -1;
|
|
projectile.penetrate = -1;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 10;
|
|
projectile.damage /= 2;
|
|
projectile.Damage();
|
|
Main.PlaySound(SoundID.Item14, projectile.position);
|
|
int num226 = 36;
|
|
for (int num227 = 0; num227 < num226; num227++)
|
|
{
|
|
Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f;
|
|
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center;
|
|
Vector2 vector7 = vector6 - projectile.Center;
|
|
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f);
|
|
Main.dust[num228].noGravity = true;
|
|
Main.dust[num228].noLight = true;
|
|
Main.dust[num228].velocity = vector7;
|
|
}
|
|
}
|
|
}
|
|
}
|