MP-fixed Driftwood Bow & Sword.
This commit is contained in:
1 parent
2a390194a3
commit
d4c15b99a2
2 files changed
+31
-34
No files matched your search
@@ -9,6 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public class DriftwoodSword : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 14;
|
||||
@@ -24,24 +25,17 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Item.value = CalamityGlobalItem.RarityWhiteBuyPrice;
|
||||
Item.rare = ItemRarityID.White;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
bool surface = player.Center.Y < Main.worldSurface * 16.0;
|
||||
bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet));
|
||||
if (GetEffects)
|
||||
{
|
||||
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160);
|
||||
Item.useTime = 12;
|
||||
Item.useAnimation = 12;
|
||||
Item.knockBack = 5.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Item.useTime = 20;
|
||||
Item.useAnimation = 20;
|
||||
Item.knockBack = 4f;
|
||||
}
|
||||
if (IsPlayerInContactWithWater(player))
|
||||
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160);
|
||||
}
|
||||
|
||||
public override float UseSpeedMultiplier(Player player) => IsPlayerInContactWithWater(player) ? 1.66f : 1f;
|
||||
|
||||
public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback.Base += IsPlayerInContactWithWater(player) ? 1.5f : 0f;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
@@ -49,5 +43,11 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
AddTile(TileID.WorkBenches).
|
||||
Register();
|
||||
}
|
||||
|
||||
private static bool IsPlayerInContactWithWater(Player player)
|
||||
{
|
||||
bool surface = player.Center.Y < Main.worldSurface * 16.0;
|
||||
return (Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using CalamityMod.Items.Placeables.SunkenSea;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -10,6 +9,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public class DriftwoodBow : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 10;
|
||||
@@ -31,32 +31,23 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
|
||||
{
|
||||
bool surface = player.Center.Y < Main.worldSurface * 16.0;
|
||||
bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet));
|
||||
if (GetEffects)
|
||||
if (IsPlayerInContactWithWater(player))
|
||||
{
|
||||
velocity *= 1.3f;
|
||||
knockback += 1f;
|
||||
|
||||
for (int i = 0; i <= 18; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(position + velocity * 3, 160, velocity.RotatedByRandom(MathHelper.ToRadians(19f)) * Main.rand.NextFloat(0.8f, 3.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f));
|
||||
Dust dust = Dust.NewDustPerfect(position + velocity * 3f, 160, velocity.RotatedByRandom(MathHelper.ToRadians(19f)) * Main.rand.NextFloat(0.8f, 3.8f), Scale: Main.rand.NextFloat(1.2f, 1.6f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
Item.useTime = 23;
|
||||
Item.useAnimation = 23;
|
||||
Item.knockBack = 1f;
|
||||
Item.shootSpeed = 8.6f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Item.useTime = 28;
|
||||
Item.useAnimation = 28;
|
||||
Item.knockBack = 0f;
|
||||
Item.shootSpeed = 6.6f;
|
||||
}
|
||||
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override float UseSpeedMultiplier(Player player) => IsPlayerInContactWithWater(player) ? 1.2f : 1f;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
@@ -64,5 +55,11 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
AddTile(TileID.WorkBenches).
|
||||
Register();
|
||||
}
|
||||
|
||||
private static bool IsPlayerInContactWithWater(Player player)
|
||||
{
|
||||
bool surface = player.Center.Y < Main.worldSurface * 16.0;
|
||||
return (Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user