mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
adapt ooga booga C# code style
This commit is contained in:
@@ -26,7 +26,7 @@ public class ArcaneMissile : ModItem
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
player.GetModPlayer<YhtPlayer>().arcaneMissle = Item.damage;
|
||||
player.GetModPlayer<YhtPlayer>().ArcaneMissle = Item.damage;
|
||||
|
||||
base.UpdateAccessory(player, hideVisual);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ArcaneMissileBehavior : GlobalNPC
|
||||
|
||||
var player = Main.LocalPlayer;
|
||||
|
||||
if (player.GetModPlayer<YhtPlayer>().arcaneMissle != 0 && projectile.DamageType == DamageClass.Magic)
|
||||
if (player.GetModPlayer<YhtPlayer>().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<YhtPlayer>().arcaneMissle,
|
||||
player.GetModPlayer<YhtPlayer>().ArcaneMissle,
|
||||
0,
|
||||
Main.LocalPlayer.whoAmI
|
||||
);
|
||||
|
||||
@@ -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<CopperSwordOnAStickProjectile>();
|
||||
}
|
||||
|
||||
public override void AddRecipes() {
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe()
|
||||
.AddIngredient(ItemID.Wood, 5)
|
||||
.AddIngredient(ItemID.Rope, 5)
|
||||
.AddIngredient(ItemID.CopperShortsword)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -25,8 +25,8 @@ public class KatanaRedo : GlobalItem
|
||||
if (item.type != ItemID.Katana || player.altFunctionUse != 2) return null;
|
||||
var yhtPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
|
||||
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++)
|
||||
{
|
||||
|
||||
@@ -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<MithrilPebbleOfPigSmitingProjectile>();
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-10
@@ -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<ToclafaneMinion>();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -1,13 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\tModLoader.targets" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>YHTMod</AssemblyName>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="tModLoader.CodeAssist" Version="0.1.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+11
-10
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user