From fbfd3149e572bc18dae3966c7b5b3748ae2a561b Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 9 Mar 2020 20:08:40 -0400 Subject: [PATCH 1/2] umbrella/hat and cleaning up some Dom crap --- Buffs/FuelCellBundleSummon.png | Bin 1467 -> 0 bytes Buffs/Summon/MagicHatBuff.cs | 36 +++ Buffs/Summon/MagicHatBuff.png | Bin 0 -> 509 bytes Items/Weapons/Summon/BensUmbrella.cs | 91 ++++++ Items/Weapons/Summon/BensUmbrella.png | Bin 0 -> 1198 bytes Items/Weapons/Summon/CorvidHarbringerStaff.cs | 4 +- Items/Weapons/Summon/CosmicImmaterializer.cs | 2 +- Items/Weapons/Summon/RadiantResolution.cs | 2 +- Projectiles/Summon/MagicAxe.cs | 271 ++++++++++++++++ Projectiles/Summon/MagicAxe.png | Bin 0 -> 555 bytes Projectiles/Summon/MagicBat.cs | 56 ++++ Projectiles/Summon/MagicBat.png | Bin 0 -> 454 bytes Projectiles/Summon/MagicBird.cs | 145 +++++++++ Projectiles/Summon/MagicBird.png | Bin 0 -> 2076 bytes Projectiles/Summon/MagicBullet.cs | 58 ++++ Projectiles/Summon/MagicBullet.png | Bin 0 -> 130 bytes Projectiles/Summon/MagicHammer.cs | 165 ++++++++++ Projectiles/Summon/MagicHammer.png | Bin 0 -> 586 bytes Projectiles/Summon/MagicHat.cs | 178 +++++++++++ Projectiles/Summon/MagicHat.png | Bin 0 -> 502 bytes Projectiles/Summon/MagicRifle.cs | 235 ++++++++++++++ Projectiles/Summon/MagicRifle.png | Bin 0 -> 604 bytes Projectiles/Summon/MagicUmbrella.cs | 298 ++++++++++++++++++ Projectiles/Summon/MagicUmbrella.png | Bin 0 -> 493 bytes 24 files changed, 1537 insertions(+), 4 deletions(-) delete mode 100644 Buffs/FuelCellBundleSummon.png create mode 100644 Buffs/Summon/MagicHatBuff.cs create mode 100644 Buffs/Summon/MagicHatBuff.png create mode 100644 Items/Weapons/Summon/BensUmbrella.cs create mode 100644 Items/Weapons/Summon/BensUmbrella.png create mode 100644 Projectiles/Summon/MagicAxe.cs create mode 100644 Projectiles/Summon/MagicAxe.png create mode 100644 Projectiles/Summon/MagicBat.cs create mode 100644 Projectiles/Summon/MagicBat.png create mode 100644 Projectiles/Summon/MagicBird.cs create mode 100644 Projectiles/Summon/MagicBird.png create mode 100644 Projectiles/Summon/MagicBullet.cs create mode 100644 Projectiles/Summon/MagicBullet.png create mode 100644 Projectiles/Summon/MagicHammer.cs create mode 100644 Projectiles/Summon/MagicHammer.png create mode 100644 Projectiles/Summon/MagicHat.cs create mode 100644 Projectiles/Summon/MagicHat.png create mode 100644 Projectiles/Summon/MagicRifle.cs create mode 100644 Projectiles/Summon/MagicRifle.png create mode 100644 Projectiles/Summon/MagicUmbrella.cs create mode 100644 Projectiles/Summon/MagicUmbrella.png diff --git a/Buffs/FuelCellBundleSummon.png b/Buffs/FuelCellBundleSummon.png deleted file mode 100644 index e210f873f1403775f471fc5d26b6c98039b6c4ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1467 zcmai!eNfT|7{`BY>h~`TsLZ()>`9_8%Na;EgQz;@% z%a-pA#eBgeJ<*iBz%9)L_|k_wrkrT&-1`&S@=M#3B&>d z0Dy^)w--UL2z^a%Fw}SXU`&Z#KokPj1K{=UngIZCvX7Vhk12QO?&8kuir)T=aq85B z_1nfhg%7s1_RWUHiPz_vj0`M0r}luTYw>DwNe!Q zCMru+@@Q=3o#&2rozYGJGuAq+vc_>RQPMl!L{?IzTMEjFk*x9MPE1+>jQ2_<$iJ`Y z*6T~nTM(7YCxklFcD@3Y%0eLtzC&1d(O6U|s9m{u0smo`6lc^;P>S;NKnd!h7fVhE zhPK}nsElv{eX5P3o13@1eS5{MJFpdW9);Ljc0JM#UAerh*47G*<@w0tbTBlPVoU+5 zYirggEOx3dujD|FC2|j0j^bsX+&=s+P<7NPcf$8>%e8#2XKCyWiRkc$3@A0_tmT#h zd;5C^X8`u_65!ot(KpgJ=c6|ouPEp{EDg)e!=6dh=+ zHR|JX(xVOH4+@ulIu}8G-{*1lFgE@rr6)j_D@HjTJy<%I(y(!S=3%fRhm)#$^%(TW zSr~3~*|Ciy-qzctaD(|jaAe_*|HKmB6~c67DB0-nt!nxq$$N+zWM2E>bPs}+ULs%gluXP zY~A>3MovA($Iw&eldk0;!!Ckt2x8H>yrVLo^TY#jn#&$c4+S-d)X~g;#;tFF_p(RA zHO`2TiZe23PfTI<)taFAYE0%eiKq;-V>gUJM>Y#t^&jc-QZh3%>*%zPSdXx^tb5QS z8q2Ynq23FpgO8~MM^t1(&4xXbFUsbv9)?SM&cpF>wCRiza?D5r-&mka(iqoQtamoy zgzOWbb4Te(eB;x0a+p17BZrbtYL?t@{|bGB^fNovGxX!==3tuRFHot;$^RKuR>2rt zr07fe%Ig0J_DgGj>R{)*SB@22H|7spSSPO}i|3fb!i-CUzu6dtkUV#g@=5R`V&~n1 zrMVJUXY^VXCiY(5D9Sf1S%0f_68mb)1?+SmNHA^J80OEH%TWbPSNd_A)yTd(>NQ}% zlK-+W>fvrm-A%_f9cX(dCTrDOG^Ss&XD?Jz`DXf9&67hA2$C&k-=fD`^AGl`W2}q% zs%Qmyy&+fTEF3gR#|LEgp(hN6Rd?USo-Bq37b2PnB!30I&GJr#d-$sPm34JgHUZy7 znp3R&j9(A-Bc}C#bU*@4jxcaMZM?_$hcz^#gJKNjwWVhSvyw`aG~LvIZ%1VI9sdZ9 cx>&RZ()] > 0) + { + modPlayer.magicHat = true; + } + if (!modPlayer.magicHat) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/MagicHatBuff.png b/Buffs/Summon/MagicHatBuff.png new file mode 100644 index 0000000000000000000000000000000000000000..fb326780749e21887184d1c9b25da11158f205b1 GIT binary patch literal 509 zcmVPx$w@E}nR9J=OS3OSxK@fds2!&Dzi5Ddl=#_@T#Dc`uP+<56)>``$?Ch*9O|-SK zvnQc2F@#`ukpj^`0u(?&qs84jv*XQCn7}5!Wa1df6Q~bgbF`aZA09ae* zkH*0v^GczXxY3_?005tpQR2SotZR%tw-mJLqA~x}eFR{E0x4}lW4xWo0{G1+LhisA zk||uoerKNolDWoskx!g?Ct)w}Eh^y^Y*&Dcj>KI`#?sq~MbRW-j{^1K3jm$D-)|)v zx+t9+vf;0N|xeAEGZ1D_6jgb%69{qCM&X__^cb zYSUP6HZP5R5>X~(G=z%Sqkue_1igAMyldWZ2?KP-{X$Mu)6u{t9~)&|X8% zt5tCbEgJ021BAwWkuQ*`%#4J+Zvi|1_TTY0{;I#O4%}4300000NkvXXu0mjf)Mn!! literal 0 HcmV?d00001 diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs new file mode 100644 index 0000000000..274185f0ee --- /dev/null +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -0,0 +1,91 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class BensUmbrella : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ben's Umbrella"); + Tooltip.SetDefault("Surprisingly sturdy, I reckon this could defeat the Mafia in a single blow\n" + + "Summons a magic hat to hover above your head\n" + + "The hat will release a variety of objects to assault your foes\n" + + "Requires 5 minion slots to use\n" + + "There can only be one"); + } + + public override void SetDefaults() + { + item.mana = 99; + item.damage = 3001; + item.useStyle = 1; + item.width = 74; + item.height = 72; + item.useTime = 36; + item.useAnimation = 36; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.Calamity().postMoonLordRarity = 16; + item.rare = 10; + item.UseSound = SoundID.Item68; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) + { + return false; + } + } + return true; + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + for (int x = 0; x < Main.projectile.Length; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.owner == player.whoAmI && projectile.type == type) + { + projectile.Kill(); + } + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Umbrella); + recipe.AddIngredient(ItemID.TopHat); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/BensUmbrella.png b/Items/Weapons/Summon/BensUmbrella.png new file mode 100644 index 0000000000000000000000000000000000000000..8d9a67b7e050aa1cef85719ac83bf1792841d22b GIT binary patch literal 1198 zcmV;f1X25mP)Px(Xh}ptRA_g%Tk_n+O6zzyMNVfC&cFp%Ps{ zA_HQogcuMK>Vy~==+3}EH--`k1_~7|s0pf6nW})AMrr_)qNdcvabkv-zwP&OFL!oK z47vL)$-R3%pZxRp-uu3L4%lW)4($hES1t>{&2pvMc)n}vZ>h6nJADJK(w~1kw0)&} z1%R97TUCJJJNf{a`{O#0K*K?&Zy*Yv$?Wa{04mq6R>RJ}GHzU+Dl7r8E0+x*HQYIT zCcB6C0kAxGG1O%L!B+w3nivP*p^sk&;LCXv%Oia&0YGN?mg(2FJN}>0F~hFWD3kf4 zA2oIT;<4BCZve1ZJPjn!@RrTPQAU^NE&_Fvg9iq!{`0f**0JyW>baQ>?;|zbE?lFJ zj+;^P%*@V~jEbm!i_^ye$nG8p04mq6TIW;4n?+`Cf9weW{`~gqD!`eUod8_==Caj) zDmMzi_a}Z1y`GHj*_*T4&%Sj6sL#JHGON*9q=s8XX7@bv6aWifd{qTF@X2QYd^+@? z)&Hd{=K+|XwaxmB3g0&&YIGK<;bw7TR%W03ZrbWM#gEpp%(_NDEZ-m6U&y2zyHTUF zNDa4&Mq|Zn6c4{Ry5V`57L)J17wfvd(OIO1>9o80h8U_xNttSiYT+H3#;;=SamBAI*u|cd}dwZ#%}Gpv3hMI!eY1z zaN~l>SAA<^w@RqLbDnI*9i?5fzRHEm;gcqI$NEbFKw+^b*6V8T(^T(mK<&vxLkx$m zoT4fb!mUU|)sLghy7R48Rya=-;*uK9jZFYhE}XMW$2Bb66_>Bh?89d^clT%jQ2y0? zlTyPGtb2MGlIMojsN&|kQT1ct%WKQL({%YT?U%HfvTS&agKh)+egHi+?Scs$|Lej9jxa zIeg>=t6ghsna%X&16ZF=H=F%5OKMoiY`%A`%TlQd@bsYByQooHxcjAqR#>(6wa}N@ zf6Jtg)Ua!|xMcPlKRMP5z^Q`Sl{(PV69D|yeHQ?W)5p!Tr6cj?=}wV6!!jy%WHUgR zS+grO-)nZIvQz@rkFv8bKM(k0y3-`jFl!YK@pr}SLe)-k#jMO0mns09z48NKt;hnX z?_*X>=O;`)t-X)k!}|iLKW*G<5@$G=9NKUFHsGE+jc~>6j%+4?x_O!P;j5f9z9($` z{3{Y?xHb>V?B(C>1S+msQOl(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 9eabdb1c34..edf411b7e8 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Summon/RadiantResolution.cs b/Items/Weapons/Summon/RadiantResolution.cs index c475dbcb74..114a10c885 100644 --- a/Items/Weapons/Summon/RadiantResolution.cs +++ b/Items/Weapons/Summon/RadiantResolution.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon item.damage = 555; item.knockBack = 3f; item.autoReuse = true; - item.useTime = item.useAnimation = 40; + item.useTime = item.useAnimation = 36; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs new file mode 100644 index 0000000000..f3f1be5dbc --- /dev/null +++ b/Projectiles/Summon/MagicAxe.cs @@ -0,0 +1,271 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MagicAxe : ModProjectile + { + private int counter = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Axe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 52; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0; + projectile.timeLeft = 180; + projectile.penetrate = -1; + projectile.minion = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.alpha = 255; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + projectile.rotation += 0.075f; + projectile.alpha -= 50; + float num634 = 1200f; + float num635 = 2500f; + float num637 = 0.05f; + for (int num638 = 0; num638 < Main.projectile.Length; num638++) + { + bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + if (projectile.ai[1] <= 30) + { + projectile.ai[1]++; + return; + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + counter += 1; + projectile.extraUpdates = 4; + if (counter > 30) + { + counter = 1; + projectile.ai[0] = 0f; + projectile.extraUpdates = 1; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + float homingRange = 700f; + bool homeIn = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < homingRange) || !homeIn) + { + homingRange = num646; + vector46 = npc.Center; + homeIn = true; + } + } + } + else + { + for (int num645 = 0; num645 < Main.npc.Length; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < homingRange) || !homeIn) + { + homingRange = num646; + vector46 = nPC2.Center; + homeIn = true; + } + } + } + } + float num647 = num634; + if (homeIn) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (homeIn && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 24f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 12f; //4 + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 + } + } + else + { + bool flag26 = false; + float num636 = 400f; + if (!flag26) + { + flag26 = projectile.ai[0] == 1f; + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float playerDist = vector48.Length(); + if (playerDist > 200f && num650 < 8f) + { + num650 = 8f; + } + if (playerDist < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDist > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (counter > 0) + { + counter += Main.rand.Next(1, 4); + } + if (counter > 30) + { + counter = 0; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (counter == 0 && homeIn && homingRange < 500f) + { + counter += 1; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 16f; //8 + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 255, 111, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/MagicAxe.png b/Projectiles/Summon/MagicAxe.png new file mode 100644 index 0000000000000000000000000000000000000000..4790f40a3f3a51e86d54c1eec23eb3e57393cd9d GIT binary patch literal 555 zcmV+`0@VG9P)Px$Pl$iP=+=9=bm0X&jXTfaz1(Ub0gRDZ%zPPWL4JZn zdw3foO(Usibyt_+&Dn0Z0EA(f0{Fgfvg2VG0&qMY0r=|m?Rvm_)q{7t-P7?XiU7FX zZop%tg~nH_l`f?Kr_%|5$z);x*6TIkpdnLzOEU`0q|feGq?gO30hmsw0POdB05+Qq z0C60rkTaE=uiSFZ(93d&3NymajVOw8IdQ+=Yt0XW02mCtp7Z&f0xT8_18})q3UkLs z`_y2lDar{&UXj-7By`=*so88+>vuG7FjSWy2nVOPmjt5jDwXQ=ZW z(he{BG9v~JkKF^Jp?LS>H7%D^Opd?9v$H*s1VgN>?5!p{_R^?U5{9wq& zKB11sV>{yJ_c{RA>lG-^v9>sSVr^Y1)aV@)K3h3fV6qj?_Y@i%YHCK^o6NjU&8ROI z$1&ibq1vllTQfFgC)g_NT**`Gb!W7SJgK$b+Kh0|kli=aj;!xGY3e-lu4aULhU{9(Hl-c?a5(h)W-W2g tP}zX0TGdXUg8PQ-+$pPS-xcQ!eFLVB+?*|@{LlaZ002ovPDHLkV1huk0jvN3 literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/MagicBat.cs b/Projectiles/Summon/MagicBat.cs new file mode 100644 index 0000000000..ed58a72851 --- /dev/null +++ b/Projectiles/Summon/MagicBat.cs @@ -0,0 +1,56 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MagicBat : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baseball Bat"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 150; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(80, 200, 120, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/MagicBat.png b/Projectiles/Summon/MagicBat.png new file mode 100644 index 0000000000000000000000000000000000000000..b574ad075385cd427d07ae4454eba3f78284a9b3 GIT binary patch literal 454 zcmV;%0XhDOP)Px$fJsC_RA_pB2}Ah^$Y zon)NIR!QQiSrWsXh-q6%C?~SEttFHbS=zfK+&Z$fcS&?z=K=J64>*zO-X+0c%-8D` za3bUFEuoyquun-SYean017ukSK-;zegkiX=gmNM(iXs52s=5P&VQ6~DMH0%1Xl|&n z>rV?>C83;%=7z2a#&Nv%P(~8!dqp;!8=FX|?-f})H?+4-lEj1G^~O{}StBz0>{n;E zbzK7x$MMT^DhWhU^yfXArU9TRiY4Qm?0ZDU_8I!d^{chFz%cto=I;3Fy8ej3FndK7 z?7cT#nN71tMEA9Q|FOuQPLI#_;;!nUB$PEG{@6bZhU)|el~DGGjO{1%xb8y)K>!?2 wLfIoS^@Q8)1{_yH*)Q^RHoMzkOtMDg2l!8uVct$VvH$=807*qoM6N<$f?s#j#sB~S literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/MagicBird.cs new file mode 100644 index 0000000000..2bb8f5ba5a --- /dev/null +++ b/Projectiles/Summon/MagicBird.cs @@ -0,0 +1,145 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MagicBird : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bird"); + Main.projFrames[projectile.type] = 7; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 14; + projectile.height = 14; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.alpha = 255; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 7) + { + projectile.frame = 0; + } + projectile.ai[0]++; + projectile.ai[1]++; + if (projectile.ai[0] >= 20f) + { + Vector2 dspeed = projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + projectile.ai[0] = 0f; + } + + //Homing + if (projectile.ai[1] > 30f) + HomingAI(); + //Fade in + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + + private void HomingAI() + { + Player player = Main.player[projectile.owner]; + int targetIdx = -1; + float maxHomingRange = 700f; + bool hasHomingTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = player.MinionAttackTargetNPC; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + else + { + for (int i = 0; i < Main.npc.Length; ++i) + { + NPC npc = Main.npc[i]; + if (npc == null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = i; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + } + + // Home in on said closest NPC. + if (hasHomingTarget) + { + NPC target = Main.npc[targetIdx]; + Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 32f; + float homingRatio = 15f; + projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 239, 0, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Summon/MagicBird.png b/Projectiles/Summon/MagicBird.png new file mode 100644 index 0000000000000000000000000000000000000000..b9eb9d0c2793f29395ef1b0408e75c5f7b2ed46a GIT binary patch literal 2076 zcmV+%2;=vOP)!b00001b5ch_0Itp) z=>Px+)=5M`RCt{2ozHLEWEjW4E-A#F*QRlnwPD?~^*}YWA~7T+gfvbJv`L)d0{jCU zIKhDvmtEl>0IqOl+O*RqRY*Gwq4ltF=q5JQWLw-{bLULWS`O)x+E4u2uVXt++4GSq zC3YOU-#mWa*Iz$=Ujq@?rD*`ziTaEWW2`uVXRY( z;DvX;0RYUG-Ua~NUi%XOaOKCh&Q$e4n{A`-05hfTlBHA%LR-70}Z_V>Oj9cn|QoApq>O&B^S0Y?d-**~*K~(*X z#91P*esR0K)ouQxNYz^-!W36gF5AZT_6xLHEwoy#p7n7(xzu?$X>6~oI4}z~Mn^0y zMLCHT4kKx&JZm>d5ClOG1VIp97W(SI>vq_S#p3Rt2>@udJmsZP7@_{K?m@))!z#E_ z^iuo7M5J;mf0#V8{%}_Qu&QpDIC(O-T>Rm*^~3aeQkHyR@rQwQ z^~2md~mqp@*Mdt29aF?Z^n)Mj=n2VR_aK@bE%5CkE} z!S#pZ4o3Xpto-3|tAY);2`K*axbY=aWaSU{D7@h|VVb7aK@5WJ?HApH1tLc95Pvu$ zln%U#q~l8vTv>`?qHlkA*y!z5YD_b-t!7 zz?B{P`eD!W_P2gmRrAiX1wDO0$1-&F!)eK-e%ODXPvy{4?Ao?%IF18A&)v)=4=1_L z=Qs{#PrRvZ#b&8+q85|4U_*P4gK%9JwWHys3Q_D!4Ll)^ydVgIAaF8inpMO#+5I%l zxpjWdpZknn?kN8H>VxF!58Jj4$8nT)YTWkw;tzlEWw4&jcMTWEaQVY=49p*UpA z>xY5xzDANNSJn8#1M}9#iW7;dTxtB_fz%JHkSbR}5ClQUid>wZJe%Ic^%AwCvsiu< z>HHX#$r_rg!AbP?ZH~p|M@z6QOSztANy`iE2eJLix~{8yn)b%^g`U|gYe#1XtFT>~ zj#XBLWm#B$w3K>YIzlUk{den0+4o-i3P7*_K;9WSJXy_4M-1%Q{A#s|QmK@_emKET z6oP>zj>KJIRvR7_P6}rI!IO?DEY^0Mu8} zVGdAbvNrrNOpr65)+g@knvU>a+fhvOSSGUaiBoxN{ao7>3Ztny`r7_*T>UV`GL3)9 z=lUABKRit1OY~KHsj44VjYG_(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.BetsysCurse, 180); + target.AddBuff(BuffID.Ichor, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.BetsysCurse, 180); + target.AddBuff(BuffID.Ichor, 180); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(189, 51, 164, projectile.alpha); + } + } +} diff --git a/Projectiles/Summon/MagicBullet.png b/Projectiles/Summon/MagicBullet.png new file mode 100644 index 0000000000000000000000000000000000000000..2fabfdd09aae7ab575a02337af89b73678c5c528 GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^Oh7Ed!3HF~v+~XZDNj!q#}JO0$u`0gKjt?AK_??u z#5ud#;|*Fx7Xz4lUH<>!HkmkG-fmH6Ou$oj;fWI*joBw3{Pc)(*U9zo?c9Y0L#L@M cX_H`M*w83)t>Kwg1<+6iPgg&ebxsLQ07Wb+Q2+n{ literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs new file mode 100644 index 0000000000..78361808a5 --- /dev/null +++ b/Projectiles/Summon/MagicHammer.cs @@ -0,0 +1,165 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MagicHammer : ModProjectile + { + private int counter = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.alpha = 255; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = 10; + projectile.timeLeft = 180; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + { + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + } + projectile.rotation += 0.075f; + if (counter <= 30) + { + counter++; + return; + } + int num716 = -1; + Vector2 vector59 = projectile.Center; + float num717 = 700f; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + Player player = Main.player[projectile.owner]; + if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + { + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(player.MinionAttackTargetNPC + 1))) + { + Vector2 center4 = npc.Center; + float num719 = Vector2.Distance(center4, vector59); + if (num719 < num717) + { + num717 = num719; + vector59 = center4; + num716 = player.MinionAttackTargetNPC; + } + } + } + else + { + for (int num718 = 0; num718 < Main.npc.Length; num718++) + { + NPC nPC6 = Main.npc[num718]; + if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) + { + Vector2 center4 = nPC6.Center; + float num719 = Vector2.Distance(center4, vector59); + if (num719 < num717) + { + num717 = num719; + vector59 = center4; + num716 = num718; + } + } + } + } + if (num716 >= 0) + { + projectile.ai[0] = (float)(num716 + 1); + projectile.netUpdate = true; + } + } + if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) + { + projectile.localAI[0] = 30f; + } + bool flag32 = false; + if (projectile.ai[0] != 0f) + { + int num720 = (int)(projectile.ai[0] - 1f); + if (Main.npc[num720].active && !Main.npc[num720].dontTakeDamage && Main.npc[num720].immune[projectile.owner] == 0) + { + float num721 = Main.npc[num720].position.X + (float)(Main.npc[num720].width / 2); + float num722 = Main.npc[num720].position.Y + (float)(Main.npc[num720].height / 2); + float num723 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num721) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num722); + if (num723 < 1000f) + { + flag32 = true; + vector59 = Main.npc[num720].Center; + } + } + else + { + projectile.ai[0] = 0f; + flag32 = false; + projectile.netUpdate = true; + } + } + if (flag32) + { + Vector2 v = vector59 - projectile.Center; + float num724 = projectile.velocity.ToRotation(); + float num725 = v.ToRotation(); + double num726 = (double)(num725 - num724); + num726 = MathHelper.WrapAngle((float)num726); + projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.25, default); + } + float num727 = projectile.velocity.Length(); + projectile.velocity.Normalize(); + projectile.velocity *= num727 + 0.0025f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 56, 0, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/MagicHammer.png b/Projectiles/Summon/MagicHammer.png new file mode 100644 index 0000000000000000000000000000000000000000..d29c13995453a95173376661ca526d2e91a5b395 GIT binary patch literal 586 zcmV-Q0=4~#P)Px%1W80eRA_)9vnNi zvk`LgJ8WY|ewq39L}4Hu4hPxv>KLlpKaR)aAnSh(GRp@ji=DuOgzQ(=QJ$KK1dz~F z*LCR9MopJUEQ#y&3IHgI!gpz_k|EMNbHtLM>blm}%=6qjzOTeYIN$$KlP1Dz7t4?=PCC2d}{6M^*V@%6i))2Kg)hzB6%X1E)kdZ`#k{QcDua* z|Lh}0B9{3SFcWzfW2b2v0Kjs&jEWIoKS_p2w6kxwTL6FAE6?*$Nl-Hpig#~jm985f zcbbwr9!i2rhDdPM>YJsSrcnTJzu&cXI&{maLt`r~ABnDOS^Pr%_5%P;r<2yX+wB0j zW6L7#ZJHhtS6xfqN4UdX)epu-K$bFASEfV6MS@wWGX;8sP$U2 zl81~n07E~3?wCu4$eXkGB|*i0l{Ktq)MRSEiVn*v#cH(zV07$%`940Bk|B~+Ri#xY zuxRW;tzL?~S%GBz%k%eYSzsAPzI Y127lJ4zg7dYXATM07*qoM6N<$f?Lo9#{d8T literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/MagicHat.cs b/Projectiles/Summon/MagicHat.cs new file mode 100644 index 0000000000..77af61d0fc --- /dev/null +++ b/Projectiles/Summon/MagicHat.cs @@ -0,0 +1,178 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MagicHat : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magic Hat"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = projectile.Calamity(); + + //set up minion buffs and bools + bool hatExists = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (hatExists) + { + if (player.dead) + { + modPlayer.magicHat = false; + } + if (modPlayer.magicHat) + { + projectile.timeLeft = 2; + } + } + + //projectile movement + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + if (player.gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 150f; + projectile.rotation = MathHelper.Pi; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)(int)projectile.position.X; + projectile.position.Y = (float)(int)projectile.position.Y; + + //I don't know what this is + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + + //on summon dust and flexible damage + if (projectile.localAI[0] == 0f) + { + int dustAmt = 50; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + int dustEffects = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + Main.dust[dustEffects].velocity *= 2f; + Main.dust[dustEffects].scale *= 1.15f; + } + modProj.spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != modProj.spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = damage2; + } + + //finding an enemy, then shooting projectiles at it + if (projectile.owner == Main.myPlayer) + { + float projPosX = projectile.position.X; + float projPosY = projectile.position.Y; + float detectionRange = 1500f; + bool enemyDetected = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float xDist = npc.position.X + (float)(npc.width / 2); + float yDist = npc.position.Y + (float)(npc.height / 2); + float enemyDist = Math.Abs(projPosX + (float)(projectile.width / 2) - xDist) + Math.Abs(projPosY + (float)(projectile.height / 2) - yDist); + if (enemyDist < detectionRange) + { + detectionRange = enemyDist; + projPosX = xDist; + projPosY = yDist; + enemyDetected = true; + } + } + } + else + { + for (int index = 0; index < Main.npc.Length; index++) + { + NPC target = Main.npc[index]; + if (target.CanBeChasedBy(projectile, true)) + { + float xDist = target.position.X + (float)(target.width / 2); + float yDist = target.position.Y + (float)(target.height / 2); + float enemyDist = Math.Abs(projPosX + (float)(projectile.width / 2) - xDist) + Math.Abs(projPosY + (float)(projectile.height / 2) - yDist); + if (enemyDist < detectionRange) + { + detectionRange = enemyDist; + projPosX = xDist; + projPosY = yDist; + enemyDetected = true; + } + } + } + } + if (enemyDetected) + { + projectile.ai[1] += 1f; + if ((projectile.ai[1] % 5f) == 0f) + { + int amount = Main.rand.Next(1, 2); + for (int i = 0; i < amount; i++) + { + int projType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); + float velocityX = Main.rand.NextFloat(-10f, 10f); + float velocityY = Main.rand.NextFloat(-15f, -8f); + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, projType, projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + } + } + + //glowmask effect + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + + //no contact damage + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/MagicHat.png b/Projectiles/Summon/MagicHat.png new file mode 100644 index 0000000000000000000000000000000000000000..6cef86e8d32309f336949a31664b51d8706463ca GIT binary patch literal 502 zcmVPx$ut`KgR7i>Cm(4B%Q5462Q?0M5kG2%mP_;x@*pS%T@dOs0#DiFS1F^9cJBdYO zISA5HNsDw;mDXY$ddHNiCbx6hj!dHgY^Em+5g**WEQbFy*SRfNbvyj}dNO|sSWBmUd*Nw52bz*bf>r9yvb9Y@!Z(sq5uE@ literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/MagicRifle.cs b/Projectiles/Summon/MagicRifle.cs new file mode 100644 index 0000000000..45e4068dd9 --- /dev/null +++ b/Projectiles/Summon/MagicRifle.cs @@ -0,0 +1,235 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MagicRifle : ModProjectile + { + private int counter = 0; + private bool canHome = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rifle"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 180; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num637 = 0.05f; + for (int num638 = 0; num638 < Main.projectile.Length; num638++) + { + bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + if (counter <= 30) + { + counter++; + canHome = true; + } + float homingRange = 700f; + float num634 = 1300f; + float num635 = 2600f; + float num636 = 600f; + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && canHome) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < homingRange) || !flag25) + { + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < Main.npc.Length; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false) && canHome) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < homingRange) || !flag25) + { + homingRange = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 18f; //12 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 9f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = projectile.ai[0] == 1f; + } + float num650 = 12f; + if (flag26) + { + num650 = 30f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 16f) + { + num650 = 16f; + } + if (num651 < num636 && flag26) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (flag25) + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = (vector46 - projectile.Center).ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.ToRadians(315) : MathHelper.ToRadians(135)); + } + else + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.ToRadians(315) : MathHelper.ToRadians(135)); + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 6f; + int projType = ModContent.ProjectileType(); + if (flag25 && projectile.ai[1] == 0f) + { + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20, 0.25f); + } + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + Main.PlaySound(SoundID.Item40, projectile.position); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, projType, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(148, 0, 211, projectile.alpha); + } + + public override bool CanDamage() + { + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/MagicRifle.png b/Projectiles/Summon/MagicRifle.png new file mode 100644 index 0000000000000000000000000000000000000000..5e84792f42094e66d9921ffea2197fa91100a55d GIT binary patch literal 604 zcmV-i0;BzjP)Px%7D+@wRA_$0Uv~%^pKC<2Ar#HL ziJ6VIp&ar^J9{q3zYlhBHR8tCnWsd_F6HFbs3QH<9{-NA8+dd{uGENNy&AAOOJgyxfjv zcDg!4mBlF|8kt*iY0``(NunOlY3=v>9q4YKD8eZtvb$?DZ2n)7$wY2@Tel%~amt90 qYbG<}3Z6HELgqH5qal{V86)4@deb5o?{D4!0000(); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && + flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + if (counter <= 30) + { + counter++; + canHome = true; + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + if (!canHome) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && canHome) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < Main.npc.Length; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false) && canHome) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 9f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = projectile.ai[0] == 1f; + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 9f; //8 + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(75, 255, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(3)) + { + for (int n = 0; n < Main.rand.Next(1, 3); n++) //1 to 2 baseball bats + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.1 * Main.rand.Next(4, 7)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.rand.NextBool(3)) + { + for (int n = 0; n < Main.rand.Next(1, 3); n++) //1 to 2 baseball bats + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.1 * Main.rand.Next(4, 7)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Summon/MagicUmbrella.png b/Projectiles/Summon/MagicUmbrella.png new file mode 100644 index 0000000000000000000000000000000000000000..277fb1483ec2392b6b73481278307cf15b766091 GIT binary patch literal 493 zcmVPx$r%6OXRA_{6Y1x?$w;qyFTH8P%|SrDX3RaF%L?)N+3$jJL|-AHGl zZCe0#yWR8i({!Evejfnpy6%myMy%v!K_gX4%-wFc-f=fZCa+q#eIZ7yN@?5}nJgny zWkD0GQW`f#MrTA!bjZqrMz5tVm&?oZS0klNSgVxAjgi4stCR`BTBS7pjp&(|{vfN? z+)f=MwU$cZ-$;kvenG0r*p4l9suTd%>ow~-i!xG_+$yDUW8_zTVAB=S^inkBiY# zCIml5e(2;vuaC$~%Wro2cns@X_ObXe()pg6;oc4|c6=^e88Ml#j+d@ZF Date: Mon, 9 Mar 2020 20:27:19 -0400 Subject: [PATCH 2/2] can release bloodworms now --- Items/SummonItems/BloodwormItem.cs | 12 +++++++++++- NPCs/AcidRain/BloodwormNormal.cs | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs index aa001cd755..e730198191 100644 --- a/Items/SummonItems/BloodwormItem.cs +++ b/Items/SummonItems/BloodwormItem.cs @@ -1,4 +1,6 @@ -using Terraria.ModLoader; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.NPCs.AcidRain; namespace CalamityMod.Items.SummonItems { @@ -16,6 +18,14 @@ namespace CalamityMod.Items.SummonItems item.maxStack = 20; item.rare = 9; item.bait = 69420; + item.useStyle = 1; + item.autoReuse = true; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.consumable = true; + item.noUseGraphic = true; + item.makeNPC = (short)ModContent.NPCType(); } } } diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs index 392dd09171..be417a321c 100644 --- a/NPCs/AcidRain/BloodwormNormal.cs +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -11,6 +11,7 @@ namespace CalamityMod.NPCs.AcidRain { DisplayName.SetDefault("Bloodworm"); Main.npcFrameCount[npc.type] = 7; + Main.npcCatchable[npc.type] = true; } public override void SetDefaults()