From 50d7f8b0d295aab8950e27b6c0a862d2bdc483f2 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Mon, 22 Dec 2025 17:59:47 +0100 Subject: [PATCH] adapt ooga booga C# code style --- Items/ArcaneMissile/ArcaneMissile.cs | 2 +- Items/ArcaneMissile/ArcaneMissileBehavior.cs | 4 +-- Items/CopperSwordOnAStick.cs | 14 ++++++---- Items/KatanaRedo.cs | 4 +-- Items/MithrilPebbleOfPigSmiting.cs | 11 +++++--- Items/ToclafaneStaff.cs | 26 ++++++++++++------- .../Weapons/CopperSwordOnAStickProjectile.cs | 16 +++++++----- .../MithrilPebbleOfPigSmitingProjectile.cs | 11 +++++--- YHTMod.cs | 6 ++--- YHTMod.csproj | 5 +--- YhtPlayer.cs | 21 ++++++++------- 11 files changed, 69 insertions(+), 51 deletions(-) diff --git a/Items/ArcaneMissile/ArcaneMissile.cs b/Items/ArcaneMissile/ArcaneMissile.cs index 0c6471e..7ec82e7 100644 --- a/Items/ArcaneMissile/ArcaneMissile.cs +++ b/Items/ArcaneMissile/ArcaneMissile.cs @@ -26,7 +26,7 @@ public class ArcaneMissile : ModItem public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetModPlayer().arcaneMissle = Item.damage; + player.GetModPlayer().ArcaneMissle = Item.damage; base.UpdateAccessory(player, hideVisual); } diff --git a/Items/ArcaneMissile/ArcaneMissileBehavior.cs b/Items/ArcaneMissile/ArcaneMissileBehavior.cs index 09c01de..603b185 100644 --- a/Items/ArcaneMissile/ArcaneMissileBehavior.cs +++ b/Items/ArcaneMissile/ArcaneMissileBehavior.cs @@ -21,7 +21,7 @@ public class ArcaneMissileBehavior : GlobalNPC var player = Main.LocalPlayer; - if (player.GetModPlayer().arcaneMissle != 0 && projectile.DamageType == DamageClass.Magic) + if (player.GetModPlayer().ArcaneMissle != 0 && projectile.DamageType == DamageClass.Magic) { // player just crit with magic weapon while having arcane missile accessory var proj = Projectile.NewProjectileDirect( @@ -29,7 +29,7 @@ public class ArcaneMissileBehavior : GlobalNPC Main.LocalPlayer.position, npc.position.DirectionFrom(Main.LocalPlayer.position), ProjectileID.MagicMissile, - player.GetModPlayer().arcaneMissle, + player.GetModPlayer().ArcaneMissle, 0, Main.LocalPlayer.whoAmI ); diff --git a/Items/CopperSwordOnAStick.cs b/Items/CopperSwordOnAStick.cs index 31c0ea8..5c1db66 100644 --- a/Items/CopperSwordOnAStick.cs +++ b/Items/CopperSwordOnAStick.cs @@ -5,12 +5,15 @@ using YHTMod.Projectiles.Weapons; namespace YHTMod.Items; -public class CopperSwordOnAStick : ModItem { - public override void SetStaticDefaults() { +public class CopperSwordOnAStick : ModItem +{ + public override void SetStaticDefaults() + { CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; } - public override void SetDefaults() { + public override void SetDefaults() + { Item.DamageType = DamageClass.Melee; Item.damage = 3; Item.width = 80; @@ -31,11 +34,12 @@ public class CopperSwordOnAStick : ModItem { Item.shoot = ModContent.ProjectileType(); } - public override void AddRecipes() { + public override void AddRecipes() + { CreateRecipe() .AddIngredient(ItemID.Wood, 5) .AddIngredient(ItemID.Rope, 5) .AddIngredient(ItemID.CopperShortsword) .Register(); } -} +} \ No newline at end of file diff --git a/Items/KatanaRedo.cs b/Items/KatanaRedo.cs index 6e1d6d0..f465283 100644 --- a/Items/KatanaRedo.cs +++ b/Items/KatanaRedo.cs @@ -25,8 +25,8 @@ public class KatanaRedo : GlobalItem if (item.type != ItemID.Katana || player.altFunctionUse != 2) return null; var yhtPlayer = player.GetModPlayer(); - if (yhtPlayer.katanaTeleportCooldown > 0) return null; - yhtPlayer.katanaTeleportCooldown = 300; + if (yhtPlayer.KatanaTeleportCooldown > 0) return null; + yhtPlayer.KatanaTeleportCooldown = 300; for (var i = 0; i < Main.maxNPCs; i++) { diff --git a/Items/MithrilPebbleOfPigSmiting.cs b/Items/MithrilPebbleOfPigSmiting.cs index 878b9ae..acc6d79 100644 --- a/Items/MithrilPebbleOfPigSmiting.cs +++ b/Items/MithrilPebbleOfPigSmiting.cs @@ -5,12 +5,15 @@ using YHTMod.Projectiles.Weapons; namespace YHTMod.Items; -public class MithrilPebbleOfPigSmiting : ModItem { - public override void SetStaticDefaults() { +public class MithrilPebbleOfPigSmiting : ModItem +{ + public override void SetStaticDefaults() + { CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; } - public override void SetDefaults() { + public override void SetDefaults() + { Item.DamageType = DamageClass.Ranged; Item.damage = 16; Item.width = 8; @@ -30,4 +33,4 @@ public class MithrilPebbleOfPigSmiting : ModItem { Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); } -} +} \ No newline at end of file diff --git a/Items/ToclafaneStaff.cs b/Items/ToclafaneStaff.cs index f77cee5..16f882e 100644 --- a/Items/ToclafaneStaff.cs +++ b/Items/ToclafaneStaff.cs @@ -7,17 +7,20 @@ using Terraria.ModLoader; using YHTMod.Buffs; using YHTMod.Projectiles.Weapons; -namespace YHTMod.Items; +namespace YHTMod.Items; -public class ToclafaneStaff : ModItem { - - public override void SetStaticDefaults() { - ItemID.Sets.GamepadWholeScreenUseRange[Item.type] = true; // This lets the player target anywhere on the whole screen while using a controller. +public class ToclafaneStaff : ModItem +{ + public override void SetStaticDefaults() + { + ItemID.Sets.GamepadWholeScreenUseRange[Item.type] = + true; // This lets the player target anywhere on the whole screen while using a controller. ItemID.Sets.LockOnIgnoresCollision[Item.type] = true; CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; } - - public override void SetDefaults() { + + public override void SetDefaults() + { Item.damage = 30; Item.knockBack = 3f; Item.mana = 10; @@ -35,13 +38,16 @@ public class ToclafaneStaff : ModItem { Item.shoot = ModContent.ProjectileType(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, + int type, int damage, float knockback) + { player.AddBuff(Item.buffType, 2); position = Main.MouseWorld; return base.Shoot(player, source, position, velocity, type, damage, knockback); } - public override void AddRecipes() { + public override void AddRecipes() + { CreateRecipe() .AddIngredient(ItemID.GuideVoodooDoll, 1) .AddIngredient(ItemID.HallowedBar, 15) @@ -79,4 +85,4 @@ public class ToclafaneStaff : ModItem { .AddTile(TileID.MythrilAnvil) .Register(); } -} +} \ No newline at end of file diff --git a/Projectiles/Weapons/CopperSwordOnAStickProjectile.cs b/Projectiles/Weapons/CopperSwordOnAStickProjectile.cs index 56c9d6c..00c58d8 100644 --- a/Projectiles/Weapons/CopperSwordOnAStickProjectile.cs +++ b/Projectiles/Weapons/CopperSwordOnAStickProjectile.cs @@ -6,8 +6,10 @@ using Terraria.ModLoader; namespace YHTMod.Projectiles.Weapons; -class CopperSwordOnAStickProjectile : ModProjectile { - public override void SetDefaults() { +class CopperSwordOnAStickProjectile : ModProjectile +{ + public override void SetDefaults() + { Projectile.width = 80; Projectile.height = 80; @@ -21,12 +23,14 @@ class CopperSwordOnAStickProjectile : ModProjectile { Projectile.aiStyle = ProjAIStyleID.ShortSword; } - public override void AI() { + public override void AI() + { base.AI(); - float random = (float) (Random.Shared.NextDouble() / 5f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 - MathHelper.PiOver4 * Projectile.spriteDirection; + float random = (float)(Random.Shared.NextDouble() / 5f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 - + MathHelper.PiOver4 * Projectile.spriteDirection; Projectile.rotation += random; DrawOriginOffsetX = 0; DrawOffsetX = 0; } -} +} \ No newline at end of file diff --git a/Projectiles/Weapons/MithrilPebbleOfPigSmitingProjectile.cs b/Projectiles/Weapons/MithrilPebbleOfPigSmitingProjectile.cs index be33921..d3648f3 100644 --- a/Projectiles/Weapons/MithrilPebbleOfPigSmitingProjectile.cs +++ b/Projectiles/Weapons/MithrilPebbleOfPigSmitingProjectile.cs @@ -5,8 +5,10 @@ using Terraria.ModLoader; namespace YHTMod.Projectiles.Weapons; -class MithrilPebbleOfPigSmitingProjectile : ModProjectile { - public override void SetDefaults() { +class MithrilPebbleOfPigSmitingProjectile : ModProjectile +{ + public override void SetDefaults() + { Projectile.width = 8; Projectile.height = 8; Projectile.friendly = true; @@ -20,7 +22,8 @@ class MithrilPebbleOfPigSmitingProjectile : ModProjectile { Projectile.light = 0.3f; } - public override void AI() { + public override void AI() + { base.AI(); DrawOriginOffsetX = 0; DrawOffsetX = 0; @@ -28,4 +31,4 @@ class MithrilPebbleOfPigSmitingProjectile : ModProjectile { Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.3f; } -} +} \ No newline at end of file diff --git a/YHTMod.cs b/YHTMod.cs index 418186c..a01874d 100644 --- a/YHTMod.cs +++ b/YHTMod.cs @@ -2,13 +2,13 @@ using Terraria.ModLoader; namespace YHTMod { public class YHTMod : Mod { - private static YHTMod mod; + private static YHTMod _mod; public YHTMod() { - mod = this; + _mod = this; } public static YHTMod GetInstance() { - return mod; + return _mod; } } } \ No newline at end of file diff --git a/YHTMod.csproj b/YHTMod.csproj index 2f6bba4..69fad5b 100644 --- a/YHTMod.csproj +++ b/YHTMod.csproj @@ -1,13 +1,10 @@ - + YHTMod - net6.0 - AnyCPU latest - \ No newline at end of file diff --git a/YhtPlayer.cs b/YhtPlayer.cs index cc1cf16..0ff5383 100644 --- a/YhtPlayer.cs +++ b/YhtPlayer.cs @@ -1,20 +1,21 @@ using System; using Terraria.ModLoader; -namespace YHTMod; +namespace YHTMod; -public class YhtPlayer : ModPlayer { +public class YhtPlayer : ModPlayer +{ + public int ArcaneMissle = 0; + public int KatanaTeleportCooldown = 0; - public int arcaneMissle = 0; - public int katanaTeleportCooldown = 0; - - public override void PreUpdate() { - this.katanaTeleportCooldown = Math.Max(this.katanaTeleportCooldown - 1, 0); + public override void PreUpdate() + { + KatanaTeleportCooldown = Math.Max(KatanaTeleportCooldown - 1, 0); } - public override void ResetEffects() { - - this.arcaneMissle = 0; + public override void ResetEffects() + { + ArcaneMissle = 0; base.ResetEffects(); }