but where's the pizza
This commit is contained in:
1 parent
f2744b1033
commit
454db525da
8 files changed
+199
No files matched your search
@@ -0,0 +1,29 @@
|
||||
using CalamityMod.Projectiles.Pets;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Pets
|
||||
{
|
||||
public class PineappleBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Pineapple");
|
||||
Description.SetDefault("It smells like pizza...");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.vanityPet[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
player.Calamity().pineapplePet = true;
|
||||
bool PetProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType<PineapplePetProj>()] <= 0;
|
||||
if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType<PineapplePetProj>(), 0, 0f, player.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 647 B |
@@ -355,6 +355,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool hiveMindPet = false;
|
||||
public bool bendyPet = false;
|
||||
public bool littleLightPet = false;
|
||||
public bool pineapplePet = false;
|
||||
#endregion
|
||||
|
||||
#region Rage
|
||||
@@ -1505,6 +1506,7 @@ namespace CalamityMod.CalPlayer
|
||||
hiveMindPet = false;
|
||||
bendyPet = false;
|
||||
littleLightPet = false;
|
||||
pineapplePet = false;
|
||||
|
||||
onyxExcavator = false;
|
||||
angryDog = false;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using CalamityMod.Buffs.Pets;
|
||||
using CalamityMod.Projectiles.Pets;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Pets
|
||||
{
|
||||
public class PineapplePet : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Pineapple");
|
||||
Tooltip.SetDefault("Summons a pineapple");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 0;
|
||||
item.useTime = item.useAnimation = 20;
|
||||
item.shoot = ModContent.ProjectileType<PineapplePetProj>();
|
||||
item.buffType = ModContent.BuffType<PineappleBuff>();
|
||||
|
||||
item.width = 32;
|
||||
item.height = 34;
|
||||
item.useStyle = ItemUseStyleID.SwingThrow;
|
||||
item.noMelee = true;
|
||||
item.UseSound = SoundID.Item2;
|
||||
|
||||
item.value = Item.buyPrice(gold: 4);
|
||||
item.rare = ItemRarityID.Orange;
|
||||
item.Calamity().donorItem = true;
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
|
||||
{
|
||||
player.AddBuff(item.buffType, 3600, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 798 B |
@@ -1086,6 +1086,11 @@ namespace CalamityMod.NPCs
|
||||
DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f);
|
||||
break;
|
||||
|
||||
case NPCID.Goldfish:
|
||||
case NPCID.GoldfishWalker:
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<PineapplePet>(), 0.002f);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Pets
|
||||
{
|
||||
public class PineapplePetProj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Pineapple");
|
||||
Main.projFrames[projectile.type] = 5;
|
||||
Main.projPet[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];
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (!player.active)
|
||||
{
|
||||
projectile.active = false;
|
||||
return;
|
||||
}
|
||||
if (player.dead)
|
||||
{
|
||||
modPlayer.pineapplePet = false;
|
||||
}
|
||||
if (modPlayer.pineapplePet)
|
||||
{
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 6)
|
||||
{
|
||||
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
|
||||
float passiveMvtFloat = 0.1f;
|
||||
projectile.tileCollide = false;
|
||||
float range = 200f;
|
||||
float xDist = player.Center.X - projectile.Center.X - 2f;
|
||||
float yDist = player.Center.Y - projectile.Center.Y - 60f;
|
||||
Vector2 playerVector = new Vector2(xDist, yDist);
|
||||
float playerDist = playerVector.Length();
|
||||
float returnSpeed = 7f;
|
||||
if (playerDist < range && player.velocity.Y == 0f && (projectile.position.Y + projectile.height <= player.position.Y + player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)))
|
||||
{
|
||||
projectile.ai[0] = 0f;
|
||||
if (projectile.velocity.Y < -6f)
|
||||
projectile.velocity.Y = -6f;
|
||||
}
|
||||
|
||||
//Teleport to player if too far
|
||||
if (playerDist > 2000f)
|
||||
{
|
||||
projectile.position.X = player.Center.X - projectile.width / 2;
|
||||
projectile.position.Y = player.Center.Y - projectile.height / 2;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
if (playerDist < 4f)
|
||||
{
|
||||
projectile.velocity.X = xDist;
|
||||
projectile.velocity.Y = yDist;
|
||||
passiveMvtFloat = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playerDist > 350f)
|
||||
{
|
||||
passiveMvtFloat = 0.2f;
|
||||
returnSpeed = 12f;
|
||||
}
|
||||
float speedMult = returnSpeed / playerDist;
|
||||
xDist *= speedMult;
|
||||
yDist *= speedMult;
|
||||
}
|
||||
if (projectile.velocity.X < xDist)
|
||||
{
|
||||
projectile.velocity.X += passiveMvtFloat;
|
||||
if (projectile.velocity.X < 0f)
|
||||
projectile.velocity.X += passiveMvtFloat;
|
||||
}
|
||||
if (projectile.velocity.X > xDist)
|
||||
{
|
||||
projectile.velocity.X -= passiveMvtFloat;
|
||||
if (projectile.velocity.X > 0f)
|
||||
projectile.velocity.X -= passiveMvtFloat;
|
||||
}
|
||||
if (projectile.velocity.Y < yDist)
|
||||
{
|
||||
projectile.velocity.Y += passiveMvtFloat;
|
||||
if (projectile.velocity.Y < 0f)
|
||||
projectile.velocity.Y += passiveMvtFloat;
|
||||
}
|
||||
if (projectile.velocity.Y > yDist)
|
||||
{
|
||||
projectile.velocity.Y -= passiveMvtFloat;
|
||||
if (projectile.velocity.Y > 0f)
|
||||
projectile.velocity.Y -= passiveMvtFloat;
|
||||
}
|
||||
projectile.direction = -player.direction;
|
||||
projectile.spriteDirection = 1;
|
||||
projectile.rotation = projectile.velocity.Y * 0.05f * -projectile.direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in new issue
Block a user