From 8ab8a773ccfef45e5f85314fbe686441bcef4d01 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 17 Mar 2020 21:01:17 -0500 Subject: [PATCH] 2 new summons and summon fixes/changes --- Buffs/Summon/MidnightSunBuff.cs | 36 +++ Buffs/Summon/MidnightSunBuff.png | Bin 0 -> 506 bytes Buffs/Summon/TacticalPlagueEngineBuff.cs | 36 +++ Buffs/Summon/TacticalPlagueEngineBuff.png | Bin 0 -> 541 bytes CalPlayer/CalamityPlayer.cs | 4 + ExtraTextures/Lasers/MidnightSunBeamBegin.png | Bin 0 -> 259 bytes ExtraTextures/Lasers/MidnightSunBeamEnd.png | Bin 0 -> 302 bytes ExtraTextures/Lasers/MidnightSunBeamMid.png | Bin 0 -> 165 bytes Items/Fishing/SulphurCatches/AbyssalCrate.cs | 7 + Items/Weapons/Summon/MidnightSunBeacon.cs | 56 +++++ Items/Weapons/Summon/MidnightSunBeacon.png | Bin 0 -> 731 bytes Items/Weapons/Summon/TacticalPlagueEngine.cs | 62 ++++++ Items/Weapons/Summon/TacticalPlagueEngine.png | Bin 0 -> 575 bytes Projectiles/Summon/BelladonnaSpirit.cs | 15 +- Projectiles/Summon/IgneousBlade.cs | 3 + Projectiles/Summon/MK2FlaskSummon.cs | 11 +- Projectiles/Summon/MidnightSunBeaconProj.cs | 61 +++++ Projectiles/Summon/MidnightSunBeaconProj.png | Bin 0 -> 731 bytes Projectiles/Summon/MidnightSunBeam.cs | 209 ++++++++++++++++++ Projectiles/Summon/MidnightSunBeam.png | Bin 0 -> 259 bytes Projectiles/Summon/MidnightSunLaser.cs | 41 ++++ Projectiles/Summon/MidnightSunLaser.png | Bin 0 -> 146 bytes Projectiles/Summon/MidnightSunSkyBeam.cs | 204 +++++++++++++++++ Projectiles/Summon/MidnightSunSkyBeam.png | Bin 0 -> 259 bytes Projectiles/Summon/MidnightSunUFO.cs | 199 +++++++++++++++++ Projectiles/Summon/MidnightSunUFO.png | Bin 0 -> 1083 bytes Projectiles/Summon/PlaguebringerMK2.cs | 13 +- .../Summon/TacticalPlagueEngineSummon.cs | 193 ++++++++++++++++ .../Summon/TacticalPlagueEngineSummon.png | Bin 0 -> 1155 bytes 29 files changed, 1132 insertions(+), 18 deletions(-) create mode 100644 Buffs/Summon/MidnightSunBuff.cs create mode 100644 Buffs/Summon/MidnightSunBuff.png create mode 100644 Buffs/Summon/TacticalPlagueEngineBuff.cs create mode 100644 Buffs/Summon/TacticalPlagueEngineBuff.png create mode 100644 ExtraTextures/Lasers/MidnightSunBeamBegin.png create mode 100644 ExtraTextures/Lasers/MidnightSunBeamEnd.png create mode 100644 ExtraTextures/Lasers/MidnightSunBeamMid.png create mode 100644 Items/Weapons/Summon/MidnightSunBeacon.cs create mode 100644 Items/Weapons/Summon/MidnightSunBeacon.png create mode 100644 Items/Weapons/Summon/TacticalPlagueEngine.cs create mode 100644 Items/Weapons/Summon/TacticalPlagueEngine.png create mode 100644 Projectiles/Summon/MidnightSunBeaconProj.cs create mode 100644 Projectiles/Summon/MidnightSunBeaconProj.png create mode 100644 Projectiles/Summon/MidnightSunBeam.cs create mode 100644 Projectiles/Summon/MidnightSunBeam.png create mode 100644 Projectiles/Summon/MidnightSunLaser.cs create mode 100644 Projectiles/Summon/MidnightSunLaser.png create mode 100644 Projectiles/Summon/MidnightSunSkyBeam.cs create mode 100644 Projectiles/Summon/MidnightSunSkyBeam.png create mode 100644 Projectiles/Summon/MidnightSunUFO.cs create mode 100644 Projectiles/Summon/MidnightSunUFO.png create mode 100644 Projectiles/Summon/TacticalPlagueEngineSummon.cs create mode 100644 Projectiles/Summon/TacticalPlagueEngineSummon.png diff --git a/Buffs/Summon/MidnightSunBuff.cs b/Buffs/Summon/MidnightSunBuff.cs new file mode 100644 index 0000000000..30b0cc66e6 --- /dev/null +++ b/Buffs/Summon/MidnightSunBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class MidnightSunBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Midnight Sun UFO"); + Description.SetDefault("A strange UFO is observing you, and it's making you very uncomfortable"); + 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.midnightUFO = true; + } + if (!modPlayer.midnightUFO) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/MidnightSunBuff.png b/Buffs/Summon/MidnightSunBuff.png new file mode 100644 index 0000000000000000000000000000000000000000..fd2f2637d7a8b5cac95fc0448df5e546cbaa7014 GIT binary patch literal 506 zcmVPx$v`IukR9J=0moZBNK@f$%6D0&9L@*Kr>p;+uBDQw1uu36TDyQSg8PKy7~`(xHCSF>8 zhJ1bz_}&eILkxUIq-s~rZH&4rCeFZ@5*}=?hF;h?j;oET-wpW*QbsAC4fmDMuJ*Xv zu=SyptpL#5D*=XLfSKBrIq;!j49+tk*tu1tid_0}zjOHGKE3r)*l=wYcNkFB3et8P zVnj?R@~uj^i%!oje{}(O7_h%&G}WZ-f|yaY{}=8s5C@wXzhM|rp9{lso;*5^w7bKA z=CuvYb3xkfML9N_Ey940DIVDtXZ6@qz`Dwb@8ZUc4R|wfR wIf=Z$#2N6?2{YAR-n(P{J1#8Ex$$@W0n?|Muk)fs>Hq)$07*qoM6N<$f+PamAOHXW literal 0 HcmV?d00001 diff --git a/Buffs/Summon/TacticalPlagueEngineBuff.cs b/Buffs/Summon/TacticalPlagueEngineBuff.cs new file mode 100644 index 0000000000..365620e246 --- /dev/null +++ b/Buffs/Summon/TacticalPlagueEngineBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class TacticalPlagueEngineBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tactical Plague Engine"); + Description.SetDefault("A giant plague engine is following 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.plagueEngine = true; + } + if (!modPlayer.plagueEngine) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/TacticalPlagueEngineBuff.png b/Buffs/Summon/TacticalPlagueEngineBuff.png new file mode 100644 index 0000000000000000000000000000000000000000..19c105eed09fc6f6aa761c6948c4b714a73a1901 GIT binary patch literal 541 zcmV+&0^Px$*GWV{R9J=OmrE!_Q5eU6S0p6znowkzqHHuvQEWunP}Xc@YoV+ZD`jD;Nl`Yk zu<(tGpTti+euPJ?_;t!jb=G?tJ&0bIc7WXG%WlA3@y1iYl@S|rZL z0$Fz8CZ5y;%ptJ79t9HXJgOXZtN+ufPXH|M+_(;Oe|8Qes^9OKU=9J1I3I}J0WhZs zG+o)}`G9ICxo?izJK)UYt-9mf2}OVBec;WxTGz4<3|kKXj0NoVFV4Rza|lTFOU`xY zaz^OR7c=bk-?ZL=!jo!Y^f`|`sKX$l6)D7ew~07D69Y= fc7FLkzm8u4SAUGon=2&k00000NkvXXu0mjf^`P|z literal 0 HcmV?d00001 diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 4fa0e5e7b0..d8c4fa07d5 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -752,6 +752,8 @@ namespace CalamityMod.CalPlayer public bool belladonaSpirit = false; public bool vileFeeder = false; public bool scabRipper = false; + public bool midnightUFO = false; + public bool plagueEngine = false; // Biome public bool ZoneCalamity = false; @@ -1582,6 +1584,8 @@ namespace CalamityMod.CalPlayer belladonaSpirit = false; vileFeeder = false; scabRipper = false; + midnightUFO = false; + plagueEngine = false; abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; diff --git a/ExtraTextures/Lasers/MidnightSunBeamBegin.png b/ExtraTextures/Lasers/MidnightSunBeamBegin.png new file mode 100644 index 0000000000000000000000000000000000000000..d85e68b29db26fe37b8efadaaf8bf19b0b59ff20 GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^LO{&N!3HFiZux8nQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-8&rgD~Uq{1quc!5N+|jv*HQ$tev@Gai>8_;OYH{J-WG8yJEO za*(D1U4-~NCJPt4wr zB5#xy@E@powVQ(@;1Jt0p%R8-Nu4zf3~!89?c`YQs4#otVb;0*d>P_y1`Zmsij22f z1y7`GcNn{1`ISV`@i-8&rgD~Uq{1quc!NZ;|jv*HQ$tev?hkv#&&}sXxprms^Nn{1`ISV`@i-8&rgD~Uq{1qucK`T!e#}Etu>=(PP;P|`Uda>kK; zwb`7uO%eyH&a2;QwDd`s#FcPG;Sdx%H8e6ZXdh>nd3m7wD9{uJPgg&ebxsLQ0Box< A=Kufz literal 0 HcmV?d00001 diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index e88f901d70..678dacafdc 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Accessories; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables; +using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Potions; using CalamityMod.Tiles.Abyss; using CalamityMod.World; @@ -65,6 +66,12 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); } + // Acid Rain summoner + if (NPC.downedBoss1) + { + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f); + } + // Equipment DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.25f, ModContent.ItemType(), diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs new file mode 100644 index 0000000000..3cf68898f2 --- /dev/null +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -0,0 +1,56 @@ +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class MidnightSunBeacon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Midnight Sun Beacon"); + Tooltip.SetDefault("Summons a UFO to vaporize enemies"); + } + + public override void SetDefaults() + { + item.damage = 330; + item.mana = 12; + item.width = item.height = 32; + item.useTime = item.useAnimation = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.noUseGraphic = true; + item.knockBack = 1f; + item.UseSound = SoundID.Item90; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Violet; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.XenoStaff); + recipe.AddIngredient(ItemID.MoonlordTurretStaff); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/MidnightSunBeacon.png b/Items/Weapons/Summon/MidnightSunBeacon.png new file mode 100644 index 0000000000000000000000000000000000000000..fc4de89b2db21ae917787db7fde8f8192019c506 GIT binary patch literal 731 zcmV<10wn#3P)Px%l}SWFR9J=0mrH0XktpQi@8%X*W1vLLhjilGjso$ zIp;tB+_{1(;cW_QZGUqc0Kxb^0DQu2REl5o`2|2jE(<_IwHw%KxN3+s0J1AT0O%0C z0Icrm0-$ufPkXrWX;LouY0>~#TKgrHs9^(Jg8vlgi6klpEEWppZxMiayJS3aG7Z4R zHl6wD69)l!V43IJ_;mxEs6ZKP-Q3&REC5ooe*p0KRaLCmPV(s3IRLhqZRHUKM=Jop zjSIWA_VBIG2Edu4+W{C$X3UW$Ky$kmXJxM7d-wQxE>plDT0x)pu9sq|EaR4&&Ic*~4mHW?^0GL{q zH=fRjR{%`^%-e3jISOFD{S*_G`@ySk065a!Dga)-oihL~5ANL50@k|E7c<&;-4$@P z1Y{wkmsf#*%vHS~+7-~4k6)2DoQZdm$;6zj8s&E7k^ZjDT{r8lfar-NwA?EfM_XM2 z;Kj!U+nkr>7JyjLCje#^a~pjZIMV~`3Md2va;L9TS&g|h*Bv3Z0QfRrsA@sSDd57) zjk@norHUGJYp$a^d?s^w5?UEmi@GbYej_UT>eW24QLbxcu26Rc{sNxE(?89#3|{~M N002ovPDHLkV1ffsOrih) literal 0 HcmV?d00001 diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs new file mode 100644 index 0000000000..8db3eeba64 --- /dev/null +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -0,0 +1,62 @@ +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class TacticalPlagueEngine : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tactical Plague Engine"); + Tooltip.SetDefault("Summons a plague engine to pummel your enemies into submission\n" + + "Consumes bullets\n" + + "Sometimes shoots a missile instead of a bullet"); + } + + public override void SetDefaults() + { + item.damage = 100; + item.mana = 10; + item.width = 28; + item.height = 20; + item.useTime = item.useAnimation = 15; + item.useStyle = 4; + item.noMelee = true; + item.knockBack = 0.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item14; + item.autoReuse = true; + item.summon = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.png b/Items/Weapons/Summon/TacticalPlagueEngine.png new file mode 100644 index 0000000000000000000000000000000000000000..edb71d485312022bb54911ed48941fbed0b549b9 GIT binary patch literal 575 zcmV-F0>J%=P)Px$`AI}UR7i={mcdFJQ51&15eKoP219Jpq(xMSWMM$EDHNB|mMmH$yVz5Y4X{!y=}o4`l|u1aB%YU!3jpZ4u7Ne-T;;jP_66~9I`tNS z!sZSD$*H(fCr?InP1+{vB=0rsJ1LT~q)7 N002ovPDHLkV1fp94#)ri literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index 0d661a34ad..420581938d 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon projectile.penetrate = -1; projectile.timeLeft *= 5; projectile.minion = true; + projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } @@ -90,7 +91,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 targetPosition = player.Bottom; if (potentialTarget == null) { - projectile.velocity.X = (player.Center.X + player.direction * 75f - projectile.Center.X) / 110f; + projectile.velocity.X = (player.Center.X + player.direction * 75f - projectile.Center.X) / 60f; if (projectile.Distance(player.Center) > 2500f || targetPosition.Y - projectile.Top.Y > 360f) { @@ -99,11 +100,11 @@ namespace CalamityMod.Projectiles.Summon } else if (targetPosition.Y - projectile.Top.Y < -550f) { - projectile.velocity.Y += Math.Sign(targetPosition.Y - targetPosition.Y) * 0.05f; + projectile.velocity.Y += Math.Sign(targetPosition.Y - targetPosition.Y) * 0.08f; } else { - projectile.velocity.Y = (targetPosition.Y - projectile.Center.Y) / 110f; + projectile.velocity.Y = (targetPosition.Y - projectile.Center.Y) / 60f; } } else @@ -168,13 +169,5 @@ namespace CalamityMod.Projectiles.Summon } } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } } } diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index 56c6d78bc1..10c87d0d32 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -159,6 +159,9 @@ namespace CalamityMod.Projectiles.Summon rectangle.Size() / 2f, scale, spriteEffects, 0f); } } + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Rectangle?(rectangle), Color.White, + projectile.rotation, + rectangle.Size() / 2f, 1.35f, spriteEffects, 0f); return false; } return true; diff --git a/Projectiles/Summon/MK2FlaskSummon.cs b/Projectiles/Summon/MK2FlaskSummon.cs index 2bb6eb04f7..3d0ad4db21 100644 --- a/Projectiles/Summon/MK2FlaskSummon.cs +++ b/Projectiles/Summon/MK2FlaskSummon.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Flask"); ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -42,7 +43,15 @@ namespace CalamityMod.Projectiles.Summon } Main.PlaySound(SoundID.Item107, projectile.Center); int idx = Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 6f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); - Main.projectile[idx].ai[1] = CalamityUtils.CountProjectiles(ModContent.ProjectileType()); + int beeArrayIndex = 0; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && Main.projectile[i].type == ModContent.ProjectileType()) + { + Main.projectile[i].ai[1] = beeArrayIndex; + beeArrayIndex++; + } + } } } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/MidnightSunBeaconProj.cs b/Projectiles/Summon/MidnightSunBeaconProj.cs new file mode 100644 index 0000000000..30275b3835 --- /dev/null +++ b/Projectiles/Summon/MidnightSunBeaconProj.cs @@ -0,0 +1,61 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MidnightSunBeaconProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beacon"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 32; + projectile.height = 32; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 420; + } + + public override void AI() + { + projectile.rotation = projectile.rotation.AngleLerp(-MathHelper.PiOver4, 0.03f); + if (Math.Abs(projectile.rotation + MathHelper.PiOver4) < 0.02f && projectile.ai[0] == 0f) + { + for (int i = 1; i <= 4; i++) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 150, 0f, projectile.owner, + projectile.whoAmI, i - 2); + } + projectile.ai[1] = MidnightSunSkyBeam.TrueTimeLeft + 60f; + projectile.ai[0] = 1f; + } + if (projectile.ai[1] == 1f) + { + Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 30f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, + projectile.owner); + projectile.Kill(); + } + if (projectile.ai[1] > 0) + projectile.ai[1]--; + if (projectile.ai[1] > 1f && + projectile.ai[1] <= 60f) + { + projectile.velocity.Y -= 0.4f; + } + else + projectile.velocity *= 0.96f; + } + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/MidnightSunBeaconProj.png b/Projectiles/Summon/MidnightSunBeaconProj.png new file mode 100644 index 0000000000000000000000000000000000000000..fc4de89b2db21ae917787db7fde8f8192019c506 GIT binary patch literal 731 zcmV<10wn#3P)Px%l}SWFR9J=0mrH0XktpQi@8%X*W1vLLhjilGjso$ zIp;tB+_{1(;cW_QZGUqc0Kxb^0DQu2REl5o`2|2jE(<_IwHw%KxN3+s0J1AT0O%0C z0Icrm0-$ufPkXrWX;LouY0>~#TKgrHs9^(Jg8vlgi6klpEEWppZxMiayJS3aG7Z4R zHl6wD69)l!V43IJ_;mxEs6ZKP-Q3&REC5ooe*p0KRaLCmPV(s3IRLhqZRHUKM=Jop zjSIWA_VBIG2Edu4+W{C$X3UW$Ky$kmXJxM7d-wQxE>plDT0x)pu9sq|EaR4&&Ic*~4mHW?^0GL{q zH=fRjR{%`^%-e3jISOFD{S*_G`@ySk065a!Dga)-oihL~5ANL50@k|E7c<&;-4$@P z1Y{wkmsf#*%vHS~+7-~4k6)2DoQZdm$;6zj8s&E7k^ZjDT{r8lfar-NwA?EfM_XM2 z;Kj!U+nkr>7JyjLCje#^a~pjZIMV~`3Md2va;L9TS&g|h*Bv3Z0QfRrsA@sSDd57) zjk@norHUGJYp$a^d?s^w5?UEmi@GbYej_UT>eW24QLbxcu26Rc{sNxE(?89#3|{~M N002ovPDHLkV1ffsOrih) literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/MidnightSunBeam.cs b/Projectiles/Summon/MidnightSunBeam.cs new file mode 100644 index 0000000000..6de9189653 --- /dev/null +++ b/Projectiles/Summon/MidnightSunBeam.cs @@ -0,0 +1,209 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MidnightSunBeam : ModProjectile + { + // How long this laser can exist before it is deleted. + public const int TrueTimeLeft = 120; + + // Pretty self explanatory + private const float maximumLength = 1600f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = TrueTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + // Netcode for sending and receiving shit + // localAI[0] is the timer, localAI[1] is the laser length + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + Projectile body = Main.projectile[(int)projectile.ai[1]]; + if (body.type != ModContent.ProjectileType() || !body.active) + projectile.Kill(); + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + + if (Main.projectile[(int)projectile.ai[1]].active) + { + projectile.Center = Main.projectile[(int)projectile.ai[1]].Center; + } + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + + // How fat the laser is + float laserSize = 1f; + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= TrueTimeLeft) + { + projectile.Kill(); + return; + } + + // Causes the effect where the laser appears to expand/contract at the beginning and end of its life + projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 10f * laserSize; + if (projectile.scale > laserSize) + { + projectile.scale = laserSize; + } + + // The heart of the "sweeping rotation" part of the laser + // Basically converts the velocity to a rotation, increments some value to that rotation, + // and then converts the rotation to a velocity + float velocityAsRotation = body.rotation + MathHelper.PiOver2; + projectile.rotation = velocityAsRotation - MathHelper.PiOver2; + projectile.velocity = velocityAsRotation.ToRotationVector2(); + + Vector2 samplingPoint = projectile.Center; + + float[] samples = new float[3]; + + float determinedLength = 0f; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + for (int i = 0; i < samples.Length; i++) + { + determinedLength += samples[i]; + } + determinedLength /= samples.Length; + + float lerpDelta = 0.5f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); + Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); + for (int i = 0; i < 4; i++) + { + float theta = projectile.velocity.ToRotation() + Main.rand.NextBool(2).ToDirectionInt() * MathHelper.PiOver2; + float speed = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 velocity = theta.ToRotationVector2() * speed; + Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, 185, velocity.X, velocity.Y, 0, default, 1f); + dust.noGravity = true; + dust.scale = 1.7f; + } + + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, 185); + dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(projectile.rotation); + dust.noGravity = true; + dust.scale = 1.2f; + } + + // Draw light blue light across the laser + DelegateMethods.v3_1 = new Vector3(0.52f, 0.93f, 0.97f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamBegin"); + Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamMid"); + Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamEnd"); + float laserLength = projectile.localAI[1]; + Color drawColor = new Color(1f, 1f, 1f) * 0.9f; + + // Laser tail logic + + Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + + // Laser body logic + + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; + Vector2 centerDelta = projectile.Center; + centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + if (laserLength > 0f) + { + float laserLengthDelta = 0f; + Rectangle sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + while (laserLengthDelta + 1f < laserLength) + { + if (laserLength - laserLengthDelta < sourceRectangle.Height) + { + sourceRectangle.Height = (int)(laserLength - laserLengthDelta); + } + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * projectile.scale; + centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + sourceRectangle.Y += 16; + if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) + { + sourceRectangle.Y = 0; + } + } + } + + // Laser head logic + + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float value = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + { + return true; + } + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 300); + } + } +} diff --git a/Projectiles/Summon/MidnightSunBeam.png b/Projectiles/Summon/MidnightSunBeam.png new file mode 100644 index 0000000000000000000000000000000000000000..d85e68b29db26fe37b8efadaaf8bf19b0b59ff20 GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^LO{&N!3HFiZux8nQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-8&rgD~Uq{1quc!5N+|jv*HQ$tev@Gai>8_;OYH{J-WG8yJEO za*(D1U4-~NCJPt4wr zB5#xy@E@powVQ(@;1Jt0p%R8-Nu4zf3~!89?c`YQs4#otVb;0*d>P_y1`Zmsij22f z1y7`Gck44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`0h7I;J!GcfQS24TkI`72U@g6f_wjv*4^$tH8^I~p4sIXfB~KK}pzpF_^B mYvbR)yb8K%?Ek6X*!r() || !body.active) + projectile.Kill(); + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + + if (body.active) + { + float angleVarianceRatio = projectile.localAI[0] / TrueTimeLeft; + float angleVariance = MathHelper.TwoPi * (projectile.ai[1] - 2f) / 2f * angleVarianceRatio * 1.25f; + float xDelta = 45f * (float)Math.Sin(angleVariance) * angleVarianceRatio; + projectile.Center = body.Center - new Vector2(xDelta, maximumLength / 2f); + } + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + + // How fat the laser is + float laserSize = 1f; + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= TrueTimeLeft) + { + projectile.Kill(); + return; + } + + // Causes the effect where the laser appears to expand/contract at the beginning and end of its life + projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 10f * laserSize; + if (projectile.scale > laserSize) + { + projectile.scale = laserSize; + } + + projectile.rotation = 0f; + projectile.velocity = Vector2.UnitY; + + Vector2 samplingPoint = projectile.Center; + + float[] samples = new float[3]; + + float determinedLength = 0f; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + for (int i = 0; i < samples.Length; i++) + { + determinedLength += samples[i]; + } + determinedLength /= samples.Length; + + float lerpDelta = 0.5f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); + Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); + for (int i = 0; i < 4; i++) + { + float theta = projectile.velocity.ToRotation() + Main.rand.NextBool(2).ToDirectionInt() * MathHelper.PiOver2; + float speed = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 velocity = theta.ToRotationVector2() * speed; + Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, 185, velocity.X, velocity.Y, 0, default, 1f); + dust.noGravity = true; + dust.scale = 1.7f; + } + + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, 185); + dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(projectile.rotation); + dust.noGravity = true; + dust.scale = 1.2f; + } + + // Draw light blue light across the laser + DelegateMethods.v3_1 = new Vector3(0.52f, 0.93f, 0.97f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamBegin"); + Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamMid"); + Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamEnd"); + float laserLength = projectile.localAI[1]; + Color drawColor = new Color(1f, 1f, 1f) * 0.9f; + + // Laser tail logic + + Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + + // Laser body logic + + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; + Vector2 centerDelta = projectile.Center; + centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + if (laserLength > 0f) + { + float laserLengthDelta = 0f; + Rectangle sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + while (laserLengthDelta + 1f < laserLength) + { + if (laserLength - laserLengthDelta < sourceRectangle.Height) + { + sourceRectangle.Height = (int)(laserLength - laserLengthDelta); + } + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * projectile.scale; + centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + sourceRectangle.Y += 16; + if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) + { + sourceRectangle.Y = 0; + } + } + } + + // Laser head logic + + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float value = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + { + return true; + } + return false; + } + } +} diff --git a/Projectiles/Summon/MidnightSunSkyBeam.png b/Projectiles/Summon/MidnightSunSkyBeam.png new file mode 100644 index 0000000000000000000000000000000000000000..d85e68b29db26fe37b8efadaaf8bf19b0b59ff20 GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^LO{&N!3HFiZux8nQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-8&rgD~Uq{1quc!5N+|jv*HQ$tev@Gai>8_;OYH{J-WG8yJEO za*(D1U4-~NCJPt4wr zB5#xy@E@powVQ(@;1Jt0p%R8-Nu4zf3~!89?c`YQs4#otVb;0*d>P_y1`Zmsij22f z1y7`Gc(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.midnightUFO = false; + } + if (modPlayer.midnightUFO) + { + projectile.timeLeft = 2; + } + } + + NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + if (potentialTarget != null) + { + if (projectile.ai[0]++ % 360 < 180) + { + projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); + if (projectile.ai[1] != 0f) + { + projectile.ai[1] = 0f; + } + float angle = MathHelper.ToRadians(2f * projectile.ai[0] % 180f); + Vector2 destination = potentialTarget.Center - new Vector2((float)Math.Cos(angle) * potentialTarget.width * 0.65f, 250f); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.DirectionTo(destination) * 24f, 0.03f); + if (projectile.ai[0] % 3f == 2f && potentialTarget.Top.Y > projectile.Bottom.Y) + { + Projectile.NewProjectile(projectile.Bottom, projectile.DirectionTo(potentialTarget.Center).RotatedByRandom(0.15f) * 25f, + ModContent.ProjectileType(), + projectile.damage, projectile.knockBack, projectile.owner); + } + float acceleration = 0.35f; + for (int index = 0; index < Main.projectile.Length; index++) + { + Projectile proj = Main.projectile[index]; + if (index != projectile.whoAmI && proj.active && proj.owner == projectile.owner && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= acceleration; + } + else + { + projectile.velocity.X += acceleration; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= acceleration; + } + else + { + projectile.velocity.Y += acceleration; + } + } + } + } + else + { + const float framesUsedSpinning = MidnightSunBeam.TrueTimeLeft; + float totalRadiansToSpin = MathHelper.ToRadians(120f); + float totalRadiansNegativeRange = totalRadiansToSpin - (totalRadiansToSpin / 2); + float radiansToSpinPerFrame = totalRadiansNegativeRange / framesUsedSpinning * 2f; + if (projectile.ai[0] % 180 < 180 - framesUsedSpinning) + { + projectile.rotation = projectile.rotation.AngleLerp(projectile.AngleTo(potentialTarget.Center) - MathHelper.PiOver2 - totalRadiansNegativeRange, 0.15f); + + Vector2 spawnPosition = projectile.Center + Utils.NextVector2Unit(Main.rand).RotatedBy(projectile.rotation) * new Vector2(13f, 6f) / 2f; + int idx = Dust.NewDust(spawnPosition - Vector2.One * 8f, 16, 16, 229, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 0, default, 1f); + Main.dust[idx].velocity = Vector2.Normalize(projectile.Center - spawnPosition) * 2.6f; + Main.dust[idx].noGravity = true; + Main.dust[idx].scale = 0.9f; + } + else + { + projectile.rotation += radiansToSpinPerFrame; + if (projectile.ai[1] == 0f) + { + Main.PlaySound(SoundID.Item122, projectile.Center); + Projectile.NewProjectile(projectile.Center, (projectile.velocity.ToRotation() + MathHelper.PiOver2).ToRotationVector2(), + ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, + radiansToSpinPerFrame, projectile.whoAmI); + projectile.ai[1] = 1f; + } + } + projectile.velocity *= 0.935f; + } + } + else + { + projectile.velocity = (projectile.velocity * 15f + projectile.DirectionTo(player.Center - new Vector2(player.direction * -80f, 160f)) * 19f) / 16f; + + float acceleration = 0.35f; + for (int index = 0; index < Main.projectile.Length; index++) + { + Projectile proj = Main.projectile[index]; + if (index != projectile.whoAmI && proj.active && proj.owner == projectile.owner && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= acceleration; + } + else + { + projectile.velocity.X += acceleration; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= acceleration; + } + else + { + projectile.velocity.Y += acceleration; + } + } + } + projectile.rotation = projectile.velocity.X * 0.03f; + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Summon/MidnightSunUFO.png b/Projectiles/Summon/MidnightSunUFO.png new file mode 100644 index 0000000000000000000000000000000000000000..5b51bfecdada05f85fd06e75d602be8ca7d900ce GIT binary patch literal 1083 zcmeAS@N?(olHy`uVBq!ia0vp^YCzn;!3HGLE2LwA6k~CayA#8@b22X(7?{6$x;TbZ z%y~Q8KO-buq<#PLpXXJwE*+V%L`|i+e$xe$s0$ZD7e?)xu;77Hz!BHNEw1O%(j>KE_pS@8Bn_gBy;e!K9y#K++_=;2*wMMG@4c2*XJ2&Y#^<%q z=9NF+`((QH^Sj?Catd6!yjQqE{Gu7dv*Yc?`Evbtf51#z z>o@Sb8r<&OImzq&O;M}*jPGI$S+l}f82p8{H{4VY-_!ZjJ1hJBbA~xq#WySCU$$y9 z@XWL0aY!!?WiXiG!T58s_P-+y>N6JFENH z?qqjxJ$tEqoZXc{yMRGVZ7svkK^;KSmH-EH*tlqoS3pEro zFZSEJaNSMG+fRO(g)y)H9eYqM?2-7c=y}Wqc@K64+gCrD{bse=^16cm@(ew;Rj;mW zuieSfu|0DEV=V#?XHfWy~iiNyimRDs9M(KjU}eDp7_Pp z@a&np#Xok5(TO;Ijkde3@f%LIPGGdyu=A|ux8rA)pMRfR#v64nB75QPw0iewo6es% zSgdESW{~h%V#IKZm+gAR@ZjJM&utms|7@-k+J5qC*c9dq^L#&?ntOcV z{CitvyO|nx-`rf%UoR3$w>})=BW=6_CZ(oL@)5)4Qj@-M||J3=_ z@c{c}bvpd7j@w-6_YAaGbNxF* 10f) { diff --git a/Projectiles/Summon/TacticalPlagueEngineSummon.cs b/Projectiles/Summon/TacticalPlagueEngineSummon.cs new file mode 100644 index 0000000000..154eb578ce --- /dev/null +++ b/Projectiles/Summon/TacticalPlagueEngineSummon.cs @@ -0,0 +1,193 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class TacticalPlagueEngineSummon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tactical Plague Engine"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 32; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 9; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + for (int i = 0; i < 45; i++) + { + float angle = MathHelper.TwoPi / 45f * i; + Vector2 velocity = angle.ToRotationVector2() * 4f; + Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2f, (int)CalamityDusts.Plague, velocity); + dust.noGravity = true; + } + projectile.localAI[0] = 1f; + } + if (projectile.frameCounter++ > 6f) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + modPlayer.plagueEngine = false; + } + if (modPlayer.plagueEngine) + { + projectile.timeLeft = 2; + } + } + NPC potentialTarget = projectile.Center.MinionHoming(1560f, player); + + Item exampleGun = new Item() + { + useAmmo = AmmoID.Bullet + }; + + if (potentialTarget == null || !player.HasAmmo(exampleGun, false)) + { + float acceleration = 0.1f; + Vector2 distanceVector = player.Center - projectile.Center; + if (distanceVector.Length() < 200f) + { + acceleration = 0.07f; + } + if (distanceVector.Length() < 140f) + { + acceleration = 0.035f; + } + if (distanceVector.Length() > 100f) + { + if (Math.Abs(player.Center.X - projectile.Center.X) > 20f) + { + projectile.velocity.X += acceleration * Math.Sign(player.Center.X - projectile.Center.X); + } + if (Math.Abs(player.Center.Y - projectile.Center.Y) > 10f) + { + projectile.velocity.Y += acceleration * Math.Sign(player.Center.Y - projectile.Center.Y); + } + } + else if (projectile.velocity.Length() > 4f) + { + projectile.velocity *= 0.95f; + } + if (Math.Abs(projectile.velocity.Y) < 2f) + { + projectile.velocity.Y += 0.1f * Math.Sign(player.Center.Y - projectile.Center.Y); + } + if (projectile.velocity.Length() > 9f) + { + projectile.velocity = Vector2.Normalize(projectile.velocity) * 9f; + } + + if (projectile.velocity.X > 0.25f) + { + projectile.spriteDirection = 1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = -1; + } + projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); + } + else + { + projectile.spriteDirection = 1; + Vector2 idealVelocity = projectile.DirectionTo(potentialTarget.Center - Vector2.UnitY * 195f) * 17f; + projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, 0.035f); + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center), 0.1f); + + if (projectile.ai[0]++ % 25f == 24f) + { + int damage = projectile.damage; + if (Main.rand.NextBool(20)) + { + int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), + damage, 5f, projectile.owner); + Main.projectile[idx].Calamity().forceMinion = true; + } + else + { + int shoot = 0; + float shootSpeed = 0f; + bool canShoot = true; + float knockBack = projectile.knockBack * 0.5f; + player.PickAmmo(exampleGun, ref shoot, ref shootSpeed, ref canShoot, ref damage, ref knockBack); + int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, shoot, + damage, knockBack, projectile.owner); + Main.projectile[idx].Calamity().forceMinion = true; + } + } + float SAImovement = 0.25f; + for (int index = 0; index < Main.projectile.Length; index++) + { + Projectile proj = Main.projectile[index]; + if (index != projectile.whoAmI && + proj.active && proj.owner == projectile.owner && + proj.type == projectile.type && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= SAImovement; + } + else + { + projectile.velocity.X += SAImovement; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= SAImovement; + } + else + { + projectile.velocity.Y += SAImovement; + } + } + } + } + } + } +} diff --git a/Projectiles/Summon/TacticalPlagueEngineSummon.png b/Projectiles/Summon/TacticalPlagueEngineSummon.png new file mode 100644 index 0000000000000000000000000000000000000000..9dc69c1a3e7f9fe4f761f38b55f9d0311739fb4d GIT binary patch literal 1155 zcmV-}1bq96P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1Q~j6Z~wX|-{YwJB&7K@qfV*}hHdHqj=Cf)*_#S`-8kLC~rsT!cc4 zz>qQ~5rrX5G<9@lbacj_?A&+6cbw~c_q};97|*vk_l|#e-p4ubzI#T$&tt-oR(<5# z)}w*g(KxJW?$<2LSF$q@trE~<+2FaM`i2gOg+d+-UAl1@=E%V7j}WUP8mujs&A{BM zDK@0ao}2+1q77nD2!Ns9E4?s962nP|)8k_hu;$gZJj@X^#)gn*ZRa3%MS~ELCrf`I z_Ah3N8o???s~hGHLQNsmm=>;v_mEl1!Tj(Uq9!6iaSgO4F(3S%1`}6LX)y0gEyC}7 zJU$Dr-@1S2U)bfm$L#co?EA$Iw*y8A1aTnj7Qu;?9mHkhY6aeI)oj zI1jP=O9G;-nyt=>@1rK}`9&_^>-6uv|0#A3Z%#BqM9@@O8p3Ks^Qov2gqop59t}aH zIfRDH7`q;Wh{h>5H;(8dL0KEphek@3L+8)*K&sv4 z@w~K_7tc#<$PD^CR2va{uyl5%s4-gouH{74LSE*x`bZGgYGKWr`2x(>)b8nnBo*Q_OOR`$GiJ4RL=+5!VgTs>b~xMM`dH zpAqg4Im5Og*?HcJRq?DpvXLulg!@B^NDax(6r{gs=1^X5e-1 z4>@Gt*>;Oo39%_AuEdWCaav<`rcJ@_gRGiyf5;+x4HRnGRZ0tq z_qbyMB7(Wo6%84x6++Ltxj$4QcK?5fR;e9mejS)QGDF-Sa)|3W#Qh)4d$`hiqcm5XI{A&}5akX51gLiETqx;r@_ATsK7F{*WS`8{+;DQ&#wVe*v=g V6lA8FvWNfx002ovPDHLkV1hef6@35z literal 0 HcmV?d00001