added baby ghost bell light pet
This commit is contained in:
1 parent
1513cba333
commit
818ace0aec
5 files changed
+231
-3
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using CalamityMod.Projectiles.Pets;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Pets
|
||||
{
|
||||
public class BabyGhostBellBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Baby Ghost Bell");
|
||||
Description.SetDefault("Be careful not to pop the bubble");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.lightPet[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
player.Calamity().babyGhostBell = true;
|
||||
bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType<BabyGhostBell>()] <= 0;
|
||||
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, ModContent.ProjectileType<BabyGhostBell>(), 0, 0f, player.whoAmI, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 568 B |
@@ -159,6 +159,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool trashMan = false;
|
||||
public int trashManChest = -1;
|
||||
public bool astrophage = false;
|
||||
public bool babyGhostBell = false;
|
||||
|
||||
// Rage
|
||||
public const int stressMax = 10000;
|
||||
@@ -849,6 +850,7 @@ namespace CalamityMod.CalPlayer
|
||||
kendra = false;
|
||||
trashMan = false;
|
||||
astrophage = false;
|
||||
babyGhostBell = false;
|
||||
onyxExcavator = false;
|
||||
angryDog = false;
|
||||
fab = false;
|
||||
@@ -2928,7 +2930,7 @@ namespace CalamityMod.CalPlayer
|
||||
int breathLoss = 2;
|
||||
int lifeLossAtZeroBreath = 3;
|
||||
int lightStrength = 0 +
|
||||
((player.lightOrb || player.crimsonHeart || player.magicLantern) ? 1 : 0) + //1
|
||||
((player.lightOrb || player.crimsonHeart || player.magicLantern || babyGhostBell) ? 1 : 0) + //1
|
||||
(aquaticEmblem ? 1 : 0) + //2
|
||||
(player.arcticDivingGear ? 1 : 0) + //3
|
||||
(jellyfishNecklace ? 1 : 0) + //4
|
||||
@@ -7396,6 +7398,7 @@ namespace CalamityMod.CalPlayer
|
||||
rareItemList.Add(ModContent.ItemType<RustedJingleBell>());
|
||||
break;
|
||||
}*/
|
||||
rareItemList.Add(ModContent.ItemType<RustedJingleBell>());
|
||||
if (Main.hardMode)
|
||||
{
|
||||
rareItemList.Add(ModContent.ItemType<SerpentsBite>());
|
||||
@@ -7609,11 +7612,11 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
caughtType = ModContent.ItemType<SerpentsBite>();
|
||||
}
|
||||
/*else if (sunkenFish <= 3 && sunkenFish >= 5) //3%
|
||||
else if (sunkenFish <= 3 && sunkenFish >= 5) //3%
|
||||
{
|
||||
caughtType = ModContent.ItemType<RustedJingleBell>();
|
||||
}
|
||||
else if (sunkenFish <= 2 && sunkenFish >= 0) //3%
|
||||
/*else if (sunkenFish <= 2 && sunkenFish >= 0) //3%
|
||||
{
|
||||
caughtType = ModContent.ItemType<SparklingEmpress>();
|
||||
}*/
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using CalamityMod.Buffs.Pets;
|
||||
using CalamityMod.Projectiles.Pets;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Fishing.SunkenSeaCatches
|
||||
{
|
||||
public class RustedJingleBell : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Rusted Jingle Bell");
|
||||
Tooltip.SetDefault("Summons a baby ghost bell light pet\n" +
|
||||
"Provides a good amount of light while underwater");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.CloneDefaults(ItemID.WispinaBottle);
|
||||
item.shoot = ModContent.ProjectileType<BabyGhostBell>();
|
||||
item.buffType = ModContent.BuffType<BabyGhostBellBuff>();
|
||||
item.value = Item.sellPrice(gold: 5);
|
||||
item.rare = 3;
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
|
||||
{
|
||||
player.AddBuff(item.buffType, 3600, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
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.Pets
|
||||
{
|
||||
public class BabyGhostBell : ModProjectile
|
||||
{
|
||||
private bool underwater = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Baby Ghost Bell");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
Main.projPet[projectile.type] = true;
|
||||
ProjectileID.Sets.LightPet[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.netImportant = true;
|
||||
projectile.width = 30;
|
||||
projectile.height = 30;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.timeLeft *= 5;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
if (!player.active)
|
||||
{
|
||||
projectile.active = false;
|
||||
return;
|
||||
}
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.dead)
|
||||
{
|
||||
modPlayer.babyGhostBell = false;
|
||||
}
|
||||
if (modPlayer.babyGhostBell)
|
||||
{
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir);
|
||||
if (underwater)
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0.3f, 0.9f, 1.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0.1f, 0.3f, 0.5f);
|
||||
}
|
||||
float num16 = 0.5f;
|
||||
projectile.tileCollide = false;
|
||||
int num17 = 100;
|
||||
Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X;
|
||||
float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y;
|
||||
num19 += (float)Main.rand.Next(-10, 21);
|
||||
num18 += (float)Main.rand.Next(-10, 21);
|
||||
num18 += (float)(60 * -(float)Main.player[projectile.owner].direction);
|
||||
num19 -= 60f;
|
||||
float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19));
|
||||
float num21 = 18f;
|
||||
if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f &&
|
||||
projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height &&
|
||||
!Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
|
||||
{
|
||||
projectile.ai[0] = 0f;
|
||||
if (projectile.velocity.Y < -6f)
|
||||
{
|
||||
projectile.velocity.Y = -6f;
|
||||
}
|
||||
}
|
||||
if (num20 > 2000f)
|
||||
{
|
||||
projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
|
||||
projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2);
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (num20 < 50f)
|
||||
{
|
||||
if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f)
|
||||
{
|
||||
projectile.velocity *= 0.99f;
|
||||
}
|
||||
num16 = 0.01f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num20 < 100f)
|
||||
{
|
||||
num16 = 0.1f;
|
||||
}
|
||||
if (num20 > 300f)
|
||||
{
|
||||
num16 = 1f;
|
||||
}
|
||||
num20 = num21 / num20;
|
||||
num18 *= num20;
|
||||
num19 *= num20;
|
||||
}
|
||||
if (projectile.velocity.X < num18)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X + num16;
|
||||
if (num16 > 0.05f && projectile.velocity.X < 0f)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X + num16;
|
||||
}
|
||||
}
|
||||
if (projectile.velocity.X > num18)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X - num16;
|
||||
if (num16 > 0.05f && projectile.velocity.X > 0f)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X - num16;
|
||||
}
|
||||
}
|
||||
if (projectile.velocity.Y < num19)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y + num16;
|
||||
if (num16 > 0.05f && projectile.velocity.Y < 0f)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y + num16 * 2f;
|
||||
}
|
||||
}
|
||||
if (projectile.velocity.Y > num19)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y - num16;
|
||||
if (num16 > 0.05f && projectile.velocity.Y > 0f)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y - num16 * 2f;
|
||||
}
|
||||
}
|
||||
if ((double)projectile.velocity.X >= 0.25)
|
||||
{
|
||||
projectile.direction = -1;
|
||||
}
|
||||
else if ((double)projectile.velocity.X < -0.25)
|
||||
{
|
||||
projectile.direction = 1;
|
||||
}
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
projectile.rotation = projectile.velocity.X * 0.05f;
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 6)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame > 3)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user