mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
configure a code style that is not completely cursed
This commit is contained in:
@@ -5,15 +5,12 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace YHTMod.Items.ArcaneMissile;
|
||||
|
||||
public class ArcaneMissile : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
public class ArcaneMissile : ModItem {
|
||||
public override void SetStaticDefaults() {
|
||||
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
public override void SetDefaults() {
|
||||
Item.width = 32;
|
||||
Item.height = 32;
|
||||
Item.accessory = true;
|
||||
@@ -24,10 +21,9 @@ public class ArcaneMissile : ModItem
|
||||
Item.noUseGraphic = true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
public override void UpdateAccessory(Player player, bool hideVisual) {
|
||||
player.GetModPlayer<YhtPlayer>().ArcaneMissile = Item.damage;
|
||||
|
||||
base.UpdateAccessory(player, hideVisual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,27 +4,22 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace YHTMod.Items.ArcaneMissile;
|
||||
|
||||
public class ArcaneMissileBehavior : GlobalNPC
|
||||
{
|
||||
public override void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hitInfo, int damage)
|
||||
{
|
||||
if (!hitInfo.Crit)
|
||||
{
|
||||
public class ArcaneMissileBehavior : GlobalNPC {
|
||||
public override void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hitInfo, int damage) {
|
||||
if (!hitInfo.Crit) {
|
||||
base.OnHitByProjectile(npc, projectile, hitInfo, damage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.Server) {
|
||||
return;
|
||||
}
|
||||
|
||||
var player = Main.LocalPlayer;
|
||||
Player player = Main.LocalPlayer;
|
||||
|
||||
if (player.GetModPlayer<YhtPlayer>().ArcaneMissile != 0 && projectile.DamageType == DamageClass.Magic)
|
||||
{
|
||||
if (player.GetModPlayer<YhtPlayer>().ArcaneMissile != 0 && projectile.DamageType == DamageClass.Magic) {
|
||||
// player just crit with magic weapon while having arcane missile accessory
|
||||
var proj = Projectile.NewProjectileDirect(
|
||||
Projectile proj = Projectile.NewProjectileDirect(
|
||||
projectile.GetSource_FromThis("arcaneMissile"),
|
||||
Main.LocalPlayer.position,
|
||||
npc.position.DirectionFrom(Main.LocalPlayer.position),
|
||||
@@ -47,4 +42,4 @@ public class ArcaneMissileBehavior : GlobalNPC
|
||||
|
||||
base.OnHitByProjectile(npc, projectile, hitInfo, damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user