From 5ffc030c47eaeb6b39552898eaddbf8d807b1e4f Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 29 Sep 2019 21:21:51 -0400 Subject: [PATCH] Added Kylie and unified line endings. --- .../BouncingEyeball.cs | 2 +- .../CelestialReaper.cs | 2 +- Items/CalamityCustomThrowingDamage/Kylie.cs | 68 ++++++++++ Items/CalamityCustomThrowingDamage/Kylie.png | Bin 0 -> 734 bytes Projectiles/Rogue/BlueFlamePillar.cs | 2 +- .../Rogue/BouncingEyeballProjectile.cs | 2 +- .../BouncingEyeballProjectileStealthStrike.cs | 2 +- .../Rogue/CelestialReaperAfterimage.cs | 2 +- .../Rogue/CelestialReaperProjectile.cs | 2 +- Projectiles/Rogue/CinquedeaProj.cs | 2 +- .../Rogue/ConsecratedWaterProjectile.cs | 2 +- Projectiles/Rogue/GlaiveProj.cs | 2 +- Projectiles/Rogue/KylieBoomerang.cs | 118 ++++++++++++++++++ Projectiles/Rogue/KylieBoomerang.png | Bin 0 -> 734 bytes Utilities/CalamityUtils.cs | 62 ++++----- 15 files changed, 227 insertions(+), 41 deletions(-) create mode 100644 Items/CalamityCustomThrowingDamage/Kylie.cs create mode 100644 Items/CalamityCustomThrowingDamage/Kylie.png create mode 100644 Projectiles/Rogue/KylieBoomerang.cs create mode 100644 Projectiles/Rogue/KylieBoomerang.png diff --git a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs index 71d5d95072..dfad01af54 100644 --- a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs +++ b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs @@ -56,4 +56,4 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage return false; } } -} \ No newline at end of file +} diff --git a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs index 180047992d..3e1ae8bdea 100644 --- a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs +++ b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage return false; } } -} \ No newline at end of file +} diff --git a/Items/CalamityCustomThrowingDamage/Kylie.cs b/Items/CalamityCustomThrowingDamage/Kylie.cs new file mode 100644 index 0000000000..15833b6388 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/Kylie.cs @@ -0,0 +1,68 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class Kylie : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kylie"); + Tooltip.SetDefault("Throws three short ranged boomerangs if stealth is full\n" + "Also known as Dowak"); + } + + public override void SafeSetDefaults() + { + item.damage = 40; + item.knockBack = 12; + item.thrown = true; + item.crit = 16; + item.value = Item.buyPrice(0, 10, 0, 0); + item.rare = 3; + item.useTime = 25; + item.useAnimation = 25; + item.width = 32; + item.height = 46; + item.useStyle = 1; + item.UseSound = SoundID.Item1; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("KylieBoomerang"); + item.noMelee = true; + item.noUseGraphic = true; + item.GetGlobalItem(mod).rogue = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + CalamityPlayer p = Main.player[Main.myPlayer].GetCalamityPlayer(); + //If stealth is full, shoot a spread of 3 boomerangs with reduced range + if(p.StealthStrikeAvailable()) + { + int spread = 10; + for (int i = 0; i <3; i++) + { + Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); + Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType("Kylieproj"), item.damage, item.knockBack, player.whoAmI,0f,1f); + spread -= 10; + } + return false; + } + return true; + } + + public override bool CanUseItem(Player player) + { + //If you have more than one boomerang, you cant shoot another + int MAX = 1; + int launched = 0; + foreach (Projectile projectile in Main.projectile) + if (projectile.type == item.shoot && projectile.owner == item.owner && projectile.active) + { + launched++; + } + return (launched >= MAX) ? false : true; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Kylie.png b/Items/CalamityCustomThrowingDamage/Kylie.png new file mode 100644 index 0000000000000000000000000000000000000000..f29f779e13884cfa22520c3381e144f7211c0621 GIT binary patch literal 734 zcmV<40wMj0P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00JyYL_t(o!_}BiYZE~jho5bOVr!*s zih*X?8tfrhQ&0;E?I+NKUhE;?q#z!|kKwt8^r9!fKm|Rh;A+@|k{V;cYVg0fR9z3V z?_oEynk>=GyqB=MGhv?RxAX2M4ms=6nJWOe3zGnJ-u;Yp7qawe$F|8dRyiSVQzV|3$!af6Q%NqccW)`&MLR>97+Vg1>V>dAL0>Xok@F2wR z27PyUnmA28k_C*q3d2tL`2F)AuS@nqUt3-RU}v|fjw@4^8<1LY=Ny3RjfW9HZLtbu z_k*mm&p`W)-1&-l`p}dE;CBPn7dWS`mIrGw_8E}+;rvoxFflpMc)9zf10Fwi)Qo3A zZUco#t$lvx2ms!EIY}JvfB*SQ?fm^uU$EPNRO{`21W;dhwb!L1rn9%#fLBuc|5T+2 zK(o~Y`uF|cvX_2hp8=_6s}}(@Ze9l9yn7gc2b~ar7kh00wi}Ou{_LgfF_4vg@T3!e zs&Um-wHr>J@Zy=uKstM43=I5MECzr?_ENX+zDgX+zQ1sK(E+&sv}>sWP4*GMjm`ME zznbiTo7e8Bd8yxkX>#)o2>FUT2f(w=`$YD6GdJHr7P(};v-=f*`bG5~uysrA^FcE= z*MN|F#aUt!EqVIgu2xaxerq^#a|~pW*VoUY$i8XG^JZ?Gfx@`R%`q@8a&ru%Py8=( zV+=T6sjB@e>tB-_W8gQbe-D<V=-F@#v` Q?*IS*07*qoM6N<$f|;U9fdBvi literal 0 HcmV?d00001 diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index ae16055d42..d4830d0e12 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -70,4 +70,4 @@ namespace CalamityMod.Projectiles.Rogue } } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index 3033eb2f4c..75825ac436 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -73,4 +73,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index c00054e1c2..21bfa03978 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -66,4 +66,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.cs b/Projectiles/Rogue/CelestialReaperAfterimage.cs index 4922ba881f..6c21cd8ceb 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Projectiles.Rogue projectile.alpha += 5; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index 9140007a9d..d5cf24b6ce 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -67,4 +67,4 @@ namespace CalamityMod.Projectiles.Rogue } } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 74d9ffa0ee..09fede144f 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } diff --git a/Projectiles/Rogue/ConsecratedWaterProjectile.cs b/Projectiles/Rogue/ConsecratedWaterProjectile.cs index ecc887f8cc..674a42634c 100644 --- a/Projectiles/Rogue/ConsecratedWaterProjectile.cs +++ b/Projectiles/Rogue/ConsecratedWaterProjectile.cs @@ -57,4 +57,4 @@ namespace CalamityMod.Projectiles.Rogue } } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index b3f1dfdece..8ac7d7dacb 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue // ai[1] = 1 means that the projectile is a stealth strike, in which case it pierces infinitely. if (projectile.ai[1] == 1f) projectile.penetrate = projectile.maxPenetrate = -1; - + // Boomerang rotation projectile.rotation += 0.4f * (float)projectile.direction; diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs new file mode 100644 index 0000000000..f6de64d32b --- /dev/null +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -0,0 +1,118 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class KylieBoomerang : ModProjectile + { + //This variable will be used for the stealth strike + internal float timer = 0f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kylie"); + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 40; + projectile.height = 40; + projectile.penetrate = -1; + projectile.timeLeft = 360; + projectile.tileCollide = false; + drawOffsetX = 6 * projectile.spriteDirection; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + //Constant rotation + projectile.rotation += 0.2f; + + projectile.ai[0]++; + //Dust trail + if(Main.rand.Next(15) == 0) + { + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 7, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 100, default(Color), 0f); + Main.dust[d].position = projectile.Center; + } + //Constant sound effects + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 15; + Main.PlaySound(SoundID.Item7, projectile.position); + } + //Slopes REEEEEEEEEEEE + if (projectile.ai[0] == 3f) + { + projectile.tileCollide = true; + } + //Decide the range of the boomerang depending on stealth + if (projectile.ai[1] == 1) + { + timer = 30f; + } + else + { + timer = 60f; + } + //Home in on the player after certain time + if (projectile.ai[0] >= timer) + { + projectile.tileCollide = false; + Player target = Main.player[projectile.owner]; + float var2 = target.position.X + (target.width / 2); + float var3 = target.position.Y + (target.height / 2); + float homingstrenght = 11f; + Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float var6 = var2 - vector1.X; + float var7 = var3 - vector1.Y; + float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); + var8 = homingstrenght / var8; + var6 *= var8; + var7 *= var8; + projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; + //Kill projectile if it collides with player + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + //Start homing at player if you hit an enemy + projectile.ai[0] = 90; + projectile.tileCollide = false; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + //Bounce off tiles and start homing on player if it hits a tile + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, projectile.position); + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + projectile.ai[0] = 90; + projectile.tileCollide = false; + return false; + + } + } +} diff --git a/Projectiles/Rogue/KylieBoomerang.png b/Projectiles/Rogue/KylieBoomerang.png new file mode 100644 index 0000000000000000000000000000000000000000..f29f779e13884cfa22520c3381e144f7211c0621 GIT binary patch literal 734 zcmV<40wMj0P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00JyYL_t(o!_}BiYZE~jho5bOVr!*s zih*X?8tfrhQ&0;E?I+NKUhE;?q#z!|kKwt8^r9!fKm|Rh;A+@|k{V;cYVg0fR9z3V z?_oEynk>=GyqB=MGhv?RxAX2M4ms=6nJWOe3zGnJ-u;Yp7qawe$F|8dRyiSVQzV|3$!af6Q%NqccW)`&MLR>97+Vg1>V>dAL0>Xok@F2wR z27PyUnmA28k_C*q3d2tL`2F)AuS@nqUt3-RU}v|fjw@4^8<1LY=Ny3RjfW9HZLtbu z_k*mm&p`W)-1&-l`p}dE;CBPn7dWS`mIrGw_8E}+;rvoxFflpMc)9zf10Fwi)Qo3A zZUco#t$lvx2ms!EIY}JvfB*SQ?fm^uU$EPNRO{`21W;dhwb!L1rn9%#fLBuc|5T+2 zK(o~Y`uF|cvX_2hp8=_6s}}(@Ze9l9yn7gc2b~ar7kh00wi}Ou{_LgfF_4vg@T3!e zs&Um-wHr>J@Zy=uKstM43=I5MECzr?_ENX+zDgX+zQ1sK(E+&sv}>sWP4*GMjm`ME zznbiTo7e8Bd8yxkX>#)o2>FUT2f(w=`$YD6GdJHr7P(};v-=f*`bG5~uysrA^FcE= z*MN|F#aUt!EqVIgu2xaxerq^#a|~pW*VoUY$i8XG^JZ?Gfx@`R%`q@8a&ru%Py8=( zV+=T6sjB@e>tB-_W8gQbe-D<V=-F@#v` Q?*IS*07*qoM6N<$f|;U9fdBvi literal 0 HcmV?d00001 diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index e1ce2bd8be..b95f95226b 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -63,42 +63,42 @@ namespace CalamityMod npc.lifeMax = revengeance.Value; } } - /// - /// Detects nearby hostile NPCs from a given point - /// - /// The position where we wish to check for nearby NPCs + /// + /// Detects nearby hostile NPCs from a given point + /// + /// The position where we wish to check for nearby NPCs /// Maximum amount of pixels to check around the origin - public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck) - { - NPC closestTarget = null; - float distance = maxDistanceToCheck; - for (int index = 0; index < Main.npc.Length; index++) - { - //doesn't matter what the attacker is in CanBeChasedBy? wtf. - if (Main.npc[index].CanBeChasedBy(null, false) && Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1)) - { - if (Vector2.Distance(origin, Main.npc[index].Center) < distance) - { - distance = Vector2.Distance(origin, Main.npc[index].Center); - closestTarget = Main.npc[index]; - } - } + public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck) + { + NPC closestTarget = null; + float distance = maxDistanceToCheck; + for (int index = 0; index < Main.npc.Length; index++) + { + //doesn't matter what the attacker is in CanBeChasedBy? wtf. + if (Main.npc[index].CanBeChasedBy(null, false) && Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1)) + { + if (Vector2.Distance(origin, Main.npc[index].Center) < distance) + { + distance = Vector2.Distance(origin, Main.npc[index].Center); + closestTarget = Main.npc[index]; + } + } } - return closestTarget; + return closestTarget; } - /// - /// Detects nearby hostile NPCs from a given point with minion support - /// - /// The position where we wish to check for nearby NPCs - /// Maximum amount of pixels to check around the origin + /// + /// Detects nearby hostile NPCs from a given point with minion support + /// + /// The position where we wish to check for nearby NPCs + /// Maximum amount of pixels to check around the origin /// Owner of the minion - public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner) - { - if (owner.HasMinionAttackTargetNPC) - { - return Main.npc[owner.MinionAttackTargetNPC]; + public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner) + { + if (owner.HasMinionAttackTargetNPC) + { + return Main.npc[owner.MinionAttackTargetNPC]; } - return ClosestNPCAt(origin,maxDistanceToCheck); + return ClosestNPCAt(origin,maxDistanceToCheck); } }