This commit is contained in:
mountaindrew10 committed 2023-01-07 08:46:09 -06:00
commit 615b21915d
21 files changed
+160 -43

No files matched your search

+2 -3
View File
@@ -15,14 +15,13 @@ namespace CalamityMod.Items.Weapons.Summon
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Ethereal Subjugator");
Tooltip.SetDefault("Summons a phantom to protect you\n" +
"Each phantom takes only half of a minion slot");
Tooltip.SetDefault("Summons a phantom to protect you");
SacrificeTotal = 1;
}
public override void SetDefaults()
{
Item.damage = 45;
Item.damage = 200;
Item.mana = 10;
Item.width = 66;
Item.height = 70;
+1 -1
View File
@@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged
float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 16f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f;
Color color = Color.Lerp(Color.LightGreen, Color.LightPink, colorInterpolation) * 0.4f;
color.A = 0;
Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-25f, -25f);
Color outerColor = color;
Color innerColor = color * 0.5f;
float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi);
+1 -1
View File
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged
Color.SlateGray
}) * Projectile.Opacity;
color.A = 0;
Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-15f, -15f);
Color outerColor = color;
Color innerColor = color * 0.5f;
float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi);
+105 -19
View File
@@ -1,49 +1,135 @@
using Microsoft.Xna.Framework;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class GhostFire : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public bool ableToHit = true;
public NPC target;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Fire");
DisplayName.SetDefault("Ghastly Particle");
ProjectileID.Sets.MinionShot[Projectile.type] = true;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20;
}
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.width = Projectile.height = 16;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.extraUpdates = 100;
Projectile.timeLeft = 80;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 50;
Projectile.penetrate = 200;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 600;
Projectile.minion = true;
Projectile.minionSlots = 0f;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 50;
Projectile.DamageType = DamageClass.Summon;
}
public override bool? CanDamage() => ableToHit ? (bool?)null : false;
public override void AI()
{
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 6f)
Player player = Main.player[Projectile.owner];
Projectile.localAI[0] += 1f / (Projectile.extraUpdates + 1);
if (Projectile.penetrate < 200) //If an enemy has already been hit by the projectile, prevents any further homing capabilities
{
Vector2 vector33 = Projectile.position;
vector33 -= Projectile.velocity * 0.25f;
Projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 180, 0f, 0f, 0, default, 0.2f);
Main.dust[num448].position = vector33;
Main.dust[num448].noGravity = true;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
if (Projectile.timeLeft > 60) { Projectile.timeLeft = 60; } //The projectile start shrinking and slowing down. it can still hit for a bit during this, to allow a bit of multi-target if the enemies are really close to eachother.
Projectile.velocity *= 0.88f;
}
else if (Projectile.localAI[0] < 60f) //If the projectile hasn't been alive for 1 second yet, slow it down more every frame and prevent any homing capabilities.
{
Projectile.velocity *= 0.93f;
}
else FindTarget(player); //No barricades stand in our way. FIND AND KILL!
if (Projectile.timeLeft <= 20) //removes projectile's ability to hit when it is super close to death because it will have been visually shrunk to almost nothing in PreDraw
{
ableToHit = false;
}
}
public void FindTarget(Player player)
{
float maxDistance = 3000f;
bool foundTarget = false;
if (player.HasMinionAttackTargetNPC) //Targetted enemy takes priority for homing no matter what.
{
NPC npc = Main.npc[player.MinionAttackTargetNPC];
if (npc.CanBeChasedBy(Projectile, false))
{
float targetDist = Vector2.Distance(npc.Center, Projectile.Center);
if (targetDist < maxDistance)
{
maxDistance = targetDist;
foundTarget = true;
target = npc;
}
}
}
if (!foundTarget)
{
for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++)
{
NPC npc = Main.npc[npcIndex];
if (npc.CanBeChasedBy(Projectile, false))
{
float targetDist = Vector2.Distance(npc.Center, Projectile.Center);
if (targetDist < maxDistance)
{
maxDistance = targetDist;
foundTarget = true;
target = npc;
}
}
}
}
if (!foundTarget) //If the enemy that the projectile was heading towards died prematurely, slow down the projectile if there are no new targets.
{
Projectile.velocity *= 0.98f;
}
else KillTheThing(target); //If there is an npc found, seek and destroy.
}
public void KillTheThing(NPC npc)
{
Projectile.velocity = Projectile.SuperhomeTowardsTarget(npc, 50f/(Projectile.extraUpdates+1), 60f / (Projectile.extraUpdates + 1), 1f / (Projectile.extraUpdates + 1)); //predictionStrength is lessened to account for extra updates, otherwise the projectile tends to copy fast NPC movement 1:1. Not Cool.
}
public override bool PreDraw(ref Color lightColor) //photoviscerator ball drawcode, slightly edited
{
Texture2D lightTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value;
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f;
Color color = Color.Lerp(Color.Cyan, Color.LightBlue, colorInterpolation) * 0.4f;
color.A = 0;
Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2 (-28f, -28f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right.
Color outerColor = color;
Color innerColor = color * 0.5f;
float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi);
intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length);
if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death
{
intensity *= Projectile.timeLeft / 60f;
}
// Become smaller the futher along the old positions we are.
Vector2 outerScale = new Vector2(1f) * intensity;
Vector2 innerScale = new Vector2(1f) * intensity * 0.7f;
outerColor *= intensity;
innerColor *= intensity;
Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.6f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.6f, SpriteEffects.None, 0);
}
return false;
}
}
}
+27 -11
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon
Projectile.netImportant = true;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.minionSlots = 0.5f;
Projectile.minionSlots = 1f;
Projectile.timeLeft = 18000;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
@@ -36,6 +36,9 @@ namespace CalamityMod.Projectiles.Summon
Projectile.DamageType = DamageClass.Summon;
}
public int shootTimeCounter = 0;
bool canShoot = false;
public override void AI()
{
Player player = Main.player[Projectile.owner];
@@ -80,7 +83,7 @@ namespace CalamityMod.Projectiles.Summon
if (npc.CanBeChasedBy(Projectile, false))
{
float num646 = Vector2.Distance(npc.Center, Projectile.Center);
if (!flag25 && num646 < num633)
if (num646 < num633)
{
num633 = num646;
vector46 = npc.Center;
@@ -194,24 +197,37 @@ namespace CalamityMod.Projectiles.Summon
}
if (Projectile.ai[0] == 0f)
{
float scaleFactor3 = 6f;
int num658 = ModContent.ProjectileType<GhostFire>();
if (flag25 && Projectile.ai[1] == 0f)
{
SoundEngine.PlaySound(SoundID.Item20, Projectile.position);
Projectile.ai[1] += 1f;
if (Main.myPlayer == Projectile.owner)
{
Vector2 value19 = vector46 - Projectile.Center;
value19.Normalize();
value19 *= scaleFactor3;
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, value19.X, value19.Y, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f);
if (Main.projectile.IndexInRange(p))
Main.projectile[p].originalDamage = Projectile.originalDamage;
canShoot = true;
Projectile.netUpdate = true;
}
}
}
if (canShoot)
{
shootTimeCounter++;
if (shootTimeCounter % 20 == 0 && shootTimeCounter <= 60)
{
SoundEngine.PlaySound(SoundID.Item20, Projectile.position);
float randomRadius = Main.rand.Next(10, 14);
Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(randomRadius, randomRadius);
Projectile.velocity -= randomVelocity*0.22f; //funny recoil
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, randomVelocity.X, randomVelocity.Y, ModContent.ProjectileType<GhostFire>(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f);
Projectile.netUpdate = true;
}
if (shootTimeCounter > 200)
{
canShoot = false;
shootTimeCounter = 0;
Projectile.netUpdate = true;
}
}
}
public override Color? GetAlpha(Color lightColor)
+1 -1
View File
@@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Furniture
public override bool RightClick(int i, int j)
{
CalamityUtils.RightClickBreak(i, j);
CalamityUtils.LightHitWire(Type, i, j, 1, 1);
return true;
}
}
@@ -1,8 +1,10 @@
using CalamityMod.Items.Placeables.Furniture.Fountains;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.ObjectInteractions;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
@@ -19,7 +21,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override void NearbyEffects(int i, int j, bool closer)
{
if (Main.tile[i, j].TileFrameX < 36)
if (Main.tile[i, j].TileFrameX >= 36)
CalamityGlobalTile.SetActiveFountainColor(ModContent.Find<ModWaterStyle>("CalamityMod/AbyssWater").Slot);
}
@@ -60,6 +62,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override bool RightClick(int i, int j)
{
CalamityUtils.LightHitWire(Type, i, j, 2, 4);
SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16));
return true;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

