From befe0f2e4697b0a73f5ee85a12865346085e4a6b Mon Sep 17 00:00:00 2001 From: GinYuH Date: Fri, 2 Jun 2023 03:13:01 -0700 Subject: [PATCH 01/10] 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>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ZW%aipm;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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++ b/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 From 7af3baf5e0411eaf1b72e739e28e2607904a4b79 Mon Sep 17 00:00:00 2001 From: GinYuH Date: Sat, 3 Jun 2023 03:43:59 -0700 Subject: [PATCH 02/10] a whole lotta stuff use sound and rarity changes, hold offset, removed unnecessary code, changed offsets for the summons, fixed flipping visuals, now counts as a minion, uses mechworm idle movement, changed which segments have legs, is anyone even reading this if so react to this commit with a carrot or ping me, probably other stuff --- .../Summon/KingofConstellationsTenryu.cs | 63 +++------- Projectiles/Summon/BlackDragonBody.cs | 1 + Projectiles/Summon/BlackDragonBody.png | Bin 601 -> 661 bytes Projectiles/Summon/BlackDragonBody2.png | Bin 844 -> 768 bytes Projectiles/Summon/BlackDragonHead.cs | 107 +++++++++++++---- Projectiles/Summon/BlackDragonHead.png | Bin 2683 -> 1997 bytes Projectiles/Summon/BlackDragonTail.cs | 1 + Projectiles/Summon/BlackDragonTail.png | Bin 582 -> 677 bytes Projectiles/Summon/BlackDragonTail2.png | Bin 1064 -> 1188 bytes Projectiles/Summon/WhiteDragonBody.cs | 1 + Projectiles/Summon/WhiteDragonBody.png | Bin 591 -> 689 bytes Projectiles/Summon/WhiteDragonBody2.png | Bin 927 -> 932 bytes Projectiles/Summon/WhiteDragonHead.cs | 108 ++++++++++++++---- Projectiles/Summon/WhiteDragonHead.png | Bin 2291 -> 1724 bytes Projectiles/Summon/WhiteDragonTail.cs | 1 + Projectiles/Summon/WhiteDragonTail.png | Bin 598 -> 665 bytes Projectiles/Summon/WhiteDragonTail2.png | Bin 953 -> 1096 bytes 17 files changed, 185 insertions(+), 97 deletions(-) diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index 744530806a..a5f2e86525 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -1,7 +1,7 @@ using Terraria.DataStructures; -using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -23,11 +23,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.width = 44; Item.height = 62; - Item.UseSound = NPCs.Yharon.Yharon.HitSound; + Item.UseSound = Flare.FlareSound; Item.useAnimation = Item.useTime = 25; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.noMelee = true; @@ -36,12 +36,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.autoReuse = true; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-20, 0); + } + 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); + 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; @@ -49,47 +54,11 @@ namespace CalamityMod.Items.Weapons.Summon 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) + 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++) { - 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); - } - } + Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, body, damage, knockback, player.whoAmI); } } @@ -99,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(ItemID.StardustDragonStaff). AddIngredient(ItemID.LightShard). AddIngredient(ItemID.DarkShard). - AddIngredient(ModContent.ItemType(), 7). + AddIngredient(ModContent.ItemType(), 3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Projectiles/Summon/BlackDragonBody.cs b/Projectiles/Summon/BlackDragonBody.cs index e20652e28a..681a53a990 100644 --- a/Projectiles/Summon/BlackDragonBody.cs +++ b/Projectiles/Summon/BlackDragonBody.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.aiStyle = -1; Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; + Projectile.minion = true; } diff --git a/Projectiles/Summon/BlackDragonBody.png b/Projectiles/Summon/BlackDragonBody.png index abe048cbcb59713cd03f3d11c3fef0a373462f3d..81e1e1a23e0cb63fc430ffff6d571b8486082a76 100644 GIT binary patch literal 661 zcmV;G0&4wPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0xC&FK~!i%?U~I= z0#O)-ogffOAvNvC2+~bZ2tsHVV0Y0CwCg6?w(ADmwJaiN*`^|B(>9C9DD7{NkrZL^ z&Upvs!$UB~W?GzQ^PZD<5a!{0-+Vc}UN05|$8prkB^Mt-wz_Y=1M8)dTDfd|d?9D@ zlgOLq9g_R$d>(mxe2ScTc}Jdoz9Ju=+DP*A`~5$}kRg>8MPNgUiIiHoG&(OhXl0^+ z{c3I$Nsi)iaDXWb4?xLVEtTqyBNJs=Wg!2&H9AsS?;F+O5mv@P* zGBm}Tq}fh2S^^ugn8_ihh7-QKgYyqQQE85xsY*jwWxTs({}5?A)rc^uGWa6<4rvC_ zP2CAi(Y@P9Lx{aYLc-V(9deS!euT)$nVi1cnd(2m#1OUe@ZBjy-YxU<3rO7@L{7}? vOf_N#ZixIpjqEUgo2AOCW9K1}5{rEU{bPF&#FCL900000NkvXXu0mjfrr0RR 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 diff --git a/Projectiles/Summon/BlackDragonBody2.png b/Projectiles/Summon/BlackDragonBody2.png index cc2564f292f0409512c7a9a9b6278e14e8cc449c..843053ffddb1cc208a3e3dfd53ac98d55214c53a 100644 GIT binary patch literal 768 zcmV+b1ONPqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0+mTbK~!i%?U}tw z98nmCcLIWiv5CKAC6L$%3BnrDT!5wsdI#P>5(}?DY;5h)Zn0g;1RK48D4K;pz{Vhw z4gPINp%77IO};tL!oF}AoipWmns>&&Rzwp@Jw z&N3Pz1RL^pYRc~6!}hkjN@3?f4bf*BFve$!8lts>n!!4;hU6r;%lP^|W~{j#qo#b^ zKd@9&Dibd)>tA;*fgRo3`)6y4#w z)($lbs1-i5qai}!hWIAc+Q~(F@#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mzJ9U+qo54Vli4RQ-xMiSra8y 100f) + { + if (Math.Abs(player.Center.X - Projectile.Center.X) > 20f) + Projectile.velocity.X += hoverAcceleration * Math.Sign(idealPos.X - Projectile.Center.X); + if (Math.Abs(player.Center.Y - Projectile.Center.Y) > 10f) + Projectile.velocity.Y += hoverAcceleration * Math.Sign(idealPos.Y - Projectile.Center.Y); + } + else if (Projectile.velocity.Length() > 1f) + Projectile.velocity *= 0.96f; + + if (Math.Abs(Projectile.velocity.Y) < 1f) + Projectile.velocity.Y -= 0.1f; + + if (Projectile.velocity.Length() > 25) + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 25; + } + if (distanceFromOwner > 5000) + { + Projectile.Center = player.Center; + } - 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) @@ -85,37 +123,56 @@ namespace CalamityMod.Projectiles.Summon segments[i].ModProjectile().SegmentMove(); } } - // Fly away from the white dragon - float pushForce = 0.1f; - for (int k = 0; k < Main.maxProjectiles; k++) + } + internal void AttackTarget(NPC target) + { + float idealFlyAcceleration = 0.18f; + + Vector2 destination = target.Center; + float distanceFromDestination = Projectile.Distance(destination); + + // Get a swerve effect if somewhat far from the target. + if (Projectile.Distance(destination) > 425f) { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || k == Projectile.whoAmI) - continue; + destination += (Projectile.ai[0] % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; + distanceFromDestination = Projectile.Distance(destination); + idealFlyAcceleration *= 2.5f; + } - // 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; + // Charge if the target is far away. + if (distanceFromDestination > 1500f) + idealFlyAcceleration = MathHelper.Min(6f, Projectile.ai[1] + 1f); - if (Projectile.position.Y < otherProj.position.Y) - Projectile.velocity.Y -= pushForce; - else - Projectile.velocity.Y += pushForce; - } + Projectile.ai[1] = MathHelper.Lerp(Projectile.ai[1], idealFlyAcceleration, 0.3f); + + float directionToTargetOrthogonality = Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), Projectile.SafeDirectionTo(destination)); + + // Fly towards the target if it's far. + if (distanceFromDestination > 320f) + { + float speed = Projectile.velocity.Length(); + if (speed < 23f) + speed += 0.08f; + + if (speed > 32f) + speed -= 0.08f; + + // Go faster if the line of sight is aiming closely at the target. + if (directionToTargetOrthogonality < 0.85f && directionToTargetOrthogonality > 0.5f) + speed += 16f; + + // And go slower otherwise so that the dragon can angle towards the target more accurately. + if (directionToTargetOrthogonality < 0.5f && directionToTargetOrthogonality > -0.7f) + speed -= 16f; + + speed = MathHelper.Clamp(speed, 16f, 34f); + + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(destination), Projectile.ai[1]).ToRotationVector2() * speed; } } 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; @@ -128,7 +185,7 @@ namespace CalamityMod.Projectiles.Summon 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); + Main.EntitySpriteDraw((i == 5 || i == 12) ? 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) { diff --git a/Projectiles/Summon/BlackDragonHead.png b/Projectiles/Summon/BlackDragonHead.png index 92c3679f44ca3f6c7444e36b6a7bb172ed444aef..9f5c41f47a80589c3b482de0bfe85880574324db 100644 GIT binary patch literal 1997 zcmeAS@N?(olHy`uVBq!ia0vp^B|u!o!3-oL{n}H36k~CayA#8@b22Z19F}xPUq=Rp zjs4tz5?L7-m>B|mLR^93BEn*pDjb@cI&KomA;#8O=H^*mEN-r@iHV7e_4Qk#8D1)L z{(sFddCJtCJ9qy7{~xGj6pV(z@CboFZ-bu$^9e&qkY6w`ZI5KY5d5886&S0W1s;*b z3=DjSL74G){)!Y}Vd3TJ;uw|3C?#PRipeG3fBVmS=^?z(@bBIkU5P|;{)c-vg{zK&{`<6i!3qQa<@;+%t)(vwU@)ABae$^qwS_h z2+onPw{xnf4qnp0$hwrFHGns0r9}SUg_jm8q~`U!e{aY%^`eUwOE>>ArNs4;F?J#C zLJJJvl_}`DIf%;M<9#abweffor-sK=w>P4Gmto^&(y>{f1+ay&Gv^{iA-P= zQTBN{H({wu$GSxQP@|A%Wpf!L7;?`%n|wfENp@P?s+bokxv|D;dDgw2vz4X!obmRQ z46omRKdx|I#up!Yv~aSkg42;3%f8t$&bsulK&GWNCsxM0fvfvv&b18Z>iG=3jM?9- z`DXjbIGwAF4{h-{6f%vuWbva9EE*>cD@-s7Z+|86dtW9`W_-(Er`9Q3tx^m(?z8z~ zn<3`dGcECSQxHc>iqNvdG1UoYQrxayRu8Xe@^k39+TpwMIGaR(F5~X!_6AEGSY6ms zc$6KP1VRcAJ<058ec5+gi#1D%oy}0OcIImL8Z za|vJ&o4w*zxZE6eB;%#LL;jw(;Zu38woL9+*vgS;@I!RLBu8B{qv>|~2O}=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Summon/BlackDragonTail.cs index 53714189fc..2876a13653 100644 --- a/Projectiles/Summon/BlackDragonTail.cs +++ b/Projectiles/Summon/BlackDragonTail.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.aiStyle = -1; Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; + Projectile.minion = true; } public override void AI() diff --git a/Projectiles/Summon/BlackDragonTail.png b/Projectiles/Summon/BlackDragonTail.png index 235544b686daabebb1d61acf5529b52103d943fc..c5a5dd9f5aadb2d7d02d71408aaa9b31a69ab472 100644 GIT binary patch literal 677 zcmV;W0$TlvP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0y;@VK~!i%?U~O? z0zm-A*GLdbqtfh;6{Lp(B?!WLfi6*R&$>x9?2&eo_5TT4QZ|>idE*V(7vh=W5|HeW=Jn+(Aj$hN#wbNW)Sv} z)0bN$O*4iJ2pxvFe|69{w`^CdNUl0oY6YR{AI%1Wc>+4Rsdm6$%BJXll4Yh%pLk5A)RR$+wGd<2`kwk8+e7CCF%k*lf>>$RFKBL_b zvN|2cKbHIx_+0KI@~*ezExh_|d-H+00000 LNkvXXu0mjfSokhS 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 diff --git a/Projectiles/Summon/BlackDragonTail2.png b/Projectiles/Summon/BlackDragonTail2.png index 00627c3de32a1ae19ae2df3a201917bf74903725..f890bc138212a1cf7e3029dcd7f47c1106e62f25 100644 GIT binary patch literal 1188 zcmV;V1Y7%wP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1UX4WK~#8N?VHU` z6Hye$I|ljzEv8Tl5{WS-u8bxm27CcFMwjk*0e3!u@g>}{VCM^%urYBX#DoNOWk6$4 zl_S}F<7Ju`nYbJE*sJ7)@u^Gj~d%*f2pdw@dZhMlEE- z^z9Nw&b#9p#kskM6v3~z?;>^qg ziWm5G2lB|&-=T=}0kRJ_MGX-~%#cccwC#ns8S~Yz z6qoaNDe`OsL%{yQE=3p!cqOZb2qTeY=mHoyj2NFwUSl*<(Nc0D67 zhXBka0W*Lak_2LgaGuZ3`deWz!b`*36knC@Q^cBv8v>$CDW_xgdt&w zzt#RZ2u2iZ8e|!;P@ANPIR!?*9Ap__%Qo)kx%h>8K@DNVHe@2_jX2gYeD1&qW5i$X zf1-%`1K9@V@O^;eJiGAhriKU;+Ynx<%%j zTkVT=i895d3UnQX$V)F8$b*b>ATXIeg!q2^+Y2)0DO8ap?j~c=d?+{ZD@LHi2#thSJb4qEfOwAa_tutUQkwy(+ z^sPf+LKJ4TYnrKSO^eD#QCY5A)DVVPhuHqFM}hN9R^cmJ!^~iTTCdmd7Bz$+)*;9) zrY=Bj&u#J!M*_BMJim=8|sf5-HRWhIoe@ zH5=5T;3Lf|Png1gF6p^M4PhkKA@|10j%j>^LAN7~dL(Jo5JqAhvRA87<0kOA!e$VN zTFXeIhARdCF`cExDW!)T)BIg){ee|3)->gz z5yv$DpT$u_7!rT|_qVLj4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FKu$K`*J|d`V&Z-eP ztF#iZvjR3VvS0q;09}90ZrY3D@9}(o7=FVzD d3|jB3{{S5(!0bgZks1I1002ovPDHLkV1h4n7pMRL diff --git a/Projectiles/Summon/WhiteDragonBody2.png b/Projectiles/Summon/WhiteDragonBody2.png index f25f076d0eff604c2e1c782fd21d7afd76245016..539499f742df34c6297c2e86b3d074964556d40a 100644 GIT binary patch literal 932 zcmV;V16%xwP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D135`VK~z{r?U-Lk zlTjGPH`fYN2ASyyQo5;(+_HkOXpYv*E^1dr$jY)JBJ{!tFGLVV7a@pcU1dQb64XW3 zO*ti7tRNNBqO6(873^9%DpY9jCvyx-Fe4i5*wj`o}20$~A@ zKVBk8Rv8LYMoBwVvE&H&Df|HwdiLBwJmvR+RA2KXSg}huN{6mr?Eon{Lk$l;2VV@0 zf)S-1iYlQ)%$?HQQgCV}j0tV_1`#U`d1u3*vE?gBhhD!GJ6^PA9Z1PJL@mgr*sn+e z(Mjz&lx*(E4pDM0vC7doPg5Ic-MkT$9V%G83PJGQSlor$w=c%HKL0Po+H=U2c?vWc za{ik;zPYDh?$J!pYApn-j=4cueO@u24pFRf`R3(Vz(nXX{;&J^!6^QI?$&}Upw0CK zq*E#9&?1GZia4V@#j5f5W6)#V0XhwW)r0LIcT!EPdU0|GqBG5H^@!b5>+dAdLT8z&EHdU$3QW6=u99O1gY_U57^Ku?qhj5 zm%wzDlRE{9=aQpUI>p|Ov8lqM%>jt9$0000o>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 diff --git a/Projectiles/Summon/WhiteDragonHead.cs b/Projectiles/Summon/WhiteDragonHead.cs index 573fbc0b5d..de7594ef8d 100644 --- a/Projectiles/Summon/WhiteDragonHead.cs +++ b/Projectiles/Summon/WhiteDragonHead.cs @@ -38,6 +38,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; Projectile.minionSlots = 2; + Projectile.minion = true; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; @@ -58,7 +59,45 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - Projectile.ChargingMinionAI(2000f, 2500f, 3200f, 300f, 0, 45f, 36f, 8f, new Vector2(0f, -60f), 12f, 12f, true, true, 1); + Projectile.ai[0]++; + // Hover to the right because light is right or something + Vector2 idealPos = new Vector2(player.Center.X + 200, player.Center.Y - 50); + float distanceFromOwner = Projectile.Distance(idealPos); + + NPC target = CalamityUtils.MinionHoming(Projectile.position, 2500, player, true, true); + if (target != null && Projectile.position.Distance(player.position) <= 2500) + { + AttackTarget(target); + } + else + { + float hoverAcceleration = 0.2f; + if (distanceFromOwner < 200f) + hoverAcceleration = 0.12f; + if (distanceFromOwner < 140f) + hoverAcceleration = 0.06f; + + if (distanceFromOwner > 100f) + { + if (Math.Abs(player.Center.X - Projectile.Center.X) > 20f) + Projectile.velocity.X += hoverAcceleration * Math.Sign(idealPos.X - Projectile.Center.X); + if (Math.Abs(player.Center.Y - Projectile.Center.Y) > 10f) + Projectile.velocity.Y += hoverAcceleration * Math.Sign(idealPos.Y - Projectile.Center.Y); + } + else if (Projectile.velocity.Length() > 1f) + Projectile.velocity *= 0.96f; + + if (Math.Abs(Projectile.velocity.Y) < 1f) + Projectile.velocity.Y -= 0.1f; + + if (Projectile.velocity.Length() > 25) + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 25; + } + + if (distanceFromOwner > 5000) + { + Projectile.Center = player.Center; + } Projectile.rotation = Projectile.velocity.ToRotation(); segments.Clear(); foreach (var projectile in Main.projectile) @@ -85,37 +124,56 @@ namespace CalamityMod.Projectiles.Summon segments[i].ModProjectile().SegmentMove(); } } - // Fly away from the black dragon - float pushForce = 0.1f; - for (int k = 0; k < Main.maxProjectiles; k++) + } + internal void AttackTarget(NPC target) + { + float idealFlyAcceleration = 0.18f; + + Vector2 destination = target.Center; + float distanceFromDestination = Projectile.Distance(destination); + + // Get a swerve effect if somewhat far from the target. + if (Projectile.Distance(destination) > 425f) { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || k == Projectile.whoAmI) - continue; + destination += (Projectile.ai[0] % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; + distanceFromDestination = Projectile.Distance(destination); + idealFlyAcceleration *= 2.5f; + } - // 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; + // Charge if the target is far away. + if (distanceFromDestination > 1500f) + idealFlyAcceleration = MathHelper.Min(6f, Projectile.ai[1] + 1f); - if (Projectile.position.Y < otherProj.position.Y) - Projectile.velocity.Y -= pushForce; - else - Projectile.velocity.Y += pushForce; - } + Projectile.ai[1] = MathHelper.Lerp(Projectile.ai[1], idealFlyAcceleration, 0.3f); + + float directionToTargetOrthogonality = Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), Projectile.SafeDirectionTo(destination)); + + // Fly towards the target if it's far. + if (distanceFromDestination > 320f) + { + float speed = Projectile.velocity.Length(); + if (speed < 23f) + speed += 0.08f; + + if (speed > 32f) + speed -= 0.08f; + + // Go faster if the line of sight is aiming closely at the target. + if (directionToTargetOrthogonality < 0.85f && directionToTargetOrthogonality > 0.5f) + speed += 16f; + + // And go slower otherwise so that the dragon can angle towards the target more accurately. + if (directionToTargetOrthogonality < 0.5f && directionToTargetOrthogonality > -0.7f) + speed -= 16f; + + speed = MathHelper.Clamp(speed, 16f, 34f); + + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(destination), Projectile.ai[1]).ToRotationVector2() * speed; } } 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; @@ -128,7 +186,7 @@ namespace CalamityMod.Projectiles.Summon 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); + Main.EntitySpriteDraw((i == 5 || i == 12) ? 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) { diff --git a/Projectiles/Summon/WhiteDragonHead.png b/Projectiles/Summon/WhiteDragonHead.png index d2674d99382dfffa169fbf7a2e876c1137dfba5a..214360df851f51cf16cbb2fa025d5a3d93820bb6 100644 GIT binary patch literal 1724 zcmeAS@N?(olHy`uVBq!ia0vp^20$Fc!3-qjUmcqQq!^2X+?^QKos)S9k`0|G&?8@!;kE|Nnu8jDpb+7>XgV$0`<>7Z@2z zg8YJkDS0FVhT!k)s=zqpEbxddW?U-|4{=5>F3*Rqq(W(6}WyuyX zO=9^={l?5kUw3^_Zjj&%xUr$0^~~o@o(GJJbOOA36m68=GB~cuXjoV6 za*Odz^^$%2V_GDxaDAE0a>h8FA?P}1Ci4xm8xt5~+h=}1&ANnFqje+O?DT~UEroh5 zWeRSyet!G*vCvBQG~Wr15|I!8_!yW37EjgQ%8>InweVeu)%>j`OdO(z?p|TI;L~<% z=jWM=l`f{}&S}kJzG1;*T9(4#D$lqfV9Lt3%^_b50!p+Mc2C${9jsXw%yD=^vGsvz zi7V}xYv&hp+s6w{kK8$3H&SFr}|x*N1;A;Yx?0vyR6+zo%rq>oS0 z2;qIk&&9!zCfz5caIDazLB9C8#tdVF)=83A8T-G@xw&S}#yQn1svJ~L=WVYHVe$#S zafNNglR}f~>x}|k$Amf=&)@uQrl9(K&+|eh1s2`~N>%>aBCGf$j^91!WO&Br+6@!S z`1LaaZ5azhOU(K?i9C)AUo}3T#>B`V$9!bRI)*y|3z8XS zO%m7=!kKw~d|Lb?J0Vt-g~9svJ%)9<0o(_~ldtT4Bg0r$ZF|7&U{}UNxej}~Paba> z(xO&6?D`$Kwn3>TKc7{C;f<8l-O4cA10Ea>zrIY(VicJ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xh>Wy-${{QgYkg75;G1I@sUzL1jfQ!zaPEC%1 G8UF$PuzU#s diff --git a/Projectiles/Summon/WhiteDragonTail.cs b/Projectiles/Summon/WhiteDragonTail.cs index 7eef32556b..da271ece5a 100644 --- a/Projectiles/Summon/WhiteDragonTail.cs +++ b/Projectiles/Summon/WhiteDragonTail.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.aiStyle = -1; Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; + Projectile.minion = true; } public override void AI() diff --git a/Projectiles/Summon/WhiteDragonTail.png b/Projectiles/Summon/WhiteDragonTail.png index fc63bd23bc4dd555be2d2cda158fd8cd7382c423..8ffd19d92f3b270c732509c9330bca8f92641bb9 100644 GIT binary patch literal 665 zcmV;K0%rY*P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0xn5JK~z{r?U=o5 z6LA>F@A5(jY77!%amgf@LA0odh@nW;cB)GUheGMrp?`rmNe3x*Xz3u$rUXZ~R+}N{ z5Q>O~26X5WmtrFHHO8Rk?DI{YaCzXGyWY9vmk)e+dXR8!zj>bDlhX~u(2hdab<}JA zd#LwAH&DO%8hGQA;B8#5{r!U)oZm(r8E(G*Tq2Ijd@q$-KQ(#!Y#H@s`W31P+_?O6 z0~dDjwQA2``wxl*&ciqLb%Ug2I341yKLEQyiOJN6OM@4oThvR4dWXCaO~7RMI*i^* zK}n%dg56lnzJ<)?t5={~)JuqaC;uaFkc&f)G*UuSjwc-<6JTh{nI~Q0<7em<>LnEN zg(3Hj74I5($p3LVhxjZqV>RWxN=m(iBK|W_GQ9EtGAZ9p=yY1i*T)B9I@!8(jCu)4 zW^%Jo_LSXCK~6bl4fNW-TrLL^N7zOyVJ^QquAZqhsQ;|gkBuX zLJ9X0Cu6sV{x?eZ5IB1xqLW{0A2f12bq6vJi<8i5my>w4Au#=fD%CxM%#Oa+ND226 zPcf@=N8)xvV0tbg+fRKaPPWgSjyKT$W`-wSZmxnV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mT90DD(&MlT33Q!3Wy_ O0000GYSv000AkNklp01IKR;`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 From 3e7eec106d120f9fdda3e5c78ef09257529e253d Mon Sep 17 00:00:00 2001 From: GinYuH Date: Sun, 4 Jun 2023 01:32:19 -0700 Subject: [PATCH 03/10] pushing this so i can go fix new tml stuff --- Projectiles/Summon/BlackDragonHead.cs | 85 ++++++++++++++++++++------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/Projectiles/Summon/BlackDragonHead.cs b/Projectiles/Summon/BlackDragonHead.cs index 0b86314ef3..390e27874b 100644 --- a/Projectiles/Summon/BlackDragonHead.cs +++ b/Projectiles/Summon/BlackDragonHead.cs @@ -63,38 +63,79 @@ namespace CalamityMod.Projectiles.Summon Vector2 idealPos = new Vector2(player.Center.X - 200, player.Center.Y - 50); float distanceFromOwner = Projectile.Distance(idealPos); + if (distanceFromOwner > 3000) + { + Projectile.Center = player.Center; + Projectile.netUpdate = true; + } + NPC target = CalamityUtils.MinionHoming(Projectile.position, 2500, player, true, true); if (target != null && Projectile.position.Distance(player.position) <= 2500) { - AttackTarget(target); + Vector2 targetDistance = target.Center - Projectile.Center; + (targetDistance.X > 0f).ToDirectionInt(); + (targetDistance.Y > 0f).ToDirectionInt(); + float speed = 0.3f; + if (targetDistance.Length() < 900f) + { + speed = 0.45f; + } + if (targetDistance.Length() < 600f) + { + speed = 0.6f; + } + if (targetDistance.Length() < 300f) + { + speed = 0.8f; + } + if (targetDistance.Length() > target.Size.Length() * 0.75f) + { + Projectile.velocity += Vector2.Normalize(targetDistance) * speed * 1.5f; + if (Vector2.Dot(Projectile.velocity, targetDistance) < 0.25f) + { + Projectile.velocity *= 0.8f; + } + } + if (Projectile.velocity.Length() > 50) + { + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 50; + } } else { - float hoverAcceleration = 0.2f; - if (distanceFromOwner < 200f) - hoverAcceleration = 0.12f; - if (distanceFromOwner < 140f) - hoverAcceleration = 0.06f; - - if (distanceFromOwner > 100f) + float speed = 0.2f; + Vector2 playerDistance = idealPos - Projectile.Center; + if (playerDistance.Length() < 200f) { - if (Math.Abs(player.Center.X - Projectile.Center.X) > 20f) - Projectile.velocity.X += hoverAcceleration * Math.Sign(idealPos.X - Projectile.Center.X); - if (Math.Abs(player.Center.Y - Projectile.Center.Y) > 10f) - Projectile.velocity.Y += hoverAcceleration * Math.Sign(idealPos.Y - Projectile.Center.Y); + speed = 0.12f; } - else if (Projectile.velocity.Length() > 1f) + if (playerDistance.Length() < 140f) + { + speed = 0.06f; + } + if (playerDistance.Length() > 100f) + { + if (Math.Abs(idealPos.X - Projectile.Center.X) > 20f) + { + Projectile.velocity.X = Projectile.velocity.X + speed * Math.Sign(idealPos.X - Projectile.Center.X); + } + if (Math.Abs(idealPos.Y - Projectile.Center.Y) > 10f) + { + Projectile.velocity.Y = Projectile.velocity.Y + speed * Math.Sign(idealPos.Y - Projectile.Center.Y); + } + } + else if (Projectile.velocity.Length() > 2f) + { Projectile.velocity *= 0.96f; - + } if (Math.Abs(Projectile.velocity.Y) < 1f) - Projectile.velocity.Y -= 0.1f; - - if (Projectile.velocity.Length() > 25) - Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 25; - } - if (distanceFromOwner > 5000) - { - Projectile.Center = player.Center; + { + Projectile.velocity.Y = Projectile.velocity.Y - 0.1f; + } + if (Projectile.velocity.Length() > 25f) + { + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 25f; + } } Projectile.rotation = Projectile.velocity.ToRotation(); From 0f8fa42c794aa58bd4f2ad8907eca4b4214cb70c Mon Sep 17 00:00:00 2001 From: GinYuH Date: Mon, 5 Jun 2023 02:52:14 -0700 Subject: [PATCH 04/10] failsafe --- Projectiles/Summon/BlackDragonHead.cs | 85 +++++++++------------------ Projectiles/Summon/WhiteDragonHead.cs | 18 ++++-- 2 files changed, 42 insertions(+), 61 deletions(-) diff --git a/Projectiles/Summon/BlackDragonHead.cs b/Projectiles/Summon/BlackDragonHead.cs index 390e27874b..038f766a92 100644 --- a/Projectiles/Summon/BlackDragonHead.cs +++ b/Projectiles/Summon/BlackDragonHead.cs @@ -72,70 +72,31 @@ namespace CalamityMod.Projectiles.Summon NPC target = CalamityUtils.MinionHoming(Projectile.position, 2500, player, true, true); if (target != null && Projectile.position.Distance(player.position) <= 2500) { - Vector2 targetDistance = target.Center - Projectile.Center; - (targetDistance.X > 0f).ToDirectionInt(); - (targetDistance.Y > 0f).ToDirectionInt(); - float speed = 0.3f; - if (targetDistance.Length() < 900f) - { - speed = 0.45f; - } - if (targetDistance.Length() < 600f) - { - speed = 0.6f; - } - if (targetDistance.Length() < 300f) - { - speed = 0.8f; - } - if (targetDistance.Length() > target.Size.Length() * 0.75f) - { - Projectile.velocity += Vector2.Normalize(targetDistance) * speed * 1.5f; - if (Vector2.Dot(Projectile.velocity, targetDistance) < 0.25f) - { - Projectile.velocity *= 0.8f; - } - } - if (Projectile.velocity.Length() > 50) - { - Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 50; - } + AttackTarget(target); } else { - float speed = 0.2f; - Vector2 playerDistance = idealPos - Projectile.Center; - if (playerDistance.Length() < 200f) + float hoverAcceleration = 0.2f; + if (distanceFromOwner < 200f) + hoverAcceleration = 0.12f; + if (distanceFromOwner < 140f) + hoverAcceleration = 0.06f; + + if (distanceFromOwner > 100f) { - speed = 0.12f; + if (Math.Abs(player.Center.X - Projectile.Center.X) > 20f) + Projectile.velocity.X += hoverAcceleration * Math.Sign(idealPos.X - Projectile.Center.X); + if (Math.Abs(player.Center.Y - Projectile.Center.Y) > 10f) + Projectile.velocity.Y += hoverAcceleration * Math.Sign(idealPos.Y - Projectile.Center.Y); } - if (playerDistance.Length() < 140f) - { - speed = 0.06f; - } - if (playerDistance.Length() > 100f) - { - if (Math.Abs(idealPos.X - Projectile.Center.X) > 20f) - { - Projectile.velocity.X = Projectile.velocity.X + speed * Math.Sign(idealPos.X - Projectile.Center.X); - } - if (Math.Abs(idealPos.Y - Projectile.Center.Y) > 10f) - { - Projectile.velocity.Y = Projectile.velocity.Y + speed * Math.Sign(idealPos.Y - Projectile.Center.Y); - } - } - else if (Projectile.velocity.Length() > 2f) - { + else if (Projectile.velocity.Length() > 1f) Projectile.velocity *= 0.96f; - } + if (Math.Abs(Projectile.velocity.Y) < 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y - 0.1f; - } - if (Projectile.velocity.Length() > 25f) - { - Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 25f; - } + Projectile.velocity.Y -= 0.1f; + + if (Projectile.velocity.Length() > 25) + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 25; } Projectile.rotation = Projectile.velocity.ToRotation(); @@ -167,6 +128,7 @@ namespace CalamityMod.Projectiles.Summon } internal void AttackTarget(NPC target) { + float idealFlyAcceleration = 0.18f; Vector2 destination = target.Center; @@ -175,6 +137,7 @@ namespace CalamityMod.Projectiles.Summon // Get a swerve effect if somewhat far from the target. if (Projectile.Distance(destination) > 425f) { + Projectile.ai[2] = 0; destination += (Projectile.ai[0] % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; distanceFromDestination = Projectile.Distance(destination); idealFlyAcceleration *= 2.5f; @@ -209,6 +172,14 @@ namespace CalamityMod.Projectiles.Summon speed = MathHelper.Clamp(speed, 16f, 34f); Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(destination), Projectile.ai[1]).ToRotationVector2() * speed; + + // failsafe to prevent orbiting + Projectile.ai[2]++; + if (Projectile.ai[2] >= 90) + { + Projectile.velocity = Projectile.DirectionTo(destination) * 30; + Projectile.ai[2] = 0; + } } } diff --git a/Projectiles/Summon/WhiteDragonHead.cs b/Projectiles/Summon/WhiteDragonHead.cs index de7594ef8d..230dcc11ef 100644 --- a/Projectiles/Summon/WhiteDragonHead.cs +++ b/Projectiles/Summon/WhiteDragonHead.cs @@ -64,6 +64,11 @@ namespace CalamityMod.Projectiles.Summon Vector2 idealPos = new Vector2(player.Center.X + 200, player.Center.Y - 50); float distanceFromOwner = Projectile.Distance(idealPos); + if (distanceFromOwner > 5000) + { + Projectile.Center = player.Center; + } + NPC target = CalamityUtils.MinionHoming(Projectile.position, 2500, player, true, true); if (target != null && Projectile.position.Distance(player.position) <= 2500) { @@ -94,10 +99,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 25; } - if (distanceFromOwner > 5000) - { - Projectile.Center = player.Center; - } Projectile.rotation = Projectile.velocity.ToRotation(); segments.Clear(); foreach (var projectile in Main.projectile) @@ -135,6 +136,7 @@ namespace CalamityMod.Projectiles.Summon // Get a swerve effect if somewhat far from the target. if (Projectile.Distance(destination) > 425f) { + Projectile.ai[2] = 0; destination += (Projectile.ai[0] % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; distanceFromDestination = Projectile.Distance(destination); idealFlyAcceleration *= 2.5f; @@ -169,6 +171,14 @@ namespace CalamityMod.Projectiles.Summon speed = MathHelper.Clamp(speed, 16f, 34f); Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(destination), Projectile.ai[1]).ToRotationVector2() * speed; + + // failsafe to prevent orbiting + Projectile.ai[2]++; + if (Projectile.ai[2] >= 90) + { + Projectile.velocity = Projectile.DirectionTo(destination) * 30; + Projectile.ai[2] = 0; + } } } From 13544d77086b1ab102acb96ac87d68780b710b7e Mon Sep 17 00:00:00 2001 From: GinYuH Date: Wed, 7 Jun 2023 00:56:23 -0700 Subject: [PATCH 05/10] Added Deepcore GK2 --- Items/Weapons/Ranged/DeepcoreGK2.cs | 51 ++++++++++++++++++ Items/Weapons/Ranged/DeepcoreGK2.png | Bin 0 -> 1478 bytes ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 9 ++++ NPCs/CalamityGlobalTownNPC.cs | 1 + Projectiles/CalamityGlobalProjectile.cs | 9 ++++ 5 files changed, 70 insertions(+) create mode 100644 Items/Weapons/Ranged/DeepcoreGK2.cs create mode 100644 Items/Weapons/Ranged/DeepcoreGK2.png diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs new file mode 100644 index 0000000000..7d4d37a41e --- /dev/null +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -0,0 +1,51 @@ +using Terraria.DataStructures; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class DeepcoreGK2 : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetDefaults() + { + Item.damage = 45; + Item.ArmorPenetration = 20; + Item.DamageType = DamageClass.Ranged; + Item.noMelee = true; + Item.width = 142; + Item.height = 64; + Item.useTime = Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 7f; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item38; + Item.autoReuse = true; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Bullet; + } + + public override Vector2? HoldoutOffset() => new Vector2(-20, 0); + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Vector2 shootDirection = velocity.SafeNormalize(Vector2.UnitX * player.direction); + Vector2 gunTip = position + shootDirection * Item.scale * 120f; + gunTip.Y -= 18f; + + int p = Projectile.NewProjectile(source, gunTip, velocity, type, damage, knockback, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].Calamity().deepcoreBullet = true; + Main.projectile[p].scale = 222; + Main.projectile[p].tileCollide = false; + } + return false; + } + } +} diff --git a/Items/Weapons/Ranged/DeepcoreGK2.png b/Items/Weapons/Ranged/DeepcoreGK2.png new file mode 100644 index 0000000000000000000000000000000000000000..e651e6d6fab9ca48220d344766ca8b99b1e51d40 GIT binary patch literal 1478 zcmV;%1v&bOP)+$^7pZ$Hd=ji6<=IAjhO5b-s zlDc$9+GP6l`O82kKkMS+;;t{;SMPqaY4Z9vI0omx1gERKz3NqL5`(0!J3l{9TIxK2 z;d1xNnS}e``!P5M$KcGNH&31KNn1b9pDQrYgW)`$Luo!h z;qwN^;7kLKDu5bJDo2%)8m1!u^73O+R4xXF&vQkORR`}t$Y)ctwv>bL*Y7_^_hKMh z^9_!{83&H)Ty|zFsdO0GHD^^S{oc-OCE>w!W-AHj`N7U5l!MEIdgA&6V9KF4)#vbF zRp%S^&BOWH{09?ha12fpIMFZ`6%rK;O{H>FDXAtF`JLHH;`4t$yh>8#;wGG%Tn3<2 zC=V+FXer@-Q4REhFhbxp#&D0@-wL8sR zAE;OEDzxSs9D_3rII1AE;Pg6I>}X2)5jeZuE-O@oIuEhwRNyGnGgiuUE!A08e=M$N zHK>X54UWMX2Ts)Vm4d@y@DFpo`kts9rRC*g4CAK;=lc5FKnkFx6q)iUWYG%|@v#3P zSZZ(#&ivq%y671c21Z>sm+62oj8_l5Rkyc42SWZ@;FJQy%77!2!7(`NgQHyG+%%S6 zKXtGY;PCIMa!i%ajj8Shyb4}f2+boKAvito8V_~49@)EL`!PbVgL_00{Z&d#1`q zJ=Jz%#~!z8HdAGA49)t_*n!3_{74Ksz$pzisB)D`0nGp@0HTmdbQ~?SQOj#i&&^QJ#SVmJCVi+5WP#`MDW+_mm$F+{r)=dix zj=^aIXRb{HN=+1+bTy2{^(Vu!r&O3ZGeN+ zRc2DDiBjN{nyA_eD_!zi3tYxD!3~k!EC7QLxG8FnBL{0H)H6+2#NZg5O@b4dC92Pje;dr()yC*m~Nrl2xVCgZN4izd;;M7j%;N?MwVxkO=!Pz!A5FA&S zw$bVWpDN^`HcVom0Dzi~f$!sqQat?b-M7IpI0k3-mqTQNl(RUf_(f-IqIfGg27%8j zVAz4Frf43Ti843_=W)DtXsMTtFgVdv)oAKxWTM#AmO3;Ij=?cFhaj~KhfPrJBzOi( zy{cgDPQSr1I0k2n;Bd&Jbi?ilC^k{NtZ1t*jx#t0$KcEf&Yl<64}z|xK(z)d4+Rv1 zV{i;k2{=l%KpkqZ(%={zgENPt5y940pbmX_ZEy_EBKikR1b7_~+Pez?000hUSV?A0 gO#mtY000O800000007cclK=n!07*qoM6N<$g7Oif+5i9m literal 0 HcmV?d00001 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index c855c69ff1..5109ce8d17 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -347,6 +347,15 @@ DarkechoGreatbow: { ''' } +DeepcoreGK2: { + DisplayName: Deepcore GK2 + Tooltip: + ''' + Ignores 20 points of enemy defense and up to 10% damage reduction + 'For rock and stone!' + ''' +} + Deathwind: { DisplayName: Deathwind Tooltip: diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index d1b33d55dc..af1f3402dd 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1592,6 +1592,7 @@ namespace CalamityMod.NPCs .AddWithCustomValue(ItemID.SpelunkerPotion, Item.buyPrice(gold: 4), potionSells, Condition.HappyEnough, Condition.DownedEowOrBoc) .AddWithCustomValue(ItemID.ObsidianSkinPotion, Item.buyPrice(gold: 4), potionSells, Condition.HappyEnough, Condition.DownedSkeletron); AddScalingPotion(ref shop, ItemID.EndurancePotion, Condition.DownedSkeletron); + shop.Add(ModContent.ItemType(), Condition.DownedMechBossAny); } if (type == NPCID.ArmsDealer) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index f00384285c..e9cf99cb27 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -70,6 +70,9 @@ namespace CalamityMod.Projectiles // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; + // If true, this projectile breaks through 10% of enemy DR + public bool deepcoreBullet = false; + // Amount of extra updates that are set in SetDefaults. public int defExtraUpdates = -1; @@ -2512,6 +2515,12 @@ namespace CalamityMod.Projectiles if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); + if (deepcoreBullet && !(modifiers.SuperArmor || target.defense > 999 || target.Calamity().DR >= 0.95f || target.Calamity().unbreakableDR)) + { + //Bypassup to DR + modifiers.FinalDamage /= 1f - MathHelper.Clamp(target.Calamity().DR, 0, 0.1f); + } + if (modPlayer.farProximityRewardEnchant) { float proximityDamageInterpolant = Utils.GetLerpValue(250f, 2400f, target.Distance(player.Center), true); From bb30e7c5516999275927bce93a1070230bce2d75 Mon Sep 17 00:00:00 2001 From: GinYuH Date: Wed, 7 Jun 2023 19:41:18 -0700 Subject: [PATCH 06/10] sparks --- Items/Weapons/Ranged/DeepcoreGK2.cs | 6 +++--- Projectiles/CalamityGlobalProjectile.cs | 27 ++++++++++++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index 7d4d37a41e..da0dc44192 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { Item.damage = 45; - Item.ArmorPenetration = 20; + Item.ArmorPenetration = 15; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; Item.width = 142; @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Bullet; + Item.Calamity().donorItem = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); @@ -42,8 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().deepcoreBullet = true; - Main.projectile[p].scale = 222; - Main.projectile[p].tileCollide = false; + Main.projectile[p].scale = 2; } return false; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index e9cf99cb27..59ab5e7f3e 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -7,6 +7,7 @@ using CalamityMod.EntitySources; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.NPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; - // If true, this projectile breaks through 10% of enemy DR + // If true, this projectile creates impact sparks upon hitting enemies public bool deepcoreBullet = false; // Amount of extra updates that are set in SetDefaults. @@ -2515,12 +2516,6 @@ namespace CalamityMod.Projectiles if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); - if (deepcoreBullet && !(modifiers.SuperArmor || target.defense > 999 || target.Calamity().DR >= 0.95f || target.Calamity().unbreakableDR)) - { - //Bypassup to DR - modifiers.FinalDamage /= 1f - MathHelper.Clamp(target.Calamity().DR, 0, 0.1f); - } - if (modPlayer.farProximityRewardEnchant) { float proximityDamageInterpolant = Utils.GetLerpValue(250f, 2400f, target.Distance(player.Center), true); @@ -2541,6 +2536,24 @@ namespace CalamityMod.Projectiles if (!WorldUtils.Find(projectile.Center.ToTileCoordinates(), Searches.Chain(new Searches.Down(12), new Conditions.IsSolid()), out _)) modifiers.SourceDamage /= 1.5f; } + + // create sparks on hit to hammer in the defense shredding + if (deepcoreBullet) + { + if (Main.netMode != NetmodeID.Server) + { + Vector2 cen = Vector2.Lerp(projectile.Center, target.Center, 0.65f); + int numSparks = Main.rand.Next(2, 5); + for (int i = 0; i < numSparks; i++) + { + Vector2 sparkVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(2f, 8f); + Color sparkColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.7f)); + sparkColor = Color.Lerp(sparkColor, Color.Orange, Main.rand.NextFloat()); + SparkParticle sparke = new(cen, -sparkVelocity, false, 10, 0.5f, sparkColor); + GeneralParticleHandler.SpawnParticle(sparke); + } + } + } } #endregion From 32943fdbb0018364692d90bc5b3f33fffe2be0bc Mon Sep 17 00:00:00 2001 From: GinYuH Date: Wed, 7 Jun 2023 19:44:36 -0700 Subject: [PATCH 07/10] tooltip update --- Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 5109ce8d17..dcd5b80bc6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -351,7 +351,7 @@ DeepcoreGK2: { DisplayName: Deepcore GK2 Tooltip: ''' - Ignores 20 points of enemy defense and up to 10% damage reduction + Bullets are twice as large and ignores 15 points of enemy defense 'For rock and stone!' ''' } From 9c9c56aac2006232db04629187f4db3385583648 Mon Sep 17 00:00:00 2001 From: GinYuH Date: Wed, 7 Jun 2023 20:11:19 -0700 Subject: [PATCH 08/10] blue sparks (donor request) --- Projectiles/CalamityGlobalProjectile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 59ab5e7f3e..6be524fa4e 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2547,8 +2547,8 @@ namespace CalamityMod.Projectiles for (int i = 0; i < numSparks; i++) { Vector2 sparkVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(2f, 8f); - Color sparkColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.7f)); - sparkColor = Color.Lerp(sparkColor, Color.Orange, Main.rand.NextFloat()); + Color sparkColor = Color.Lerp(Color.AliceBlue, Color.DarkSlateBlue, Main.rand.NextFloat(0.7f)); + sparkColor = Color.Lerp(sparkColor, Color.CornflowerBlue, Main.rand.NextFloat()); SparkParticle sparke = new(cen, -sparkVelocity, false, 10, 0.5f, sparkColor); GeneralParticleHandler.SpawnParticle(sparke); } From 7475cde32d5852e569b5f870580c53fcab6a57d7 Mon Sep 17 00:00:00 2001 From: GinYuH Date: Wed, 7 Jun 2023 20:23:50 -0700 Subject: [PATCH 09/10] point blank --- Items/Weapons/Ranged/DeepcoreGK2.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index da0dc44192..ab7b26c421 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); From 6c4328e26703203c7deb6f973955edd88faec61c Mon Sep 17 00:00:00 2001 From: GinYuH <> Date: Fri, 9 Jun 2023 18:10:16 -0700 Subject: [PATCH 10/10] new strings for tenryu --- Items/Weapons/Summon/KingofConstellationsTenryu.cs | 2 +- Projectiles/Summon/BlackDragonBody.cs | 2 +- Projectiles/Summon/BlackDragonHead.cs | 2 +- Projectiles/Summon/BlackDragonTail.cs | 2 +- Projectiles/Summon/WhiteDragonBody.cs | 2 +- Projectiles/Summon/WhiteDragonHead.cs | 2 +- Projectiles/Summon/WhiteDragonTail.cs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index a5f2e86525..1630c5da10 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Summon { public class KingofConstellationsTenryu : ModItem, ILocalizedModType { - public string LocalizationCategory => "Items.Weapons.Summon"; + public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { diff --git a/Projectiles/Summon/BlackDragonBody.cs b/Projectiles/Summon/BlackDragonBody.cs index 681a53a990..ba5906b4e2 100644 --- a/Projectiles/Summon/BlackDragonBody.cs +++ b/Projectiles/Summon/BlackDragonBody.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Summon { public class BlackDragonBody : ModProjectile, ILocalizedModType { - public string LocalizationCategory => "Projectiles.Summon"; + public new string LocalizationCategory => "Projectiles.Summon"; public int segmentIndex = 1; public override void SetStaticDefaults() diff --git a/Projectiles/Summon/BlackDragonHead.cs b/Projectiles/Summon/BlackDragonHead.cs index 038f766a92..6b8a7ea608 100644 --- a/Projectiles/Summon/BlackDragonHead.cs +++ b/Projectiles/Summon/BlackDragonHead.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon // HUGE credit to Dozezoze for lending his worm projectile code public class BlackDragonHead : ModProjectile, ILocalizedModType { - public string LocalizationCategory => "Projectiles.Summon"; + public new string LocalizationCategory => "Projectiles.Summon"; Dictionary segments = new Dictionary(); public override void SetStaticDefaults() { diff --git a/Projectiles/Summon/BlackDragonTail.cs b/Projectiles/Summon/BlackDragonTail.cs index 2876a13653..c995b595d4 100644 --- a/Projectiles/Summon/BlackDragonTail.cs +++ b/Projectiles/Summon/BlackDragonTail.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Summon { public class BlackDragonTail : ModProjectile, ILocalizedModType { - public string LocalizationCategory => "Projectiles.Summon"; + public new string LocalizationCategory => "Projectiles.Summon"; public int segmentIndex = 1; public override void SetStaticDefaults() diff --git a/Projectiles/Summon/WhiteDragonBody.cs b/Projectiles/Summon/WhiteDragonBody.cs index 2f4956d23f..97571df41b 100644 --- a/Projectiles/Summon/WhiteDragonBody.cs +++ b/Projectiles/Summon/WhiteDragonBody.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Summon { public class WhiteDragonBody : ModProjectile, ILocalizedModType { - public string LocalizationCategory => "Projectiles.Summon"; + public new string LocalizationCategory => "Projectiles.Summon"; public int segmentIndex = 1; public override void SetStaticDefaults() diff --git a/Projectiles/Summon/WhiteDragonHead.cs b/Projectiles/Summon/WhiteDragonHead.cs index 230dcc11ef..b9ef8df47b 100644 --- a/Projectiles/Summon/WhiteDragonHead.cs +++ b/Projectiles/Summon/WhiteDragonHead.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon // HUGE credit to Dozezoze for lending his worm projectile code public class WhiteDragonHead : ModProjectile, ILocalizedModType { - public string LocalizationCategory => "Projectiles.Summon"; + public new string LocalizationCategory => "Projectiles.Summon"; Dictionary segments = new Dictionary(); public override void SetStaticDefaults() diff --git a/Projectiles/Summon/WhiteDragonTail.cs b/Projectiles/Summon/WhiteDragonTail.cs index da271ece5a..f1850eb66a 100644 --- a/Projectiles/Summon/WhiteDragonTail.cs +++ b/Projectiles/Summon/WhiteDragonTail.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Summon { public class WhiteDragonTail : ModProjectile, ILocalizedModType { - public string LocalizationCategory => "Projectiles.Summon"; + public new string LocalizationCategory => "Projectiles.Summon"; public int segmentIndex = 1; public override void SetStaticDefaults()