A few Rancor fixes
1 - Fixed it scaling three times with damage; damage buff to compensate 2 - Fixed possible errors from attempting to spawn tile stuff outside of the world 3 - Converted the fog to a particle to fix laser jankiness issues caused by hitting the projectile cap
This commit is contained in:
1 parent
194d0b1d86
commit
290b77f5ed
14 files changed
+59
-83
No files matched your search
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
Item.width = 66;
|
||||
Item.height = 82;
|
||||
Item.damage = 290;
|
||||
Item.damage = 333;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.noUseGraphic = true;
|
||||
Item.channel = true;
|
||||
|
||||
@@ -184,7 +184,6 @@ PrinceFlameSmall.DisplayName: Holy Fire
|
||||
RainbowComet.DisplayName: Comet
|
||||
RainbowRocket.DisplayName: Rainbow Rocket
|
||||
RancorArm.DisplayName: Vengeful Arm
|
||||
RancorFog.DisplayName: The Fog Is Coming
|
||||
RancorLargeCinder.DisplayName: Lava Cinder
|
||||
RancorLaserbeam.DisplayName: The Angy Beam
|
||||
RancorMagicCircle.DisplayName: Magic Circle
|
||||
|
||||
@@ -7,6 +7,7 @@ using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -208,7 +209,8 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
NPC.Calamity().newAI[0]++;
|
||||
if (NPC.Calamity().newAI[0] % 5 == 0 && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType<RancorFog>(), 0, 0f, Main.myPlayer);
|
||||
RancorFog fog = new(NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
RancorLavaMetaball.SpawnParticle(NPC.Bottom + Main.rand.NextVector2Circular(10f, 10f), 135f);
|
||||
}
|
||||
if (NPC.Calamity().newAI[0] % 30 == 0 && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
|
||||
@@ -4510,8 +4510,10 @@ namespace CalamityMod.NPCs
|
||||
if (ashesOnDeath > 0)
|
||||
{
|
||||
if (Main.rand.NextBool(4))
|
||||
Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), ProjectileType<RancorFog>(), 0, 0f, Main.myPlayer, 0f, 0.475f);
|
||||
|
||||
{
|
||||
RancorFog fog = new(npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), 180, Main.rand.NextFloat(0.45f, 0.75f), Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
if (Main.rand.NextBool(6))
|
||||
{
|
||||
Vector2 randomPosition = new(npc.position.X + Main.rand.NextFloat(-10f, npc.width + 10f), npc.position.Y + Main.rand.NextFloat(-10f, npc.height + 10f));
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class RancorFog : Particle
|
||||
{
|
||||
private float Opacity = 0f;
|
||||
public override bool UseAdditiveBlend => true;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
public RancorFog(Vector2 position, Vector2 velocity, int lifetime, float scale, float rotation)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
Lifetime = lifetime;
|
||||
Scale = scale;
|
||||
Rotation = rotation;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Rotation += Velocity.X * 0.004f;
|
||||
Velocity *= 0.985f;
|
||||
Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 90f, Time, true);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D texture = GeneralParticleHandler.GetTexture(Type);
|
||||
float opacity = Opacity * 0.5f;
|
||||
Color drawColor = new Color(236, 0, 68) * opacity;
|
||||
Main.EntitySpriteDraw(texture, Position - Main.screenPosition, null, drawColor, Rotation, texture.Size() * 0.5f, Scale, SpriteEffects.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class RancorFog : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public ref float LightPower => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 184;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.timeLeft = 210;
|
||||
Projectile.hide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Decide scale and initial rotation on the first frame this projectile exists.
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
Projectile.scale = Main.rand.NextFloat(1f, 1.7f) * Projectile.ai[1];
|
||||
Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
|
||||
Projectile.rotation += Projectile.velocity.X * 0.004f;
|
||||
Projectile.velocity *= 0.985f;
|
||||
|
||||
// 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information.
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
// Calculate light power. This checks below the position of the fog to check if this fog is underground.
|
||||
// Without this, it may render over the fullblack that the game renders for obscured tiles.
|
||||
float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D);
|
||||
LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f);
|
||||
Projectile.Opacity = Utils.GetLerpValue(210f, 195f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true);
|
||||
}
|
||||
|
||||
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
|
||||
{
|
||||
behindNPCsAndTiles.Add(index);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Main.spriteBatch.SetBlendState(BlendState.Additive);
|
||||
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Vector2 origin = texture.Size() * 0.5f;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f;
|
||||
Color drawColor = new Color(236, 0, 68) * opacity;
|
||||
Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale;
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0);
|
||||
|
||||
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
// Cast the magic circle on the first frame.
|
||||
if (Main.myPlayer == Projectile.owner && Time == 1f)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<RancorMagicCircle>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<RancorMagicCircle>(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner);
|
||||
|
||||
// Handle frames.
|
||||
Projectile.frameCounter++;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -128,7 +129,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public void CreateTileHitEffects()
|
||||
{
|
||||
Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f));
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType<RancorFog>(), 0, 0f, Projectile.owner, 0f, 1f);
|
||||
RancorFog fog = new(endOfLaser, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
SoundEngine.PlaySound(SoundID.Zombie104, Projectile.Center);
|
||||
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType<RancorLaserbeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.identity);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType<RancorLaserbeam>(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner, Projectile.identity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public class AuroraFire : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog";
|
||||
public override string Texture => "CalamityMod/Particles/RancorFog";
|
||||
|
||||
public static int Lifetime => 480;
|
||||
public static int Fadetime => 450;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public class PristineSecondary : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog";
|
||||
public override string Texture => "CalamityMod/Particles/RancorFog";
|
||||
|
||||
public ref float ScaleFactor => ref Projectile.ai[0];
|
||||
public float LightPower = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public class AntlionSkewerSandCloud : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog";
|
||||
public override string Texture => "CalamityMod/Particles/RancorFog";
|
||||
public ref float CloudHue => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CalamityMod.World
|
||||
|
||||
public class SolidOrPlatform : GenCondition
|
||||
{
|
||||
protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(x, y);
|
||||
protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(Framing.GetTileSafely(x, y));
|
||||
}
|
||||
|
||||
public class IsNotTouchingAir : GenCondition
|
||||
|
||||
Reference in new issue
Block a user