diff --git a/Buffs/MirrorBarrier.cs b/Buffs/MirrorBarrier.cs index f22a3b1..415f52b 100644 --- a/Buffs/MirrorBarrier.cs +++ b/Buffs/MirrorBarrier.cs @@ -20,7 +20,7 @@ public override void SetDefaults() public override void Update(Player player, ref int buffIndex) { - PlayerFX p = player.GetModPlayer(mod); + PlayerFX p = player.GetModPlayer(); p.reflectingProjectiles = true; } } diff --git a/Buffs/RapidRecovery.cs b/Buffs/RapidRecovery.cs index e89d17d..77046a4 100644 --- a/Buffs/RapidRecovery.cs +++ b/Buffs/RapidRecovery.cs @@ -47,7 +47,7 @@ public static void HealDamage(Player player, Mod mod, double damage) public static void HealDamage(Player player, Mod mod, int damage) { int time = (int)(damage * (120f / healthPer2Secs)); - int id = mod.BuffType(); + int id = ModContent.BuffType(); player.AddBuff(id, time, false); } } diff --git a/Buffs/SabreDance.cs b/Buffs/SabreDance.cs index 0b19318..6babcce 100644 --- a/Buffs/SabreDance.cs +++ b/Buffs/SabreDance.cs @@ -18,21 +18,21 @@ public override void SetDefaults() public override void Update(Player player, ref int buffIndex) { - if (player.buffTime[buffIndex] >= 2) - { - player.meleeSpeed += 2f; + if (player.buffTime[buffIndex] >= 2) + { + player.meleeSpeed += 2f; } player.itemAnimation = Math.Min(player.itemAnimation, player.itemAnimationMax); - if(player.itemAnimation <= 1) - { + if(player.itemAnimation <= 1) + { player.HeldItem.useStyle = 1; - player.controlUseItem = true; + player.controlUseItem = true; } } - public static void ApplySabreDance(Mod mod, Player player, int extraStrikes) - { - player.AddBuff(mod.BuffType(), 2 + (extraStrikes * player.itemAnimationMax / 3)); + public static void ApplySabreDance(Mod mod, Player player, int extraStrikes) + { + player.AddBuff(ModContent.BuffType(), 2 + (extraStrikes * player.itemAnimationMax / 3)); } } } diff --git a/Buffs/SpiritGuardian.cs b/Buffs/SpiritGuardian.cs index df886d2..04b758f 100644 --- a/Buffs/SpiritGuardian.cs +++ b/Buffs/SpiritGuardian.cs @@ -1,20 +1,20 @@ -using Terraria; -using Terraria.ModLoader; - -namespace WeaponOut.Buffs -{ - public class SpiritGuardian : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Starlight Guardian"); - Description.SetDefault("The starlight guardian will assist you"); - Main.buffNoTimeDisplay[Type] = true; - } - public override void Update(Player player, ref int buffIndex) +using Terraria; +using Terraria.ModLoader; + +namespace WeaponOut.Buffs +{ + public class SpiritGuardian : ModBuff + { + public override void SetDefaults() { - int guardianID = mod.ProjectileType(); - player.GetModPlayer().starlightGuardian = player.ownedProjectileCounts[guardianID] > 0; - } - } -} + DisplayName.SetDefault("Starlight Guardian"); + Description.SetDefault("The starlight guardian will assist you"); + Main.buffNoTimeDisplay[Type] = true; + } + public override void Update(Player player, ref int buffIndex) + { + int guardianID = ModContent.ProjectileType(); + player.GetModPlayer().starlightGuardian = player.ownedProjectileCounts[guardianID] > 0; + } + } +} diff --git a/Items/Accessories/AccretionEmblem.cs b/Items/Accessories/AccretionEmblem.cs index f60e1b0..e485eca 100644 --- a/Items/Accessories/AccretionEmblem.cs +++ b/Items/Accessories/AccretionEmblem.cs @@ -54,7 +54,7 @@ public override void UpdateAccessory(Player player, bool hideVisual) player.statManaMax2 += 20; if (hideVisual) return; HeliosphereEmblem.DustVisuals(player, DustID.PinkFlame, 2f); - player.GetModPlayer(mod).lunarMagicVisual = true; + player.GetModPlayer().lunarMagicVisual = true; } } } diff --git a/Items/Accessories/ChaosHook.cs b/Items/Accessories/ChaosHook.cs index 1b6d2ba..d50c7f3 100644 --- a/Items/Accessories/ChaosHook.cs +++ b/Items/Accessories/ChaosHook.cs @@ -35,13 +35,13 @@ public override void AddRecipes() { if (!ModConf.EnableAccessories) return; ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); recipe.SetResult(this); recipe.AddRecipe(); //Conversion from recipe = new ModRecipe(mod); recipe.AddIngredient(this, 1); - recipe.SetResult(mod.ItemType()); + recipe.SetResult(ModContent.ItemType()); recipe.AddRecipe(); } } diff --git a/Items/Accessories/HyperSash.cs b/Items/Accessories/HyperSash.cs index 6f0e99d..f0a535b 100644 --- a/Items/Accessories/HyperSash.cs +++ b/Items/Accessories/HyperSash.cs @@ -41,7 +41,7 @@ public override void SetDefaults() public override void AddRecipes() { if (!ModConf.EnableFists) return; ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ItemID.ChlorophyteBar, 2); recipe.AddTile(TileID.Loom); recipe.SetResult(this, 1); diff --git a/Items/Accessories/LunarEmblem.cs b/Items/Accessories/LunarEmblem.cs index 62834f1..bf8632d 100644 --- a/Items/Accessories/LunarEmblem.cs +++ b/Items/Accessories/LunarEmblem.cs @@ -41,11 +41,11 @@ public override void SetDefaults() public override void AddRecipes() { if (!ModConf.EnableEmblems) return; ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType()); - recipe.AddIngredient(mod.ItemType()); - recipe.AddIngredient(mod.ItemType()); - recipe.AddIngredient(mod.ItemType()); - recipe.AddIngredient(mod.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this, 1); recipe.AddRecipe(); @@ -60,9 +60,9 @@ public override void UpdateAccessory(Player player, bool hideVisual) player.thrownVelocity += 0.3f; player.maxMinions += 1; if (hideVisual) return; - player.GetModPlayer(mod).lunarRangeVisual = true; - player.GetModPlayer(mod).lunarMagicVisual = true; - player.GetModPlayer(mod).lunarThrowVisual = true; + player.GetModPlayer().lunarRangeVisual = true; + player.GetModPlayer().lunarMagicVisual = true; + player.GetModPlayer().lunarThrowVisual = true; Vector2 hand = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; if (player.direction != 1) { diff --git a/Items/Accessories/MirrorBadge.cs b/Items/Accessories/MirrorBadge.cs index 97ef573..26f2cc4 100644 --- a/Items/Accessories/MirrorBadge.cs +++ b/Items/Accessories/MirrorBadge.cs @@ -1,72 +1,73 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace WeaponOut.Items.Accessories -{ - public class MirrorBadge : ModItem - { - public const int reflectDelay = 90; - - public override void SetStaticDefaults() - { +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace WeaponOut.Items.Accessories +{ + public class MirrorBadge : ModItem + { + public const int reflectDelay = 90; + + public override void SetStaticDefaults() + { DisplayName.SetDefault("Mirror Badge"); DisplayName.AddTranslation(GameCulture.Chinese, "镜之徽章"); - DisplayName.AddTranslation(GameCulture.Russian, "Зеркальная Медаль"); - - Tooltip.SetDefault( - "Immunity to petrification\n" + - "Reflects most projectiles\n" + + DisplayName.AddTranslation(GameCulture.Russian, "Зеркальная Медаль"); + + Tooltip.SetDefault( + "Immunity to petrification\n" + + "Reflects most projectiles\n" + "'A mark of courage, polished to perfection'"); Tooltip.AddTranslation(GameCulture.Chinese, "免疫石化\n反射大多数抛射物\n“勇气的印记,极致的抛光”"); - Tooltip.AddTranslation(GameCulture.Russian, - "Иммунитет к окаменению\n" + - "Отражает большинство снарядов\n" + - "'Тщательно отполированный знак отваги'"); + Tooltip.AddTranslation(GameCulture.Russian, + "Иммунитет к окаменению\n" + + "Отражает большинство снарядов\n" + + "'Тщательно отполированный знак отваги'"); + + } + public override void SetDefaults() + { + item.width = 18; + item.height = 20; + item.rare = 8; + item.value = Item.sellPrice(0, 3, 0, 0); + item.accessory = true; + } + public override void AddRecipes() { + if (!ModConf.EnableAccessories) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PocketMirror, 1); + recipe.AddIngredient(ItemID.ShroomiteBar, 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.buffImmune[BuffID.Stoned] = true; + + PlayerFX pFX = player.GetModPlayer(); + if (pFX.reflectingProjectileDelay <= 0) + { + player.AddBuff(WeaponOut.BuffIDMirrorBarrier, 2); + } + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + if (Main.rand.Next(15) == 0) + { + int dustIndex = Dust.NewDust(item.position, item.width, item.height, 43, 0, 0, 100, Color.White, 0.3f); + Main.dust[dustIndex].velocity *= 0.1f; + Main.dust[dustIndex].fadeIn = 1f; + } + return true; + } - } - public override void SetDefaults() - { - item.width = 18; - item.height = 20; - item.rare = 8; - item.value = Item.sellPrice(0, 3, 0, 0); - item.accessory = true; - } - public override void AddRecipes() { - if (!ModConf.EnableAccessories) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PocketMirror, 1); - recipe.AddIngredient(ItemID.ShroomiteBar, 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.buffImmune[BuffID.Stoned] = true; - - PlayerFX pFX = player.GetModPlayer(mod); - if (pFX.reflectingProjectileDelay <= 0) - { - player.AddBuff(WeaponOut.BuffIDMirrorBarrier, 2); - } - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - if (Main.rand.Next(15) == 0) - { - int dustIndex = Dust.NewDust(item.position, item.width, item.height, 43, 0, 0, 100, Color.White, 0.3f); - Main.dust[dustIndex].velocity *= 0.1f; - Main.dust[dustIndex].fadeIn = 1f; - } - return true; - } - } -} + } +} diff --git a/Items/Accessories/Pavise.cs b/Items/Accessories/Pavise.cs index 81735a0..b973e91 100644 --- a/Items/Accessories/Pavise.cs +++ b/Items/Accessories/Pavise.cs @@ -42,7 +42,7 @@ public override void AddRecipes() { public override void UpdateAccessory(Player player, bool hideVisual) { - PlayerFX modPlayer = player.GetModPlayer(mod); + PlayerFX modPlayer = player.GetModPlayer(); modPlayer.FrontDefence += 10; modPlayer.frontNoKnockback = true; } diff --git a/Items/Accessories/PerihelionEmblem.cs b/Items/Accessories/PerihelionEmblem.cs index 960617f..06b6671 100644 --- a/Items/Accessories/PerihelionEmblem.cs +++ b/Items/Accessories/PerihelionEmblem.cs @@ -1,57 +1,57 @@ -using System; -using System.Collections.Generic; - -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace WeaponOut.Items.Accessories -{ - public class PerihelionEmblem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perihelion Emblem"); - DisplayName.AddTranslation(GameCulture.Chinese, "近日点徽章"); - DisplayName.AddTranslation(GameCulture.Russian, "Эмблема Перигелия"); - - Tooltip.SetDefault( - "Supercharges throwing weapons to their lunar potential\n" + - "30% increased throwing velocity\n" + - "'Swing back around'"); - Tooltip.AddTranslation(GameCulture.Chinese, "激发投掷武器的月之潜力\n增加30%投掷速度\n“来回摆动”"); - Tooltip.AddTranslation(GameCulture.Russian, - "Заряжает метательое оружие космической энергией\n" + - "+30% скорость метания\n" + - "'Закинь подальше'"); - - } - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.rare = 10; - item.value = Item.sellPrice(0, 15, 0, 0); - item.accessory = true; - item.expert = true; - } - public override void AddRecipes() { - if (!ModConf.EnableEmblems) return; - Mod thorium = ModLoader.GetMod("ThoriumMod"); - ModRecipe recipe; - if (thorium != null) - { - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShinyStone, 1); - recipe.AddIngredient(thorium.GetItem("NinjaEmblem"), 1); - recipe.AddIngredient(thorium.GetItem("AngelsEnd"), 1); - recipe.AddIngredient(thorium.GetItem("StarEater"), 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 1); - recipe.AddRecipe(); +using System; +using System.Collections.Generic; + +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace WeaponOut.Items.Accessories +{ + public class PerihelionEmblem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perihelion Emblem"); + DisplayName.AddTranslation(GameCulture.Chinese, "近日点徽章"); + DisplayName.AddTranslation(GameCulture.Russian, "Эмблема Перигелия"); + + Tooltip.SetDefault( + "Supercharges throwing weapons to their lunar potential\n" + + "30% increased throwing velocity\n" + + "'Swing back around'"); + Tooltip.AddTranslation(GameCulture.Chinese, "激发投掷武器的月之潜力\n增加30%投掷速度\n“来回摆动”"); + Tooltip.AddTranslation(GameCulture.Russian, + "Заряжает метательое оружие космической энергией\n" + + "+30% скорость метания\n" + + "'Закинь подальше'"); + + } + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.rare = 10; + item.value = Item.sellPrice(0, 15, 0, 0); + item.accessory = true; + item.expert = true; + } + public override void AddRecipes() { + if (!ModConf.EnableEmblems) return; + Mod thorium = ModLoader.GetMod("ThoriumMod"); + ModRecipe recipe; + if (thorium != null) + { + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ShinyStone, 1); + recipe.AddIngredient(thorium.GetItem("NinjaEmblem"), 1); + recipe.AddIngredient(thorium.GetItem("AngelsEnd"), 1); + recipe.AddIngredient(thorium.GetItem("StarEater"), 1); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 1); + recipe.AddRecipe(); } recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ShinyStone, 1); @@ -60,15 +60,15 @@ public override void AddRecipes() { recipe.AddIngredient(ItemID.MagicDagger, 1); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - public override void UpdateAccessory(Player player, bool hideVisual) - { - HeliosphereEmblem.SetBonus(player, 2); - player.thrownVelocity += 0.3f; - if (hideVisual) return; - HeliosphereEmblem.DustVisuals(player, 75, 1.5f); - player.GetModPlayer(mod).lunarThrowVisual = true; - } - } -} + recipe.AddRecipe(); + } + public override void UpdateAccessory(Player player, bool hideVisual) + { + HeliosphereEmblem.SetBonus(player, 2); + player.thrownVelocity += 0.3f; + if (hideVisual) return; + HeliosphereEmblem.DustVisuals(player, 75, 1.5f); + player.GetModPlayer().lunarThrowVisual = true; + } + } +} diff --git a/Items/Accessories/ScrapExosuit.cs b/Items/Accessories/ScrapExosuit.cs index 19c7e4d..a894724 100644 --- a/Items/Accessories/ScrapExosuit.cs +++ b/Items/Accessories/ScrapExosuit.cs @@ -43,9 +43,9 @@ public override void SetDefaults() public override void AddRecipes() { if (!ModConf.EnableFists) return; ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType(), 1); - recipe.AddIngredient(mod.ItemType(), 1); - recipe.AddIngredient(mod.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddTile(TileID.TinkerersWorkbench); recipe.SetResult(this, 1); recipe.AddRecipe(); diff --git a/Items/Accessories/WoodenShield.cs b/Items/Accessories/WoodenShield.cs index fc8261a..649a6b0 100644 --- a/Items/Accessories/WoodenShield.cs +++ b/Items/Accessories/WoodenShield.cs @@ -45,7 +45,7 @@ public override void AddRecipes() { public override void UpdateAccessory(Player player, bool hideVisual) { - PlayerFX modPlayer = player.GetModPlayer(mod); + PlayerFX modPlayer = player.GetModPlayer(); modPlayer.DamageKnockbackThreshold += 10; } } diff --git a/Items/Accessories/WormholeEmblem.cs b/Items/Accessories/WormholeEmblem.cs index d7d7250..89c390a 100644 --- a/Items/Accessories/WormholeEmblem.cs +++ b/Items/Accessories/WormholeEmblem.cs @@ -55,7 +55,7 @@ public override void UpdateAccessory(Player player, bool hideVisual) player.ammoCost80 = true; if (hideVisual) return; HeliosphereEmblem.DustVisuals(player, DustID.Vortex); - player.GetModPlayer(mod).lunarRangeVisual = true; + player.GetModPlayer().lunarRangeVisual = true; } } } diff --git a/Items/Armour/ChampionLaurels.cs b/Items/Armour/ChampionLaurels.cs index 69a4b5d..9a825dc 100644 --- a/Items/Armour/ChampionLaurels.cs +++ b/Items/Armour/ChampionLaurels.cs @@ -76,20 +76,20 @@ public override void DrawHair(ref bool drawHair, ref bool drawAltHair) private byte armourSet = 0; public override bool IsArmorSet(Item head, Item body, Item legs) { - armourSet = 0;if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + armourSet = 0;if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; return true; diff --git a/Items/Armour/FistBoxingHelmet.cs b/Items/Armour/FistBoxingHelmet.cs index 0b29609..daeda1f 100644 --- a/Items/Armour/FistBoxingHelmet.cs +++ b/Items/Armour/FistBoxingHelmet.cs @@ -77,20 +77,20 @@ public override void DrawHair(ref bool drawHair, ref bool drawAltHair) public override bool IsArmorSet(Item head, Item body, Item legs) { armourSet = 0; - if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; return true; diff --git a/Items/Armour/FistBoxingHelmetPlus.cs b/Items/Armour/FistBoxingHelmetPlus.cs index 12ddd1f..a7f530c 100644 --- a/Items/Armour/FistBoxingHelmetPlus.cs +++ b/Items/Armour/FistBoxingHelmetPlus.cs @@ -91,38 +91,38 @@ public override void DrawHair(ref bool drawHair, ref bool drawAltHair) public override bool IsArmorSet(Item head, Item body, Item legs) { armourSet = 0; - if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; hardMode = false; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; hardMode = true; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; hardMode = false; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; hardMode = true; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; hardMode = false; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; hardMode = true; return true; diff --git a/Items/Armour/FistMartialHead.cs b/Items/Armour/FistMartialHead.cs index d4a6bcc..f4ade89 100644 --- a/Items/Armour/FistMartialHead.cs +++ b/Items/Armour/FistMartialHead.cs @@ -81,20 +81,20 @@ public override void DrawHair(ref bool drawHair, ref bool drawAltHair) public override bool IsArmorSet(Item head, Item body, Item legs) { armourSet = 0; - if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; return true; diff --git a/Items/Armour/FistMasterHead.cs b/Items/Armour/FistMasterHead.cs index 899652a..cac8b2f 100644 --- a/Items/Armour/FistMasterHead.cs +++ b/Items/Armour/FistMasterHead.cs @@ -79,20 +79,20 @@ public override void DrawHair(ref bool drawHair, ref bool drawAltHair) public override bool IsArmorSet(Item head, Item body, Item legs) { armourSet = 0; - if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; return true; diff --git a/Items/Armour/FistVeteranHead.cs b/Items/Armour/FistVeteranHead.cs index 7e24339..989c5fd 100644 --- a/Items/Armour/FistVeteranHead.cs +++ b/Items/Armour/FistVeteranHead.cs @@ -91,38 +91,38 @@ public override void DrawHair(ref bool drawHair, ref bool drawAltHair) public override bool IsArmorSet(Item head, Item body, Item legs) { armourSet = 0; - if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; hardMode = false; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 1; hardMode = true; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; hardMode = false; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 2; hardMode = true; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; hardMode = false; return true; } - else if (body.type == mod.ItemType() && - legs.type == mod.ItemType()) + else if (body.type == ModContent.ItemType() && + legs.type == ModContent.ItemType()) { armourSet = 3; hardMode = true; return true; diff --git a/Items/Armour/LunarFistHead.cs b/Items/Armour/LunarFistHead.cs index 3cdd50c..05e9f25 100644 --- a/Items/Armour/LunarFistHead.cs +++ b/Items/Armour/LunarFistHead.cs @@ -1,75 +1,75 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; using Microsoft.Xna.Framework; -namespace WeaponOut.Items.Armour -{ - [AutoloadEquip(EquipType.Head)] - public class LunarFistHead : ModItem - { - public override void SetStaticDefaults() { +namespace WeaponOut.Items.Armour +{ + [AutoloadEquip(EquipType.Head)] + public class LunarFistHead : ModItem + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Starlight Circlet"); - DisplayName.AddTranslation(GameCulture.Russian, "Звёздная тиара"); - - Tooltip.SetDefault( - "15% increased minion damage, 13% increased melee critical strike chance\n" + - "Fighting bosses slowly empowers next melee attack, up to 2500%\n" + + DisplayName.AddTranslation(GameCulture.Russian, "Звёздная тиара"); + + Tooltip.SetDefault( + "15% increased minion damage, 13% increased melee critical strike chance\n" + + "Fighting bosses slowly empowers next melee attack, up to 2500%\n" + "Increases your max number of minions by 1"); Tooltip.AddTranslation(GameCulture.Russian, "+15% к урону миньонов, +13% к шансу критического удара ближнего боя\n" + "Драка с боссами увеличивает следующую ближнюю атаку, вплоть до 2500%\n" + - "+1 к количеству миньонов"); - + "+1 к количеству миньонов"); + ModTranslation text; - text = mod.CreateTranslation("LunarFistHeadBonus"); - text.SetDefault("Double tap $BUTTON to switch your guardian's stance"); - mod.AddTranslation(text); - } + text = mod.CreateTranslation("LunarFistHeadBonus"); + text.SetDefault("Double tap $BUTTON to switch your guardian's stance"); + mod.AddTranslation(text); + } public override void SetDefaults() - { - item.defense = 16; - item.value = 0; - item.rare = 10; - - item.width = 18; - item.height = 18; - } + { + item.defense = 16; + item.value = 0; + item.rare = 10; + + item.width = 18; + item.height = 18; + } public override void AddRecipes() - { - if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentStardust, 4); - recipe.AddIngredient(ItemID.FragmentSolar, 4); - recipe.AddIngredient(ItemID.LunarBar, 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - + { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentStardust, 4); + recipe.AddIngredient(ItemID.FragmentSolar, 4); + recipe.AddIngredient(ItemID.LunarBar, 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + public override void UpdateEquip(Player player) - { - player.minionDamage += 0.15f; - player.meleeCrit += 13; - player.maxMinions += 1; - player.GetModPlayer().patienceDamage = 25f; // Can do up to 2500% + { + player.minionDamage += 0.15f; + player.meleeCrit += 13; + player.maxMinions += 1; + player.GetModPlayer().patienceDamage = 25f; // Can do up to 2500% player.GetModPlayer().patienceBuildUpModifier += 0.4f; // 75->105% - Lighting.AddLight(player.Center + player.velocity, new Vector3(0.9f, 0.9f, 0.95f)); - } - + Lighting.AddLight(player.Center + player.velocity, new Vector3(0.9f, 0.9f, 0.95f)); + } + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) { drawHair = true; } public override bool IsArmorSet(Item head, Item body, Item legs) { - return head.type == mod.ItemType() - && body.type == mod.ItemType() - && legs.type == mod.ItemType(); + return head.type == ModContent.ItemType() + && body.type == ModContent.ItemType() + && legs.type == ModContent.ItemType(); } - public override void UpdateArmorSet(Player player) + public override void UpdateArmorSet(Player player) { string button = Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"); player.setBonus = WeaponOut.GetTranslationTextValue("LunarFistHeadBonus").Replace("$BUTTON", button); @@ -77,8 +77,8 @@ public override void UpdateArmorSet(Player player) if (player.whoAmI == Main.myPlayer) { // Based on Stardust Guardian spawn - int buffID = mod.BuffType(); - int guardianID = mod.ProjectileType(); + int buffID = ModContent.BuffType(); + int guardianID = ModContent.ProjectileType(); if (player.FindBuffIndex(buffID) == -1) player.AddBuff(buffID, 1, true); if (player.ownedProjectileCounts[guardianID] < 1) // No guardian? spawn one Projectile.NewProjectile( @@ -86,12 +86,12 @@ public override void UpdateArmorSet(Player player) player.Center.Y, 0.0f, -1f, guardianID, 0, 0.0f, Main.myPlayer, 0.0f, 0.0f); } - } - - public override void ArmorSetShadows(Player player) + } + + public override void ArmorSetShadows(Player player) { player.armorEffectDrawShadow = true; - player.armorEffectDrawOutlinesForbidden = true; + player.armorEffectDrawOutlinesForbidden = true; } public override void DrawArmorColor(Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor) diff --git a/Items/BuddyHorn.cs b/Items/BuddyHorn.cs index 136a6e2..b241ac2 100644 --- a/Items/BuddyHorn.cs +++ b/Items/BuddyHorn.cs @@ -66,8 +66,8 @@ public override bool UseItem(Player player) if (player.SpawnX > 0) spawnX = player.SpawnX; if (player.SpawnY > 0) spawnY = player.SpawnY; - int entrance = mod.ProjectileType(); - int exit = mod.ProjectileType(); + int entrance = ModContent.ProjectileType(); + int exit = ModContent.ProjectileType(); foreach (Projectile projectile in Main.projectile) { diff --git a/Items/DemonBloodCure.cs b/Items/DemonBloodCure.cs index 20bd09e..96e939e 100644 --- a/Items/DemonBloodCure.cs +++ b/Items/DemonBloodCure.cs @@ -44,7 +44,7 @@ public override void AddRecipes() if (!ModConf.EnableFists) return; ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(mod.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.PixieDust); recipe.AddIngredient(ItemID.Daybloom); recipe.AddIngredient(ItemID.Shiverthorn); diff --git a/Items/MeteorBreakshot.cs b/Items/MeteorBreakshot.cs index cd5034f..090ea14 100644 --- a/Items/MeteorBreakshot.cs +++ b/Items/MeteorBreakshot.cs @@ -32,7 +32,7 @@ public override void SetDefaults() item.ranged = true; item.ammo = AmmoID.Bullet; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 2.5f; item.damage = 9; item.knockBack = 3f; diff --git a/Items/MonsterMead.cs b/Items/MonsterMead.cs index 994b6f8..d1d291b 100644 --- a/Items/MonsterMead.cs +++ b/Items/MonsterMead.cs @@ -22,7 +22,7 @@ public override void SetStaticDefaults() public override void SetDefaults() { item.CloneDefaults(ItemID.Ale); - item.buffType = mod.BuffType(); + item.buffType = ModContent.BuffType(); item.buffTime = 3600 * 5; // 5 mins } public override void AddRecipes() diff --git a/Items/RustedBadge.cs b/Items/RustedBadge.cs index 68ff901..da1199a 100644 --- a/Items/RustedBadge.cs +++ b/Items/RustedBadge.cs @@ -29,13 +29,13 @@ public override void AddRecipes() { if (!ModConf.EnableAccessories) return; ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ItemID.Obsidifish, 3); // Rough polish recipe.AddIngredient(ItemID.ArmoredCavefish, 2); // Fine polish recipe.AddIngredient(ItemID.Silk, 1); // Buffing recipe.AddTile(TileID.Sawmill); recipe.needWater = true; - recipe.SetResult(mod.ItemType(), 1); + recipe.SetResult(ModContent.ItemType(), 1); recipe.AddRecipe(); } } diff --git a/Items/ScatterShot.cs b/Items/ScatterShot.cs index b7a2249..e5bc131 100644 --- a/Items/ScatterShot.cs +++ b/Items/ScatterShot.cs @@ -33,7 +33,7 @@ public override void SetDefaults() item.ranged = true; item.ammo = AmmoID.Bullet; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 4; item.damage = 7; item.knockBack = 1; diff --git a/Items/SplinterShot.cs b/Items/SplinterShot.cs index 7d0fd53..926e70d 100644 --- a/Items/SplinterShot.cs +++ b/Items/SplinterShot.cs @@ -33,7 +33,7 @@ public override void SetDefaults() item.ranged = true; item.ammo = AmmoID.Bullet; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 2; item.damage = 4; item.knockBack = 1; diff --git a/Items/Weapons/Basic/ChannelerStaff.cs b/Items/Weapons/Basic/ChannelerStaff.cs index bbf3c88..4937b9a 100644 --- a/Items/Weapons/Basic/ChannelerStaff.cs +++ b/Items/Weapons/Basic/ChannelerStaff.cs @@ -54,7 +54,7 @@ public override void SetDefaults() item.knockBack = 0; item.mana = 8; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 2; item.useStyle = 5; //aim diff --git a/Items/Weapons/Basic/DemonBlaster.cs b/Items/Weapons/Basic/DemonBlaster.cs index 327af36..9cbacc3 100644 --- a/Items/Weapons/Basic/DemonBlaster.cs +++ b/Items/Weapons/Basic/DemonBlaster.cs @@ -42,7 +42,7 @@ public override void SetDefaults() item.autoReuse = true; item.noMelee = true; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30; item.useStyle = 5; diff --git a/Items/Weapons/Basic/ManaBlast.cs b/Items/Weapons/Basic/ManaBlast.cs index 98476e8..9eab83c 100644 --- a/Items/Weapons/Basic/ManaBlast.cs +++ b/Items/Weapons/Basic/ManaBlast.cs @@ -33,7 +33,7 @@ public override void SetDefaults() item.autoReuse = true; item.noMelee = true; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7; item.useStyle = 5; diff --git a/Items/Weapons/Basic/StaffOfExplosion.cs b/Items/Weapons/Basic/StaffOfExplosion.cs index 7369f16..6af67c1 100644 --- a/Items/Weapons/Basic/StaffOfExplosion.cs +++ b/Items/Weapons/Basic/StaffOfExplosion.cs @@ -42,7 +42,7 @@ public override void SetDefaults() item.noMelee = true; Item.staff[item.type] = true; //rotate weapon, as it is a staff - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1; item.useStyle = 5; diff --git a/Items/Weapons/Dual/ManaSword.cs b/Items/Weapons/Dual/ManaSword.cs index 25c8506..b424347 100644 --- a/Items/Weapons/Dual/ManaSword.cs +++ b/Items/Weapons/Dual/ManaSword.cs @@ -45,7 +45,7 @@ public override void SetDefaults() item.knockBack = 5f; item.mana = 10; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; Item.staff[item.type] = true; //rotate weapon, as it is a staff @@ -66,7 +66,7 @@ public override void AddRecipes() { { recipe.AddIngredient(ItemID.TitaniumSword, 1); } - recipe.AddIngredient(mod.GetItem().item.type, 1); + recipe.AddIngredient(ModContent.GetInstance().item.type, 1); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); @@ -86,14 +86,14 @@ public override bool CanUseItem(Player player) item.UseSound = SoundID.Item68; item.noMelee = true; player.manaCost *= 4f; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); } else { item.useStyle = 1; item.UseSound = SoundID.Item28; item.noMelee = false; - item.shoot = mod.ProjectileType(); + item.shoot = ModContent.ProjectileType(); } return true; } diff --git a/Items/Weapons/Fists/FistsAdamant.cs b/Items/Weapons/Fists/FistsAdamant.cs index abed892..5e0de7b 100644 --- a/Items/Weapons/Fists/FistsAdamant.cs +++ b/Items/Weapons/Fists/FistsAdamant.cs @@ -33,7 +33,7 @@ public override void SetStaticDefaults() "Комбо: разрушительные удары"); altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - projID = mod.ProjectileType(); + projID = ModContent.ProjectileType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Fists/FistsBetsy.cs b/Items/Weapons/Fists/FistsBetsy.cs index 6142f95..bf6da4b 100644 --- a/Items/Weapons/Fists/FistsBetsy.cs +++ b/Items/Weapons/Fists/FistsBetsy.cs @@ -34,7 +34,7 @@ public override void SetStaticDefaults() "Комбо: урон передаётся ближайшим врагам"); altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - projectileID = mod.ProjectileType(); + projectileID = ModContent.ProjectileType(); customGlowMask = WeaponOut.SetStaticDefaultsGlowMask(this); } public override void SetDefaults() @@ -151,7 +151,7 @@ public override void HoldItem(Player player) { if (Main.time % 30 == 0) { - player.AddBuff(mod.BuffType(), 60, false); + player.AddBuff(ModContent.BuffType(), 60, false); } } } diff --git a/Items/Weapons/Fists/FistsBone.cs b/Items/Weapons/Fists/FistsBone.cs index a6b04cc..292d00a 100644 --- a/Items/Weapons/Fists/FistsBone.cs +++ b/Items/Weapons/Fists/FistsBone.cs @@ -33,7 +33,7 @@ public override void SetStaticDefaults() "'Руку подать?'"); altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - skeleBroID = mod.ProjectileType(); + skeleBroID = ModContent.ProjectileType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Fists/FistsForbidden.cs b/Items/Weapons/Fists/FistsForbidden.cs index a5fabfa..4e71bd8 100644 --- a/Items/Weapons/Fists/FistsForbidden.cs +++ b/Items/Weapons/Fists/FistsForbidden.cs @@ -1,216 +1,217 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class FistsForbidden : ModItem - { - public static int altEffect = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Forbidden Gauntlet"); - DisplayName.AddTranslation(GameCulture.Chinese, "禁戒钢拳"); - DisplayName.AddTranslation(GameCulture.Russian, "Запретная Рукавица"); - - Tooltip.SetDefault( - " to transform into a raging sandstorm\n" + - "Dash reduces damage, but steals life\n" + - "Combo causes attacks to wear away at enemies\n" + - "'Forbidden techniques in the palm of your hand'"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键将让玩家身边出现肆虐的沙尘暴\n冲刺时免疫伤害且窃取生命值\n连击会使敌人受到磨损伤害\n“禁戒之力在你的手心里”"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы прорваться через врагов\n" + - "Рывок: меньше урона, крадёт жизнь\n" + - "Комбо: атаки медленно калечат врагов" + - "'Запретные техники на ладони'"); - - altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 101; - item.useAnimation = 30; // 30%-50% reduction - item.knockBack = 6.5f; - item.tileBoost = 7; // Combo Power - - item.value = Item.sellPrice(0, 1, 0, 0); - item.rare = 5; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item18; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 20; - const float fistDashSpeed = 10f; - const float fistDashThresh = 8f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().dashEffect == altEffect; } - const float altDashSpeed = 15f; - const float altDashThresh = 10f; - const float altJumpVelo = 16.85f; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - for (int i = 0; i < 2; i++) - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - if (i == 0) - { recipe.AddIngredient(ItemID.AdamantiteBar, 5); } - else - { recipe.AddIngredient(ItemID.TitaniumBar, 5); } - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } - - /// The method called during a dash. Use for ongoing dust and gore effects. - public static void DashEffects(Player player, Item item) - { - if (player.velocity.Y != 0) - { - player.velocity.Y -= (player.gravity * player.gravDir) / 2; - } - - player.GetModPlayer().hidden = true; - - if (player.dashDelay == 0) - { - Main.PlaySound(SoundID.DD2_FlameburstTowerShot, player.position); - } - else - { - - Vector2 bigPos = player.position - new Vector2(8, 8); - for (int i = 0; i < 5; i++) - { - Dust d = Main.dust[Dust.NewDust(bigPos, player.width + 16, player.height + 16, 32, 0f, 0f, 140)]; - d.velocity *= -1f; - d.velocity.X += player.velocity.X * 4f; - d.velocity.Y += player.velocity.Y * 2f; - d.position -= d.velocity * 4f; - d.scale = 1f; - d.fadeIn = 1.6f; - d.noGravity = true; - d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - - d = Main.dust[Dust.NewDust(bigPos, player.width + 16, player.height + 16, 32, player.velocity.X, player.velocity.Y, 50, default(Color), 2f)]; - d.position += d.velocity; - d.noGravity = true; - d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - - if (i < 2) - { - d = Main.dust[Dust.NewDust(bigPos, player.width + 16, player.height + 16, DustID.Sandnado, 0f, 0f, 120)]; - d.velocity += player.velocity / 10; - d.position += d.velocity * 5f; - d.fadeIn = 0.7f; - d.scale = 0.2f; - d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - } - } - } - - // Dash & Combo - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - if (AltStats(player) && !target.immortal) - { - PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / 30f); - } - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActiveItemOnHit) - { - target.AddBuff(mod.BuffType(), 600, false); - } - } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - target.AddBuff(mod.BuffType(), 600, false); - } - } - - //Dash reduced damage - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - if (AltStats(player)) - { - damage = (int)(damage * 0.75f); - } - } - - // Melee Effect - public override void MeleeEffects(Player player, Rectangle hitbox) - { - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 26); - Vector2 pVelo = (player.position - player.oldPosition); - Vector2 velocity = ModPlayerFists.GetFistVelocity(player) * -3f + pVelo * 0.5f; - Dust d; - - Vector2 pos = r.TopLeft(); - for (int i = 0; i < 2; i++) - { - d = Main.dust[Dust.NewDust(pos, r.Width, r.Height, DustID.Sandnado, - velocity.X * -1.5f, velocity.Y * -1.5f, 100, default(Color), 0.2f)]; - d.noGravity = true; - d.fadeIn = 0.4f; - } - } - - #region Hardmode Dash Base - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - if (player.dashDelay == 0) - { - player.GetModPlayer(). - SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, altEffect); - return true; - } - return false; - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 16f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, altJumpVelo, 0.5f, 16f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class FistsForbidden : ModItem + { + public static int altEffect = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Forbidden Gauntlet"); + DisplayName.AddTranslation(GameCulture.Chinese, "禁戒钢拳"); + DisplayName.AddTranslation(GameCulture.Russian, "Запретная Рукавица"); + + Tooltip.SetDefault( + " to transform into a raging sandstorm\n" + + "Dash reduces damage, but steals life\n" + + "Combo causes attacks to wear away at enemies\n" + + "'Forbidden techniques in the palm of your hand'"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键将让玩家身边出现肆虐的沙尘暴\n冲刺时免疫伤害且窃取生命值\n连击会使敌人受到磨损伤害\n“禁戒之力在你的手心里”"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы прорваться через врагов\n" + + "Рывок: меньше урона, крадёт жизнь\n" + + "Комбо: атаки медленно калечат врагов" + + "'Запретные техники на ладони'"); + + altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 101; + item.useAnimation = 30; // 30%-50% reduction + item.knockBack = 6.5f; + item.tileBoost = 7; // Combo Power + + item.value = Item.sellPrice(0, 1, 0, 0); + item.rare = 5; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item18; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 20; + const float fistDashSpeed = 10f; + const float fistDashThresh = 8f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().dashEffect == altEffect; } + const float altDashSpeed = 15f; + const float altDashThresh = 10f; + const float altJumpVelo = 16.85f; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + for (int i = 0; i < 2; i++) + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + if (i == 0) + { recipe.AddIngredient(ItemID.AdamantiteBar, 5); } + else + { recipe.AddIngredient(ItemID.TitaniumBar, 5); } + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + /// The method called during a dash. Use for ongoing dust and gore effects. + public static void DashEffects(Player player, Item item) + { + if (player.velocity.Y != 0) + { + player.velocity.Y -= (player.gravity * player.gravDir) / 2; + } + + player.GetModPlayer().hidden = true; + + if (player.dashDelay == 0) + { + Main.PlaySound(SoundID.DD2_FlameburstTowerShot, player.position); + } + else + { + + Vector2 bigPos = player.position - new Vector2(8, 8); + for (int i = 0; i < 5; i++) + { + Dust d = Main.dust[Dust.NewDust(bigPos, player.width + 16, player.height + 16, 32, 0f, 0f, 140)]; + d.velocity *= -1f; + d.velocity.X += player.velocity.X * 4f; + d.velocity.Y += player.velocity.Y * 2f; + d.position -= d.velocity * 4f; + d.scale = 1f; + d.fadeIn = 1.6f; + d.noGravity = true; + d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + + d = Main.dust[Dust.NewDust(bigPos, player.width + 16, player.height + 16, 32, player.velocity.X, player.velocity.Y, 50, default(Color), 2f)]; + d.position += d.velocity; + d.noGravity = true; + d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + + if (i < 2) + { + d = Main.dust[Dust.NewDust(bigPos, player.width + 16, player.height + 16, DustID.Sandnado, 0f, 0f, 120)]; + d.velocity += player.velocity / 10; + d.position += d.velocity * 5f; + d.fadeIn = 0.7f; + d.scale = 0.2f; + d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + } + } + } + + // Dash & Combo + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + if (AltStats(player) && !target.immortal) + { + PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / 30f); + } + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActiveItemOnHit) + { + target.AddBuff(ModContent.BuffType(), 600, false); + } + } + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + target.AddBuff(ModContent.BuffType(), 600, false); + } + } + + //Dash reduced damage + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + if (AltStats(player)) + { + damage = (int)(damage * 0.75f); + } + } + + // Melee Effect + public override void MeleeEffects(Player player, Rectangle hitbox) + { + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 26); + Vector2 pVelo = (player.position - player.oldPosition); + Vector2 velocity = ModPlayerFists.GetFistVelocity(player) * -3f + pVelo * 0.5f; + Dust d; + + Vector2 pos = r.TopLeft(); + for (int i = 0; i < 2; i++) + { + d = Main.dust[Dust.NewDust(pos, r.Width, r.Height, DustID.Sandnado, + velocity.X * -1.5f, velocity.Y * -1.5f, 100, default(Color), 0.2f)]; + d.noGravity = true; + d.fadeIn = 0.4f; + } + } + + #region Hardmode Dash Base + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + if (player.dashDelay == 0) + { + player.GetModPlayer(). + SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, altEffect); + return true; + } + return false; + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 16f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, altJumpVelo, 0.5f, 16f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/FistsFrozen.cs b/Items/Weapons/Fists/FistsFrozen.cs index 81f3cda..d1518f6 100644 --- a/Items/Weapons/Fists/FistsFrozen.cs +++ b/Items/Weapons/Fists/FistsFrozen.cs @@ -33,7 +33,7 @@ public override void SetStaticDefaults() "Комбо: оставляет холодный след, усиливающий морозное пламя"); altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - projectileID = mod.ProjectileType(); + projectileID = ModContent.ProjectileType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Fists/FistsHokuto.cs b/Items/Weapons/Fists/FistsHokuto.cs index 5a523f9..99fa67c 100644 --- a/Items/Weapons/Fists/FistsHokuto.cs +++ b/Items/Weapons/Fists/FistsHokuto.cs @@ -1,420 +1,422 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; -using Terraria.Graphics.Shaders; - -namespace WeaponOut.Items.Weapons.Fists -{ - /// - /// This may or may not be a joke item - /// - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] // Uncomment if you have hand sprites - public class FistsHokuto : ModItem - { - public static int dashEffect = 0; // ID for when this fist is dashing - public static int altEffect = 0; // ID for when this fist is using combo power - public static int buffID = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polaris Punch"); - DisplayName.AddTranslation(GameCulture.Russian, "Полярный Удар"); - - Tooltip.SetDefault( - " to dash, or consume combo to unleash a deadly combo\n" + - "Dash for a projectile deflecting punch\n" + - "Increases length of combo by 5 second whilst held\n" + - "'Channel the power of the constellations'"); - Tooltip.AddTranslation(GameCulture.Russian, - " для рывка, или использовать заряд комбо для смертельного комбо\n" + - "Рывок отталкивает снаряды\n" + - "Увеличивает длительность комбо на 5 секунд, когда в руке\n" + - "'Вся мощь созвездий'"); - - dashEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - buffID = mod.BuffType(); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 290; // 795dps (vs 50 def) - item.useAnimation = 20; // Reduced by 30-50% on hit, increasing DPS - item.knockBack = 7f; - item.tileBoost = 100; // Combo Power - - item.value = Item.sellPrice(0, 0, 5, 0); - item.rare = 8; // >= 4, can use second uppercut - item.shootSpeed = 10 + item.rare / 2; // Default shoot speed in case it needs to fire projectiles - - item.UseSound = SoundID.Item20; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 22; // Actual punching hitbox - const float fistDashSpeed = 10f; // Speed at start of dash - const float fistDashThresh = 7f; // Minimum speed of dash (before ending) - const float fistJumpVelo = 14f; // http://rextester.com/OIY60171 for jump height in tiles - public bool DashStats(Player p) { return p.GetModPlayer().dashEffect == dashEffect; } - public bool ComboStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } - const int altHitboxSize = (int)(fistHitboxSize * 5f); - const float altDashSpeed = 17f; // Dash speed when dashing through enemies - const float altDashThresh = 10f; - const float altJumpVelo = 17f; - const int comboDelay = 80; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddIngredient(ItemID.FragmentNebula, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - /// The method called during a dash. Use for ongoing effects like dust. - public static void DashEffects(Player player, Item item) - { - - if (player.dashDelay == 0) { } - // =================== BEHAVIOURS =================== // - - for (int i = 0; i < 3; i++) // Fire! - { - Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.height, 173, - -player.velocity.X, 0, 100, default(Color), 2 + i * 0.15f)]; - d.noGravity = true; - d.velocity.Y = player.velocity.Y * -0.5f; - d.velocity *= 0.7f; - d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - - d = Main.dust[Dust.NewDust(player.position, player.width, player.height, 180, - -player.velocity.X, 0, 100, default(Color), 2 + i * 0.15f)]; - d.noGravity = true; - d.velocity.Y = player.velocity.Y * -0.5f; - d.velocity *= 0.7f; - d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - - player.GetModPlayer().reflectingProjectilesForce = true; - player.GetModPlayer().reflectingProjectilesParryStyle = true; - - // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // - } - const int flurryDuration = 150; - const int flurryEndDelay = 60; - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) { - - player.AddBuff(buffID, flurryDuration + flurryEndDelay + comboDelay, false); // Flurry - player.itemAnimation = player.itemAnimationMax + comboDelay; // Set initial combo animation delay - player.GetModPlayer().jumpAgainUppercut = true; // Hardmode combos reset uppercut - Main.PlaySound(WeaponOut.mod.GetLegacySoundSlot - (SoundType.Item, "Sounds/Item/HokutoActivate").WithPitchVariance(0f), - player.position); - } - // Charging (Hardmode) - int bIdx = player.FindBuffIndex(buffID); - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, altHitboxSize); - player.statDefense += player.itemAnimation; // Bonus defence during special - if (player.itemAnimation > player.itemAnimationMax) - { - // =================== BEHAVIOURS =================== // - - // Charge effect - for (int i = 0; i < 2; i++) - { - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 175, 0, 0, 0, default(Color), 1.5f)]; - d.position -= d.velocity * 10f; - d.velocity /= 2; - d.noGravity = true; - } - - // Final punch effect - if(bIdx >= 0 && player.buffTime[bIdx] <= flurryEndDelay) { - - player.velocity.Y -= player.gravity; - // Move towards mouse - if (player.whoAmI == Main.myPlayer && player.buffTime[bIdx] % 3 == 0) { - - Vector2 velo = Main.MouseWorld - player.Center; - velo.Normalize(); - velo *= altDashSpeed * 2f; - player.velocity = (player.velocity * 3 + velo) / 4; - NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); - } - } - - // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // - } - // Initial throw - else if (player.itemAnimation == player.itemAnimationMax) - { - if (bIdx >= 0 && player.buffTime[bIdx] > flurryEndDelay) { - - // Higher pitch for initiate - Main.PlaySound(WeaponOut.mod.GetLegacySoundSlot - (SoundType.Item, "Sounds/Item/HokutoFlurry").WithPitchVariance(0f)); - } else { - - // Boost otherwise - Vector2 velo = Main.MouseWorld - player.Center; - velo.Normalize(); - velo *= altDashSpeed; - player.velocity = velo; - NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); - } - - // =================== BEHAVIOURS =================== // - - // Swag dust ring - for (int i = 0; i < 64; i++) - { - double angle = Main.time + i / 10.0; - Dust d = Dust.NewDustPerfect(player.Center, i % 2 == 0 ? 173 : 162, - new Vector2((float)(5.0 * Math.Sin(angle)), (float)(5.0 * Math.Cos(angle)))); - d.noGravity = true; - d.fadeIn = 1.3f; - d.velocity *= 2f; - } - - // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // - } - else - { - // =================== BEHAVIOURS =================== // - - // Reset - bool bigPunch = false; - if (bIdx >= 0) { - - if (player.buffTime[bIdx] > flurryEndDelay) { - if (player.itemAnimation <= player.itemAnimationMax / 2) { - - // Reset in flurry - player.itemAnimation = player.itemAnimationMax; - ModPlayerFists.Get(player).specialMove = 0; - - // Move towards mouse - if (player.whoAmI == Main.myPlayer) { - - Vector2 velo = Main.MouseWorld - player.Center; - velo.Normalize(); - velo *= altDashSpeed; - player.velocity = (player.velocity * 2 + velo) / 3; - NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); - } - } - }else { - - if(player.buffTime[bIdx] == flurryEndDelay) { - // Higher pitch for initiate - Main.PlaySound(WeaponOut.mod.GetLegacySoundSlot - (SoundType.Item, "Sounds/Item/HokutoEnd").WithPitchVariance(0f)); - } - - // Last punch, double hitbox - player.itemAnimation = player.buffTime[bIdx] + 1; - r = ModPlayerFists.UseItemGraphicbox(player, 16, altHitboxSize * 2); - bigPunch = true; - } - - } - - Vector2 pVelo = (player.position - player.oldPosition); - Vector2 velocity = ModPlayerFists.GetFistVelocity(player) * -3f + pVelo * 0.5f; - Dust d; - - for (int i = 0; i < 8; i++) { - d = Main.dust[Dust.NewDust(r.TopLeft(), r.Width, r.Height, 173, - velocity.X, velocity.Y)]; - d.velocity *= bigPunch ? 3f : 2f; - d.noGravity = true; - d.scale *= bigPunch ? 4f : 1.5f; - } - - // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // - } - } - - - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit, target.statLife, target.Center, target.velocity); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit, target.life, target.Center, target.velocity); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit, int targetLife, Vector2 targetCentre, Vector2 targetVelocity) - { - // Dashing Bonus - if (DashStats(player)) // If dashing - { - // =================== BEHAVIOURS =================== // - - knockBack = 0f; // No knockback - - // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // - } - - // Combo Bonus - ModPlayerFists mpf = player.GetModPlayer(); - if (ComboStats(player)) - { - // =================== BEHAVIOURS =================== // - - int bIdx = player.FindBuffIndex(buffID); - if (bIdx >= 0) { - - // And back - Vector2 velo = player.Center - targetCentre; - velo.Normalize(); - velo *= altDashSpeed; - velo += targetVelocity; - - if (player.buffTime[bIdx] > flurryEndDelay) { - - damage = (int)(damage * 0.9f); // flurry attack - knockBack = 0f; // no knockback - ModPlayerFists.Get(player).ModifyComboCounter(0, true); - - player.velocity = (player.velocity * 2 + velo) / 3; - } - else { - - damage = 1; // little damage - knockBack = 0f; // no knockback - ModPlayerFists.Get(player).ModifyComboCounter(1, true); - - player.velocity = velo; - } - - // And back - NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); - - } - - // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { - - if (ComboStats(player)) { - - int bIdx = player.FindBuffIndex(buffID); - if (bIdx >= 0) { - - if (player.buffTime[bIdx] > flurryEndDelay) { - - // Slowdown target - if (target.velocity.Equals(default(Vector2))) return; - target.velocity /= 2; - target.netUpdate = true; - } - else { - - // Final hit - PlayerFX pfx = player.GetModPlayer(); - if (pfx.omHaMoShin == null) { - pfx.omHaMoShin = target; - pfx.omHaMoShindearuTimer = PlayerFX.omHaMoShindearuTimerMax; - } - else if (pfx.omHaMoShin.life < target.life) { - pfx.omHaMoShin = target; - pfx.omHaMoShindearuTimer = PlayerFX.omHaMoShindearuTimerMax; - } - } - } - } - } - - - // Combo duration extender - public override void UpdateInventory(Player player) { if (player.HeldItem != item) return; - - ModPlayerFists mpf = ModPlayerFists.Get(player); - mpf.comboResetTimeBonus += 300; - } - - // Melee Effect - public override void MeleeEffects(Player player, Rectangle hitbox) - { - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 4, fistHitboxSize); - Vector2 pVelo = (player.position - player.oldPosition); - Vector2 velocity = ModPlayerFists.GetFistVelocity(player) * -3f + pVelo * 0.5f; - Dust d; - - for (int i = 0; i < 6; i++) { - d = Main.dust[Dust.NewDust(r.TopLeft(), r.Width, r.Height, 173, - velocity.X, velocity.Y)]; - d.velocity *= 1f; - d.noGravity = true; - d.scale *= 1.2f; - } - } - - #region Advanced Dash-Combo Base: CanUseItem, AltFunctionUse, UseItemHitbox, ModifyTooltips - // - // ITEM CODE CHANGES - DON'T MESS UNLESS YOU KNOW WHAT YOU'RE DOIN - // - - // Apply dash on punch - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - // Apply better dash on alternate punch - public override bool AltFunctionUse(Player player) - { - if (!player.GetModPlayer(). - AltFunctionCombo(player, altEffect)) - { - return player.dashDelay == 0 && player.GetModPlayer(). - SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, dashEffect); ; - } - return true; - } - // Hitbox and special attack movement - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!ComboStats(player)) { - if (DashStats(player)) { - ModPlayerFists.UseItemHitbox(player, ref hitbox, - fistHitboxSize, altJumpVelo, 0.5f, 16f); - } - else { - ModPlayerFists.UseItemHitbox(player, ref hitbox, - fistHitboxSize, fistJumpVelo, 0.5f, 16f); - } - } - else { - int bIdx = player.FindBuffIndex(buffID); - - if (bIdx >= 0 && player.buffTime[bIdx] > flurryEndDelay) { - ModPlayerFists.UseItemHitbox(player, ref hitbox, - altHitboxSize, altJumpVelo, 0.5f, altDashSpeed); - } - else { - ModPlayerFists.UseItemHitbox(player, ref hitbox, - altHitboxSize * 2, altJumpVelo, 0.5f, altDashSpeed); - } - } - } - // Modify tooltip to replace tileboost with combo power - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - #endregion - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; +using Terraria.Graphics.Shaders; + +namespace WeaponOut.Items.Weapons.Fists +{ + /// + /// This may or may not be a joke item + /// + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] // Uncomment if you have hand sprites + public class FistsHokuto : ModItem + { + public static int dashEffect = 0; // ID for when this fist is dashing + public static int altEffect = 0; // ID for when this fist is using combo power + public static int buffID = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polaris Punch"); + DisplayName.AddTranslation(GameCulture.Russian, "Полярный Удар"); + + Tooltip.SetDefault( + " to dash, or consume combo to unleash a deadly combo\n" + + "Dash for a projectile deflecting punch\n" + + "Increases length of combo by 5 second whilst held\n" + + "'Channel the power of the constellations'"); + Tooltip.AddTranslation(GameCulture.Russian, + " для рывка, или использовать заряд комбо для смертельного комбо\n" + + "Рывок отталкивает снаряды\n" + + "Увеличивает длительность комбо на 5 секунд, когда в руке\n" + + "'Вся мощь созвездий'"); + + dashEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); + altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + buffID = ModContent.BuffType(); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 290; // 795dps (vs 50 def) + item.useAnimation = 20; // Reduced by 30-50% on hit, increasing DPS + item.knockBack = 7f; + item.tileBoost = 100; // Combo Power + + item.value = Item.sellPrice(0, 0, 5, 0); + item.rare = 8; // >= 4, can use second uppercut + item.shootSpeed = 10 + item.rare / 2; // Default shoot speed in case it needs to fire projectiles + + item.UseSound = SoundID.Item20; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 22; // Actual punching hitbox + const float fistDashSpeed = 10f; // Speed at start of dash + const float fistDashThresh = 7f; // Minimum speed of dash (before ending) + const float fistJumpVelo = 14f; // http://rextester.com/OIY60171 for jump height in tiles + public bool DashStats(Player p) { return p.GetModPlayer().dashEffect == dashEffect; } + public bool ComboStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } + const int altHitboxSize = (int)(fistHitboxSize * 5f); + const float altDashSpeed = 17f; // Dash speed when dashing through enemies + const float altDashThresh = 10f; + const float altJumpVelo = 17f; + const int comboDelay = 80; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddIngredient(ItemID.FragmentNebula, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + /// The method called during a dash. Use for ongoing effects like dust. + public static void DashEffects(Player player, Item item) + { + + if (player.dashDelay == 0) { } + // =================== BEHAVIOURS =================== // + + for (int i = 0; i < 3; i++) // Fire! + { + Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.height, 173, + -player.velocity.X, 0, 100, default(Color), 2 + i * 0.15f)]; + d.noGravity = true; + d.velocity.Y = player.velocity.Y * -0.5f; + d.velocity *= 0.7f; + d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + + d = Main.dust[Dust.NewDust(player.position, player.width, player.height, 180, + -player.velocity.X, 0, 100, default(Color), 2 + i * 0.15f)]; + d.noGravity = true; + d.velocity.Y = player.velocity.Y * -0.5f; + d.velocity *= 0.7f; + d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + + player.GetModPlayer().reflectingProjectilesForce = true; + player.GetModPlayer().reflectingProjectilesParryStyle = true; + + // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // + } + const int flurryDuration = 150; + const int flurryEndDelay = 60; + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) { + + player.AddBuff(buffID, flurryDuration + flurryEndDelay + comboDelay, false); // Flurry + player.itemAnimation = player.itemAnimationMax + comboDelay; // Set initial combo animation delay + player.GetModPlayer().jumpAgainUppercut = true; // Hardmode combos reset uppercut + Main.PlaySound(WeaponOut.mod.GetLegacySoundSlot + (SoundType.Item, "Sounds/Item/HokutoActivate").WithPitchVariance(0f), + player.position); + } + // Charging (Hardmode) + int bIdx = player.FindBuffIndex(buffID); + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, altHitboxSize); + player.statDefense += player.itemAnimation; // Bonus defence during special + if (player.itemAnimation > player.itemAnimationMax) + { + // =================== BEHAVIOURS =================== // + + // Charge effect + for (int i = 0; i < 2; i++) + { + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 175, 0, 0, 0, default(Color), 1.5f)]; + d.position -= d.velocity * 10f; + d.velocity /= 2; + d.noGravity = true; + } + + // Final punch effect + if(bIdx >= 0 && player.buffTime[bIdx] <= flurryEndDelay) { + + player.velocity.Y -= player.gravity; + // Move towards mouse + if (player.whoAmI == Main.myPlayer && player.buffTime[bIdx] % 3 == 0) { + + Vector2 velo = Main.MouseWorld - player.Center; + velo.Normalize(); + velo *= altDashSpeed * 2f; + player.velocity = (player.velocity * 3 + velo) / 4; + NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); + } + } + + // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // + } + // Initial throw + else if (player.itemAnimation == player.itemAnimationMax) + { + if (bIdx >= 0 && player.buffTime[bIdx] > flurryEndDelay) { + + // Higher pitch for initiate + Main.PlaySound(WeaponOut.mod.GetLegacySoundSlot + (SoundType.Item, "Sounds/Item/HokutoFlurry").WithPitchVariance(0f)); + } else { + + // Boost otherwise + Vector2 velo = Main.MouseWorld - player.Center; + velo.Normalize(); + velo *= altDashSpeed; + player.velocity = velo; + NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); + } + + // =================== BEHAVIOURS =================== // + + // Swag dust ring + for (int i = 0; i < 64; i++) + { + double angle = Main.time + i / 10.0; + Dust d = Dust.NewDustPerfect(player.Center, i % 2 == 0 ? 173 : 162, + new Vector2((float)(5.0 * Math.Sin(angle)), (float)(5.0 * Math.Cos(angle)))); + d.noGravity = true; + d.fadeIn = 1.3f; + d.velocity *= 2f; + } + + // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // + } + else + { + // =================== BEHAVIOURS =================== // + + // Reset + bool bigPunch = false; + if (bIdx >= 0) { + + if (player.buffTime[bIdx] > flurryEndDelay) { + if (player.itemAnimation <= player.itemAnimationMax / 2) { + + // Reset in flurry + player.itemAnimation = player.itemAnimationMax; + ModPlayerFists.Get(player).specialMove = 0; + + // Move towards mouse + if (player.whoAmI == Main.myPlayer) { + + Vector2 velo = Main.MouseWorld - player.Center; + velo.Normalize(); + velo *= altDashSpeed; + player.velocity = (player.velocity * 2 + velo) / 3; + NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); + } + } + }else { + + if(player.buffTime[bIdx] == flurryEndDelay) { + // Higher pitch for initiate + Main.PlaySound(WeaponOut.mod.GetLegacySoundSlot + (SoundType.Item, "Sounds/Item/HokutoEnd").WithPitchVariance(0f)); + } + + // Last punch, double hitbox + player.itemAnimation = player.buffTime[bIdx] + 1; + r = ModPlayerFists.UseItemGraphicbox(player, 16, altHitboxSize * 2); + bigPunch = true; + } + + } + + Vector2 pVelo = (player.position - player.oldPosition); + Vector2 velocity = ModPlayerFists.GetFistVelocity(player) * -3f + pVelo * 0.5f; + Dust d; + + for (int i = 0; i < 8; i++) { + d = Main.dust[Dust.NewDust(r.TopLeft(), r.Width, r.Height, 173, + velocity.X, velocity.Y)]; + d.velocity *= bigPunch ? 3f : 2f; + d.noGravity = true; + d.scale *= bigPunch ? 4f : 1.5f; + } + + // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // + } + } + + + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit, target.statLife, target.Center, target.velocity); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit, target.life, target.Center, target.velocity); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit, int targetLife, Vector2 targetCentre, Vector2 targetVelocity) + { + // Dashing Bonus + if (DashStats(player)) // If dashing + { + // =================== BEHAVIOURS =================== // + + knockBack = 0f; // No knockback + + // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // + } + + // Combo Bonus + ModPlayerFists mpf = player.GetModPlayer(); + if (ComboStats(player)) + { + // =================== BEHAVIOURS =================== // + + int bIdx = player.FindBuffIndex(buffID); + if (bIdx >= 0) { + + // And back + Vector2 velo = player.Center - targetCentre; + velo.Normalize(); + velo *= altDashSpeed; + velo += targetVelocity; + + if (player.buffTime[bIdx] > flurryEndDelay) { + + damage = (int)(damage * 0.9f); // flurry attack + knockBack = 0f; // no knockback + ModPlayerFists.Get(player).ModifyComboCounter(0, true); + + player.velocity = (player.velocity * 2 + velo) / 3; + } + else { + + damage = 1; // little damage + knockBack = 0f; // no knockback + ModPlayerFists.Get(player).ModifyComboCounter(1, true); + + player.velocity = velo; + } + + // And back + NetMessage.SendData(MessageID.SyncPlayer, -1, player.whoAmI, null, player.whoAmI); + + } + + // ^^^^^^^^^^^^^^^^^^^ BEHAVIOURS ^^^^^^^^^^^^^^^^^^^ // + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { + + if (ComboStats(player)) { + + int bIdx = player.FindBuffIndex(buffID); + if (bIdx >= 0) { + + if (player.buffTime[bIdx] > flurryEndDelay) { + + // Slowdown target + if (target.velocity.Equals(default(Vector2))) return; + target.velocity /= 2; + target.netUpdate = true; + } + else { + + // Final hit + PlayerFX pfx = player.GetModPlayer(); + if (pfx.omHaMoShin == null) { + pfx.omHaMoShin = target; + pfx.omHaMoShindearuTimer = PlayerFX.omHaMoShindearuTimerMax; + } + else if (pfx.omHaMoShin.life < target.life) { + pfx.omHaMoShin = target; + pfx.omHaMoShindearuTimer = PlayerFX.omHaMoShindearuTimerMax; + } + } + } + } + } + + + // Combo duration extender + public override void UpdateInventory(Player player) { + if (player.HeldItem != item) return; + + ModPlayerFists mpf = ModPlayerFists.Get(player); + mpf.comboResetTimeBonus += 300; + } + + // Melee Effect + public override void MeleeEffects(Player player, Rectangle hitbox) + { + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 4, fistHitboxSize); + Vector2 pVelo = (player.position - player.oldPosition); + Vector2 velocity = ModPlayerFists.GetFistVelocity(player) * -3f + pVelo * 0.5f; + Dust d; + + for (int i = 0; i < 6; i++) { + d = Main.dust[Dust.NewDust(r.TopLeft(), r.Width, r.Height, 173, + velocity.X, velocity.Y)]; + d.velocity *= 1f; + d.noGravity = true; + d.scale *= 1.2f; + } + } + + #region Advanced Dash-Combo Base: CanUseItem, AltFunctionUse, UseItemHitbox, ModifyTooltips + // + // ITEM CODE CHANGES - DON'T MESS UNLESS YOU KNOW WHAT YOU'RE DOIN + // + + // Apply dash on punch + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + // Apply better dash on alternate punch + public override bool AltFunctionUse(Player player) + { + if (!player.GetModPlayer(). + AltFunctionCombo(player, altEffect)) + { + return player.dashDelay == 0 && player.GetModPlayer(). + SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, dashEffect); ; + } + return true; + } + // Hitbox and special attack movement + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!ComboStats(player)) { + if (DashStats(player)) { + ModPlayerFists.UseItemHitbox(player, ref hitbox, + fistHitboxSize, altJumpVelo, 0.5f, 16f); + } + else { + ModPlayerFists.UseItemHitbox(player, ref hitbox, + fistHitboxSize, fistJumpVelo, 0.5f, 16f); + } + } + else { + int bIdx = player.FindBuffIndex(buffID); + + if (bIdx >= 0 && player.buffTime[bIdx] > flurryEndDelay) { + ModPlayerFists.UseItemHitbox(player, ref hitbox, + altHitboxSize, altJumpVelo, 0.5f, altDashSpeed); + } + else { + ModPlayerFists.UseItemHitbox(player, ref hitbox, + altHitboxSize * 2, altJumpVelo, 0.5f, altDashSpeed); + } + } + } + // Modify tooltip to replace tileboost with combo power + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + #endregion + } +} diff --git a/Items/Weapons/Fists/FistsLihzarhd.cs b/Items/Weapons/Fists/FistsLihzarhd.cs index 4a3ce08..a442a22 100644 --- a/Items/Weapons/Fists/FistsLihzarhd.cs +++ b/Items/Weapons/Fists/FistsLihzarhd.cs @@ -1,186 +1,187 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; -using Terraria.Graphics.Shaders; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class FistsLihzarhd : ModItem - { - public static int altEffect = 0; - public static int projectileID = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Strongarm"); - DisplayName.AddTranslation(GameCulture.Chinese, "石巨人铁拳"); - DisplayName.AddTranslation(GameCulture.Russian, "Ручищи"); - - Tooltip.SetDefault( - " to dash through enemies\n" + - "Dash for a projectile deflecting punch\n" + - "Combo causes successful strikes to generate powerful shockwaves"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键向敌人冲刺\n冲刺会使敌人(包括部分Boss)遭受巨力冲撞而击退\n连击成功将引发强烈的震荡波"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы прорваться через врагов\n" + - "Рывок: отражает снаряды\n" + - "Комбо: выпускет мощные волны при удачной атаке"); - - altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - projectileID = mod.ProjectileType(); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 260; // 705 dps (vs 50 def) - item.useAnimation = 20; // 30%-50% reduction - item.knockBack = 12f; - item.tileBoost = 8; // Combo Power - - item.shootSpeed = 16f; - - item.value = Item.sellPrice(0, 3, 0, 0); - item.rare = 7; - - item.UseSound = SoundID.DD2_SonicBoomBladeSlash; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 26; - const float fistDashSpeed = 9f; - const float fistDashThresh = 6f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().dashEffect == altEffect; } - const int altHitboxSize = 32; - const float altDashSpeed = 16f; - const float altDashThresh = 12f; - const float altJumpVelo = 16.8f; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GolemFist, 1); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - /// The method called during a dash. Use for ongoing dust and gore effects. - public static void DashEffects(Player player, Item item) - { - if (player.dashDelay == 0) { } - - for (int i = 0; i < 5; i++) - { - Dust d = Dust.NewDustDirect(player.position, player.width, player.height, DustID.Smoke, -player.velocity.X / 5, -player.velocity.Y / 5, 50 + 20 * i); - d.position -= d.velocity * 10f; - d.fadeIn = 1.2f; - } - - player.GetModPlayer().reflectingProjectilesForce = true; - player.GetModPlayer().reflectingProjectilesParryStyle = true; - } - - // Dash - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - if (AltStats(player)) - { - damage = (int)(damage * 1.75f); - knockBack *= 1.75f; - } - } - - // Dash && Combo - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActiveItemOnHit) - { - Vector2 shockVelo = (target.Center - player.Center).SafeNormalize(default(Vector2)) * item.shootSpeed; - Vector2 rotVelo; - - rotVelo = shockVelo.RotatedBy(0.4f); - Projectile.NewProjectile(target.Center + rotVelo, rotVelo, projectileID, damage / 2, knockBack, Main.myPlayer, 0f); - rotVelo = shockVelo.RotatedBy(-0.4f); - Projectile.NewProjectile(target.Center + rotVelo, rotVelo, projectileID, damage / 2, knockBack, Main.myPlayer, 1f); //No sound from this one - } - if (AltStats(player)) - { - if (target.velocity.Equals(default(Vector2))) return; - target.velocity += player.velocity / 2; - target.netUpdate = true; - } - } - - // Combo - bool hitGround; - public override void HoldItem(Player player) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - // On landing with divekicks - if (mpf.specialMove == 2 && player.velocity.Y == 0 && !hitGround) - { - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, player.position); - if (player.whoAmI == Main.myPlayer) - { - Vector2 displace = new Vector2(32, 32 * player.gravDir); - Vector2 velo = new Vector2(player.direction * item.shootSpeed, player.gravDir * -3f); - Projectile.NewProjectile(player.Center + displace, velo, projectileID, (int)(item.damage * player.meleeDamage / 2), 8f, Main.myPlayer, 1f); - velo.X *= -1; - Projectile.NewProjectile(player.Center + displace, velo, projectileID, (int)(item.damage * player.meleeDamage / 2), 8f, Main.myPlayer, 1f); - } - } - hitGround = player.velocity.Y == 0; - } - } - - #region Hardmode Dash Base - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - if (player.dashDelay == 0) - { - player.GetModPlayer(). - SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, altEffect); - return true; - } - return false; - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 16f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, altDashSpeed); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; +using Terraria.Graphics.Shaders; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class FistsLihzarhd : ModItem + { + public static int altEffect = 0; + public static int projectileID = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Strongarm"); + DisplayName.AddTranslation(GameCulture.Chinese, "石巨人铁拳"); + DisplayName.AddTranslation(GameCulture.Russian, "Ручищи"); + + Tooltip.SetDefault( + " to dash through enemies\n" + + "Dash for a projectile deflecting punch\n" + + "Combo causes successful strikes to generate powerful shockwaves"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键向敌人冲刺\n冲刺会使敌人(包括部分Boss)遭受巨力冲撞而击退\n连击成功将引发强烈的震荡波"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы прорваться через врагов\n" + + "Рывок: отражает снаряды\n" + + "Комбо: выпускет мощные волны при удачной атаке"); + + altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); + projectileID = ModContent.ProjectileType(); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 260; // 705 dps (vs 50 def) + item.useAnimation = 20; // 30%-50% reduction + item.knockBack = 12f; + item.tileBoost = 8; // Combo Power + + item.shootSpeed = 16f; + + item.value = Item.sellPrice(0, 3, 0, 0); + item.rare = 7; + + item.UseSound = SoundID.DD2_SonicBoomBladeSlash; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 26; + const float fistDashSpeed = 9f; + const float fistDashThresh = 6f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().dashEffect == altEffect; } + const int altHitboxSize = 32; + const float altDashSpeed = 16f; + const float altDashThresh = 12f; + const float altJumpVelo = 16.8f; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GolemFist, 1); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + /// The method called during a dash. Use for ongoing dust and gore effects. + public static void DashEffects(Player player, Item item) + { + if (player.dashDelay == 0) { } + + for (int i = 0; i < 5; i++) + { + Dust d = Dust.NewDustDirect(player.position, player.width, player.height, DustID.Smoke, -player.velocity.X / 5, -player.velocity.Y / 5, 50 + 20 * i); + d.position -= d.velocity * 10f; + d.fadeIn = 1.2f; + } + + player.GetModPlayer().reflectingProjectilesForce = true; + player.GetModPlayer().reflectingProjectilesParryStyle = true; + } + + // Dash + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + if (AltStats(player)) + { + damage = (int)(damage * 1.75f); + knockBack *= 1.75f; + } + } + + // Dash && Combo + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActiveItemOnHit) + { + Vector2 shockVelo = (target.Center - player.Center).SafeNormalize(default(Vector2)) * item.shootSpeed; + Vector2 rotVelo; + + rotVelo = shockVelo.RotatedBy(0.4f); + Projectile.NewProjectile(target.Center + rotVelo, rotVelo, projectileID, damage / 2, knockBack, Main.myPlayer, 0f); + rotVelo = shockVelo.RotatedBy(-0.4f); + Projectile.NewProjectile(target.Center + rotVelo, rotVelo, projectileID, damage / 2, knockBack, Main.myPlayer, 1f); //No sound from this one + } + if (AltStats(player)) + { + if (target.velocity.Equals(default(Vector2))) return; + target.velocity += player.velocity / 2; + target.netUpdate = true; + } + } + + // Combo + bool hitGround; + public override void HoldItem(Player player) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + // On landing with divekicks + if (mpf.specialMove == 2 && player.velocity.Y == 0 && !hitGround) + { + Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, player.position); + if (player.whoAmI == Main.myPlayer) + { + Vector2 displace = new Vector2(32, 32 * player.gravDir); + Vector2 velo = new Vector2(player.direction * item.shootSpeed, player.gravDir * -3f); + Projectile.NewProjectile(player.Center + displace, velo, projectileID, (int)(item.damage * player.meleeDamage / 2), 8f, Main.myPlayer, 1f); + velo.X *= -1; + Projectile.NewProjectile(player.Center + displace, velo, projectileID, (int)(item.damage * player.meleeDamage / 2), 8f, Main.myPlayer, 1f); + } + } + hitGround = player.velocity.Y == 0; + } + } + + #region Hardmode Dash Base + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + if (player.dashDelay == 0) + { + player.GetModPlayer(). + SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, altEffect); + return true; + } + return false; + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 16f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, altDashSpeed); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/FistsMartian.cs b/Items/Weapons/Fists/FistsMartian.cs index 736f877..c1ae73b 100644 --- a/Items/Weapons/Fists/FistsMartian.cs +++ b/Items/Weapons/Fists/FistsMartian.cs @@ -35,7 +35,7 @@ public override void SetStaticDefaults() "'Ракетный удар!'"); altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - projectileID = mod.ProjectileType(); + projectileID = ModContent.ProjectileType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Fists/FistsTitanium.cs b/Items/Weapons/Fists/FistsTitanium.cs index eae4e63..a5f8c14 100644 --- a/Items/Weapons/Fists/FistsTitanium.cs +++ b/Items/Weapons/Fists/FistsTitanium.cs @@ -1,154 +1,155 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; -using Terraria.Graphics.Shaders; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class FistsTitanium : ModItem - { - public static int altEffect = 0; - public static int shadowID = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titanium Fist"); - DisplayName.AddTranslation(GameCulture.Chinese, "钛金钢拳"); - DisplayName.AddTranslation(GameCulture.Russian, "Титанитовый Кулак"); - - Tooltip.SetDefault( - " to dash through enemies\n" + - "Dash grants 30% increased melee damage and knockback\n" + - "Combo grants shadow clones"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键向敌人冲刺\n冲刺将增加30%的近战伤害和击退\n连击将给予影子克隆体"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы прорваться через врагов\n" + - "Рывок: +30% урон и отбрасывание\n" + - "Комбо: призывает теневых клонов"); - - altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - shadowID = mod.ProjectileType(); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 92; //205dps v 20def - item.useAnimation = 24; // 30%-50% reduction - item.knockBack = 7f; - item.tileBoost = 15; // Combo Power - - item.value = Item.sellPrice(0, 1, 61, 0); - item.rare = 4; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item19; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 26; - const float fistDashSpeed = 8.5f; - const float fistDashThresh = 7f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().dashEffect == altEffect; } - const float altDashSpeed = 15f; - const float altDashThresh = 16f; - const float altJumpVelo = 16.85f; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - /// The method called during a dash. Use for ongoing dust and gore effects. - public static void DashEffects(Player player, Item item) - { - if (player.dashDelay == 0) { } - for (int i = 0; i < 3; i++) - { - Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.height, 111, -player.velocity.X, -player.velocity.Y, 0, default(Color), 0.8f)]; - d.velocity *= 0.01f * Main.rand.Next(-20, 21); - d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - } - - // Dash - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - if (AltStats(player)) - { - damage = (int)(damage * 1.3); - knockBack *= 1.3f; - } - } - - // Combo - public override void HoldItem(Player player) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - bool noShadow = player.whoAmI == Main.myPlayer; - foreach (Projectile p in Main.projectile) - { - if (p.active && p.owner == Main.myPlayer && p.type == shadowID) - { noShadow = false; break; } - } - if (noShadow) - { - Projectile.NewProjectile(player.Center, new Vector2(), shadowID, item.damage, item.knockBack, Main.myPlayer, 1f); - Projectile.NewProjectile(player.Center, new Vector2(), shadowID, item.damage, item.knockBack, Main.myPlayer, -1f); - } - } - } - - #region Hardmode Dash Base - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - if (player.dashDelay == 0) - { - player.GetModPlayer(). - SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, altEffect); - return true; - } - return false; - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 16f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, altJumpVelo, 0.5f, 16f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; +using Terraria.Graphics.Shaders; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class FistsTitanium : ModItem + { + public static int altEffect = 0; + public static int shadowID = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titanium Fist"); + DisplayName.AddTranslation(GameCulture.Chinese, "钛金钢拳"); + DisplayName.AddTranslation(GameCulture.Russian, "Титанитовый Кулак"); + + Tooltip.SetDefault( + " to dash through enemies\n" + + "Dash grants 30% increased melee damage and knockback\n" + + "Combo grants shadow clones"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键向敌人冲刺\n冲刺将增加30%的近战伤害和击退\n连击将给予影子克隆体"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы прорваться через врагов\n" + + "Рывок: +30% урон и отбрасывание\n" + + "Комбо: призывает теневых клонов"); + + altEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); + shadowID = ModContent.ProjectileType(); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 92; //205dps v 20def + item.useAnimation = 24; // 30%-50% reduction + item.knockBack = 7f; + item.tileBoost = 15; // Combo Power + + item.value = Item.sellPrice(0, 1, 61, 0); + item.rare = 4; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item19; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 26; + const float fistDashSpeed = 8.5f; + const float fistDashThresh = 7f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().dashEffect == altEffect; } + const float altDashSpeed = 15f; + const float altDashThresh = 16f; + const float altJumpVelo = 16.85f; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + /// The method called during a dash. Use for ongoing dust and gore effects. + public static void DashEffects(Player player, Item item) + { + if (player.dashDelay == 0) { } + for (int i = 0; i < 3; i++) + { + Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.height, 111, -player.velocity.X, -player.velocity.Y, 0, default(Color), 0.8f)]; + d.velocity *= 0.01f * Main.rand.Next(-20, 21); + d.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + } + + // Dash + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + if (AltStats(player)) + { + damage = (int)(damage * 1.3); + knockBack *= 1.3f; + } + } + + // Combo + public override void HoldItem(Player player) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + bool noShadow = player.whoAmI == Main.myPlayer; + foreach (Projectile p in Main.projectile) + { + if (p.active && p.owner == Main.myPlayer && p.type == shadowID) + { noShadow = false; break; } + } + if (noShadow) + { + Projectile.NewProjectile(player.Center, new Vector2(), shadowID, item.damage, item.knockBack, Main.myPlayer, 1f); + Projectile.NewProjectile(player.Center, new Vector2(), shadowID, item.damage, item.knockBack, Main.myPlayer, -1f); + } + } + } + + #region Hardmode Dash Base + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + if (player.dashDelay == 0) + { + player.GetModPlayer(). + SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, altEffect); + return true; + } + return false; + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 16f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, altJumpVelo, 0.5f, 16f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/GlovesButterfly.cs b/Items/Weapons/Fists/GlovesButterfly.cs index 24d212a..36ac46f 100644 --- a/Items/Weapons/Fists/GlovesButterfly.cs +++ b/Items/Weapons/Fists/GlovesButterfly.cs @@ -1,140 +1,141 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class GlovesButterfly : ModItem - { - public static int buffID = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Butterfly's Grace"); - DisplayName.AddTranslation(GameCulture.Chinese, "蝶之恩赐"); - DisplayName.AddTranslation(GameCulture.Russian, "Грация Бабочки"); - - Tooltip.SetDefault( - " to parry incoming damage\n" + - "Counterstrike grants 500% increased divekick damage\n" + - "Combo grants increased aerial movement\n" + - "'...Sting like a bee'"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键躲避到来的伤害\n反击将给予增加500%的下踢伤害\n连击将增加空中移动速度\n“...像蜜蜂一样蜇人”"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы парировать удар\n" + - "Контратака: +500% урон в падении\n" + - "Комбо: улучшает управление в воздухе\n" + - "'...Жаль, как пчела'"); - - buffID = mod.BuffType(); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 110; - item.useAnimation = 25; // 30%-50% reduction - item.knockBack = 4f; - item.tileBoost = 5; // Combo Power - - item.value = Item.sellPrice(0, 1, 50, 0); - item.rare = 7; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item18; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 28; - const float fistDashSpeed = 10f; - const float fistDashThresh = 7f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().parryBuff; } - const int altHitboxSize = 28; - const float altDashSpeed = 15f; - const float altDashThresh = 13f; - const float altJumpVelo = 17.6f; - const int parryActive = 22; - const int parryCooldown = 18; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ButterflyDust, 1); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddIngredient(ItemID.SoulofMight, 5); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - // Parry - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (AltStats(player) && mpf.specialMove == 2) - { - if (mpf.GetParryBuff() >= 0) mpf.ClearParryBuff(); - // Increase by item damage, not buffed total damage - damage += (int)(player.HeldItem.damage * 5f); - } - } - - // Combo - public override void HoldItem(Player player) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - if (player.velocity.Y != 0) player.AddBuff(buffID, 60); - } - } - - #region Hardmode Parry Base - public override bool CanUseItem(Player player) - { - if (AltStats(player) || player.FindBuffIndex(buffID) >= 0) - { - player.GetModPlayer(). - SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); - } - else - { - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionParryDash(player, parryActive, parryCooldown, fistJumpVelo - fistJumpVelo / 4, fistDashSpeed / 2f, fistDashThresh / 2); - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (AltStats(player) || player.FindBuffIndex(buffID) >= 0) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 15f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class GlovesButterfly : ModItem + { + public static int buffID = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Butterfly's Grace"); + DisplayName.AddTranslation(GameCulture.Chinese, "蝶之恩赐"); + DisplayName.AddTranslation(GameCulture.Russian, "Грация Бабочки"); + + Tooltip.SetDefault( + " to parry incoming damage\n" + + "Counterstrike grants 500% increased divekick damage\n" + + "Combo grants increased aerial movement\n" + + "'...Sting like a bee'"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键躲避到来的伤害\n反击将给予增加500%的下踢伤害\n连击将增加空中移动速度\n“...像蜜蜂一样蜇人”"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы парировать удар\n" + + "Контратака: +500% урон в падении\n" + + "Комбо: улучшает управление в воздухе\n" + + "'...Жаль, как пчела'"); + + buffID = ModContent.BuffType(); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 110; + item.useAnimation = 25; // 30%-50% reduction + item.knockBack = 4f; + item.tileBoost = 5; // Combo Power + + item.value = Item.sellPrice(0, 1, 50, 0); + item.rare = 7; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item18; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 28; + const float fistDashSpeed = 10f; + const float fistDashThresh = 7f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().parryBuff; } + const int altHitboxSize = 28; + const float altDashSpeed = 15f; + const float altDashThresh = 13f; + const float altJumpVelo = 17.6f; + const int parryActive = 22; + const int parryCooldown = 18; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ButterflyDust, 1); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddIngredient(ItemID.SoulofMight, 5); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + // Parry + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (AltStats(player) && mpf.specialMove == 2) + { + if (mpf.GetParryBuff() >= 0) mpf.ClearParryBuff(); + // Increase by item damage, not buffed total damage + damage += (int)(player.HeldItem.damage * 5f); + } + } + + // Combo + public override void HoldItem(Player player) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + if (player.velocity.Y != 0) player.AddBuff(buffID, 60); + } + } + + #region Hardmode Parry Base + public override bool CanUseItem(Player player) + { + if (AltStats(player) || player.FindBuffIndex(buffID) >= 0) + { + player.GetModPlayer(). + SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); + } + else + { + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionParryDash(player, parryActive, parryCooldown, fistJumpVelo - fistJumpVelo / 4, fistDashSpeed / 2f, fistDashThresh / 2); + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (AltStats(player) || player.FindBuffIndex(buffID) >= 0) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 15f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/GlovesCrystal.cs b/Items/Weapons/Fists/GlovesCrystal.cs index c223ab0..0a18695 100644 --- a/Items/Weapons/Fists/GlovesCrystal.cs +++ b/Items/Weapons/Fists/GlovesCrystal.cs @@ -1,151 +1,152 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; -using Terraria.Graphics.Shaders; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class GlovesCrystal : ModItem - { - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Gauntlet"); - DisplayName.AddTranslation(GameCulture.Chinese, "魔晶手套"); - DisplayName.AddTranslation(GameCulture.Russian, "Кристальная Перчатка"); - - Tooltip.SetDefault( - " to parry incoming damage\n" + - "Counterstrike unleashes crystal beams that build combo\n" + - "Combo causes damage to refract towards nearby enemies"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键躲避到来的伤害\n反击将释放可以造成连击的魔晶射线\n连击将向附近敌人释放折射攻击"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы парировать удар\n" + - "Контратака: выпускет кристальные лучи, набирающие комбо\n" + - "Комбо: отражает полученный урон на врагов"); - - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 71; - item.useAnimation = 26; // 30%-50% reduction - item.knockBack = 4f; - item.tileBoost = 18; // Combo Power - - item.value = Item.sellPrice(0, 1, 50, 0); - item.rare = 4; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item18; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 28; - const float fistDashSpeed = 8f; - const float fistDashThresh = 6f; - const float fistJumpVelo = 13.5f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().parryBuff; } - const int altHitboxSize = 32; - const float altDashSpeed = 14f; - const float altDashThresh = 12f; - const float altJumpVelo = 17.6f; - const int parryActive = 25; - const int parryCooldown = 15; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.UnicornHorn, 2); - recipe.AddIngredient(ItemID.CrystalShard, 30); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - // Parry & Combo - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (AltStats(player)) - { - if (mpf.GetParryBuff() >= 0) mpf.ClearParryBuff(); - - foreach (NPC npc in Main.npc) - { - if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.whoAmI == target.whoAmI) continue; - if (npc.Distance(player.Center) < 256) - { - if(player.CanHit(npc)) - { - Projectile.NewProjectile(npc.Center, new Vector2(-player.direction), - mod.ProjectileType(), (int)(damage * 0.33f), 0f, player.whoAmI); - } - } - } - } - if (mpf.IsComboActiveItemOnHit) - { - float distance = 128; - NPC nextTarget = null; - foreach (NPC npc in Main.npc) - { - if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.whoAmI == target.whoAmI) continue; - float ndist = npc.Distance(player.Center); - if (ndist < distance) - { - nextTarget = npc; - distance = ndist; - } - } - if (nextTarget != null) - { - Projectile.NewProjectile(nextTarget.Center, new Vector2(-player.direction), - mod.ProjectileType(), damage, knockBack, player.whoAmI); - } - } - } - - #region Hardmode Parry Base - public override bool CanUseItem(Player player) - { - if (!AltStats(player)) - { - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - else - { - player.GetModPlayer(). - SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionParryDash(player, parryActive, parryCooldown, fistJumpVelo - fistJumpVelo / 4, fistDashSpeed / 2f, fistDashThresh / 2); - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; +using Terraria.Graphics.Shaders; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class GlovesCrystal : ModItem + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Gauntlet"); + DisplayName.AddTranslation(GameCulture.Chinese, "魔晶手套"); + DisplayName.AddTranslation(GameCulture.Russian, "Кристальная Перчатка"); + + Tooltip.SetDefault( + " to parry incoming damage\n" + + "Counterstrike unleashes crystal beams that build combo\n" + + "Combo causes damage to refract towards nearby enemies"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键躲避到来的伤害\n反击将释放可以造成连击的魔晶射线\n连击将向附近敌人释放折射攻击"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы парировать удар\n" + + "Контратака: выпускет кристальные лучи, набирающие комбо\n" + + "Комбо: отражает полученный урон на врагов"); + + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 71; + item.useAnimation = 26; // 30%-50% reduction + item.knockBack = 4f; + item.tileBoost = 18; // Combo Power + + item.value = Item.sellPrice(0, 1, 50, 0); + item.rare = 4; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item18; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 28; + const float fistDashSpeed = 8f; + const float fistDashThresh = 6f; + const float fistJumpVelo = 13.5f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().parryBuff; } + const int altHitboxSize = 32; + const float altDashSpeed = 14f; + const float altDashThresh = 12f; + const float altJumpVelo = 17.6f; + const int parryActive = 25; + const int parryCooldown = 15; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.UnicornHorn, 2); + recipe.AddIngredient(ItemID.CrystalShard, 30); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + // Parry & Combo + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (AltStats(player)) + { + if (mpf.GetParryBuff() >= 0) mpf.ClearParryBuff(); + + foreach (NPC npc in Main.npc) + { + if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.whoAmI == target.whoAmI) continue; + if (npc.Distance(player.Center) < 256) + { + if(player.CanHit(npc)) + { + Projectile.NewProjectile(npc.Center, new Vector2(-player.direction), + ModContent.ProjectileType(), (int)(damage * 0.33f), 0f, player.whoAmI); + } + } + } + } + if (mpf.IsComboActiveItemOnHit) + { + float distance = 128; + NPC nextTarget = null; + foreach (NPC npc in Main.npc) + { + if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.whoAmI == target.whoAmI) continue; + float ndist = npc.Distance(player.Center); + if (ndist < distance) + { + nextTarget = npc; + distance = ndist; + } + } + if (nextTarget != null) + { + Projectile.NewProjectile(nextTarget.Center, new Vector2(-player.direction), + ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + } + } + } + + #region Hardmode Parry Base + public override bool CanUseItem(Player player) + { + if (!AltStats(player)) + { + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + else + { + player.GetModPlayer(). + SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionParryDash(player, parryActive, parryCooldown, fistJumpVelo - fistJumpVelo / 4, fistDashSpeed / 2f, fistDashThresh / 2); + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/GlovesOrich.cs b/Items/Weapons/Fists/GlovesOrich.cs index 6c89031..d4972bf 100644 --- a/Items/Weapons/Fists/GlovesOrich.cs +++ b/Items/Weapons/Fists/GlovesOrich.cs @@ -1,168 +1,169 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class GlovesOrich : ModItem - { - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orichalcum Glove"); - DisplayName.AddTranslation(GameCulture.Chinese, "奥钢手套"); - DisplayName.AddTranslation(GameCulture.Russian, "Орихалковая Перчатка"); - - Tooltip.SetDefault( - " to parry incoming damage\n" + - "Counterstrike delivers a flowery finish\n" + - "Combo grants a protective barrier"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键躲避到来的伤害\n反击将使花瓣对敌人进行攻击\n连击将给予“花瓣盾“效果"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы парировать удар\n" + - "Контратака: завершающий цветочный удар\n" + - "Комбо: создаёт защитный барьер"); - - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 84; //170dps v 20def - item.useAnimation = 26; // 30%-50% reduction - item.knockBack = 6.5f; - item.tileBoost = 8; // Combo Power - - item.value = Item.sellPrice(0, 1, 26, 50); - item.rare = 4; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item18; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 24; - const float fistDashSpeed = 9f; - const float fistDashThresh = 6f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().parryBuff; } - const int altHitboxSize = 28; - const float altDashSpeed = 13f; - const float altDashThresh = 10f; - const float altJumpVelo = 17f; - const int parryActive = 25; - const int parryCooldown = 20; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.OrichalcumBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - // Parry - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (AltStats(player)) - { - damage += 84 * 3; - } - } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { OnHit(player, target, damage, 5f, crit); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { OnHit(player, target, damage, knockBack, crit); } - private void OnHit(Player player, Entity target, int damage, float knockBack, bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (AltStats(player)) - { - if (mpf.GetParryBuff() >= 0) mpf.ClearParryBuff(); - for(int i = 0; i < 4; i++) - { - float arg_1B2_0 = player.position.X + (float)(player.width / 2); - int direction = player.direction; - float num = Main.screenPosition.X; - if (direction < 0) - { - num += (float)Main.screenWidth; - } - float num2 = Main.screenPosition.Y; - num2 += (float)Main.rand.Next(Main.screenHeight); - Vector2 vector2 = new Vector2(num, num2); - float num3 = target.position.X - vector2.X; - float num4 = target.position.Y - vector2.Y; - num3 += (float)Main.rand.Next(-50, 51) * 0.1f; - num4 += (float)Main.rand.Next(-50, 51) * 0.1f; - int num5 = 24; - float num6 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - num6 = (float)num5 / num6; - num6 *= 0.4f + 0.15f * i; // Reduce speed - num3 *= num6; - num4 *= num6; - Projectile.NewProjectile(num, num2, num3, num4, 221, 36, 0f, player.whoAmI, 0f, 0f); - - } - } - } - - // Combo - public override void HoldItem(Player player) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - player.AddBuff(mod.BuffType(), 30); - } - } - - #region Hardmode Parry Base - public override bool CanUseItem(Player player) - { - if (!AltStats(player)) - { - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - else - { - player.GetModPlayer(). - SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionParryDash(player, parryActive, parryCooldown, fistJumpVelo - fistJumpVelo / 4, fistDashSpeed / 2f, fistDashThresh / 2); - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class GlovesOrich : ModItem + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orichalcum Glove"); + DisplayName.AddTranslation(GameCulture.Chinese, "奥钢手套"); + DisplayName.AddTranslation(GameCulture.Russian, "Орихалковая Перчатка"); + + Tooltip.SetDefault( + " to parry incoming damage\n" + + "Counterstrike delivers a flowery finish\n" + + "Combo grants a protective barrier"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键躲避到来的伤害\n反击将使花瓣对敌人进行攻击\n连击将给予“花瓣盾“效果"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы парировать удар\n" + + "Контратака: завершающий цветочный удар\n" + + "Комбо: создаёт защитный барьер"); + + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 84; //170dps v 20def + item.useAnimation = 26; // 30%-50% reduction + item.knockBack = 6.5f; + item.tileBoost = 8; // Combo Power + + item.value = Item.sellPrice(0, 1, 26, 50); + item.rare = 4; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item18; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 24; + const float fistDashSpeed = 9f; + const float fistDashThresh = 6f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().parryBuff; } + const int altHitboxSize = 28; + const float altDashSpeed = 13f; + const float altDashThresh = 10f; + const float altJumpVelo = 17f; + const int parryActive = 25; + const int parryCooldown = 20; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.OrichalcumBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + // Parry + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (AltStats(player)) + { + damage += 84 * 3; + } + } + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { OnHit(player, target, damage, 5f, crit); } + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { OnHit(player, target, damage, knockBack, crit); } + private void OnHit(Player player, Entity target, int damage, float knockBack, bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (AltStats(player)) + { + if (mpf.GetParryBuff() >= 0) mpf.ClearParryBuff(); + for(int i = 0; i < 4; i++) + { + float arg_1B2_0 = player.position.X + (float)(player.width / 2); + int direction = player.direction; + float num = Main.screenPosition.X; + if (direction < 0) + { + num += (float)Main.screenWidth; + } + float num2 = Main.screenPosition.Y; + num2 += (float)Main.rand.Next(Main.screenHeight); + Vector2 vector2 = new Vector2(num, num2); + float num3 = target.position.X - vector2.X; + float num4 = target.position.Y - vector2.Y; + num3 += (float)Main.rand.Next(-50, 51) * 0.1f; + num4 += (float)Main.rand.Next(-50, 51) * 0.1f; + int num5 = 24; + float num6 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + num6 = (float)num5 / num6; + num6 *= 0.4f + 0.15f * i; // Reduce speed + num3 *= num6; + num4 *= num6; + Projectile.NewProjectile(num, num2, num3, num4, 221, 36, 0f, player.whoAmI, 0f, 0f); + + } + } + } + + // Combo + public override void HoldItem(Player player) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + player.AddBuff(ModContent.BuffType(), 30); + } + } + + #region Hardmode Parry Base + public override bool CanUseItem(Player player) + { + if (!AltStats(player)) + { + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + else + { + player.GetModPlayer(). + SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionParryDash(player, parryActive, parryCooldown, fistJumpVelo - fistJumpVelo / 4, fistDashSpeed / 2f, fistDashThresh / 2); + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/GlovesPumpkin.cs b/Items/Weapons/Fists/GlovesPumpkin.cs index ae78d3f..271b73d 100644 --- a/Items/Weapons/Fists/GlovesPumpkin.cs +++ b/Items/Weapons/Fists/GlovesPumpkin.cs @@ -36,8 +36,8 @@ public override void SetStaticDefaults() "Контратака: подрывает помеченных врагов\n" + "Комбо: усиливает взрывы"); - buffID = mod.BuffType(); - projID = mod.ProjectileType(); + buffID = ModContent.BuffType(); + projID = ModContent.ProjectileType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Fists/KnucklesDemon.cs b/Items/Weapons/Fists/KnucklesDemon.cs index c612329..b8be622 100644 --- a/Items/Weapons/Fists/KnucklesDemon.cs +++ b/Items/Weapons/Fists/KnucklesDemon.cs @@ -1,224 +1,225 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn)] - public class KnucklesDemon : ModItem - { - public static int altEffect = 0; - public static int customDashEffect = 0; - public static int buffID = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demon Hand"); - DisplayName.AddTranslation(GameCulture.Chinese, "恶魔鬼爪"); - DisplayName.AddTranslation(GameCulture.Russian, "Демоническая Рука"); - - Tooltip.SetDefault( - " to dash, or consume combo to steal life from enemies\n" + - "Combo grants increased melee damage at the cost of defense\n" + - "'Might makes right'"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键进行冲刺,或是消耗连击能量窃取敌人的生命值\n连击将以防御力为代价增加近战伤害\n“强权即公理”"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы сделать рывок или использовать комбо и красть здоровье врагов\n" + - "Комбо: увеличивает урон за счёт защиты\n" + - "'Сила есть - ума не надо'"); - - altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - customDashEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); - buffID = mod.BuffType(); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 55; - item.useAnimation = 22; // 30%-50% reduction - item.knockBack = 4f; - item.tileBoost = 13; // Combo Power - - item.value = Item.sellPrice(0, 0, 15, 0); - item.rare = 3; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item19; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 30; - const float fistDashSpeed = 8f; - const float fistDashThresh = 12f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } - const int altHitboxSize = 64 ; - const float altDashSpeed = 16f; - const float altDashThresh = 12f; - const float altJumpVelo = 16.85f; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - for (int i = 0; i < 2; i++) - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType(), 1); - recipe.AddIngredient(mod.ItemType(), 1); - recipe.AddIngredient(mod.ItemType(), 1); - if (i == 0) - { recipe.AddIngredient(mod.ItemType(), 1); } - else - { recipe.AddIngredient(mod.ItemType(), 1); } - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } - - //Combo - public override void HoldItem(Player player) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - player.AddBuff(buffID, 2); - } - } - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - player.itemAnimation = player.itemAnimationMax + 10; - Main.PlaySound(SoundID.Item73); - player.GetModPlayer().jumpAgainUppercut = true; - } - - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 8, altHitboxSize); - if (player.itemAnimation > player.itemAnimationMax) - { - // Charging - Dust.NewDust(r.TopLeft(), r.Width, r.Height, 21, 0f, 0f, 0, default(Color), 0.5f); - } - else if (player.itemAnimation == player.itemAnimationMax) - { - Main.PlaySound(SoundID.Item71, player.position); - // Force dash - player.GetModPlayer(). - SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); - - for (int i = 0; i < 64; i++) - { - double angle = Main.time + i / 10.0; - Dust d = Dust.NewDustPerfect(player.Center, 21, - new Vector2((float)(5.0 * Math.Sin(angle)), (float)(5.0 * Math.Cos(angle)))); - } - } - else - { - player.yoraiz0rEye = Math.Max(2, player.yoraiz0rEye); - if(player.attackCD > 2) player.attackCD = 2; // Attack more things - for (int i = 0; i < 5; i++) - { - int d = Dust.NewDust(r.TopLeft(), r.Width, r.Height, 27, player.velocity.X * -0.5f, player.velocity.Y * -0.5f, 180); - Main.dust[d].noGravity = true; - } - } - } - /// The method called during a dash. Use for ongoing dust and gore effects. - public static void DashEffects(Player player, Item item) - { - if (player.dashDelay == 0) { } - for (int i = 0; i < 5; i++) - { - int d = Dust.NewDust(player.position, player.width, player.height, 27, player.velocity.X * -0.5f, player.velocity.Y * -0.5f, 180); - Main.dust[d].noGravity = true; - Main.dust[d].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - if (AltStats(player) && !target.immortal) - { - player.lifeSteal += Math.Min(target.lifeMax, damage) / 4f; // Each hit restores half lifesteal potential - PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / 2f); - } - } - - // Melee Effect - public override void MeleeEffects(Player player, Rectangle hitbox) - { - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 2, 22); - Vector2 velocity = ModPlayerFists.GetFistVelocity(player); - Vector2 perpendicular = velocity.RotatedBy(Math.PI / 2); - Vector2 pVelo = (player.position - player.oldPosition); - // Claw like effect - for (int y = -1; y < 2; y++) - { - for (int i = 0; i < 2; i++) - { - Dust d = Main.dust[Dust.NewDust(r.TopLeft() + perpendicular * y * 7, r.Width, r.Height, 27, - 0, 0, 0, default(Color), 0.7f)]; - d.velocity /= 4; - d.velocity += new Vector2(velocity.X * -2, velocity.Y * -2); - d.position -= d.velocity * 8; - d.velocity += pVelo; - d.noGravity = true; - } - } - } - - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - if (player.GetModPlayer(). - AltFunctionCombo(player, altEffect) - ) - { - return true; - } - else - { - // Since auto calls at 1, don't want this dash to happen before - // the combo attack, which only happens with itemAnimation == 0 - if (player.dashDelay == 0 && player.itemAnimation == 0) - { - player.GetModPlayer(). - SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, customDashEffect); - return true; - } - } - return false; - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); - } - } - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn)] + public class KnucklesDemon : ModItem + { + public static int altEffect = 0; + public static int customDashEffect = 0; + public static int buffID = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demon Hand"); + DisplayName.AddTranslation(GameCulture.Chinese, "恶魔鬼爪"); + DisplayName.AddTranslation(GameCulture.Russian, "Демоническая Рука"); + + Tooltip.SetDefault( + " to dash, or consume combo to steal life from enemies\n" + + "Combo grants increased melee damage at the cost of defense\n" + + "'Might makes right'"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键进行冲刺,或是消耗连击能量窃取敌人的生命值\n连击将以防御力为代价增加近战伤害\n“强权即公理”"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы сделать рывок или использовать комбо и красть здоровье врагов\n" + + "Комбо: увеличивает урон за счёт защиты\n" + + "'Сила есть - ума не надо'"); + + altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + customDashEffect = ModPlayerFists.RegisterDashEffectID(DashEffects); + buffID = ModContent.BuffType(); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 55; + item.useAnimation = 22; // 30%-50% reduction + item.knockBack = 4f; + item.tileBoost = 13; // Combo Power + + item.value = Item.sellPrice(0, 0, 15, 0); + item.rare = 3; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item19; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 30; + const float fistDashSpeed = 8f; + const float fistDashThresh = 12f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } + const int altHitboxSize = 64 ; + const float altDashSpeed = 16f; + const float altDashThresh = 12f; + const float altJumpVelo = 16.85f; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + for (int i = 0; i < 2; i++) + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + if (i == 0) + { recipe.AddIngredient(ModContent.ItemType(), 1); } + else + { recipe.AddIngredient(ModContent.ItemType(), 1); } + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + //Combo + public override void HoldItem(Player player) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + player.AddBuff(buffID, 2); + } + } + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + player.itemAnimation = player.itemAnimationMax + 10; + Main.PlaySound(SoundID.Item73); + player.GetModPlayer().jumpAgainUppercut = true; + } + + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 8, altHitboxSize); + if (player.itemAnimation > player.itemAnimationMax) + { + // Charging + Dust.NewDust(r.TopLeft(), r.Width, r.Height, 21, 0f, 0f, 0, default(Color), 0.5f); + } + else if (player.itemAnimation == player.itemAnimationMax) + { + Main.PlaySound(SoundID.Item71, player.position); + // Force dash + player.GetModPlayer(). + SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); + + for (int i = 0; i < 64; i++) + { + double angle = Main.time + i / 10.0; + Dust d = Dust.NewDustPerfect(player.Center, 21, + new Vector2((float)(5.0 * Math.Sin(angle)), (float)(5.0 * Math.Cos(angle)))); + } + } + else + { + player.yoraiz0rEye = Math.Max(2, player.yoraiz0rEye); + if(player.attackCD > 2) player.attackCD = 2; // Attack more things + for (int i = 0; i < 5; i++) + { + int d = Dust.NewDust(r.TopLeft(), r.Width, r.Height, 27, player.velocity.X * -0.5f, player.velocity.Y * -0.5f, 180); + Main.dust[d].noGravity = true; + } + } + } + /// The method called during a dash. Use for ongoing dust and gore effects. + public static void DashEffects(Player player, Item item) + { + if (player.dashDelay == 0) { } + for (int i = 0; i < 5; i++) + { + int d = Dust.NewDust(player.position, player.width, player.height, 27, player.velocity.X * -0.5f, player.velocity.Y * -0.5f, 180); + Main.dust[d].noGravity = true; + Main.dust[d].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + if (AltStats(player) && !target.immortal) + { + player.lifeSteal += Math.Min(target.lifeMax, damage) / 4f; // Each hit restores half lifesteal potential + PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / 2f); + } + } + + // Melee Effect + public override void MeleeEffects(Player player, Rectangle hitbox) + { + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 2, 22); + Vector2 velocity = ModPlayerFists.GetFistVelocity(player); + Vector2 perpendicular = velocity.RotatedBy(Math.PI / 2); + Vector2 pVelo = (player.position - player.oldPosition); + // Claw like effect + for (int y = -1; y < 2; y++) + { + for (int i = 0; i < 2; i++) + { + Dust d = Main.dust[Dust.NewDust(r.TopLeft() + perpendicular * y * 7, r.Width, r.Height, 27, + 0, 0, 0, default(Color), 0.7f)]; + d.velocity /= 4; + d.velocity += new Vector2(velocity.X * -2, velocity.Y * -2); + d.position -= d.velocity * 8; + d.velocity += pVelo; + d.noGravity = true; + } + } + } + + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + if (player.GetModPlayer(). + AltFunctionCombo(player, altEffect) + ) + { + return true; + } + else + { + // Since auto calls at 1, don't want this dash to happen before + // the combo attack, which only happens with itemAnimation == 0 + if (player.dashDelay == 0 && player.itemAnimation == 0) + { + player.GetModPlayer(). + SetDash(altDashSpeed, altDashThresh, 0.992f, 0.96f, false, customDashEffect); + return true; + } + } + return false; + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); + } + } + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/KnucklesDungeon.cs b/Items/Weapons/Fists/KnucklesDungeon.cs index aeaa108..2c303c0 100644 --- a/Items/Weapons/Fists/KnucklesDungeon.cs +++ b/Items/Weapons/Fists/KnucklesDungeon.cs @@ -1,156 +1,158 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class KnucklesDungeon : ModItem - { - public static int comboEffect = 0; - public static int buffID = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cerulean Claws"); - DisplayName.AddTranslation(GameCulture.Chinese, "天蓝地牢爪"); - DisplayName.AddTranslation(GameCulture.Russian, "Лазурные Когти"); - - Tooltip.SetDefault( - " consumes combo to unleash a flurry of strikes\n" + - "Combo grants 25% increased melee attack speed"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量将开始一连串的冲击\n连击将增加25%近战攻速"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы использовать комбо и ударить много раз\n" + - "Комбо: +25% скорость атаки"); - - comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - buffID = mod.BuffType(); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 31; - item.useAnimation = 16; // Combos can increase speed by 30-50% since it halves remaining attack time - item.knockBack = 3f; - item.tileBoost = 10; // For fists, we read this as the combo power - - item.value = Item.sellPrice(0, 0, 15, 0); - item.rare = 2; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item19; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldenKey, 1); - recipe.AddIngredient(ItemID.WaterCandle, 2); - recipe.AddIngredient(ItemID.Spike, 6); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - float dashSpeed = 5f; - if (player.FindBuffIndex(buffID) >= 0) - { - dashSpeed = 8f; - } - player.GetModPlayer(). - SetDashOnMovement(dashSpeed, 12f, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionCombo(player, comboEffect); - } - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - player.itemAnimation = player.itemAnimationMax + 20; - player.velocity.X = 0; - player.velocity.Y = player.velocity.Y == 0f ? 0f : -5.5f; - Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); - player.GetModPlayer().jumpAgainUppercut = true; - } - // Charging - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 20); - if (player.itemAnimation > player.itemAnimationMax) - { - // Charge effect - for (int i = 0; i < 3; i++) - { - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 172, 0, 0, 0, default(Color), 0.7f)]; - d.fadeIn = 1.2f; - d.position -= d.velocity * 20f; - d.velocity *= 1.5f; - d.noGravity = true; - } - } - // Initial throw - else if (player.itemAnimation == player.itemAnimationMax) - { - // Higher pitch - player.AddBuff(buffID, 60, false); - } - } - - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - float jump = 11.7f; - if (player.FindBuffIndex(buffID) >= 0) - { - jump = 14f; - } - ModPlayerFists.UseItemHitbox(player, ref hitbox, 22, jump, 0.5f, 12f); - } - - //Combo - public override void UpdateInventory(Player player) { if (player.HeldItem != item) return; - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - player.meleeSpeed += 0.25f; - } - } - - // Melee Effect - public override void MeleeEffects(Player player, Rectangle hitbox) - { - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 2, 22); - Vector2 velocity = ModPlayerFists.GetFistVelocity(player); - Vector2 perpendicular = velocity.RotatedBy(Math.PI / 2); - Vector2 pVelo = (player.position - player.oldPosition); - // Claw like effect - for (int y = -1; y < 2; y++) - { - for (int i = 0; i < 2; i++) - { - Dust d = Main.dust[Dust.NewDust(r.TopLeft() + perpendicular * y * 5, r.Width, r.Height, 172, - 0, 0, 0, default(Color), 0.7f)]; - d.velocity /= 8; - d.velocity += new Vector2(velocity.X, velocity.Y) + pVelo; - d.noGravity = true; - } - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class KnucklesDungeon : ModItem + { + public static int comboEffect = 0; + public static int buffID = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cerulean Claws"); + DisplayName.AddTranslation(GameCulture.Chinese, "天蓝地牢爪"); + DisplayName.AddTranslation(GameCulture.Russian, "Лазурные Когти"); + + Tooltip.SetDefault( + " consumes combo to unleash a flurry of strikes\n" + + "Combo grants 25% increased melee attack speed"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量将开始一连串的冲击\n连击将增加25%近战攻速"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы использовать комбо и ударить много раз\n" + + "Комбо: +25% скорость атаки"); + + comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + buffID = ModContent.BuffType(); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 31; + item.useAnimation = 16; // Combos can increase speed by 30-50% since it halves remaining attack time + item.knockBack = 3f; + item.tileBoost = 10; // For fists, we read this as the combo power + + item.value = Item.sellPrice(0, 0, 15, 0); + item.rare = 2; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item19; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldenKey, 1); + recipe.AddIngredient(ItemID.WaterCandle, 2); + recipe.AddIngredient(ItemID.Spike, 6); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + float dashSpeed = 5f; + if (player.FindBuffIndex(buffID) >= 0) + { + dashSpeed = 8f; + } + player.GetModPlayer(). + SetDashOnMovement(dashSpeed, 12f, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionCombo(player, comboEffect); + } + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + player.itemAnimation = player.itemAnimationMax + 20; + player.velocity.X = 0; + player.velocity.Y = player.velocity.Y == 0f ? 0f : -5.5f; + Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); + player.GetModPlayer().jumpAgainUppercut = true; + } + // Charging + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 20); + if (player.itemAnimation > player.itemAnimationMax) + { + // Charge effect + for (int i = 0; i < 3; i++) + { + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 172, 0, 0, 0, default(Color), 0.7f)]; + d.fadeIn = 1.2f; + d.position -= d.velocity * 20f; + d.velocity *= 1.5f; + d.noGravity = true; + } + } + // Initial throw + else if (player.itemAnimation == player.itemAnimationMax) + { + // Higher pitch + player.AddBuff(buffID, 60, false); + } + } + + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + float jump = 11.7f; + if (player.FindBuffIndex(buffID) >= 0) + { + jump = 14f; + } + ModPlayerFists.UseItemHitbox(player, ref hitbox, 22, jump, 0.5f, 12f); + } + + //Combo + public override void UpdateInventory(Player player) { + if (player.HeldItem != item) return; + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + player.meleeSpeed += 0.25f; + } + } + + // Melee Effect + public override void MeleeEffects(Player player, Rectangle hitbox) + { + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 2, 22); + Vector2 velocity = ModPlayerFists.GetFistVelocity(player); + Vector2 perpendicular = velocity.RotatedBy(Math.PI / 2); + Vector2 pVelo = (player.position - player.oldPosition); + // Claw like effect + for (int y = -1; y < 2; y++) + { + for (int i = 0; i < 2; i++) + { + Dust d = Main.dust[Dust.NewDust(r.TopLeft() + perpendicular * y * 5, r.Width, r.Height, 172, + 0, 0, 0, default(Color), 0.7f)]; + d.velocity /= 8; + d.velocity += new Vector2(velocity.X, velocity.Y) + pVelo; + d.noGravity = true; + } + } + } + } +} diff --git a/Items/Weapons/Fists/KnucklesFrost.cs b/Items/Weapons/Fists/KnucklesFrost.cs index dd8ebd6..f2988c1 100644 --- a/Items/Weapons/Fists/KnucklesFrost.cs +++ b/Items/Weapons/Fists/KnucklesFrost.cs @@ -1,222 +1,224 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class KnucklesFrost : ModItem - { - public static int altEffect = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Iced Punch"); - DisplayName.AddTranslation(GameCulture.Chinese, "冰锥拳"); - DisplayName.AddTranslation(GameCulture.Russian, "Холодный Удар"); - - Tooltip.SetDefault( - " consumes combo to release a burst of icicles\n" + - "Combo grants increased armor penetration and icy kicks"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗能量向周围释放一阵冰锥\n连击将增加破甲和给予寒冰踢"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы использовать комбо и пустить ледяные осколки\n" + - "Комбо: увеличивает бронепробиваемость и делает пинки холодными"); - - altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 84; - item.useAnimation = 25; // 30%-50% reduction - item.knockBack = 1.5f; - item.tileBoost = 9; // Combo Power - - item.useTime = item.useAnimation * 2; - item.shoot = mod.ProjectileType(); - item.shootSpeed = 10f; - - item.value = Item.sellPrice(0, 1, 0, 0); - item.rare = 5; - - item.UseSound = SoundID.Item19; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 20; - const float fistDashSpeed = 12.5f; - const float fistDashThresh = 11f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } - const int altHitboxSize = (int)(fistHitboxSize * 2.5f); - const float altJumpVelo = fistJumpVelo; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - for (int i = 0; i < 2; i++) - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrostCore, 2); - if (i == 0) - { recipe.AddIngredient(ItemID.AdamantiteBar, 5); } - else - { recipe.AddIngredient(ItemID.TitaniumBar, 5); } - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } - - // Combo - bool hitGround; - public override void UpdateInventory(Player player) { if (player.HeldItem != item) return; - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - player.armorPenetration += mpf.ComboCounter * 3; - - if (Main.time % 2 == 0) - { - Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.head, 43, 0f, 0f, 100)]; - d.scale /= 2; - d.fadeIn = 0.9f; - } - - // On landing with divekicks - if (mpf.specialMove == 2 && player.velocity.Y == 0 && !hitGround) - { - Main.PlaySound(SoundID.Item27, player.position); - if (player.whoAmI == Main.myPlayer) - { - Vector2 position = new Vector2( - player.Center.X + player.direction * player.width / 2, - player.Center.Y + player.gravDir * player.height / 2 - ); - Vector2 direction = item.shootSpeed * - new Vector2(player.direction, -player.gravDir); - Projectile.NewProjectile(position, direction, item.shoot, - (int)(2 * item.damage * player.meleeDamage), - 20f * player.meleeSpeed, player.whoAmI, 10); - } - } - hitGround = player.velocity.Y == 0; - } - } - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - Main.PlaySound(SoundID.Item9, player.position); - player.itemAnimation = player.itemAnimationMax + 20; - player.GetModPlayer().jumpAgainUppercut = true; - } - - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 4, altHitboxSize); - player.statDefense += player.itemAnimation; // Bonus defence during special - if (player.itemAnimation > player.itemAnimationMax) - { - // Charging - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 4, 4, 88, 0, 0, 100, default(Color), 1.2f)]; - d.position -= d.velocity * 10f; - d.velocity *= 1f; - d.velocity += player.position - player.oldPosition; - d.noGravity = true; - } - else if (player.itemAnimation == player.itemAnimationMax) - { - Main.PlaySound(SoundID.Shatter, player.position); - Dust d; - Vector2 center = player.Center - new Vector2(4, 4); - for (int i = 0; i < 15; i++) - { - d = Main.dust[Dust.NewDust(center, 8, 8, DustID.Ice, 0, -1, 100, default(Color), 1.5f)]; - d.velocity *= 3f; - d.noGravity = true; - d = Main.dust[Dust.NewDust(center, 8, 8, 88, 0, -1, 100, default(Color), 0.5f)]; - d.velocity *= 2f; - d.fadeIn = 1f; - d.noGravity = true; - } - - player.itemTime = 0; - } - else - { - // Punch effect - } - } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.GetModPlayer().ComboEffectAbs == altEffect && - player.itemAnimation < player.itemAnimationMax) - { - float angle = Main.rand.NextFloat(-MathHelper.Pi, MathHelper.Pi); - for (int i = 0; i < 8; i++) - { - Vector2 direction = item.shootSpeed * new Vector2((float)Math.Sin(angle), (float)Math.Cos(angle)); - - Projectile.NewProjectile(player.Center, direction, item.shoot, - (int)(2 * item.damage * player.meleeDamage), - 20f * player.meleeSpeed, player.whoAmI); - - angle += (float)(Math.PI / 4); - } - } - return false; - } - - //Combo - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (AltStats(player)) - { - damage += player.HeldItem.damage; - knockBack *= 5f; - } - } - - #region Hardmode Combo Base - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionCombo(player, altEffect); - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class KnucklesFrost : ModItem + { + public static int altEffect = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Iced Punch"); + DisplayName.AddTranslation(GameCulture.Chinese, "冰锥拳"); + DisplayName.AddTranslation(GameCulture.Russian, "Холодный Удар"); + + Tooltip.SetDefault( + " consumes combo to release a burst of icicles\n" + + "Combo grants increased armor penetration and icy kicks"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗能量向周围释放一阵冰锥\n连击将增加破甲和给予寒冰踢"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы использовать комбо и пустить ледяные осколки\n" + + "Комбо: увеличивает бронепробиваемость и делает пинки холодными"); + + altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 84; + item.useAnimation = 25; // 30%-50% reduction + item.knockBack = 1.5f; + item.tileBoost = 9; // Combo Power + + item.useTime = item.useAnimation * 2; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.value = Item.sellPrice(0, 1, 0, 0); + item.rare = 5; + + item.UseSound = SoundID.Item19; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 20; + const float fistDashSpeed = 12.5f; + const float fistDashThresh = 11f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } + const int altHitboxSize = (int)(fistHitboxSize * 2.5f); + const float altJumpVelo = fistJumpVelo; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + for (int i = 0; i < 2; i++) + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FrostCore, 2); + if (i == 0) + { recipe.AddIngredient(ItemID.AdamantiteBar, 5); } + else + { recipe.AddIngredient(ItemID.TitaniumBar, 5); } + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + // Combo + bool hitGround; + public override void UpdateInventory(Player player) { + if (player.HeldItem != item) return; + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + player.armorPenetration += mpf.ComboCounter * 3; + + if (Main.time % 2 == 0) + { + Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.head, 43, 0f, 0f, 100)]; + d.scale /= 2; + d.fadeIn = 0.9f; + } + + // On landing with divekicks + if (mpf.specialMove == 2 && player.velocity.Y == 0 && !hitGround) + { + Main.PlaySound(SoundID.Item27, player.position); + if (player.whoAmI == Main.myPlayer) + { + Vector2 position = new Vector2( + player.Center.X + player.direction * player.width / 2, + player.Center.Y + player.gravDir * player.height / 2 + ); + Vector2 direction = item.shootSpeed * + new Vector2(player.direction, -player.gravDir); + Projectile.NewProjectile(position, direction, item.shoot, + (int)(2 * item.damage * player.meleeDamage), + 20f * player.meleeSpeed, player.whoAmI, 10); + } + } + hitGround = player.velocity.Y == 0; + } + } + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + Main.PlaySound(SoundID.Item9, player.position); + player.itemAnimation = player.itemAnimationMax + 20; + player.GetModPlayer().jumpAgainUppercut = true; + } + + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 4, altHitboxSize); + player.statDefense += player.itemAnimation; // Bonus defence during special + if (player.itemAnimation > player.itemAnimationMax) + { + // Charging + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 4, 4, 88, 0, 0, 100, default(Color), 1.2f)]; + d.position -= d.velocity * 10f; + d.velocity *= 1f; + d.velocity += player.position - player.oldPosition; + d.noGravity = true; + } + else if (player.itemAnimation == player.itemAnimationMax) + { + Main.PlaySound(SoundID.Shatter, player.position); + Dust d; + Vector2 center = player.Center - new Vector2(4, 4); + for (int i = 0; i < 15; i++) + { + d = Main.dust[Dust.NewDust(center, 8, 8, DustID.Ice, 0, -1, 100, default(Color), 1.5f)]; + d.velocity *= 3f; + d.noGravity = true; + d = Main.dust[Dust.NewDust(center, 8, 8, 88, 0, -1, 100, default(Color), 0.5f)]; + d.velocity *= 2f; + d.fadeIn = 1f; + d.noGravity = true; + } + + player.itemTime = 0; + } + else + { + // Punch effect + } + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.GetModPlayer().ComboEffectAbs == altEffect && + player.itemAnimation < player.itemAnimationMax) + { + float angle = Main.rand.NextFloat(-MathHelper.Pi, MathHelper.Pi); + for (int i = 0; i < 8; i++) + { + Vector2 direction = item.shootSpeed * new Vector2((float)Math.Sin(angle), (float)Math.Cos(angle)); + + Projectile.NewProjectile(player.Center, direction, item.shoot, + (int)(2 * item.damage * player.meleeDamage), + 20f * player.meleeSpeed, player.whoAmI); + + angle += (float)(Math.PI / 4); + } + } + return false; + } + + //Combo + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (AltStats(player)) + { + damage += player.HeldItem.damage; + knockBack *= 5f; + } + } + + #region Hardmode Combo Base + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionCombo(player, altEffect); + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/KnucklesIchor.cs b/Items/Weapons/Fists/KnucklesIchor.cs index 321d29d..93026af 100644 --- a/Items/Weapons/Fists/KnucklesIchor.cs +++ b/Items/Weapons/Fists/KnucklesIchor.cs @@ -1,225 +1,226 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.DataStructures; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class KnucklesIchor : ModItem - { - public static int altEffect = 0; - public static int buffID = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Baghnakh"); - DisplayName.AddTranslation(GameCulture.Chinese, "血腥虎爪"); - DisplayName.AddTranslation(GameCulture.Russian, "Кровавый Багнак"); - - Tooltip.SetDefault( - " consumes combo and life to greatly increase melee damage\n" + - "Combo inflicts ichor and steals life from enemies"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量和生命值以大幅增加近战伤害\n连击将窃取生命值并使敌人被脓血感染"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы использовать комбо и здоровье для усиления ближнего боя\n" + - "Комбо: насылает ихор и крадёт здоровье врагов"); - - - ModTranslation text; - - text = mod.CreateTranslation("KnucklesIchorSuicide1"); - text.SetDefault("$NAME ripped out their mortal coil."); - text.AddTranslation(GameCulture.Chinese, "$NAME 的肉体被绞成一团"); - text.AddTranslation(GameCulture.Russian, "$NAME вырвало внутренности."); - mod.AddTranslation(text); - - text = mod.CreateTranslation("KnucklesIchorSuicide2"); - text.SetDefault("$NAME was disemboweled by the $ITEM."); - text.AddTranslation(GameCulture.Chinese, "$NAME被$ITEM开膛破肚"); - text.AddTranslation(GameCulture.Russian, "$NAME был распотрашён $ITEM"); - mod.AddTranslation(text); - - text = mod.CreateTranslation("KnucklesIchorSuicide3"); - text.SetDefault("$NAME tore themself apart."); - text.AddTranslation(GameCulture.Chinese, "$NAME 被大卸八块"); - text.AddTranslation(GameCulture.Russian, "$NAME разорвался пополам"); - mod.AddTranslation(text); - - altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - buffID = mod.BuffType(); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 70; - item.useAnimation = 18; // 30%-50% reduction - item.knockBack = 3.5f; - item.tileBoost = 6; // Combo Power - - item.value = Item.sellPrice(0, 0, 92, 0); - item.rare = 5; - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item19; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 16; - const float fistDashSpeed = 10f; - const float fistDashThresh = 12f; - const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } - const int altHitboxSize = (int)(fistHitboxSize * 2.5f); - const float altDashSpeed = 16f; - const float altDashThresh = 14f; - const float altJumpVelo = 17.5f; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ichor, 10); - recipe.AddIngredient(ItemID.SoulofNight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - player.itemAnimation = player.itemAnimationMax + 18; - player.AddBuff(buffID, 60 * 6); - player.GetModPlayer().jumpAgainUppercut = true; - Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); - } - - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 10, altHitboxSize); - player.statDefense += player.itemAnimation; // Bonus defence during special - if (player.itemAnimation > player.itemAnimationMax) - { - // Charging - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.Blood, 0, 0, 100, default(Color), 1.2f)]; - d.position -= d.velocity * 20f; - d.velocity *= 1.5f; - d.velocity += player.position - player.oldPosition; - d.noGravity = true; - } - else if (player.itemAnimation == player.itemAnimationMax) - { - // Lower pitch - Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 12, 1f, -0.2f); - if (player.whoAmI == Main.myPlayer) - { - PlayerDeathReason pdr = PlayerDeathReason.LegacyDefault(); - switch (Main.rand.Next(3)) - { - case 1: - pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide1") - .Replace("$NAME", player.name); - break; - case 2: - pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide2") - .Replace("$NAME", player.name).Replace("$ITEM", item.Name); - break; - default: - pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide3") - .Replace("$NAME", player.name); - break; - } - player.immune = false; - player.Hurt(pdr, 100 + player.statDefense / 2, player.direction, false, false, false, -1); - } - - for (int i = 0; i < 30; i++) - { - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.Blood, 0, -0.5f, 0, default(Color), 2f)]; - d.velocity.X *= 2f; - } - - // Allow dash - player.GetModPlayer(). - SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); - } - else - { - // Punch effect - } - } - - // Combo - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActiveItemOnHit) - { - target.AddBuff(BuffID.Ichor, 60 * 10); - - if (!target.immortal) - { - int divider = 60; - if (player.FindBuffIndex(buffID) >= 0) { divider = 30; } - PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / divider); - } - } - } - - // Melee Effect - public override void MeleeEffects(Player player, Rectangle hitbox) - { - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 1, 8); - Vector2 velocity = ModPlayerFists.GetFistVelocity(player); - Vector2 perpendicular = velocity.RotatedBy(Math.PI / 2); - Vector2 pVelo = (player.position - player.oldPosition); - // Claw like effect - for (int y = -1; y < 2; y++) - { - Dust d = Dust.NewDustPerfect(r.TopLeft() + perpendicular * y * 7, 170, null, 0, default(Color), 0.6f); - d.velocity = new Vector2(velocity.X * -2, velocity.Y * -2); - d.position -= d.velocity * 8; - d.velocity += pVelo; - d.fadeIn = 0.7f; - d.noGravity = true; - } - } - - #region Hardmode Combo Base - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionCombo(player, altEffect); - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.DataStructures; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class KnucklesIchor : ModItem + { + public static int altEffect = 0; + public static int buffID = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Baghnakh"); + DisplayName.AddTranslation(GameCulture.Chinese, "血腥虎爪"); + DisplayName.AddTranslation(GameCulture.Russian, "Кровавый Багнак"); + + Tooltip.SetDefault( + " consumes combo and life to greatly increase melee damage\n" + + "Combo inflicts ichor and steals life from enemies"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量和生命值以大幅增加近战伤害\n连击将窃取生命值并使敌人被脓血感染"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы использовать комбо и здоровье для усиления ближнего боя\n" + + "Комбо: насылает ихор и крадёт здоровье врагов"); + + + ModTranslation text; + + text = mod.CreateTranslation("KnucklesIchorSuicide1"); + text.SetDefault("$NAME ripped out their mortal coil."); + text.AddTranslation(GameCulture.Chinese, "$NAME 的肉体被绞成一团"); + text.AddTranslation(GameCulture.Russian, "$NAME вырвало внутренности."); + mod.AddTranslation(text); + + text = mod.CreateTranslation("KnucklesIchorSuicide2"); + text.SetDefault("$NAME was disemboweled by the $ITEM."); + text.AddTranslation(GameCulture.Chinese, "$NAME被$ITEM开膛破肚"); + text.AddTranslation(GameCulture.Russian, "$NAME был распотрашён $ITEM"); + mod.AddTranslation(text); + + text = mod.CreateTranslation("KnucklesIchorSuicide3"); + text.SetDefault("$NAME tore themself apart."); + text.AddTranslation(GameCulture.Chinese, "$NAME 被大卸八块"); + text.AddTranslation(GameCulture.Russian, "$NAME разорвался пополам"); + mod.AddTranslation(text); + + altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + buffID = ModContent.BuffType(); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 70; + item.useAnimation = 18; // 30%-50% reduction + item.knockBack = 3.5f; + item.tileBoost = 6; // Combo Power + + item.value = Item.sellPrice(0, 0, 92, 0); + item.rare = 5; + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item19; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 16; + const float fistDashSpeed = 10f; + const float fistDashThresh = 12f; + const float fistJumpVelo = 14.8f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } + const int altHitboxSize = (int)(fistHitboxSize * 2.5f); + const float altDashSpeed = 16f; + const float altDashThresh = 14f; + const float altJumpVelo = 17.5f; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ichor, 10); + recipe.AddIngredient(ItemID.SoulofNight, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + player.itemAnimation = player.itemAnimationMax + 18; + player.AddBuff(buffID, 60 * 6); + player.GetModPlayer().jumpAgainUppercut = true; + Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); + } + + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 10, altHitboxSize); + player.statDefense += player.itemAnimation; // Bonus defence during special + if (player.itemAnimation > player.itemAnimationMax) + { + // Charging + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.Blood, 0, 0, 100, default(Color), 1.2f)]; + d.position -= d.velocity * 20f; + d.velocity *= 1.5f; + d.velocity += player.position - player.oldPosition; + d.noGravity = true; + } + else if (player.itemAnimation == player.itemAnimationMax) + { + // Lower pitch + Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 12, 1f, -0.2f); + if (player.whoAmI == Main.myPlayer) + { + PlayerDeathReason pdr = PlayerDeathReason.LegacyDefault(); + switch (Main.rand.Next(3)) + { + case 1: + pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide1") + .Replace("$NAME", player.name); + break; + case 2: + pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide2") + .Replace("$NAME", player.name).Replace("$ITEM", item.Name); + break; + default: + pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide3") + .Replace("$NAME", player.name); + break; + } + player.immune = false; + player.Hurt(pdr, 100 + player.statDefense / 2, player.direction, false, false, false, -1); + } + + for (int i = 0; i < 30; i++) + { + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.Blood, 0, -0.5f, 0, default(Color), 2f)]; + d.velocity.X *= 2f; + } + + // Allow dash + player.GetModPlayer(). + SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0); + } + else + { + // Punch effect + } + } + + // Combo + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActiveItemOnHit) + { + target.AddBuff(BuffID.Ichor, 60 * 10); + + if (!target.immortal) + { + int divider = 60; + if (player.FindBuffIndex(buffID) >= 0) { divider = 30; } + PlayerFX.LifeStealPlayer(player, damage, target.lifeMax, 1f / divider); + } + } + } + + // Melee Effect + public override void MeleeEffects(Player player, Rectangle hitbox) + { + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 1, 8); + Vector2 velocity = ModPlayerFists.GetFistVelocity(player); + Vector2 perpendicular = velocity.RotatedBy(Math.PI / 2); + Vector2 pVelo = (player.position - player.oldPosition); + // Claw like effect + for (int y = -1; y < 2; y++) + { + Dust d = Dust.NewDustPerfect(r.TopLeft() + perpendicular * y * 7, 170, null, 0, default(Color), 0.6f); + d.velocity = new Vector2(velocity.X * -2, velocity.Y * -2); + d.position -= d.velocity * 8; + d.velocity += pVelo; + d.fadeIn = 0.7f; + d.noGravity = true; + } + } + + #region Hardmode Combo Base + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionCombo(player, altEffect); + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/KnucklesLead.cs b/Items/Weapons/Fists/KnucklesLead.cs index 047158f..bfbc9eb 100644 --- a/Items/Weapons/Fists/KnucklesLead.cs +++ b/Items/Weapons/Fists/KnucklesLead.cs @@ -1,151 +1,152 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class KnucklesLead : ModItem - { - public static int comboEffect = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lead Knuckleduster"); - DisplayName.AddTranslation(GameCulture.Chinese, "铅指虎"); - DisplayName.AddTranslation(GameCulture.Russian, "Свинцовый Кастет"); - - Tooltip.SetDefault( - " consumes combo to unleash spirit energy\n" + - "Combo grants 4 bonus damage"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量以释放精神能量\n连击将奖励增加4点伤害"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы использовать комбо и выпустить духовную энергию\n" + - "Комбо: +4 урон"); - - comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 15; - item.useAnimation = 23; // Combos can increase speed by 30-50% since it halves remaining attack time - item.knockBack = 3f; - item.tileBoost = 6; // For fists, we read this as the combo power - - item.useTime = item.useAnimation * 2; - item.shoot = mod.ProjectileType(); - item.shootSpeed = 10f; - - item.value = Item.sellPrice(0, 0, 4, 50); - - item.UseSound = SoundID.Item7; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LeadBar, 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - player.GetModPlayer(). - SetDashOnMovement(6f, 4f, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionCombo(player, comboEffect); - } - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - player.itemAnimation = player.itemAnimationMax + 20; - Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); - } - // Charging - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 45); - if (player.itemAnimation > player.itemAnimationMax) - { - // Charge effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 0, 0, 100, default(Color), 1.2f)]; - d.position -= d.velocity * 10f; - d.velocity /= 2; - d.noGravity = true; - } - // Initial throw - else if (player.itemAnimation == player.itemAnimationMax) - { - // Higher pitch - Main.PlaySound(42, (int)player.position.X, (int)player.position.Y, 184, 1f, 0.5f); - player.itemTime = 0; - } - else - { - // Punch effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 3, 3, 100, default(Color), 1f)]; - d.velocity *= 0.6f * ModPlayerFists.GetFistVelocity(player); - d.noGravity = 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) - { - if (player.GetModPlayer().ComboEffectAbs == comboEffect && - player.itemAnimation < player.itemAnimationMax) - { - return true; - } - return false; - } - - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - ModPlayerFists mpf = player.GetModPlayer(); - int size = 18; - float jump = 9f; - if (mpf.ComboEffectAbs == comboEffect) - { - size = (int)(size * 2.5f); - jump = 11f; - } - // jump exactly 6 blocks high! - ModPlayerFists.UseItemHitbox(player, ref hitbox, size, jump, 0.5f, 8f); - } - - //Combo - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActiveItemOnHit) - { - damage += 4; - } - if (mpf.ComboEffectAbs == comboEffect) - { - damage += player.HeldItem.damage; - knockBack *= 2f; - } - } - } -} +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class KnucklesLead : ModItem + { + public static int comboEffect = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lead Knuckleduster"); + DisplayName.AddTranslation(GameCulture.Chinese, "铅指虎"); + DisplayName.AddTranslation(GameCulture.Russian, "Свинцовый Кастет"); + + Tooltip.SetDefault( + " consumes combo to unleash spirit energy\n" + + "Combo grants 4 bonus damage"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量以释放精神能量\n连击将奖励增加4点伤害"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы использовать комбо и выпустить духовную энергию\n" + + "Комбо: +4 урон"); + + comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 15; + item.useAnimation = 23; // Combos can increase speed by 30-50% since it halves remaining attack time + item.knockBack = 3f; + item.tileBoost = 6; // For fists, we read this as the combo power + + item.useTime = item.useAnimation * 2; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.value = Item.sellPrice(0, 0, 4, 50); + + item.UseSound = SoundID.Item7; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LeadBar, 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + player.GetModPlayer(). + SetDashOnMovement(6f, 4f, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionCombo(player, comboEffect); + } + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + player.itemAnimation = player.itemAnimationMax + 20; + Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); + } + // Charging + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 45); + if (player.itemAnimation > player.itemAnimationMax) + { + // Charge effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 0, 0, 100, default(Color), 1.2f)]; + d.position -= d.velocity * 10f; + d.velocity /= 2; + d.noGravity = true; + } + // Initial throw + else if (player.itemAnimation == player.itemAnimationMax) + { + // Higher pitch + Main.PlaySound(42, (int)player.position.X, (int)player.position.Y, 184, 1f, 0.5f); + player.itemTime = 0; + } + else + { + // Punch effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 3, 3, 100, default(Color), 1f)]; + d.velocity *= 0.6f * ModPlayerFists.GetFistVelocity(player); + d.noGravity = 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) + { + if (player.GetModPlayer().ComboEffectAbs == comboEffect && + player.itemAnimation < player.itemAnimationMax) + { + return true; + } + return false; + } + + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + ModPlayerFists mpf = player.GetModPlayer(); + int size = 18; + float jump = 9f; + if (mpf.ComboEffectAbs == comboEffect) + { + size = (int)(size * 2.5f); + jump = 11f; + } + // jump exactly 6 blocks high! + ModPlayerFists.UseItemHitbox(player, ref hitbox, size, jump, 0.5f, 8f); + } + + //Combo + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActiveItemOnHit) + { + damage += 4; + } + if (mpf.ComboEffectAbs == comboEffect) + { + damage += player.HeldItem.damage; + knockBack *= 2f; + } + } + } +} diff --git a/Items/Weapons/Fists/KnucklesMeteor.cs b/Items/Weapons/Fists/KnucklesMeteor.cs index 5a3650e..44a3948 100644 --- a/Items/Weapons/Fists/KnucklesMeteor.cs +++ b/Items/Weapons/Fists/KnucklesMeteor.cs @@ -1,151 +1,152 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class KnucklesMeteor : ModItem - { - public static int comboEffect = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet Fu"); - DisplayName.AddTranslation(GameCulture.Chinese, "彗星武拳"); - DisplayName.AddTranslation(GameCulture.Russian, "Удар Кометы"); - - Tooltip.SetDefault( - " consumes combo to meteor strike!\n" + - "Combo grants a protective barrier\n" + - "'Space CQC is explicitly stated to be whatever you claim it to be'"); //これは宇宙CQC! sorry MPT no kanas are supported - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量进行陨石打击!\n连击将给予陨铁盾效果\n“宇宙CQC是明确的规定,无论你声称它是什么”"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы использовать комбо и нанести метеоритный удар!\n" + - "Комбо: создаёт защитный барьер\n"); - - comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 26; - item.useAnimation = 19; // Combos can increase speed by 30-50% since it halves remaining attack time - item.knockBack = 2.5f; - item.tileBoost = 5; // For fists, this is the combo power - - item.useTime = item.useAnimation * 2; - item.shoot = mod.ProjectileType(); - item.shootSpeed = 6f; - - item.value = Item.sellPrice(0, 0, 24, 0); - item.rare = 2; - - item.UseSound = SoundID.Item7; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - player.GetModPlayer(). - SetDashOnMovement(6.5f, 4f, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionCombo(player, comboEffect); - } - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - player.itemAnimation = player.itemAnimationMax + 12; - Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); - } - // Charging - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 20); - if (player.itemAnimation > player.itemAnimationMax) - { - // Charge effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 6, 0, 0, 100, default(Color), 2f)]; - d.velocity /= 2; - d.noGravity = true; - } - // Initial throw - else if (player.itemAnimation == player.itemAnimationMax) - { - // Higher pitch - Main.PlaySound(SoundID.Item88, (int)player.position.X, (int)player.position.Y); - player.itemTime = 0; - } - else - { - // Punch effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 6, 0, 0, 100, default(Color), 1.3f)]; - d.velocity = 1.4f * ModPlayerFists.GetFistVelocity(player); - d.noGravity = 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) - { - if (player.GetModPlayer().ComboEffectAbs == comboEffect && - player.itemAnimation < player.itemAnimationMax) - { - damage *= 5; - return true; - } - return false; - } - - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, 20, 10f, 0.5f); - } - - //Combo - public override void HoldItem(Player player) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActive) - { - player.AddBuff(mod.BuffType(), 30); - } - } - - // Melee Effect - public override void MeleeEffects(Player player, Rectangle hitbox) - { - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 4, 20); - Vector2 velocity = ModPlayerFists.GetFistVelocity(player); - Vector2 pVelo = (player.position - player.oldPosition); - for (int i = 0; i < 2; i++) - { - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), r.Width, r.Height, 174, - velocity.X * -4f + pVelo.X, velocity.Y * -4f + pVelo.Y)]; - d.noGravity = true; - d.velocity /= 2; - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class KnucklesMeteor : ModItem + { + public static int comboEffect = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet Fu"); + DisplayName.AddTranslation(GameCulture.Chinese, "彗星武拳"); + DisplayName.AddTranslation(GameCulture.Russian, "Удар Кометы"); + + Tooltip.SetDefault( + " consumes combo to meteor strike!\n" + + "Combo grants a protective barrier\n" + + "'Space CQC is explicitly stated to be whatever you claim it to be'"); //これは宇宙CQC! sorry MPT no kanas are supported + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量进行陨石打击!\n连击将给予陨铁盾效果\n“宇宙CQC是明确的规定,无论你声称它是什么”"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы использовать комбо и нанести метеоритный удар!\n" + + "Комбо: создаёт защитный барьер\n"); + + comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 26; + item.useAnimation = 19; // Combos can increase speed by 30-50% since it halves remaining attack time + item.knockBack = 2.5f; + item.tileBoost = 5; // For fists, this is the combo power + + item.useTime = item.useAnimation * 2; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 6f; + + item.value = Item.sellPrice(0, 0, 24, 0); + item.rare = 2; + + item.UseSound = SoundID.Item7; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + player.GetModPlayer(). + SetDashOnMovement(6.5f, 4f, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionCombo(player, comboEffect); + } + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + player.itemAnimation = player.itemAnimationMax + 12; + Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); + } + // Charging + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 20); + if (player.itemAnimation > player.itemAnimationMax) + { + // Charge effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 6, 0, 0, 100, default(Color), 2f)]; + d.velocity /= 2; + d.noGravity = true; + } + // Initial throw + else if (player.itemAnimation == player.itemAnimationMax) + { + // Higher pitch + Main.PlaySound(SoundID.Item88, (int)player.position.X, (int)player.position.Y); + player.itemTime = 0; + } + else + { + // Punch effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, 6, 0, 0, 100, default(Color), 1.3f)]; + d.velocity = 1.4f * ModPlayerFists.GetFistVelocity(player); + d.noGravity = 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) + { + if (player.GetModPlayer().ComboEffectAbs == comboEffect && + player.itemAnimation < player.itemAnimationMax) + { + damage *= 5; + return true; + } + return false; + } + + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, 20, 10f, 0.5f); + } + + //Combo + public override void HoldItem(Player player) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActive) + { + player.AddBuff(ModContent.BuffType(), 30); + } + } + + // Melee Effect + public override void MeleeEffects(Player player, Rectangle hitbox) + { + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 4, 20); + Vector2 velocity = ModPlayerFists.GetFistVelocity(player); + Vector2 pVelo = (player.position - player.oldPosition); + for (int i = 0; i < 2; i++) + { + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), r.Width, r.Height, 174, + velocity.X * -4f + pVelo.X, velocity.Y * -4f + pVelo.Y)]; + d.noGravity = true; + d.velocity /= 2; + } + } + } +} diff --git a/Items/Weapons/Fists/KnucklesMithril.cs b/Items/Weapons/Fists/KnucklesMithril.cs index 0a7a2a1..c04aef2 100644 --- a/Items/Weapons/Fists/KnucklesMithril.cs +++ b/Items/Weapons/Fists/KnucklesMithril.cs @@ -1,181 +1,182 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class KnucklesMithril : ModItem - { - public static int altEffect = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mythril Knuckleduster"); - DisplayName.AddTranslation(GameCulture.Chinese, "秘银指虎"); - DisplayName.AddTranslation(GameCulture.Russian, "Мифриловый Кастет"); - - Tooltip.SetDefault( - " consumes combo to unleash spirit energy\n" + - "Combo grant 50% increased melee damage"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量以释放精神能量\n连击将增加50%近战伤害"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы использовать комбо и выпустить духовную энергию\n" + - "Комбо: +50% урон"); - - altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 55; //130dps v 20def (up to 217) - item.useAnimation = 20; // 30%-50% reduction - item.knockBack = 3f; - item.tileBoost = 10; // Combo Power - - item.value = Item.sellPrice(0, 1, 3, 50); // half sword cost - item.rare = 4; - item.useTime = item.useAnimation * 2; - item.shoot = mod.ProjectileType(); - item.shootSpeed = 10 + item.rare / 2; - - item.UseSound = SoundID.Item19; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - const int fistHitboxSize = 22; - const float fistDashSpeed = 8f; - const float fistDashThresh = 7f; - const float fistJumpVelo = 14f; // http://rextester.com/OIY60171 - public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } - const int altHitboxSize = (int)(fistHitboxSize * 2.5f); - const float altDashSpeed = 10f; - const float altDashThresh = 8f; - const float altJumpVelo = 16f; - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MythrilBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - player.itemAnimation = player.itemAnimationMax + 30; - player.GetModPlayer().jumpAgainUppercut = true; - Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); - } - // Charging - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 20, 45); - player.statDefense += player.itemAnimation; // Bonus defence during special - if (player.itemAnimation > player.itemAnimationMax) - { - for (int i = 0; i < 2; i++) - { - // Charge effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 0, 0, 100, default(Color), 1.4f)]; - d.position -= d.velocity * 10f; - d.velocity /= 2; - d.noGravity = true; - } - } - // Initial throw - else if (player.itemAnimation == player.itemAnimationMax) - { - // Higher pitch - Main.PlaySound(42, (int)player.position.X, (int)player.position.Y, 184, 1f, 0.5f); - player.itemTime = 0; - } - else - { - // Punch effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 3, 3, 100, default(Color), 1f)]; - d.velocity *= 0.6f * ModPlayerFists.GetFistVelocity(player); - d.noGravity = 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) - { - if (player.GetModPlayer().ComboEffectAbs == altEffect && - player.itemAnimation < player.itemAnimationMax) - { - Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY) * 0.95f, - type, damage * 2, knockBack, player.whoAmI, 0f, 1f); - Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY) * 0.95f, - type, damage * 2, knockBack, player.whoAmI, 0f, -1f); - return true; - } - return false; - } - - //Combo - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActiveItemOnHit) - { - damage *= 2; - } - } - - // Hit Impact Effect - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - // Impact - Dust d; - for (int i = 0; i < 1 + damage / 30; i++) - { - d = Main.dust[Dust.NewDust((player.Center + target.Center) / 2, 0, 0, 43, -target.velocity.X, target.velocity.Y, 0, default(Color), 0.1f)]; - d.fadeIn = 0.6f; - d.velocity = (5f * d.velocity) + (5f * ModPlayerFists.GetFistVelocity(player)); - } - } - - #region Hardmode Combo Base - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { - player.GetModPlayer(). - SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionCombo(player, altEffect); - } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - if (!AltStats(player)) - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); - } - else - { - ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); - } - } - #endregion - - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class KnucklesMithril : ModItem + { + public static int altEffect = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mythril Knuckleduster"); + DisplayName.AddTranslation(GameCulture.Chinese, "秘银指虎"); + DisplayName.AddTranslation(GameCulture.Russian, "Мифриловый Кастет"); + + Tooltip.SetDefault( + " consumes combo to unleash spirit energy\n" + + "Combo grant 50% increased melee damage"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量以释放精神能量\n连击将增加50%近战伤害"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы использовать комбо и выпустить духовную энергию\n" + + "Комбо: +50% урон"); + + altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 55; //130dps v 20def (up to 217) + item.useAnimation = 20; // 30%-50% reduction + item.knockBack = 3f; + item.tileBoost = 10; // Combo Power + + item.value = Item.sellPrice(0, 1, 3, 50); // half sword cost + item.rare = 4; + item.useTime = item.useAnimation * 2; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10 + item.rare / 2; + + item.UseSound = SoundID.Item19; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + const int fistHitboxSize = 22; + const float fistDashSpeed = 8f; + const float fistDashThresh = 7f; + const float fistJumpVelo = 14f; // http://rextester.com/OIY60171 + public bool AltStats(Player p) { return p.GetModPlayer().ComboEffectAbs == altEffect; } + const int altHitboxSize = (int)(fistHitboxSize * 2.5f); + const float altDashSpeed = 10f; + const float altDashThresh = 8f; + const float altJumpVelo = 16f; + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MythrilBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + player.itemAnimation = player.itemAnimationMax + 30; + player.GetModPlayer().jumpAgainUppercut = true; + Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); + } + // Charging + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 20, 45); + player.statDefense += player.itemAnimation; // Bonus defence during special + if (player.itemAnimation > player.itemAnimationMax) + { + for (int i = 0; i < 2; i++) + { + // Charge effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 0, 0, 100, default(Color), 1.4f)]; + d.position -= d.velocity * 10f; + d.velocity /= 2; + d.noGravity = true; + } + } + // Initial throw + else if (player.itemAnimation == player.itemAnimationMax) + { + // Higher pitch + Main.PlaySound(42, (int)player.position.X, (int)player.position.Y, 184, 1f, 0.5f); + player.itemTime = 0; + } + else + { + // Punch effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 3, 3, 100, default(Color), 1f)]; + d.velocity *= 0.6f * ModPlayerFists.GetFistVelocity(player); + d.noGravity = 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) + { + if (player.GetModPlayer().ComboEffectAbs == altEffect && + player.itemAnimation < player.itemAnimationMax) + { + Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY) * 0.95f, + type, damage * 2, knockBack, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY) * 0.95f, + type, damage * 2, knockBack, player.whoAmI, 0f, -1f); + return true; + } + return false; + } + + //Combo + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActiveItemOnHit) + { + damage *= 2; + } + } + + // Hit Impact Effect + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + // Impact + Dust d; + for (int i = 0; i < 1 + damage / 30; i++) + { + d = Main.dust[Dust.NewDust((player.Center + target.Center) / 2, 0, 0, 43, -target.velocity.X, target.velocity.Y, 0, default(Color), 0.1f)]; + d.fadeIn = 0.6f; + d.velocity = (5f * d.velocity) + (5f * ModPlayerFists.GetFistVelocity(player)); + } + } + + #region Hardmode Combo Base + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { + player.GetModPlayer(). + SetDashOnMovement(fistDashSpeed, fistDashThresh, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionCombo(player, altEffect); + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + if (!AltStats(player)) + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, fistHitboxSize, fistJumpVelo, 0.5f, 14f); + } + else + { + ModPlayerFists.UseItemHitbox(player, ref hitbox, altHitboxSize, altJumpVelo, 0.5f, 14f); + } + } + #endregion + + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + } +} diff --git a/Items/Weapons/Fists/KnucklesPlantera.cs b/Items/Weapons/Fists/KnucklesPlantera.cs index 49a9eef..4492b30 100644 --- a/Items/Weapons/Fists/KnucklesPlantera.cs +++ b/Items/Weapons/Fists/KnucklesPlantera.cs @@ -34,8 +34,8 @@ public override void SetStaticDefaults() "'Спрятан глубоко в лабиринте джунглей'"); altEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - leafID = mod.ProjectileType(); - ballID = mod.ProjectileType(); + leafID = ModContent.ProjectileType(); + ballID = ModContent.ProjectileType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Fists/KnucklesPlat.cs b/Items/Weapons/Fists/KnucklesPlat.cs index 01166f3..e751818 100644 --- a/Items/Weapons/Fists/KnucklesPlat.cs +++ b/Items/Weapons/Fists/KnucklesPlat.cs @@ -1,150 +1,151 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Fists -{ - [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] - public class KnucklesPlat : ModItem - { - public static int comboEffect = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Platinum Knuckleduster"); - DisplayName.AddTranslation(GameCulture.Chinese, "铂金指虎"); - DisplayName.AddTranslation(GameCulture.Russian, "Платиновый Кастет"); - - Tooltip.SetDefault( - " consumes combo to unleash spirit energy\n" + - "Combo grants 7 bonus damage"); - Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量以释放精神能量\n连击将奖励增加7点伤害"); - Tooltip.AddTranslation(GameCulture.Russian, - ", чтобы использовать комбо и выпустить духовную энергию\n" + - "Комбо: +7 урон"); - - comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); - } - public override void SetDefaults() - { - item.melee = true; - item.damage = 22; - item.useAnimation = 24; // Combos can increase speed by 30-50% since it halves remaining attack time - item.knockBack = 4.5f; - item.tileBoost = 5; // For fists, we read this as the combo power - - item.useTime = item.useAnimation * 2; - item.shoot = mod.ProjectileType(); - item.shootSpeed = 12f; - - item.value = Item.sellPrice(0, 0, 18, 0); // One bar - - item.UseSound = SoundID.Item7; - item.useStyle = ModPlayerFists.useStyle; - item.autoReuse = true; - item.width = 20; - item.height = 20; - } - public override void AddRecipes() { if (!ModConf.EnableFists) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - public override void ModifyTooltips(List tooltips) - { ModPlayerFists.ModifyTooltips(tooltips, item); } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 0) - { // Short dash brings up to max default speed. - player.GetModPlayer(). - SetDashOnMovement(6f, 4f, 0.992f, 0.96f, true, 0); - } - return true; - } - public override bool AltFunctionUse(Player player) - { - return player.GetModPlayer(). - AltFunctionCombo(player, comboEffect); - } - /// The method called during a combo. Use for ongoing dust and gore effects. - public static void ComboEffects(Player player, Item item, bool initial) - { - if (initial) - { - player.itemAnimation = player.itemAnimationMax + 20; - Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); - } - // Charging - Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 45); - if (player.itemAnimation > player.itemAnimationMax) - { - // Charge effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 0, 0, 100, default(Color), 1.2f)]; - d.position -= d.velocity * 10f; - d.velocity /= 2; - d.noGravity = true; - } - // Initial throw - else if (player.itemAnimation == player.itemAnimationMax) - { - // Higher pitch - Main.PlaySound(42, (int)player.position.X, (int)player.position.Y, 184, 1f, 0.5f); - player.itemTime = 0; - } - else - { - // Punch effect - Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 3, 3, 100, default(Color), 1f)]; - d.velocity *= 0.6f * ModPlayerFists.GetFistVelocity(player); - d.noGravity = 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) - { - if (player.GetModPlayer().ComboEffectAbs == comboEffect && - player.itemAnimation < player.itemAnimationMax) - { - return true; - } - return false; - } - - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - ModPlayerFists mpf = player.GetModPlayer(); - int size = 18; - float jump = 10.5f; - if (mpf.ComboEffectAbs == comboEffect) - { - size = (int)(size * 2.5f); - jump = 11f; - } - ModPlayerFists.UseItemHitbox(player, ref hitbox, size, jump, 0.5f, 8f); - } - - //Combo - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { ModifyHit(player, ref damage, ref knockBack, ref crit); } - private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) - { - ModPlayerFists mpf = player.GetModPlayer(); - if (mpf.IsComboActiveItemOnHit) - { - damage += 7; - } - if(mpf.ComboEffectAbs == comboEffect) - { - damage += player.HeldItem.damage; - knockBack *= 2f; - } - } - } -} +using System.Collections.Generic; +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Fists +{ + [AutoloadEquip(EquipType.HandsOn, EquipType.HandsOff)] + public class KnucklesPlat : ModItem + { + public static int comboEffect = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Platinum Knuckleduster"); + DisplayName.AddTranslation(GameCulture.Chinese, "铂金指虎"); + DisplayName.AddTranslation(GameCulture.Russian, "Платиновый Кастет"); + + Tooltip.SetDefault( + " consumes combo to unleash spirit energy\n" + + "Combo grants 7 bonus damage"); + Tooltip.AddTranslation(GameCulture.Chinese, "鼠标右键消耗连击能量以释放精神能量\n连击将奖励增加7点伤害"); + Tooltip.AddTranslation(GameCulture.Russian, + ", чтобы использовать комбо и выпустить духовную энергию\n" + + "Комбо: +7 урон"); + + comboEffect = ModPlayerFists.RegisterComboEffectID(ComboEffects); + } + public override void SetDefaults() + { + item.melee = true; + item.damage = 22; + item.useAnimation = 24; // Combos can increase speed by 30-50% since it halves remaining attack time + item.knockBack = 4.5f; + item.tileBoost = 5; // For fists, we read this as the combo power + + item.useTime = item.useAnimation * 2; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + + item.value = Item.sellPrice(0, 0, 18, 0); // One bar + + item.UseSound = SoundID.Item7; + item.useStyle = ModPlayerFists.useStyle; + item.autoReuse = true; + item.width = 20; + item.height = 20; + } + public override void AddRecipes() { + if (!ModConf.EnableFists) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + public override void ModifyTooltips(List tooltips) + { ModPlayerFists.ModifyTooltips(tooltips, item); } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 0) + { // Short dash brings up to max default speed. + player.GetModPlayer(). + SetDashOnMovement(6f, 4f, 0.992f, 0.96f, true, 0); + } + return true; + } + public override bool AltFunctionUse(Player player) + { + return player.GetModPlayer(). + AltFunctionCombo(player, comboEffect); + } + /// The method called during a combo. Use for ongoing dust and gore effects. + public static void ComboEffects(Player player, Item item, bool initial) + { + if (initial) + { + player.itemAnimation = player.itemAnimationMax + 20; + Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position); + } + // Charging + Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 16, 45); + if (player.itemAnimation > player.itemAnimationMax) + { + // Charge effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 0, 0, 100, default(Color), 1.2f)]; + d.position -= d.velocity * 10f; + d.velocity /= 2; + d.noGravity = true; + } + // Initial throw + else if (player.itemAnimation == player.itemAnimationMax) + { + // Higher pitch + Main.PlaySound(42, (int)player.position.X, (int)player.position.Y, 184, 1f, 0.5f); + player.itemTime = 0; + } + else + { + // Punch effect + Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.t_Martian, 3, 3, 100, default(Color), 1f)]; + d.velocity *= 0.6f * ModPlayerFists.GetFistVelocity(player); + d.noGravity = 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) + { + if (player.GetModPlayer().ComboEffectAbs == comboEffect && + player.itemAnimation < player.itemAnimationMax) + { + return true; + } + return false; + } + + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + ModPlayerFists mpf = player.GetModPlayer(); + int size = 18; + float jump = 10.5f; + if (mpf.ComboEffectAbs == comboEffect) + { + size = (int)(size * 2.5f); + jump = 11f; + } + ModPlayerFists.UseItemHitbox(player, ref hitbox, size, jump, 0.5f, 8f); + } + + //Combo + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { float knockBack = 5f; ModifyHit(player, ref damage, ref knockBack, ref crit); } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { ModifyHit(player, ref damage, ref knockBack, ref crit); } + private void ModifyHit(Player player, ref int damage, ref float knockBack, ref bool crit) + { + ModPlayerFists mpf = player.GetModPlayer(); + if (mpf.IsComboActiveItemOnHit) + { + damage += 7; + } + if(mpf.ComboEffectAbs == comboEffect) + { + damage += player.HeldItem.damage; + knockBack *= 2f; + } + } + } +} diff --git a/Items/Weapons/Sabres/BeamSabres/BeamSabreItems.cs b/Items/Weapons/Sabres/BeamSabres/BeamSabreItems.cs index 50a6ad7..0462c9c 100644 --- a/Items/Weapons/Sabres/BeamSabres/BeamSabreItems.cs +++ b/Items/Weapons/Sabres/BeamSabres/BeamSabreItems.cs @@ -1,16 +1,16 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; using Microsoft.Xna.Framework.Graphics; -namespace WeaponOut.Items.Weapons.Sabres.BeamSabres -{ - public class BeamSabrePurple : BeamSabre +namespace WeaponOut.Items.Weapons.Sabres.BeamSabres +{ + public class BeamSabrePurple : BeamSabre { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Purple Beam Saber"); DisplayName.AddTranslation(GameCulture.Russian, "Фиолетовый Световой Клинок"); @@ -21,29 +21,29 @@ public override Color SabreColour() { return new Color(0.7f, 0f, 1f); } public override int SabreSlashType() - { return mod.ProjectileType(); } + { return ModContent.ProjectileType(); } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 15); - recipe.AddIngredient(ItemID.SoulofFright, 15); - recipe.AddIngredient(ItemID.Amethyst, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 15); + recipe.AddIngredient(ItemID.SoulofFright, 15); + recipe.AddIngredient(ItemID.Amethyst, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); recipe.AddRecipe(); } - } + } public class BeamSabrePurpleSlash : BeamSabreSlash { public override Vector3 SabreColour() { return new Vector3(0.7f, 0f, 1f); } } - public class BeamSabreYellow : BeamSabre + public class BeamSabreYellow : BeamSabre { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Yellow Beam Saber"); DisplayName.AddTranslation(GameCulture.Russian, "Жёлтый Световой Клинок"); @@ -54,29 +54,29 @@ public override Color SabreColour() { return new Color(1f, 1f, 0f); } public override int SabreSlashType() - { return mod.ProjectileType(); } + { return ModContent.ProjectileType(); } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 15); - recipe.AddIngredient(ItemID.SoulofFright, 15); - recipe.AddIngredient(ItemID.Topaz, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 15); + recipe.AddIngredient(ItemID.SoulofFright, 15); + recipe.AddIngredient(ItemID.Topaz, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); recipe.AddRecipe(); } - } + } public class BeamSabreYellowSlash : BeamSabreSlash { public override Vector3 SabreColour() { return new Vector3(1f, 1f, 0f); } } - public class BeamSabreBlue : BeamSabre + public class BeamSabreBlue : BeamSabre { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Blue Beam Saber"); DisplayName.AddTranslation(GameCulture.Russian, "Синий Световой Клинок"); @@ -87,29 +87,29 @@ public override Color SabreColour() { return new Color(0f, 0.1f, 1f); } public override int SabreSlashType() - { return mod.ProjectileType(); } + { return ModContent.ProjectileType(); } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 15); - recipe.AddIngredient(ItemID.SoulofFright, 15); - recipe.AddIngredient(ItemID.Sapphire, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 15); + recipe.AddIngredient(ItemID.SoulofFright, 15); + recipe.AddIngredient(ItemID.Sapphire, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); recipe.AddRecipe(); } - } + } public class BeamSabreBlueSlash : BeamSabreSlash { public override Vector3 SabreColour() { return new Vector3(0f, 0.1f, 1f); } } - public class BeamSabreGreen : BeamSabre + public class BeamSabreGreen : BeamSabre { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Green Beam Saber"); DisplayName.AddTranslation(GameCulture.Russian, "Зелёный Световой Клинок"); @@ -120,29 +120,29 @@ public override Color SabreColour() { return new Color(0.5f, 1f, 0f); } public override int SabreSlashType() - { return mod.ProjectileType(); } + { return ModContent.ProjectileType(); } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 15); - recipe.AddIngredient(ItemID.SoulofFright, 15); - recipe.AddIngredient(ItemID.Emerald, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 15); + recipe.AddIngredient(ItemID.SoulofFright, 15); + recipe.AddIngredient(ItemID.Emerald, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); recipe.AddRecipe(); } - } + } public class BeamSabreGreenSlash : BeamSabreSlash { public override Vector3 SabreColour() { return new Vector3(0.5f, 1f, 0f); } - } - - public class BeamSabreRed : BeamSabre + } + + public class BeamSabreRed : BeamSabre { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Red Beam Saber"); DisplayName.AddTranslation(GameCulture.Russian, "Красный Световой Клинок"); @@ -153,29 +153,29 @@ public override Color SabreColour() { return new Color(1f, 0.1f, 0f); } public override int SabreSlashType() - { return mod.ProjectileType(); } + { return ModContent.ProjectileType(); } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 15); - recipe.AddIngredient(ItemID.SoulofFright, 15); - recipe.AddIngredient(ItemID.Ruby, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 15); + recipe.AddIngredient(ItemID.SoulofFright, 15); + recipe.AddIngredient(ItemID.Ruby, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); recipe.AddRecipe(); } - } + } public class BeamSabreRedSlash : BeamSabreSlash { public override Vector3 SabreColour() { return new Vector3(1f, 0.1f, 0f); } } - public class BeamSabreWhite : BeamSabre + public class BeamSabreWhite : BeamSabre { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("White Beam Saber"); DisplayName.AddTranslation(GameCulture.Russian, "Белый Световой Клинок"); @@ -186,23 +186,23 @@ public override Color SabreColour() { return new Color(1f, 1f, 1f); } public override int SabreSlashType() - { return mod.ProjectileType(); } + { return ModContent.ProjectileType(); } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 15); - recipe.AddIngredient(ItemID.SoulofFright, 15); - recipe.AddIngredient(ItemID.Diamond, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 15); + recipe.AddIngredient(ItemID.SoulofFright, 15); + recipe.AddIngredient(ItemID.Diamond, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); recipe.AddRecipe(); } - } + } public class BeamSabreWhiteSlash : BeamSabreSlash { public override Vector3 SabreColour() { return new Vector3(1f, 1f, 1f); } - } -} + } +} diff --git a/Items/Weapons/Sabres/BorealWoodSabre.cs b/Items/Weapons/Sabres/BorealWoodSabre.cs index 7db716d..0f7df57 100644 --- a/Items/Weapons/Sabres/BorealWoodSabre.cs +++ b/Items/Weapons/Sabres/BorealWoodSabre.cs @@ -4,18 +4,18 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Localization; -using Microsoft.Xna.Framework.Graphics; - +using Microsoft.Xna.Framework.Graphics; + namespace WeaponOut.Items.Weapons.Sabres { public class BorealWoodSabre : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Boreal Saber"); - DisplayName.AddTranslation(GameCulture.Russian, "Северный Клинок"); - - Tooltip.SetDefault("Charge Attack to double strike"); + DisplayName.SetDefault("Boreal Saber"); + DisplayName.AddTranslation(GameCulture.Russian, "Северный Клинок"); + + Tooltip.SetDefault("Charge Attack to double strike"); Tooltip.AddTranslation(GameCulture.Russian, "Заряд для двойного удара"); } public override void SetDefaults() @@ -29,8 +29,8 @@ public override void SetDefaults() item.autoReuse = true; item.useStyle = 1; - item.UseSound = SoundID.Item1; - + item.UseSound = SoundID.Item1; + item.useTime = 30 / 4; item.useAnimation = 25; @@ -38,7 +38,7 @@ public override void SetDefaults() item.value = 0; } public override void AddRecipes() - { + { if (!ModConf.EnableSabres) return; ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BorealWood, 7); @@ -47,41 +47,41 @@ public override void AddRecipes() recipe.AddRecipe(); } - public override void HoldItem(Player player) - { - if (ModSabres.HoldItemManager(player, item, mod.ProjectileType(), - default(Color), 0.9f, player.itemTime == 0 ? 0f : 1f)) - { Buffs.SabreDance.ApplySabreDance(mod, player, 1); } - } - - // Doesn't get called unless item.shoot is defined. - //public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override void HoldItem(Player player) + { + if (ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), + default(Color), 0.9f, player.itemTime == 0 ? 0f : 1f)) + { Buffs.SabreDance.ApplySabreDance(mod, player, 1); } + } + + // Doesn't get called unless item.shoot is defined. + //public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) //{ return ModSabres.IsChargedShot(player); } - public override bool UseItemFrame(Player player) - { - ModSabres.UseItemFrame(player, 0.9f, item.isBeingGrabbed); - return true; + public override bool UseItemFrame(Player player) + { + ModSabres.UseItemFrame(player, 0.9f, item.isBeingGrabbed); + return true; + } + + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + int height = 70; + int length = 72; + ModSabres.UseItemHitboxCalculate(player, item, ref hitbox, ref noHitbox, 0.9f, height, length); } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - int height = 70; - int length = 72; - ModSabres.UseItemHitboxCalculate(player, item, ref hitbox, ref noHitbox, 0.9f, height, length); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - Color colour = new Color(255, 89, 0, 119); - ModSabres.OnHitFX(player, target, crit, colour); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + Color colour = new Color(255, 89, 0, 119); + ModSabres.OnHitFX(player, target, crit, colour); + } } - public class BorealWoodSabreSlash : ModProjectile + public class BorealWoodSabreSlash : ModProjectile { public static Texture2D specialSlash; - public const int specialProjFrames = 5; - bool sndOnce = true; + public const int specialProjFrames = 5; + bool sndOnce = true; int chargeSlashDirection = 1; public override void SetStaticDefaults() { @@ -102,48 +102,48 @@ public override void SetDefaults() projectile.ignoreWater = true; projectile.penetrate = -1; - } - public override bool? CanCutTiles() { return false; } + } + public override bool? CanCutTiles() { return false; } public int FrameCheck { get { return (int)projectile.ai[0]; } set { projectile.ai[0] = value; } - } - public int SlashLogic + } + public int SlashLogic { get { return (int)projectile.ai[1]; } - set { projectile.ai[1] = value; } - } - + set { projectile.ai[1] = value; } + } + public override void AI() - { - Player player = Main.player[projectile.owner]; - if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } - else - { - // Charged attack - ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); - ModSabres.NormalSlash(projectile, player); - - // Play charged sound - if (sndOnce) - { Main.PlaySound(SoundID.Item5.WithVolume(0.5f), projectile.Center); sndOnce = false; } + { + Player player = Main.player[projectile.owner]; + if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } + else + { + // Charged attack + ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); + ModSabres.NormalSlash(projectile, player); + + // Play charged sound + if (sndOnce) + { Main.PlaySound(SoundID.Item5.WithVolume(0.5f), projectile.Center); sndOnce = false; } } projectile.damage = 0; projectile.ai[0] += 1f; // Framerate - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); - Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); - return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, - null,//SlashLogic == 0f ? specialSlash : null, - lighting, - specialProjFrames, - SlashLogic == 0f ? chargeSlashDirection : SlashLogic); - } - + int weaponItemID = ModContent.ItemType(); + Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); + return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, + null,//SlashLogic == 0f ? specialSlash : null, + lighting, + specialProjFrames, + SlashLogic == 0f ? chargeSlashDirection : SlashLogic); + } + } } diff --git a/Items/Weapons/Sabres/EnchantedSabre.cs b/Items/Weapons/Sabres/EnchantedSabre.cs index 899a611..0ecc381 100644 --- a/Items/Weapons/Sabres/EnchantedSabre.cs +++ b/Items/Weapons/Sabres/EnchantedSabre.cs @@ -1,79 +1,79 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; using Microsoft.Xna.Framework.Graphics; -namespace WeaponOut.Items.Weapons.Sabres -{ - public class EnchantedSabre : ModItem - { - public override void SetStaticDefaults() - { +namespace WeaponOut.Items.Weapons.Sabres +{ + public class EnchantedSabre : ModItem + { + public override void SetStaticDefaults() + { DisplayName.SetDefault("Enchanted Saber"); DisplayName.AddTranslation(GameCulture.Russian, "Зачарованный Клинок"); Tooltip.SetDefault("Charge Attack shoots an enchanted beam"); - Tooltip.AddTranslation(GameCulture.Russian, "Заряд выпускает волшебный клинок"); - } - public override void SetDefaults() - { - item.width = 32; - item.height = 32; - - item.melee = true; - item.damage = 25; //DPS 75 - item.knockBack = 3; - item.autoReuse = true; - - item.useStyle = 1; + Tooltip.AddTranslation(GameCulture.Russian, "Заряд выпускает волшебный клинок"); + } + public override void SetDefaults() + { + item.width = 32; + item.height = 32; + + item.melee = true; + item.damage = 25; //DPS 75 + item.knockBack = 3; + item.autoReuse = true; + + item.useStyle = 1; item.UseSound = SoundID.Item1; - item.useTime = 30 / 4; + item.useTime = 30 / 4; item.useAnimation = 18; - item.shoot = mod.ProjectileType(); - item.shootSpeed = 16f; - - item.rare = 2; - item.value = 25000; - } - public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.EnchantedSword, 1); - recipe.AddIngredient(ItemID.Feather, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - //Conversion from - recipe = new ModRecipe(mod); - recipe.AddIngredient(this, 1); - recipe.AddIngredient(ItemID.FallenStar, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.EnchantedSword); - recipe.AddRecipe(); - } - + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + + item.rare = 2; + item.value = 25000; + } + public override void AddRecipes() + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.EnchantedSword, 1); + recipe.AddIngredient(ItemID.Feather, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + //Conversion from + recipe = new ModRecipe(mod); + recipe.AddIngredient(this, 1); + recipe.AddIngredient(ItemID.FallenStar, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.EnchantedSword); + recipe.AddRecipe(); + } + public override void HoldItem(Player player) { - ModSabres.HoldItemManager(player, item, mod.ProjectileType(), + ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), Color.Yellow, 0.9f, player.itemTime == 0 ? 0f : 1f); } // Doesn't get called unless item.shoot is defined. public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { return ModSabres.IsChargedShot(player); } - + { return ModSabres.IsChargedShot(player); } + public override bool UseItemFrame(Player player) { ModSabres.UseItemFrame(player, 0.9f, item.isBeingGrabbed); return true; - } - + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 84; @@ -86,46 +86,46 @@ public override void OnHitNPC(Player player, NPC target, int damage, float knock Color colour = new Color(0.8f, 0.4f, 1f); ModSabres.OnHitFX(player, target, crit, colour, true); } - } + } public class EnchantedSabreSlash : ModProjectile - { - public static Texture2D specialSlash; + { + public static Texture2D specialSlash; public static int specialProjFrames = 5; bool sndOnce = true; - int chargeSlashDirection = 1; - public override void SetStaticDefaults() - { - Main.projFrames[projectile.type] = 5; - if (Main.netMode == 2) return; - specialSlash = mod.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); - } - public override void SetDefaults() - { - projectile.width = 88; - projectile.height = 84; - projectile.aiStyle = -1; - projectile.timeLeft = 60; - - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - - projectile.penetrate = -1; + int chargeSlashDirection = 1; + public override void SetStaticDefaults() + { + Main.projFrames[projectile.type] = 5; + if (Main.netMode == 2) return; + specialSlash = mod.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); + } + public override void SetDefaults() + { + projectile.width = 88; + projectile.height = 84; + projectile.aiStyle = -1; + projectile.timeLeft = 60; + + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + + projectile.penetrate = -1; } public override bool? CanCutTiles() { return false; } - public int FrameCheck - { - get { return (int)projectile.ai[0]; } - set { projectile.ai[0] = value; } + public int FrameCheck + { + get { return (int)projectile.ai[0]; } + set { projectile.ai[0] = value; } } public int SlashLogic - { - get { return (int)projectile.ai[1]; } + { + get { return (int)projectile.ai[1]; } set { projectile.ai[1] = value; } } - public override void AI() + public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } @@ -134,15 +134,15 @@ public override void AI() // Charged attack ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); - } - projectile.damage = 0; - projectile.ai[0] += 1f; // Framerate + } + projectile.damage = 0; + projectile.ai[0] += 1f; // Framerate } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); + Player player = Main.player[projectile.owner]; + int weaponItemID = ModContent.ItemType(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, SlashLogic == 0f ? specialSlash : null, @@ -151,24 +151,24 @@ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) SlashLogic == 0f ? chargeSlashDirection : SlashLogic); } - } + } public class EnchantedSabreBeam : ModProjectile - { - public override void SetStaticDefaults() - { - Main.projFrames[projectile.type] = 6; - } - public override void SetDefaults() - { - projectile.width = 64; + { + public override void SetStaticDefaults() + { + Main.projFrames[projectile.type] = 6; + } + public override void SetDefaults() + { + projectile.width = 64; projectile.height = 64; - projectile.penetrate = 1; - - projectile.friendly = true; - projectile.melee = true; - } - public override void AI() + projectile.penetrate = 1; + + projectile.friendly = true; + projectile.melee = true; + } + public override void AI() { if(projectile.ai[0] == 0) { @@ -226,5 +226,5 @@ public override bool TileCollideStyle(ref int width, ref int height, ref bool fa { return new Color(1f, 1f, 1f, 0.6f); } - } -} + } +} diff --git a/Items/Weapons/Sabres/Hayauchi.cs b/Items/Weapons/Sabres/Hayauchi.cs index 13664d3..8bad75d 100644 --- a/Items/Weapons/Sabres/Hayauchi.cs +++ b/Items/Weapons/Sabres/Hayauchi.cs @@ -1,98 +1,98 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; using Microsoft.Xna.Framework.Graphics; using System; -namespace WeaponOut.Items.Weapons.Sabres -{ - /// - /// Stand (mostly) still to charge a slash, messes with hitboxes etc. - /// drawstrike does quad damage, with added crit for a total of x8 - /// 35 * 8 == 280 - /// Draw Strike speed = 80 + 20 + 15 == 115 - /// Draw Strike DPS = 146 - /// hey, its me, jetstream sammy - /// - public class Hayauchi : ModItem - { +namespace WeaponOut.Items.Weapons.Sabres +{ + /// + /// Stand (mostly) still to charge a slash, messes with hitboxes etc. + /// drawstrike does quad damage, with added crit for a total of x8 + /// 35 * 8 == 280 + /// Draw Strike speed = 80 + 20 + 15 == 115 + /// Draw Strike DPS = 146 + /// hey, its me, jetstream sammy + /// + public class Hayauchi : ModItem + { public const int waitTime = 15; public const int chargeDamageMult = 4; - private bool drawStrike; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hayauchi"); - DisplayName.AddTranslation(GameCulture.Chinese, "快打"); - DisplayName.AddTranslation(GameCulture.Russian, "Хаяуси"); - - Tooltip.SetDefault( - "'Focus, steel thyself'\n" + - "'Wait for the perfect moment'\n" + - "'A decisive blow'"); - Tooltip.AddTranslation(GameCulture.Chinese, "“聚集力量”\n“等待时机”\n“一击定音”"); - Tooltip.AddTranslation(GameCulture.Russian, - "'Сосредоточься'\n" + - "'Выбери момент'\n" + - "'Точный удар'"); - } - public override void SetDefaults() - { - item.width = 46; - item.height = 46; - - item.melee = true; - item.damage = 52; //DPS 126 - item.knockBack = 3; - item.autoReuse = true; - - item.useStyle = 1; - item.UseSound = SoundID.Item1; - - item.useTime = waitTime; - item.useAnimation = 22; - - item.rare = 5; - item.value = Item.buyPrice(0, 02, 50, 00); - } + private bool drawStrike; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hayauchi"); + DisplayName.AddTranslation(GameCulture.Chinese, "快打"); + DisplayName.AddTranslation(GameCulture.Russian, "Хаяуси"); + + Tooltip.SetDefault( + "'Focus, steel thyself'\n" + + "'Wait for the perfect moment'\n" + + "'A decisive blow'"); + Tooltip.AddTranslation(GameCulture.Chinese, "“聚集力量”\n“等待时机”\n“一击定音”"); + Tooltip.AddTranslation(GameCulture.Russian, + "'Сосредоточься'\n" + + "'Выбери момент'\n" + + "'Точный удар'"); + } + public override void SetDefaults() + { + item.width = 46; + item.height = 46; + + item.melee = true; + item.damage = 52; //DPS 126 + item.knockBack = 3; + item.autoReuse = true; + + item.useStyle = 1; + item.UseSound = SoundID.Item1; + + item.useTime = waitTime; + item.useAnimation = 22; + + item.rare = 5; + item.value = Item.buyPrice(0, 02, 50, 00); + } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - for (int i = 0; i < 2; i++) - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Katana, 1); - if (i == 0) - { - recipe.AddIngredient(ItemID.CobaltBar, 6); - } - else - { - recipe.AddIngredient(ItemID.PalladiumBar, 6); - } - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } - - // Define if the player is still enough to use the special + { + if (!ModConf.EnableSabres) return; + for (int i = 0; i < 2; i++) + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Katana, 1); + if (i == 0) + { + recipe.AddIngredient(ItemID.CobaltBar, 6); + } + else + { + recipe.AddIngredient(ItemID.PalladiumBar, 6); + } + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + // Define if the player is still enough to use the special public bool hasHayauchiSpecialCharge(Player player) { return player.itemTime == 0 && Math.Abs(player.position.X - player.oldPosition.X) < 1f && Math.Abs(player.position.Y - player.oldPosition.Y) < 2f; - } - + } + public override void HoldItem(Player player) { bool specialCharge = hasHayauchiSpecialCharge(player); - ModSabres.HoldItemManager(player, item, mod.ProjectileType(), + ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), Color.Red, 0.9f, specialCharge ? 0f : 1f, customCharge, 12); // Blade sheen once fully charged @@ -105,8 +105,8 @@ public override void HoldItem(Player player) d.scale = 0.2f; d.fadeIn = 0.8f; } - } - + } + public Action customCharge = CustomCharge; public static void CustomCharge(Player player, bool flashFrame) { @@ -119,14 +119,14 @@ public static void CustomCharge(Player player, bool flashFrame) Dust d = Dust.NewDustDirect(dustPos, 0, 0, 130, player.direction, 0f); d.scale = 0.6f; } - } - if (player.itemTime > 0) // Charging sheen effect + } + if (player.itemTime > 0) // Charging sheen effect { float chargeNormal = (float)player.itemTime / player.HeldItem.useTime; // 1 -> 0 Vector2 dustPos = getBladeDustPos(player, chargeNormal); Dust d = Dust.NewDustDirect(dustPos, 0, 0, 71); - d.scale = 0.5f; - d.velocity *= chargeNormal / 2f; + d.scale = 0.5f; + d.velocity *= chargeNormal / 2f; } } private static Vector2 getBladeDustPos(Player player, float distanceNormal) @@ -143,23 +143,23 @@ private static Vector2 getBladeDustPos(Player player, float distanceNormal) ); return bladePosition; } - - public override bool HoldItemFrame(Player player) //called on player holding but not swinging - { - if (hasHayauchiSpecialCharge(player)) //ready to slash - { - player.bodyFrame.Y = 4 * player.bodyFrame.Height; - return true; - } - return false; - } - + + public override bool HoldItemFrame(Player player) //called on player holding but not swinging + { + if (hasHayauchiSpecialCharge(player)) //ready to slash + { + player.bodyFrame.Y = 4 * player.bodyFrame.Height; + return true; + } + return false; + } + public override bool UseItemFrame(Player player) { ModSabres.UseItemFrame(player, 0.9f, item.isBeingGrabbed); return true; - } - + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 100; @@ -176,10 +176,10 @@ public override void OnHitNPC(Player player, NPC target, int damage, float knock { Color colour = new Color(1f, 0f, 0f); ModSabres.OnHitFX(player, target, crit, colour, true); - } - - //x6 damage + crit to make up for terrible (but cool) usage - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + } + + //x6 damage + crit to make up for terrible (but cool) usage + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) { if (ModSabres.SabreIsChargedStriking(player, item)) { @@ -187,63 +187,63 @@ public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref knockBack *= 2; if ((player.Center - target.Center).Length() > 70) { crit = true; } - } - - } - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + } + + } + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) { if (ModSabres.SabreIsChargedStriking(player, item)) { damage *= chargeDamageMult; if ((player.Center - target.Center).Length() > 70) { crit = true; } - } - } + } + } } - public class HayauchiSlash : ModProjectile - { - public static Texture2D specialSlash; + public class HayauchiSlash : ModProjectile + { + public static Texture2D specialSlash; public static int specialProjFrames = 6; bool sndOnce = true; - int chargeSlashDirection = -1; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hayauchi"); + int chargeSlashDirection = -1; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hayauchi"); DisplayName.AddTranslation(GameCulture.Chinese, "快打"); - DisplayName.AddTranslation(GameCulture.Russian, "Хаяуси"); + DisplayName.AddTranslation(GameCulture.Russian, "Хаяуси"); Main.projFrames[projectile.type] = 5; - if (Main.netMode == 2) return; - specialSlash = mod.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); - } - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.aiStyle = -1; + if (Main.netMode == 2) return; + specialSlash = mod.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); + } + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.aiStyle = -1; projectile.timeLeft = 60; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - - projectile.penetrate = -1; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + + projectile.penetrate = -1; } public override bool? CanCutTiles() { return false; } - public float FrameCheck - { - get { return projectile.ai[0]; } - set { projectile.ai[0] = value; } + public float FrameCheck + { + get { return projectile.ai[0]; } + set { projectile.ai[0] = value; } } public float SlashLogic - { - get { return (int)projectile.ai[1]; } + { + get { return (int)projectile.ai[1]; } set { projectile.ai[1] = value; } - } - - public override void AI() + } + + public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) @@ -275,20 +275,20 @@ public override void AI() new Vector3(pow, pow * 0.2f, pow * 0.8f)); FrameCheck += 0.5f; - } - projectile.damage = 0; + } + projectile.damage = 0; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); + Player player = Main.player[projectile.owner]; + int weaponItemID = ModContent.ItemType(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, SlashLogic == 0f ? specialSlash : null, SlashLogic == 0f ? new Color(1f, 1f, 1f, 0.1f) : lighting, specialProjFrames, - SlashLogic == 0f ? chargeSlashDirection : SlashLogic); - } - } -} + SlashLogic == 0f ? chargeSlashDirection : SlashLogic); + } + } +} diff --git a/Items/Weapons/Sabres/JungleWoodSabre.cs b/Items/Weapons/Sabres/JungleWoodSabre.cs index 0bbd742..8b58c1a 100644 --- a/Items/Weapons/Sabres/JungleWoodSabre.cs +++ b/Items/Weapons/Sabres/JungleWoodSabre.cs @@ -12,10 +12,10 @@ public class JungleWoodSabre : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mahogany Saber"); - DisplayName.AddTranslation(GameCulture.Russian, "Красный Клинок"); - - Tooltip.SetDefault("Charge Attack to lunge forwards"); + DisplayName.SetDefault("Mahogany Saber"); + DisplayName.AddTranslation(GameCulture.Russian, "Красный Клинок"); + + Tooltip.SetDefault("Charge Attack to lunge forwards"); Tooltip.AddTranslation(GameCulture.Russian, "Заряд для рывка вперёд"); } public override void SetDefaults() @@ -49,7 +49,7 @@ public override void AddRecipes() public override void HoldItem(Player player) { - ModSabres.HoldItemManager(player, item, mod.ProjectileType(), + ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), default(Color), 0.9f, player.itemTime == 0 ? 0f : 1f); } @@ -80,7 +80,7 @@ public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref { if (ModSabres.SabreIsChargedStriking(player, item)) { - target.AddBuff(mod.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); } } } @@ -156,7 +156,7 @@ public override void AI() public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); + int weaponItemID = ModContent.ItemType(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, null,//SlashLogic == 0f ? specialSlash : null, diff --git a/Items/Weapons/Sabres/Onsoku.cs b/Items/Weapons/Sabres/Onsoku.cs index c0f55a9..5734519 100644 --- a/Items/Weapons/Sabres/Onsoku.cs +++ b/Items/Weapons/Sabres/Onsoku.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace WeaponOut.Items.Weapons.Sabres -{ - /// - /// Dash around like some kind of... cyborg ninja - /// - public class Onsoku : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Onsoku"); - DisplayName.AddTranslation(GameCulture.Chinese, "音速"); - DisplayName.AddTranslation(GameCulture.Russian, "Онсоку"); - - Tooltip.SetDefault( - "Dashes through enemies\n" + - "Dash cooldown reduced on the ground"); - Tooltip.AddTranslation(GameCulture.Chinese, "挥动后玩家会冲刺到光标所指方向\n在地面时降低该武器冷却时间"); - Tooltip.AddTranslation(GameCulture.Russian, - "Прорывается сквозь врагов\n" + - "Время между рывками короче на земле"); - } - public override void SetDefaults() - { - item.width = 40; - item.height = 40; - - item.melee = true; - item.damage = 35; - item.knockBack = 1; +using System; +using System.Collections.Generic; + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace WeaponOut.Items.Weapons.Sabres +{ + /// + /// Dash around like some kind of... cyborg ninja + /// + public class Onsoku : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Onsoku"); + DisplayName.AddTranslation(GameCulture.Chinese, "音速"); + DisplayName.AddTranslation(GameCulture.Russian, "Онсоку"); + + Tooltip.SetDefault( + "Dashes through enemies\n" + + "Dash cooldown reduced on the ground"); + Tooltip.AddTranslation(GameCulture.Chinese, "挥动后玩家会冲刺到光标所指方向\n在地面时降低该武器冷却时间"); + Tooltip.AddTranslation(GameCulture.Russian, + "Прорывается сквозь врагов\n" + + "Время между рывками короче на земле"); + } + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + + item.melee = true; + item.damage = 35; + item.knockBack = 1; item.autoReuse = true; - item.useStyle = 1; - item.UseSound = SoundID.Item1; - - item.useTime = 60 / 4; - item.useAnimation = 15; - - item.rare = 4; - item.value = Item.sellPrice(0, 0, 50, 0); - } + item.useStyle = 1; + item.UseSound = SoundID.Item1; + + item.useTime = 60 / 4; + item.useAnimation = 15; + + item.rare = 4; + item.value = Item.sellPrice(0, 0, 50, 0); + } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.UnicornHorn, 1); - recipe.AddIngredient(ItemID.SoulofLight, 25); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void HoldItem(Player player) { - ModSabres.HoldItemManager(player, item, mod.ProjectileType(), - Color.HotPink, 0.9f, player.itemTime == 0 ? 0f : 1f); - } - + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.UnicornHorn, 1); + recipe.AddIngredient(ItemID.SoulofLight, 25); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void HoldItem(Player player) + { + ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), + Color.HotPink, 0.9f, player.itemTime == 0 ? 0f : 1f); + } + public override bool UseItemFrame(Player player) { ModSabres.UseItemFrame(player, 0.9f, item.isBeingGrabbed); return true; - } - + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 98; @@ -91,50 +91,50 @@ public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref { damage /= 2; knockBack = knockBack * 2f + 4f; - target.AddBuff(mod.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); } } } - public class OnsokuSlash : ModProjectile - { + public class OnsokuSlash : ModProjectile + { public const int specialProjFrames = 5; bool sndOnce = true; - int chargeSlashDirection = 1; - public override void SetStaticDefaults() - { - Main.projFrames[projectile.type] = specialProjFrames; - } - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.aiStyle = -1; - projectile.timeLeft = 60; - - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - - projectile.penetrate = -1; + int chargeSlashDirection = 1; + public override void SetStaticDefaults() + { + Main.projFrames[projectile.type] = specialProjFrames; + } + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.aiStyle = -1; + projectile.timeLeft = 60; + + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + + projectile.penetrate = -1; } public override bool? CanCutTiles() { return SlashLogic == 0; } - public float FrameCheck - { - get { return projectile.ai[0]; } - set { projectile.ai[0] = value; } + public float FrameCheck + { + get { return projectile.ai[0]; } + set { projectile.ai[0] = value; } } public int SlashLogic - { - get { return (int)projectile.ai[1]; } + { + get { return (int)projectile.ai[1]; } set { projectile.ai[1] = value; } } Vector2? preDashVelocity; bool firstFrame = true; - public override void AI() + public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } @@ -209,16 +209,16 @@ public override void AI() } } } - } - + } + projectile.damage = 0; - FrameCheck += 1f; // Framerate + FrameCheck += 1f; // Framerate } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); + Player player = Main.player[projectile.owner]; + int weaponItemID = ModContent.ItemType(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, null,//SlashLogic == 0f ? specialSlash : null, @@ -226,7 +226,7 @@ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) specialProjFrames, SlashLogic == 0f ? chargeSlashDirection : SlashLogic, SlashLogic == 0f); - } - - } + } + + } } \ No newline at end of file diff --git a/Items/Weapons/Sabres/PalmWoodSabre.cs b/Items/Weapons/Sabres/PalmWoodSabre.cs index a5d8553..e1d51a8 100644 --- a/Items/Weapons/Sabres/PalmWoodSabre.cs +++ b/Items/Weapons/Sabres/PalmWoodSabre.cs @@ -12,10 +12,10 @@ public class PalmWoodSabre : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Palm Saber"); - DisplayName.AddTranslation(GameCulture.Russian, "Пальмовый Клинок"); - - Tooltip.SetDefault("Charge Attack launches enemies upwards"); + DisplayName.SetDefault("Palm Saber"); + DisplayName.AddTranslation(GameCulture.Russian, "Пальмовый Клинок"); + + Tooltip.SetDefault("Charge Attack launches enemies upwards"); Tooltip.AddTranslation(GameCulture.Russian, "Заряд подбрасывает врагов"); } public override void SetDefaults() @@ -49,7 +49,7 @@ public override void AddRecipes() public override void HoldItem(Player player) { - ModSabres.HoldItemManager(player, item, mod.ProjectileType(), + ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), default(Color), 0.9f, player.itemTime == 0 ? 0f : 1f); } @@ -81,7 +81,7 @@ public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref if (ModSabres.SabreIsChargedStriking(player, item)) { knockBack *= 2f; - target.AddBuff(mod.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); } } } @@ -95,7 +95,7 @@ public override void SetStaticDefaults() { Main.projFrames[projectile.type] = specialProjFrames; //if (Main.netMode == 2) return; - //specialSlash = mod.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); + //specialSlash = ModContent.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); } public override void SetDefaults() { @@ -144,7 +144,7 @@ public override void AI() public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); + int weaponItemID = ModContent.ItemType(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, null,//SlashLogic == 0f ? specialSlash : null, diff --git a/Items/Weapons/Sabres/Raiden.cs b/Items/Weapons/Sabres/Raiden.cs index 410503c..cc72de3 100644 --- a/Items/Weapons/Sabres/Raiden.cs +++ b/Items/Weapons/Sabres/Raiden.cs @@ -1,22 +1,22 @@ -using System; -using System.Collections.Generic; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; +using System; +using System.Collections.Generic; + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; using System.Linq; -namespace WeaponOut.Items.Weapons.Sabres -{ +namespace WeaponOut.Items.Weapons.Sabres +{ public static class RaidenUtils - { - public const int focusTime = 60; - public const int focusTargets = 15; - private const float focusRadius = 320f; + { + public const int focusTime = 60; + public const int focusTargets = 15; + private const float focusRadius = 320f; private const float focusRadiusReductionSpeedFactor = 15f; public static int DustAmount(Player player) { return player.whoAmI == Main.myPlayer ? 32 : 2; } @@ -124,61 +124,61 @@ public static void DrawDustToBetweenVectors(Vector2 start, Vector2 end, int dust d.noGravity = noGravity; } } - } - - /// - /// Yo it's like, a homing weapon or something. - /// - public class Raiden : ModItem - { - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Raiden"); - DisplayName.AddTranslation(GameCulture.Chinese, "雷电"); - DisplayName.AddTranslation(GameCulture.Russian, "Рейден"); - - Tooltip.SetDefault( - "Stand still to focus on nearby foes\n" + - "'Imbued with ancient arts'"); - Tooltip.AddTranslation(GameCulture.Chinese, "站着不动时会将注意力集中到附近敌人身上\n“注满了古代的武艺”"); - Tooltip.AddTranslation(GameCulture.Russian, - "Стойте на месте, чтобы сфокусироваться на ближайших врагов\n" + - "'Зачарован древним мастерством'"); - } - public override void SetDefaults() - { - item.width = 40; - item.height = 40; - - item.melee = true; - item.damage = 55; - item.knockBack = 5; - item.autoReuse = true; - - item.useStyle = 1; - item.UseSound = SoundID.Item1; - item.useTime = 60 / 4; - item.useAnimation = 17; - - item.rare = 7; - item.value = Item.sellPrice(0, 3, 0, 0); - } + } + + /// + /// Yo it's like, a homing weapon or something. + /// + public class Raiden : ModItem + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Raiden"); + DisplayName.AddTranslation(GameCulture.Chinese, "雷电"); + DisplayName.AddTranslation(GameCulture.Russian, "Рейден"); + + Tooltip.SetDefault( + "Stand still to focus on nearby foes\n" + + "'Imbued with ancient arts'"); + Tooltip.AddTranslation(GameCulture.Chinese, "站着不动时会将注意力集中到附近敌人身上\n“注满了古代的武艺”"); + Tooltip.AddTranslation(GameCulture.Russian, + "Стойте на месте, чтобы сфокусироваться на ближайших врагов\n" + + "'Зачарован древним мастерством'"); + } + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + + item.melee = true; + item.damage = 55; + item.knockBack = 5; + item.autoReuse = true; + + item.useStyle = 1; + item.UseSound = SoundID.Item1; + item.useTime = 60 / 4; + item.useAnimation = 17; + + item.rare = 7; + item.value = Item.sellPrice(0, 3, 0, 0); + } public override void AddRecipes() - { - if (!ModConf.EnableSabres) return; - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType(), 1); - recipe.AddIngredient(mod.ItemType(), 1); - recipe.AddIngredient(ItemID.ChlorophyteBar, 8); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); + { + if (!ModConf.EnableSabres) return; + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ItemID.ChlorophyteBar, 8); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); } public override void HoldItem(Player player) { - ModSabres.HoldItemManager(player, item, mod.ProjectileType(), + ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), default(Color), 1f, player.itemTime == 0 ? 0f : 1f, customCharge, 8); if (player.itemTime == 0) @@ -211,22 +211,22 @@ public static void CustomCharge(Player player, bool flashFrame) d.fadeIn = player.whoAmI + 1; } - public override bool HoldItemFrame(Player player) //called on player holding but not swinging - { - if (player.itemTime == 0 && false) //ready to slash targets - { - player.bodyFrame.Y = 4 * player.bodyFrame.Height; - return true; - } - return false; + public override bool HoldItemFrame(Player player) //called on player holding but not swinging + { + if (player.itemTime == 0 && false) //ready to slash targets + { + player.bodyFrame.Y = 4 * player.bodyFrame.Height; + return true; + } + return false; } public override bool UseItemFrame(Player player) { ModSabres.UseItemFrame(player, 0.9f, item.isBeingGrabbed); return true; - } - + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 94; @@ -243,9 +243,9 @@ public override void OnHitNPC(Player player, NPC target, int damage, float knock { Color colour = new Color(0.4f, 0.8f, 0.1f); ModSabres.OnHitFX(player, target, crit, colour, true); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) + } + + public override void MeleeEffects(Player player, Rectangle hitbox) { float rotation = player.itemRotation + MathHelper.PiOver4; if (item.isBeingGrabbed) rotation -= MathHelper.PiOver2; // Reverse slash (upward) flip @@ -254,52 +254,52 @@ public override void MeleeEffects(Player player, Rectangle hitbox) Dust d = Dust.NewDustDirect(hitbox.Location.ToVector2() - new Vector2(4, 4), hitbox.Width, hitbox.Height, 159); d.color = Color.Green; - d.scale = 0.5f; - d.fadeIn = 0.8f; - d.position -= direction * 25f; - d.velocity = direction * 5f; - } + d.scale = 0.5f; + d.fadeIn = 0.8f; + d.position -= direction * 25f; + d.velocity = direction * 5f; + } } - public class RaidenSlash : ModProjectile + public class RaidenSlash : ModProjectile { public const int specialProjFrames = 9; bool sndOnce = true; - int chargeSlashDirection = 1; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Raiden"); - DisplayName.AddTranslation(GameCulture.Chinese, "雷电"); - Main.projFrames[projectile.type] = specialProjFrames; - } - public override void SetDefaults() - { - projectile.width = 104; - projectile.height = 94; - projectile.aiStyle = -1; - projectile.timeLeft = 60; - - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - - projectile.penetrate = -1; + int chargeSlashDirection = 1; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Raiden"); + DisplayName.AddTranslation(GameCulture.Chinese, "雷电"); + Main.projFrames[projectile.type] = specialProjFrames; + } + public override void SetDefaults() + { + projectile.width = 104; + projectile.height = 94; + projectile.aiStyle = -1; + projectile.timeLeft = 60; + + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + + projectile.penetrate = -1; } public override bool? CanCutTiles() { return false; } - public float FrameCheck - { - get { return projectile.ai[0]; } - set { projectile.ai[0] = value; } + public float FrameCheck + { + get { return projectile.ai[0]; } + set { projectile.ai[0] = value; } } public float SlashLogic - { - get { return (int)projectile.ai[1]; } + { + get { return (int)projectile.ai[1]; } set { projectile.ai[1] = value; } - } - - public override void AI() + } + + public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) @@ -350,8 +350,8 @@ public override void AI() FrameCheck += 1f; targets = null; } - } - projectile.damage = 0; + } + projectile.damage = 0; } /// As there are 9 frames, gotta fit the number of targets within this window (roughly) @@ -483,15 +483,15 @@ private void setAnimationAndImmunities(Player player) public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); + Player player = Main.player[projectile.owner]; + int weaponItemID = ModContent.ItemType(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, null,//SlashLogic == 0f ? specialSlash : null, lighting, specialProjFrames, SlashLogic == 0f ? chargeSlashDirection : SlashLogic, - SlashLogic == 0f); - } - } -} + SlashLogic == 0f); + } + } +} diff --git a/Items/Weapons/Sabres/WoodenSabre.cs b/Items/Weapons/Sabres/WoodenSabre.cs index 050dc1d..94f2b8b 100644 --- a/Items/Weapons/Sabres/WoodenSabre.cs +++ b/Items/Weapons/Sabres/WoodenSabre.cs @@ -12,10 +12,10 @@ public class WoodenSabre : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Wooden Saber"); - DisplayName.AddTranslation(GameCulture.Russian, "Деревянный Клинок"); - - Tooltip.SetDefault("Charge Attack grants 50% increased knockback"); + DisplayName.SetDefault("Wooden Saber"); + DisplayName.AddTranslation(GameCulture.Russian, "Деревянный Клинок"); + + Tooltip.SetDefault("Charge Attack grants 50% increased knockback"); Tooltip.AddTranslation(GameCulture.Russian, "Заряд увеличивает отброс на 50%"); } public override void SetDefaults() @@ -49,7 +49,7 @@ public override void AddRecipes() public override void HoldItem(Player player) { - ModSabres.HoldItemManager(player, item, mod.ProjectileType(), + ModSabres.HoldItemManager(player, item, ModContent.ProjectileType(), default(Color), 0.9f, player.itemTime == 0 ? 0f : 1f); } @@ -92,7 +92,7 @@ public override void SetStaticDefaults() { Main.projFrames[projectile.type] = specialProjFrames; //if (Main.netMode == 2) return; - //specialSlash = mod.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); + //specialSlash = ModContent.GetTexture("Items/Weapons/Sabres/" + GetType().Name + "_Special"); } public override void SetDefaults() { @@ -141,7 +141,7 @@ public override void AI() public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Player player = Main.player[projectile.owner]; - int weaponItemID = mod.ItemType(); + int weaponItemID = ModContent.ItemType(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, null,//SlashLogic == 0f ? specialSlash : null, diff --git a/ModConf.cs b/ModConf.cs index 90f646a..31082fb 100644 --- a/ModConf.cs +++ b/ModConf.cs @@ -1,153 +1,259 @@ -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.IO; -using Terraria.ModLoader; - -namespace WeaponOut -{ - /// - /// Tutorial by goldenapple: https://forums.terraria.org/index.php?threads/modders-guide-to-config-files-and-optional-features.48581/ - /// - public static class ModConf - { - public const int configVersion = 3; - - internal static bool showWeaponOut = true; - public static bool ShowWeaponOut { get { return showWeaponOut; } } - private const string showWeaponOutField = "show_weaponOut_visuals"; - - internal static bool forceShowWeaponOut = false; - public static bool ForceShowWeaponOut { get { return forceShowWeaponOut; } } - private const string forceShowWeaponOutField = "forceshow_weaponOut_visuals"; - - internal static bool toggleWaistRotation = false; - public static bool ToggleWaistRotation { get { return toggleWaistRotation; } } - private const string toggleWaistRotationField = "toggle_weaponOut_waist_rotation"; - - internal static bool enableBasicContent = true; - public static bool EnableBasicContent { get { return enableBasicContent; } } - private const string enableBasicContentField = "enable_base_weapons_and_tiles"; - - internal static bool enableWhips = true; - public static bool EnableWhips { get { return enableWhips; } } - private const string enableWhipsField = "enable_whips"; - - internal static bool enableFists = true; - public static bool EnableFists { get { return enableFists; } } - private const string enableFistsField = "enable_fists"; - - internal static bool enableDualWeapons = true; - public static bool EnableDualWeapons { get { return enableDualWeapons; } } - private const string enableDualWeaponsField = "enable_dual_weapons"; - - internal static bool enableAccessories = true; - public static bool EnableAccessories { get { return enableAccessories; } } - private const string enableAccessoriesField = "enable_accessories"; - - internal static bool enableEmblems = true; - public static bool EnableEmblems { get { return enableEmblems; } } - private const string enableEmblemsField = "enable_emblems"; - - internal static bool enableSabres = true; - public static bool EnableSabres { get { return enableSabres; } } - private const string enableSabresField = "enable_sabres"; - - static string ConfigPath = Path.Combine(Main.SavePath, "Mod Configs/WeaponOut.json"); - - static Preferences ModConfig = new Preferences(ConfigPath); - - internal static void Load() - { - bool success = ReadConfig(); - if (!success) - { - ErrorLogger.Log("WeaponOut: Couldn't load config file, creating new file. "); - CreateConfig(); - } - } - - /// true is loaded successfully - internal static bool ReadConfig() - { - if (ModConfig.Load()) - { - int readVersion = 0; - ModConfig.Get("version", ref readVersion); - if (readVersion != configVersion) - { - bool canUpdate = false; - if (readVersion == 0) - { - canUpdate = true; - readVersion = 1; - ModConfig.Put("version", readVersion); - ModConfig.Put(enableEmblemsField, enableEmblems); - ModConfig.Save(); - } - if (readVersion == 1) - { - canUpdate = true; - readVersion = 2; - ModConfig.Put("version", readVersion); - ModConfig.Put(toggleWaistRotationField, toggleWaistRotation); - ModConfig.Save(); - } - if (readVersion == 2) - { - canUpdate = true; - readVersion = 3; - ModConfig.Put("version", readVersion); - ModConfig.Put(enableSabresField, enableSabres); - ModConfig.Save(); - } - - if (!canUpdate) return false; - } - - ModConfig.Get(showWeaponOutField, ref showWeaponOut); - ModConfig.Get(forceShowWeaponOutField, ref forceShowWeaponOut); - ModConfig.Get(toggleWaistRotationField, ref toggleWaistRotation); - ModConfig.Get(enableBasicContentField, ref enableBasicContent); - ModConfig.Get(enableWhipsField, ref enableWhips); - ModConfig.Get(enableFistsField, ref enableFists); - ModConfig.Get(enableSabresField, ref enableSabres); - ModConfig.Get(enableDualWeaponsField, ref enableDualWeapons); - ModConfig.Get(enableAccessoriesField, ref enableAccessories); - ModConfig.Get(enableEmblemsField, ref enableEmblems); - - return true; - } - return false; - } - - /// - /// Create a new config file for the player to edit. - /// - internal static void CreateConfig() - { - ModConfig.Clear(); - ModConfig.Put("version", configVersion); - - ModConfig.Put(showWeaponOutField, showWeaponOut); - ModConfig.Put(forceShowWeaponOutField, forceShowWeaponOut); - ModConfig.Put(toggleWaistRotationField, toggleWaistRotation); - ModConfig.Put(enableBasicContentField, enableBasicContent); - ModConfig.Put(enableWhipsField, enableWhips); - ModConfig.Put(enableFistsField, enableFists); - ModConfig.Put(enableSabresField, enableSabres); - ModConfig.Put(enableDualWeaponsField, enableDualWeapons); - ModConfig.Put(enableAccessoriesField, enableAccessories); - ModConfig.Put(enableEmblemsField, enableEmblems); - - ModConfig.Put("readme", "First off, make sure to reload before the configs will take any effect. Most of the fields do exactly as they say, they will allow the mod to load, or choose not to, sets of content from the mod. The only field that does not do this is forceshow_weaponOut_visuals, which simply forces the weapon to always show regardless of the visibility of the first accessory slot as this is an oft requested feature. WARNING: Clients will desync if their local config is different to the server - this cannot be fixed without forcing the clients to download the server's mods and forcing the mods to reload. So don't mess with this too much outside of singleplayer unless you know what you're doing. And no I'm too lazy to find out how to even fix this behaviour, though a simple server mismatch warning might be a good idea. Feel free to delete this."); - - ModConfig.Save(); - } - } - +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.IO; +using Terraria.ModLoader; +using Terraria.ModLoader.Config; +using System.ComponentModel; + +namespace WeaponOut +{ + /// + /// Everything in here does not have to be synced with the server. + /// ExampleMod used as a reference. + /// + public class ClientConfig : ModConfig + { + public override ConfigScope Mode => ConfigScope.ClientSide; + + // For future-Proofing + // It does not *have* to follow the version number from the old config + // Since it is a new file + // This can't be edited in the GUI + public int Version => 1; + + [ReloadRequired] + [DefaultValue(true)] + public bool ShowWeaponOut; + + [ReloadRequired] + [DefaultValue(false)] + public bool ForceShowWeaponOut; + + [ReloadRequired] + [DefaultValue(false)] + public bool ToggleWaistRotation; + + public override void OnLoaded() + { + // Set ModConf config to this + ModConf.clientConfig = (ClientConfig)this.Clone(); + ModConf.createClientConfig(); + } + } + + + /// + /// Everything in here has to be synced with the server. + /// ExampleMod used as a reference. + /// + public class ServerConfig : ModConfig + { + // Any settings that would require syncing between the server and client (i.e. recipes) go here. + // This config will be synced with the client on connection, (they will reload with the server config if their config differs). + public override ConfigScope Mode => ConfigScope.ServerSide; + + // For future-Proofing. + // It does not have to follow the version number from the old config, + // Since it is a new file. + // This can't be edited in the GUI + public int Version => 1; + + [ReloadRequired] + [DefaultValue(true)] + public bool EnableBaseContent; + + [ReloadRequired] + [DefaultValue(true)] + public bool EnableWhips; + + [ReloadRequired] + [DefaultValue(true)] + public bool EnableFists; + + [ReloadRequired] + [DefaultValue(true)] + public bool EnableDualWeapons; + + [ReloadRequired] + [DefaultValue(true)] + public bool EnableAccessories; + + [ReloadRequired] + [DefaultValue(true)] + public bool EnableEmblems; + + [ReloadRequired] + [DefaultValue(true)] + public bool EnableSabres; + + public override void OnLoaded() + { + // Set ModConf config to this + ModConf.serverConfig = (ServerConfig)this.Clone(); + ModConf.createServerConfig(); + } + + } + + /// + /// Tutorial by goldenapple: https://forums.terraria.org/index.php?threads/modders-guide-to-config-files-and-optional-features.48581/ + /// + public static class ModConf + { + internal static ClientConfig clientConfig = null; + internal static ServerConfig serverConfig = null; + + public const int configVersion = 3; + + // Fields are no longer needed since tModloader just uses the Variable names instead + public static bool ShowWeaponOut { get { return clientConfig.ShowWeaponOut; } } + public static bool ForceShowWeaponOut { get { return clientConfig.ForceShowWeaponOut; } } + public static bool ToggleWaistRotation { get { return clientConfig.ToggleWaistRotation; } } + public static bool EnableBasicContent { get { return serverConfig.EnableBaseContent; } } + public static bool EnableWhips { get { return serverConfig.EnableWhips; } } + public static bool EnableFists { get { return serverConfig.EnableFists; } } + public static bool EnableDualWeapons { get { return serverConfig.EnableDualWeapons; } } + public static bool EnableAccessories { get { return serverConfig.EnableAccessories; } } + public static bool EnableEmblems { get { return serverConfig.EnableEmblems; } } + public static bool EnableSabres { get { return serverConfig.EnableSabres; } } + + // tModloader names the config like so: _.json + // These could be simplified to WeaponOut_ClientConfig.json and WeaponOut_ServerConfig.json + // But if the internal config names get changed, we'll be manually saving to the wrong place + internal readonly static string clientPath = Path.Combine(ConfigManager.ModConfigPath, nameof(WeaponOut) + "_" + nameof(ClientConfig) + ".json"); + internal readonly static string serverPath = Path.Combine(ConfigManager.ModConfigPath, nameof(WeaponOut) + "_" + nameof(ServerConfig) + ".json"); + internal readonly static string legacyPath = Path.Combine(ConfigManager.ModConfigPath, "WeaponOut.json"); + + /// + /// Tmodloader only saves differing settings + /// This will manually create a complete client config + /// + internal static void createClientConfig() + { + // It should be noted that this is completely unnecessary + + // This is only for people like server admins, or others + // who choose to edit JSON's instead of using the GUI + + //Similar to above, using nameof() to ensure the same name tModloader uses + Preferences clientPrefs = new Preferences(clientPath); + clientPrefs.Put(nameof(ClientConfig.ShowWeaponOut), clientConfig.ShowWeaponOut); + clientPrefs.Put(nameof(ClientConfig.ForceShowWeaponOut), clientConfig.ForceShowWeaponOut); + clientPrefs.Put(nameof(ClientConfig.ToggleWaistRotation), clientConfig.ToggleWaistRotation); + clientPrefs.Save(); + } + + /// + /// Tmodloader only saves differing settings + /// This will manually create a complete server config + /// + internal static void createServerConfig() + { + // It should be noted that this is completely unnecessary + + // This is only for people like server admins, or others + // who choose to edit JSON's instead of using the GUI + + // Similar to above, using nameof() to ensure the same name tModloader uses + Preferences serverPrefs = new Preferences(serverPath); + serverPrefs.Put(nameof(ServerConfig.EnableBaseContent), serverConfig.EnableBaseContent); + serverPrefs.Put(nameof(ServerConfig.EnableWhips), serverConfig.EnableWhips); + serverPrefs.Put(nameof(ServerConfig.EnableFists), serverConfig.EnableFists); + serverPrefs.Put(nameof(ServerConfig.EnableSabres), serverConfig.EnableSabres); + serverPrefs.Put(nameof(ServerConfig.EnableDualWeapons), serverConfig.EnableDualWeapons); + serverPrefs.Put(nameof(ServerConfig.EnableAccessories), serverConfig.EnableAccessories); + serverPrefs.Put(nameof(ServerConfig.EnableEmblems), serverConfig.EnableEmblems); + serverPrefs.Save(); + } + + + /// + /// This will manually create a complete server config + /// + internal static void Load() + { + // Load is now almost completely unnecessary + // It is currently only being used to try to convert the old config to the new ones + if (File.Exists(legacyPath)) + { + ConvertLegacyConfig(); + }; + } + + + /// + /// true means succesful conversion, reload required + /// false means failed conversion + /// something went wrong and we're just gonnna ignore the old config, + /// no reload required + /// + /// TODO: Is there a way to force a reload after changing + /// the config without user intervention? + internal static bool ConvertLegacyConfig() + { + bool success = false; + Preferences legacyPrefs = new Preferences(legacyPath); + if (legacyPrefs.Load()) + { + int readVersion = 0; + + // Version 0 Setings + legacyPrefs.Get("show_weaponOut_visuals", ref clientConfig.ShowWeaponOut); + legacyPrefs.Get("forceshow_weaponOut_visuals", ref clientConfig.ForceShowWeaponOut); + legacyPrefs.Get("enable_base_weapons_and_tiles", ref serverConfig.EnableBaseContent); + legacyPrefs.Get("enable_whips", ref serverConfig.EnableWhips); + legacyPrefs.Get("enable_fists", ref serverConfig.EnableFists); + legacyPrefs.Get("enable_dual_weapons", ref serverConfig.EnableDualWeapons); + legacyPrefs.Get("enable_accessories", ref serverConfig.EnableAccessories); + + if (readVersion >= 1) + { + legacyPrefs.Get("enable_emblems", ref serverConfig.EnableEmblems); + } + if (readVersion >= 2) + { + legacyPrefs.Get("toggle_weaponOut_waist_rotation", ref clientConfig.ToggleWaistRotation); + } + if (readVersion >= 3) + { + legacyPrefs.Get("enable_sabres", ref serverConfig.EnableSabres); + } + + // call saveModConfigs() here to convert + // clientConfig and serverConfig to Preferences + // (we can't save ModConfigs manually, but we can + // save Preferences, and they're encoded the same way) + + success = true; + } + else + { + ErrorLogger.Log("WeaponOut: legacyConfig exists, but did not load"); + } + + // Whether it worked or not, rename the legacy, so we don't convert every time + // File.Move(legacyPath, ConfigManager.ModConfigPath + "WeaponOut_old.json"); + + if (clientConfig.NeedsReload(clientConfig)) + { + Preferences thing = new Preferences(clientPath); + } + serverConfig.NeedsReload(serverConfig); + return success; + } + + internal static Preferences saveModConfigs() + { + return null; + } + } + + + + public static class ModConfWeaponOutCustom - { + { public const int configVersion = 0; /// @@ -161,18 +267,18 @@ public static class ModConfWeaponOutCustom /// static int[] customHoldStyleArray; - static string ConfigPath = Path.Combine(Main.SavePath, "Mod Configs/WeaponOut_Custom.json"); - - static Preferences ModConfig = new Preferences(ConfigPath); - internal static bool ModConfigLoaded = false; - internal static bool ModConfigUpdated = false; - - internal static void Load() - { - customHoldStyleArray = new int[ItemLoader.ItemCount]; - - customHoldPositions = new Dictionary(); - ModConfigLoaded = ReadConfig(); + static string ConfigPath = Path.Combine(Main.SavePath, "Mod Configs/WeaponOut_Custom.json"); + + static Preferences ModConfig = new Preferences(ConfigPath); + internal static bool ModConfigLoaded = false; + internal static bool ModConfigUpdated = false; + + internal static void Load() + { + customHoldStyleArray = new int[ItemLoader.ItemCount]; + + customHoldPositions = new Dictionary(); + ModConfigLoaded = ReadConfig(); } public static bool ItemTypeHasCustomHoldStyle(int type) @@ -221,7 +327,7 @@ private static void UpdateCustomHold(string itemID, int style) { customHoldPositions[itemID] = style; } else { customHoldPositions.Add(itemID, style); } - + } else { @@ -230,30 +336,30 @@ private static void UpdateCustomHold(string itemID, int style) if (style != currentStyle) ModConfigUpdated = true; } - /// true is loaded successfully - internal static bool ReadConfig() - { - if (ModConfig.Load()) - { - int readVersion = 0; - ModConfig.Get("version", ref readVersion); - if (readVersion != configVersion) - { - bool canUpdate = false; - if (readVersion == 0) - { - canUpdate = true; - } - if (!canUpdate) return false; + /// true is loaded successfully + internal static bool ReadConfig() + { + if (ModConfig.Load()) + { + int readVersion = 0; + ModConfig.Get("version", ref readVersion); + if (readVersion != configVersion) + { + bool canUpdate = false; + if (readVersion == 0) + { + canUpdate = true; + } + if (!canUpdate) return false; } - - List allKeys = ModConfig.GetAllKeys(); + + List allKeys = ModConfig.GetAllKeys(); foreach (string key in allKeys) { customHoldPositions.Add(key, ModConfig.Get(key, -1)); - } - - for(int i = 0; i < ItemLoader.ItemCount; i++) + } + + for (int i = 0; i < ItemLoader.ItemCount; i++) { ModItem item = ItemLoader.GetItem(i); if (item != null) @@ -267,13 +373,13 @@ internal static bool ReadConfig() if (customHoldPositions.ContainsKey(i.ToString())) { customHoldStyleArray[i] = customHoldPositions[i.ToString()]; } } - } - - return true; - } - return false; - } - + } + + return true; + } + return false; + } + internal static void SaveConfig() { if (ModConfigUpdated) @@ -288,5 +394,6 @@ internal static void SaveConfig() ModConfigUpdated = false; } } - } -} + } +} + diff --git a/ModPlayerFists.cs b/ModPlayerFists.cs index 30703c0..63cfa92 100644 --- a/ModPlayerFists.cs +++ b/ModPlayerFists.cs @@ -31,22 +31,22 @@ namespace WeaponOut /// public class ModPlayerFists : ModPlayer { - public override bool Autoload(ref string name) - { - ModTranslation text; - - text = mod.CreateTranslation("WOFistComboPower"); - text.SetDefault("$POWER combo power cost"); - text.AddTranslation(GameCulture.Chinese, "$POWER 点连击能量消耗"); - text.AddTranslation(GameCulture.Russian, "$POWER стоимость заряда комбо"); - mod.AddTranslation(text); - - text = mod.CreateTranslation("WOFistPrefixSize"); - text.SetDefault("% combo cost"); - text.AddTranslation(GameCulture.Chinese, "%连击能量消耗"); - text.AddTranslation(GameCulture.Russian, "% стоимость комбо"); - mod.AddTranslation(text); - + public override bool Autoload(ref string name) + { + ModTranslation text; + + text = mod.CreateTranslation("WOFistComboPower"); + text.SetDefault("$POWER combo power cost"); + text.AddTranslation(GameCulture.Chinese, "$POWER 点连击能量消耗"); + text.AddTranslation(GameCulture.Russian, "$POWER стоимость заряда комбо"); + mod.AddTranslation(text); + + text = mod.CreateTranslation("WOFistPrefixSize"); + text.SetDefault("% combo cost"); + text.AddTranslation(GameCulture.Chinese, "%连击能量消耗"); + text.AddTranslation(GameCulture.Russian, "% стоимость комбо"); + mod.AddTranslation(text); + return true; } @@ -210,7 +210,7 @@ protected static List> ComboEffectsMethods #region overrides public override void Initialize() { - if (!ModConf.EnableFists) return; + if (!ModConf.EnableFists) return; specialMove = 0; comboResetTimeBonus = 0; @@ -236,7 +236,7 @@ public override void Initialize() } public override void UpdateDead() { - if (!ModConf.EnableFists) return; + if (!ModConf.EnableFists) return; this.Initialize(); } @@ -250,83 +250,83 @@ public override void ResetEffects() public override bool PreItemCheck() { - if (!ModConf.EnableFists) return true; - - // Main.NewText("cd = " + player.attackCD + " : " + noBounce); - // Don't use the item whilst a parry is in progress - if (ItemCheckParry()) - { - return false; - } - - // Reset comboEffect at the end of animation - ManageComboMethodCall(); - - // Make dashing effects hit everything it passes through - if (dashEffect != 0 || specialMove == 1 || noBounce) - { - player.attackCD = 0; + if (!ModConf.EnableFists) return true; + + // Main.NewText("cd = " + player.attackCD + " : " + noBounce); + // Don't use the item whilst a parry is in progress + if (ItemCheckParry()) + { + return false; + } + + // Reset comboEffect at the end of animation + ManageComboMethodCall(); + + // Make dashing effects hit everything it passes through + if (dashEffect != 0 || specialMove == 1 || noBounce) + { + player.attackCD = 0; } return true; } public override void PreUpdate() { - if (!ModConf.EnableFists) return; - - comboCounterMax = player.HeldItem.tileBoost; - comboCounterMaxScaleMod = Math.Max(0, 2 - player.HeldItem.scale); - - // Jump again uppercut cannot be used from ground, only after attack resets - if (player.velocity.Y == 0) - { - // But upgraded fists can - Item i = new Item(); i.SetDefaults(player.HeldItem.type); - if (i.rare >= 4) - { jumpAgainUppercut = true; } - else - { jumpAgainUppercut = false; } - - jumpWingUppercut = false; - } - - // Reset dash here when grappling - if (player.pulley || player.grapCount > 0) - { - if (player.dashDelay == -1) player.dashDelay = dashCooldownDelay; - ResetDashVars(); - } - - if (specialMove == 2) - { - // Increase speed whilst diving - player.maxFallSpeed *= 1.5f; + if (!ModConf.EnableFists) return; + + comboCounterMax = player.HeldItem.tileBoost; + comboCounterMaxScaleMod = Math.Max(0, 2 - player.HeldItem.scale); + + // Jump again uppercut cannot be used from ground, only after attack resets + if (player.velocity.Y == 0) + { + // But upgraded fists can + Item i = new Item(); i.SetDefaults(player.HeldItem.type); + if (i.rare >= 4) + { jumpAgainUppercut = true; } + else + { jumpAgainUppercut = false; } + + jumpWingUppercut = false; + } + + // Reset dash here when grappling + if (player.pulley || player.grapCount > 0) + { + if (player.dashDelay == -1) player.dashDelay = dashCooldownDelay; + ResetDashVars(); + } + + if (specialMove == 2) + { + // Increase speed whilst diving + player.maxFallSpeed *= 1.5f; } } public override void PostUpdate() { - if (!ModConf.EnableFists) return; - - // Set up parry frames - SetComboEffectLogic(); - - FistBodyFrame(); - ParryBodyFrame(); - + if (!ModConf.EnableFists) return; + + // Set up parry frames + SetComboEffectLogic(); + + FistBodyFrame(); + ParryBodyFrame(); + ShowFistHandOn(); } public override void PostUpdateRunSpeeds() { - if (!ModConf.EnableFists) return; + if (!ModConf.EnableFists) return; CustomDashMovement(); } public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { - if (!ModConf.EnableFists) return true; + if (!ModConf.EnableFists) return true; // All fists have a global damage reduction on projectiles, because they're all about closing // in and doing big DPS. Due to the nature of the weapon, dodging projectiles is less important @@ -341,7 +341,7 @@ public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDi // This gets called last in the hook stack, after Item, then NPC public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) { - if (!ModConf.EnableFists) return; + if (!ModConf.EnableFists) return; if (specialMove == 1) // Uppercut { @@ -356,7 +356,7 @@ public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref flo } public override void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit) { - if (!ModConf.EnableFists) return; + if (!ModConf.EnableFists) return; if (specialMove == 1) { @@ -370,7 +370,7 @@ public override void ModifyHitPvp(Item item, Player target, ref int damage, ref public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) { - if (!ModConf.EnableFists) return; + if (!ModConf.EnableFists) return; OnHitComboLogic(item, target); } @@ -496,13 +496,13 @@ private void SetSpecialMove(Player player, float jumpSpeed, float fallSpeedXmod, (jumpWingUppercut && player.wingTime > jumpWingCost))) { // Uppercut from jumpagain specialMove = 1; - if(jumpAgainUppercut) - { - jumpAgainUppercut = false; - } - else - { - player.wingTime -= jumpWingCost; + if(jumpAgainUppercut) + { + jumpAgainUppercut = false; + } + else + { + player.wingTime -= jumpWingCost; } } else if (player.controlDown @@ -1293,7 +1293,7 @@ private bool ParryPreHurt(PlayerDeathReason damageSource, ref int damageTaken) // Add 5 sec parry buff and short invincibility int immunityParryTime = 20 + player.itemAnimationMax; provideImmunity(player, immunityParryTime); - player.AddBuff(mod.BuffType(), parryBuffTime, false); + player.AddBuff(ModContent.BuffType(), parryBuffTime, false); // Set flat cooldown parryTime = -immunityParryTime - 6; @@ -1389,15 +1389,15 @@ private bool ParryPreHurt(PlayerDeathReason damageSource, ref int damageTaken) WeaponOut.NetUpdateParry(this); // Only partial parry if too powerful for weapon - if(damageTaken > player.HeldItem.damage * 2) - { - player.noKnockback = true; - if (damageTaken > player.HeldItem.damage * 3) - { - damageTaken /= 2; - } - damageTaken /= 3; - return false; + if(damageTaken > player.HeldItem.damage * 2) + { + player.noKnockback = true; + if (damageTaken > player.HeldItem.damage * 3) + { + damageTaken /= 2; + } + damageTaken /= 3; + return false; } return true; } @@ -1447,7 +1447,7 @@ public bool AltFunctionParryDash(Player player, int parryWindow, int parryCooldo public int GetParryBuff() { - return player.FindBuffIndex(mod.BuffType()); + return player.FindBuffIndex(ModContent.BuffType()); } public bool ClearParryBuff() { @@ -1765,14 +1765,14 @@ private void SetComboEffectLogic() // TODO: does this need to be used? // was in SetComboEffectLogic, and causing big sad lag. - private void NetUpdateClient() + private void NetUpdateClient() { // Update other clients that the fist is being used. if (Main.netMode == 1 && Main.myPlayer == player.whoAmI) { NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(MessageID.ItemAnimation, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } + } } #endregion diff --git a/NPCs/NpcFX.cs b/NPCs/NpcFX.cs index 3c7d0be..fa3db40 100644 --- a/NPCs/NpcFX.cs +++ b/NPCs/NpcFX.cs @@ -19,7 +19,7 @@ public override void SetupShop(int type, Chest shop, ref int nextSlot) //add puzzling cutter if hardmode if (Main.hardMode) { - shop.item[nextSlot].SetDefaults(mod.ItemType()); + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; } } @@ -31,7 +31,7 @@ public override void SetupShop(int type, Chest shop, ref int nextSlot) //add scrap salvo after mech if (Main.hardMode && NPC.downedPlantBoss) { - shop.item[nextSlot].SetDefaults(mod.ItemType()); + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; } } @@ -43,12 +43,12 @@ public override void SetupShop(int type, Chest shop, ref int nextSlot) //add headbands after bossess if (NPC.downedBoss3) { - shop.item[nextSlot].SetDefaults(mod.ItemType()); + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; } if (NPC.downedGolemBoss) { - shop.item[nextSlot].SetDefaults(mod.ItemType()); + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; } } @@ -62,8 +62,8 @@ public override void SetupTravelShop(int[] shop, ref int nextSlot) int chance = 5; if (NPC.downedSlimeKing) chance--; if (NPC.downedBoss1) chance--; - int taekwonBody = mod.ItemType(); - int boxingBody = mod.ItemType(); + int taekwonBody = ModContent.ItemType(); + int boxingBody = ModContent.ItemType(); foreach (Player p in Main.player) { if (p.armor[1].type == taekwonBody || p.armor[1].type == boxingBody) @@ -73,8 +73,8 @@ public override void SetupTravelShop(int[] shop, ref int nextSlot) } if (Main.rand.Next(Math.Max(1,chance)) == 0) { - shop[nextSlot] = mod.ItemType(); nextSlot++; - shop[nextSlot] = mod.ItemType(); nextSlot++; + shop[nextSlot] = ModContent.ItemType(); nextSlot++; + shop[nextSlot] = ModContent.ItemType(); nextSlot++; } } } @@ -86,12 +86,12 @@ public override void NPCLoot(NPC npc) int itemType = -1; if (npc.type == NPCID.GraniteGolem && Main.rand.Next(10) == 0) { - Item.NewItem(npc.position, npc.Size, mod.ItemType(), 1, false, -1, false, false); + Item.NewItem(npc.position, npc.Size, ModContent.ItemType(), 1, false, -1, false, false); return; } if (npc.type == NPCID.BoneLee && Main.rand.Next(6) == 0) { - Item.NewItem(npc.position, npc.Size, mod.ItemType(), 1, false, -1, false, false); + Item.NewItem(npc.position, npc.Size, ModContent.ItemType(), 1, false, -1, false, false); return; } @@ -103,25 +103,25 @@ public override void NPCLoot(NPC npc) if (Main.expertMode) { if (npc.type == NPCID.KingSlime) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.EyeofCthulhu) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type >= NPCID.EaterofWorldsHead && npc.type <= NPCID.EaterofWorldsTail) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.BrainofCthulhu) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.QueenBee) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.SkeletronHead) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.WallofFlesh) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) { @@ -130,24 +130,24 @@ public override void NPCLoot(NPC npc) // Last eye standing if (!NPC.AnyNPCs(partner)) { - itemType = mod.ItemType(); + itemType = ModContent.ItemType(); } } if (npc.type == NPCID.TheDestroyer) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.SkeletronPrime) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.Plantera) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.Golem) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.DukeFishron) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } } // Modified from DropItemInstanced, only drop for people using fists @@ -179,38 +179,38 @@ public override void NPCLoot(NPC npc) if (chance) { if (npc.type == NPCID.KingSlime) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.Plantera) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.MartianSaucerCore) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.DukeFishron) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } if (npc.type == NPCID.DD2Betsy) - { itemType = mod.ItemType(); } + { itemType = ModContent.ItemType(); } } } if(Main.pumpkinMoon && npc.type == NPCID.Pumpking) { - int waveChance = Math.Max(1, (Main.expertMode ? 12 : 16) - NPC.waveNumber); // 12 is when two start spawning at once - int chance = Main.rand.Next(waveChance); - //Main.NewText("Pumpking Slain, " + chance + "/" + waveChance); + int waveChance = Math.Max(1, (Main.expertMode ? 12 : 16) - NPC.waveNumber); // 12 is when two start spawning at once + int chance = Main.rand.Next(waveChance); + //Main.NewText("Pumpking Slain, " + chance + "/" + waveChance); if (chance == 0) { - itemType = mod.ItemType(); + itemType = ModContent.ItemType(); } } if(Main.snowMoon && npc.type == NPCID.IceQueen) { - int waveChance = Math.Max(1, (Main.expertMode ? 12 : 16) - NPC.waveNumber); // 12 is when two start spawning at once - int chance = Main.rand.Next(waveChance); - // Main.NewText("Pumpking Slain, " + chance + "/" + waveChance); + int waveChance = Math.Max(1, (Main.expertMode ? 12 : 16) - NPC.waveNumber); // 12 is when two start spawning at once + int chance = Main.rand.Next(waveChance); + // Main.NewText("Pumpking Slain, " + chance + "/" + waveChance); if (chance == 0) { - itemType = mod.ItemType(); + itemType = ModContent.ItemType(); } } diff --git a/PlayerFX.cs b/PlayerFX.cs index a2618aa..eb26e07 100644 --- a/PlayerFX.cs +++ b/PlayerFX.cs @@ -204,21 +204,21 @@ public static bool SameTeam(Player player1, Player player2) return true; } - public struct SoundData - { - public int Type; - public int x; - public int y; - public int Style; - public float volumeScale; - public float pitchOffset; - public SoundData(int Type) - { this.Type = Type; x = -1; y = -1; Style = 1; volumeScale = 1f; pitchOffset = 0f; } + public struct SoundData + { + public int Type; + public int x; + public int y; + public int Style; + public float volumeScale; + public float pitchOffset; + public SoundData(int Type) + { this.Type = Type; x = -1; y = -1; Style = 1; volumeScale = 1f; pitchOffset = 0f; } } public static void ItemFlashFX(Player player, int dustType = 45, SoundData sDat = default(SoundData)) { if (sDat.Type == 0) { sDat = new SoundData(25); } - if (player.whoAmI == Main.myPlayer) + if (player.whoAmI == Main.myPlayer) { Main.PlaySound(sDat.Type, sDat.x, sDat.y, sDat.Style, sDat.volumeScale, sDat.pitchOffset); } for (int i = 0; i < 5; i++) { @@ -350,7 +350,7 @@ public override void ResetEffects() else { momentum = 0; } - int buffID = mod.BuffType(); + int buffID = ModContent.BuffType(); if (momentum >= momentumMax && buildMomentum) { momentum = momentumMax; @@ -365,7 +365,7 @@ public override void ResetEffects() // ================ Second Wind ================ // secondWind = false; - if (player.FindBuffIndex(mod.BuffType()) < 0) + if (player.FindBuffIndex(ModContent.BuffType()) < 0) { secondWindLifeTax = 0; } secondWindLifeTax = Math.Max(0, secondWindLifeTax); @@ -399,13 +399,13 @@ public override void ResetEffects() { soapCooldown++; } else { - int bubbleID = mod.NPCType(); + int bubbleID = ModContent.NPCType(); if (NPC.CountNPCS(bubbleID) < maxSoapBubbles) { Point spawnPos = player.Center.ToPoint(); spawnPos.X += Main.rand.Next(-100, 101); spawnPos.Y += Main.rand.Next(-100, 101); - NPC.NewNPC(spawnPos.X, spawnPos.Y, mod.NPCType(), + NPC.NewNPC(spawnPos.X, spawnPos.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, player.whoAmI); soapCooldown = 0; @@ -427,7 +427,7 @@ public override void UpdateDead() yang = 0; yinMeleeBonus = 0f; - player.ClearBuff(mod.BuffType()); + player.ClearBuff(ModContent.BuffType()); secondWindLifeTax = 0; FakePositionTemp = default(Vector2); @@ -464,13 +464,13 @@ public override void PostUpdateBuffs() } if (ModConf.EnableFists) { - if (!starlightGuardian) - { - // Delete starlight guardian debuff if it hasn't been applied - int buffID = mod.BuffType(); - if (player.FindBuffIndex(buffID) != -1) - { player.DelBuff(player.FindBuffIndex(buffID)); } - + if (!starlightGuardian) + { + // Delete starlight guardian debuff if it hasn't been applied + int buffID = ModContent.BuffType(); + if (player.FindBuffIndex(buffID) != -1) + { player.DelBuff(player.FindBuffIndex(buffID)); } + } } } @@ -482,10 +482,10 @@ private void applyBannerBuff() if (!bannerPlayer.active || bannerPlayer.dead) continue; int itemType = bannerPlayer.inventory[bannerPlayer.selectedItem].type; - if (itemType != mod.ItemType() && - itemType != mod.ItemType() && - itemType != mod.ItemType() && - itemType != mod.ItemType() + if (itemType != ModContent.ItemType() && + itemType != ModContent.ItemType() && + itemType != ModContent.ItemType() && + itemType != ModContent.ItemType() ) continue; //only use these banner items foreach (Player otherPlayer in Main.player) @@ -499,7 +499,7 @@ private void applyBannerBuff() otherPlayer.position.Y >= bannerPlayer.position.Y - Buffs.RallyBanner.buffRadius && otherPlayer.position.Y <= bannerPlayer.position.Y + Buffs.RallyBanner.buffRadius) { - otherPlayer.AddBuff(mod.BuffType(), 2); + otherPlayer.AddBuff(ModContent.BuffType(), 2); } } } @@ -508,9 +508,9 @@ private void applyBannerBuff() public override bool PreItemCheck() { - if (ModConf.EnableBasicContent) - { - tentCleanupScript(); + if (ModConf.EnableBasicContent) + { + tentCleanupScript(); } if (ModConf.EnableDualWeapons) { @@ -522,7 +522,7 @@ public override bool PreItemCheck() public override void PostItemCheck() { - if( ModConf.enableDualWeapons) + if( ModConf.EnableDualWeapons) { PostItemDualSyncAltFunction(); } @@ -890,14 +890,14 @@ private void tentScript() { if (localTempSpawn != default(Vector2)) SetTemporaryRespawn(); } - private void tentCleanupScript() - { - if(localPermaSpawnCache != null) + private void tentCleanupScript() + { + if(localPermaSpawnCache != null) { player.SpawnX = (int)((Vector2)localPermaSpawnCache).X; - player.SpawnY = (int)((Vector2)localPermaSpawnCache).Y; - localPermaSpawnCache = null; - } + player.SpawnY = (int)((Vector2)localPermaSpawnCache).Y; + localPermaSpawnCache = null; + } } private void SetTemporaryRespawn() { @@ -960,7 +960,7 @@ private void FistPostUpdate() if (yomiFinishedAttack) { // Buff manages setting/resetting - player.AddBuff(mod.BuffType(), 60 * 3); + player.AddBuff(ModContent.BuffType(), 60 * 3); yomiFinishedAttack = false; } } @@ -1050,23 +1050,23 @@ private void FistPostUpdate() yinMeleeBonus = Math.Max(yinMeleeBonus, yinPower); } - player.AddBuff(mod.BuffType(), 2); + player.AddBuff(ModContent.BuffType(), 2); } yin = 0; yang = 0; - player.ClearBuff(mod.BuffType()); - player.ClearBuff(mod.BuffType()); - player.ClearBuff(mod.BuffType()); + player.ClearBuff(ModContent.BuffType()); + player.ClearBuff(ModContent.BuffType()); + player.ClearBuff(ModContent.BuffType()); #endregion } else { #region Apply YinYang Buff - int bYiYa = mod.BuffType(); - int bYang = mod.BuffType(); - int bYin = mod.BuffType(); + int bYiYa = ModContent.BuffType(); + int bYang = ModContent.BuffType(); + int bYin = ModContent.BuffType(); int time = mpf.comboTimerMax - mpf.comboTimer; if (isBalanced) @@ -1280,9 +1280,9 @@ private void FistOnHitNPC(NPC target, int damage) { int healBeeType = ProjectileID.BeeArrow; if (player.strongBees && Main.rand.Next(2) == 0) - { healBeeType = mod.ProjectileType(); } + { healBeeType = ModContent.ProjectileType(); } else - { healBeeType = mod.ProjectileType(); } + { healBeeType = ModContent.ProjectileType(); } int targetPlayer = player.whoAmI; if (Main.LocalPlayer.team != 0) @@ -1475,7 +1475,7 @@ private bool FistPreHurt(int damage, PlayerDeathReason damageSource) if (damageSource.SourceProjectileIndex >= 0) { momentum /= 2; - player.AddBuff(mod.BuffType(), 0, false); + player.AddBuff(ModContent.BuffType(), 0, false); // Can't reflect damage that's too powerful! if (Main.projectile[damageSource.SourceProjectileIndex].damage > player.statLifeMax2 / 8) { @@ -1497,7 +1497,7 @@ private bool FistPreHurt(int damage, PlayerDeathReason damageSource) player.ApplyDamageToNPC(Main.npc[damageSource.SourceNPCIndex], player.statLife / 4, 3f + Math.Abs(player.velocity.X) * 2f, player.direction, false); Main.PlaySound(SoundID.Item10, player.position); - player.AddBuff(mod.BuffType(), 0, false); + player.AddBuff(ModContent.BuffType(), 0, false); player.immuneTime += 60; return false; } @@ -1515,7 +1515,7 @@ private void FistPostHurt(double damage) #region Counter Damage Buff if (taekwonCounter) { - player.AddBuff(mod.BuffType(), 60 + Math.Abs(player.statLife - player.statLifeMax2) / 2); + player.AddBuff(ModContent.BuffType(), 60 + Math.Abs(player.statLife - player.statLifeMax2) / 2); } #endregion @@ -1569,7 +1569,7 @@ private bool FistPreKill(double damage, PlayerDeathReason damageSource) { if (secondWindLifeTax == 0) { - player.AddBuff(mod.BuffType(), 3600 * 3); // 3 min + player.AddBuff(ModContent.BuffType(), 3600 * 3); // 3 min } secondWindLifeTax += overkill; player.statLife = Math.Max(player.statLife, 1); @@ -1587,7 +1587,7 @@ private void MomentumDashTorwardsMouse() momentum = 0; momentumDashTime = 6; - player.AddBuff(mod.BuffType(), 90); + player.AddBuff(ModContent.BuffType(), 90); player.immune = true; player.immuneTime = Math.Max(10, player.immuneTime); if (player.longInvince) player.immuneTime += 10; @@ -1606,7 +1606,7 @@ private void MomentumDashTorwardsMouse() private void sashRestoreLogic() { - if (!ModConf.enableFists || + if (!ModConf.EnableFists || sashMaxLifeRecoverMult <= 0f || player.whoAmI != Main.myPlayer) return; @@ -1632,17 +1632,17 @@ private void sashRestoreLogic() sashLifeLost = lifeRestorable(player); if (sashLifeLost == 0) - { player.AddBuff(mod.BuffType(), 1); } + { player.AddBuff(ModContent.BuffType(), 1); } else if (sashLifeLost >= (int)(player.statLifeMax2 * sashMaxLifeRecoverMult)) { - if (player.FindBuffIndex(mod.BuffType()) < 0) + if (player.FindBuffIndex(ModContent.BuffType()) < 0) { Main.PlaySound(SoundID.Tink, player.position); } - player.AddBuff(mod.BuffType(), 2); + player.AddBuff(ModContent.BuffType(), 2); } else - { player.AddBuff(mod.BuffType(), 1); } + { player.AddBuff(ModContent.BuffType(), 1); } } else if (sashLifeLost > 0) { @@ -1666,7 +1666,7 @@ private void CriticalHeartHit(int damage) for (int i = 0; i < amount; i++) { - int itemAmI = Item.NewItem(player.Hitbox, mod.ItemType(), 1); + int itemAmI = Item.NewItem(player.Hitbox, ModContent.ItemType(), 1); Item item = Main.item[itemAmI]; item.velocity.X *= 1f + (0.05f * damage); item.velocity.Y -= Math.Abs(item.velocity.X) / 10; @@ -1685,12 +1685,12 @@ private void discordItemsCheck() bool canTeleHook = false; bool checkChaosState = false; // Misc equips take priority - if (player.miscEquips[4].type == mod.ItemType()) + if (player.miscEquips[4].type == ModContent.ItemType()) { canTeleHook = true; checkChaosState = false; } - else if (player.miscEquips[4].type == mod.ItemType()) + else if (player.miscEquips[4].type == ModContent.ItemType()) { canTeleHook = true; checkChaosState = true; @@ -1699,8 +1699,8 @@ private void discordItemsCheck() { foreach (Item item in player.armor) { - if (item.type == mod.ItemType() || - item.type == mod.ItemType()) + if (item.type == ModContent.ItemType() || + item.type == ModContent.ItemType()) { foreach (Item i in player.inventory) { @@ -1787,7 +1787,7 @@ public override void CatchFish(Item fishingRod, Item bait, int power, int liquid if (superrare) { if (superrare && Main.rand.Next(3) == 0) - { caughtType = mod.ItemType(); return; } + { caughtType = ModContent.ItemType(); return; } } if (worldLayer <= 1) //Surface or below @@ -1799,7 +1799,7 @@ public override void CatchFish(Item fishingRod, Item bait, int power, int liquid if (veryrare && Main.rand.Next(2) == 0) { return; } if (rare && Main.rand.Next(2) == 0) // Same chance as swordfish - { caughtType = mod.ItemType(); return; } + { caughtType = ModContent.ItemType(); return; } if (uncommon) { return; } if(common) diff --git a/PlayerWOFX.cs b/PlayerWOFX.cs index 18c2ee5..e00581b 100644 --- a/PlayerWOFX.cs +++ b/PlayerWOFX.cs @@ -25,7 +25,7 @@ public class PlayerWOFX : ModPlayer #region Weapon Holding public bool weaponVisual = true; - public bool WeaponVisual { get { return weaponVisual || ModConf.forceShowWeaponOut; } } + public bool WeaponVisual { get { return weaponVisual || ModConf.ForceShowWeaponOut; } } public int weaponFrame;//frame of weapon... #endregion @@ -39,7 +39,7 @@ private void manageBodyFrame() { //change idle pose for player using a heavy weapon //copypasting from drawPlayerItem Item heldItem = player.inventory[player.selectedItem]; - if (heldItem == null || heldItem.type == 0 || heldItem.holdStyle != 0 || !ModConf.showWeaponOut) return; //no item so nothing to show + if (heldItem == null || heldItem.type == 0 || heldItem.holdStyle != 0 || !ModConf.ShowWeaponOut) return; //no item so nothing to show Texture2D weaponTex = weaponTex = Main.itemTexture[heldItem.type]; if (weaponTex == null) return; //no texture to item so ignore too float itemWidth = weaponTex.Width * heldItem.scale; @@ -156,22 +156,22 @@ public override void ModifyDrawLayers(List layers) { //layers.Insert(MiscEffectsFrontStack, MiscEffectsFront); } - internal static HoldType getCustomHoldType(Item item) + internal static HoldType getCustomHoldType(Item item) { int style; - if (ModConfWeaponOutCustom.TryGetCustomHoldStyle(item.type, out style)) - { - return setHoldTypeSafeWrapping(style); - } - return HoldType.None; + if (ModConfWeaponOutCustom.TryGetCustomHoldStyle(item.type, out style)) + { + return setHoldTypeSafeWrapping(style); + } + return HoldType.None; } - internal static HoldType setHoldTypeSafeWrapping(int style) - { - if (style > HoldTypeCount) - { style = (int)HoldType.None; } - if (style < (int)HoldType.None) - { style = HoldTypeCount; } - return (HoldType)style; + internal static HoldType setHoldTypeSafeWrapping(int style) + { + if (style > HoldTypeCount) + { style = (int)HoldType.None; } + if (style < (int)HoldType.None) + { style = HoldTypeCount; } + return (HoldType)style; } /// @@ -181,7 +181,7 @@ internal static HoldType setHoldTypeSafeWrapping(int style) /// private static void drawPlayerItem(PlayerDrawInfo drawInfo, bool drawOnBack) { //don't draw when not ingame - if (Main.gameMenu || !ModConf.showWeaponOut) return; + if (Main.gameMenu || !ModConf.ShowWeaponOut) return; //get player player Player drawPlayer = drawInfo.drawPlayer; @@ -193,7 +193,7 @@ private static void drawPlayerItem(PlayerDrawInfo drawInfo, bool drawOnBack) { if (//do nothing if player is doing something drawPlayer.itemAnimation > 0 || //also hide if visual is disabled - (!ModConf.forceShowWeaponOut && !drawPlayer.GetModPlayer().weaponVisual)) { + (!ModConf.ForceShowWeaponOut && !drawPlayer.GetModPlayer().weaponVisual)) { return; } } @@ -314,234 +314,234 @@ private static void drawPlayerItem(PlayerDrawInfo drawInfo, bool drawOnBack) { public enum HoldType { None, Hand, Waist, Back, Spear, PowerTool, Bow, SmallGun, LargeGun, Staff } - private static readonly bool[] holdTypeHideOnBack = new bool[] { - true, true, false, false, true, true, true, true, true, true + private static readonly bool[] holdTypeHideOnBack = new bool[] { + true, true, false, false, true, true, true, true, true, true }; public static readonly int HoldTypeCount = (int)HoldType.Staff; private static void PickItemDrawType(bool drawOnBack, Player drawPlayer, Item heldItem, bool isYoyo, int gWidth, int gHeight, ref DrawData data, float itemWidth, float itemHeight, float larger, float lesser) { HoldType holdType = HoldType.None; int style; - if (ModConfWeaponOutCustom.TryGetCustomHoldStyle(heldItem.type, out style)) - { - holdType = getCustomHoldType(heldItem); + if (ModConfWeaponOutCustom.TryGetCustomHoldStyle(heldItem.type, out style)) + { + holdType = getCustomHoldType(heldItem); } - else - { + else + { #region AutoPicker - if (heldItem.useStyle == 1 || //swing - heldItem.useStyle == 2 || //eat - heldItem.useStyle == 3) //stab - { - //| ###### - //| ## ## - //| ########## - //| ## ## - //| ## ## - //| ## ## - //| ## ## - //| ## - //Items, daggers and other throwables lie below 28 and are easily held in the hand - if ((larger < 28 && !heldItem.magic) || //nonmagic weapons - (larger <= 32 && heldItem.shoot != 0) || //larger for throwing weapons - (larger <= 24 && heldItem.magic)) //only smallest magic weapons - { - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(hand): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Hand; - } - //| #### - //| ## ## - //| ## ## - //| ## ## - //| #### ## - //| ## ## - //| ## #### - //| #### - //Broadsword weapons are swing type weapons between 28 - 48 - //They are worn on the waist, and react to falling! Except when disabled - //This also amusingly applies to ducks, axes and rockfish - //But shouldn't apply to pickaxes, except when they are also not pickaxes - else if (larger <= 48 && - (heldItem.pick <= 0 || - (heldItem.pick > 0 && heldItem.axe > 0))) - { - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(waist): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Waist; - } - //| ######## - //| ## ## - //| ## #### - //| ## ## ## - //| #### ## - //| ## #### - //| ## ######## - //| ###### - //Great weapons are swing type weapons past 36 in size and slung on the back - else - { - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(back): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Back; - } - } - - if (heldItem.useStyle == 4 || //hold up - heldItem.useStyle == 5) //hold out - { - bool isAStaff = Item.staff[heldItem.type]; - //staves, guns and bows - if (gHeight >= gWidth * 1.2f && !isAStaff) - { - //| ###### - //| ## ###### - //| ## ## ## - //| ## ## ## - //| ## ## ## - //| ## ## ## - //| ## ###### - //| ###### - //bows - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(bow): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Bow; - } - else if (gWidth >= gHeight * 1.2f && !isAStaff) - { - if (heldItem.noUseGraphic && heldItem.melee) - { - //| - //| #### - //| ## ########## - //| #### ## #### - //| ## ## ## #### - //| ## ## ###### - //| ############ - //| - //drills, chainsaws - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(drill): " + itemWidth + " x " + itemHeight); - holdType = HoldType.PowerTool; - } - else - { - if (larger < 45) - { - //| #### #### - //| ## ######## ## - //| #### ## - //| ## ######## - //| ## ## ## - //| ## #### - //| ###### - //| - if (drawPlayer.grapCount > 0) return; // can't see while grappling - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(pistol): " + itemWidth + " x " + itemHeight); - //small aimed weapons (like handgun/aquasceptre) held halfway down, 1/3 back - holdType = HoldType.SmallGun; - } - else - { - //| - //| ## - //| ###################### - //| ## ## ## ## - //| ## ############ - //| #### ## ## - //| #### ## - //| - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(rifle): " + itemWidth + " x " + itemHeight); - //large guns (rifles, launchers, etc.) held with both hands - holdType = HoldType.LargeGun; - } - } - } - else - { - if (heldItem.noUseGraphic && !isAStaff) - { - if (!heldItem.autoReuse) - { - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(polearm): " + itemWidth + " x " + itemHeight); - if (isYoyo) - { - //sam (?why did i write sam? maybe same?) - data = WeaponDrawInfo.modDraw_HandWeapon(data, drawPlayer, larger, lesser, isYoyo); - } - else - { - //| #### - //| #### ## - //| ## ## - //| ## ## - //| ## ## - //| ## - //| ## - //| ## - //spears are held facing to the floor, maces generally held - holdType = HoldType.Spear; - } - } - else - { - //nebula blaze, flairon, solar eruption (too inconsistent) - if (larger <= 48) - { - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(waist safe): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Waist; - } - else - { - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(back safe): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Back; - } - } - } - else - { - if (larger + lesser <= 72) //only smallest magic weapons - { - //| ###### - //| ## ## ## - //| ## ## ## - //| ## ###### - //| ## ## ## - //| ## ## ## - //| ## ## ## - //| ###### - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(hand magic): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Hand; - } - else if (lesser <= 42) //medium sized magic weapons, treated like polearms - { - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(polearm magic): " + itemWidth + " x " + itemHeight); - holdType = HoldType.Spear; - } - else - { //largestaves are held straight up - //| - //| #### - //| ############ ## - //| ## ## ## - //| ############ ## - //| #### - //| - //| - if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(staff): " + itemWidth + " x " + itemHeight); - //staves - holdType = HoldType.Staff; - } - } - } - } - #endregion - - // Get any custom hold if no override was set - foreach (var drawMethod in WeaponOut.mod.weaponOutCustomHoldMethods) - { - holdType = setHoldTypeSafeWrapping(drawMethod(drawPlayer, heldItem, (int)holdType)); - } - } - - - // can't see non-backed while grappling - if (holdTypeHideOnBack[(int)holdType] && drawPlayer.grapCount > 0) return; - // Only draw back items when it is a back item hold type + if (heldItem.useStyle == 1 || //swing + heldItem.useStyle == 2 || //eat + heldItem.useStyle == 3) //stab + { + //| ###### + //| ## ## + //| ########## + //| ## ## + //| ## ## + //| ## ## + //| ## ## + //| ## + //Items, daggers and other throwables lie below 28 and are easily held in the hand + if ((larger < 28 && !heldItem.magic) || //nonmagic weapons + (larger <= 32 && heldItem.shoot != 0) || //larger for throwing weapons + (larger <= 24 && heldItem.magic)) //only smallest magic weapons + { + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(hand): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Hand; + } + //| #### + //| ## ## + //| ## ## + //| ## ## + //| #### ## + //| ## ## + //| ## #### + //| #### + //Broadsword weapons are swing type weapons between 28 - 48 + //They are worn on the waist, and react to falling! Except when disabled + //This also amusingly applies to ducks, axes and rockfish + //But shouldn't apply to pickaxes, except when they are also not pickaxes + else if (larger <= 48 && + (heldItem.pick <= 0 || + (heldItem.pick > 0 && heldItem.axe > 0))) + { + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(waist): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Waist; + } + //| ######## + //| ## ## + //| ## #### + //| ## ## ## + //| #### ## + //| ## #### + //| ## ######## + //| ###### + //Great weapons are swing type weapons past 36 in size and slung on the back + else + { + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(back): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Back; + } + } + + if (heldItem.useStyle == 4 || //hold up + heldItem.useStyle == 5) //hold out + { + bool isAStaff = Item.staff[heldItem.type]; + //staves, guns and bows + if (gHeight >= gWidth * 1.2f && !isAStaff) + { + //| ###### + //| ## ###### + //| ## ## ## + //| ## ## ## + //| ## ## ## + //| ## ## ## + //| ## ###### + //| ###### + //bows + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(bow): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Bow; + } + else if (gWidth >= gHeight * 1.2f && !isAStaff) + { + if (heldItem.noUseGraphic && heldItem.melee) + { + //| + //| #### + //| ## ########## + //| #### ## #### + //| ## ## ## #### + //| ## ## ###### + //| ############ + //| + //drills, chainsaws + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(drill): " + itemWidth + " x " + itemHeight); + holdType = HoldType.PowerTool; + } + else + { + if (larger < 45) + { + //| #### #### + //| ## ######## ## + //| #### ## + //| ## ######## + //| ## ## ## + //| ## #### + //| ###### + //| + if (drawPlayer.grapCount > 0) return; // can't see while grappling + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(pistol): " + itemWidth + " x " + itemHeight); + //small aimed weapons (like handgun/aquasceptre) held halfway down, 1/3 back + holdType = HoldType.SmallGun; + } + else + { + //| + //| ## + //| ###################### + //| ## ## ## ## + //| ## ############ + //| #### ## ## + //| #### ## + //| + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(rifle): " + itemWidth + " x " + itemHeight); + //large guns (rifles, launchers, etc.) held with both hands + holdType = HoldType.LargeGun; + } + } + } + else + { + if (heldItem.noUseGraphic && !isAStaff) + { + if (!heldItem.autoReuse) + { + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(polearm): " + itemWidth + " x " + itemHeight); + if (isYoyo) + { + //sam (?why did i write sam? maybe same?) + data = WeaponDrawInfo.modDraw_HandWeapon(data, drawPlayer, larger, lesser, isYoyo); + } + else + { + //| #### + //| #### ## + //| ## ## + //| ## ## + //| ## ## + //| ## + //| ## + //| ## + //spears are held facing to the floor, maces generally held + holdType = HoldType.Spear; + } + } + else + { + //nebula blaze, flairon, solar eruption (too inconsistent) + if (larger <= 48) + { + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(waist safe): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Waist; + } + else + { + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(back safe): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Back; + } + } + } + else + { + if (larger + lesser <= 72) //only smallest magic weapons + { + //| ###### + //| ## ## ## + //| ## ## ## + //| ## ###### + //| ## ## ## + //| ## ## ## + //| ## ## ## + //| ###### + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(hand magic): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Hand; + } + else if (lesser <= 42) //medium sized magic weapons, treated like polearms + { + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(polearm magic): " + itemWidth + " x " + itemHeight); + holdType = HoldType.Spear; + } + else + { //largestaves are held straight up + //| + //| #### + //| ############ ## + //| ## ## ## + //| ############ ## + //| #### + //| + //| + if (DEBUG_WEAPONHOLD && drawPlayer.controlHook) Main.NewText(heldItem.useStyle + "(staff): " + itemWidth + " x " + itemHeight); + //staves + holdType = HoldType.Staff; + } + } + } + } + #endregion + + // Get any custom hold if no override was set + foreach (var drawMethod in WeaponOut.mod.weaponOutCustomHoldMethods) + { + holdType = setHoldTypeSafeWrapping(drawMethod(drawPlayer, heldItem, (int)holdType)); + } + } + + + // can't see non-backed while grappling + if (holdTypeHideOnBack[(int)holdType] && drawPlayer.grapCount > 0) return; + // Only draw back items when it is a back item hold type if (holdTypeHideOnBack[(int)holdType] == drawOnBack) return; switch (holdType) { @@ -555,24 +555,24 @@ private static void PickItemDrawType(bool drawOnBack, Player drawPlayer, Item he case HoldType.LargeGun: data = WeaponDrawInfo.modDraw_HeavyWeapon(data, drawPlayer, lesser); break; case HoldType.Staff: data = WeaponDrawInfo.modDraw_MagicWeapon(data, drawPlayer, larger); break; default: return; - } - - + } + + // Run custom draws - bool allowDraw = true; - foreach (var drawMethod in WeaponOut.mod.weaponOutCustomPreDrawMethods) - { - if (!drawMethod(drawPlayer, heldItem, data)) - { allowDraw = false; } + bool allowDraw = true; + foreach (var drawMethod in WeaponOut.mod.weaponOutCustomPreDrawMethods) + { + if (!drawMethod(drawPlayer, heldItem, data)) + { allowDraw = false; } } // Attempt standard draw if allowed - if (allowDraw) - { - //Add the weapon to the draw layers - Main.playerDrawData.Add(data); - WeaponDrawInfo.drawGlowLayer(data, drawPlayer, heldItem); + if (allowDraw) + { + //Add the weapon to the draw layers + Main.playerDrawData.Add(data); + WeaponDrawInfo.drawGlowLayer(data, drawPlayer, heldItem); } } diff --git a/ProjFX.cs b/ProjFX.cs index a2d42d2..4d6f630 100644 --- a/ProjFX.cs +++ b/ProjFX.cs @@ -19,7 +19,7 @@ public override bool PreAI(Projectile projectile) { if (!player.active) continue; - PlayerFX pFX = player.GetModPlayer(mod); + PlayerFX pFX = player.GetModPlayer(); if (!pFX.CanReflectProjectiles) continue; Player pOwner = Main.player[projectile.owner]; @@ -28,7 +28,7 @@ public override bool PreAI(Projectile projectile) projectile.hostile && (projectile.owner == Main.myPlayer || projectile.owner == 255); // 255 is npc owner on servers bool isUnfriendlyPlayer = projectile.friendly && !PlayerFX.SameTeam( - player, pOwner); + player, pOwner); if (projectile.damage > 0 && (isHostile || isUnfriendlyPlayer)) { @@ -165,7 +165,7 @@ private void LunarAccessoryVisuals(Projectile projectile) if (projectile.npcProj || projectile.hostile) return; if (projectile.position == projectile.oldPosition) return; - PlayerFX p = Main.player[projectile.owner].GetModPlayer(mod); + PlayerFX p = Main.player[projectile.owner].GetModPlayer(); if (p.lunarMagicVisual && projectile.magic) { Dust d = Main.dust[Dust.NewDust( diff --git a/Projectiles/BuddyPortalEntrance.cs b/Projectiles/BuddyPortalEntrance.cs index 48f6b0d..92a028b 100644 --- a/Projectiles/BuddyPortalEntrance.cs +++ b/Projectiles/BuddyPortalEntrance.cs @@ -53,7 +53,7 @@ public override void AI() { if (p.active && projectile.owner == p.owner) { - if (p.type == mod.ProjectileType()) + if (p.type == ModContent.ProjectileType()) { Vector2 newPosition = p.Center - new Vector2(Main.LocalPlayer.width, Main.LocalPlayer.height) / 2; Main.LocalPlayer.Teleport(newPosition, 3); @@ -115,7 +115,7 @@ public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Main.player[Main.myPlayer].noThrow = 2; Main.player[Main.myPlayer].showItemIcon = true; - Main.player[Main.myPlayer].showItemIcon2 = mod.ItemType(); + Main.player[Main.myPlayer].showItemIcon2 = ModContent.ItemType(); if (PlayerInput.UsingGamepad) { Main.player[Main.myPlayer].GamepadEnableGrappleCooldown(); diff --git a/Projectiles/Explosion.cs b/Projectiles/Explosion.cs index fc883eb..a695067 100644 --- a/Projectiles/Explosion.cs +++ b/Projectiles/Explosion.cs @@ -198,7 +198,7 @@ private void SpawnExplosionAndFade(bool weaken) if (projectile.owner == Main.myPlayer) { Projectile.NewProjectile(projectile.Center, projectile.velocity, - mod.ProjectileType(), + ModContent.ProjectileType(), CalculateDamage(weaken), projectile.knockBack, projectile.owner, diff --git a/Projectiles/MeteorBreakshot.cs b/Projectiles/MeteorBreakshot.cs index acf1d67..24a4763 100644 --- a/Projectiles/MeteorBreakshot.cs +++ b/Projectiles/MeteorBreakshot.cs @@ -106,7 +106,7 @@ private void generateScatter(Vector2 position, Vector2 velocity) Projectile.NewProjectile( position, velocity * 0.25f + Inaccuracy(3f), - mod.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); + ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); } } private Vector2 calculateDirectionFactor(Vector2 velocity, Vector2 oldVelocity) diff --git a/Projectiles/SpiritWindstream.cs b/Projectiles/SpiritWindstream.cs index 08168d0..de2acc2 100644 --- a/Projectiles/SpiritWindstream.cs +++ b/Projectiles/SpiritWindstream.cs @@ -18,7 +18,7 @@ public override void SetStaticDefaults() DisplayName.SetDefault("Chilly Slipstream"); DisplayName.AddTranslation(GameCulture.Chinese, "寒冰气流"); DisplayName.AddTranslation(GameCulture.Russian, "Холодный След"); - buffID = mod.BuffType(); + buffID = ModContent.BuffType(); } public override void SetDefaults() { diff --git a/Tiles/CampTent.cs b/Tiles/CampTent.cs index 7edc23f..4986d8f 100644 --- a/Tiles/CampTent.cs +++ b/Tiles/CampTent.cs @@ -14,62 +14,62 @@ public class CampTent : ModTile const int _FRAMEWIDTH = 5; const int _FRAMEHEIGHT = 3; - public override void SetDefaults() + public override void SetDefaults() { ModTranslation name = CreateMapEntryName(); name.SetDefault("Camping Tent"); name.AddTranslation(GameCulture.Chinese, "野营帐篷"); - AddMapEntry(new Color(90, 190, 20), name); + AddMapEntry(new Color(90, 190, 20), name); TileID.Sets.HasOutlines[Type] = true; //extra info Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; dustType = 93; - disableSmartCursor = true; + disableSmartCursor = true; adjTiles = new int[] { TileID.Beds }; bed = true; //style is set up like a bed - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - //strangely enough this means styles are read VERTICALLY + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + //strangely enough this means styles are read VERTICALLY TileObjectData.newTile.StyleHorizontal = true; //width in blocks, and define required ground anchor TileObjectData.newTile.Width = _FRAMEWIDTH; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - - //height, and coordinates of each row + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + + //height, and coordinates of each row TileObjectData.newTile.Height = _FRAMEHEIGHT; - TileObjectData.newTile.CoordinateHeights = new int[] - { + TileObjectData.newTile.CoordinateHeights = new int[] + { 16, 16, - 16 + 16 }; //placement centre and offset on ground TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.DrawYOffset = 2; - - //add left and right versions + TileObjectData.newTile.DrawYOffset = 2; + + //add left and right versions TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + } public override void KillMultiTile(int i, int j, int frameX, int frameY) { if (ModConf.EnableBasicContent) - { + { int type = GetItemTypeFromStyle(frameY); - if (type > 0) + if (type > 0) { Item.NewItem(i * 16, j * 16, 80, 48, mod.ItemType("CampTent")); } } } - public override bool HasSmartInteract() + public override bool HasSmartInteract() { return true; } public override void RightClick(int i, int j) @@ -84,13 +84,13 @@ public override void RightClick(int i, int j) if (frameX > 90) spawnX += 5; // mirror facing offset for alternate //Dust.NewDust(new Vector2((float)(spawnX * 16), (float)(spawnY * 16)), 16, 16, 6, 0f, 0f, 0, default(Color), 4f); - PlayerFX modPlayer = player.GetModPlayer(mod); - if (modPlayer.localTempSpawn != new Vector2(spawnX, spawnY)) + PlayerFX modPlayer = player.GetModPlayer(); + if (modPlayer.localTempSpawn != new Vector2(spawnX, spawnY)) { Main.NewText("Temporary spawn point set!", 255, 240, 20, false); - modPlayer.localTempSpawn = new Vector2(spawnX, spawnY); - } - else + modPlayer.localTempSpawn = new Vector2(spawnX, spawnY); + } + else { if (player.SpawnX == -1 && player.SpawnY == -1) { @@ -100,7 +100,7 @@ public override void RightClick(int i, int j) { Main.NewText("Spawn point set to bed!", 255, 240, 20, false); } - modPlayer.localTempSpawn = new Vector2(); + modPlayer.localTempSpawn = new Vector2(); } } @@ -111,27 +111,27 @@ public override void MouseOver(int i, int j) player.noThrow = 2; if (ModConf.EnableBasicContent) { - player.showItemIcon = true; + player.showItemIcon = true; int type = GetItemTypeFromStyle(Main.tile[i, j].frameY); player.showItemIcon2 = type; } - } - - private int GetItemTypeFromStyle(int frameY) - { - int style = frameY / (18 * _FRAMEHEIGHT); - int type = 0; - switch (style) - { - case 0: - type = mod.ItemType("CampTent"); - break; - case 1: - type = mod.ItemType("CampTentMakeshift"); - break; - } - - return type; - } + } + + private int GetItemTypeFromStyle(int frameY) + { + int style = frameY / (18 * _FRAMEHEIGHT); + int type = 0; + switch (style) + { + case 0: + type = mod.ItemType("CampTent"); + break; + case 1: + type = mod.ItemType("CampTentMakeshift"); + break; + } + + return type; + } } } \ No newline at end of file diff --git a/WeaponDrawInfo.cs b/WeaponDrawInfo.cs index 1014d7c..2d6a2d5 100644 --- a/WeaponDrawInfo.cs +++ b/WeaponDrawInfo.cs @@ -111,7 +111,7 @@ internal static DrawData modDraw_HandWeapon(DrawData data, Player p, float lengt internal static DrawData modDraw_WaistWeapon(DrawData data, Player p, float length) { float maxFall = 2f; - if (!ModConf.toggleWaistRotation) + if (!ModConf.ToggleWaistRotation) { maxFall = p.velocity.Y * p.gravDir; if (p.velocity.Y == 0) maxFall = p.velocity.X * p.direction; diff --git a/WeaponOut.cs b/WeaponOut.cs index 8fb5d9d..8302b1a 100644 --- a/WeaponOut.cs +++ b/WeaponOut.cs @@ -11,8 +11,8 @@ using Terraria.ModLoader; using Terraria.Graphics; using Terraria.Localization; -using Terraria.DataStructures; - +using Terraria.DataStructures; + /* RARITY: * 1 - Special/Unique early armour + weapons @@ -25,21 +25,21 @@ * 8 - Golem Loot, the Terrarian * 9 - Lunar materials, dev loot * 10 - Ancient Manipulator + Moonlord - */ - + */ + namespace WeaponOut { public class WeaponOut : Mod { internal static WeaponOut mod; - internal static Mod modOverhaul; - - /// - /// Holds a list of custom draw functions that can be added to by other mods. + internal static Mod modOverhaul; + + /// + /// Holds a list of custom draw functions that can be added to by other mods. /// internal List> weaponOutCustomPreDrawMethods; internal List> weaponOutCustomHoldMethods; - + public static Texture2D dHeart; public static Texture2D pumpkinMark; @@ -64,11 +64,11 @@ public WeaponOut() { }; weaponOutCustomPreDrawMethods = new List>(); weaponOutCustomHoldMethods = new List>(); - } - - public override void PreSaveAndQuit() - { - ModConfWeaponOutCustom.SaveConfig(); + } + + public override void PreSaveAndQuit() + { + ModConfWeaponOutCustom.SaveConfig(); } public override void Load() { @@ -140,15 +140,15 @@ public override void Load() { text.AddTranslation(GameCulture.Russian, "Посох"); mod.AddTranslation(text); - ControlToggleVisual = RegisterHotKey(GetTranslationTextValue("WOVisualControl"), "#"); + ControlToggleVisual = RegisterHotKey(GetTranslationTextValue("WOVisualControl"), "#"); } - public override void Unload() - { - mod = null; - modOverhaul = null; - weaponOutCustomPreDrawMethods.Clear(); - weaponOutCustomHoldMethods.Clear(); + public override void Unload() + { + mod = null; + modOverhaul = null; + weaponOutCustomPreDrawMethods.Clear(); + weaponOutCustomHoldMethods.Clear(); } @@ -156,14 +156,14 @@ internal static string GetTranslationTextValue(string key) { return Language.GetText("Mods.WeaponOut." + key).Value; } - public override void PostSetupContent() { + public override void PostSetupContent() { ModConf.Load(); if (ModConf.ShowWeaponOut) ModConfWeaponOutCustom.Load(); if (ModConf.EnableAccessories) BuffIDMirrorBarrier = GetBuff("MirrorBarrier").Type; if (ModConf.EnableDualWeapons) BuffIDManaReduction = GetBuff("ManaReduction").Type; - DustIDManaDust = GetDust().Type; - DustIDSlashFX = GetDust().Type; + DustIDManaDust = ModContent.GetInstance().Type; + DustIDSlashFX = ModContent.GetInstance().Type; if (ModConf.EnableEmblems) Items.Accessories.HeliosphereEmblem.SetUpGlobalDPS(); @@ -175,9 +175,9 @@ public override void PostSetupContent() { } else { Console.WriteLine("WeaponOut loaded: qol#01"); - } - } - + } + } + /// /// Registers a glowmask texture to the game's array, and returns that value. /// The file should be located under Glow/ItemName_Glow. Make sure to register @@ -232,10 +232,10 @@ public override void PostDrawInterface(SpriteBatch spriteBatch) { } private void DrawPumpkinMark(SpriteBatch spriteBatch) { - if (!ModConf.enableFists) return; + if (!ModConf.EnableFists) return; if (Main.gameMenu) return; - int buffID = BuffType(); + int buffID = ModContent.BuffType(); Dictionary drawPositions = new Dictionary(); foreach (NPC i in Main.npc) { if (!i.active || i.life <= 0) continue; @@ -282,7 +282,7 @@ private void DrawPumpkinMark(SpriteBatch spriteBatch) { } private void DrawInterfaceDemonBloodHeart(SpriteBatch spriteBatch) { - if (!ModConf.enableFists) return; + if (!ModConf.EnableFists) return; Player p = Main.LocalPlayer; PlayerFX pfx = p.GetModPlayer(); if (pfx.demonBloodRally <= 0) return; @@ -350,29 +350,29 @@ private void DrawInterfaceWeaponOutToggleEye(SpriteBatch spriteBatch) { //if (Disabled) return; // Janky quick inventory visibilty - if (!Main.playerInventory || !ModConf.showWeaponOut || ModConf.forceShowWeaponOut) return; + if (!Main.playerInventory || !ModConf.ShowWeaponOut || ModConf.ForceShowWeaponOut) return; //Get vars - PlayerWOFX pfx = Main.LocalPlayer.GetModPlayer(this); + PlayerWOFX pfx = Main.LocalPlayer.GetModPlayer(); Texture2D eye = Main.inventoryTickOnTexture; string hoverText = GetTranslationTextValue("WOVisualShow"); // Visible - Vector2 position = new Vector2(20, 10); - - // Display custom styling - int style; - if (ModConfWeaponOutCustom.TryGetCustomHoldStyle(Main.LocalPlayer.HeldItem.type, out style)) - { - switch (style) - { - case 1: hoverText += ": " + GetTranslationTextValue("WOVisualTypeHand"); break; - case 2: hoverText += ": " + GetTranslationTextValue("WOVisualTypeWaist"); break; - case 3: hoverText += ": " + GetTranslationTextValue("WOVisualTypeBack"); break; - case 4: hoverText += ": " + GetTranslationTextValue("WOVisualTypeSpear"); break; - case 5: hoverText += ": " + GetTranslationTextValue("WOVisualTypePowerTool"); break; - case 6: hoverText += ": " + GetTranslationTextValue("WOVisualTypeBow"); break; - case 7: hoverText += ": " + GetTranslationTextValue("WOVisualTypeSmallGun"); break; - case 8: hoverText += ": " + GetTranslationTextValue("WOVisualTypeLargeGun"); break; - case 9: hoverText += ": " + GetTranslationTextValue("WOVisualTypeStaff"); break; - } + Vector2 position = new Vector2(20, 10); + + // Display custom styling + int style; + if (ModConfWeaponOutCustom.TryGetCustomHoldStyle(Main.LocalPlayer.HeldItem.type, out style)) + { + switch (style) + { + case 1: hoverText += ": " + GetTranslationTextValue("WOVisualTypeHand"); break; + case 2: hoverText += ": " + GetTranslationTextValue("WOVisualTypeWaist"); break; + case 3: hoverText += ": " + GetTranslationTextValue("WOVisualTypeBack"); break; + case 4: hoverText += ": " + GetTranslationTextValue("WOVisualTypeSpear"); break; + case 5: hoverText += ": " + GetTranslationTextValue("WOVisualTypePowerTool"); break; + case 6: hoverText += ": " + GetTranslationTextValue("WOVisualTypeBow"); break; + case 7: hoverText += ": " + GetTranslationTextValue("WOVisualTypeSmallGun"); break; + case 8: hoverText += ": " + GetTranslationTextValue("WOVisualTypeLargeGun"); break; + case 9: hoverText += ": " + GetTranslationTextValue("WOVisualTypeStaff"); break; + } } // Show hidden instead @@ -393,20 +393,20 @@ private void DrawInterfaceWeaponOutToggleEye(SpriteBatch spriteBatch) { // On plain click if (!Main.mouseRight && Main.mouseLeft && Main.mouseLeftRelease) { ToggleWeaponVisual(pfx, !pfx.weaponVisual); - } - if (pfx.weaponVisual) - { - // On alt click - if (Main.mouseRight && Main.mouseRightRelease) - { - ModConfWeaponOutCustom.UpdateCustomHoldIncrement(Main.LocalPlayer.HeldItem, 1); - } - - // On click during alt - if (Main.mouseRight && Main.mouseLeft && Main.mouseLeftRelease) - { - ModConfWeaponOutCustom.UpdateCustomHoldIncrement(Main.LocalPlayer.HeldItem, -1); - } + } + if (pfx.weaponVisual) + { + // On alt click + if (Main.mouseRight && Main.mouseRightRelease) + { + ModConfWeaponOutCustom.UpdateCustomHoldIncrement(Main.LocalPlayer.HeldItem, 1); + } + + // On click during alt + if (Main.mouseRight && Main.mouseLeft && Main.mouseLeftRelease) + { + ModConfWeaponOutCustom.UpdateCustomHoldIncrement(Main.LocalPlayer.HeldItem, -1); + } } } @@ -519,7 +519,7 @@ private void HandlePacketParry(BinaryReader reader, int code, int sender) { //-/ Console.WriteLine("received parry from " + sender); } else { - ModPlayerFists pfx = Main.player[sender].GetModPlayer(this); + ModPlayerFists pfx = Main.player[sender].GetModPlayer(); pfx.AltFunctionParryMax(Main.player[sender], parryWindow, parryTimeMax); //-/ Main.NewText("received parry from " + sender); } @@ -546,7 +546,7 @@ private void HandlePacketCombo(BinaryReader reader, int code, int sender) { //-/ Console.WriteLine("echo combo " + comboEffect + " from " + sender); } else { - ModPlayerFists pfx = Main.player[sender].GetModPlayer(this); + ModPlayerFists pfx = Main.player[sender].GetModPlayer(); pfx.player.itemAnimation = 0; pfx.AltFunctionCombo(Main.player[sender], comboEffect, true); //-/ Main.NewText("received combo " + comboEffect + " from " + sender); @@ -572,23 +572,23 @@ private void HandlePacketWeaponVisual(BinaryReader reader, int code, int sender) me.Send(-1, sender); } else { - PlayerWOFX pfx = Main.player[sender].GetModPlayer(this); + PlayerWOFX pfx = Main.player[sender].GetModPlayer(); pfx.weaponVisual = weaponVis; } } #endregion - public override void PostUpdateInput() + public override void PostUpdateInput() { if (Main.gameMenu || ControlToggleVisual == null || ModConf.ForceShowWeaponOut) return; - if (ControlToggleVisual.JustPressed) + if (ControlToggleVisual.JustPressed) { - PlayerWOFX pfx = Main.LocalPlayer.GetModPlayer(this); + PlayerWOFX pfx = Main.LocalPlayer.GetModPlayer(); ToggleWeaponVisual(pfx, !pfx.weaponVisual); } } - internal static Vector2 CalculateNormalAngle(Vector2 start, Vector2 end) + internal static Vector2 CalculateNormalAngle(Vector2 start, Vector2 end) { Vector2 diff = end - start; diff.Normalize(); @@ -596,32 +596,32 @@ internal static Vector2 CalculateNormalAngle(Vector2 start, Vector2 end) } #region Mod Calls - /// - /// "SetPlayerWeaponVisual", Player player, boolean show - /// "SetFrenzyHeart", Player player, boolean state - /// "AddCustomPreDrawMethod", Func(Player, Item, DrawData, returns bool show) customMethod - /// "AddCustomHoldMethod", Func(Player, Item, int holdType, returns int holdType) customMethod - /// - /// + /// + /// "SetPlayerWeaponVisual", Player player, boolean show + /// "SetFrenzyHeart", Player player, boolean state + /// "AddCustomPreDrawMethod", Func(Player, Item, DrawData, returns bool show) customMethod + /// "AddCustomHoldMethod", Func(Player, Item, int holdType, returns int holdType) customMethod + /// + /// /// public override object Call(params object[] args) { if (args.Length < 1) return null; if (args[0].GetType() != typeof(string)) return null; string method = (string)args[0]; - try + try { - switch (method) + switch (method) { case "SetPlayerWeaponVisual": CallShowWeapon((Player)args[1], (bool)args[2]); - break; + break; case "SetFrenzyHeart": SetFrenzyHeart((Player)args[1], (bool)args[2]); - break; - + break; + case "AddCustomPreDrawMethod": AddCustomPreDrawMethod(args[1] as Func); - break; + break; case "AddCustomHoldMethod": AddCustomHoldMethod(args[1] as Func); break; @@ -629,52 +629,52 @@ public override object Call(params object[] args) { } catch { } return null; - } - + } + private void CallShowWeapon(Player p, bool show) { - ToggleWeaponVisual(p.GetModPlayer(this), show); + ToggleWeaponVisual(p.GetModPlayer(), show); } private void SetFrenzyHeart(Player p, bool state) { - p.GetModPlayer().demonBlood = true; + p.GetModPlayer().demonBlood = true; } - /// - /// Add a custom draw method to WeaponOut held item rendering. WeaponOut provides the following: - /// Player = The player the item is being drawn for. - /// Item = The item to be drawn. - /// DrawData = The calculated DrawData just before being added to Main.playerDrawData. - /// Returns bool = True to allow drawing of the item for the player. - /// + /// + /// Add a custom draw method to WeaponOut held item rendering. WeaponOut provides the following: + /// Player = The player the item is being drawn for. + /// Item = The item to be drawn. + /// DrawData = The calculated DrawData just before being added to Main.playerDrawData. + /// Returns bool = True to allow drawing of the item for the player. + /// + /// + public void AddCustomPreDrawMethod(Func customDrawMethod) + { + weaponOutCustomPreDrawMethods.Add(customDrawMethod); + } + /// + /// Use this to override the 'Auto' hold position for the item. + /// [1: Hand] + /// [2: Waist, drawn behind] + /// [3: Back, drawn behind] + /// [4: Spear] + /// [5: PowerTool] + /// [6: Bow] + /// [7: SmallGun] + /// [8: LargeGun] + /// [9: Staff] + /// /// - public void AddCustomPreDrawMethod(Func customDrawMethod) - { - weaponOutCustomPreDrawMethods.Add(customDrawMethod); - } - /// - /// Use this to override the 'Auto' hold position for the item. - /// [1: Hand] - /// [2: Waist, drawn behind] - /// [3: Back, drawn behind] - /// [4: Spear] - /// [5: PowerTool] - /// [6: Bow] - /// [7: SmallGun] - /// [8: LargeGun] - /// [9: Staff] - /// - /// - public void AddCustomHoldMethod(Func customDrawMethod) - { - weaponOutCustomHoldMethods.Add(customDrawMethod); - } - - private Func WOPreDrawData = _HideCustomPreDrawMethod; - private static bool _HideCustomPreDrawMethod(Player p, Item i, DrawData dd) - { - // Hide the Nebula Blaze - if (i.type == ItemID.NebulaBlaze) return false; - return true; + public void AddCustomHoldMethod(Func customDrawMethod) + { + weaponOutCustomHoldMethods.Add(customDrawMethod); + } + + private Func WOPreDrawData = _HideCustomPreDrawMethod; + private static bool _HideCustomPreDrawMethod(Player p, Item i, DrawData dd) + { + // Hide the Nebula Blaze + if (i.type == ItemID.NebulaBlaze) return false; + return true; } #endregion diff --git a/WeaponOut.csproj b/WeaponOut.csproj index 3f0e1e3..d9996e8 100644 --- a/WeaponOut.csproj +++ b/WeaponOut.csproj @@ -1,435 +1,13 @@ - - - + + + - Debug - AnyCPU - {4E3DFB86-01BB-4397-B63C-D5ABE1E5597C} - Exe - Properties - WeaponOut WeaponOut - v4.5 - 512 + net452 + x86 + latest - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\dllReferences\ItemCustomizer.dll - - - - - - - - ..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\terraria\tModLoader.exe - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + \ No newline at end of file