diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 68d984728c..e70c6322e5 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -6906,18 +6906,22 @@ namespace CalamityMod.CalPlayer { caughtType = mod.ItemType("AstralCrate"); } - else if (Main.rand.NextBool(10)) + else if (!player.cratePotion && Main.rand.NextBool(10)) { caughtType = mod.ItemType("AstralCrate"); } - else if (Main.rand.NextBool(25)) + else if (Main.rand.NextBool(15)) { caughtType = mod.ItemType("UrsaSergeant"); } - else if (Main.rand.NextBool(25)) + else if (Main.rand.NextBool(15)) { caughtType = mod.ItemType("GacruxianMollusk"); } + else if (Main.rand.NextBool(15)) + { + caughtType = mod.ItemType("PolarisParrotfish"); + } else { caughtType = mod.ItemType("TwinklingPollox"); diff --git a/Items/Fishing/PolarisParrotfish.cs b/Items/Fishing/PolarisParrotfish.cs new file mode 100644 index 0000000000..0162d4768f --- /dev/null +++ b/Items/Fishing/PolarisParrotfish.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing +{ + public class PolarisParrotfish : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polaris Parrotfish"); + Tooltip.SetDefault("It carries the mark of the Northern Star"); + Item.staff[item.type] = true; //so it doesn't look weird af when holding it + } + + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 38; + item.height = 34; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); //pew pew + item.autoReuse = true; + item.shoot = mod.ProjectileType("PolarStar"); + item.shootSpeed = 15f; + } + + public override Vector2? HoldoutOrigin() + { + return new Vector2(10, 10); + } + } +} diff --git a/Items/Weapons/SanguineFlare.cs b/Items/Weapons/SanguineFlare.cs index bb327c7a40..70f5f56f51 100644 --- a/Items/Weapons/SanguineFlare.cs +++ b/Items/Weapons/SanguineFlare.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,6 +35,11 @@ namespace CalamityMod.Items.Weapons item.Calamity().postMoonLordRarity = 13; } + public override Vector2? HoldoutOrigin() + { + return new Vector2(15, 15); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int num6 = Main.rand.Next(6, 9); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index edba6ed3d2..d2a15e9cfb 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -520,7 +520,7 @@ namespace CalamityMod.Projectiles } } } - else if (projectile.type == ProjectileID.FallingStar) + else if (projectile.type == ProjectileID.FallingStar && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == ItemID.StarCannon) projectile.ranged = true; else if (projectile.type == ProjectileID.SoulDrain) projectile.magic = true; diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs new file mode 100644 index 0000000000..16276454cf --- /dev/null +++ b/Projectiles/Ranged/PolarStar.cs @@ -0,0 +1,97 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PolarStar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polar Star"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 40f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 40f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)(int)projectile.localAI[0]; + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Ranged/PolarStar.png b/Projectiles/Ranged/PolarStar.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/Ranged/PolarStar.png differ