118 lines
3.5 KiB
C#
118 lines
3.5 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
|
|
namespace Emiliasmod.Content.Items.Accessories
|
|
{
|
|
public class Spacesuit : ModItem
|
|
{
|
|
|
|
public static readonly int DefenseBonus = 8;
|
|
|
|
//public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs();
|
|
|
|
public override void SetDefaults() {
|
|
Item.width = 40;
|
|
Item.height = 40;
|
|
Item.accessory = true;
|
|
Item.rare = ItemRarityID.Red;
|
|
Item.value = Item.sellPrice(platinum: 1, gold: 35);
|
|
}
|
|
|
|
public override void AddRecipes() {
|
|
Recipe recipe = CreateRecipe();
|
|
recipe.AddTile(TileID.LunarMonolith);
|
|
recipe.AddIngredient(ItemID.TerrasparkBoots, 1);
|
|
recipe.AddIngredient(ItemID.CelestialShell, 1);
|
|
recipe.AddIngredient(ItemID.ArcticDivingGear, 1);
|
|
recipe.AddIngredient(ItemID.CharmofMyths, 1);
|
|
recipe.AddIngredient(ItemID.AnkhShield, 1);
|
|
recipe.AddCondition(Condition.DownedMoonLord);
|
|
recipe.Register();
|
|
}
|
|
|
|
public override void UpdateAccessory(Player player, bool hideVisual) {
|
|
player.rocketBoots = 2;
|
|
player.vanityRocketBoots = 2;
|
|
|
|
player.waterWalk2 = true;
|
|
player.waterWalk = true;
|
|
player.iceSkate = true;
|
|
player.desertBoots = true;
|
|
player.fireWalk = true;
|
|
player.noFallDmg = true;
|
|
player.lavaRose = true;
|
|
//player.lavaMax += 20 * 60;
|
|
|
|
player.statDefense += DefenseBonus;
|
|
|
|
player.arcticDivingGear = true;
|
|
player.accMerman = true;
|
|
if (Main.dayTime == false)
|
|
{
|
|
player.wereWolf = true;
|
|
}
|
|
|
|
player.buffImmune[BuffID.BrokenArmor] = true;
|
|
player.buffImmune[BuffID.Bleeding] = true;
|
|
player.buffImmune[BuffID.Burning] = true;
|
|
player.buffImmune[BuffID.Chilled] = true;
|
|
player.buffImmune[BuffID.Confused] = true;
|
|
player.buffImmune[BuffID.Cursed] = true;
|
|
player.buffImmune[BuffID.Darkness] = true;
|
|
player.buffImmune[BuffID.Poisoned] = true;
|
|
player.buffImmune[BuffID.Silenced] = true;
|
|
player.buffImmune[BuffID.Slow] = true;
|
|
player.buffImmune[BuffID.Stoned] = true;
|
|
player.buffImmune[BuffID.Weak] = true;
|
|
player.noKnockback = true;
|
|
|
|
player.lifeRegen += 4;
|
|
player.PotionDelayModifier -= 0.25f;
|
|
|
|
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.moveSpeed += 0.08f;
|
|
|
|
if (!hideVisual) {
|
|
player.CancelAllBootRunVisualEffects();
|
|
}
|
|
//if (player.)
|
|
|
|
player.GetModPlayer<SpacesuitStatBonusAccessoryPlayer>().SpacesuitStatBonusAccessory = true;
|
|
}
|
|
|
|
}
|
|
|
|
// Some movement effects are not suitable to be modified in ModItem.UpdateAccessory due to how the math is done.
|
|
// ModPlayer.PostUpdateRunSpeeds is suitable for these modifications.
|
|
public class SpacesuitStatBonusAccessoryPlayer : ModPlayer
|
|
{
|
|
public bool SpacesuitStatBonusAccessory = false;
|
|
|
|
public override void ResetEffects() {
|
|
SpacesuitStatBonusAccessory = false;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
// The following modifications are similar to Shadow Armor set bonus
|
|
Player.runAcceleration *= 1.75f;
|
|
Player.maxRunSpeed *= 1.15f;
|
|
Player.accRunSpeed *= 6.75f;
|
|
Player.runSlowdown *= 1.75f;
|
|
}
|
|
}
|
|
}
|