@@ -2,8 +2,10 @@
using CalamityMod.Items.Placeables.Furniture.Fountains;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.ObjectInteractions;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
@@ -20,7 +22,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override void NearbyEffects(int i, int j, bool closer)
{
if (Main.tile[i, j].TileFrameX < 36)
if (Main.tile[i, j].TileFrameX >= 36)
CalamityGlobalTile.SetActiveFountainColor(ModContent.Find<ModWaterStyle>("CalamityMod/AstralWater").Slot);
}
@@ -61,6 +63,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override bool RightClick(int i, int j)
{
CalamityUtils.LightHitWire(Type, i, j, 2, 4);
SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16));
return true;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,8 +1,10 @@
using CalamityMod.Items.Placeables.Furniture.Fountains;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.ObjectInteractions;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
@@ -19,7 +21,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override void NearbyEffects(int i, int j, bool closer)
{
if (Main.tile[i, j].TileFrameX < 36)
if (Main.tile[i, j].TileFrameX >= 36)
CalamityGlobalTile.SetActiveFountainColor(ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricWater").Slot);
}
@@ -60,6 +62,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override bool RightClick(int i, int j)
{
CalamityUtils.LightHitWire(Type, i, j, 2, 4);
SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16));
return true;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -1,8 +1,10 @@
using CalamityMod.Items.Placeables.Furniture.Fountains;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.ObjectInteractions;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
@@ -19,7 +21,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override void NearbyEffects(int i, int j, bool closer)
{
if (Main.tile[i, j].TileFrameX < 36)
if (Main.tile[i, j].TileFrameX >= 36)
CalamityGlobalTile.SetActiveFountainColor(ModContent.Find<ModWaterStyle>("CalamityMod/SunkenSeaWater").Slot);
}
@@ -60,6 +62,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains
public override bool RightClick(int i, int j)
{
CalamityUtils.LightHitWire(Type, i, j, 2, 4);
SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16));
return true;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

