diff --git a/Assets/Textures/EmiliasWand.png b/Assets/Textures/EmiliasWand.png new file mode 100644 index 0000000..a14ec18 Binary files /dev/null and b/Assets/Textures/EmiliasWand.png differ diff --git a/Assets/Textures/EmiliasWandFull.png b/Assets/Textures/EmiliasWandFull.png new file mode 100644 index 0000000..f6acfe9 Binary files /dev/null and b/Assets/Textures/EmiliasWandFull.png differ diff --git a/Assets/Textures/EmiliasWandHorizontal.png b/Assets/Textures/EmiliasWandHorizontal.png new file mode 100644 index 0000000..1a63656 Binary files /dev/null and b/Assets/Textures/EmiliasWandHorizontal.png differ diff --git a/Assets/Textures/EmiliasWandNoCable.png b/Assets/Textures/EmiliasWandNoCable.png new file mode 100644 index 0000000..e9bc94f Binary files /dev/null and b/Assets/Textures/EmiliasWandNoCable.png differ diff --git a/Assets/Textures/EmiliasWandProjectile.png b/Assets/Textures/EmiliasWandProjectile.png new file mode 100644 index 0000000..779099a Binary files /dev/null and b/Assets/Textures/EmiliasWandProjectile.png differ diff --git a/Content/Items/Accessories/Spacesuit.cs b/Content/Items/Accessories/Spacesuit.cs index 9d2372d..29978d6 100644 --- a/Content/Items/Accessories/Spacesuit.cs +++ b/Content/Items/Accessories/Spacesuit.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,8 +34,8 @@ namespace Emiliasmod.Content.Items.Accessories } public override void UpdateAccessory(Player player, bool hideVisual) { - player.rocketBoots = 4; - player.vanityRocketBoots = 4; + player.rocketBoots = 2; + player.vanityRocketBoots = 2; player.waterWalk2 = true; player.waterWalk = true; @@ -43,13 +44,16 @@ namespace Emiliasmod.Content.Items.Accessories player.fireWalk = true; player.noFallDmg = true; player.lavaRose = true; - player.lavaMax += 20 * 60; + //player.lavaMax += 20 * 60; player.statDefense += DefenseBonus; player.arcticDivingGear = true; - //player.wereWolf = true; player.accMerman = true; + if (Main.dayTime == false) + { + player.wereWolf = true; + } player.buffImmune[BuffID.BrokenArmor] = true; player.buffImmune[BuffID.Bleeding] = true; @@ -68,16 +72,14 @@ namespace Emiliasmod.Content.Items.Accessories player.lifeRegen += 4; player.PotionDelayModifier -= 0.25f; - player.GetDamage(DamageClass.Generic) += 10f; - player.GetAttackSpeed(DamageClass.Generic) += 10f; + player.GetDamage(DamageClass.Generic) += 0.10f; + player.GetAttackSpeed(DamageClass.Generic) += 0.10f; player.GetCritChance(DamageClass.Generic) += 4f; player.GetKnockback(DamageClass.Summon) += 0.5f; player.blockRange += 1; player.pickSpeed -= 0.15f; - //player.accRunSpeed = 6.75f; - //player.runAcceleration = 1.25f; - player.moveSpeed += 0.25f; + player.moveSpeed += 0.08f; if (!hideVisual) { player.CancelAllBootRunVisualEffects(); @@ -101,12 +103,11 @@ namespace Emiliasmod.Content.Items.Accessories public override void PostUpdateRunSpeeds() { //// We only want our additional changes to apply if ExampleStatBonusAccessory is equipped and not on a mount. - //if (Player.mount.Active || !SpacesuitStatBonusAccessory) { - // return; - //} + if (Player.mount.Active || !SpacesuitStatBonusAccessory) { + return; + } // The following modifications are similar to Shadow Armor set bonus - //Player.canFloatInWater = true; Player.runAcceleration *= 1.75f; Player.maxRunSpeed *= 1.15f; Player.accRunSpeed *= 6.75f; diff --git a/Content/Items/Accessories/Spacesurf.cs b/Content/Items/Accessories/Spacesurf.cs index 52dac81..7c6cebe 100644 --- a/Content/Items/Accessories/Spacesurf.cs +++ b/Content/Items/Accessories/Spacesurf.cs @@ -13,31 +13,21 @@ namespace Emiliasmod.Content.Items.Accessories } public override void SetDefaults() { - Item.width = 22; - Item.height = 20; + Item.CloneDefaults(ItemID.LongRainbowTrailWings); + //Item.width = 22; + //Item.height = 20; Item.value = Item.sellPrice(platinum: 1, gold: 35); Item.rare = ItemRarityID.Red; Item.accessory = true; } - - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, - ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { - ascentWhenFalling = 1.2f; // Falling glide speed - ascentWhenRising = 0.4f; // Rising speed - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 3f; - constantAscend = 0.135f; - } - + public override void UpdateAccessory(Player player, bool hideVisual) { - player.wingTimeMax = 100000000; + player.wingTimeMax = 100000; player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.8f; - player.maxFallSpeed += 0.10f; - player.maxRunSpeed *= 1.75f; - player.wingAccRunSpeed += 0.75f; + //player.jumpSpeedBoost += 1.8f; } + public override void AddRecipes() { Recipe recipe = CreateRecipe(); recipe.AddCondition(Condition.DownedMoonLord); diff --git a/Content/Items/EmiliasWand.cs b/Content/Items/EmiliasWand.cs index efcce08..621978c 100644 --- a/Content/Items/EmiliasWand.cs +++ b/Content/Items/EmiliasWand.cs @@ -1,3 +1,4 @@ +using Emiliasmod.Content.Projectiles; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,23 +11,35 @@ namespace Emiliasmod.Content.Items // https://github.com/tModLoader/tModLoader/tree/stable/ExampleMod public class EmiliasWand : ModItem { + + public override void SetStaticDefaults() { + // As mentioned in the documentation, IsDrill and IsChainsaw automatically reduce useTime and useAnimation to 60% of what is set in SetDefaults and decrease tileBoost by 1, but only for vanilla items. + // We set it here despite it doing nothing because it is likely to be used by other mods to provide special effects to drill or chainsaw items globally. + ItemID.Sets.IsDrill[Type] = true; + } + // The Display Name and Tooltip of this item can be edited in the 'Localization/en-US_Mods.Emiliasmod.hjson' file. public override void SetDefaults() { Item.damage = 300; - Item.DamageType = DamageClass.Melee; Item.pick = 300; - Item.width = 40; - Item.height = 200; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.tileBoost = 5; + Item.width = 14; + Item.height = 64; + Item.useTime = 2; + Item.useAnimation = 15; + Item.crit = 36; Item.knockBack = 6; + Item.useStyle = ItemUseStyleID.Shoot; Item.value = Item.buyPrice(platinum: 1); Item.rare = ItemRarityID.Red; //Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.useTurn = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; // Adjusts how far away from the player to hold the projectile + Item.noMelee = true; // Turns off damage from the item itself, as we have a projectile + Item.noUseGraphic = true; // Stops the item from drawing in your hands, for the aforementioned reason + Item.channel = true; } public override void AddRecipes() diff --git a/Content/Items/EmiliasWand.png b/Content/Items/EmiliasWand.png index b54922e..a14ec18 100644 Binary files a/Content/Items/EmiliasWand.png and b/Content/Items/EmiliasWand.png differ diff --git a/Content/Projectiles/EmiliasWandProjectile.cs b/Content/Projectiles/EmiliasWandProjectile.cs new file mode 100644 index 0000000..eb68dfe --- /dev/null +++ b/Content/Projectiles/EmiliasWandProjectile.cs @@ -0,0 +1,92 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace Emiliasmod.Content.Projectiles +{ + public class EmiliasWandProjectile : ModProjectile + { + public override void SetStaticDefaults() { + // Prevents jitter when stepping up and down blocks and half blocks + ProjectileID.Sets.HeldProjDoesNotUsePlayerGfxOffY[Type] = true; + } + + public override void SetDefaults() { + Projectile.width = 14; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.ownerHitCheck = true; + Projectile.aiStyle = -1; // Replace with 20 if you do not want custom code + Projectile.hide = true; // Hides the projectile, so it will draw in the player's hand when we set the player's heldProj to this one. + } + + // This code is adapted and simplified from aiStyle 20 to use a different dust and more noises. If you want to use aiStyle 20, you do not need to do any of this. + // It should be noted that this projectile has no effect on mining and is mostly visual. + public override void AI() { + Player player = Main.player[Projectile.owner]; + + Projectile.timeLeft = 60; + + // Animation code could go here if the projectile was animated. + + // Plays a sound every 20 ticks. In aiStyle 20, soundDelay is set to 30 ticks. + if (Projectile.soundDelay <= 0) { + SoundEngine.PlaySound(SoundID.Item22, Projectile.Center); + Projectile.soundDelay = 20; + } + + Vector2 playerCenter = player.RotatedRelativePoint(player.MountedCenter); + if (Main.myPlayer == Projectile.owner) { + // This code must only be ran on the client of the projectile owner + if (player.channel) { + float holdoutDistance = player.HeldItem.shootSpeed * Projectile.scale; + // Calculate a normalized vector from player to mouse and multiply by holdoutDistance to determine resulting holdoutOffset + Vector2 holdoutOffset = holdoutDistance * Vector2.Normalize(Main.MouseWorld - playerCenter); + if (holdoutOffset.X != Projectile.velocity.X || holdoutOffset.Y != Projectile.velocity.Y) { + // This will sync the projectile, most importantly, the velocity. + Projectile.netUpdate = true; + } + + // Projectile.velocity acts as a holdoutOffset for held projectiles. + Projectile.velocity = holdoutOffset; + } + else { + Projectile.Kill(); + } + } + + if (Projectile.velocity.X > 0f) { + player.ChangeDir(1); + } + else if (Projectile.velocity.X < 0f) { + player.ChangeDir(-1); + } + + Projectile.spriteDirection = Projectile.direction; + player.ChangeDir(Projectile.direction); // Change the player's direction based on the projectile's own + player.heldProj = Projectile.whoAmI; // We tell the player that the drill is the held projectile, so it will draw in their hand + player.SetDummyItemTime(2); // Make sure the player's item time does not change while the projectile is out + Projectile.Center = playerCenter; // Centers the projectile on the player. Projectile.velocity will be added to this in later Terraria code causing the projectile to be held away from the player at a set distance. + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + // Gives the drill a slight jiggle + Projectile.velocity.X *= 1f + Main.rand.Next(-3, 4) * 0.01f; + Projectile.velocity.Y *= 1f + Main.rand.Next(-3, 4) * 0.01f; + + // Spawning dust + if (Main.rand.NextBool(10)) { + Dust dust = Dust.NewDustDirect(Projectile.position + Projectile.velocity * Main.rand.Next(6, 10) * 0.15f, Projectile.width, Projectile.height, DustID.Honey, 0f, 0f, 80, Color.White, 1f); + dust.position.X -= 4f; + dust.noGravity = true; + dust.velocity.X *= 0.5f; + dust.velocity.Y = -Main.rand.Next(3, 8) * 0.1f; + } + } + } +} diff --git a/Content/Projectiles/EmiliasWandProjectile.png b/Content/Projectiles/EmiliasWandProjectile.png new file mode 100644 index 0000000..9a5c3ae Binary files /dev/null and b/Content/Projectiles/EmiliasWandProjectile.png differ diff --git a/Localization/en-US_Mods.Emiliasmod.hjson b/Localization/en-US_Mods.Emiliasmod.hjson index 1283acd..f77f254 100644 --- a/Localization/en-US_Mods.Emiliasmod.hjson +++ b/Localization/en-US_Mods.Emiliasmod.hjson @@ -13,6 +13,8 @@ Items: { Spacesurf: { DisplayName: Spacesurf - Tooltip: "Surfing through the void" + Tooltip: Surfing through the void } } + +Projectiles.EmiliasWandProjectile.DisplayName: Emilias Wand Projectile