Odd Mushroom dust duplication, New Birb attacks and visuals, Yharon flare bombs slowed down.
No files matched your search
@@ -8316,7 +8316,57 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
|
||||
{
|
||||
bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f;
|
||||
// Dust modifications while high
|
||||
if (trippy)
|
||||
{
|
||||
Rectangle rectangle = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100);
|
||||
int dustDrawn = 0;
|
||||
float maxShroomDust = Main.maxDustToDraw / 2;
|
||||
for (int i = 0; i < Main.maxDustToDraw; i++)
|
||||
{
|
||||
Dust dust = Main.dust[i];
|
||||
if (dust.active)
|
||||
{
|
||||
if (new Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(rectangle))
|
||||
{
|
||||
dust.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0);
|
||||
for (int num213 = 0; num213 < 4; num213++)
|
||||
{
|
||||
Vector2 position9 = dust.position;
|
||||
Vector2 dustCenter = new Vector2(position9.X + 4f, position9.Y + 4f);
|
||||
float num214 = Math.Abs(dustCenter.X - player.Center.X);
|
||||
float num215 = Math.Abs(dustCenter.Y - player.Center.Y);
|
||||
if (num213 == 0 || num213 == 2)
|
||||
{
|
||||
position9.X = player.Center.X + num214;
|
||||
}
|
||||
else
|
||||
{
|
||||
position9.X = player.Center.X - num214;
|
||||
}
|
||||
position9.X -= 4f;
|
||||
if (num213 == 0 || num213 == 1)
|
||||
{
|
||||
position9.Y = player.Center.Y + num215;
|
||||
}
|
||||
else
|
||||
{
|
||||
position9.Y = player.Center.Y - num215;
|
||||
}
|
||||
position9.Y -= 4f;
|
||||
Main.spriteBatch.Draw(Main.dustTexture, position9 - Main.screenPosition, new Rectangle?(dust.frame), dust.color, dust.rotation, new Vector2(4f, 4f), dust.scale, SpriteEffects.None, 0f);
|
||||
dustDrawn++;
|
||||
}
|
||||
|
||||
// Break if too many dust clones have been drawn
|
||||
if (dustDrawn > maxShroomDust)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f;
|
||||
if (rogueStealth > 0f && rogueStealthMax > 0f && player.townNPCs < 3f)
|
||||
{
|
||||
//A translucent orchid color, the rogue class color
|
||||
|
||||
|
After Width: | Height: | Size: 868 B |
|
After Width: | Height: | Size: 864 B |
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 13 KiB |
@@ -10,6 +10,9 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -23,7 +26,8 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
{
|
||||
DisplayName.SetDefault("Bumblebirb");
|
||||
Main.npcFrameCount[npc.type] = 6;
|
||||
}
|
||||
NPCID.Sets.TrailingMode[npc.type] = 1;
|
||||
}
|
||||
|
||||
public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb";
|
||||
public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss";
|
||||
@@ -76,9 +80,21 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
bossBag = ModContent.ItemType<BumblebirbBag>();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(npc.dontTakeDamage);
|
||||
writer.Write(npc.localAI[0]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
npc.dontTakeDamage = reader.ReadBoolean();
|
||||
npc.localAI[0] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.visualOffset = new Vector2(20f, 50f);
|
||||
//npc.visualOffset = new Vector2(20f, 50f);
|
||||
CalamityAI.BumblebirbAI(npc, mod);
|
||||
}
|
||||
|
||||
@@ -90,32 +106,280 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
|
||||
public override void FindFrame(int frameHeight)
|
||||
{
|
||||
bool lightningBreathAttack = false; //leaving this for fabbo to sort
|
||||
if (lightningBreathAttack)
|
||||
{
|
||||
npc.frame.Y = npc.frame.Height * 5;
|
||||
}
|
||||
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
|
||||
|
||||
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
||||
bool death = CalamityWorld.death || CalamityWorld.bossRushActive;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = (float)npc.life / (float)npc.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death;
|
||||
bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f);
|
||||
|
||||
float newPhaseTimer = 180f;
|
||||
bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) ||
|
||||
(phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f);
|
||||
|
||||
if (phaseSwitchPhase)
|
||||
{
|
||||
float frameGateValue = phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0];
|
||||
int num116 = 180;
|
||||
if (frameGateValue < (float)(num116 - 60) || frameGateValue > (float)(num116 - 20))
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter > 5D)
|
||||
{
|
||||
npc.frameCounter = 0D;
|
||||
npc.frame.Y += frameHeight;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * 5)
|
||||
{
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frame.Y = frameHeight * 4;
|
||||
if (frameGateValue > (float)(num116 - 50) && frameGateValue < (float)(num116 - 25))
|
||||
{
|
||||
npc.frame.Y = frameHeight * 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (npc.ai[0] == 5f)
|
||||
{
|
||||
int num115 = 120;
|
||||
if (npc.ai[1] < (float)(num115 - 50) || npc.ai[1] > (float)(num115 - 10))
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter > 5D)
|
||||
{
|
||||
npc.frameCounter = 0D;
|
||||
npc.frame.Y += frameHeight;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * 5)
|
||||
{
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frame.Y = frameHeight * 4;
|
||||
if (npc.ai[1] > (float)(num115 - 40) && npc.ai[1] < (float)(num115 - 15))
|
||||
{
|
||||
npc.frame.Y = frameHeight * 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (npc.frameCounter >= 5) //iban said the time between frames was 5 so using that as a base
|
||||
npc.frameCounter += (npc.ai[0] == 3.2f ? 1.5 : 1D);
|
||||
if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base
|
||||
{
|
||||
if (npc.frame.Y >= npc.frame.Height * 4) //frame 5 or 6 for transitioning from open jaw
|
||||
{
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frame.Y += npc.frame.Height;
|
||||
}
|
||||
npc.frameCounter = -1; //set to -1 to account for the framecounter increment shortly after
|
||||
npc.frameCounter = 0D;
|
||||
npc.frame.Y += frameHeight;
|
||||
}
|
||||
}
|
||||
npc.frameCounter++;
|
||||
if (npc.ai[0] == 3.2f)
|
||||
npc.frameCounter += 0.5;
|
||||
if (npc.frame.Y >= frameHeight * 5)
|
||||
{
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void BossLoot(ref string name, ref int potionType)
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
|
||||
|
||||
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
||||
bool death = CalamityWorld.death || CalamityWorld.bossRushActive;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = (float)npc.life / (float)npc.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death;
|
||||
bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f);
|
||||
|
||||
float newPhaseTimer = 180f;
|
||||
bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) ||
|
||||
(phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f);
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = Main.npcTexture[npc.type];
|
||||
Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2));
|
||||
Color color = lightColor;
|
||||
Color color36 = phase2 && calamityGlobalNPC.newAI[2] == 1f ? Color.Yellow : Color.White;
|
||||
|
||||
float amount9 = 0f;
|
||||
int num150 = 120;
|
||||
int num151 = 60;
|
||||
|
||||
if (phase3 && calamityGlobalNPC.newAI[3] == 1f)
|
||||
{
|
||||
color = buffColor(color, 0.4f, 0.8f, 0.4f, 1f);
|
||||
}
|
||||
else if (phase3 && calamityGlobalNPC.newAI[1] > (float)num150)
|
||||
{
|
||||
float num152 = calamityGlobalNPC.newAI[1] - (float)num150;
|
||||
num152 /= (float)num151;
|
||||
color = buffColor(color, 1f - 0.5f * num152, 1f - 0.5f * num152, 1f - 0.3f * num152, 1f);
|
||||
}
|
||||
else if (phase2 && calamityGlobalNPC.newAI[2] == 1f)
|
||||
{
|
||||
color = buffColor(color, 0.5f, 0.7f, 0.5f, 1f);
|
||||
}
|
||||
else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150)
|
||||
{
|
||||
float num152 = calamityGlobalNPC.newAI[0] - (float)num150;
|
||||
num152 /= (float)num151;
|
||||
color = buffColor(color, 1f - 0.5f * num152, 1f - 0.5f * num152, 1f - 0.3f * num152, 1f);
|
||||
}
|
||||
|
||||
int num153 = 10;
|
||||
int num154 = 2;
|
||||
if (npc.ai[0] == 0f || npc.ai[0] == 3.1f || npc.ai[0] == 4f || npc.ai[0] == 4.2f)
|
||||
{
|
||||
num153 = 4;
|
||||
}
|
||||
if (npc.ai[0] == 1f || npc.ai[0] == 3f || npc.ai[0] == 4.1f)
|
||||
{
|
||||
num153 = 7;
|
||||
}
|
||||
if (npc.ai[0] == 2f || npc.ai[0] == 3.2f)
|
||||
{
|
||||
color36 = Color.Yellow;
|
||||
amount9 = 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = lightColor;
|
||||
}
|
||||
|
||||
for (int num155 = 1; num155 < num153; num155 += num154)
|
||||
{
|
||||
Color color38 = color;
|
||||
color38 = Color.Lerp(color38, color36, amount9);
|
||||
color38 = npc.GetAlpha(color38);
|
||||
color38 *= (float)(num153 - num155) / 15f;
|
||||
Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition;
|
||||
vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector41, new Rectangle?(npc.frame), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
int num156 = 0;
|
||||
float num157 = 0f;
|
||||
float scaleFactor9 = 0f;
|
||||
|
||||
if (npc.ai[0] == 0f || npc.ai[0] == 3.1f || npc.ai[0] == 4f || npc.ai[0] == 4.2f)
|
||||
{
|
||||
num156 = 4;
|
||||
}
|
||||
|
||||
if (npc.ai[0] == 5f)
|
||||
{
|
||||
int num158 = 60;
|
||||
int num159 = 30;
|
||||
if (npc.ai[1] > (float)num158)
|
||||
{
|
||||
num156 = 6;
|
||||
num157 = 1f - (float)Math.Cos((double)((npc.ai[1] - (float)num158) / (float)num159 * MathHelper.TwoPi));
|
||||
num157 /= 3f;
|
||||
scaleFactor9 = 40f;
|
||||
}
|
||||
}
|
||||
|
||||
if (phaseSwitchPhase && (calamityGlobalNPC.newAI[0] > (float)num150 || calamityGlobalNPC.newAI[1] > (float)num150))
|
||||
{
|
||||
num156 = 6;
|
||||
num157 = 1f - (float)Math.Cos((double)(((phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)num150) / (float)num151 * MathHelper.TwoPi));
|
||||
num157 /= 3f;
|
||||
scaleFactor9 = 60f;
|
||||
}
|
||||
|
||||
for (int num160 = 0; num160 < num156; num160++)
|
||||
{
|
||||
Color color39 = lightColor;
|
||||
color39 = Color.Lerp(color39, color36, amount9);
|
||||
color39 = npc.GetAlpha(color39);
|
||||
color39 *= 1f - num157;
|
||||
Vector2 vector42 = npc.Center + ((float)num160 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition;
|
||||
vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector42 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector42, new Rectangle?(npc.frame), color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
Color color2 = lightColor;
|
||||
color2 = Color.Lerp(color2, color36, amount9);
|
||||
color2 = npc.GetAlpha(color2);
|
||||
Vector2 vector43 = npc.Center - Main.screenPosition;
|
||||
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector43, new Rectangle?(npc.frame), (phase3 && calamityGlobalNPC.newAI[3] == 1f ? color2 : npc.GetAlpha(lightColor)), npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
|
||||
if (phase2)
|
||||
{
|
||||
texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Bumblebirb/BirbGlow");
|
||||
Color color40 = Color.Lerp(Color.White, Color.Red, 0.5f);
|
||||
color36 = Color.Red;
|
||||
|
||||
amount9 = 1f;
|
||||
num157 = 0.5f;
|
||||
scaleFactor9 = 10f;
|
||||
num154 = 1;
|
||||
|
||||
if (phaseSwitchPhase)
|
||||
{
|
||||
float num161 = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)num150;
|
||||
num161 /= (float)num151;
|
||||
color36 *= num161;
|
||||
color40 *= num161;
|
||||
}
|
||||
|
||||
for (int num163 = 1; num163 < num153; num163 += num154)
|
||||
{
|
||||
Color color41 = color40;
|
||||
color41 = Color.Lerp(color41, color36, amount9);
|
||||
color41 *= (float)(num153 - num163) / 15f;
|
||||
Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition;
|
||||
vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector44, new Rectangle?(npc.frame), color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
for (int num164 = 1; num164 < num156; num164++)
|
||||
{
|
||||
Color color42 = color40;
|
||||
color42 = Color.Lerp(color42, color36, amount9);
|
||||
color42 = npc.GetAlpha(color42);
|
||||
color42 *= 1f - num157;
|
||||
Vector2 vector45 = npc.Center + ((float)num164 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition;
|
||||
vector45 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector45 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector45, new Rectangle?(npc.frame), color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
spriteBatch.Draw(texture2D15, vector43, new Rectangle?(npc.frame), color40, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Color buffColor(Color newColor, float R, float G, float B, float A)
|
||||
{
|
||||
newColor.R = (byte)((float)newColor.R * R);
|
||||
newColor.G = (byte)((float)newColor.G * G);
|
||||
newColor.B = (byte)((float)newColor.B * B);
|
||||
newColor.A = (byte)((float)newColor.A * A);
|
||||
return newColor;
|
||||
}
|
||||
|
||||
public override void BossLoot(ref string name, ref int potionType)
|
||||
{
|
||||
name = "A Bumblebirb";
|
||||
potionType = ItemID.SuperHealingPotion;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -13,7 +14,8 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
{
|
||||
DisplayName.SetDefault("Bumblebirb");
|
||||
Main.npcFrameCount[npc.type] = 6;
|
||||
}
|
||||
NPCID.Sets.TrailingMode[npc.type] = 1;
|
||||
}
|
||||
|
||||
public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb";
|
||||
|
||||
@@ -59,12 +61,15 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.visualOffset = new Vector2(10, 40);
|
||||
//npc.visualOffset = new Vector2(10, 40);
|
||||
Player player = Main.player[npc.target];
|
||||
Vector2 vector = npc.Center;
|
||||
npc.damage = npc.defDamage;
|
||||
|
||||
if (Vector2.Distance(player.Center, vector) > 5600f)
|
||||
float rotationMult = 4f;
|
||||
float rotationAmt = 0.04f;
|
||||
|
||||
if (Vector2.Distance(player.Center, vector) > 5600f)
|
||||
{
|
||||
if (npc.timeLeft > 5)
|
||||
{
|
||||
@@ -75,7 +80,7 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
npc.noTileCollide = false;
|
||||
npc.noGravity = true;
|
||||
|
||||
npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f;
|
||||
|
||||
if (npc.ai[0] == 0f || npc.ai[0] == 1f)
|
||||
{
|
||||
@@ -202,7 +207,7 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
npc.direction = 1;
|
||||
}
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f;
|
||||
Vector2 value45 = Main.player[npc.target].Center - npc.Center;
|
||||
if (value45.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
{
|
||||
@@ -235,7 +240,7 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
npc.direction = 1;
|
||||
}
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * 7f + npc.velocity.X * 0.05f) / 8f;
|
||||
npc.rotation = (npc.rotation * rotationMult * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f;
|
||||
npc.noTileCollide = true;
|
||||
Vector2 vector242 = Main.player[npc.target].Center - npc.Center;
|
||||
vector242.Y -= 8f;
|
||||
@@ -312,32 +317,51 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
|
||||
public override void FindFrame(int frameHeight)
|
||||
{
|
||||
bool lightningBreathAttack = false; //leaving this for fabbo to sort
|
||||
if (lightningBreathAttack)
|
||||
{
|
||||
npc.frame.Y = npc.frame.Height * 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (npc.frameCounter >= 5) //iban said the time between frames was 5 so using that as a base
|
||||
{
|
||||
if (npc.frame.Y >= npc.frame.Height * 4) //frame 5 or 6 for transitioning from open jaw
|
||||
{
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frame.Y += npc.frame.Height;
|
||||
}
|
||||
npc.frameCounter = -1; //set to -1 to account for the framecounter increment shortly after
|
||||
}
|
||||
}
|
||||
npc.frameCounter++;
|
||||
if (npc.ai[0] == 2.1f)
|
||||
npc.frameCounter += 0.5;
|
||||
npc.frameCounter += (npc.ai[0] == 2.1f ? 1.5 : 1D);
|
||||
if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base
|
||||
{
|
||||
npc.frameCounter = 0D;
|
||||
npc.frame.Y += frameHeight;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * 4)
|
||||
{
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = Main.npcTexture[npc.type];
|
||||
Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2));
|
||||
Color color36 = Color.Gold;
|
||||
float amount9 = 0.5f;
|
||||
int num153 = npc.ai[0] == 2.1f ? 7 : 0;
|
||||
|
||||
for (int num155 = 1; num155 < num153; num155 += 2)
|
||||
{
|
||||
Color color38 = lightColor;
|
||||
color38 = Color.Lerp(color38, color36, amount9);
|
||||
color38 = npc.GetAlpha(color38);
|
||||
color38 *= (float)(num153 - num155) / 15f;
|
||||
Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition;
|
||||
vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector41, new Rectangle?(npc.frame), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
Vector2 vector43 = npc.Center - Main.screenPosition;
|
||||
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector43, new Rectangle?(npc.frame), npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using CalamityMod.NPCs.OldDuke;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -3636,6 +3637,8 @@ namespace CalamityMod.NPCs
|
||||
#region Bumblebirb
|
||||
public static void BumblebirbAI(NPC npc, Mod mod)
|
||||
{
|
||||
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
|
||||
|
||||
// Get a target
|
||||
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
|
||||
npc.TargetClosest(true);
|
||||
@@ -3643,6 +3646,8 @@ namespace CalamityMod.NPCs
|
||||
Player player = Main.player[npc.target];
|
||||
|
||||
// Variables
|
||||
float rotationMult = 3f;
|
||||
float rotationAmt = 0.03f;
|
||||
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
||||
bool death = CalamityWorld.death || CalamityWorld.bossRushActive;
|
||||
Vector2 vector = npc.Center;
|
||||
@@ -3655,7 +3660,7 @@ namespace CalamityMod.NPCs
|
||||
|
||||
if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f)
|
||||
{
|
||||
npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f;
|
||||
|
||||
if (npc.velocity.Y > 3f)
|
||||
npc.velocity.Y = 3f;
|
||||
@@ -3687,18 +3692,97 @@ namespace CalamityMod.NPCs
|
||||
float lifeRatio = (float)npc.life / (float)npc.lifeMax;
|
||||
|
||||
// Phases
|
||||
float mult = 1f +
|
||||
(revenge ? 0.25f : 0f) +
|
||||
(death ? 0.25f : 0f);
|
||||
bool phase2 = lifeRatio < 0.5f * mult;
|
||||
bool phase3 = lifeRatio < 0.1f * mult;
|
||||
bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death;
|
||||
bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f);
|
||||
|
||||
float newPhaseTimer = 180f;
|
||||
bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) ||
|
||||
(phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f);
|
||||
|
||||
npc.dontTakeDamage = phaseSwitchPhase;
|
||||
|
||||
if (phaseSwitchPhase)
|
||||
{
|
||||
npc.collideX = false;
|
||||
npc.collideY = false;
|
||||
npc.noTileCollide = true;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else if (npc.velocity.X > 0f)
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f;
|
||||
|
||||
if (phase3)
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] += 1f;
|
||||
|
||||
// Sound
|
||||
if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f)
|
||||
{
|
||||
SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y);
|
||||
sound.Pitch = 0.25f;
|
||||
}
|
||||
|
||||
if (calamityGlobalNPC.newAI[1] >= newPhaseTimer)
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
calamityGlobalNPC.newAI[3] = 1f;
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
calamityGlobalNPC.newAI[0] += 1f;
|
||||
|
||||
// Sound
|
||||
if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f)
|
||||
{
|
||||
SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y);
|
||||
sound.Pitch = 0.25f;
|
||||
}
|
||||
|
||||
if (calamityGlobalNPC.newAI[0] >= newPhaseTimer)
|
||||
{
|
||||
calamityGlobalNPC.newAI[0] = 0f;
|
||||
calamityGlobalNPC.newAI[2] = 1f;
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 value52 = player.Center - npc.Center;
|
||||
float scaleFactor16 = 4f + value52.Length() / 100f;
|
||||
float num1308 = 25f;
|
||||
value52.Normalize();
|
||||
value52 *= scaleFactor16;
|
||||
npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308;
|
||||
npc.netSpam = 5;
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Max spawn amount
|
||||
int num1305 = revenge ? 4 : 3;
|
||||
if (death)
|
||||
num1305 = 5;
|
||||
int num1305 = revenge ? 3 : 2;
|
||||
if (phase2)
|
||||
num1305 = death ? 3 : 2;
|
||||
num1305 = death ? 2 : 1;
|
||||
|
||||
// Variable for charging
|
||||
float chargeDistance = 600f;
|
||||
if (phase2)
|
||||
chargeDistance -= 50f;
|
||||
if (phase3)
|
||||
chargeDistance -= 50f;
|
||||
|
||||
// Don't collide with tiles, disable gravity
|
||||
npc.noTileCollide = false;
|
||||
@@ -3717,7 +3801,7 @@ namespace CalamityMod.NPCs
|
||||
|
||||
// Direction and rotation
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f;
|
||||
|
||||
// Slow down if colliding with tiles
|
||||
if (npc.collideX)
|
||||
@@ -3771,390 +3855,420 @@ namespace CalamityMod.NPCs
|
||||
npc.netUpdate = true;
|
||||
while (npc.ai[0] == 0f)
|
||||
{
|
||||
int damage = Main.expertMode ? 50 : 60;
|
||||
if (phase2)
|
||||
npc.localAI[0] += 1f;
|
||||
|
||||
int num1307 = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3);
|
||||
if (phase3)
|
||||
num1307 = 1;
|
||||
bool canHit = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1);
|
||||
|
||||
if (num1307 == 0 && Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1))
|
||||
if (npc.localAI[0] >= (phase3 ? 7 : 9) && canHit)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 2f;
|
||||
npc.ai[0] = 5f;
|
||||
npc.localAI[0] = 0f;
|
||||
}
|
||||
else if (num1307 == 1)
|
||||
else
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 3f;
|
||||
if (phase2)
|
||||
int num1307 = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3);
|
||||
if (phase3)
|
||||
num1307 = 1;
|
||||
|
||||
int damage = Main.expertMode ? 50 : 60;
|
||||
|
||||
if (num1307 == 0 && canHit)
|
||||
{
|
||||
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102);
|
||||
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-2, 3), -4f, ModContent.ProjectileType<RedLightningFeather>(), damage, 0f, Main.myPlayer, 0f, 0f);
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 2f;
|
||||
}
|
||||
}
|
||||
else if (NPC.CountNPCS(ModContent.NPCType<Bumblefuck2>()) < num1305)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 4f;
|
||||
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102);
|
||||
int featherAmt = phase2 ? 3 : 6;
|
||||
if (death)
|
||||
featherAmt *= 2;
|
||||
for (int num186 = 0; num186 < featherAmt; num186++)
|
||||
else if (num1307 == 1)
|
||||
{
|
||||
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-4, 5), -3f, ModContent.ProjectileType<RedLightningFeather>(), damage, 0f, Main.myPlayer, 0f, 0f);
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 3f;
|
||||
if (phase2)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item102, (int)npc.position.X, (int)npc.position.Y);
|
||||
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-2, 3), -4f, ModContent.ProjectileType<RedLightningFeather>(), damage, 0f, Main.myPlayer, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else if (NPC.CountNPCS(ModContent.NPCType<Bumblefuck2>()) < num1305)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 4f;
|
||||
Main.PlaySound(SoundID.Item102, (int)npc.position.X, (int)npc.position.Y);
|
||||
int featherAmt = phase2 ? 3 : 6;
|
||||
if (death)
|
||||
featherAmt *= 2;
|
||||
for (int num186 = 0; num186 < featherAmt; num186++)
|
||||
{
|
||||
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-4, 5), -3f, ModContent.ProjectileType<RedLightningFeather>(), damage, 0f, Main.myPlayer, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Fly to target
|
||||
else if (npc.ai[0] == 1f)
|
||||
{
|
||||
// Fly to target
|
||||
if (npc.ai[0] == 1f)
|
||||
npc.collideX = false;
|
||||
npc.collideY = false;
|
||||
npc.noTileCollide = true;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else if (npc.velocity.X > 0f)
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f;
|
||||
|
||||
Vector2 value52 = player.Center - npc.Center;
|
||||
if (value52.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
{
|
||||
npc.collideX = false;
|
||||
npc.collideY = false;
|
||||
npc.noTileCollide = true;
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
|
||||
float scaleFactor16 = 14f + value52.Length() / 100f; //7
|
||||
float num1308 = 25f;
|
||||
value52.Normalize();
|
||||
value52 *= scaleFactor16;
|
||||
npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308;
|
||||
npc.netSpam = 5;
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Fly towards target quickly
|
||||
else if (npc.ai[0] == 2f)
|
||||
{
|
||||
if (npc.target < 0 || !player.active || player.dead)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
|
||||
if (player.Center.X - 10f < npc.Center.X)
|
||||
npc.direction = -1;
|
||||
else if (player.Center.X + 10f > npc.Center.X)
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 1.25f) / 5f;
|
||||
|
||||
if (npc.collideX)
|
||||
{
|
||||
npc.velocity.X *= (-npc.oldVelocity.X * 0.5f);
|
||||
if (npc.velocity.X > 4f)
|
||||
npc.velocity.X = 4f;
|
||||
if (npc.velocity.X < -4f)
|
||||
npc.velocity.X = -4f;
|
||||
}
|
||||
if (npc.collideY)
|
||||
{
|
||||
npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f);
|
||||
if (npc.velocity.Y > 4f)
|
||||
npc.velocity.Y = 4f;
|
||||
if (npc.velocity.Y < -4f)
|
||||
npc.velocity.Y = -4f;
|
||||
}
|
||||
|
||||
Vector2 value53 = player.Center - npc.Center;
|
||||
value53.Y -= 20f;
|
||||
npc.ai[2] += 0.0222222228f;
|
||||
if (Main.expertMode)
|
||||
npc.ai[2] += 0.0166666675f;
|
||||
|
||||
float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4
|
||||
float num1309 = 20f;
|
||||
value53.Normalize();
|
||||
value53 *= scaleFactor17;
|
||||
npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309;
|
||||
|
||||
npc.ai[1] += 1f;
|
||||
if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1))
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Line up charge
|
||||
else if (npc.ai[0] == 3f)
|
||||
{
|
||||
npc.noTileCollide = true;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f;
|
||||
|
||||
Vector2 value54 = player.Center - npc.Center;
|
||||
value54.Y -= 12f;
|
||||
if (npc.Center.X > player.Center.X)
|
||||
value54.X += chargeDistance;
|
||||
else
|
||||
value54.X -= chargeDistance;
|
||||
|
||||
if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < (phase3 ? 100f : 20f))
|
||||
{
|
||||
npc.ai[0] = 3.1f;
|
||||
npc.ai[1] = 0f;
|
||||
}
|
||||
|
||||
npc.ai[1] += 0.0333333351f;
|
||||
float scaleFactor18 = 18f + npc.ai[1];
|
||||
float num1310 = 4f;
|
||||
value54.Normalize();
|
||||
value54 *= scaleFactor18;
|
||||
npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310;
|
||||
}
|
||||
|
||||
// Prepare to charge
|
||||
else if (npc.ai[0] == 3.1f)
|
||||
{
|
||||
npc.noTileCollide = true;
|
||||
|
||||
npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f;
|
||||
|
||||
Vector2 vector206 = player.Center - npc.Center;
|
||||
vector206.Y -= 12f;
|
||||
float scaleFactor19 = 32f; //16
|
||||
float num1311 = 8f;
|
||||
vector206.Normalize();
|
||||
vector206 *= scaleFactor19;
|
||||
npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
|
||||
npc.ai[1] += 1f;
|
||||
if (npc.ai[1] > 10f)
|
||||
{
|
||||
npc.velocity = vector206;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else if (npc.velocity.X > 0f)
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f;
|
||||
|
||||
Vector2 value52 = player.Center - npc.Center;
|
||||
if (value52.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
|
||||
float scaleFactor16 = 14f + value52.Length() / 100f; //7
|
||||
float num1308 = 25f;
|
||||
value52.Normalize();
|
||||
value52 *= scaleFactor16;
|
||||
npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308;
|
||||
npc.netSpam = 5;
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Fly towards target quickly
|
||||
if (npc.ai[0] == 2f)
|
||||
{
|
||||
if (npc.target < 0 || !player.active || player.dead)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
|
||||
if (player.Center.X - 10f < npc.Center.X)
|
||||
npc.direction = -1;
|
||||
else if (player.Center.X + 10f > npc.Center.X)
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.05f) / 5f;
|
||||
|
||||
if (npc.collideX)
|
||||
{
|
||||
npc.velocity.X *= (-npc.oldVelocity.X * 0.5f);
|
||||
if (npc.velocity.X > 4f)
|
||||
npc.velocity.X = 4f;
|
||||
if (npc.velocity.X < -4f)
|
||||
npc.velocity.X = -4f;
|
||||
}
|
||||
if (npc.collideY)
|
||||
{
|
||||
npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f);
|
||||
if (npc.velocity.Y > 4f)
|
||||
npc.velocity.Y = 4f;
|
||||
if (npc.velocity.Y < -4f)
|
||||
npc.velocity.Y = -4f;
|
||||
}
|
||||
|
||||
Vector2 value53 = player.Center - npc.Center;
|
||||
value53.Y -= 20f;
|
||||
npc.ai[2] += 0.0222222228f;
|
||||
if (Main.expertMode)
|
||||
npc.ai[2] += 0.0166666675f;
|
||||
|
||||
float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4
|
||||
float num1309 = 20f;
|
||||
value53.Normalize();
|
||||
value53 *= scaleFactor17;
|
||||
npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309;
|
||||
|
||||
npc.ai[1] += 1f;
|
||||
if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1))
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Variable for charging
|
||||
float chargeDistance = 600f;
|
||||
if (phase2)
|
||||
chargeDistance -= 50f;
|
||||
if (phase3)
|
||||
chargeDistance -= 50f;
|
||||
|
||||
// Line up charge
|
||||
if (npc.ai[0] == 3f)
|
||||
{
|
||||
npc.noTileCollide = true;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f;
|
||||
|
||||
Vector2 value54 = player.Center - npc.Center;
|
||||
value54.Y -= 12f;
|
||||
if (npc.Center.X > player.Center.X)
|
||||
value54.X += chargeDistance;
|
||||
else
|
||||
value54.X -= chargeDistance;
|
||||
|
||||
if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < (phase3 ? 100f : 20f))
|
||||
{
|
||||
npc.ai[0] = 3.1f;
|
||||
npc.ai[1] = 0f;
|
||||
}
|
||||
|
||||
npc.ai[1] += 0.0333333351f;
|
||||
float scaleFactor18 = 18f + npc.ai[1];
|
||||
float num1310 = 4f;
|
||||
value54.Normalize();
|
||||
value54 *= scaleFactor18;
|
||||
npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310;
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare to charge
|
||||
if (npc.ai[0] == 3.1f)
|
||||
{
|
||||
npc.noTileCollide = true;
|
||||
|
||||
npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f;
|
||||
|
||||
Vector2 vector206 = player.Center - npc.Center;
|
||||
vector206.Y -= 12f;
|
||||
float scaleFactor19 = 32f; //16
|
||||
float num1311 = 8f;
|
||||
vector206.Normalize();
|
||||
vector206 *= scaleFactor19;
|
||||
npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
|
||||
npc.ai[1] += 1f;
|
||||
if (npc.ai[1] > 10f)
|
||||
{
|
||||
npc.velocity = vector206;
|
||||
|
||||
if (npc.velocity.X < 0f)
|
||||
npc.direction = -1;
|
||||
else
|
||||
npc.direction = 1;
|
||||
|
||||
npc.ai[0] = 3.2f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[1] = (float)npc.direction;
|
||||
}
|
||||
}
|
||||
else
|
||||
npc.direction = 1;
|
||||
|
||||
npc.ai[0] = 3.2f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[1] = (float)npc.direction;
|
||||
}
|
||||
}
|
||||
|
||||
// Charge
|
||||
else if (npc.ai[0] == 3.2f)
|
||||
{
|
||||
npc.damage = (int)((double)npc.defDamage * 1.5);
|
||||
|
||||
npc.collideX = false;
|
||||
npc.collideY = false;
|
||||
npc.noTileCollide = true;
|
||||
|
||||
npc.ai[2] += 0.0333333351f;
|
||||
npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1];
|
||||
|
||||
if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f)))
|
||||
{
|
||||
if (!Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
{
|
||||
// Charge
|
||||
if (npc.ai[0] == 3.2f)
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 1f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f;
|
||||
}
|
||||
|
||||
// Find tile coordinates for birb spawn
|
||||
else if (npc.ai[0] == 4f)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
npc.ai[1] = -1f;
|
||||
npc.ai[2] = -1f;
|
||||
|
||||
for (int num1312 = 0; num1312 < 1000; num1312++)
|
||||
{
|
||||
int num1313 = (int)player.Center.X / 16;
|
||||
int num1314 = (int)player.Center.Y / 16;
|
||||
|
||||
int num1315 = 30 + num1312 / 50;
|
||||
int num1316 = 20 + num1312 / 75;
|
||||
|
||||
num1313 += Main.rand.Next(-num1315, num1315 + 1);
|
||||
num1314 += Main.rand.Next(-num1316, num1316 + 1);
|
||||
|
||||
if (!WorldGen.SolidTile(num1313, num1314))
|
||||
{
|
||||
npc.damage = (int)((double)npc.defDamage * 1.5);
|
||||
while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface)
|
||||
num1314++;
|
||||
|
||||
npc.collideX = false;
|
||||
npc.collideY = false;
|
||||
npc.noTileCollide = true;
|
||||
|
||||
npc.ai[2] += 0.0333333351f;
|
||||
npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1];
|
||||
|
||||
if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f)))
|
||||
if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 1600f)
|
||||
{
|
||||
if (!Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 1f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
}
|
||||
npc.ai[0] = 4.1f;
|
||||
npc.ai[1] = (float)num1313;
|
||||
npc.ai[2] = (float)num1314;
|
||||
break;
|
||||
}
|
||||
|
||||
npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f;
|
||||
return;
|
||||
}
|
||||
|
||||
// Find tile coordinates for birb spawn
|
||||
if (npc.ai[0] == 4f)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
npc.ai[1] = -1f;
|
||||
npc.ai[2] = -1f;
|
||||
|
||||
for (int num1312 = 0; num1312 < 1000; num1312++)
|
||||
{
|
||||
int num1313 = (int)player.Center.X / 16;
|
||||
int num1314 = (int)player.Center.Y / 16;
|
||||
|
||||
int num1315 = 30 + num1312 / 50;
|
||||
int num1316 = 20 + num1312 / 75;
|
||||
|
||||
num1313 += Main.rand.Next(-num1315, num1315 + 1);
|
||||
num1314 += Main.rand.Next(-num1316, num1316 + 1);
|
||||
|
||||
if (!WorldGen.SolidTile(num1313, num1314))
|
||||
{
|
||||
while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface)
|
||||
num1314++;
|
||||
|
||||
if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 1600f)
|
||||
{
|
||||
npc.ai[0] = 4.1f;
|
||||
npc.ai[1] = (float)num1313;
|
||||
npc.ai[2] = (float)num1314;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
npc.netUpdate = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Move to birb spawn location
|
||||
if (npc.ai[0] == 4.1f)
|
||||
{
|
||||
if (npc.velocity.X < -2f)
|
||||
npc.direction = -1;
|
||||
else if (npc.velocity.X > 2f)
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f;
|
||||
|
||||
npc.noTileCollide = true;
|
||||
|
||||
int num1317 = (int)npc.ai[1];
|
||||
int num1318 = (int)npc.ai[2];
|
||||
|
||||
float x2 = (float)(num1317 * 16 + 8);
|
||||
float y2 = (float)(num1318 * 16 - 20);
|
||||
|
||||
Vector2 vector207 = new Vector2(x2, y2);
|
||||
vector207 -= npc.Center;
|
||||
float num1319 = 12f + vector207.Length() / 150f;
|
||||
if (num1319 > 20f)
|
||||
num1319 = 20f;
|
||||
|
||||
float num1320 = 10f;
|
||||
if (vector207.Length() < 10f)
|
||||
npc.ai[0] = 4.2f;
|
||||
|
||||
vector207.Normalize();
|
||||
vector207 *= num1319;
|
||||
npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320;
|
||||
return;
|
||||
}
|
||||
|
||||
// Spawn birbs
|
||||
if (npc.ai[0] == 4.2f)
|
||||
{
|
||||
npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f;
|
||||
|
||||
npc.noTileCollide = true;
|
||||
|
||||
int num1321 = (int)npc.ai[1];
|
||||
int num1322 = (int)npc.ai[2];
|
||||
|
||||
float x3 = (float)(num1321 * 16 + 8);
|
||||
float y3 = (float)(num1322 * 16 - 20);
|
||||
|
||||
Vector2 vector208 = new Vector2(x3, y3);
|
||||
vector208 -= npc.Center;
|
||||
|
||||
float num1323 = 4f; //4
|
||||
float num1324 = 2f; //2
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 4f)
|
||||
{
|
||||
int num1325 = 10;
|
||||
if (Main.expertMode)
|
||||
num1325 = (int)((double)num1325 * 0.75);
|
||||
|
||||
npc.ai[3] += 1f;
|
||||
if (npc.ai[3] == (float)num1325)
|
||||
NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, ModContent.NPCType<Bumblefuck2>(), npc.whoAmI, 0f, 0f, 0f, 0f, 255);
|
||||
else if (npc.ai[3] == (float)(num1325 * 2))
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
|
||||
if (NPC.CountNPCS(ModContent.NPCType<Bumblefuck2>()) < num1305 && Main.rand.Next(5) != 0)
|
||||
npc.ai[0] = 4f;
|
||||
else if (Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
npc.ai[0] = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
if (vector208.Length() > num1323)
|
||||
{
|
||||
vector208.Normalize();
|
||||
vector208 *= num1323;
|
||||
}
|
||||
|
||||
npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
|
||||
// Move to birb spawn location
|
||||
else if (npc.ai[0] == 4.1f)
|
||||
{
|
||||
if (npc.velocity.X < -2f)
|
||||
npc.direction = -1;
|
||||
else if (npc.velocity.X > 2f)
|
||||
npc.direction = 1;
|
||||
|
||||
npc.spriteDirection = npc.direction;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f;
|
||||
|
||||
npc.noTileCollide = true;
|
||||
|
||||
int num1317 = (int)npc.ai[1];
|
||||
int num1318 = (int)npc.ai[2];
|
||||
|
||||
float x2 = (float)(num1317 * 16 + 8);
|
||||
float y2 = (float)(num1318 * 16 - 20);
|
||||
|
||||
Vector2 vector207 = new Vector2(x2, y2);
|
||||
vector207 -= npc.Center;
|
||||
float num1319 = 12f + vector207.Length() / 150f;
|
||||
if (num1319 > 20f)
|
||||
num1319 = 20f;
|
||||
|
||||
float num1320 = 10f;
|
||||
if (vector207.Length() < 10f)
|
||||
npc.ai[0] = 4.2f;
|
||||
|
||||
vector207.Normalize();
|
||||
vector207 *= num1319;
|
||||
npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320;
|
||||
}
|
||||
|
||||
// Spawn birbs
|
||||
else if (npc.ai[0] == 4.2f)
|
||||
{
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f;
|
||||
|
||||
npc.noTileCollide = true;
|
||||
|
||||
int num1321 = (int)npc.ai[1];
|
||||
int num1322 = (int)npc.ai[2];
|
||||
|
||||
float x3 = (float)(num1321 * 16 + 8);
|
||||
float y3 = (float)(num1322 * 16 - 20);
|
||||
|
||||
Vector2 vector208 = new Vector2(x3, y3);
|
||||
vector208 -= npc.Center;
|
||||
|
||||
float num1323 = 4f; //4
|
||||
float num1324 = 2f; //2
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 4f)
|
||||
{
|
||||
int num1325 = 10;
|
||||
if (Main.expertMode)
|
||||
num1325 = (int)((double)num1325 * 0.75);
|
||||
|
||||
npc.ai[3] += 1f;
|
||||
if (npc.ai[3] == (float)num1325)
|
||||
{
|
||||
SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsySummon, (int)npc.position.X, (int)npc.position.Y);
|
||||
sound.Pitch = 0.25f;
|
||||
|
||||
NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, ModContent.NPCType<Bumblefuck2>(), npc.whoAmI, 0f, 0f, 0f, 0f, 255);
|
||||
}
|
||||
else if (npc.ai[3] == (float)(num1325 * 2))
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
|
||||
if (NPC.CountNPCS(ModContent.NPCType<Bumblefuck2>()) < num1305 && Main.rand.Next(5) != 0)
|
||||
npc.ai[0] = 4f;
|
||||
else if (Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
npc.ai[0] = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
if (vector208.Length() > num1323)
|
||||
{
|
||||
vector208.Normalize();
|
||||
vector208 *= num1323;
|
||||
}
|
||||
|
||||
npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324;
|
||||
}
|
||||
|
||||
// Spit homing aura sphere
|
||||
else if (npc.ai[0] == 5f)
|
||||
{
|
||||
// Velocity
|
||||
npc.velocity *= 0.98f;
|
||||
npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f;
|
||||
|
||||
// Play sound
|
||||
float aiGateValue = 120f;
|
||||
if (npc.ai[1] == aiGateValue - 30f)
|
||||
{
|
||||
Main.PlaySound(SoundID.DD2_BetsyFireballShot, (int)npc.position.X, (int)npc.position.Y);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector;
|
||||
Projectile.NewProjectile(vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType<BirbAuraFlare>(), 0, 0f, Main.myPlayer, 0f, (float)(npc.target + 1));
|
||||
}
|
||||
}
|
||||
|
||||
npc.ai[1] += 1f;
|
||||
if (npc.ai[1] >= aiGateValue)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.OldDuke
|
||||
if (npc.frameCounter > (double)num114)
|
||||
{
|
||||
npc.frameCounter = 0D;
|
||||
npc.frame.Y = npc.frame.Y + frameHeight;
|
||||
npc.frame.Y += frameHeight;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * 6)
|
||||
{
|
||||
@@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.OldDuke
|
||||
if (npc.frameCounter > 7D)
|
||||
{
|
||||
npc.frameCounter = 0D;
|
||||
npc.frame.Y = npc.frame.Y + frameHeight;
|
||||
npc.frame.Y += frameHeight;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * 6)
|
||||
{
|
||||
@@ -154,7 +154,7 @@ namespace CalamityMod.NPCs.OldDuke
|
||||
if (npc.frameCounter > 7D)
|
||||
{
|
||||
npc.frameCounter = 0D;
|
||||
npc.frame.Y = npc.frame.Y + frameHeight;
|
||||
npc.frame.Y += frameHeight;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * 6)
|
||||
{
|
||||
|
||||
@@ -188,22 +188,6 @@ namespace CalamityMod.NPCs.OldDuke
|
||||
spriteBatch.Draw(texture2D15, vector41, new Rectangle?(npc.frame), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
int num156 = 0;
|
||||
float num157 = 0f;
|
||||
float scaleFactor9 = 0f;
|
||||
|
||||
for (int num160 = 0; num160 < num156; num160++)
|
||||
{
|
||||
Color color39 = lightColor;
|
||||
color39 = Color.Lerp(color39, color36, amount9);
|
||||
color39 = npc.GetAlpha(color39);
|
||||
color39 *= 1f - num157;
|
||||
Vector2 vector42 = npc.Center + ((float)num160 / (float)num156 * 6.28318548f + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition;
|
||||
vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector42 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, vector42, new Rectangle?(npc.frame), color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
Vector2 vector43 = npc.Center - Main.screenPosition;
|
||||
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f;
|
||||
vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.NPCs.BrimstoneElemental;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class BirbAura : ModProjectile
|
||||
{
|
||||
float timer = 0f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Birb Aura");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 80;
|
||||
projectile.height = 80;
|
||||
projectile.hostile = true;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.timeLeft = 1200;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(projectile.localAI[0]);
|
||||
writer.Write(projectile.localAI[1]);
|
||||
writer.Write(timer);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
projectile.localAI[0] = reader.ReadSingle();
|
||||
projectile.localAI[1] = reader.ReadSingle();
|
||||
timer = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2? vector78 = null;
|
||||
|
||||
if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero)
|
||||
projectile.velocity = -Vector2.UnitY;
|
||||
|
||||
Vector2 fireFrom = new Vector2(projectile.ai[0], projectile.ai[1]);
|
||||
projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f;
|
||||
|
||||
if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero)
|
||||
projectile.velocity = -Vector2.UnitY;
|
||||
|
||||
if (timer > 0f)
|
||||
timer -= 1f;
|
||||
|
||||
float num801 = 1f;
|
||||
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] >= 1200f)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * Math.PI / 1200f)) * 10f * num801;
|
||||
if (projectile.scale > num801)
|
||||
projectile.scale = num801;
|
||||
|
||||
float num804 = projectile.velocity.ToRotation();
|
||||
projectile.rotation = num804 - MathHelper.PiOver2;
|
||||
projectile.velocity = num804.ToRotationVector2();
|
||||
|
||||
float num805 = 3f; //3f
|
||||
float num806 = (float)projectile.width;
|
||||
|
||||
Vector2 samplingPoint = projectile.Center;
|
||||
if (vector78.HasValue)
|
||||
samplingPoint = vector78.Value;
|
||||
|
||||
float laserLength = MathHelper.Clamp(projectile.ai[1] - 160f, 1600f, 3600f);
|
||||
float[] array3 = new float[(int)num805];
|
||||
Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, laserLength, array3);
|
||||
float num807 = 0f;
|
||||
for (int num808 = 0; num808 < array3.Length; num808++)
|
||||
{
|
||||
num807 += array3[num808];
|
||||
}
|
||||
num807 /= num805;
|
||||
|
||||
float amount = 0.5f;
|
||||
projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount);
|
||||
|
||||
DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f);
|
||||
Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
|
||||
}
|
||||
|
||||
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
|
||||
{
|
||||
if (timer <= 0f && projectile.localAI[0] >= 120f)
|
||||
{
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
timer = 15f;
|
||||
Vector2 fireFrom = new Vector2(target.Center.X, target.Center.Y - 900f);
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)target.Center.X, (int)target.Center.Y - 300);
|
||||
Vector2 ai0 = target.Center - fireFrom;
|
||||
float ai = (float)Main.rand.Next(100);
|
||||
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
|
||||
Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), projectile.damage, 0f, projectile.owner, ai0.ToRotation(), ai);
|
||||
}
|
||||
}
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
if (projectile.velocity == Vector2.Zero)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Texture2D texture2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BirbAuraStart");
|
||||
Texture2D texture3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd");
|
||||
float num223 = projectile.localAI[1]; //length of laser
|
||||
Color color44 = new Color(128, 128, 128, 0);
|
||||
Vector2 vector = projectile.Center - Main.screenPosition;
|
||||
Rectangle? sourceRectangle2 = null;
|
||||
spriteBatch.Draw(texture2, vector, sourceRectangle2, color44, projectile.rotation, texture2.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
num223 -= (float)(texture2.Height / 2 + texture3.Height) * projectile.scale;
|
||||
Vector2 value20 = projectile.Center;
|
||||
value20 += projectile.velocity * projectile.scale * (float)texture2.Height / 2f;
|
||||
if (num223 > 0f)
|
||||
{
|
||||
float num224 = 0f;
|
||||
Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture.Width, 16);
|
||||
while (num224 + 1f < num223)
|
||||
{
|
||||
if (num223 - num224 < (float)rectangle7.Height)
|
||||
{
|
||||
rectangle7.Height = (int)(num223 - num224);
|
||||
}
|
||||
spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f);
|
||||
num224 += (float)rectangle7.Height * projectile.scale;
|
||||
value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale;
|
||||
rectangle7.Y += 16;
|
||||
if (rectangle7.Y + rectangle7.Height > texture.Height)
|
||||
{
|
||||
rectangle7.Y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vector2 vector2 = value20 - Main.screenPosition;
|
||||
sourceRectangle2 = null;
|
||||
spriteBatch.Draw(texture3, vector2, sourceRectangle2, color44, projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void CutTiles()
|
||||
{
|
||||
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
|
||||
Vector2 unit = projectile.velocity;
|
||||
Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles));
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
if (projHitbox.Intersects(targetHitbox))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
float num6 = 0f;
|
||||
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 990 B |
@@ -0,0 +1,134 @@
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class BirbAuraFlare : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Birb Aura Flare");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 32;
|
||||
projectile.height = 32;
|
||||
projectile.hostile = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.timeLeft = 600;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(projectile.localAI[0]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
projectile.localAI[0] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (projectile.ai[1] > 0f)
|
||||
{
|
||||
int num625 = (int)projectile.ai[1] - 1;
|
||||
if (num625 < 255)
|
||||
{
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] > 10f)
|
||||
{
|
||||
// Dust pulse effect
|
||||
projectile.ai[0] = (float)Math.Abs(Math.Cos((double)MathHelper.ToRadians(projectile.localAI[0] * 2f)));
|
||||
int num626 = 18;
|
||||
for (int num627 = 0; num627 < num626; num627++)
|
||||
{
|
||||
Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * projectile.ai[0];
|
||||
vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center;
|
||||
Vector2 value15 = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8);
|
||||
int num628 = Dust.NewDust(vector45 + value15, 0, 0, 60, value15.X * 2f, value15.Y * 2f, 100, default, 1f);
|
||||
Main.dust[num628].scale = 1.4f;
|
||||
Main.dust[num628].noGravity = true;
|
||||
Main.dust[num628].noLight = true;
|
||||
Main.dust[num628].velocity /= 4f;
|
||||
Main.dust[num628].velocity -= projectile.velocity;
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 value16 = Main.player[num625].Center - projectile.Center;
|
||||
float num629 = 4f;
|
||||
num629 += projectile.localAI[0] / 60f;
|
||||
projectile.velocity = Vector2.Normalize(value16) * num629;
|
||||
if (value16.Length() < 32f)
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
||||
Main.PlaySound(SoundID.DD2_BetsyFireballImpact, (int)projectile.position.X, (int)projectile.position.Y);
|
||||
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)) * MathHelper.TwoPi / (float)num226), default) + projectile.Center;
|
||||
Vector2 vector7 = vector6 - projectile.Center;
|
||||
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X, vector7.Y, 100, default, 1.4f);
|
||||
Main.dust[num228].noGravity = true;
|
||||
Main.dust[num228].noLight = true;
|
||||
Main.dust[num228].velocity = vector7;
|
||||
}
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int num231 = (int)(projectile.Center.Y / 16f);
|
||||
int num232 = (int)(projectile.Center.X / 16f);
|
||||
int num233 = 100;
|
||||
if (num232 < 10)
|
||||
{
|
||||
num232 = 10;
|
||||
}
|
||||
if (num232 > Main.maxTilesX - 10)
|
||||
{
|
||||
num232 = Main.maxTilesX - 10;
|
||||
}
|
||||
if (num231 < 10)
|
||||
{
|
||||
num231 = 10;
|
||||
}
|
||||
if (num231 > Main.maxTilesY - num233 - 10)
|
||||
{
|
||||
num231 = Main.maxTilesY - num233 - 10;
|
||||
}
|
||||
int spawnAreaY = Main.maxTilesY - num231;
|
||||
for (int num234 = num231; num234 < num231 + spawnAreaY; num234++)
|
||||
{
|
||||
Tile tile = Main.tile[num232, num234];
|
||||
if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0))
|
||||
{
|
||||
num231 = num234;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float x = (float)(num232 * 16);
|
||||
float y = (float)(num231 * 16 - 48);
|
||||
Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y);
|
||||
laserVelocity.Normalize();
|
||||
int damage = Main.expertMode ? 75 : 100;
|
||||
int num236 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, ModContent.ProjectileType<BirbAura>(), damage, 0f, Main.myPlayer, x, y);
|
||||
Main.projectile[num236].netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 159 B |
@@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Color color44 = new Color(255, 255, 255, 0) * 0.9f;
|
||||
Vector2 vector = projectile.Center - Main.screenPosition;
|
||||
Rectangle? sourceRectangle2 = null;
|
||||
Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale;
|
||||
Vector2 value20 = projectile.Center;
|
||||
value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f;
|
||||
@@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
rectangle7.Height = (int)(num223 - num224);
|
||||
}
|
||||
Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f);
|
||||
num224 += (float)rectangle7.Height * projectile.scale;
|
||||
value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale;
|
||||
rectangle7.Y += 16;
|
||||
@@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
}
|
||||
Vector2 vector2 = value20 - Main.screenPosition;
|
||||
sourceRectangle2 = null;
|
||||
Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
}
|
||||
}
|
||||
|
||||
float num1247 = 0.5f;
|
||||
float num1247 = 0.1f;
|
||||
for (int num1248 = 0; num1248 < Main.maxProjectiles; num1248++)
|
||||
{
|
||||
if (Main.projectile[num1248].active)
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.NPCs.BrimstoneElemental;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities;
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class RedLightning : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Red Lightning");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 20;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 14;
|
||||
projectile.height = 14;
|
||||
projectile.hostile = true;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.extraUpdates = 20;
|
||||
projectile.timeLeft = 1260;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(projectile.localAI[0]);
|
||||
writer.Write(projectile.localAI[1]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
projectile.localAI[0] = reader.ReadSingle();
|
||||
projectile.localAI[1] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (projectile.frameCounter == 0 || projectile.oldPos[0] == Vector2.Zero)
|
||||
{
|
||||
for (int num31 = projectile.oldPos.Length - 1; num31 > 0; num31--)
|
||||
{
|
||||
projectile.oldPos[num31] = projectile.oldPos[num31 - 1];
|
||||
}
|
||||
projectile.oldPos[0] = projectile.position;
|
||||
if (projectile.velocity == Vector2.Zero)
|
||||
{
|
||||
float num32 = projectile.rotation + MathHelper.PiOver2 + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
|
||||
float num33 = (float)Main.rand.NextDouble() * 2f + 2f;
|
||||
Vector2 vector2 = new Vector2((float)Math.Cos((double)num32) * num33, (float)Math.Sin((double)num32) * num33);
|
||||
int num34 = Dust.NewDust(projectile.oldPos[projectile.oldPos.Length - 1], 0, 0, 60, vector2.X, vector2.Y, 0, default, 1f);
|
||||
Main.dust[num34].noGravity = true;
|
||||
Main.dust[num34].scale = 1.7f;
|
||||
}
|
||||
}
|
||||
|
||||
int num3 = projectile.frameCounter;
|
||||
projectile.frameCounter = num3 + 1;
|
||||
Lighting.AddLight(projectile.Center, 0.8f, 0.25f, 0.15f);
|
||||
if (projectile.velocity == Vector2.Zero)
|
||||
{
|
||||
if (projectile.frameCounter >= projectile.extraUpdates * 2)
|
||||
{
|
||||
projectile.frameCounter = 0;
|
||||
bool flag36 = true;
|
||||
for (int num855 = 1; num855 < projectile.oldPos.Length; num855 = num3 + 1)
|
||||
{
|
||||
if (projectile.oldPos[num855] != projectile.oldPos[0])
|
||||
{
|
||||
flag36 = false;
|
||||
}
|
||||
num3 = num855;
|
||||
}
|
||||
if (flag36)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Main.rand.Next(projectile.extraUpdates) == 0)
|
||||
{
|
||||
for (int num856 = 0; num856 < 2; num856 = num3 + 1)
|
||||
{
|
||||
float num857 = projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
|
||||
float num858 = (float)Main.rand.NextDouble() * 0.8f + 1f;
|
||||
Vector2 vector96 = new Vector2((float)Math.Cos((double)num857) * num858, (float)Math.Sin((double)num857) * num858);
|
||||
int num859 = Dust.NewDust(projectile.Center, 0, 0, 60, vector96.X, vector96.Y, 0, default, 1f);
|
||||
Main.dust[num859].noGravity = true;
|
||||
Main.dust[num859].scale = 1.2f;
|
||||
num3 = num856;
|
||||
}
|
||||
if (Main.rand.Next(5) == 0)
|
||||
{
|
||||
Vector2 value39 = projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width;
|
||||
int num860 = Dust.NewDust(projectile.Center + value39 - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f);
|
||||
Dust dust = Main.dust[num860];
|
||||
dust.velocity *= 0.5f;
|
||||
Main.dust[num860].velocity.Y = -Math.Abs(Main.dust[num860].velocity.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (projectile.frameCounter >= projectile.extraUpdates * 2)
|
||||
{
|
||||
projectile.frameCounter = 0;
|
||||
float num861 = projectile.velocity.Length();
|
||||
UnifiedRandom unifiedRandom = new UnifiedRandom((int)projectile.ai[1]);
|
||||
int num862 = 0;
|
||||
Vector2 vector97 = -Vector2.UnitY;
|
||||
Vector2 vector98;
|
||||
do
|
||||
{
|
||||
int num863 = unifiedRandom.Next();
|
||||
projectile.ai[1] = (float)num863;
|
||||
num863 %= 100;
|
||||
float f = (float)num863 / 100f * MathHelper.TwoPi;
|
||||
vector98 = f.ToRotationVector2();
|
||||
if (vector98.Y > 0f)
|
||||
{
|
||||
vector98.Y *= -1f;
|
||||
}
|
||||
bool flag37 = false;
|
||||
if (vector98.Y > -0.02f)
|
||||
{
|
||||
flag37 = true;
|
||||
}
|
||||
if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] > 40f)
|
||||
{
|
||||
flag37 = true;
|
||||
}
|
||||
if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] < -40f)
|
||||
{
|
||||
flag37 = true;
|
||||
}
|
||||
if (!flag37)
|
||||
{
|
||||
goto IL_25086;
|
||||
}
|
||||
num3 = num862;
|
||||
num862 = num3 + 1;
|
||||
}
|
||||
while (num3 < 100);
|
||||
|
||||
projectile.velocity = Vector2.Zero;
|
||||
projectile.localAI[1] = 1f;
|
||||
|
||||
goto IL_25092;
|
||||
|
||||
IL_25086:
|
||||
vector97 = vector98;
|
||||
|
||||
IL_25092:
|
||||
if (projectile.velocity != Vector2.Zero)
|
||||
{
|
||||
projectile.localAI[0] += vector97.X * (float)(projectile.extraUpdates + 1) * 2f * num861;
|
||||
projectile.velocity = vector97.RotatedBy((double)(projectile.ai[0] + MathHelper.PiOver2), default(Vector2)) * num861;
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Vector2 end = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Texture2D tex3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/RedLightningTexture");
|
||||
projectile.GetAlpha(lightColor);
|
||||
Vector2 scale16 = new Vector2(projectile.scale) / 2f;
|
||||
for (int num289 = 0; num289 < 3; num289++)
|
||||
{
|
||||
if (num289 == 0)
|
||||
{
|
||||
scale16 = new Vector2(projectile.scale) * 0.6f;
|
||||
DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(219, 104, 58, 0) * 0.5f;
|
||||
}
|
||||
else if (num289 == 1)
|
||||
{
|
||||
scale16 = new Vector2(projectile.scale) * 0.4f;
|
||||
DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 126, 56, 0) * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale16 = new Vector2(projectile.scale) * 0.2f;
|
||||
DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 128, 128, 0) * 0.5f;
|
||||
}
|
||||
DelegateMethods.f_1 = 1f;
|
||||
for (int num290 = projectile.oldPos.Length - 1; num290 > 0; num290--)
|
||||
{
|
||||
if (!(projectile.oldPos[num290] == Vector2.Zero))
|
||||
{
|
||||
Vector2 start = projectile.oldPos[num290] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Vector2 end2 = projectile.oldPos[num290 - 1] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Utils.DrawLaser(spriteBatch, tex3, start, end2, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw));
|
||||
}
|
||||
}
|
||||
if (projectile.oldPos[0] != Vector2.Zero)
|
||||
{
|
||||
DelegateMethods.f_1 = 1f;
|
||||
Vector2 start2 = projectile.oldPos[0] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Utils.DrawLaser(Main.spriteBatch, tex3, start2, end, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 191 B |
@@ -1880,15 +1880,9 @@ namespace CalamityMod.Projectiles
|
||||
{
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
}
|
||||
float num66 = 0f;
|
||||
Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.projFrames[projectile.type] / 2));
|
||||
Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0);
|
||||
Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha);
|
||||
Color alpha15 = projectile.GetAlpha(color9);
|
||||
float num212 = 0.99f;
|
||||
alpha15.R = (byte)((float)alpha15.R * num212);
|
||||
alpha15.G = (byte)((float)alpha15.G * num212);
|
||||
alpha15.B = (byte)((float)alpha15.B * num212);
|
||||
alpha15.A = (byte)((float)alpha15.A * num212);
|
||||
for (int num213 = 0; num213 < 4; num213++)
|
||||
{
|
||||
Vector2 position9 = projectile.position;
|
||||
@@ -1915,7 +1909,7 @@ namespace CalamityMod.Projectiles
|
||||
int y = frames * projectile.frame;
|
||||
position9.Y -= (float)(projectile.height / 2);
|
||||
Main.spriteBatch.Draw(texture,
|
||||
new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + num66 + projectile.gfxOffY),
|
||||
new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY),
|
||||
new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||