Reworked Mauler's AI and moved it to T3 Acid Rain
This commit is contained in:
1 parent
1fec40abda
commit
c4583827f2
13 files changed
+1101
-895
No files matched your search
@@ -91,7 +91,8 @@ namespace CalamityMod.Events
|
||||
public static Dictionary<int, AcidRainSpawnData> PossibleMinibossesPolter = new Dictionary<int, AcidRainSpawnData>()
|
||||
{
|
||||
{ ModContent.NPCType<CragmawMire>(), new AcidRainSpawnData(4, 0.08f, AcidRainSpawnRequirement.Water) },
|
||||
{ ModContent.NPCType<NuclearTerror>(), new AcidRainSpawnData(8, 0.05f, AcidRainSpawnRequirement.Anywhere) }
|
||||
{ ModContent.NPCType<Mauler>(), new AcidRainSpawnData(4, 0.07f, AcidRainSpawnRequirement.Water) },
|
||||
{ ModContent.NPCType<NuclearTerror>(), new AcidRainSpawnData(8, 0.045f, AcidRainSpawnRequirement.Anywhere) }
|
||||
};
|
||||
|
||||
public static readonly List<int> AllMinibosses = PossibleMinibossesAS.Select(miniboss => miniboss.Key).ToList().Concat(PossibleMinibossesPolter.Select(miniboss => miniboss.Key)).Distinct().ToList();
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 132 B |
@@ -1,19 +1,15 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.Projectiles.Environment;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using Terraria.Utilities;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
@@ -82,11 +78,11 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.noTileCollide = false;
|
||||
npc.HitSound = SoundID.NPCHit1;
|
||||
npc.DeathSound = SoundID.NPCDeath1;
|
||||
npc.Calamity().VulnerableToHeat = false;
|
||||
npc.Calamity().VulnerableToSickness = false;
|
||||
npc.Calamity().VulnerableToElectricity = true;
|
||||
npc.Calamity().VulnerableToWater = false;
|
||||
}
|
||||
npc.Calamity().VulnerableToHeat = false;
|
||||
npc.Calamity().VulnerableToSickness = false;
|
||||
npc.Calamity().VulnerableToElectricity = true;
|
||||
npc.Calamity().VulnerableToWater = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,449 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
public class Mauler : ModNPC
|
||||
{
|
||||
public enum MaulerAttackState
|
||||
{
|
||||
BubbleBursts,
|
||||
HorizontalAcidCharge,
|
||||
BigChargeupDash
|
||||
}
|
||||
|
||||
public bool InWater => Collision.DrownCollision(npc.Center, 1, 1);
|
||||
public Player Target => Main.player[npc.target];
|
||||
public MaulerAttackState CurrentAttack
|
||||
{
|
||||
get => (MaulerAttackState)(int)npc.ai[0];
|
||||
set => npc.ai[0] = (int)value;
|
||||
}
|
||||
public ref float AttackTimer => ref npc.ai[1];
|
||||
public int CurrentFrame
|
||||
{
|
||||
get => (int)npc.localAI[0];
|
||||
set => npc.localAI[0] = value;
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Mauler");
|
||||
Main.npcFrameCount[npc.type] = 8;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
npc.noGravity = true;
|
||||
npc.damage = 135;
|
||||
npc.width = 180;
|
||||
npc.height = 90;
|
||||
npc.defense = 50;
|
||||
npc.DR_NERD(0.05f);
|
||||
npc.lifeMax = 88500;
|
||||
npc.aiStyle = -1;
|
||||
aiType = -1;
|
||||
npc.value = Item.buyPrice(0, 25, 0, 0);
|
||||
npc.HitSound = SoundID.NPCHit1;
|
||||
npc.DeathSound = SoundID.NPCDeath60;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.rarity = 2;
|
||||
banner = npc.type;
|
||||
bannerItem = ModContent.ItemType<MaulerBanner>();
|
||||
npc.RemoveWaterSlowness();
|
||||
npc.Calamity().canBreakPlayerDefense = true;
|
||||
npc.Calamity().VulnerableToHeat = false;
|
||||
npc.Calamity().VulnerableToSickness = false;
|
||||
npc.Calamity().VulnerableToElectricity = true;
|
||||
npc.Calamity().VulnerableToWater = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.TargetClosest(false);
|
||||
|
||||
// Reset things every frame. They may be changed in the attack states below.
|
||||
npc.noTileCollide = false;
|
||||
npc.noGravity = InWater;
|
||||
TelegraphCompletionInterpolant = 0f;
|
||||
|
||||
switch (CurrentAttack)
|
||||
{
|
||||
case MaulerAttackState.BubbleBursts:
|
||||
DoBehavior_BubbleBursts();
|
||||
break;
|
||||
case MaulerAttackState.HorizontalAcidCharge:
|
||||
DoBehavior_HorizontalAcidCharge();
|
||||
break;
|
||||
case MaulerAttackState.BigChargeupDash:
|
||||
DoBehavior_BigChargeupDash();
|
||||
break;
|
||||
}
|
||||
|
||||
// Emit radioactive light.
|
||||
Vector2 left = npc.Center - Vector2.UnitX * 15f;
|
||||
Vector2 right = npc.Center + Vector2.UnitX * 15f;
|
||||
DelegateMethods.v3_1 = Color.Lime.ToVector3();
|
||||
Utils.PlotTileLine(left, right, 10f, DelegateMethods.CastLightOpen);
|
||||
|
||||
// Drift away from the world border.
|
||||
if (npc.Center.X < (Main.offLimitBorderTiles + 6f) * 16f || npc.Center.X >= (Main.maxTilesX - Main.offLimitBorderTiles - 6f) * 16f)
|
||||
{
|
||||
npc.velocity *= 0.9f;
|
||||
npc.Center = npc.Center.MoveTowards(Target.Center, 12f);
|
||||
}
|
||||
|
||||
AttackTimer++;
|
||||
}
|
||||
|
||||
public void DoBehavior_BubbleBursts()
|
||||
{
|
||||
int roarDelay = 32;
|
||||
int shootDelay = 24;
|
||||
int bubblesPerBurst = 7;
|
||||
int burstShootRate = 45;
|
||||
int burstCount = 3;
|
||||
float wrappedAttackTimer = (AttackTimer - roarDelay - shootDelay) % burstShootRate;
|
||||
|
||||
// Slow down. If necessary, fall.
|
||||
npc.velocity *= 0.94f;
|
||||
if (!InWater)
|
||||
{
|
||||
npc.noTileCollide = true;
|
||||
npc.position.Y += 6f;
|
||||
}
|
||||
|
||||
// Roar prior to releasing bubbles.
|
||||
if (AttackTimer <= roarDelay)
|
||||
CurrentFrame = (int)Math.Round(Utils.InverseLerp(0f, roarDelay, AttackTimer, true) * 5f);
|
||||
|
||||
// Animate as usual a bit after roaring.
|
||||
else if (AttackTimer >= roarDelay + shootDelay)
|
||||
{
|
||||
npc.frameCounter++;
|
||||
if (npc.frameCounter >= 5)
|
||||
{
|
||||
CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type];
|
||||
npc.frameCounter = 0;
|
||||
}
|
||||
|
||||
// Open the mouth prior to creating bubbles.
|
||||
if (wrappedAttackTimer >= burstShootRate * 0.7f)
|
||||
CurrentFrame = 4;
|
||||
}
|
||||
if (AttackTimer == roarDelay)
|
||||
Main.PlaySound(SoundID.Zombie, Target.Center, 97);
|
||||
|
||||
// Rotate towards the target.
|
||||
int previousSpriteDirection = npc.spriteDirection;
|
||||
float idealRotation = npc.AngleTo(Target.Center);
|
||||
if (previousSpriteDirection == 1)
|
||||
idealRotation += MathHelper.Pi;
|
||||
npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt();
|
||||
if (previousSpriteDirection != npc.spriteDirection)
|
||||
npc.rotation += MathHelper.Pi;
|
||||
|
||||
npc.rotation = npc.rotation.AngleTowards(idealRotation, 0.125f).AngleLerp(idealRotation, 0.075f);
|
||||
|
||||
// Fire the bubble bursts.
|
||||
bool shouldShootBubbles = AttackTimer >= roarDelay + shootDelay && wrappedAttackTimer == burstShootRate - 1f;
|
||||
if (shouldShootBubbles)
|
||||
{
|
||||
Vector2 mouthPosition = npc.Center + new Vector2(npc.spriteDirection * -56f, 22f).RotatedBy(npc.rotation);
|
||||
Main.PlaySound(SoundID.Item96, mouthPosition);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int bubbleShootType = ModContent.ProjectileType<MaulerAcidBubble>();
|
||||
int bubbleDamage = npc.GetProjectileDamage(bubbleShootType);
|
||||
Vector2 baseBubbleShootVelocity = npc.SafeDirectionTo(mouthPosition) * 13.5f;
|
||||
for (int i = 0; i < bubblesPerBurst; i++)
|
||||
{
|
||||
Vector2 bubbleShootVelocity = baseBubbleShootVelocity + Main.rand.NextVector2Circular(4f, 4f);
|
||||
Projectile.NewProjectile(mouthPosition, bubbleShootVelocity, bubbleShootType, bubbleDamage, 0f);
|
||||
}
|
||||
|
||||
// Get launched back after firing. This only happens if in water and there's no obstacles behind.
|
||||
if (InWater && Collision.CanHit(npc.Center, 1, 1, npc.Center - baseBubbleShootVelocity.SafeNormalize(Vector2.Zero) * 100f, 1, 1))
|
||||
npc.velocity -= baseBubbleShootVelocity * 0.62f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (AttackTimer >= roarDelay + shootDelay + burstShootRate * burstCount)
|
||||
SelectNextAttack();
|
||||
}
|
||||
|
||||
public void DoBehavior_HorizontalAcidCharge()
|
||||
{
|
||||
int stuckGiveupTime = 360;
|
||||
int chargeDelay = 45;
|
||||
int chargePreparationTime = 15;
|
||||
int chargeTime = 72;
|
||||
int acidShootRate = 4;
|
||||
float chargeSpeed = 24.5f;
|
||||
ref float stuckTimer = ref npc.ai[2];
|
||||
ref float chargeDirection = ref npc.ai[3];
|
||||
|
||||
// Select frames.
|
||||
npc.frameCounter++;
|
||||
if (npc.frameCounter >= 5)
|
||||
{
|
||||
CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type];
|
||||
npc.frameCounter = 0;
|
||||
}
|
||||
|
||||
// Decide the rotation and direction.
|
||||
npc.rotation = npc.velocity.X * 0.0125f;
|
||||
if (Math.Abs(npc.velocity.X) > 0.1f)
|
||||
npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt();
|
||||
if (AttackTimer < chargeDelay + chargePreparationTime)
|
||||
npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt();
|
||||
|
||||
// Move through tiles and attempt to reach water if stuck on land.
|
||||
Vector2 idealPosition = Target.Center + Vector2.UnitX * (Target.Center.X < npc.Center.X).ToDirectionInt() * 480f;
|
||||
if (!InWater && AttackTimer < chargeDelay)
|
||||
{
|
||||
npc.noTileCollide = true;
|
||||
npc.noGravity = true;
|
||||
AttackTimer = 0f;
|
||||
|
||||
if (WorldUtils.Find(idealPosition.ToTileCoordinates(), Searches.Chain(new Searches.Down(1500), new CustomConditions.IsWater()), out Point hitPoint))
|
||||
idealPosition = hitPoint.ToWorldCoordinates();
|
||||
Vector2 idealVelocity = npc.SafeDirectionTo(idealPosition) * 20f;
|
||||
|
||||
// Move towards the ideal position.
|
||||
if (!npc.WithinRange(idealPosition, 120f))
|
||||
npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.05f);
|
||||
|
||||
// Give up and do another attack if unable to find water.
|
||||
stuckTimer++;
|
||||
if (stuckTimer >= stuckGiveupTime)
|
||||
{
|
||||
npc.Opacity = 1f;
|
||||
SelectNextAttack();
|
||||
}
|
||||
}
|
||||
else
|
||||
stuckTimer = 0f;
|
||||
|
||||
// Handle opacity. When not in water, become almost completely transparent.
|
||||
npc.Opacity = MathHelper.Clamp(npc.Opacity + InWater.ToDirectionInt() * 0.04f, 0.33f, 1f);
|
||||
|
||||
// Charge and release homing acid upward.
|
||||
if (AttackTimer >= chargeDelay && AttackTimer < chargeDelay + chargePreparationTime)
|
||||
{
|
||||
// Define the charge direction.
|
||||
if (chargeDirection == 0f)
|
||||
{
|
||||
chargeDirection = (Target.Center.X > npc.Center.X).ToDirectionInt();
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
npc.position.Y += npc.SafeDirectionTo(Target.Center).Y * 8f;
|
||||
npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitX * chargeDirection * chargeSpeed, 0.075f);
|
||||
}
|
||||
|
||||
bool isCharging = AttackTimer >= chargeDelay + chargePreparationTime && AttackTimer < chargeDelay + chargePreparationTime + chargeTime;
|
||||
bool shouldShootAcid = isCharging && AttackTimer % acidShootRate == acidShootRate - 1f;
|
||||
if (shouldShootAcid)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item95, npc.Center);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int acidShootType = ModContent.ProjectileType<MaulerAcidDrop>();
|
||||
int acidDamage = npc.GetProjectileDamage(acidShootType);
|
||||
Vector2 acidSpawnPosition = npc.Center + Main.rand.NextVector2Circular(30f, 10f).RotatedBy(npc.rotation);
|
||||
Vector2 acidShootVelocity = -Vector2.UnitY.RotatedByRandom(0.33f) * Main.rand.NextFloat(8f, 10.5f);
|
||||
Projectile.NewProjectile(acidSpawnPosition, acidShootVelocity, acidShootType, acidDamage, 0f);
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (npc.velocity.Length() < 0.4f)
|
||||
npc.velocity = Vector2.Zero;
|
||||
|
||||
Vector2 aheadPosition = npc.position + npc.velocity.SafeNormalize(Vector2.UnitX * -npc.spriteDirection) * 150f;
|
||||
bool stuckWhileCharging = !Collision.CanHit(npc.position, npc.width, npc.height, aheadPosition, npc.width, npc.height) ||
|
||||
Collision.SolidCollision(npc.position, npc.width, npc.height);
|
||||
stuckWhileCharging &= isCharging;
|
||||
if (AttackTimer >= chargeDelay + chargePreparationTime + chargeTime || stuckWhileCharging)
|
||||
{
|
||||
npc.velocity *= 0.5f;
|
||||
SelectNextAttack();
|
||||
}
|
||||
}
|
||||
|
||||
public void DoBehavior_BigChargeupDash()
|
||||
{
|
||||
int chargeDelay = 105;
|
||||
int telegraphTime = 60;
|
||||
int chargeTime = 50;
|
||||
float chargeSpeed = MathHelper.Clamp(npc.Distance(Target.Center) / chargeTime * 1.35f, 29f, 45f);
|
||||
bool hasCharged = AttackTimer >= chargeDelay;
|
||||
|
||||
// Slow down at first. If necessary, fall.
|
||||
if (!hasCharged)
|
||||
{
|
||||
npc.velocity *= 0.94f;
|
||||
npc.noGravity = true;
|
||||
}
|
||||
|
||||
// Select frames.
|
||||
npc.frameCounter++;
|
||||
if (npc.frameCounter >= (hasCharged ? 4 : 7))
|
||||
{
|
||||
CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type];
|
||||
npc.frameCounter = 0;
|
||||
}
|
||||
|
||||
// Open the mouth if close to the target after charging.
|
||||
if (CurrentFrame < 4 && npc.WithinRange(Target.Center, 200f) && AttackTimer > chargeDelay)
|
||||
CurrentFrame = 4;
|
||||
|
||||
// Create the telegraph.
|
||||
TelegraphCompletionInterpolant = Utils.InverseLerp(chargeDelay - telegraphTime, chargeDelay, AttackTimer, true);
|
||||
TelegraphCompletionInterpolant *= Utils.InverseLerp(chargeDelay + 16f, chargeDelay, AttackTimer, true);
|
||||
|
||||
// Rotate towards the target at first.
|
||||
int previousSpriteDirection = npc.spriteDirection;
|
||||
float idealRotation = npc.AngleTo(Target.Center);
|
||||
if (previousSpriteDirection == 1)
|
||||
idealRotation += MathHelper.Pi;
|
||||
|
||||
// Roar as a telegraph. The placement of the sound is offset such that the player and ideally determine the determine where the charge will come from.
|
||||
if (AttackTimer == chargeDelay - telegraphTime)
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), Target.Center + Target.SafeDirectionTo(npc.Center) * 300f);
|
||||
|
||||
// Charge.
|
||||
if (AttackTimer == chargeDelay)
|
||||
{
|
||||
Main.PlaySound(SoundID.DD2_FlameburstTowerShot, Target.Center);
|
||||
npc.velocity = npc.SafeDirectionTo(Target.Center) * chargeSpeed;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
if (!hasCharged)
|
||||
{
|
||||
npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt();
|
||||
if (previousSpriteDirection != npc.spriteDirection)
|
||||
npc.rotation += MathHelper.Pi;
|
||||
|
||||
npc.rotation = npc.rotation.AngleTowards(idealRotation, 0.18f).AngleLerp(idealRotation, 0.08f);
|
||||
}
|
||||
else
|
||||
{
|
||||
TelegraphCompletionInterpolant = 0f;
|
||||
npc.noGravity = npc.noTileCollide = true;
|
||||
npc.rotation = npc.velocity.ToRotation();
|
||||
if (previousSpriteDirection == 1)
|
||||
npc.rotation += MathHelper.Pi;
|
||||
}
|
||||
|
||||
if (AttackTimer >= chargeDelay + chargeTime)
|
||||
SelectNextAttack();
|
||||
}
|
||||
|
||||
public void SelectNextAttack()
|
||||
{
|
||||
// Reset the attack timer and optional attack variables.
|
||||
AttackTimer = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[3] = 0f;
|
||||
|
||||
MaulerAttackState oldAttack = CurrentAttack;
|
||||
|
||||
bool targetDefinitelyNotNearWater = false;
|
||||
bool isInCrampedPosition = Collision.SolidCollision(npc.Center - Vector2.One * 150f, 300, 300) && InWater;
|
||||
if (Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
isInCrampedPosition = true;
|
||||
|
||||
// Register the target as not near water if they have left the ocean.
|
||||
if (Target.position.X > 8000f && Target.position.X < Main.maxTilesX * 16f - 8000f)
|
||||
targetDefinitelyNotNearWater = true;
|
||||
|
||||
// Register the target as not near water if there's no water below the target's position or it's very far away.
|
||||
if (WorldUtils.Find(Target.Center.ToTileCoordinates(), Searches.Chain(new Searches.Down(750), new CustomConditions.IsWater()), out Point hitPoint))
|
||||
{
|
||||
if (Target.Distance(hitPoint.ToWorldCoordinates()) > 6400f)
|
||||
targetDefinitelyNotNearWater = true;
|
||||
}
|
||||
else
|
||||
targetDefinitelyNotNearWater = true;
|
||||
|
||||
WeightedRandom<MaulerAttackState> attackSelector = new WeightedRandom<MaulerAttackState>(Main.rand);
|
||||
attackSelector.Add(MaulerAttackState.BubbleBursts);
|
||||
attackSelector.Add(MaulerAttackState.HorizontalAcidCharge);
|
||||
attackSelector.Add(MaulerAttackState.BigChargeupDash);
|
||||
|
||||
// Select the new attack.
|
||||
// It is random, but will never perform the same attack twice in succession.
|
||||
do
|
||||
CurrentAttack = attackSelector.Get();
|
||||
while (oldAttack == CurrentAttack);
|
||||
|
||||
// Bypass the above check and use an attack that doesn't require water if there's none nearby.
|
||||
if (targetDefinitelyNotNearWater || isInCrampedPosition)
|
||||
CurrentAttack = MaulerAttackState.BigChargeupDash;
|
||||
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
|
||||
{
|
||||
Texture2D texture = Main.npcTexture[npc.type];
|
||||
Texture2D glowmask = ModContent.GetTexture("CalamityMod/NPCs/AcidRain/MaulerGlowmask");
|
||||
Vector2 drawPosition = npc.Center - Main.screenPosition + Vector2.UnitY * npc.gfxOffY;
|
||||
Vector2 origin = npc.frame.Size() * 0.5f;
|
||||
SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
spriteBatch.Draw(texture, drawPosition, npc.frame, npc.GetAlpha(drawColor), npc.rotation, origin, npc.scale, direction, 0f);
|
||||
spriteBatch.Draw(glowmask, drawPosition, npc.frame, npc.GetAlpha(Color.White), npc.rotation, origin, npc.scale, direction, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight)
|
||||
{
|
||||
npc.frame.Y = CurrentFrame * frameHeight;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
{
|
||||
player.AddBuff(ModContent.BuffType<Irradiated>(), 420);
|
||||
}
|
||||
|
||||
public override void NPCLoot()
|
||||
{
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<SulphuricAcidCannon>(), 3);
|
||||
|
||||
// Drop shark fins. They are specially colored to match the color of maulers.
|
||||
int item = Item.NewItem(npc.Center, npc.Size, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false);
|
||||
Main.item[item].color = new Color(151, 115, 57, 255);
|
||||
NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
for (int k = 0; k < 5; k++)
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
|
||||
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
for (int k = 0; k < 30; k++)
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
|
||||
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), npc.scale);
|
||||
for (int i = 2; i <= 5; i++)
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot($"Gores/Mauler{i}"), npc.scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.lifeMax = 198230;
|
||||
npc.defense = 50;
|
||||
|
||||
npc.damage = 175;
|
||||
npc.damage = 135;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.value = Item.buyPrice(0, 20, 0, 0);
|
||||
npc.DR_NERD(0.3f);
|
||||
|
||||
@@ -1,395 +0,0 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.NPCs.AquaticScourge;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.SulphurousSea
|
||||
{
|
||||
public class Mauler : ModNPC
|
||||
{
|
||||
private bool hasBeenHit = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Mauler");
|
||||
Main.npcFrameCount[npc.type] = 8;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
npc.Calamity().canBreakPlayerDefense = true;
|
||||
npc.noGravity = true;
|
||||
npc.damage = 135;
|
||||
npc.width = 180;
|
||||
npc.height = 90;
|
||||
npc.defense = 50;
|
||||
npc.DR_NERD(0.05f);
|
||||
npc.lifeMax = 165000;
|
||||
npc.aiStyle = -1;
|
||||
aiType = -1;
|
||||
npc.value = Item.buyPrice(0, 25, 0, 0);
|
||||
npc.HitSound = SoundID.NPCHit1;
|
||||
npc.DeathSound = SoundID.NPCDeath60;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.rarity = 2;
|
||||
banner = npc.type;
|
||||
bannerItem = ModContent.ItemType<MaulerBanner>();
|
||||
npc.Calamity().VulnerableToHeat = false;
|
||||
npc.Calamity().VulnerableToSickness = false;
|
||||
npc.Calamity().VulnerableToElectricity = true;
|
||||
npc.Calamity().VulnerableToWater = false;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(hasBeenHit);
|
||||
writer.Write(npc.chaseable);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
hasBeenHit = reader.ReadBoolean();
|
||||
npc.chaseable = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.spriteDirection = (npc.direction > 0) ? 1 : -1;
|
||||
npc.noGravity = true;
|
||||
if (npc.direction == 0)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
}
|
||||
if (npc.justHit)
|
||||
{
|
||||
hasBeenHit = true;
|
||||
}
|
||||
npc.chaseable = hasBeenHit;
|
||||
if (npc.wet)
|
||||
{
|
||||
bool flag14 = hasBeenHit;
|
||||
npc.TargetClosest(false);
|
||||
if (Main.player[npc.target].wet && !Main.player[npc.target].dead &&
|
||||
Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) &&
|
||||
(Main.player[npc.target].Center - npc.Center).Length() < 300f)
|
||||
{
|
||||
flag14 = true;
|
||||
}
|
||||
if (Main.player[npc.target].dead && flag14)
|
||||
{
|
||||
flag14 = false;
|
||||
}
|
||||
if (!flag14)
|
||||
{
|
||||
if (npc.collideX)
|
||||
{
|
||||
npc.velocity.X = npc.velocity.X * -1f;
|
||||
npc.direction *= -1;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
if (npc.collideY)
|
||||
{
|
||||
npc.netUpdate = true;
|
||||
if (npc.velocity.Y > 0f)
|
||||
{
|
||||
npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f;
|
||||
npc.directionY = -1;
|
||||
npc.ai[0] = -1f;
|
||||
}
|
||||
else if (npc.velocity.Y < 0f)
|
||||
{
|
||||
npc.velocity.Y = Math.Abs(npc.velocity.Y);
|
||||
npc.directionY = 1;
|
||||
npc.ai[0] = 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag14)
|
||||
{
|
||||
if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
{
|
||||
npc.localAI[1] += 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (npc.localAI[1] > 0f)
|
||||
{
|
||||
npc.localAI[1] -= 1f;
|
||||
}
|
||||
}
|
||||
npc.localAI[2] += 1f;
|
||||
npc.TargetClosest(true);
|
||||
npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.5f;
|
||||
npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.25f;
|
||||
if (npc.velocity.X > 22f)
|
||||
{
|
||||
npc.velocity.X = 22f;
|
||||
}
|
||||
if (npc.velocity.X < -22f)
|
||||
{
|
||||
npc.velocity.X = -22f;
|
||||
}
|
||||
if (npc.velocity.Y > 13f)
|
||||
{
|
||||
npc.velocity.Y = 13f;
|
||||
}
|
||||
if (npc.velocity.Y < -13f)
|
||||
{
|
||||
npc.velocity.Y = -13f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.velocity.X += (float)npc.direction * 0.2f;
|
||||
if (npc.velocity.X < -4f || npc.velocity.X > 4f)
|
||||
{
|
||||
npc.velocity.X *= 0.95f;
|
||||
}
|
||||
if (npc.ai[0] == -1f)
|
||||
{
|
||||
npc.velocity.Y -= 0.01f;
|
||||
if (npc.velocity.Y < -0.3f)
|
||||
{
|
||||
npc.ai[0] = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.velocity.Y += 0.01f;
|
||||
if (npc.velocity.Y > 0.3f)
|
||||
{
|
||||
npc.ai[0] = -1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16;
|
||||
int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16;
|
||||
if (Main.tile[num258, num259 - 1] == null)
|
||||
{
|
||||
Main.tile[num258, num259 - 1] = new Tile();
|
||||
}
|
||||
if (Main.tile[num258, num259 + 1] == null)
|
||||
{
|
||||
Main.tile[num258, num259 + 1] = new Tile();
|
||||
}
|
||||
if (Main.tile[num258, num259 + 2] == null)
|
||||
{
|
||||
Main.tile[num258, num259 + 2] = new Tile();
|
||||
}
|
||||
if (Main.tile[num258, num259 - 1].liquid > 128)
|
||||
{
|
||||
if (Main.tile[num258, num259 + 1].active())
|
||||
{
|
||||
npc.ai[0] = -1f;
|
||||
}
|
||||
else if (Main.tile[num258, num259 + 2].active())
|
||||
{
|
||||
npc.ai[0] = -1f;
|
||||
}
|
||||
}
|
||||
if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f)
|
||||
{
|
||||
npc.velocity.Y *= 0.95f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.localAI[1] += 1f;
|
||||
npc.localAI[0] += 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 30f)
|
||||
{
|
||||
npc.localAI[0] = 0f;
|
||||
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
{
|
||||
float speed = 12f;
|
||||
Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2));
|
||||
float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21);
|
||||
float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21);
|
||||
float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7));
|
||||
num8 = speed / num8;
|
||||
num6 *= num8;
|
||||
num7 *= num8;
|
||||
int damage = 50;
|
||||
if (Main.expertMode)
|
||||
{
|
||||
damage = 45;
|
||||
}
|
||||
int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 60f : -60f), npc.Center.Y, num6, num7, ModContent.ProjectileType<SulphuricAcidMist>(), damage, 0f, Main.myPlayer, 0f, 0f);
|
||||
}
|
||||
}
|
||||
if (npc.velocity.Y == 0f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
npc.velocity.Y = (float)Main.rand.Next(-200, -150) * 0.1f; //50 20
|
||||
npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; //20 20
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
npc.velocity.Y = npc.velocity.Y + 0.4f; //0.4
|
||||
if (npc.velocity.Y > 16f)
|
||||
{
|
||||
npc.velocity.Y = 16f;
|
||||
}
|
||||
npc.ai[0] = 1f;
|
||||
}
|
||||
if (hasBeenHit)
|
||||
{
|
||||
if (Main.rand.NextBool(300))
|
||||
{
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)npc.position.X, (int)npc.position.Y);
|
||||
}
|
||||
}
|
||||
if (npc.localAI[1] >= 255f || npc.localAI[2] >= 600f)
|
||||
{
|
||||
npc.localAI[2] = 0f;
|
||||
BlowUp();
|
||||
return;
|
||||
}
|
||||
else if (npc.localAI[1] > 0f)
|
||||
{
|
||||
for (int k = 0; k < (int)((double)npc.localAI[1] * 0.05); k++)
|
||||
{
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 0, default, 1f);
|
||||
}
|
||||
}
|
||||
npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f;
|
||||
if (npc.rotation < -0.2f)
|
||||
{
|
||||
npc.rotation = -0.2f;
|
||||
}
|
||||
if (npc.rotation > 0.2f)
|
||||
{
|
||||
npc.rotation = 0.2f;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanBeHitByProjectile(Projectile projectile)
|
||||
{
|
||||
if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention)
|
||||
{
|
||||
return hasBeenHit;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void BlowUp()
|
||||
{
|
||||
Main.PlaySound(SoundID.NPCDeath60, npc.Center);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
|
||||
float spreadBoom = 15f * 0.0174f;
|
||||
double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2;
|
||||
double deltaAngleBoom = spreadBoom / 8f;
|
||||
double offsetAngleBoom;
|
||||
int iBoom;
|
||||
int damageBoom = npc.localAI[1] >= 255f ? 200 : 50;
|
||||
for (iBoom = 0; iBoom < 25; iBoom++)
|
||||
{
|
||||
int projectileType = Main.rand.NextBool(2) ? ModContent.ProjectileType<SulphuricAcidMist>() : ModContent.ProjectileType<SulphuricAcidBubble>();
|
||||
offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom;
|
||||
int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f);
|
||||
int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f);
|
||||
}
|
||||
}
|
||||
for (int num621 = 0; num621 < 25; num621++)
|
||||
{
|
||||
int num622 = Dust.NewDust(npc.position, npc.width, npc.height, 31, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[num622].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[num622].scale = 0.5f;
|
||||
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
Main.dust[num622].noGravity = true;
|
||||
}
|
||||
for (int num623 = 0; num623 < 50; num623++)
|
||||
{
|
||||
int num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[num624].noGravity = true;
|
||||
Main.dust[num624].velocity *= 5f;
|
||||
num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[num624].velocity *= 2f;
|
||||
Main.dust[num624].noGravity = true;
|
||||
}
|
||||
if (npc.localAI[1] >= 255f)
|
||||
{
|
||||
npc.active = false;
|
||||
}
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight)
|
||||
{
|
||||
npc.frameCounter += hasBeenHit ? 0.15f : 0.075f;
|
||||
npc.frameCounter %= Main.npcFrameCount[npc.type];
|
||||
int frame = (int)npc.frameCounter;
|
||||
npc.frame.Y = frame * frameHeight;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
{
|
||||
player.AddBuff(ModContent.BuffType<Irradiated>(), 420);
|
||||
}
|
||||
|
||||
public override void NPCLoot()
|
||||
{
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<SulphuricAcidCannon>(), CalamityWorld.downedPolterghast, 3, 1, 1);
|
||||
int item = Item.NewItem(npc.Center, npc.Size, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false);
|
||||
Main.item[item].color = new Color(151, 115, 57, 255);
|
||||
NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
if (spawnInfo.playerSafe)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType<Mauler>()) &&
|
||||
!NPC.AnyNPCs(ModContent.NPCType<AquaticScourgeHead>()))
|
||||
{
|
||||
if (!Main.hardMode)
|
||||
{
|
||||
return 0.001f;
|
||||
}
|
||||
if (!NPC.downedMoonlord)
|
||||
{
|
||||
return 0.01f;
|
||||
}
|
||||
return 0.1f;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
|
||||
}
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
for (int k = 0; k < 30; k++)
|
||||
{
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
|
||||
}
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler2"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler3"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler4"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler5"), 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,79 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Enemy
|
||||
{
|
||||
public class MaulerAcidBubble : ModProjectile
|
||||
{
|
||||
public ref float Time => ref projectile.ai[0];
|
||||
public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Acid Bubble");
|
||||
Main.projFrames[projectile.type] = 7;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 30;
|
||||
projectile.height = 30;
|
||||
projectile.hostile = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.timeLeft = 150;
|
||||
projectile.penetrate = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Handle frames.
|
||||
projectile.frameCounter++;
|
||||
projectile.frame = projectile.frameCounter / 4 % Main.projFrames[projectile.type];
|
||||
|
||||
// Home in on players after a sufficient amount of time has passed.
|
||||
if (Time > 60f)
|
||||
{
|
||||
float flySpeed = Main.expertMode ? 17.5f : 14.5f;
|
||||
Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)];
|
||||
if (!projectile.WithinRange(target.Center, 50f))
|
||||
projectile.velocity = (projectile.velocity * 49f + projectile.SafeDirectionTo(target.Center) * flySpeed) / 50f;
|
||||
projectile.tileCollide = true;
|
||||
}
|
||||
|
||||
// Emit light.
|
||||
Lighting.AddLight(projectile.Center, 0.2f, 0.6f, 0.2f);
|
||||
|
||||
// Rotate.
|
||||
projectile.rotation += projectile.direction * 0.04f;
|
||||
Time++;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, int damage, bool crit)
|
||||
{
|
||||
if (projectile.localAI[1] < 1f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
target.AddBuff(ModContent.BuffType<Irradiated>(), 120);
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item54, projectile.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Enemy
|
||||
{
|
||||
public class MaulerAcidDrop : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Acid");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 16;
|
||||
projectile.height = 16;
|
||||
projectile.penetrate = -1;
|
||||
projectile.hostile = true;
|
||||
projectile.timeLeft = 240;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = false;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
float homingSpeed = 16f;
|
||||
Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)];
|
||||
if (projectile.WithinRange(target.Center, 1200f) && projectile.timeLeft < 210)
|
||||
projectile.velocity = (projectile.velocity * 59f + projectile.SafeDirectionTo(target.Center) * homingSpeed) / 60f;
|
||||
projectile.Opacity = Utils.InverseLerp(0f, 25f, projectile.timeLeft, true);
|
||||
projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, int damage, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Irradiated>(), 60);
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
lightColor = Color.White;
|
||||
lightColor.A = 64;
|
||||
return lightColor * projectile.Opacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
+513
-489
File diff suppressed because it is too large.
Load diff
@@ -38,6 +38,7 @@ using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.NPCs.AcidRain;
|
||||
|
||||
namespace CalamityMod
|
||||
{
|
||||
@@ -739,6 +740,9 @@ namespace CalamityMod
|
||||
{ new Tuple<int, int>(ModContent.NPCType<PhantomFuckYou>(), ModContent.ProjectileType<PhantomMine>()), new int[] { 160, 276, 304, 320, 456 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<PhantomSpiritL>(), ModContent.ProjectileType<PhantomGhostShot>()), new int[] { 130, 212, 236, 248, 354 } },
|
||||
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Mauler>(), ModContent.ProjectileType<MaulerAcidBubble>()), new int[] { 140, 220, 220, 220, 220 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Mauler>(), ModContent.ProjectileType<MaulerAcidDrop>()), new int[] { 140, 220, 220, 220, 220 } },
|
||||
|
||||
{ new Tuple<int, int>(ModContent.NPCType<OldDuke>(), ModContent.ProjectileType<OldDukeGore>()), new int[] { 150, 240, 264, 276, 390 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<OldDuke>(), ModContent.ProjectileType<OldDukeVortex>()), new int[] { 280, 400, 440, 464, 660 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<OldDukeToothBall>(), ModContent.ProjectileType<SandToothOldDuke>()), new int[] { 150, 240, 264, 276, 390 } },
|
||||
|
||||
Reference in new issue
Block a user