diff --git a/Buffs/Summon/ScabRipperBuff.cs b/Buffs/Summon/ScabRipperBuff.cs new file mode 100644 index 0000000000..2136bacae3 --- /dev/null +++ b/Buffs/Summon/ScabRipperBuff.cs @@ -0,0 +1,35 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Buffs.Summon +{ + public class ScabRipperBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Baby Blood Crawler"); + Description.SetDefault("The baby blood crawler will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.scabRipper = true; + } + if (!modPlayer.scabRipper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/ScabRipperBuff.png b/Buffs/Summon/ScabRipperBuff.png new file mode 100644 index 0000000000..879c7b54a5 Binary files /dev/null and b/Buffs/Summon/ScabRipperBuff.png differ diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs new file mode 100644 index 0000000000..ab78232363 --- /dev/null +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -0,0 +1,61 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class ScabRipper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scab Ripper"); + Tooltip.SetDefault("Summons a baby blood crawler to protect you"); + } + + public override void SetDefaults() + { + item.damage = 15; + item.mana = 10; + item.width = 66; + item.height = 70; + item.useTime = item.useAnimation = 35; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 0.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item83; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddIngredient(ItemID.TissueSample, 9); + recipe.AddIngredient(ItemID.Shadewood, 20); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/ScabRipper.png b/Items/Weapons/Summon/ScabRipper.png new file mode 100644 index 0000000000..db01a65a8b Binary files /dev/null and b/Items/Weapons/Summon/ScabRipper.png differ diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index aeedb9d39e..4d0f1431e2 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -726,6 +726,7 @@ namespace CalamityMod sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs new file mode 100644 index 0000000000..f5b91bd9d2 --- /dev/null +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -0,0 +1,159 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BabyBloodCrawler : ModProjectile + { + public float dust = 0f; + public int spiderCount = 0; + public bool countedAlready = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baby Blood Crawler"); + Main.projFrames[projectile.type] = 11; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1f; + projectile.aiStyle = 26; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = ProjectileID.VenomSpider; + projectile.tileCollide = false; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + for (int j = 0; j < Main.maxProjectiles; j++) + { + Projectile proj = Main.projectile[j]; + if (proj.active && proj.owner == projectile.owner && proj.type == ModContent.ProjectileType() && proj.Calamity().lineColor == 0) + { + spiderCount += (int)proj.minionSlots; + proj.Calamity().lineColor = 1; + } + } + + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + bool flag64 = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.scabRipper = false; + } + if (modPlayer.scabRipper) + { + projectile.timeLeft = 2; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + //1 spider = 15 frames, 5 spiders, 10 frames + int immuneTime = 16 - spiderCount; + if (immuneTime < 5) + immuneTime = 5; //cap to prevent potential insanity + target.immune[projectile.owner] = immuneTime; + + if (Main.rand.NextBool(2)) + { + for (int n = 0; n < Main.rand.Next(1, 3); n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((float)projectile.damage * Main.rand.NextFloat(0.7f, 1f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.rand.NextBool(2)) + { + for (int n = 0; n < Main.rand.Next(1, 3); n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((float)projectile.damage * Main.rand.NextFloat(0.7f, 1f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Summon/BabyBloodCrawler.png b/Projectiles/Summon/BabyBloodCrawler.png new file mode 100644 index 0000000000..59067ac95f Binary files /dev/null and b/Projectiles/Summon/BabyBloodCrawler.png differ diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs new file mode 100644 index 0000000000..26cbf83ae0 --- /dev/null +++ b/Projectiles/Summon/BloodRain.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BloodRain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Rain"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.aiStyle = 45; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 300; + projectile.alpha = 255; + projectile.scale = 1.1f; + projectile.minion = true; + aiType = ProjectileID.RainFriendly; + } + + public override void AI() + { + int blood = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); + Dust dust = Main.dust[blood]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f; + dust.noGravity = true; + dust.scale = 2f; + dust.noLight = true; + } + } +} diff --git a/Projectiles/Summon/BloodRain.png b/Projectiles/Summon/BloodRain.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/Summon/BloodRain.png differ