Merge branch '1.4' of https://github.com/CalamityTeam/CalamityMod into 1.4
No files matched your search
@@ -20,6 +20,7 @@ using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Balancing
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class BalancingChangesManager
|
||||
{
|
||||
internal static List<IBalancingRule[]> UniversalBalancingChanges = null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Terraria;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Potions
|
||||
@@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Potions
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Anechoic Coating");
|
||||
Description.SetDefault("Abyssal creatures' detection radius reduced");
|
||||
Description.SetDefault("Abyssal creatures' detection ranges reduced");
|
||||
Main.debuff[Type] = false;
|
||||
Main.pvpBuff[Type] = true;
|
||||
Main.buffNoSave[Type] = false;
|
||||
|
||||
@@ -3322,103 +3322,8 @@ namespace CalamityMod.CalPlayer
|
||||
#endregion
|
||||
|
||||
#region UpdateEquips
|
||||
public override void UpdateVisibleVanityAccessories()
|
||||
{
|
||||
for (int n = 13; n < 18 + Player.extraAccessorySlots; n++)
|
||||
{
|
||||
Item item = Player.armor[n];
|
||||
|
||||
if (item.type == ModContent.ItemType<Popo>())
|
||||
{
|
||||
snowmanHide = false;
|
||||
snowmanForce = true;
|
||||
}
|
||||
else if (item.type == ModContent.ItemType<AbyssalDivingSuit>())
|
||||
{
|
||||
abyssalDivingSuitHide = false;
|
||||
abyssalDivingSuitForce = true;
|
||||
}
|
||||
else if (item.type == ModContent.ItemType<AquaticHeart>())
|
||||
{
|
||||
aquaticHeartHide = false;
|
||||
aquaticHeartForce = true;
|
||||
}
|
||||
else if (item.type == ModContent.ItemType<ProfanedSoulCrystal>())
|
||||
{
|
||||
profanedCrystalHide = false;
|
||||
profanedCrystalForce = true;
|
||||
}
|
||||
|
||||
// Whichever is lowest in your vanity slots should take priority
|
||||
if (item.type == ModContent.ItemType<AbyssalDivingGear>())
|
||||
{
|
||||
featherCrownDraw = false;
|
||||
moonCrownDraw = false;
|
||||
abyssDivingGear = true;
|
||||
}
|
||||
if (item.type == ModContent.ItemType<FeatherCrown>())
|
||||
{
|
||||
abyssDivingGear = false;
|
||||
moonCrownDraw = false;
|
||||
featherCrownDraw = true;
|
||||
}
|
||||
if (item.type == ModContent.ItemType<MoonstoneCrown>())
|
||||
{
|
||||
abyssDivingGear = false;
|
||||
featherCrownDraw = false;
|
||||
moonCrownDraw = true;
|
||||
}
|
||||
|
||||
// Summon anime girl if it's in vanity slot as the pet is purely vanity
|
||||
// It's possible for other "pet" items like Fungal Clump or HotE to summon a passive version of their "pets" with some tweaks though
|
||||
if (item.type == ModContent.ItemType<DaawnlightSpiritOrigin>())
|
||||
{
|
||||
spiritOriginVanity = true;
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
if (Player.FindBuffIndex(ModContent.BuffType<ArcherofLunamoon>()) == -1)
|
||||
Player.AddBuff(ModContent.BuffType<ArcherofLunamoon>(), 18000, true);
|
||||
}
|
||||
}
|
||||
if (item.type == ModContent.ItemType<HowlsHeart>())
|
||||
{
|
||||
howlsHeartVanity = true;
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
var source = Player.GetSource_Accessory(item);
|
||||
if (Player.FindBuffIndex(ModContent.BuffType<HowlTrio>()) == -1)
|
||||
{
|
||||
Player.AddBuff(ModContent.BuffType<HowlTrio>(), 3600, true);
|
||||
}
|
||||
if (Player.ownedProjectileCounts[ModContent.ProjectileType<HowlsHeartHowl>()] < 1)
|
||||
{
|
||||
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(HowlsHeart.HowlDamage);
|
||||
int p = Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType<HowlsHeartHowl>(), damage, 1f, Player.whoAmI, 0f, 1f);
|
||||
if (Main.projectile.IndexInRange(p))
|
||||
Main.projectile[p].originalDamage = HowlsHeart.HowlDamage;
|
||||
}
|
||||
if (Player.ownedProjectileCounts[ModContent.ProjectileType<HowlsHeartCalcifer>()] < 1)
|
||||
{
|
||||
Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType<HowlsHeartCalcifer>(), 0, 0f, Player.whoAmI, 0f, 0f);
|
||||
}
|
||||
if (Player.ownedProjectileCounts[ModContent.ProjectileType<HowlsHeartTurnipHead>()] < 1)
|
||||
{
|
||||
Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType<HowlsHeartTurnipHead>(), 0, 0f, Player.whoAmI, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateEquips()
|
||||
{
|
||||
// Ankh Shield Mighty Wind immunity.
|
||||
for (int i = 0; i < 8 + Player.extraAccessorySlots; i++)
|
||||
{
|
||||
if (Player.armor[i].type == ItemID.AnkhShield)
|
||||
Player.buffImmune[BuffID.WindPushed] = true;
|
||||
}
|
||||
|
||||
// TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem
|
||||
CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText;
|
||||
|
||||
|
||||
@@ -89,6 +89,10 @@ namespace CalamityMod.CalPlayer
|
||||
copy = Main.RegisteredGameModes[GameModeID.Master];
|
||||
copy.DebuffTimeMultiplier = 1f;
|
||||
Main.RegisteredGameModes[GameModeID.Master] = copy;
|
||||
|
||||
// NOTE -- While this may seem at a glance to be redundant and nonsensical, the underlying setter for this property is what causes the game mode properties to
|
||||
// be refreshed and copied from RegisteredGameModes. Without this, the above behavior is not reflected ingame, as GameModeData is a value type, not a reference type.
|
||||
Main.GameMode = Main.GameMode;
|
||||
}
|
||||
|
||||
// Go through the old positions for the player.
|
||||
@@ -527,17 +531,6 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
private void MiscEffects()
|
||||
{
|
||||
// Do a vanity/social slot check for SCal's expert drop since alternatives to get this working are a pain in the ass to create.
|
||||
int blazingCursorItem = ModContent.ItemType<Calamity>();
|
||||
for (int i = 13; i < 18 + Player.extraAccessorySlots; i++)
|
||||
{
|
||||
if (Player.armor[i].type == blazingCursorItem)
|
||||
{
|
||||
blazingCursorVisuals = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate/reset DoG cart rotations based on whether the DoG cart is in use.
|
||||
if (Player.mount.Active && Player.mount.Type == ModContent.MountType<DoGCartMount>())
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace CalamityMod.CalPlayer.Dashes
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class PlayerDashManager
|
||||
{
|
||||
internal static Dictionary<string, PlayerDashEffect> DashIdentificationTable = new();
|
||||
|
||||
@@ -75,6 +75,7 @@ using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public class CalamityLists
|
||||
{
|
||||
public static IList<string> donatorList;
|
||||
|
||||
@@ -74,7 +74,9 @@ namespace CalamityMod
|
||||
{
|
||||
public class CalamityMod : Mod
|
||||
{
|
||||
// CONSIDER -- I have been advised by Jopo that Mods should never contain static variables
|
||||
// TODO -- A huge amount of random floating variables exist here.
|
||||
// These should all be moved to other files, whether that's CalamityLists or brand new ModSystems.
|
||||
// It is best to have a ton of small ModSystems.
|
||||
|
||||
// Boss Spawners
|
||||
public static int ghostKillCount = 0;
|
||||
@@ -117,8 +119,11 @@ namespace CalamityMod
|
||||
public static int[] holyEnemyImmunities = new int[4] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType<HolyFlames>(), ModContent.BuffType<Nightwither>() };
|
||||
|
||||
internal static CalamityMod Instance;
|
||||
|
||||
// TODO -- Mod references should be contained in a ModSystem (example name "ModLoadedChecker")
|
||||
internal Mod musicMod = null; // This is Calamity's official music mod, CalamityModMusic
|
||||
internal bool MusicAvailable => !(musicMod is null);
|
||||
|
||||
internal Mod ancientsAwakened = null;
|
||||
internal Mod bossChecklist = null;
|
||||
internal Mod census = null;
|
||||
@@ -144,7 +149,7 @@ namespace CalamityMod
|
||||
manaOriginal = TextureAssets.Mana;
|
||||
carpetOriginal = TextureAssets.FlyingCarpet;
|
||||
|
||||
// Apply IL edits instantly afterwards.
|
||||
// Apply IL edits as soon as possible.
|
||||
ILChanges.Load();
|
||||
|
||||
// If any of these mods aren't loaded, it will simply keep them as null.
|
||||
@@ -198,6 +203,7 @@ namespace CalamityMod
|
||||
|
||||
CooldownRegistry.Load();
|
||||
BossRushEvent.Load();
|
||||
// TODO -- As ModBossBarStyle is a ModType, its Load function does not need to be called directly here.
|
||||
BossHealthBarManager.Load(this);
|
||||
DraedonStructures.Load();
|
||||
EnchantmentManager.LoadAllEnchantments();
|
||||
@@ -219,6 +225,7 @@ namespace CalamityMod
|
||||
{
|
||||
AstralSky = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/AstralSky", AssetRequestMode.ImmediateLoad).Value;
|
||||
|
||||
// TODO -- Sky shaders should probably be loaded in a ModSystem
|
||||
Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh);
|
||||
SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky();
|
||||
|
||||
@@ -271,6 +278,8 @@ namespace CalamityMod
|
||||
ChargeMeterUI.Load();
|
||||
AstralArcanumUI.Load(this);
|
||||
|
||||
// TODO -- Is this not possible to place in ModNPC.Load or ModNPC.SetStaticDefaults ?
|
||||
// Centralizing head texture registration like this seems absurdly stiff
|
||||
Apollo.LoadHeadIcons();
|
||||
Artemis.LoadHeadIcons();
|
||||
DevourerofGodsHead.LoadHeadIcons();
|
||||
@@ -285,6 +294,8 @@ namespace CalamityMod
|
||||
ThanatosBody2.LoadHeadIcons();
|
||||
ThanatosTail.LoadHeadIcons();
|
||||
|
||||
// TODO -- Is this not possible to place in ModItem.Load or ModItem.SetStaticDefaults ?
|
||||
// Centralizing hair dye shaders like this seems absurdly stiff
|
||||
GameShaders.Hair.BindShader(ModContent.ItemType<AdrenalineHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax))));
|
||||
GameShaders.Hair.BindShader(ModContent.ItemType<RageHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax))));
|
||||
GameShaders.Hair.BindShader(ModContent.ItemType<WingTimeHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(139, 205, 255), ((float)player.wingTime / (float)player.wingTimeMax))));
|
||||
|
||||
@@ -6,6 +6,7 @@ using Terraria.ModLoader.Core;
|
||||
|
||||
namespace CalamityMod.Cooldowns
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public class CooldownRegistry
|
||||
{
|
||||
// Indexed by ushort netID. Contains every registered cooldown.
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace CalamityMod.DataStructures
|
||||
Phoenix, Aries, Polaris, Andromeda //Galaxia
|
||||
}
|
||||
|
||||
// TODO -- Attunements should be managed by an Attunement ModSystem
|
||||
public abstract class Attunement
|
||||
{
|
||||
public static Attunement[] attunementArray;
|
||||
|
||||
@@ -41,6 +41,7 @@ using CalamityMod.NPCs.AcidRain;
|
||||
|
||||
namespace CalamityMod
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static partial class NPCStats
|
||||
{
|
||||
private const double ExpertContactVanillaMultiplier = 2D;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Effects
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public class CalamityShaders
|
||||
{
|
||||
public static Effect AstralFogShader;
|
||||
|
||||
@@ -28,7 +28,7 @@ float4 CalculateDiffusion(float4 sampleColor : TEXCOORD, float2 coords : TEXCOOR
|
||||
// nextField[i, j] = currentField[i, j] + diffusionFactor * (totalCardinalState - currentField[i, j])
|
||||
// However, this would considerably restrict the freedom of the simulation, as any visocity values above 1 would result
|
||||
// in overshooting estimations and cause unstable behavior.
|
||||
// Instead of doing this instead of using the current state to calculate the next one, we attempt to solve for a state that when
|
||||
// Instead of using the current state to calculate the next one, we attempt to solve for a state that when
|
||||
// done in reverse returns the original state. Mathematically, this is written like so:
|
||||
|
||||
// currentField[i, j] = nextField[i, j] - diffusionFactor * (averageNextCardinalState - currentField[i, j])
|
||||
|
||||
@@ -39,6 +39,7 @@ using Terraria.DataStructures;
|
||||
|
||||
namespace CalamityMod.Events
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public class BossRushEvent
|
||||
{
|
||||
public enum TimeChangeContext
|
||||
|
||||
@@ -8,6 +8,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.ILEditing
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public partial class ILChanges
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -458,6 +458,9 @@ namespace CalamityMod.ILEditing
|
||||
if (projectile.minion)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
if (Main.gameMenu || !player.active)
|
||||
return proj;
|
||||
|
||||
CalamityPlayer.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem());
|
||||
if (player.Calamity().explosiveMinionsEnchant)
|
||||
projectile.Calamity().ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime;
|
||||
|
||||
@@ -69,6 +69,11 @@ namespace CalamityMod.Items.Accessories
|
||||
player.Calamity().abyssDivingGear = true;
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().abyssDivingGear = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -67,9 +67,13 @@ namespace CalamityMod.Items.Accessories
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.abyssalDivingSuit = true;
|
||||
if (hideVisual)
|
||||
{
|
||||
modPlayer.abyssalDivingSuitHide = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().abyssalDivingSuitHide = false;
|
||||
player.Calamity().abyssalDivingSuitForce = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -61,5 +61,11 @@ namespace CalamityMod.Items.Accessories
|
||||
if (hideVisual)
|
||||
modPlayer.aquaticHeartHide = true;
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().aquaticHeartHide = false;
|
||||
player.Calamity().aquaticHeartForce = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,8 @@ namespace CalamityMod.Items.Accessories
|
||||
Item.width = 26;
|
||||
Item.height = 26;
|
||||
Item.accessory = true;
|
||||
Item.value = CalamityGlobalItem.Rarity13BuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.PureGreen;
|
||||
Item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.Turquoise;
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@ namespace CalamityMod.Items.Accessories
|
||||
Item.accessory = true;
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
// Do a vanity/social slot check for SCal's expert drop since alternatives to get this working are a pain in the ass to create.
|
||||
player.Calamity().blazingCursorVisuals = true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
player.Calamity().blazingCursorDamage = true;
|
||||
|
||||
@@ -83,6 +83,18 @@ namespace CalamityMod.Items.Accessories
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
// Summon anime girl if it's in vanity slot as the pet is purely vanity
|
||||
// It's possible for other "pet" items like Fungal Clump or HotE to summon a passive version of their "pets" with some tweaks though
|
||||
player.Calamity().spiritOriginVanity = true;
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
if (player.FindBuffIndex(ModContent.BuffType<ArcherofLunamoon>()) == -1)
|
||||
player.AddBuff(ModContent.BuffType<ArcherofLunamoon>(), 18000, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -56,6 +56,11 @@ namespace CalamityMod.Items.Accessories
|
||||
player.Calamity().featherCrownDraw = true; //this bool is just used for drawing
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().featherCrownDraw = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -64,5 +64,30 @@ namespace CalamityMod.Items.Accessories
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().howlsHeartVanity = true;
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
var source = player.GetSource_Accessory(Item);
|
||||
if (player.FindBuffIndex(BuffType<HowlTrio>()) == -1)
|
||||
player.AddBuff(BuffType<HowlTrio>(), 3600, true);
|
||||
|
||||
if (player.ownedProjectileCounts[ProjectileType<HowlsHeartHowl>()] < 1)
|
||||
{
|
||||
int damage = (int)player.GetTotalDamage<SummonDamageClass>().ApplyTo(HowlDamage);
|
||||
int p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType<HowlsHeartHowl>(), damage, 1f, player.whoAmI, 0f, 1f);
|
||||
if (Main.projectile.IndexInRange(p))
|
||||
Main.projectile[p].originalDamage = HowlDamage;
|
||||
}
|
||||
|
||||
if (player.ownedProjectileCounts[ProjectileType<HowlsHeartCalcifer>()] < 1)
|
||||
Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType<HowlsHeartCalcifer>(), 0, 0f, player.whoAmI, 0f, 0f);
|
||||
|
||||
if (player.ownedProjectileCounts[ProjectileType<HowlsHeartTurnipHead>()] < 1)
|
||||
Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType<HowlsHeartTurnipHead>(), 0, 0f, player.whoAmI, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,11 @@ namespace CalamityMod.Items.Accessories
|
||||
player.Calamity().moonCrownDraw = true; //this bool is just used for drawing
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().moonCrownDraw = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -123,6 +123,12 @@ namespace CalamityMod.Items.Accessories
|
||||
modPlayer.profanedCrystalHide = true;
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().profanedCrystalHide = false;
|
||||
player.Calamity().profanedCrystalForce = true;
|
||||
}
|
||||
|
||||
internal static void DetermineTransformationEligibility(Player player)
|
||||
{
|
||||
if (DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= 10 && !player.Calamity().profanedCrystalForce && player.HasBuff<ProfanedCrystalBuff>())
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories
|
||||
player.jumpSpeedBoost += 0.3f;
|
||||
player.extraFall += 35;
|
||||
player.blackBelt = true;
|
||||
player.dash = 1;
|
||||
player.dashType = 1;
|
||||
player.Calamity().DashID = string.Empty;
|
||||
player.spikedBoots = 2;
|
||||
player.accFlipper = true;
|
||||
|
||||
@@ -46,6 +46,12 @@ namespace CalamityMod.Items.Accessories.Vanity
|
||||
Item.Calamity().devItem = true;
|
||||
}
|
||||
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
player.Calamity().snowmanHide = false;
|
||||
player.Calamity().snowmanForce = true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
@@ -203,6 +203,7 @@ namespace CalamityMod.Items
|
||||
case ItemID.ShrimpyTruffle:
|
||||
case ItemID.GravityGlobe:
|
||||
case ItemID.SuspiciousLookingTentacle:
|
||||
case ItemID.LongRainbowTrailWings:
|
||||
item.expert = false;
|
||||
break;
|
||||
}
|
||||
@@ -1144,6 +1145,10 @@ namespace CalamityMod.Items
|
||||
if (item.type == ItemID.ObsidianSkull || item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaWaders || item.type == ItemID.ObsidianSkullRose || item.type == ItemID.MoltenCharm || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose || item.type == ItemID.AnkhShield)
|
||||
player.buffImmune[BuffID.OnFire] = true;
|
||||
|
||||
// Ankh Shield Mighty Wind immunity.
|
||||
if (item.type == ItemID.AnkhShield)
|
||||
player.buffImmune[BuffID.WindPushed] = true;
|
||||
|
||||
if (item.type == ItemID.HellfireTreads)
|
||||
{
|
||||
modPlayer.hellfireTreads = true;
|
||||
|
||||
@@ -7,6 +7,8 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items
|
||||
{
|
||||
// TODO -- The item tweaks database and functions should be stored in a ModSystem.
|
||||
// ApplyTweaks(ref Item item) would be the one exposed function, which CalamityGlobalItem would call in SetDefaults.
|
||||
public partial class CalamityGlobalItem : GlobalItem
|
||||
{
|
||||
#region Database and Initialization
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
using CalamityMod.Tiles;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Items.Placeables.Banners
|
||||
{
|
||||
public class AquaticParasiteBanner : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Aquatic Parasite");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 10;
|
||||
Item.height = 24;
|
||||
Item.maxStack = 99;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.useAnimation = 15;
|
||||
Item.useTime = 10;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.consumable = true;
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
Item.value = Item.buyPrice(0, 0, 10, 0);
|
||||
Item.createTile = ModContent.TileType<MonsterBanner>();
|
||||
Item.placeStyle = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 321 B |
@@ -1,33 +0,0 @@
|
||||
using CalamityMod.Tiles;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Items.Placeables.Banners
|
||||
{
|
||||
public class BlightedEyeBanner : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Blighted Eye");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 10;
|
||||
Item.height = 24;
|
||||
Item.maxStack = 99;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.useAnimation = 15;
|
||||
Item.useTime = 10;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.consumable = true;
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
Item.value = Item.buyPrice(0, 0, 10, 0);
|
||||
Item.createTile = ModContent.TileType<MonsterBanner>();
|
||||
Item.placeStyle = 54;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 288 B |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 355 B |
@@ -1,32 +0,0 @@
|
||||
using CalamityMod.Tiles;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Placeables.Banners
|
||||
{
|
||||
public class SandTortoiseBanner : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}SandTortoiseBanner");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 10;
|
||||
Item.height = 24;
|
||||
Item.maxStack = 99;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.useAnimation = 15;
|
||||
Item.useTime = 10;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.consumable = true;
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
Item.value = Item.buyPrice(0, 0, 10, 0);
|
||||
Item.createTile = ModContent.TileType<MonsterBanner>();
|
||||
Item.placeStyle = 64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 306 B |
@@ -1,37 +0,0 @@
|
||||
using CalamityMod.Tiles;
|
||||
using CalamityMod.Items.Materials;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Placeables.Banners
|
||||
{
|
||||
public class WulfrumSlimeBanner : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
Tooltip.SetDefault("A decorative banner themed after an extinct slime species");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 10;
|
||||
Item.height = 24;
|
||||
Item.maxStack = 99;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.useAnimation = 15;
|
||||
Item.useTime = 10;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.consumable = true;
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
Item.value = Item.buyPrice(0, 0, 10, 0);
|
||||
Item.createTile = ModContent.TileType<MonsterBanner>();
|
||||
Item.placeStyle = 51;
|
||||
}
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe(1).AddIngredient(ItemID.Silk, 3).AddIngredient(ModContent.ItemType<WulfrumShard>(), 3).AddTile(TileID.Loom).Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 198 B |
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
@@ -7,6 +7,7 @@ using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Items.VanillaArmorChanges
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class VanillaArmorChangeManager
|
||||
{
|
||||
internal static List<VanillaArmorChange> ArmorChanges;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
DisplayName.SetDefault("Seeking Scorcher");
|
||||
Tooltip.SetDefault("May your enemies burn in hell for the sins they have committed\n" +
|
||||
"Throws a holy boomerang that seeks out up to three enemies before returning to the player");
|
||||
"Throws a holy boomerang that seeks out up to four enemies before returning to the player");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class AdamantiteParticleAccelerator : ModItem
|
||||
{
|
||||
public const int ChargeFrames = 28;
|
||||
public const int CooldownFrames = 16;
|
||||
public static readonly Color[] LightColors = new Color[] { new Color(235, 40, 121), new Color(49, 161, 246) }; //beam colors
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Adamantite Particle Accelerator");
|
||||
Tooltip.SetDefault("Charges and fires 2 beams of opposite polarities. Hitting with the opposite polarity increases the damage");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 100;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 54;
|
||||
Item.height = 52;
|
||||
Item.useTime = ChargeFrames + CooldownFrames;
|
||||
Item.useAnimation = ChargeFrames + CooldownFrames;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 3f;
|
||||
Item.channel = true;
|
||||
Item.value = Item.buyPrice(0, 36, 0, 0);
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
Item.autoReuse = true;
|
||||
Item.shootSpeed = 6f;
|
||||
Item.shoot = ModContent.ProjectileType<AdamantiteAcceleratorHoldout>();
|
||||
Item.noUseGraphic = true;
|
||||
}
|
||||
|
||||
|
||||
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
|
||||
{
|
||||
velocity *= Item.shootSpeed;
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<AdamantiteAcceleratorHoldout>(), damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.AdamantiteBar, 10).
|
||||
AddTile(TileID.MythrilAnvil).
|
||||
Register();
|
||||
}
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bouncy Spiky Ball");
|
||||
Tooltip.SetDefault(@"Throws a very bouncy ball that richochets off walls and enemies
|
||||
Tooltip.SetDefault(@"Throws a very bouncy ball that ricochets off walls and enemies
|
||||
Receives a small boost in damage and velocity after bouncing off an enemy
|
||||
Stealth strikes provide a bigger boost after richocheting");
|
||||
Stealth strikes provide a bigger boost after ricocheting");
|
||||
SacrificeTotal = 99;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 38;
|
||||
Item.width = 62;
|
||||
Item.height = 58;
|
||||
Item.damage = 563;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
@@ -32,7 +33,6 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.useAnimation = 33;
|
||||
Item.knockBack = 7f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.height = 54;
|
||||
Item.value = CalamityGlobalItem.Rarity14BuyPrice;
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
Item.Calamity().customRarity = CalamityRarity.DarkBlue;
|
||||
|
||||
@@ -57,7 +57,9 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
}
|
||||
else if (player.ownedProjectileCounts[ModContent.ProjectileType<DormantBrimseekerAura>()] <= 0f)
|
||||
{
|
||||
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<DormantBrimseekerAura>(), damage * 2, knockback, player.whoAmI, 0f, 0f);
|
||||
int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<DormantBrimseekerAura>(), damage * 2, knockback, player.whoAmI, 0f, 0f);
|
||||
if (Main.projectile.IndexInRange(p))
|
||||
Main.projectile[p].originalDamage = Item.damage;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
DisplayName.SetDefault("Virid Vanguard");
|
||||
Tooltip.SetDefault("Summons 2 blades that rotate around you\n" +
|
||||
"Each pair of blades take up three minion slots\n" +
|
||||
"Each pair of blades takes up three minion slots\n" +
|
||||
"Right clicking prompts all blades to fly upward and redirect towards the mouse");
|
||||
Item.staff[Item.type] = true;
|
||||
SacrificeTotal = 1;
|
||||
|
||||
@@ -120,30 +120,30 @@ namespace CalamityMod
|
||||
{ "Crabulon", 2.5f },
|
||||
{ "HiveMind", 3.5f },
|
||||
{ "Perforators", 3.51f },
|
||||
{ "SlimeGod", 5.5f },
|
||||
{ "Cryogen", 6.5f },
|
||||
{ "AquaticScourge", 7.5f },
|
||||
{ "BrimstoneElemental", 8.5f },
|
||||
{ "Calamitas", 9.7f },
|
||||
{ "GreatSandShark", 10.09f },
|
||||
{ "Leviathan", 10.5f },
|
||||
{ "AstrumAureus", 10.6f },
|
||||
{ "PlaguebringerGoliath", 11.5f },
|
||||
{ "Ravager", 12.5f },
|
||||
{ "AstrumDeus", 13.5f },
|
||||
{ "ProfanedGuardians", 14.5f },
|
||||
{ "Dragonfolly", 14.6f },
|
||||
{ "Providence", 15.01f }, // Thorium's Ragnarok is 15f
|
||||
{ "CeaselessVoid", 15.5f },
|
||||
{ "StormWeaver", 15.51f },
|
||||
{ "Signus", 15.52f },
|
||||
{ "Polterghast", 16f },
|
||||
{ "OldDuke", 16.5f },
|
||||
{ "DevourerOfGods", 17f },
|
||||
{ "Yharon", 18f },
|
||||
{ "ExoMechs", 18.5f },
|
||||
{ "SupremeCalamitas", 19f },
|
||||
{ "AdultEidolonWyrm", 19.5f },
|
||||
{ "SlimeGod", 6.5f },
|
||||
{ "Cryogen", 8.5f },
|
||||
{ "AquaticScourge", 9.5f },
|
||||
{ "BrimstoneElemental", 10.5f },
|
||||
{ "Calamitas", 11.7f },
|
||||
{ "GreatSandShark", 12.09f },
|
||||
{ "Leviathan", 12.5f },
|
||||
{ "AstrumAureus", 12.6f },
|
||||
{ "PlaguebringerGoliath", 13.5f },
|
||||
{ "Ravager", 15.5f },
|
||||
{ "AstrumDeus", 16.5f },
|
||||
{ "ProfanedGuardians", 17.5f },
|
||||
{ "Dragonfolly", 17.6f },
|
||||
{ "Providence", 18.01f }, // Thorium's Ragnarok will most likely be 18f
|
||||
{ "CeaselessVoid", 18.5f },
|
||||
{ "StormWeaver", 18.51f },
|
||||
{ "Signus", 18.52f },
|
||||
{ "Polterghast", 19f },
|
||||
{ "OldDuke", 19.5f },
|
||||
{ "DevourerOfGods", 20f },
|
||||
{ "Yharon", 21f },
|
||||
{ "ExoMechs", 21.5f },
|
||||
{ "SupremeCalamitas", 22f },
|
||||
{ "AdultEidolonWyrm", 22.5f },
|
||||
// { "Yharim", 20f },
|
||||
// { "Noxus", 120f },
|
||||
// { "Xeroc", 121f },
|
||||
@@ -152,8 +152,8 @@ namespace CalamityMod
|
||||
private static readonly Dictionary<string, float> InvasionDifficulty = new Dictionary<string, float>
|
||||
{
|
||||
{ "Acid Rain Initial", 2.4f },
|
||||
{ "Acid Rain Aquatic Scourge", 7.51f },
|
||||
{ "Acid Rain Polterghast", 16.49f }
|
||||
{ "Acid Rain Aquatic Scourge", 9.51f },
|
||||
{ "Acid Rain Polterghast", 19.49f }
|
||||
};
|
||||
|
||||
public static void Setup()
|
||||
@@ -235,15 +235,18 @@ namespace CalamityMod
|
||||
/// 3.0 = Eater of Worlds / Brain of Cthulhu<br />
|
||||
/// 4.0 = Queen Bee<br />
|
||||
/// 5.0 = Skeletron<br />
|
||||
/// 6.0 = Wall of Flesh<br />
|
||||
/// 7.0 = The Twins<br />
|
||||
/// 8.0 = The Destroyer<br />
|
||||
/// 9.0 = Skeletron Prime<br />
|
||||
/// 10.0 = Plantera<br />
|
||||
/// 11.0 = Golem<br />
|
||||
/// 12.0 = Duke Fishron<br />
|
||||
/// 13.0 = Lunatic Cultist<br />
|
||||
/// 14.0 = Moon Lord
|
||||
/// 6.0 = Deerclops<br />
|
||||
/// 7.0 = Wall of Flesh<br />
|
||||
/// 8.0 = Queen Slime<br />
|
||||
/// 9.0 = The Twins<br />
|
||||
/// 10.0 = The Destroyer<br />
|
||||
/// 11.0 = Skeletron Prime<br />
|
||||
/// 12.0 = Plantera<br />
|
||||
/// 13.0 = Golem<br />
|
||||
/// 14.0 = Empress of Light<br />
|
||||
/// 15.0 = Duke Fishron<br />
|
||||
/// 16.0 = Lunatic Cultist<br />
|
||||
/// 17.0 = Moon Lord
|
||||
/// </summary>
|
||||
private static void BossChecklistSupport()
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
DisplayName.SetDefault("Draconic Swarmer");
|
||||
Main.npcFrameCount[NPC.type] = 5;
|
||||
NPCID.Sets.TrailingMode[NPC.type] = 1;
|
||||
NPCID.Sets.BossBestiaryPriority.Add(Type);
|
||||
this.HideFromBestiary();
|
||||
}
|
||||
|
||||
public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly";
|
||||
@@ -43,19 +43,6 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
NPC.Calamity().VulnerableToSickness = true;
|
||||
}
|
||||
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
{
|
||||
int associatedNPCType = ModContent.NPCType<Bumblefuck>();
|
||||
bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true);
|
||||
|
||||
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
|
||||
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
|
||||
|
||||
// Will move to localization whenever that is cleaned up.
|
||||
new FlavorTextBestiaryInfoElement("Though these creatures may look adorable, they are a vicious invasive species. If not dealt with quickly, they may drive the nearby fauna to extinction.")
|
||||
});
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
CalamityAI.Bumblebirb2AI(NPC, Mod, true);
|
||||
|
||||
@@ -1242,12 +1242,14 @@ namespace CalamityMod.NPCs
|
||||
// Does not show up in the Bestiary
|
||||
LeadingConditionRule bloodOrbDrop = new LeadingConditionRule(DropHelper.BloodOrbBaseCondition);
|
||||
bloodOrbDrop.Add(ModContent.ItemType<BloodOrb>(), 5, hideLootReport: true);
|
||||
globalLoot.Add(bloodOrbDrop);
|
||||
|
||||
// Bloodflare set bonus Blood Orb drops: 50% chance from any valid enemy on the surface during a Blood Moon
|
||||
// See the condition lambda in DropHelper for details
|
||||
// Does not show up in the Bestiary
|
||||
LeadingConditionRule bloodflareBloodOrbDrop = new LeadingConditionRule(DropHelper.BloodOrbBloodflareCondition);
|
||||
bloodflareBloodOrbDrop.Add(ModContent.ItemType<BloodOrb>(), 2, hideLootReport: true);
|
||||
globalLoot.Add(bloodflareBloodOrbDrop);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace CalamityMod.NPCs
|
||||
{
|
||||
public class CalamityPolarityNPC : GlobalNPC
|
||||
{
|
||||
private float curPolarity = 0;
|
||||
public List<Particle> pulses;
|
||||
private List<Particle> pulsesToClear;
|
||||
|
||||
public bool isPolarized => curPolarity != 0;
|
||||
|
||||
public override bool InstancePerEntity => true;
|
||||
|
||||
public float CurPolarity
|
||||
{
|
||||
get
|
||||
{
|
||||
return curPolarity;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
curPolarity = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults(NPC npc)
|
||||
{
|
||||
CurPolarity = 0;
|
||||
pulses = new List<Particle>();
|
||||
pulsesToClear = new List<Particle>();
|
||||
|
||||
}
|
||||
|
||||
//Applies a new polarity to the target
|
||||
public void applyPolarity(float update, NPC npc)
|
||||
{
|
||||
//Round the polarity to avoid ending up with a polarity that's got decimals which will cause it to forever alternate between positive and negative.
|
||||
CurPolarity = (float)Math.Round(update);
|
||||
Color pulseColor = AdamantiteParticleAccelerator.LightColors[update < 0 ? 1 : 0];
|
||||
pulses.Add(new AuraPulseRing(pulseColor, new Vector2(Math.Max(npc.width / 156f * 1.1f, 0.25f) , 0.3f), new Vector2(Math.Max(npc.width / 156f * 1.5f, 0.4f), 0.01f), 40, npc));
|
||||
}
|
||||
|
||||
public override GlobalNPC Clone(NPC npc, NPC npcClone)
|
||||
{
|
||||
CalamityPolarityNPC myClone = (CalamityPolarityNPC)base.Clone(npc, npcClone);
|
||||
|
||||
myClone.curPolarity = CurPolarity;
|
||||
|
||||
return myClone;
|
||||
}
|
||||
|
||||
public override void PostAI(NPC npc)
|
||||
{
|
||||
HandlePulses();
|
||||
|
||||
if (!isPolarized)
|
||||
return;
|
||||
|
||||
//Polarity decay
|
||||
if (curPolarity < 0)
|
||||
curPolarity++;
|
||||
else if (curPolarity > 0)
|
||||
curPolarity--;
|
||||
|
||||
//Polarity particles
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Color sparkColor = AdamantiteParticleAccelerator.LightColors[CurPolarity < 0 ? 1 : 0];
|
||||
Particle spark = new ElectricSpark(npc.Center + Main.rand.NextVector2Circular(npc.width / 2f, npc.height / 2f), Main.rand.NextVector2CircularEdge(20f, 20f) * 0.4f, Color.Lerp(Color.White, sparkColor, 0.4f), sparkColor, Main.rand.NextFloat(0.5f, 1.2f), Main.rand.Next(20, 40), bloomScale: 2.5f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
|
||||
public void HandlePulses()
|
||||
{
|
||||
foreach (Particle pulse in pulses)
|
||||
{
|
||||
pulse.Time++;
|
||||
pulse.Update();
|
||||
if (pulse.Time > pulse.Lifetime)
|
||||
pulsesToClear.Add(pulse);
|
||||
}
|
||||
|
||||
pulses.RemoveAll(n => pulsesToClear.Contains(n));
|
||||
pulsesToClear.Clear();
|
||||
}
|
||||
|
||||
public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
foreach (Particle pulse in pulses)
|
||||
{
|
||||
pulse.CustomDraw(spriteBatch, npc.Center);
|
||||
pulse.CustomDraw(spriteBatch, npc.Center);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
this.HideFromBestiary();
|
||||
DisplayName.SetDefault("Scryllar");
|
||||
}
|
||||
|
||||
@@ -45,16 +46,6 @@ namespace CalamityMod.NPCs.Crags
|
||||
NPC.Calamity().VulnerableToWater = true;
|
||||
}
|
||||
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
{
|
||||
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
|
||||
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Crags,
|
||||
|
||||
// Will move to localization whenever that is cleaned up.
|
||||
new FlavorTextBestiaryInfoElement("Twisted detritus of those who once came to harvest the remains of the crags. The whispers got to them.")
|
||||
});
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
NPC.rotation = NPC.velocity.X * 0.04f;
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace CalamityMod.NPCs.DraedonLabThings
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = false;
|
||||
NPC.chaseable = false;
|
||||
NPC.HitSound = SoundID.NPCHit4;
|
||||
NPC.DeathSound = SoundID.NPCDeath44;
|
||||
}
|
||||
|
||||
@@ -206,6 +206,11 @@ namespace CalamityMod.NPCs.HiveMind
|
||||
writer.Write(reelCount);
|
||||
writer.Write(frameX);
|
||||
writer.Write(frameY);
|
||||
|
||||
writer.Write(NPC.frame.X);
|
||||
writer.Write(NPC.frame.Y);
|
||||
writer.Write(NPC.frame.Width);
|
||||
writer.Write(NPC.frame.Height);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
@@ -228,6 +233,10 @@ namespace CalamityMod.NPCs.HiveMind
|
||||
reelCount = reader.ReadInt32();
|
||||
frameX = reader.ReadInt32();
|
||||
frameY = reader.ReadInt32();
|
||||
|
||||
Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32());
|
||||
if (frame.Width > 0 && frame.Height > 0)
|
||||
NPC.frame = frame;
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight)
|
||||
@@ -439,6 +448,8 @@ namespace CalamityMod.NPCs.HiveMind
|
||||
NPC.alpha = 0;
|
||||
NPC.dontTakeDamage = false;
|
||||
NPC.damage = NPC.defDamage;
|
||||
NPC.netSpam = 0;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class AuraPulseRing : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/HollowCircleHardEdge";
|
||||
public override bool UseAdditiveBlend => true;
|
||||
public override bool SetLifetime => true;
|
||||
|
||||
private Vector2 OriginalScale;
|
||||
private Vector2 FinalScale;
|
||||
public Vector2 CurrentScale;
|
||||
private float opacity;
|
||||
private Color BaseColor;
|
||||
public NPC StuckTo;
|
||||
|
||||
public AuraPulseRing(Color color, Vector2 originalScale, Vector2 finalScale, int lifeTime, NPC stuckTo)
|
||||
{
|
||||
BaseColor = color;
|
||||
OriginalScale = originalScale;
|
||||
FinalScale = finalScale;
|
||||
CurrentScale = originalScale;
|
||||
Lifetime = lifeTime;
|
||||
StuckTo = stuckTo;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(SineBumpEasing, 0f, 0f, 1f)});
|
||||
|
||||
float heightProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(SineInOutEasing, 0f, 0f, 1f) });
|
||||
|
||||
opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.8f + 0.2f;
|
||||
|
||||
Color = BaseColor * opacity;
|
||||
Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f);
|
||||
|
||||
if (StuckTo != null && StuckTo.active)
|
||||
{
|
||||
CurrentScale = Vector2.Lerp(OriginalScale, FinalScale, pulseProgress) * StuckTo.scale;
|
||||
RelativeOffset = - Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height / 2f + Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height * heightProgress;
|
||||
Rotation = StuckTo.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch, Vector2 basePosition)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Particles/HollowCircleHardEdge").Value; //somehow wont work for set particles and defaults to the first particle it has (blood)
|
||||
|
||||
spriteBatch.Draw(tex, basePosition + RelativeOffset - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, CurrentScale, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ namespace CalamityMod.Particles
|
||||
// As such, it is littered with many netMode checks. While some may be overprotective in their nature it is critical that
|
||||
// failsafes exist there, as visual failures tend to result in engine crashes, which will kill a lot of MP servers.
|
||||
// If someone other than me for any reason attempts to notably expand upon this system you must keep this in mind. -Dominic
|
||||
|
||||
// TODO -- This can be made into a ModSystem. Its main thread load dependency with render targets is safe to put in OnModLoad.
|
||||
public static class FusableParticleManager
|
||||
{
|
||||
internal static List<FusableParticleRenderCollection> ParticleSets = new List<FusableParticleRenderCollection>();
|
||||
|
||||
@@ -11,6 +11,7 @@ using Terraria.ModLoader.Core;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class GeneralParticleHandler
|
||||
{
|
||||
private static List<Particle> particles;
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
public abstract int IntendedProjectileType { get; }
|
||||
public static Dictionary<int, int> ItemProjectileRelationship = new();
|
||||
|
||||
// TODO -- There is no reason this load hook should need to be called from CalamityMod.
|
||||
// All subclasses of this should be ILoadable and should load themselves.
|
||||
public static void LoadAll()
|
||||
{
|
||||
ItemProjectileRelationship = new Dictionary<int, int>();
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Enums;
|
||||
using Terraria.GameContent.Shaders;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class AdamAcceleratorBeam : ModProjectile
|
||||
{
|
||||
private const int Lifetime = 24;
|
||||
|
||||
private const float MaxBeamScale = 1.2f;
|
||||
public int DustType => polarity < 0 ? 226 : 73;
|
||||
|
||||
private const float MaxBeamLength = 2400f;
|
||||
private const float BeamTileCollisionWidth = 1f;
|
||||
private const float BeamHitboxCollisionWidth = 15f;
|
||||
private const int NumSamplePoints = 3;
|
||||
private const float BeamLengthChangeFactor = 0.75f;
|
||||
|
||||
private const float OuterBeamOpacityMultiplier = 0.82f;
|
||||
private const float InnerBeamOpacityMultiplier = 0.2f;
|
||||
private const float MaxBeamBrightness = 0.75f;
|
||||
|
||||
private const float MainDustBeamEndOffset = 14.5f;
|
||||
private const float SidewaysDustBeamEndOffset = 4f;
|
||||
private const float BeamRenderTileOffset = 10.5f;
|
||||
private const float BeamLengthReductionFactor = 14.5f;
|
||||
|
||||
private Vector2 beamVector = Vector2.Zero;
|
||||
public ref float polarity => ref Projectile.ai[1];
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Adamantite Particle Beam");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 16;
|
||||
Projectile.height = 16;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.alpha = 0;
|
||||
// The beam itself still stops on tiles, but its invisible "source" projectile ignores them.
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
|
||||
// The beam lasts for only some frames and fades out over that time.
|
||||
Projectile.timeLeft = Lifetime;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// If the projectile for some reason isn't still an Adamantite Particle Beam delete it immediately.
|
||||
if (Projectile.type != ModContent.ProjectileType<AdamAcceleratorBeam>())
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
// On frame 1, set the beam vector and rotation, but set the real velocity to zero.
|
||||
if (Projectile.velocity != Vector2.Zero)
|
||||
{
|
||||
beamVector = Vector2.Normalize(Projectile.velocity);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
// Reduce the "power" and thus scale of the projectile over its lifetime.
|
||||
float power = (float)Projectile.timeLeft / Lifetime;
|
||||
Projectile.scale = MaxBeamScale * power;
|
||||
|
||||
// Perform a laser scan to calculate the correct length of the beam.
|
||||
float[] laserScanResults = new float[NumSamplePoints];
|
||||
|
||||
// A minimum width is forced for the beam scan to prevent massive lag when fired into open areas.
|
||||
float scanWidth = Projectile.scale < 1f ? 1f : Projectile.scale;
|
||||
Collision.LaserScan(Projectile.Center, beamVector, BeamTileCollisionWidth * scanWidth, MaxBeamLength, laserScanResults);
|
||||
float avg = 0f;
|
||||
for (int i = 0; i < laserScanResults.Length; ++i)
|
||||
avg += laserScanResults[i];
|
||||
avg /= NumSamplePoints;
|
||||
Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], avg, BeamLengthChangeFactor);
|
||||
|
||||
// X = beam length. Y = beam width.
|
||||
Vector2 beamDims = new Vector2(beamVector.Length() * Projectile.ai[0], Projectile.width * Projectile.scale);
|
||||
Color beamColor = GetBeamColor(polarity);
|
||||
ProduceBeamDust(beamColor);
|
||||
// If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water.
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader();
|
||||
// A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds.
|
||||
float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f);
|
||||
Vector2 ripplePos = Projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(Projectile.rotation);
|
||||
// WaveData is encoded as a Color. Not sure why, considering Vector3 exists.
|
||||
Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine);
|
||||
wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, Projectile.rotation);
|
||||
}
|
||||
|
||||
// Make the beam cast light along its length.
|
||||
// v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight
|
||||
DelegateMethods.v3_1 = beamColor.ToVector3() * power * MaxBeamBrightness;
|
||||
Utils.PlotTileLine(Projectile.Center, Projectile.Center + beamVector * Projectile.ai[0], beamDims.Y, DelegateMethods.CastLight);
|
||||
|
||||
//Also add some fast moving dust
|
||||
if (Projectile.timeLeft == Lifetime)
|
||||
{
|
||||
int dustCount = Main.rand.Next(10, 30);
|
||||
for (int i = 0; i < dustCount; i++)
|
||||
{
|
||||
float dustProgressAlongBeam = Projectile.ai[0] * Main.rand.NextFloat(0f, 0.7f);
|
||||
Vector2 dustPosition = Projectile.Center + dustProgressAlongBeam * beamVector + beamVector.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-6f, 6f) * Projectile.scale;
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(dustPosition, DustType, beamVector * Main.rand.NextFloat(2f, 16f), 0, beamColor);
|
||||
dust.color = beamColor;
|
||||
dust.noGravity = true;
|
||||
dust.scale = 0.7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Determines whether the specified target hitbox is intersecting with the beam.
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
// If the target is touching the beam's hitbox (which is a small rectangle vaguely overlapping the host crystal), that's good enough.
|
||||
if (projHitbox.Intersects(targetHitbox))
|
||||
return true;
|
||||
// Otherwise, perform an AABB line collision check to check the whole beam.
|
||||
float _ = float.NaN;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + beamVector * Projectile.ai[0], BeamHitboxCollisionWidth * Projectile.scale, ref _);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.PolarityNPC().applyPolarity(polarity, target); //applies a positive or negative polarity on the target for 120 frames
|
||||
}
|
||||
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
// Ensure that the hit direction is correct when hitting enemies.
|
||||
hitDirection = (Projectile.Center.X < target.Center.X).ToDirectionInt();
|
||||
float targetPolarity = target.PolarityNPC().CurPolarity;
|
||||
//If a polarity beam hits the target with the opposite polarity, the damage dealt increases by 20%
|
||||
if (polarity * targetPolarity < 0)
|
||||
{
|
||||
double newDamage = damage * 1.2;
|
||||
damage = (int)newDamage;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Color sparkColor = AdamantiteParticleAccelerator.LightColors[polarity < 0 ? 1 : 0];
|
||||
|
||||
Vector2 sparkSpeed = Owner.DirectionTo(target.Center).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(8f, 17f);
|
||||
Particle Spark = new CritSpark(target.Center, sparkSpeed, Color.White, sparkColor, 0.7f + Main.rand.NextFloat(0, 0.6f), 30, 0.4f, 0.6f);
|
||||
GeneralParticleHandler.SpawnParticle(Spark);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Color GetBeamColor(float polarity)
|
||||
{
|
||||
//Beam color changes based on polarity. Red for positive, blue for negative, just like a magnet
|
||||
int index = (polarity > 0) ? 0 : 1;
|
||||
Color c = AdamantiteParticleAccelerator.LightColors[index];
|
||||
c.A = 64;
|
||||
return c;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
// If the beam doesn't have a defined projection vector or hasn't yet had its velocity set to zero, don't draw anything.
|
||||
if (beamVector == Vector2.Zero || Projectile.velocity != Vector2.Zero)
|
||||
return false;
|
||||
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
float beamLength = Projectile.ai[0];
|
||||
Vector2 centerFloored = Projectile.Center.Floor() + beamVector * Projectile.scale * BeamRenderTileOffset;
|
||||
Vector2 scaleVec = new Vector2(Projectile.scale);
|
||||
|
||||
// Reduce the beam length proportional to its square area to reduce block penetration.
|
||||
beamLength -= BeamLengthReductionFactor * Projectile.scale * Projectile.scale;
|
||||
|
||||
DelegateMethods.f_1 = 1f; // f_1 is an unnamed decompiled variable whose function is unknown. Leave it at 1.
|
||||
Vector2 beamStartPos = centerFloored - Main.screenPosition;
|
||||
Vector2 beamEndPos = beamStartPos + beamVector * beamLength;
|
||||
Utils.LaserLineFraming llf = new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw);
|
||||
|
||||
// Draw the outermost beam
|
||||
// c_1 is an unnamed decompiled variable which is the render color of the beam drawn by DelegateMethods.RainbowLaserDraw
|
||||
Color beamColor = GetBeamColor(polarity);
|
||||
DelegateMethods.c_1 = beamColor * OuterBeamOpacityMultiplier * Projectile.Opacity;
|
||||
Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf);
|
||||
|
||||
// Draw the inner beams, each with reduced size and whiter color
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
beamColor = Color.Lerp(beamColor, Color.White, 0.4f);
|
||||
scaleVec *= 0.85f;
|
||||
DelegateMethods.c_1 = beamColor * InnerBeamOpacityMultiplier * Projectile.Opacity;
|
||||
Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ProduceBeamDust(Color beamColor)
|
||||
{
|
||||
// Create a few dust per frame a small distance from where the beam ends.
|
||||
Vector2 laserEndPos = Projectile.Center + beamVector * (Projectile.ai[0] - MainDustBeamEndOffset * Projectile.scale);
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
// 50% chance for the dust to come off on either side of the beam.
|
||||
float dustAngle = Projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2;
|
||||
float dustStartDist = Main.rand.NextFloat(1f, 1.8f);
|
||||
Vector2 dustVel = dustAngle.ToRotationVector2() * dustStartDist;
|
||||
int d = Dust.NewDust(laserEndPos, 0, 0, DustType, dustVel.X, dustVel.Y, 0, beamColor);
|
||||
Main.dust[d].color = beamColor;
|
||||
Main.dust[d].noGravity = true;
|
||||
Main.dust[d].scale = 0.7f;
|
||||
|
||||
// Scale up dust with the projectile if it's large.
|
||||
if (Projectile.scale > 1f)
|
||||
{
|
||||
Main.dust[d].velocity *= Projectile.scale;
|
||||
Main.dust[d].scale *= Projectile.scale;
|
||||
}
|
||||
|
||||
// If the beam isn't at max scale, then make additional smaller dust.
|
||||
if (Projectile.scale != MaxBeamScale)
|
||||
{
|
||||
Dust smallDust = Dust.CloneDust(d);
|
||||
smallDust.scale /= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
// Low chance every frame to spawn a large "directly sideways" dust which doesn't move.
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
// Velocity, flipped sideways, times -50% to 50% of beam width.
|
||||
Vector2 dustOffset = beamVector.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * Projectile.width;
|
||||
Vector2 dustPos = laserEndPos + dustOffset - Vector2.One * SidewaysDustBeamEndOffset;
|
||||
int d = Dust.NewDust(dustPos, 8, 8, DustType, 0f, 0f, 100, beamColor, 1.2f);
|
||||
Main.dust[d].velocity *= 0.5f;
|
||||
|
||||
// Force the dust to always move downwards, never upwards.
|
||||
Main.dust[d].velocity.Y = -Math.Abs(Main.dust[d].velocity.Y);
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically iterates through every tile the laser is overlapping to cut grass at all those locations.
|
||||
public override void CutTiles()
|
||||
{
|
||||
// tilecut_0 is an unnamed decompiled variable which tells CutTiles how the tiles are being cut (in this case, via a projectile).
|
||||
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
|
||||
Utils.TileActionAttempt cut = DelegateMethods.CutTiles;
|
||||
Vector2 beamStartPos = Projectile.Center;
|
||||
Vector2 beamEndPos = beamStartPos + beamVector * Projectile.ai[0];
|
||||
Utils.PlotTileLine(beamStartPos, beamEndPos, Projectile.width * Projectile.scale, cut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 526 B |
@@ -0,0 +1,198 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class AdamantiteAcceleratorHoldout : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Ranged/AdamantiteParticleAccelerator";
|
||||
const float maxTimeAnim = 35;
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public float Timer => maxTimeAnim - Projectile.timeLeft;
|
||||
public ref float ChargeTimer => ref Projectile.ai[0];
|
||||
public ref float DelayTimer => ref Projectile.ai[1];
|
||||
public ref float ChargeRate => ref Projectile.localAI[0];
|
||||
public ref float BounceBackPower => ref Projectile.localAI[1];
|
||||
public Vector2 NuzzlePosition => Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 70f + (Vector2.UnitY * -12f * Owner.direction).RotatedBy(Projectile.rotation);
|
||||
|
||||
private SlotId ChargeupSoundSlot;
|
||||
|
||||
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Adamantite Particle Accelerator");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 54;
|
||||
Projectile.height = 52;
|
||||
// This projectile has no hitboxes and no damage type.
|
||||
Projectile.friendly = false;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 900;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
// ChargeTimer is a time-dilated frame counter. DelayTimer is the frame counter for when the beams are fired.
|
||||
// ChargeRate is the rate at which the "frame" counter increases. BounceBackPower is there for the visuals of the gun recoiling in the players hands.
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
|
||||
Projectile.rotation = Owner.MountedCenter.AngleTo(Owner.Calamity().mouseWorld);
|
||||
|
||||
// Calculate how quickly the gun should charge. Charge increases by some number close to 1 every frame.
|
||||
// Speed increasing reforges make this number greater than 1. Slowing reforges make it smaller than 1.
|
||||
if (ChargeRate == 0f)
|
||||
ChargeRate = 44f / player.ActiveItem().useTime;
|
||||
|
||||
if (ChargeTimer == 0f)
|
||||
ChargeupSoundSlot = SoundEngine.PlaySound(SoundID.DD2_WitherBeastAuraPulse with { Volume = SoundID.DD2_WitherBeastAuraPulse.Volume * 1.6f }, Projectile.Center);
|
||||
|
||||
else if (SoundEngine.TryGetActiveSound(ChargeupSoundSlot, out var soundOut) && soundOut.IsPlaying)
|
||||
{
|
||||
soundOut.Sound.Pitch = ChargeTimer * 2f ;
|
||||
soundOut.Position = Projectile.Center;
|
||||
}
|
||||
|
||||
if (BounceBackPower > 0f)
|
||||
BounceBackPower -= 0.07f;
|
||||
|
||||
// Increment the timer for the gun. If the timer has passed 44, destroy it.
|
||||
ChargeTimer += ChargeRate;
|
||||
int maxTime = AdamantiteParticleAccelerator.ChargeFrames + AdamantiteParticleAccelerator.CooldownFrames;
|
||||
if (ChargeTimer > maxTime)
|
||||
{
|
||||
if (Owner.channel)
|
||||
ResetToStart();
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the weapon's charge.
|
||||
float chargeLevel = MathHelper.Clamp(Projectile.ai[0] / AdamantiteParticleAccelerator.ChargeFrames, 0f, 1f);
|
||||
|
||||
// Common code among holdouts to keep the holdout projectile directly in the player's hand
|
||||
UpdatePlayerVisuals(player, rrp);
|
||||
|
||||
// Firing or charging?
|
||||
if (chargeLevel >= 1f)
|
||||
{
|
||||
//Fires the first beam of the positive polarity on the 1st frame
|
||||
if (DelayTimer == 0f)
|
||||
{
|
||||
FiringEffects(new Color(235, 40, 121));
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile redLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), NuzzlePosition, Projectile.rotation.ToRotationVector2(), ProjectileType<AdamAcceleratorBeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 120);
|
||||
redLaser.Center = NuzzlePosition;
|
||||
}
|
||||
}
|
||||
|
||||
//Fires the second beam of the negative polarity 8 frames after the first frame
|
||||
else if (DelayTimer == 8f)
|
||||
{
|
||||
FiringEffects(new Color(49, 161, 246));
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile blueLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), NuzzlePosition, Projectile.rotation.ToRotationVector2(), ProjectileType<AdamAcceleratorBeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, -120);
|
||||
blueLaser.Center = NuzzlePosition;
|
||||
}
|
||||
}
|
||||
DelayTimer += 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public CurveSegment bounceAway = new CurveSegment(SineOutEasing, 0f, 0.5f, 0.5f);
|
||||
public CurveSegment moveBack = new CurveSegment(SineInEasing, 0.56f, 1f, -1f);
|
||||
public CurveSegment bounceBack = new CurveSegment(SineBumpEasing, 0.7f, 0f, -0.35f);
|
||||
internal float RecoilDisplacement => PiecewiseAnimation(1 - BounceBackPower, new CurveSegment[] { bounceAway, moveBack, bounceBack });
|
||||
|
||||
public CurveSegment unsquish = new CurveSegment(SineOutEasing, 0f, 1f, -1f);
|
||||
public CurveSegment oversquish = new CurveSegment(SineBumpEasing, 0.7f, 0f, -0.6f);
|
||||
internal float RecoilSquish => PiecewiseAnimation(1 - MathHelper.Clamp(BounceBackPower * 2f, 0f, 1f), new CurveSegment[] { unsquish, oversquish });
|
||||
|
||||
private void UpdatePlayerVisuals(Player player, Vector2 rrp)
|
||||
{
|
||||
// Place the projectile directly into the player's hand at all times
|
||||
Projectile.Center = rrp;
|
||||
|
||||
// The gun is a holdout projectile, so change the player's variables to reflect that
|
||||
player.ChangeDir(Math.Sign(Projectile.rotation.ToRotationVector2().X));
|
||||
player.heldProj = Projectile.whoAmI;
|
||||
player.itemTime = 2;
|
||||
player.itemAnimation = 2;
|
||||
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2);
|
||||
|
||||
}
|
||||
|
||||
private void FiringEffects(Color color)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item92, NuzzlePosition);
|
||||
SoundEngine.PlaySound(SoundID.Item60, NuzzlePosition);
|
||||
|
||||
Particle pulse = new DirectionalPulseRing(NuzzlePosition + Projectile.rotation.ToRotationVector2() * 5f, Vector2.Zero, color, new Vector2(0.5f, 1f), Projectile.rotation, 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
|
||||
if (Owner == Main.LocalPlayer && Owner.Calamity().GeneralScreenShakePower < 5)
|
||||
{
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 1;
|
||||
}
|
||||
|
||||
BounceBackPower = 1f;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D gun = Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/AdamantiteParticleAccelerator").Value;
|
||||
|
||||
SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
float drawAngle = Projectile.rotation + (Owner.direction < 0 ? MathHelper.Pi : 0);
|
||||
Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? gun.Width - 33f : 33f, 33f);
|
||||
Vector2 drawOffset = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * (10f - RecoilDisplacement * 5f) - Main.screenPosition;
|
||||
|
||||
Vector2 scale = new Vector2(1f - 0.05f * RecoilSquish, 1f + 0.05f * RecoilSquish) * Projectile.scale;
|
||||
|
||||
Main.EntitySpriteDraw(gun, drawOffset, null, lightColor, drawAngle, drawOrigin, scale, flip, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreKill(int timeLeft)
|
||||
{
|
||||
if (Owner.channel)
|
||||
{
|
||||
ResetToStart();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ResetToStart()
|
||||
{
|
||||
Projectile.timeLeft = 900;
|
||||
ChargeTimer = 0f;
|
||||
DelayTimer = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
@@ -43,16 +42,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
if (Projectile.frame > 7)
|
||||
Projectile.frame = 0;
|
||||
|
||||
if (Projectile.velocity.X < 0f)
|
||||
{
|
||||
Projectile.spriteDirection = -1;
|
||||
Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.spriteDirection = 1;
|
||||
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X);
|
||||
}
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi);
|
||||
|
||||
if (Projectile.timeLeft < 210)
|
||||
CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 8f, 20f);
|
||||
@@ -64,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Texture2D texture2D13 = ModContent.Request<Texture2D>(Texture).Value;
|
||||
int num214 = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
|
||||
int y6 = num214 * Projectile.frame;
|
||||
Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 150;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.minion = true;
|
||||
Projectile.minionSlots = 0f;
|
||||
}
|
||||
|
||||
public override void AI() => Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Schematics
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class SchematicManager
|
||||
{
|
||||
internal const string RustedWorkshopKey = "Rusted Workshop";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace CalamityMod.Systems
|
||||
{
|
||||
// TODO -- Expand this ModSystem to contain the Speedrun Timer itself, as well as the UI.
|
||||
public class SpeedrunTimerStoppingSystem : ModSystem
|
||||
{
|
||||
public override void PreSaveAndQuit() => CalamityMod.SpeedrunTimer?.Stop();
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
@@ -23,6 +24,7 @@ namespace CalamityMod.Tiles.DraedonStructures
|
||||
ModTranslation name = CreateMapEntryName();
|
||||
name.SetDefault("Aged Screen");
|
||||
AddMapEntry(Color.DarkGray, name);
|
||||
TileID.Sets.FramesOnKillWall[Type] = true;
|
||||
DustType = 8;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
@@ -23,6 +24,7 @@ namespace CalamityMod.Tiles.DraedonStructures
|
||||
ModTranslation name = CreateMapEntryName();
|
||||
name.SetDefault("Screen");
|
||||
AddMapEntry(Color.DarkGray, name);
|
||||
TileID.Sets.FramesOnKillWall[Type] = true;
|
||||
DustType = 8;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
@@ -25,6 +26,7 @@ namespace CalamityMod.Tiles.FurnitureExo
|
||||
AddMapEntry(new Color(71, 95, 114), name);
|
||||
DustType = 8;
|
||||
AnimationFrameHeight = 36;
|
||||
TileID.Sets.FramesOnKillWall[Type] = true;
|
||||
}
|
||||
|
||||
public override void AnimateTile(ref int frame, ref int frameCounter)
|
||||
|
||||
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 56 KiB |
@@ -10,6 +10,7 @@ using ReLogic.Content;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class AstralArcanumUI
|
||||
{
|
||||
enum CircleStyle
|
||||
|
||||
@@ -13,6 +13,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.UI.CalamitasEnchants
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class EnchantmentManager
|
||||
{
|
||||
internal const int ClearEnchantmentID = -18591774;
|
||||
|
||||
@@ -9,6 +9,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public class ChargeMeterUI
|
||||
{
|
||||
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class InvasionProgressUIManager
|
||||
{
|
||||
private static readonly List<InvasionProgressUI> gUIs = new List<InvasionProgressUI>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -6,6 +6,7 @@ using Terraria;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class PopupGUIManager
|
||||
{
|
||||
private static readonly List<PopupGUI> gUIs = new List<PopupGUI>();
|
||||
|
||||
@@ -11,6 +11,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class RipperUI
|
||||
{
|
||||
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
|
||||
|
||||
@@ -32,6 +32,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
// TODO -- Combine with SpeedrunTimerStoppingSystem, which should be renamed and call the UI draw code in this file.
|
||||
public class SpeedrunTimerUI
|
||||
{
|
||||
// These values put the Speedrun Timer roughly at the top center of a 1080p screen.
|
||||
|
||||
@@ -9,6 +9,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public class StealthUI
|
||||
{
|
||||
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
|
||||
|
||||
@@ -18,6 +18,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod
|
||||
{
|
||||
// TODO -- Change this to a ModSystem so it does not need to be manually loaded from CalamityMod
|
||||
internal class CalamityRecipes
|
||||
{
|
||||
private static Recipe CreateRecipe(int itemID, int stack = 1) => CalamityMod.Instance.CreateRecipe(itemID, stack);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace CalamityMod
|
||||
public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer<CalamityPlayer>();
|
||||
public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC<CalamityGlobalNPC>();
|
||||
public static CalamityFallDamageNPC FallingNPC(this NPC npc) => npc.GetGlobalNPC<CalamityFallDamageNPC>();
|
||||
public static CalamityPolarityNPC PolarityNPC(this NPC npc) => npc.GetGlobalNPC<CalamityPolarityNPC>();
|
||||
public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem<CalamityGlobalItem>();
|
||||
public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile<CalamityGlobalProjectile>();
|
||||
public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem;
|
||||
|
||||
@@ -281,7 +281,12 @@ namespace CalamityMod
|
||||
float segmentProgress = (progress - segment.originX) / segmentLenght; //How far along the specific segment
|
||||
ratio = segment.originY;
|
||||
|
||||
ratio += segment.easing(segmentProgress, segment.degree) * segment.displacement;
|
||||
//Failsafe because somehow it can fail? what
|
||||
if (segment.easing != null)
|
||||
ratio += segment.easing(segmentProgress, segment.degree) * segment.displacement;
|
||||
|
||||
else
|
||||
ratio += LinearEasing(segmentProgress, segment.degree) * segment.displacement;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -303,9 +303,6 @@ namespace CalamityMod
|
||||
int item = -1;
|
||||
switch (style)
|
||||
{
|
||||
case 0:
|
||||
item = ModContent.ItemType<AquaticParasiteBanner>();
|
||||
break;
|
||||
case 1:
|
||||
item = ModContent.ItemType<FlounderBanner>();
|
||||
break;
|
||||
@@ -450,18 +447,12 @@ namespace CalamityMod
|
||||
case 50:
|
||||
item = ModContent.ItemType<ProfanedEnergyBanner>();
|
||||
break;
|
||||
case 51:
|
||||
item = ModContent.ItemType<WulfrumSlimeBanner>();
|
||||
break;
|
||||
case 52:
|
||||
item = ModContent.ItemType<WulfrumDroneBanner>();
|
||||
break;
|
||||
case 53:
|
||||
item = ModContent.ItemType<RotdogBanner>();
|
||||
break;
|
||||
case 54:
|
||||
item = ModContent.ItemType<BlightedEyeBanner>();
|
||||
break;
|
||||
case 55:
|
||||
item = ModContent.ItemType<CalamityEyeBanner>();
|
||||
break;
|
||||
@@ -489,9 +480,6 @@ namespace CalamityMod
|
||||
case 63:
|
||||
item = ModContent.ItemType<CnidrionBanner>();
|
||||
break;
|
||||
case 64:
|
||||
item = ModContent.ItemType<SandTortoiseBanner>();
|
||||
break;
|
||||
case 65:
|
||||
item = ModContent.ItemType<GreatSandSharkBanner>();
|
||||
break;
|
||||
|
||||
@@ -13,6 +13,8 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
// OnModLoad is guaranteed to be run after all content has autoloaded.
|
||||
public static class TileFraming
|
||||
{
|
||||
private static int[][] PlantCheckAgainst;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Waters
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class CustomLavaManagement
|
||||
{
|
||||
internal static List<CustomLavaStyle> CustomLavaStyles;
|
||||
|
||||
@@ -14,6 +14,7 @@ using static CalamityMod.Schematics.SchematicManager;
|
||||
|
||||
namespace CalamityMod.World
|
||||
{
|
||||
// TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks.
|
||||
public static class DraedonStructures
|
||||
{
|
||||
private static int[] otherModTilesToAvoid;
|
||||
|
||||