Added PerforaMini pet

This commit is contained in:
Ozzatron committed 2019-08-04 17:25:31 -04:00
1 parent ba8b0f3797
commit 86a67263d8
9 files changed
+248

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod;
using CalamityMod.NPCs;
namespace CalamityMod.Buffs
{
public class BloodBound : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Blood Bound");
Description.SetDefault("You must be desperate for company");
Main.buffNoTimeDisplay[Type] = true;
Main.vanityPet[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<CalamityPlayer>(mod).perfmini = true;
bool PetProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("PerforaMini")] <= 0;
if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + (player.height / 2), 0f, 0f, mod.ProjectileType("PerforaMini"), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

+2
View File
@@ -98,6 +98,7 @@ namespace CalamityMod
public bool crysthamyr = false;
//Pet
public bool perfmini = false;
public bool akato = false;
public bool leviPet = false;
public bool sirenPet = false;
@@ -769,6 +770,7 @@ namespace CalamityMod
dashMod = 0;
alcoholPoisonLevel = 0;
perfmini = false;
akato = false;
leviPet = false;
sirenPet = false;
+41
View File
@@ -0,0 +1,41 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items;
namespace CalamityMod.Items.Patreon
{
public class BloodyVein : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bloody Vein");
Tooltip.SetDefault("Summons an amalgamated pile of flesh");
}
public override void SetDefaults()
{
item.damage = 0;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.noMelee = true;
item.width = 24;
item.height = 48;
item.value = Item.buyPrice(0, 4, 0, 0);
item.UseSound = SoundID.NPCHit9;
item.shoot = mod.ProjectileType("PerforaMini");
item.buffType = mod.BuffType("BloodBound");
item.rare = 3;
item.GetGlobalItem<CalamityGlobalItem>(mod).postMoonLordRarity = 21;
}
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: 789 B

+1
View File
@@ -52,6 +52,7 @@ namespace CalamityMod.Items.Perforator
// Vanity
DropHelper.DropItemChance(player, mod.ItemType("PerforatorMask"), 7);
DropHelper.DropItemChance(player, mod.ItemType("BloodyVein"), 10);
}
}
}
+1
View File
@@ -313,6 +313,7 @@ namespace CalamityMod.NPCs.Perforator
// Vanity
DropHelper.DropItemChance(npc, mod.ItemType("PerforatorMask"), 7);
DropHelper.DropItemChance(npc, mod.ItemType("BloodyVein"), 10);
}
// If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore
+173
View File
@@ -0,0 +1,173 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using System;
namespace CalamityMod.Projectiles.Patreon
{
public class PerforaMini : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Perforamini");
Main.projFrames[projectile.type] = 8;
Main.projPet[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.netImportant = true;
projectile.width = 32;
projectile.height = 32;
projectile.friendly = true;
projectile.penetrate = -1;
projectile.timeLeft *= 5;
projectile.tileCollide = false;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
Vector2 perfcenter = projectile.Center;
Vector2 vectorperf = player.Center - perfcenter;
float playerdistance = vectorperf.Length();
if (!player.active)
{
projectile.active = false;
return;
}
//Delete the projectile if the player doesnt have the buff or is very far away (dunno if this needs to be deleted)
if (!player.HasBuff(mod.BuffType("BloodBound")) || playerdistance >= 4000f)
{
projectile.Kill();
}
CalamityPlayer modPlayer = player.GetModPlayer<CalamityPlayer>(mod);
if (player.dead)
{
modPlayer.perfmini = false;
}
if (modPlayer.perfmini)
{
projectile.timeLeft = 2;
}
float num16 = 0.5f;
projectile.tileCollide = false;
int num17 = 100;
Vector2 vector3 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f);
float num18 = Main.player[projectile.owner].position.X + (Main.player[projectile.owner].width / 2) - vector3.X;
float num19 = Main.player[projectile.owner].position.Y + (Main.player[projectile.owner].height / 2) - vector3.Y;
num18 += 60 * -(float)Main.player[projectile.owner].direction;
num19 -= 60f;
float num20 = (float)Math.Sqrt(num18 * num18 + num19 * num19);
float num21 = 18f;
if (num20 < num17 && Main.player[projectile.owner].velocity.Y == 0f &&
projectile.position.Y + projectile.height <= Main.player[projectile.owner].position.Y + 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 - (projectile.width / 2);
projectile.position.Y = Main.player[projectile.owner].Center.Y - (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 (projectile.velocity.X >= 0.25)
{
projectile.direction = 1;
}
else if (projectile.velocity.X < -0.25)
{
projectile.direction = -1;
}
//Dust
if (Main.rand.Next(50) == 0)
{
int d1 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1.5f);
int d2 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 170, 0f, 0f, 170, default(Color), 0.5f);
Main.dust[d2].noLight = true;
Main.dust[d1].position = projectile.Center;
Main.dust[d2].position = projectile.Center;
}
//Tilting and change directions
projectile.spriteDirection = projectile.direction;
projectile.rotation = projectile.velocity.X * 0.1f;
//Animation
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 5)
{
projectile.frame = 0;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB