diff --git a/.gitignore b/.gitignore index 940794e6..fb7a1daf 100644 --- a/.gitignore +++ b/.gitignore @@ -286,3 +286,4 @@ __pycache__/ *.btm.cs *.odx.cs *.xsd.cs +*.sln diff --git a/Helper.cs b/Helper.cs index af28b119..bc9e8ba4 100644 --- a/Helper.cs +++ b/Helper.cs @@ -10,16 +10,6 @@ namespace Tremor public delegate void ExtraAction(); public static class Helper { - /// - /// *Используется для перевода градусов в радианы* - /// - /// Градусов - /// Возвращяет радианы - public static float GradtoRad(float Grad) - { - return Grad * (float)Math.PI / 180.0f; - } - public static Vector2 RandomPositin(Vector2 pos1, Vector2 pos2) { Random rnd = new Random(); @@ -48,16 +38,6 @@ public static Vector2 VelocityFPTP(Vector2 pos1, Vector2 pos2, float speed) return move * (speed / (float)Math.Sqrt(move.X * move.X + move.Y * move.Y)); } - /// - /// *Используется для перевода радиан в градусы* - /// - /// Радианов - /// Возвращяет градусы - public static float RadtoGrad(float Rad) - { - return Rad * 180.0f / (float)Math.PI; - } - /// /// *Используется для нахождения ID ближайшего NPC к точке* /// @@ -176,10 +156,12 @@ public static Vector2 CenterPoint(Vector2 A, Vector2 B) /// Возвращяет точку смещённую по заданым параметрам public static Vector2 PolarPos(Vector2 Point, float Distance, float Angle, int XOffset = 0, int YOffset = 0) { - Vector2 ReturnedValue = new Vector2(); - ReturnedValue.X = (Distance * (float)Math.Sin(RadtoGrad(Angle)) + Point.X) + XOffset; - ReturnedValue.Y = (Distance * (float)Math.Cos(RadtoGrad(Angle)) + Point.Y) + YOffset; - return ReturnedValue; + Vector2 returnedValue = new Vector2 + { + X = (Distance * (float)Math.Sin(MathHelper.ToDegrees(Angle)) + Point.X) + XOffset, + Y = (Distance * (float)Math.Cos(MathHelper.ToDegrees(Angle)) + Point.Y) + YOffset + }; + return returnedValue; } /// *Вычисления того, произойдёт ли событие с заданым шансом в этот раз, или нет* diff --git a/Projectiles/BallChainPro.cs b/Projectiles/BallChainPro.cs index 51178e04..43dde36e 100644 --- a/Projectiles/BallChainPro.cs +++ b/Projectiles/BallChainPro.cs @@ -29,15 +29,14 @@ public override void SetDefaults() public override void SetStaticDefaults() { DisplayName.SetDefault("Ball n Chain"); - } public override void AI() { Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - Helper.GradtoRad(90); + projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - MathHelper.ToRadians(90); } public override bool? CanHitNPC(NPC target) @@ -56,9 +55,7 @@ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) float num1 = texture.Height; Vector2 vector2_4 = mountedCenter - position; float rotation = (float)Math.Atan2(vector2_4.Y, vector2_4.X) - 1.57f; - bool flag = true; - if (float.IsNaN(position.X) && float.IsNaN(position.Y)) - flag = false; + bool flag = !(float.IsNaN(position.X) && float.IsNaN(position.Y)); if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y)) flag = false; while (flag) diff --git a/Projectiles/BerserkerPro.cs b/Projectiles/BerserkerPro.cs index fa84a484..c64d7ad8 100644 --- a/Projectiles/BerserkerPro.cs +++ b/Projectiles/BerserkerPro.cs @@ -1,4 +1,5 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace Tremor.Projectiles @@ -12,7 +13,6 @@ public class BerserkerPro : ModProjectile public override void SetDefaults() { - projectile.width = 18; projectile.height = 34; projectile.timeLeft = 6; @@ -26,15 +26,14 @@ public override void SetDefaults() public override void SetStaticDefaults() { DisplayName.SetDefault("Berserker Sword"); - } public override void AI() { Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.player[(int)projectile.ai[0]].Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.player[(int)projectile.ai[0]].Center, projectile.Center) - Helper.GradtoRad(90); + projectile.Center = Helper.PolarPos(Main.player[(int)projectile.ai[0]].Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.player[(int)projectile.ai[0]].Center, projectile.Center) - MathHelper.ToRadians(90); } public override bool? CanHitNPC(NPC target) diff --git a/Projectiles/BrainSmasherPro.cs b/Projectiles/BrainSmasherPro.cs index 33ea8d3a..dfbe0656 100644 --- a/Projectiles/BrainSmasherPro.cs +++ b/Projectiles/BrainSmasherPro.cs @@ -15,7 +15,6 @@ public class BrainSmasherPro : ModProjectile public override void SetDefaults() { - projectile.width = 48; projectile.height = 48; projectile.timeLeft = 6; @@ -29,15 +28,13 @@ public override void SetDefaults() public override void SetStaticDefaults() { DisplayName.SetDefault("BrainSmasher"); - } - public override void AI() { Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.player[(int)projectile.ai[0]].Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.player[(int)projectile.ai[0]].Center, projectile.Center) - Helper.GradtoRad(90); + projectile.Center = Helper.PolarPos(Main.player[(int)projectile.ai[0]].Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.player[(int)projectile.ai[0]].Center, projectile.Center) - MathHelper.ToRadians(90); } public override bool? CanHitNPC(NPC target) @@ -56,9 +53,7 @@ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) float num1 = texture.Height; Vector2 vector2_4 = mountedCenter - position; float rotation = (float)Math.Atan2(vector2_4.Y, vector2_4.X) - 1.57f; - bool flag = true; - if (float.IsNaN(position.X) && float.IsNaN(position.Y)) - flag = false; + bool flag = !(float.IsNaN(position.X) && float.IsNaN(position.Y)); if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y)) flag = false; while (flag) diff --git a/Projectiles/FungusBlueSword.cs b/Projectiles/FungusBlueSword.cs index dbed87df..46b324ef 100644 --- a/Projectiles/FungusBlueSword.cs +++ b/Projectiles/FungusBlueSword.cs @@ -13,7 +13,6 @@ public class FungusBlueSword : ModProjectile public override void SetDefaults() { - projectile.width = 18; projectile.height = 44; projectile.timeLeft = 6; @@ -27,16 +26,13 @@ public override void SetDefaults() public override void SetStaticDefaults() { DisplayName.SetDefault("Fungus Blue Sword"); - } - public override Color? GetAlpha(Color lightColor) { return Color.White; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Main.rand.Next(3) == 0) @@ -44,11 +40,12 @@ public override void OnHitNPC(NPC target, int damage, float knockback, bool crit target.AddBuff(31, 180, false); } } + public override void AI() { Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - Helper.GradtoRad(90); + projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - MathHelper.ToRadians(90); } public override bool? CanHitNPC(NPC target) diff --git a/Projectiles/FungusYellowSword.cs b/Projectiles/FungusYellowSword.cs index 52a9c00d..3e07b2ce 100644 --- a/Projectiles/FungusYellowSword.cs +++ b/Projectiles/FungusYellowSword.cs @@ -35,8 +35,8 @@ public override void SetStaticDefaults() public override void AI() { Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - Helper.GradtoRad(90); + projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - MathHelper.ToRadians(90); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/PaladinHammerPro.cs b/Projectiles/PaladinHammerPro.cs index dd2c1b0e..5795d347 100644 --- a/Projectiles/PaladinHammerPro.cs +++ b/Projectiles/PaladinHammerPro.cs @@ -6,59 +6,56 @@ namespace Tremor.Projectiles { public class PaladinHammerPro : ModProjectile - { - const float RotationSpeed = 0.05f; - const float Distanse = 48; + { + const float RotationSpeed = 0.05f; + const float Distanse = 48; - float Rotation; + float Rotation; - public override void SetDefaults() - { - - projectile.width = 18; - projectile.height = 34; - projectile.timeLeft = 6; - projectile.melee = true; - projectile.aiStyle = -1; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("PaladinHammerPro"); - - } + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 34; + projectile.timeLeft = 6; + projectile.melee = true; + projectile.aiStyle = -1; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("PaladinHammerPro"); + } public override Color? GetAlpha(Color lightColor) { return Color.White; } - public override void AI() - { - Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - Helper.GradtoRad(90); - } + public override void AI() + { + Rotation += RotationSpeed; + projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - MathHelper.ToRadians(90); + } - public override bool? CanHitNPC(NPC target) - { - return !target.friendly; - } + public override bool? CanHitNPC(NPC target) + { + return !target.friendly; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for(int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + } } diff --git a/Projectiles/TrueBladeOne.cs b/Projectiles/TrueBladeOne.cs index eabc0aef..6dd860d0 100644 --- a/Projectiles/TrueBladeOne.cs +++ b/Projectiles/TrueBladeOne.cs @@ -4,48 +4,45 @@ namespace Tremor.Projectiles { - public class TrueBladeOne : ModProjectile - { - const float RotationSpeed = 0.05f; - const float Distanse = 50; + public class TrueBladeOne : ModProjectile + { + const float RotationSpeed = 0.05f; + const float Distanse = 50; - float Rotation; + float Rotation; - public override void SetDefaults() - { - - projectile.width = 22; - projectile.height = 44; - projectile.timeLeft = 6; - projectile.melee = true; - projectile.aiStyle = -1; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Blade"); - - } + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 44; + projectile.timeLeft = 6; + projectile.melee = true; + projectile.aiStyle = -1; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Blade"); + } public override Color? GetAlpha(Color lightColor) { return Color.White; } - public override void AI() - { - Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - Helper.GradtoRad(90); - } + public override void AI() + { + Rotation += RotationSpeed; + projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - MathHelper.ToRadians(90); + } - public override bool? CanHitNPC(NPC target) - { - return !target.friendly; - } - } + public override bool? CanHitNPC(NPC target) + { + return !target.friendly; + } + } } diff --git a/Projectiles/TrueBladeThree.cs b/Projectiles/TrueBladeThree.cs index c76bd6cb..d484c446 100644 --- a/Projectiles/TrueBladeThree.cs +++ b/Projectiles/TrueBladeThree.cs @@ -4,47 +4,45 @@ namespace Tremor.Projectiles { - public class TrueBladeThree : ModProjectile - { - const float RotationSpeed = 0.05f; - const float Distanse = 150; + public class TrueBladeThree : ModProjectile + { + const float RotationSpeed = 0.05f; + const float Distanse = 150; - float Rotation; + float Rotation; public override Color? GetAlpha(Color lightColor) { return Color.White; } - public override void SetDefaults() - { - - projectile.width = 22; - projectile.height = 44; - projectile.timeLeft = 6; - projectile.melee = true; - projectile.aiStyle = -1; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Blade"); - - } + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 44; + projectile.timeLeft = 6; + projectile.melee = true; + projectile.aiStyle = -1; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } - public override void AI() - { - Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - Helper.GradtoRad(90); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Blade"); + } + + public override void AI() + { + Rotation += RotationSpeed; + projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - MathHelper.ToRadians(90); + } - public override bool? CanHitNPC(NPC target) - { - return !target.friendly; - } - } + public override bool? CanHitNPC(NPC target) + { + return !target.friendly; + } + } } diff --git a/Projectiles/TrueBladeTwo.cs b/Projectiles/TrueBladeTwo.cs index 7662341f..9bd8085f 100644 --- a/Projectiles/TrueBladeTwo.cs +++ b/Projectiles/TrueBladeTwo.cs @@ -4,47 +4,46 @@ namespace Tremor.Projectiles { - public class TrueBladeTwo : ModProjectile - { - const float RotationSpeed = 0.05f; - const float Distanse = 100; + public class TrueBladeTwo : ModProjectile + { + const float RotationSpeed = 0.05f; + const float Distanse = 100; - float Rotation; + float Rotation; - public override void SetDefaults() - { + public override void SetDefaults() + { - projectile.width = 22; - projectile.height = 44; - projectile.timeLeft = 6; - projectile.melee = true; - projectile.aiStyle = -1; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } + projectile.width = 22; + projectile.height = 44; + projectile.timeLeft = 6; + projectile.melee = true; + projectile.aiStyle = -1; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Blade"); - - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Blade"); + } public override Color? GetAlpha(Color lightColor) { return Color.White; } - public override void AI() - { - Rotation += RotationSpeed; - projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, Helper.GradtoRad(Rotation)); - projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - Helper.GradtoRad(90); - } - - public override bool? CanHitNPC(NPC target) - { - return !target.friendly; - } - } + public override void AI() + { + Rotation += RotationSpeed; + projectile.Center = Helper.PolarPos(Main.LocalPlayer.Center, Distanse, MathHelper.ToRadians(Rotation)); + projectile.rotation = Helper.rotateBetween2Points(Main.LocalPlayer.Center, projectile.Center) - MathHelper.ToRadians(90); + } + + public override bool? CanHitNPC(NPC target) + { + return !target.friendly; + } + } } diff --git a/Projectiles/VultureFeather.cs b/Projectiles/VultureFeather.cs index 7492f3ce..144375bb 100644 --- a/Projectiles/VultureFeather.cs +++ b/Projectiles/VultureFeather.cs @@ -5,41 +5,40 @@ namespace Tremor.Projectiles { - public class VultureFeather : ModProjectile - { - const int TileCollideDustType = DustID.Tin; - const int TileCollideDustCount = 4; - const float TileCollideDustSpeedMulti = 0.2f; + public class VultureFeather : ModProjectile + { + const int TileCollideDustType = DustID.Tin; + const int TileCollideDustCount = 4; + const float TileCollideDustSpeedMulti = 0.2f; - public override void SetDefaults() - { + public override void SetDefaults() + { - projectile.width = 14; - projectile.height = 34; - projectile.timeLeft = 36000; - projectile.aiStyle = 0; - projectile.penetrate = -1; - projectile.hostile = true; -projectile.tileCollide = false; - } + projectile.width = 14; + projectile.height = 34; + projectile.timeLeft = 36000; + projectile.aiStyle = 0; + projectile.penetrate = -1; + projectile.hostile = true; + projectile.tileCollide = false; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vulture Feather"); - - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vulture Feather"); + } - public override void AI() - { - projectile.rotation = Helper.rotateBetween2Points(projectile.position, projectile.position + projectile.velocity) + Helper.GradtoRad(270); - } + public override void AI() + { + projectile.rotation = Helper.rotateBetween2Points(projectile.position, projectile.position + projectile.velocity) + MathHelper.ToRadians(270); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - for (int i = 0; i < TileCollideDustCount; i++) - Dust.NewDust(projectile.position, projectile.width, projectile.height, TileCollideDustType, projectile.velocity.X * TileCollideDustSpeedMulti, projectile.velocity.Y * TileCollideDustSpeedMulti); - return true; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + for (int i = 0; i < TileCollideDustCount; i++) + Dust.NewDust(projectile.position, projectile.width, projectile.height, TileCollideDustType, projectile.velocity.X * TileCollideDustSpeedMulti, projectile.velocity.Y * TileCollideDustSpeedMulti); + return true; + } + } } diff --git a/Projectiles/projBoneHook.cs b/Projectiles/projBoneHook.cs index e2f0258b..fdbaff3d 100644 --- a/Projectiles/projBoneHook.cs +++ b/Projectiles/projBoneHook.cs @@ -5,84 +5,81 @@ namespace Tremor.Projectiles { - public class projBoneHook : ModProjectile - { - const int HookTime = 50; // "Длина" хука - const float BackSpeedMulti = 0.75f; // Множитель скорости возвращения хука - int TimeToHook = HookTime; - int NPC = -1; + public class projBoneHook : ModProjectile + { + const int HookTime = 50; // "Длина" хука + const float BackSpeedMulti = 0.75f; // Множитель скорости возвращения хука + int TimeToHook = HookTime; + int NPC = -1; - public override void SetDefaults() - { + public override void SetDefaults() + { + projectile.width = 42; + projectile.height = 38; + projectile.timeLeft = 36000; + projectile.melee = true; + projectile.aiStyle = 13; + projectile.penetrate = -1; + } - projectile.width = 42; - projectile.height = 38; - projectile.timeLeft = 36000; - projectile.melee = true; - projectile.aiStyle = 13; - projectile.penetrate = -1; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bone Hook"); + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bone Hook"); - - } + public override void AI() + { + if (--TimeToHook <= 0) + { + projectile.ai[0] = 1; + projectile.velocity *= BackSpeedMulti; + } + else + projectile.ai[0] = 0; + projectile.rotation = Helper.rotateBetween2Points(projectile.position, Main.player[projectile.owner].position) + MathHelper.ToRadians(45); + if (NPC != -1 && projectile.Distance(Main.player[projectile.owner].position) > 64) + { + Main.npc[NPC].Center = projectile.position; + if (!Main.npc[NPC].active) + NPC = -1; + } + } - - public override void AI() - { - if (--TimeToHook <= 0) - { - projectile.ai[0] = 1; - projectile.velocity *= BackSpeedMulti; - } - else - projectile.ai[0] = 0; - projectile.rotation = Helper.rotateBetween2Points(projectile.position, Main.player[projectile.owner].position) + Helper.GradtoRad(45); - if (NPC != -1 && projectile.Distance(Main.player[projectile.owner].position) > 64) - { - Main.npc[NPC].Center = projectile.position; - if (!Main.npc[NPC].active) - NPC = -1; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + spriteBatch.Draw(Main.projectileTexture[projectile.type], new Rectangle((int)(projectile.position - Main.screenPosition).X, (int)(projectile.position - Main.screenPosition).Y, projectile.width, projectile.height), null, lightColor, projectile.rotation, new Vector2(projectile.width / 2, projectile.height / 2), SpriteEffects.None, 0); + return false; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - spriteBatch.Draw(Main.projectileTexture[projectile.type], new Rectangle((int)(projectile.position - Main.screenPosition).X, (int)(projectile.position - Main.screenPosition).Y, projectile.width, projectile.height), null, lightColor, projectile.rotation, new Vector2(projectile.width / 2, projectile.height / 2), SpriteEffects.None, 0); - return false; - } + public override bool? CanHitNPC(NPC target) + { + return true; + } - public override bool? CanHitNPC(NPC target) - { - return true; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (NPC == -1 && !target.boss && !target.friendly && target.lifeMax > 5 && target.aiStyle != 6) + NPC = target.whoAmI; + TimeToHook = 1; + base.OnHitNPC(target, damage, knockback, crit); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (NPC == -1 && !target.boss && !target.friendly && target.lifeMax > 5 && target.aiStyle != 6) - NPC = target.whoAmI; - TimeToHook = 1; - base.OnHitNPC(target, damage, knockback, crit); - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + TimeToHook = 1; + return base.OnTileCollide(oldVelocity); + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - TimeToHook = 1; - return base.OnTileCollide(oldVelocity); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + TimeToHook = 1; + base.OnHitPlayer(target, damage, crit); + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - TimeToHook = 1; - base.OnHitPlayer(target, damage, crit); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - TimeToHook = 1; - base.OnHitPvp(target, damage, crit); - } - } + public override void OnHitPvp(Player target, int damage, bool crit) + { + TimeToHook = 1; + base.OnHitPvp(target, damage, crit); + } + } } diff --git a/Projectiles/projMotherboardLaser.cs b/Projectiles/projMotherboardLaser.cs index 6dcfb054..5e92edc4 100644 --- a/Projectiles/projMotherboardLaser.cs +++ b/Projectiles/projMotherboardLaser.cs @@ -62,7 +62,7 @@ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 drawPos = projectile.Center + unit * k - Main.screenPosition; Color alpha = new Color(LaserColor.R, LaserColor.G, LaserColor.B, projectile.alpha); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, alpha, Helper.RadtoGrad(Main.rand.Next(0, 181)), new Vector2(2, 2), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, alpha, MathHelper.ToDegrees(Main.rand.Next(0, 181)), new Vector2(2, 2), 1f, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/projVultureFeather.cs b/Projectiles/projVultureFeather.cs index fb1a2815..9b4c6be4 100644 --- a/Projectiles/projVultureFeather.cs +++ b/Projectiles/projVultureFeather.cs @@ -5,41 +5,38 @@ namespace Tremor.Projectiles { - public class projVultureFeather : ModProjectile - { - const int TileCollideDustType = DustID.Tin; - const int TileCollideDustCount = 4; - const float TileCollideDustSpeedMulti = 0.2f; + public class projVultureFeather : ModProjectile + { + const int TileCollideDustType = DustID.Tin; + const int TileCollideDustCount = 4; + const float TileCollideDustSpeedMulti = 0.2f; - public override void SetDefaults() - { + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 34; + projectile.timeLeft = 36000; + projectile.aiStyle = 0; + projectile.penetrate = -1; + projectile.hostile = true; + projectile.tileCollide = false; + } - projectile.width = 14; - projectile.height = 34; - projectile.timeLeft = 36000; - projectile.aiStyle = 0; - projectile.penetrate = -1; - projectile.hostile = true; -projectile.tileCollide = false; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vulture Feather"); + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vulture Feather"); - - } + public override void AI() + { + projectile.rotation = Helper.rotateBetween2Points(projectile.position, projectile.position + projectile.velocity) + MathHelper.ToRadians(270); + } - - public override void AI() - { - projectile.rotation = Helper.rotateBetween2Points(projectile.position, projectile.position + projectile.velocity) + Helper.GradtoRad(270); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - for (int i = 0; i < TileCollideDustCount; i++) - Dust.NewDust(projectile.position, projectile.width, projectile.height, TileCollideDustType, projectile.velocity.X * TileCollideDustSpeedMulti, projectile.velocity.Y * TileCollideDustSpeedMulti); - return true; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + for (int i = 0; i < TileCollideDustCount; i++) + Dust.NewDust(projectile.position, projectile.width, projectile.height, TileCollideDustType, projectile.velocity.X * TileCollideDustSpeedMulti, projectile.velocity.Y * TileCollideDustSpeedMulti); + return true; + } + } }