From befe0f2e4697b0a73f5ee85a12865346085e4a6b Mon Sep 17 00:00:00 2001 From: GinYuH Date: Fri, 2 Jun 2023 03:13:01 -0700 Subject: [PATCH] Added King of Constellations, Tenryu --- Buffs/Summon/KingofConstellationsBuff.cs | 35 ++++ Buffs/Summon/KingofConstellationsBuff.png | Bin 0 -> 809 bytes CalPlayer/CalamityPlayer.cs | 2 + .../Summon/KingofConstellationsTenryu.cs | 108 +++++++++++++ .../Summon/KingofConstellationsTenryu.png | Bin 0 -> 1372 bytes .../en-US/Mods.CalamityMod.Buffs.hjson | 5 + ...ods.CalamityMod.Items.Weapons.Summon.hjson | 9 ++ .../Mods.CalamityMod.Projectiles.Summon.hjson | 6 + ModSupport/WeakReferenceSupport.cs | 1 + Projectiles/Summon/BlackDragonBody.cs | 123 ++++++++++++++ Projectiles/Summon/BlackDragonBody.png | Bin 0 -> 601 bytes Projectiles/Summon/BlackDragonBody2.png | Bin 0 -> 844 bytes Projectiles/Summon/BlackDragonHead.cs | 151 ++++++++++++++++++ Projectiles/Summon/BlackDragonHead.png | Bin 0 -> 2683 bytes Projectiles/Summon/BlackDragonTail.cs | 111 +++++++++++++ Projectiles/Summon/BlackDragonTail.png | Bin 0 -> 582 bytes Projectiles/Summon/BlackDragonTail2.png | Bin 0 -> 1064 bytes Projectiles/Summon/WhiteDragonBody.cs | 120 ++++++++++++++ Projectiles/Summon/WhiteDragonBody.png | Bin 0 -> 591 bytes Projectiles/Summon/WhiteDragonBody2.png | Bin 0 -> 927 bytes Projectiles/Summon/WhiteDragonHead.cs | 150 +++++++++++++++++ Projectiles/Summon/WhiteDragonHead.png | Bin 0 -> 2291 bytes Projectiles/Summon/WhiteDragonTail.cs | 112 +++++++++++++ Projectiles/Summon/WhiteDragonTail.png | Bin 0 -> 598 bytes Projectiles/Summon/WhiteDragonTail2.png | Bin 0 -> 953 bytes 25 files changed, 933 insertions(+) create mode 100644 Buffs/Summon/KingofConstellationsBuff.cs create mode 100644 Buffs/Summon/KingofConstellationsBuff.png create mode 100644 Items/Weapons/Summon/KingofConstellationsTenryu.cs create mode 100644 Items/Weapons/Summon/KingofConstellationsTenryu.png create mode 100644 Projectiles/Summon/BlackDragonBody.cs create mode 100644 Projectiles/Summon/BlackDragonBody.png create mode 100644 Projectiles/Summon/BlackDragonBody2.png create mode 100644 Projectiles/Summon/BlackDragonHead.cs create mode 100644 Projectiles/Summon/BlackDragonHead.png create mode 100644 Projectiles/Summon/BlackDragonTail.cs create mode 100644 Projectiles/Summon/BlackDragonTail.png create mode 100644 Projectiles/Summon/BlackDragonTail2.png create mode 100644 Projectiles/Summon/WhiteDragonBody.cs create mode 100644 Projectiles/Summon/WhiteDragonBody.png create mode 100644 Projectiles/Summon/WhiteDragonBody2.png create mode 100644 Projectiles/Summon/WhiteDragonHead.cs create mode 100644 Projectiles/Summon/WhiteDragonHead.png create mode 100644 Projectiles/Summon/WhiteDragonTail.cs create mode 100644 Projectiles/Summon/WhiteDragonTail.png create mode 100644 Projectiles/Summon/WhiteDragonTail2.png diff --git a/Buffs/Summon/KingofConstellationsBuff.cs b/Buffs/Summon/KingofConstellationsBuff.cs new file mode 100644 index 0000000000..bb837dd790 --- /dev/null +++ b/Buffs/Summon/KingofConstellationsBuff.cs @@ -0,0 +1,35 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class KingofConstellationsBuff : ModBuff + { + public override void SetStaticDefaults() + { + 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 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.celestialDragons = true; + } + if (!modPlayer.celestialDragons) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/KingofConstellationsBuff.png b/Buffs/Summon/KingofConstellationsBuff.png new file mode 100644 index 0000000000000000000000000000000000000000..2cfd99f961ef008a41daee857742d79f719c98b3 GIT binary patch literal 809 zcmV+^1J?YBP)~DMz^v_-cgOk@m`@#ZJz(7rS2$9ckdLl989*!K3bsa^8 zft3&NzhoBjy~M; zdM}tB-3AWd)(u)FgU2A!#K20pbmkn`vSn*zZ@zYMS^uE=>c|5M>n|q{i3C!_K&S)b zUw(m#7RC#IfnB?HfJ;+TV8hS|sJ+|>4!!&uc&;^3`}$?I zxe`|6R6_%3&*wo$M+bOx`(u&c3;Pd7^RwS3>OOJ!6v$;0=FTphj{Ihd34?3SKv@IT z`5z(=7#J8pMFXt|o{!!i|L9Zj`DclStWSoo)-^?bAC%_x#l1)q0|Cucr*=OL^7%saKL5i{;Og+z z$R2t@Y8Y733yOV74KHWI*hsV>^n_3mUwr8hm@fQ@iWV;X_%qm>Jpjgv=aIr*u;fgb zEzJk}dY1DqSH!?ThCw<97TXZb9;MMmaIn00000NkvXXu0mjfHMM-X literal 0 HcmV?d00001 diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index be4dd39b27..b0c8396301 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -971,6 +971,7 @@ namespace CalamityMod.CalPlayer public bool perditionBeacon = false; public bool MoonFist = false; public bool AresCannons = false; + public bool celestialDragons = false; public List PendingProjectilesToRespawn = new List(); @@ -2001,6 +2002,7 @@ namespace CalamityMod.CalPlayer perditionBeacon = false; MoonFist = false; AresCannons = false; + celestialDragons = false; disableVoodooSpawns = false; disablePerfCystSpawns = false; diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs new file mode 100644 index 0000000000..744530806a --- /dev/null +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -0,0 +1,108 @@ +using Terraria.DataStructures; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class KingofConstellationsTenryu : ModItem, ILocalizedModType + { + public string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetDefaults() + { + Item.mana = 10; + Item.damage = 213; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.width = 44; + Item.height = 62; + Item.UseSound = NPCs.Yharon.Yharon.HitSound; + Item.useAnimation = Item.useTime = 25; + + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + + Item.noMelee = true; + Item.knockBack = 2f; + Item.DamageType = DamageClass.Summon; + Item.autoReuse = true; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 4; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Vector2 spawnPos = new Vector2(player.position.X + 200, player.position.Y - 200); + Vector2 spawnPos2 = new Vector2(player.position.X - 200, player.position.Y - 200); + SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos2, player, source, damage, knockback); + SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos, player, source, damage, knockback); + return false; + } + + public static void SpawnDragon(int head, int body, int tail, Vector2 spawnPos, Player player, EntitySource_ItemUse_WithAmmo source, int damage, float knockback) + { + bool Exists = false; + int tailID = 0; + foreach (var projectile in Main.projectile) + { + if (projectile.type == head && projectile.owner == player.whoAmI && projectile.active) + { + Exists = true; + } + + if (projectile.type == tail && projectile.owner == player.whoAmI && projectile.active) + { + tailID = projectile.whoAmI; + } + } + float foundSlotsCount = 0f; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.minion && p.owner == player.whoAmI) + { + foundSlotsCount += p.minionSlots; + } + } + if (Exists) + { + if (!(foundSlotsCount + 0.5f > (float)player.maxMinions)) + { + //Projectile.NewProjectile(source, Main.projectile[tailID].Center, Vector2.Zero, body, damage, knockback, player.whoAmI); + } + } + else + { + if (!(foundSlotsCount + 1f > (float)player.maxMinions)) + { + Projectile.NewProjectile(source, spawnPos, player.DirectionTo(Main.MouseWorld) * 3, head, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, tail, damage, knockback, player.whoAmI); + for (var i = 0; i < 20; i++) + { + Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, body, damage, knockback, player.whoAmI); + } + } + } + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.StardustDragonStaff). + AddIngredient(ItemID.LightShard). + AddIngredient(ItemID.DarkShard). + AddIngredient(ModContent.ItemType(), 7). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} + diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.png b/Items/Weapons/Summon/KingofConstellationsTenryu.png new file mode 100644 index 0000000000000000000000000000000000000000..a6dbe8424d256dedc4a8680aeb5bc90481246aab GIT binary patch literal 1372 zcmV-i1*7_jP)A8#YV-1;9Ar~qdu6%MT3_ZK&ybk2QL`FQ~^y@ zj2J=!}d&PcDENyX8pg+oXea! z``a)7a~l`eNpn*2E%RsHmma=0G_2wn%sDMTH|y7k9XnLhqos#}J$hfV z74697d*)d-e4*u1#1|`)b}|#jsV*_iOt#_ZpGJ`oR{ofqH47L&S#wMdBzpkxEL{!2 zmQBxCw)51(cUtBlj@PO>N9*gfw0TZpmh%YL zp8p+yT}TYCESU|!x*e;GDss)7{UHE3cRT^u`?6Werw{Cx*;j94uU4M6JWbj&{2p}T zW;u`Wy(=)GpzSl@YszxH1N z;FiqkE`Xf5GeQ7g9lH#`;ZyZMIM&QDs8q%`TDmzn9RPnqF#y$R8v%H2*!sU|8#t|{ zo7$2r>p73Gx=BseE&0BC<{Ec0(y3ThZlPkjcD@j+>yp}v?Cy~K6PsM}&pg`uE)bn` zG&z@W-{1%UXMYkh%Afaal(pT(0qjaQbnZCkM?`b%3LCbe8 z;r4DJVRnndr{tG*46BhyUz=q<_5c9hgI`KUSHD*7ou3FmMOSPcQX}J$6*BuHjpq3_xMI#NO#wg!JP^?QVnk=F8#=)oFJDa4a~Yzi(0f zxH{~7!qMD9DUc{Di?`h602G$L4?tc@p;1G~ZgcBo{r{Yd*rB1O8oBXo(DIWK#C4oc zI99hJ?-v!%SwvrVzHe7) zX*1c%hERK@UT`zF_c>17`SFuc&% z=P(H0=9jIdpl34>_T%^`Y&YT&{5huQ2a2svr>^CH5&8M}C7hF8sJVsOTQi>y6%UG! z*3HZTpo;GS@V)e^6q+w0ytvj&RH|JW7_Q``()tYU#S)Iw$iETRD#KM85ek z6AM9jggTilJ3^xfPpKS7c*;9mJUDo5K5;$dIKmVDZq2M^J7?(`k&lcgEXNU^3XhET e?d1R4hyMj@_t0K(), BuffType(), new List() { ProjectileType(), ProjectileType(), ProjectileType()}, new List() {1-(1f/3f), 2f/3f, 2f/3f}); //Entropy's Vigil is a bruh moment sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType()}); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType() }); } } } diff --git a/Projectiles/Summon/BlackDragonBody.cs b/Projectiles/Summon/BlackDragonBody.cs new file mode 100644 index 0000000000..e20652e28a --- /dev/null +++ b/Projectiles/Summon/BlackDragonBody.cs @@ -0,0 +1,123 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BlackDragonBody : ModProjectile, ILocalizedModType + { + public string LocalizationCategory => "Projectiles.Summon"; + public int segmentIndex = 1; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = false; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + + public override void SetDefaults() + { + Projectile.timeLeft = 10; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.idStaticNPCHitCooldown = 4; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 0; + Projectile.aiStyle = -1; + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + + } + + public override void OnSpawn(IEntitySource source) + { + foreach (var projectile in Main.projectile) + { + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + segmentIndex = projectile.ModProjectile().segmentIndex; + projectile.ModProjectile().segmentIndex++; + } + } + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + if (player.Calamity().celestialDragons) + { + Projectile.timeLeft = 2; + } + } + + internal void SegmentMove() + { + Player player = Main.player[Projectile.owner]; + var live = false; + Projectile nextSegment = new Projectile(); + BlackDragonHead head = new BlackDragonHead(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == Type && projectile.owner == Projectile.owner && projectile.active) + { + if (projectile.ModProjectile().segmentIndex == segmentIndex - 1) + { + live = true; + nextSegment = projectile; + } + } + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + if (segmentIndex == 1) + { + live = true; + nextSegment = projectile; + } + head = projectile.ModProjectile(); + } + } + if (!live) Projectile.Kill(); + Vector2 destinationOffset = nextSegment.Center+nextSegment.velocity - Projectile.Center; + if (nextSegment.rotation != Projectile.rotation) + { + float angle = MathHelper.WrapAngle(nextSegment.rotation - Projectile.rotation); + //destinationOffset = Projectile.Center.DirectionTo(nextSegment.Center); + destinationOffset = destinationOffset.RotatedBy(angle * 0.1f); + } + Projectile.rotation = destinationOffset.ToRotation(); + if (destinationOffset != Vector2.Zero) + { + Projectile.Center = nextSegment.Center+nextSegment.velocity - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + projectile.Kill(); + } + } + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.ShadowFlame, 300); + } +} diff --git a/Projectiles/Summon/BlackDragonBody.png b/Projectiles/Summon/BlackDragonBody.png new file mode 100644 index 0000000000000000000000000000000000000000..abe048cbcb59713cd03f3d11c3fef0a373462f3d GIT binary patch literal 601 zcmV-f0;c_mP)VF1W8kBN7xOe5|?Bql`^0-F#{BXEuowe6qISdx^PXIXW{*L?S>y?VL@5Ak102WIx z061>{a>g%9B>?vJ4wCuK9{?J6*8p5xo;l}@*&lf*jF+QXXQFk}i2>G&WdJr7B4>R! zp9f&EFau;a7wlLJ(fQ`g&p#^w88hK9Vi_n$b3n#~7-;^u0HAS~XyJJwxse#KO#Cmx zVMHIVmgb#>js1ORtT*+cR~@EmR88k;wfGPWBf0WiqKVekRXl8inE069RGRtR{0?MV z@%e`!AK5->Ip+pfHMt>kBOSFjpE4m0tggNpx^MH#768?Wr@&)yR^Nhr#iD+ClYAI$ z_#h3DYD5TDBRxj?x-QV?E8Q-TF`+lEnuC6}+rW^n>*+NX;V}}8PXbUW7M%_94fPnS zc3U-K#`?-;<8b7Ugu{sPh`O-4@7q)x@7pdDs-{MI!)n#_88IMcq!syybygu9My97G z09cQbo2pvsY5uTGD5o6XPLDizKs#S|fIHoFSCxgGm@ zj}X4Ielm$ncvq_du$zvRLj;>$EmS@CAt**{CW#?qLTH*QT3LAw3~Irb&>l@@_2v;V nAov{dzOJh(vI)&17)Jg9>q+O$Xlyht00000NkvXXu0mjfqAUuE literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/BlackDragonBody2.png b/Projectiles/Summon/BlackDragonBody2.png new file mode 100644 index 0000000000000000000000000000000000000000..cc2564f292f0409512c7a9a9b6278e14e8cc449c GIT binary patch literal 844 zcmV-S1GD^zP)1vbLiuSyu>wYn7~GJU5UK{0#3dV}cfbw!v+xRt8@FBp3wB-tT!0X@i3tgt zHex7I5Q^9q38blu>D%^voe6&{C%&8Z%sD;N`JVayj)&1;XAb~dhvjPX^@Z_qXWiSQ z3II2UuLH1=|L%-$3=aday!_F>zV`=!%yAKbo!xDFYY!lm8UP?3?*L$PGhej}gETTS z;sLC$uLE%DG(Y+m<&7q;I2UrIy(+-W&?o@2g9&H;LuV%d+1_5DK}HfG>F2gjCf%L{ z8pI@#Yin!s04kMA6<}=aF3@-bB>N^zO+5f$etsT+iHQjhqD%~M2uUJUC-iLxXjuH( zfbR>kn6#PCJ7f8t$XQumOI`K%efsQ)b6teO_L+M#2f(YBFMtRWi|NaqTPbH^c4fsG z%aUQT?|hiTEH3Fy5PA8Od`FJ33*l2%00J%aTFkgt&yPC!1bMLcXfmUBj z-@6Y$=JO|KA6a;9ZPnRVKBjRx?dQv|X#3yCa)pAvd$mu8+&hy;9v&V7kgZuZllkJz zTT)h*lqB+2mb8@UNqPXKa+H*=o4$I>Vc-bR`V&5Qst4Z{Z5t+%VRblsS=TosV0=PPQKgMci98j z-~V-{2a7(jM9lAh#)pQS1tp#m$ZwXpo(!9v(Q}^lUh@bvxniN@L^?od@ z4|{EVLi2TBGnIlYE+0|Uw4HWXO&O540;AqZiY&2MSG*m7nS@V5(Qu*Ge_2u@xpCAL zxS@@Hvb=oI<~L?G)!pqXz~jl=K%-M${E>4O+OrQyWbD}XPdbwb>$jwf zMnfsG#Oh}rVR}9}>5SEfNwy!eB*M-W6-})cmzJ9U+qo54Vli4RQ-xMiSra8y "Projectiles.Summon"; + Dictionary segments = new Dictionary(); + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + + public override void SetDefaults() + { + Projectile.timeLeft = 10; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.localNPCHitCooldown = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 0; + Projectile.aiStyle = -1; + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + Projectile.minionSlots = 2; + + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + player.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) + { + if (player.dead) + { + player.Calamity().celestialDragons = false; + } + if (player.Calamity().celestialDragons) + { + Projectile.timeLeft = 2; + } + } + + Projectile.ChargingMinionAI(2000f, 2500f, 3200f, 300f, 0, 45f, 36f, 8f, new Vector2(0f, -60f), 12f, 12f, true, true, 1); + Projectile.rotation = Projectile.velocity.ToRotation(); + segments.Clear(); + foreach (var projectile in Main.projectile) + { + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active && !segments.ContainsKey(projectile.ModProjectile().segmentIndex)) + { + segments.Add(projectile.ModProjectile().segmentIndex, projectile); + } + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active && !segments.ContainsKey(projectile.ModProjectile().segmentIndex)) + { + segments.Add(projectile.ModProjectile().segmentIndex, projectile); + } + } + for (var i = 1; i <= segments.Count; i++) + { + if (i < segments.Count) + { + if (segments.ContainsKey(i)) + segments[i].ModProjectile().SegmentMove(); + } + else + { + if (segments.ContainsKey(i)) + segments[i].ModProjectile().SegmentMove(); + } + } + // Fly away from the white dragon + float pushForce = 0.1f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == ModContent.ProjectileType(); + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distancegate = 80f; + if (sameProjType && taxicabDist < distancegate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + lightColor = Color.White; + Texture2D tex = ModContent.Request(Texture).Value; + Texture2D texBody = ModContent.Request("CalamityMod/Projectiles/Summon/BlackDragonBody").Value; + Texture2D texBody2 = ModContent.Request("CalamityMod/Projectiles/Summon/BlackDragonBody2").Value; + Texture2D texTail = ModContent.Request("CalamityMod/Projectiles/Summon/BlackDragonTail").Value; + Texture2D texTail2 = ModContent.Request("CalamityMod/Projectiles/Summon/BlackDragonTail2").Value; + for (var i = segments.Count; i > 0; i--) + { + if (segments.ContainsKey(i)) + { + SpriteEffects fx = Math.Abs(segments[i].rotation) > MathHelper.PiOver2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (i < segments.Count - 1) + { + Main.EntitySpriteDraw((i == 5 || i == 16) ? texBody2 : texBody, segments[i].Center - Main.screenPosition, null, segments[i].GetAlpha(lightColor), segments[i].rotation + MathHelper.Pi / 2f, texBody.Size() / 2f, segments[i].scale, fx, 0); + } + else if (i < segments.Count) + { + Main.EntitySpriteDraw(texTail, segments[i].Center - Main.screenPosition, null, segments[i].GetAlpha(lightColor), segments[i].rotation + MathHelper.Pi / 2f, texBody.Size() / 2f, segments[i].scale, fx, 0); + } + else + { + Main.EntitySpriteDraw(texTail2, segments[i].Center - Main.screenPosition - new Vector2(10, 0).RotatedBy(segments[i].rotation), null, segments[i].GetAlpha(lightColor), segments[i].rotation + MathHelper.Pi / 2f, texTail.Size() / 2f, segments[i].scale, fx, 0); + + } + } + } + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation + MathHelper.Pi / 2f, tex.Size() / 2f, Projectile.scale, Projectile.velocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + return false; + + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.ShadowFlame, 300); + } +} diff --git a/Projectiles/Summon/BlackDragonHead.png b/Projectiles/Summon/BlackDragonHead.png new file mode 100644 index 0000000000000000000000000000000000000000..92c3679f44ca3f6c7444e36b6a7bb172ed444aef GIT binary patch literal 2683 zcmXX|c{r5&7k{OzE~aiomguIG5Sc+3OE+6(H)9RSGGj2KEQ2wO>PJzyE|ZKsH^#U_ zWE1m?mPGS{qer<^PK0rpU*kpbI#{{6Kt)`A;L1k002O4-Y~HT zzew;Q92ElJXIY_-0YLcrO_Se{5!ov_7Jel4V)o)Ss*S&WsV~ho{a6X4567kpUy}OiQ0u6tN6nE5*gXFJ zDyd_O=hl%j3!h!w*M8d+f}T&_*?}+YvBS$l26b0fLSv4_mS8e|mV@JUxci0Oit%QEl@&`jHhB|UPCO7U-@5)E z_98LRPex{itdU^F81Ot}_kh6|3(J9k;BW568tpF% z8tyMX8rU3M=lS{XMw&)NzXn}p~a!VKmw1C9VIxtF7$j*?xs-*Y?Q&w8QlUm#vgFF1%VC2($G55z1MMiYPk|jz$ z+u#vWxHbB{;%GjdMGx+=bs(>ga?&&jc9w_pD=ID>xuT6XIux--zsh;QT{br>6a30; z=@XD@;&rX4Tbcr__PEpMhpQadn;wGPnP5^lBsr6E(W7}EVw-#yI>0t=Up0sln}};8 zwvV+g@I)l~W_^OP_B!jLq*^m6r1{>-T5t5RPk)PS$s$;zo>a6yY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ipm;qu6SuiJvsplVd+A~shT#NOJ#0zufL-s*yU-Af`;+Q zAz2ushm=~XdB#CV6ZWPo;94`dVJ?Iiuj%K8I*rR29ZQc&5!z&6r77CuBXCd!2U$vY zT+b=fCoaOT4?qk5yJJwKX`^Gc*oNg_%j_?@R}oyD3hVg|dwds`c*#7WdD?8c=+iCJqC65 z952L`?+Y4N>FoZu6MM>r%&Ddu{8)>?T~y0p?r&flwb!#|yGtL#vs{B;Z#E42Sb9dF)pMyyM>cvJGp{soFWOq)v_bfpwBk(re2_Xdu8y ac_fI*E5=VlkYeys3EVWbHYvOA`S4$fl~;@a literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/BlackDragonTail.cs b/Projectiles/Summon/BlackDragonTail.cs new file mode 100644 index 0000000000..53714189fc --- /dev/null +++ b/Projectiles/Summon/BlackDragonTail.cs @@ -0,0 +1,111 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BlackDragonTail : ModProjectile, ILocalizedModType + { + public string LocalizationCategory => "Projectiles.Summon"; + public int segmentIndex = 1; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = false; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + + public override void SetDefaults() + { + Projectile.timeLeft = 10; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.localNPCHitCooldown = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 0; + Projectile.aiStyle = -1; + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + + } + public override void AI() + { + Player player = Main.player[Projectile.owner]; + if (player.Calamity().celestialDragons) + { + Projectile.timeLeft = 2; + } + } + internal void SegmentMove() + { + Player player = Main.player[Projectile.owner]; + var live = false; + Projectile nextSegment = new Projectile(); + BlackDragonHead head = new BlackDragonHead(); + + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + if (projectile.ModProjectile().segmentIndex == segmentIndex - 1) + { + live = true; + nextSegment = projectile; + } + } + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + if (segmentIndex == 1) + { + live = true; + nextSegment = projectile; + } + head = projectile.ModProjectile(); + } + } + if (!live) Projectile.Kill(); + Vector2 destinationOffset = nextSegment.Center - Projectile.Center; + if (nextSegment.rotation != Projectile.rotation) + { + float angle = MathHelper.WrapAngle(nextSegment.rotation - Projectile.rotation); + //destinationOffset = Projectile.Center.DirectionTo(nextSegment.Center); + destinationOffset = destinationOffset.RotatedBy(angle * 0.1f); + } + Projectile.rotation = destinationOffset.ToRotation(); + if (destinationOffset != Vector2.Zero) + { + Projectile.Center = nextSegment.Center - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; + } + Projectile.velocity = Vector2.Zero; + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + projectile.Kill(); + } + } + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.ShadowFlame, 300); + } +} diff --git a/Projectiles/Summon/BlackDragonTail.png b/Projectiles/Summon/BlackDragonTail.png new file mode 100644 index 0000000000000000000000000000000000000000..235544b686daabebb1d61acf5529b52103d943fc GIT binary patch literal 582 zcmV-M0=fN(P)# z!AcuZ6o$Vk22%{RMU57t(7LJ65)ex4rVAIog)h(t=_B|8?tFnlHw8B;1vk3rLM_rr zt0n|mgTb^+7x(@d@99j9s~P{zaPHhY;s5VB|2c{9m@bb2aMtU_0IM?#0IW?{xQX}I ze*l=PJq6%f^Lr4_)@lIk?0k0XohtzL`o92Zwa&S`?HX{0uc}ov+-S{0l=r9-C%ur`E?LW5kWri z@y8KR#45n4kcJo%=5KmE01iDPUOi7eWF1nl%u6Gs2nwP=fEzslNSIqF+fSR#AQqGx zrysUb&-Z`#fg&m}HRcqkKb{HJ)eGc^vwqzwF}VBvW52)PJ}^)~UC}xt%Knp9a8UJb zeITm~W}!F=*siGTS2vWCZPe@T>ARw>0>#2@y`(q_*t=ib-3>O%5tS3lcAEo(8PUgC z4p>|tSoh3dOiV@q^QG|^lAMqqaP6GZ&I7kW%!NWJ5JBREU)rr0V5Q-zLX(pGK$FhW zlB0xAC$%`BMpo4G6S7i0h0 U_y8qrivR!s07*qoM6N<$f;vhEbN~PV literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/BlackDragonTail2.png b/Projectiles/Summon/BlackDragonTail2.png new file mode 100644 index 0000000000000000000000000000000000000000..00627c3de32a1ae19ae2df3a201917bf74903725 GIT binary patch literal 1064 zcmV+@1lRkCP)GYSv000B;NklLriBEicepAAy(PnnP|pf?oilN|stU zA-feypu`xgCN?o9l6#o_u07+O^+Nw>_It6t^Bb?{li$CYO@v3=)fxbc3)cX6_O>$y z*x%f?>`rQn*5|F;H_e-;zXQ;C-PTa#yVtb7$Yb<>s^nhSs4M}{?)MClsv+{j?$@bb zaB@BX;NHFOt?MsiLZ7Pe37riGmapvGSxcSxsP)Hx@`J)BBq=)dDq;s4Rb#MYe99&D z@%^mp!4WE{W+j=~Lq;TYeQ!841Mz2N z?3bsf0IaR918_f%M$MNRuiImoB^4Z@NQAblH^y0pE}8xQa{wCEZ-CioYc_wi=6BzA z%si)CaJzx<2mzMwxS4szXJQ?l^#N#pv@`El>&AE9bPN&skR)H4A~XG40w(0@r`_Gu z30mRN(klQStbGSeYMM((nn$Wuu7pcS%9V#y(-dXW!Qd7!@u~YxH=rn!e9;yhq0&?h z17^u+g4$uMmJ}YLYN-ss-OWvFK>dqWpcQ+` z%#p~8jB1!_niL)(Rr&4ejZ}lgr(!~nD-{5mA5HB#Af1qppoq6GdjOmb2UZ6e9wEIE z3FRBt`z4JhnKvfq);8sxojZ2MPkiaP9sgx&5kR|dh=of?^5q9tdmf*X)G@l9rj+|Weuwnki=v!R`=Nx8yDP{m%~Mo~kW`Orn9rA7g-b}$ zrM!Trla$>gzt}#dPO;Tnj_vHdeIW^1wdCFC5`cC>B6~${6_+nHSL5+Gy4<|vQ;>u# z^+v-qyBWDrK3suf3>G_MkbPe}T9bv*)Tz37f%)|VPNeN0k5YS78FD-NMI1G5Wx zHdJ4e?kn@6M*UIU@g<*%L&!b*%PW_lPwws`*b}te{gBUBeCJ8?2oYC^@K0gq8O*Ex z|F()psDCvA^6y6esftJFbMw*Xs(6HIWwRf1`=qt<^$4IldY{@2NUC9~Y3tWlB7n~O z^Hlrd5$cVGsVDtg%U>FUk!?Tq "Projectiles.Summon"; + public int segmentIndex = 1; + + public override void SetStaticDefaults() + { + Main.projPet[Projectile.type] = true; + } + + public override void SetDefaults() + { + Projectile.timeLeft = 10; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.idStaticNPCHitCooldown = 4; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 0; + Projectile.aiStyle = -1; + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + } + + public override void OnSpawn(IEntitySource source) + { + foreach (var projectile in Main.projectile) + { + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + segmentIndex = projectile.ModProjectile().segmentIndex; + projectile.ModProjectile().segmentIndex++; + } + } + } + public override void AI() + { + Player player = Main.player[Projectile.owner]; + if (player.Calamity().celestialDragons) + { + Projectile.timeLeft = 2; + } + } + + internal void SegmentMove() + { + Player player = Main.player[Projectile.owner]; + var live = false; + Projectile nextSegment = new Projectile(); + WhiteDragonHead head = new WhiteDragonHead(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == Type && projectile.owner == Projectile.owner && projectile.active) + { + if (projectile.ModProjectile().segmentIndex == segmentIndex - 1) + { + live = true; + nextSegment = projectile; + } + } + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + if (segmentIndex == 1) + { + live = true; + nextSegment = projectile; + } + head = projectile.ModProjectile(); + } + } + if (!live) Projectile.Kill(); + Vector2 destinationOffset = nextSegment.Center+nextSegment.velocity - Projectile.Center; + if (nextSegment.rotation != Projectile.rotation) + { + float angle = MathHelper.WrapAngle(nextSegment.rotation - Projectile.rotation); + //destinationOffset = Projectile.Center.DirectionTo(nextSegment.Center); + destinationOffset = destinationOffset.RotatedBy(angle * 0.1f); + } + Projectile.rotation = destinationOffset.ToRotation(); + if (destinationOffset != Vector2.Zero) + { + Projectile.Center = nextSegment.Center+nextSegment.velocity - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override void Kill(int timeLeft) + { + if (Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + projectile.Kill(); + } + } + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 300); + } +} diff --git a/Projectiles/Summon/WhiteDragonBody.png b/Projectiles/Summon/WhiteDragonBody.png new file mode 100644 index 0000000000000000000000000000000000000000..9a77543417d57aa4192e3995366110a43c30125b GIT binary patch literal 591 zcmV-V07{))d>mnk^7MqGfo&-C@8YcJy7cq_P)Tx_P7}3cNdGO>(`~w!R(xEzd@SrzQ z53-UAn$%WA*S%Flh1el-oer~4>wKBj(Tm@CE;GE}cjjfDdEV!J9Sq!z-v%JlIsica z%eD)!)bz}kmm7Zr!1UB(09rbledk|G-vC(MSOcI~ECKLpVbLt<0L0AbMWN0Nr0Uv$ zDia%bmI3(nI`7L%r#sG7@cNA|06x6^?2FsSh_um}^uF}U@Akk4*2{+gB+givUcP)p zz9B!+Rq^{1cY)f>*vCjy{BmHz%-<~lW)njIjK#g{#NL80&vaHn8WPNI5$t2c#N_52 zP-Q}pR^$g^p;;3hXB84hjsx)i&yEW)Q;CZibMwqkazeWhBk?g29)lIFKu$K`*J|d`V&Z-eP ztF#iZvjR3VvS0q;09}90ZrY3D@9}(o7=FVzD d3|jB3{{S5(!0bgZks1I1002ovPDHLkV1h4n7pMRL literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/WhiteDragonBody2.png b/Projectiles/Summon/WhiteDragonBody2.png new file mode 100644 index 0000000000000000000000000000000000000000..f25f076d0eff604c2e1c782fd21d7afd76245016 GIT binary patch literal 927 zcmV;Q17Q4#P)o>mzpigRS+Q+RAX-EanC-G4a}m@c zYg1}vh8dZd6}>j0wNNVyu_Dr@#htIqJdNYGAc>Zji>$gZr3m0bt@TBv_m@YU{ zML#ilD=XC|k@k63&=VR*h5<-4#+w^$qDA?I#u2y2yh|4Wqlu*@FNo-ZBlTkR6O*^v z-nWJImMK*|ky3S3Rm}8w0H{4z4>-h3dFIRppy%})f3V|g^CnmT&8;@s-;s-cVo7ny z0L)Kb9(1C-)$*eafazWKd{sxYkLmaGS8gwLbv$y<%a{f@q)PT|bFI6=a|Qrk@qiy3 za+jLI-&ph$ONpNvbVB9#y8s+bTn#`$y!~0)Q3HhTXVUz+cHfe>%;eG6`@s)zqPhZr zox4i_C_iuvfVb_v0JPL+01i0=E5V#R zbr^sbjcWk#1*YYA(=33S_ru><>=4UJwUa{b&`JOb;@wkxak+tSA6?@jB(Is7Q3*sc zy(LoJJw2{A0 z{Z9a(s`hla`xvFzAttGhNvevWJSNF&+J9ww-2G?E=GCLl0moY+HEHrh3*ht6m(W)q zMzKR|aAd#&m}1%4aU>4c{zz4_DnO(tKls8*8dtB`SyQBx9VJ!6LuJPS$XPtk?xUSA zfw8~6ihg1jhHOt2CG7&>>2SLrVBe$z0Ho&m0H;ct`zlkahPCJR0}e4Wk%;KJf;PFmj5 zeoTrq)r;`cxw-1);x53i^t_7igKFb{NKy6gY|002ovPDHLkV1l~$ ByPp66 literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/WhiteDragonHead.cs b/Projectiles/Summon/WhiteDragonHead.cs new file mode 100644 index 0000000000..573fbc0b5d --- /dev/null +++ b/Projectiles/Summon/WhiteDragonHead.cs @@ -0,0 +1,150 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + // HUGE credit to Dozezoze for lending his worm projectile code + public class WhiteDragonHead : ModProjectile, ILocalizedModType + { + public string LocalizationCategory => "Projectiles.Summon"; + + Dictionary segments = new Dictionary(); + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + + public override void SetDefaults() + { + Projectile.timeLeft = 10; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.localNPCHitCooldown = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 0; + Projectile.aiStyle = -1; + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + Projectile.minionSlots = 2; + + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + player.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) + { + if (player.dead) + { + player.Calamity().celestialDragons = false; + } + if (player.Calamity().celestialDragons) + { + Projectile.timeLeft = 2; + } + } + Projectile.ChargingMinionAI(2000f, 2500f, 3200f, 300f, 0, 45f, 36f, 8f, new Vector2(0f, -60f), 12f, 12f, true, true, 1); + Projectile.rotation = Projectile.velocity.ToRotation(); + segments.Clear(); + foreach (var projectile in Main.projectile) + { + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active && !segments.ContainsKey(projectile.ModProjectile().segmentIndex)) + { + segments.Add(projectile.ModProjectile().segmentIndex, projectile); + } + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + segments.Add(projectile.ModProjectile().segmentIndex, projectile); + } + } + for (var i = 1; i <= segments.Count; i++) + { + if (i < segments.Count) + { + if (segments.ContainsKey(i)) + segments[i].ModProjectile().SegmentMove(); + } + else + { + if (segments.ContainsKey(i)) + segments[i].ModProjectile().SegmentMove(); + } + } + // Fly away from the black dragon + float pushForce = 0.1f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == ModContent.ProjectileType(); + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distancegate = 80f; + if (sameProjType && taxicabDist < distancegate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + lightColor = Color.White; + Texture2D tex = ModContent.Request(Texture).Value; + Texture2D texBody = ModContent.Request("CalamityMod/Projectiles/Summon/WhiteDragonBody").Value; + Texture2D texBody2 = ModContent.Request("CalamityMod/Projectiles/Summon/WhiteDragonBody2").Value; + Texture2D texTail = ModContent.Request("CalamityMod/Projectiles/Summon/WhiteDragonTail").Value; + Texture2D texTail2 = ModContent.Request("CalamityMod/Projectiles/Summon/WhiteDragonTail2").Value; + for (var i = segments.Count; i > 0; i--) + { + if (segments.ContainsKey(i)) + { + SpriteEffects fx = Math.Abs(segments[i].rotation) > MathHelper.PiOver2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (i < segments.Count - 1) + { + Main.EntitySpriteDraw((i == 5 || i == 16) ? texBody2 : texBody, segments[i].Center - Main.screenPosition, null, segments[i].GetAlpha(lightColor), segments[i].rotation + MathHelper.Pi / 2f, texBody.Size() / 2f, segments[i].scale, fx, 0); + } + else if (i < segments.Count) + { + Main.EntitySpriteDraw(texTail, segments[i].Center - Main.screenPosition, null, segments[i].GetAlpha(lightColor), segments[i].rotation + MathHelper.Pi / 2f, texBody.Size() / 2f, segments[i].scale, fx, 0); + } + else + { + Main.EntitySpriteDraw(texTail2, segments[i].Center - Main.screenPosition - new Vector2(10, 0).RotatedBy(segments[i].rotation), null, segments[i].GetAlpha(lightColor), segments[i].rotation + MathHelper.Pi / 2f, texTail.Size() / 2f, segments[i].scale, fx, 0); + + } + } + } + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation + MathHelper.Pi / 2f, tex.Size() / 2f, Projectile.scale, Projectile.velocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 300); + } +} diff --git a/Projectiles/Summon/WhiteDragonHead.png b/Projectiles/Summon/WhiteDragonHead.png new file mode 100644 index 0000000000000000000000000000000000000000..d2674d99382dfffa169fbf7a2e876c1137dfba5a GIT binary patch literal 2291 zcmZuzdpOf=AOEG8P&{cbb5_n7&2p%TG2Z03r%`W|vni)Nn)70ET__I~p4c45cs7SQ zgnFDRdW$t?5|Rn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Projectiles/Summon/WhiteDragonTail.cs @@ -0,0 +1,112 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class WhiteDragonTail : ModProjectile, ILocalizedModType + { + public string LocalizationCategory => "Projectiles.Summon"; + public int segmentIndex = 1; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = false; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + + public override void SetDefaults() + { + Projectile.timeLeft = 10; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.localNPCHitCooldown = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 0; + Projectile.aiStyle = -1; + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + + } + public override void AI() + { + Player player = Main.player[Projectile.owner]; + if (player.Calamity().celestialDragons) + { + Projectile.timeLeft = 2; + } + } + internal void SegmentMove() + { + Player player = Main.player[Projectile.owner]; + var live = false; + Projectile nextSegment = new Projectile(); + WhiteDragonHead head = new WhiteDragonHead(); + + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + if (projectile.ModProjectile().segmentIndex == segmentIndex - 1) + { + live = true; + nextSegment = projectile; + } + } + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + if (segmentIndex == 1) + { + live = true; + nextSegment = projectile; + } + head = projectile.ModProjectile(); + } + } + if (!live) Projectile.Kill(); + Vector2 destinationOffset = nextSegment.Center - Projectile.Center; + if (nextSegment.rotation != Projectile.rotation) + { + float angle = MathHelper.WrapAngle(nextSegment.rotation - Projectile.rotation); + //destinationOffset = Projectile.Center.DirectionTo(nextSegment.Center); + destinationOffset = destinationOffset.RotatedBy(angle * 0.1f); + } + Projectile.rotation = destinationOffset.ToRotation(); + if (destinationOffset != Vector2.Zero) + { + Projectile.Center = nextSegment.Center - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; + } + Projectile.velocity = Vector2.Zero; + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + var projectile = Main.projectile[i]; + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.active) + { + projectile.Kill(); + } + } + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 300); + } +} diff --git a/Projectiles/Summon/WhiteDragonTail.png b/Projectiles/Summon/WhiteDragonTail.png new file mode 100644 index 0000000000000000000000000000000000000000..fc63bd23bc4dd555be2d2cda158fd8cd7382c423 GIT binary patch literal 598 zcmV-c0;&CpP)W^o_zP_e_mfKvb6Yb0nk<6 z2Ecb;Is@>mtOI~grzZfEz1RkzJ7)XWMQZt*UmKgodT97H0F!T~QCI*zZT;T_ZaZQK0rxwFR*GGX;1-0d448cnu?3|m;zSzngMuq zV*to?Lg@oe*{qR{soCB6ZLHl_U}E2n`Mt^kxM;7e=yKE_LrT0|eax1@9>!=qeCIfoL>R(gU12 zpx{XbEPz1TUW^{T%zH|9LZ1Z%-2nyfC?FkCxE*{9IG>cp$7X@tKP0CqSPbtdpm91W k4IVF+v~j6Z({%;@00DZeC&pYm*Z=?k07*qoM6N<$g3I^^8vpGYSv000AkNklp01IKR;`esAiE ztG#~-c}11@j+XdRG&&4GxZZt(s+<~Y@%JJM&EowuDgP1@rAsDV>AV%0@3a6aO_3`p z{}U3OdtskAl(QdL8eQ_n(bqk$>%+OusFL*!xi+zuc!w*gj38tHcI4T4C^Frdh!Q8M zrqE#kS|{!T$&4+;g6ss6BsF32Eg>cQ`kzp$Jha>>^YXpOe5b3ue+iYD5+Hpt5`}$p z?*NEKYXG=2a0Y-DIshm*5OSrFmyXI=|)g`pVI~L9YJ|who?5C0rD3Wm@vs}sZYRonR&|`gc%=?m%QDYV)YmE4k zS8bF0LKO}>t*+x60Ej$z0zeUkKqlPF*kI6qv+{YOX-3``DM0B7r(ms~6w~j3{#mExHW=Nn+{N zu%Q7v59I|4fYf9}89~Ukwyjjtld)yl``q-x1ROvP72xHvt&7MjihRl4#SNX5-1DKr#=-XC^W`52Yj|zEo+7 z0C;PSJ4lIi-V#z$%Ve+BM@W>4ln@GR%r^j&Kc{s5TIGa9UZm1}X2uc9Dyyur$||d@ bR=fTH_lAGV$w29w00000NkvXXu0mjf;8nWb literal 0 HcmV?d00001