+2
View File
@@ -1,6 +1,7 @@
using CalamityMod.Items.Placeables.Furniture;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.Events;
using Terraria.GameContent.ObjectInteractions;
@@ -58,6 +59,7 @@ namespace CalamityMod.Tiles.Furniture
{
CalamityUtils.LightHitWire(Type, i, j, 3, 3);
LanternNight.ToggleManualLanterns();
SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16));
return true;
}
+1 -1
View File
@@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Furniture
public override bool RightClick(int i, int j)
{
CalamityUtils.RightClickBreak(i, j);
CalamityUtils.LightHitWire(Type, i, j, 1, 1);
return true;
}
}
+4 -2
View File
@@ -152,9 +152,11 @@ namespace CalamityMod
/// <param name="projectile">The projectile that should home.</param>
/// <param name="target">The target.</param>
/// <param name="inertia">The inertia of the movement change.</param>
public static Vector2 SuperhomeTowardsTarget(this Projectile projectile, NPC target, float homingSpeed, float inertia)
/// <param name="predictionStrength">The ratio for how much the projectile aims ahead of the target. 1f is normal predictiveness. 0.01f is the lowest possible value, equating to no practical predictiveness.</param>
public static Vector2 SuperhomeTowardsTarget(this Projectile projectile, NPC target, float homingSpeed, float inertia, float predictionStrength = 1f)
{
Vector2 idealVelocity = CalculatePredictiveAimToTarget(projectile.Center, target, homingSpeed);
if (predictionStrength < 0.01f) { predictionStrength = 0.01f; }
Vector2 idealVelocity = CalculatePredictiveAimToTarget(projectile.Center, target, homingSpeed/predictionStrength) * predictionStrength;
return (projectile.velocity * (inertia - 1f) + idealVelocity) / inertia;
}
#endregion