Sea Snail friend :)
This commit is contained in:
1 parent
7bb176109f
commit
e39d40e727
8 files changed
+256
-138
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
@@ -9,8 +9,8 @@ namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Urchin");
|
||||
Description.SetDefault("The urchin will protect you");
|
||||
DisplayName.SetDefault("Sea Snail");
|
||||
Description.SetDefault("Meow?");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
//Main.persistentBuff[Type] = true;
|
||||
@@ -19,11 +19,14 @@ namespace CalamityMod.Buffs.Summon
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<Urchin>()] > 0)
|
||||
|
||||
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<VictideSeaSnail>()] > 0)
|
||||
{
|
||||
modPlayer.vUrchin = true;
|
||||
modPlayer.victideSnail = true;
|
||||
}
|
||||
if (!modPlayer.vUrchin)
|
||||
|
||||
if (!modPlayer.victideSnail)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
|
||||
@@ -625,6 +625,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool eskimoSet = false; //vanilla armor
|
||||
public bool meteorSet = false; //vanilla armor, for space gun nerf
|
||||
public bool victideSet = false;
|
||||
public bool victideSummoner = false;
|
||||
public bool sulfurSet = false;
|
||||
public bool sulfurJump = false;
|
||||
public bool jumpAgainSulfur = false;
|
||||
@@ -723,7 +724,6 @@ namespace CalamityMod.CalPlayer
|
||||
public bool omegaBlueChestplate = false;
|
||||
public bool omegaBlueSet = false;
|
||||
public bool omegaBlueHentai = false;
|
||||
public bool urchin = false;
|
||||
public bool valkyrie = false;
|
||||
public bool slimeGod = false;
|
||||
public bool molluskSet = false;
|
||||
@@ -949,7 +949,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool hauntedDishes = false;
|
||||
public bool stormjaw = false;
|
||||
public bool sGod = false;
|
||||
public bool vUrchin = false;
|
||||
public bool victideSnail = false;
|
||||
public bool cSpirit = false;
|
||||
public bool rOrb = false;
|
||||
public bool dCrystal = false;
|
||||
@@ -1780,6 +1780,7 @@ namespace CalamityMod.CalPlayer
|
||||
meteorSet = false; //vanilla armor, for Space Gun nerf
|
||||
|
||||
victideSet = false;
|
||||
victideSummoner = false;
|
||||
|
||||
sulfurSet = false;
|
||||
sulfurJump = false;
|
||||
@@ -2023,7 +2024,7 @@ namespace CalamityMod.CalPlayer
|
||||
sandnado = false;
|
||||
plantera = false;
|
||||
aProbe = false;
|
||||
vUrchin = false;
|
||||
victideSnail = false;
|
||||
cSpirit = false;
|
||||
rOrb = false;
|
||||
dCrystal = false;
|
||||
@@ -2040,7 +2041,6 @@ namespace CalamityMod.CalPlayer
|
||||
redDevil = false;
|
||||
valkyrie = false;
|
||||
slimeGod = false;
|
||||
urchin = false;
|
||||
chaosSpirit = false;
|
||||
daedalusCrystal = false;
|
||||
shellfish = false;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CalamityMod.Items.Armor
|
||||
"+1 max minion";
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.victideSet = true;
|
||||
modPlayer.urchin = true;
|
||||
modPlayer.victideSummoner = true;
|
||||
player.maxMinions++;
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
@@ -54,11 +54,11 @@ namespace CalamityMod.Items.Armor
|
||||
player.AddBuff(ModContent.BuffType<VictideSummonSetBuff>(), 3600, true);
|
||||
}
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<Urchin>()] < 1)
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<VictideSeaSnail>()] < 1)
|
||||
{
|
||||
int baseDamage = 7;
|
||||
int minionDamage = (int)player.GetDamage<GenericDamageClass>().CombineWith(player.GetDamage<SummonDamageClass>()).ApplyTo(baseDamage);
|
||||
int p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType<Urchin>(), minionDamage, 0f, Main.myPlayer, 0f, 0f);
|
||||
int p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType<VictideSeaSnail>(), minionDamage, 0f, Main.myPlayer, 0f, 0f);
|
||||
if (Main.projectile.IndexInRange(p))
|
||||
Main.projectile[p].originalDamage = baseDamage;
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ namespace CalamityMod
|
||||
|
||||
// Victide
|
||||
if (setBonus == "victide_summon" || setBonus == "victide summon")
|
||||
return mp.urchin; // the bool set directly by VictideHelmet.UpdateArmorSet
|
||||
return mp.victideSummoner; // the bool set directly by VictideHelmet.UpdateArmorSet
|
||||
else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide "))
|
||||
return mp.victideSet;
|
||||
|
||||
@@ -863,7 +863,7 @@ namespace CalamityMod
|
||||
if (setBonus == "victide_summon" || setBonus == "victide summon")
|
||||
{
|
||||
mp.victideSet = enabled;
|
||||
mp.urchin = enabled; // LATER -- remove this when player.urchin actually controls victide summoner
|
||||
mp.victideSummoner = enabled;
|
||||
return true;
|
||||
}
|
||||
else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide "))
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class Urchin : ModProjectile
|
||||
{
|
||||
public int dust = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Urchin");
|
||||
ProjectileID.Sets.MinionSacrificable[Projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 30;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.minion = true;
|
||||
Projectile.minionSlots = 0f;
|
||||
Projectile.timeLeft = 18000;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft *= 5;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (!modPlayer.urchin)
|
||||
{
|
||||
Projectile.active = false;
|
||||
return;
|
||||
}
|
||||
bool correctMinion = Projectile.type == ModContent.ProjectileType<Urchin>();
|
||||
if (correctMinion)
|
||||
{
|
||||
if (player.dead)
|
||||
{
|
||||
modPlayer.vUrchin = false;
|
||||
}
|
||||
if (modPlayer.vUrchin)
|
||||
{
|
||||
Projectile.timeLeft = 2;
|
||||
}
|
||||
}
|
||||
dust--;
|
||||
if (dust >= 0)
|
||||
{
|
||||
int dustAmt = 50;
|
||||
for (int d = 0; d < dustAmt; d++)
|
||||
{
|
||||
int index = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[index].velocity *= 2f;
|
||||
Main.dust[index].scale *= 1.15f;
|
||||
}
|
||||
}
|
||||
float scalar = (float)Main.mouseTextColor / 200f - 0.35f;
|
||||
scalar *= 0.2f;
|
||||
Projectile.scale = scalar + 0.95f;
|
||||
Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f);
|
||||
if (player.gravDir == -1f)
|
||||
{
|
||||
Projectile.position.Y += 120f;
|
||||
Projectile.rotation = MathHelper.Pi;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.rotation = 0f;
|
||||
}
|
||||
Projectile.position.X = (int)Projectile.position.X;
|
||||
Projectile.position.Y = (int)Projectile.position.Y;
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
if (Projectile.ai[0] != 0f)
|
||||
{
|
||||
Projectile.ai[0] -= 1f;
|
||||
return;
|
||||
}
|
||||
bool foundTarget = false;
|
||||
float maxDist = 300f;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc.CanBeChasedBy(Projectile, false))
|
||||
{
|
||||
if (Vector2.Distance(Projectile.Center, npc.Center) < maxDist && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height))
|
||||
{
|
||||
foundTarget = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundTarget)
|
||||
{
|
||||
int projAmt = Main.rand.Next(3, 7);
|
||||
for (int u = 0; u < projAmt; u++)
|
||||
{
|
||||
Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y);
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
int spore = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, velocity, ModContent.ProjectileType<UrchinSpike>(), Projectile.damage, 1f, Projectile.owner, 0f, 0f);
|
||||
Main.projectile[spore].minion = true;
|
||||
Main.projectile[spore].minionSlots = 0f;
|
||||
Main.projectile[spore].originalDamage = Projectile.originalDamage;
|
||||
}
|
||||
SoundEngine.PlaySound(SoundID.Item42, Projectile.position);
|
||||
Projectile.ai[0] = 60f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.aiStyle = 1;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class VictideSeaSnail : ModProjectile
|
||||
{
|
||||
public ref float DustTimer => ref Projectile.localAI[0];
|
||||
public ref float FireCooldown => ref Projectile.localAI[1];
|
||||
public ref float PeekingOut => ref Projectile.ai[0];
|
||||
public ref float PlayerStandStillTimer => ref Projectile.ai[1];
|
||||
|
||||
public const int frameTime = 6;
|
||||
public const int timeToStandStillBeforePeekOut = 200;
|
||||
|
||||
public bool CanComePeekOut => !Main.player[Projectile.owner].mount.Active && PlayerStandStillTimer >= timeToStandStillBeforePeekOut || Projectile.frame > 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sea Snail");
|
||||
ProjectileID.Sets.MinionSacrificable[Projectile.type] = true;
|
||||
Main.projFrames[Projectile.type] = 7;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 30;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.minion = true;
|
||||
Projectile.minionSlots = 0f;
|
||||
Projectile.timeLeft = 18000;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft *= 5;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
if (!modPlayer.victideSummoner)
|
||||
{
|
||||
for (int d = 0; d < 45; d++)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f);
|
||||
dust.velocity *= 2f;
|
||||
dust.scale *= 1.15f;
|
||||
}
|
||||
Projectile.active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.dead)
|
||||
modPlayer.victideSnail = false;
|
||||
|
||||
if (modPlayer.victideSnail)
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
//Create a burst of dust as it gets created
|
||||
DustTimer++;
|
||||
if (DustTimer <= 3)
|
||||
{
|
||||
int dustAmount = Main.rand.Next(40, 50);
|
||||
for (int d = 0; d < dustAmount; d++)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f);
|
||||
dust.velocity *= 2f;
|
||||
dust.scale *= 1.15f;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.velocity.Length() == 0)
|
||||
{
|
||||
PlayerStandStillTimer++;
|
||||
//pop out the shell
|
||||
if (PlayerStandStillTimer == timeToStandStillBeforePeekOut )
|
||||
{
|
||||
DustTimer = 0;
|
||||
float direction = Main.rand.NextBool() ? 1f : -1f;
|
||||
Projectile.velocity = new Vector2(Main.rand.NextFloat(4f, 10f) * direction, Main.rand.NextFloat(-6f, 0f));
|
||||
}
|
||||
|
||||
Projectile.velocity *= 0.98f;
|
||||
Projectile.velocity.X *= 0.95f;
|
||||
Projectile.velocity.Y = Math.Min(Projectile.velocity.Y + 0.1f, 14f);
|
||||
Projectile.tileCollide = true;
|
||||
|
||||
if (CanComePeekOut)
|
||||
Projectile.rotation = Projectile.rotation.AngleTowards(0, MathHelper.PiOver4 * 0.14f);
|
||||
|
||||
if (PeekingOut > 0)
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > frameTime)
|
||||
{
|
||||
Projectile.frameCounter = 0;
|
||||
Projectile.frame = Math.Min(6, Projectile.frame + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Go back, in the shell
|
||||
if (player.velocity.Length() > 0 && CanComePeekOut)
|
||||
{
|
||||
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > frameTime)
|
||||
{
|
||||
Projectile.frameCounter = 0;
|
||||
Projectile.frame--;
|
||||
}
|
||||
|
||||
if (Projectile.frame == 0)
|
||||
{
|
||||
PlayerStandStillTimer = 0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!CanComePeekOut)
|
||||
{
|
||||
PeekingOut = 0f;
|
||||
|
||||
if (player.velocity.Length() > 0)
|
||||
PlayerStandStillTimer = 0f;
|
||||
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.tileCollide = false;
|
||||
Vector2 desiredPosition = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir;
|
||||
//Round the result so it doesn't jitter.
|
||||
desiredPosition = new Vector2((int)desiredPosition.X, (int)desiredPosition.Y);
|
||||
|
||||
Projectile.rotation += MathHelper.PiOver4 * 0.2f;
|
||||
|
||||
Projectile.Center = Projectile.Center.MoveTowards(desiredPosition, 7f + player.velocity.Length());
|
||||
}
|
||||
|
||||
//Fire a projectile
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
if (FireCooldown > 0f)
|
||||
{
|
||||
FireCooldown --;
|
||||
return;
|
||||
}
|
||||
|
||||
bool foundTarget = false;
|
||||
float maxDist = 300f;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc.CanBeChasedBy(Projectile, false))
|
||||
{
|
||||
if (Vector2.Distance(Projectile.Center, npc.Center) < maxDist && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height))
|
||||
{
|
||||
foundTarget = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundTarget)
|
||||
{
|
||||
int projAmt = Main.rand.Next(3, 7);
|
||||
for (int u = 0; u < projAmt; u++)
|
||||
{
|
||||
Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y);
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
int spore = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, velocity, ModContent.ProjectileType<UrchinSpike>(), Projectile.damage, 1f, Projectile.owner, 0f, 0f);
|
||||
Main.projectile[spore].minion = true;
|
||||
Main.projectile[spore].minionSlots = 0f;
|
||||
Main.projectile[spore].originalDamage = Projectile.originalDamage;
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item42, Projectile.position);
|
||||
FireCooldown = 60f;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Projectile.Center - player.Center).Length() > 400)
|
||||
{
|
||||
DustTimer = 0;
|
||||
Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir;
|
||||
PlayerStandStillTimer = 0f;
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
for (int d = 0; d < 45; d++)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f);
|
||||
dust.velocity *= 2f;
|
||||
dust.scale *= 1.15f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
//Touches the ground
|
||||
if (oldVelocity.Y >= 0)
|
||||
{
|
||||
PeekingOut = 1f;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Rectangle frame = new Rectangle(0, 36 * Projectile.frame, 38, 34);
|
||||
Vector2 origin = !CanComePeekOut ? new Vector2(15, 23) : frame.Size() / 2f;
|
||||
|
||||
//Look at the player
|
||||
SpriteEffects flipperoni = Math.Sign(Projectile.position.X - owner.position.X) > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, flipperoni, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Reference in new issue
Block a user