diff --git a/CalamityMod.cs b/CalamityMod.cs index aa21425f3c..7971c75356 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -3406,12 +3406,12 @@ namespace CalamityMod } return true; }, InterfaceScaleType.None)); - layers.Insert(invasionIndex + 1, new LegacyGameInterfaceLayer("Popup GUIs", () => - { - PopupGUIManager.UpdateAndDraw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); } + layers.Add(new LegacyGameInterfaceLayer("Popup GUIs", () => + { + PopupGUIManager.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); } public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f) @@ -4081,6 +4081,7 @@ namespace CalamityMod (TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.Calamity().CurrentCharge = currentCharge; } (TileEntity.ByID[entityID] as TEDraedonItemCharger).ActiveTimer = reader.ReadInt32(); + (TileEntity.ByID[entityID] as TEDraedonItemCharger).DepositWithdrawCooldown = reader.ReadInt32(); break; case CalamityModMessageType.DraedonFieldGeneratorSync: int entityID2 = reader.ReadInt32(); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index d449e43c63..d9d3805a90 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -64,7 +64,8 @@ namespace CalamityMod.Items public int CurrentCharge = ChargeMax; public bool Chargeable = false; public const int ChargeMax = 150; - public const float ChargeDamageMinMultiplier = 0.4f; + public const float ChargeDamageMinMultiplier = 0.75f; + public const float ChargeDamageReductionThreshold = 0.75f; // Rarity is provided both as the classic int and the new enum. public CalamityRarity customRarity = CalamityRarity.NoEffect; @@ -1005,7 +1006,11 @@ namespace CalamityMod.Items { if (item.Calamity().Chargeable) { - mult *= MathHelper.Lerp(ChargeDamageMinMultiplier, 1f, item.Calamity().CurrentCharge / (float)ChargeMax); + float chargeDamageMultiplier = 1f; + float chargeRatio = item.Calamity().CurrentCharge / (float)ChargeMax; + if (chargeRatio < ChargeDamageReductionThreshold) + chargeDamageMultiplier = MathHelper.Lerp(ChargeDamageMinMultiplier, 1f, chargeRatio * ChargeDamageReductionThreshold); + mult *= chargeDamageMultiplier; } } #endregion diff --git a/Items/Placeables/Furniture/AgedSecurityChest.cs b/Items/Placeables/Furniture/AgedSecurityChest.cs index 6e6cb968a8..ffd6e29272 100644 --- a/Items/Placeables/Furniture/AgedSecurityChest.cs +++ b/Items/Placeables/Furniture/AgedSecurityChest.cs @@ -6,6 +6,11 @@ namespace CalamityMod.Items.Placeables.Furniture { public class AgedSecurityChest : ModItem { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aged Security Chest"); + } + public override void SetDefaults() { item.width = 32; diff --git a/Items/Placeables/Furniture/HolographicDisplayBox.cs b/Items/Placeables/Furniture/HolographicDisplayBox.cs new file mode 100644 index 0000000000..406dd60c32 --- /dev/null +++ b/Items/Placeables/Furniture/HolographicDisplayBox.cs @@ -0,0 +1,31 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class HolographicDisplayBox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holographic Display Box"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = Item.buyPrice(0, 0, 0, 0); + item.rare = 3; + item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/HolographicDisplayBox.png b/Items/Placeables/Furniture/HolographicDisplayBox.png new file mode 100644 index 0000000000..2d02e4dcf3 Binary files /dev/null and b/Items/Placeables/Furniture/HolographicDisplayBox.png differ diff --git a/Items/Placeables/Furniture/SecurityChest.cs b/Items/Placeables/Furniture/SecurityChest.cs index 9f8916f70c..a0ddc56b21 100644 --- a/Items/Placeables/Furniture/SecurityChest.cs +++ b/Items/Placeables/Furniture/SecurityChest.cs @@ -5,6 +5,11 @@ namespace CalamityMod.Items.Placeables.Furniture { public class SecurityChest : ModItem { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Security Chest"); + } + public override void SetDefaults() { item.width = 32; diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 1539e60f55..a866d3301b 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; @@ -41,7 +42,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - item.useAmmo = AmmoID.Bullet; item.Calamity().Chargeable = true; } @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index ba0fabdf64..7f28c794fc 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -36,7 +36,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.shoot = ModContent.ProjectileType(); item.shootSpeed = 27f; - item.useAmmo = AmmoID.Bullet; item.Calamity().Chargeable = true; } diff --git a/Items/Weapons/DraedonsArsenal/LaserRifle.cs b/Items/Weapons/DraedonsArsenal/LaserRifle.cs index 1e78de8913..d2c508ab4c 100644 --- a/Items/Weapons/DraedonsArsenal/LaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/LaserRifle.cs @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.Calamity().customRarity = CalamityRarity.RareVariant; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; item.Calamity().Chargeable = true; } diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index 20e8094772..58b9821f26 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Mounted Scanner"); + Tooltip.SetDefault("Summons a powerful weapon above your head that fires lasers at nearby enemies"); } public override void SetDefaults() @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.width = 26; item.height = 26; item.summon = true; - item.damage = 27; + item.damage = 15; item.knockBack = 2f; item.useTime = item.useAnimation = 35; item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index bf6e2b6dd3..93e909c1cd 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.Calamity().customRarity = CalamityRarity.RareVariant; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; item.Calamity().Chargeable = true; } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 504b114588..77c4d48f1b 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Plasma Grenade"); - Tooltip.SetDefault("Throws a rolling barrel that explodes on wall collision\n" + - "Stealth strikes make it rain on collision"); + Tooltip.SetDefault("Throws a grenade that explodes into plasma on collision\n" + + "Stealth strikes explode violently on collision into a vaporizing blast"); } public override void SafeSetDefaults() diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 50a14fae93..6e7b579249 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { item.shootSpeed = 10f; - item.damage = 38; + item.damage = 33; item.mana = 12; item.width = 38; item.height = 24; diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 75f1696043..d6d5d93ca9 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -34,8 +34,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.rare = 3; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1.2f; // Keep in mind that the shot has extra updates. - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5.2f; // Keep in mind that the shot has extra updates. item.Calamity().Chargeable = true; } diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 15419e2443..a1caa6d4b9 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -41,8 +41,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.Calamity().customRarity = CalamityRarity.RareVariant; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; item.Calamity().Chargeable = true; } diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 8c7e89c90c..878d9da33a 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -12,12 +12,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Snake Eyes"); + Tooltip.SetDefault("Summons a mechanical watcher that zaps and flies around enemies."); } public override void SetDefaults() { item.shootSpeed = 10f; - item.damage = 15; + item.damage = 11; item.mana = 12; item.width = 38; item.height = 24; diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index 11ffadc655..716fef4d87 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Star Swallower Containment Unit"); + Tooltip.SetDefault("Summons a mechanical frog that vomits plasma onto enemies"); } public override void SetDefaults() diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 56bff229a9..0ec1167cba 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.Calamity().customRarity = CalamityRarity.RareVariant; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; item.Calamity().Chargeable = true; } diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 60cfd47a1c..ff64a9d489 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -75,8 +75,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal player.ActiveItem().Calamity().CurrentCharge--; } - // Consume 2 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.ActiveItem(), 2); float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value2 = vector; diff --git a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs index 301af5d985..a6a53ecaa2 100644 --- a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs +++ b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const int Lifetime = 25; public override void SetStaticDefaults() { - DisplayName.SetDefault("Laser Rifle"); + DisplayName.SetDefault("Plasma Explosion"); } public override void SetDefaults() diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index 00bf7eafe1..c9284e2c9e 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override void SetStaticDefaults() { - DisplayName.SetDefault("Snake Eyes"); + DisplayName.SetDefault("Pole Warper"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; ProjectileID.Sets.TrailingMode[projectile.type] = 0; diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.cs b/Projectiles/DraedonsArsenal/PulsePistolShot.cs index bd4fd4dd91..4aac3ce503 100644 --- a/Projectiles/DraedonsArsenal/PulsePistolShot.cs +++ b/Projectiles/DraedonsArsenal/PulsePistolShot.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.width = 16; projectile.height = 16; projectile.friendly = true; - projectile.sentry = true; + projectile.ranged = true; projectile.penetrate = 1; projectile.extraUpdates = 10; projectile.timeLeft = 120 * (1 + projectile.extraUpdates); diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index c6baa0a3dd..a07b35e816 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -78,7 +78,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 shootPosition = projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY); shootPosition += (projectile.Size * 0.5f).RotatedBy(projectile.rotation - MathHelper.ToRadians(18f) - (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi); - if (Math.Abs(Vector2.Normalize(potentialTarget.Center - shootPosition).ToRotation() - projectile.rotation) < MathHelper.ToRadians(32f) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi) + bool aimingAtTarget = Math.Abs(Vector2.Normalize(potentialTarget.Center - shootPosition).ToRotation() - projectile.rotation) < MathHelper.ToRadians(32f) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + if (aimingAtTarget || projectile.Distance(potentialTarget.Center) < 45f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"), shootPosition); Projectile.NewProjectile(shootPosition, diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index 4d2e0c9865..266d1cfa96 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; } public override void SetDefaults() @@ -198,6 +198,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal laser.timeLeft *= 2; laser.tileCollide = false; laser.netUpdate = true; + laser.Calamity().forceMinion = true; } projectile.ai[1]++; OldCenter = projectile.Center; diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 1114bca9e6..37048d129c 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -228,7 +228,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void NPCTargetingAI(NPC potentialTarget, Player player) { HandleHop(potentialTarget.Center); - if (Collision.CanHitLine(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, projectile.height) && AcidShootCooldown <= 0f) + if (Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, projectile.height) && AcidShootCooldown <= 0f) { AcidShootTimer++; ReleasingAcid = AcidShootTimer >= 16 && AcidShootTimer <= 44; @@ -240,12 +240,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Vector2 spawnPosition = projectile.Center + Vector2.UnitX * 8f * projectile.spriteDirection; - float shootSpeed = 9f; + float shootSpeed = 11f; float gravity = -StarSwallowerAcid.Gravity; float distance = Vector2.Distance(spawnPosition, potentialTarget.Center); float angle = 0.5f * (float)Math.Asin(MathHelper.Clamp(gravity * distance / (float)Math.Pow(shootSpeed, 2), -1f, 1f)); - Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.04f); + Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.015f); velocity.X *= (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X > 0).ToDirectionInt(); @@ -267,7 +267,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } else if (AcidShootCooldown > 0f) AcidShootCooldown--; - projectile.velocity.X *= 0.935f; + projectile.velocity.X *= 0.8f; } public void AntiStickyMovement(float antiStickAcceleration = 0.05f) { diff --git a/Projectiles/Enemy/DreadonLaser.cs b/Projectiles/Enemy/DraedonLaser.cs similarity index 98% rename from Projectiles/Enemy/DreadonLaser.cs rename to Projectiles/Enemy/DraedonLaser.cs index 2fc6dc9717..735763c9ca 100644 --- a/Projectiles/Enemy/DreadonLaser.cs +++ b/Projectiles/Enemy/DraedonLaser.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy { - public class DreadonLaser : ModProjectile + public class DraedonLaser : ModProjectile { public float TrailLength { diff --git a/Projectiles/Enemy/DreadonLaser.png b/Projectiles/Enemy/DraedonLaser.png similarity index 100% rename from Projectiles/Enemy/DreadonLaser.png rename to Projectiles/Enemy/DraedonLaser.png diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index bab9a8e5f7..f92b359ffe 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -9,22 +9,22 @@ using Terraria.ModLoader; namespace CalamityMod.TileEntities { - public class TEBaseTurret : ModTileEntity + public abstract class TEBaseTurret : ModTileEntity { public int Time; public int Direction; public float Rotation; - public virtual int TileType => ModContent.TileType(); - public virtual int ShootWaitTime => 15; - public virtual int ShootRate => 60; - public virtual int ProjectileDamage => 20; - public virtual float ShootSpeed => 5f; - public virtual float ShootSpawnOffset => 32f; - public virtual float ProjectileKnockback => 3f; public virtual float MaxAngleOffestShootPrompt => MathHelper.ToRadians(35f); - public virtual int ProjectileShot => ModContent.ProjectileType(); - public virtual Vector2 ShootCoordsOffset => new Vector2(22f + 4f * Direction, -2f); - public virtual float TargetDistanceCheck => 600f; + public abstract int ShootWaitTime { get; } + public abstract int ShootRate { get; } + public abstract int ProjectileDamage { get; } + public abstract float ShootSpeed { get; } + public abstract float ShootSpawnOffset { get; } + public abstract float ProjectileKnockback { get; } + public abstract int TileType { get; } + public abstract int ProjectileShot { get; } + public abstract Vector2 ShootCoordsOffset { get; } + public abstract float TargetDistanceCheck { get; } public void SyncTile() { NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); diff --git a/TileEntities/TEDraedonFieldGenerator.cs b/TileEntities/TEDraedonFieldGenerator.cs index 32c0a30b66..4126d7a4d2 100644 --- a/TileEntities/TEDraedonFieldGenerator.cs +++ b/TileEntities/TEDraedonFieldGenerator.cs @@ -27,19 +27,19 @@ namespace CalamityMod.TileEntities ActiveTimer++; Time++; - if (Time % 20 == 19) + if (Time % 40 == 39) { float speed = 5f; Vector2 aimOffset = (player.velocity + player.oldVelocity) * 0.5f * player.Distance(positionWorldCoords) / (speed * speed); Vector2 velocity = Vector2.Normalize(player.Center - positionWorldCoords + aimOffset) * speed; - Projectile.NewProjectileDirect(positionWorldCoords, velocity, ModContent.ProjectileType(), 40, 4f); + Projectile.NewProjectileDirect(positionWorldCoords, velocity, ModContent.ProjectileType(), 27, 4f); } - if (Time % 75 == 74) + if (Time % 95 == 94) { for (int i = 0; i < 9; i++) { float angle = i / 9f * MathHelper.TwoPi; - Projectile.NewProjectileDirect(positionWorldCoords, Vector2.Normalize(player.Center - positionWorldCoords).RotatedBy(angle) * 7f, ModContent.ProjectileType(), 40, 4f); + Projectile.NewProjectileDirect(positionWorldCoords, Vector2.Normalize(player.Center - positionWorldCoords).RotatedBy(angle) * 7f, ModContent.ProjectileType(), 27, 4f); } } } diff --git a/TileEntities/TEDraedonTurret.cs b/TileEntities/TEDraedonTurret.cs index 0fd19ff751..5308f62065 100644 --- a/TileEntities/TEDraedonTurret.cs +++ b/TileEntities/TEDraedonTurret.cs @@ -1,9 +1,21 @@ +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles; using Microsoft.Xna.Framework; +using Terraria.ModLoader; namespace CalamityMod.TileEntities { public class TEDraedonTurret : TEBaseTurret { - // Literally nothing is needed in here. The base code is suited to fit this particular turret type. + public override int ShootWaitTime => 15; + public override int ShootRate => 60; + public override int ProjectileDamage => 20; + public override float ShootSpeed => 5f; + public override float ShootSpawnOffset => 32f; + public override float ProjectileKnockback => 3f; + public override int TileType => ModContent.TileType(); + public override int ProjectileShot => ModContent.ProjectileType(); + public override Vector2 ShootCoordsOffset => new Vector2(22f + 4f * Direction, -2f); + public override float TargetDistanceCheck => 600f; } } diff --git a/Tiles/DraedonFuelFactory.cs b/Tiles/DraedonFuelFactory.cs index 6e344a6505..64f8205019 100644 --- a/Tiles/DraedonFuelFactory.cs +++ b/Tiles/DraedonFuelFactory.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -131,5 +132,23 @@ namespace CalamityMod.Tiles Recipe.FindRecipes(); return true; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Tile trackTile = Main.tile[i, j]; + xPos += Main.tileFrame[trackTile.type] / 15 * 64; + yPos += Main.tileFrame[trackTile.type] % 15 * 68; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonFuelFactory"); + Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; + Color drawColor = Lighting.GetColor(i, j); + + if (!trackTile.halfBrick() && trackTile.slope() == 0) + spriteBatch.Draw(glowmask, drawOffset, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.halfBrick()) + spriteBatch.Draw(glowmask, drawOffset + Vector2.UnitY * 8f, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + return false; + } } } diff --git a/Tiles/DraedonFuelFactory.png b/Tiles/DraedonFuelFactory.png index a1663c61e9..eddd1360b3 100644 Binary files a/Tiles/DraedonFuelFactory.png and b/Tiles/DraedonFuelFactory.png differ diff --git a/Tiles/DraedonHologram.cs b/Tiles/DraedonHologram.cs index ae12765624..fdd4fe1e02 100644 --- a/Tiles/DraedonHologram.cs +++ b/Tiles/DraedonHologram.cs @@ -4,6 +4,7 @@ using Terraria.ModLoader; using Terraria.ID; using Terraria.ObjectData; using Terraria.DataStructures; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles { @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles public bool CloseToPlayer = false; public const int Width = 6; public const int Height = 7; - public const int IdleFrames = 7; + public const int IdleFrames = 8; public const int TalkingFrames = 8; public const int FrameCount = IdleFrames + TalkingFrames; public override void SetDefaults() @@ -21,7 +22,7 @@ namespace CalamityMod.Tiles Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); TileObjectData.newTile.Height = 7; - TileObjectData.newTile.Origin = new Point16(2, 6); + TileObjectData.newTile.Origin = new Point16(3, 6); TileObjectData.newTile.CoordinateHeights = new int[TileObjectData.newTile.Height]; TileObjectData.newTile.CoordinatePadding = 0; for (int i = 0; i < TileObjectData.newTile.CoordinateHeights.Length; i++) @@ -32,6 +33,7 @@ namespace CalamityMod.Tiles animationFrameHeight = 112; soundType = SoundID.Tink; + dustType = 229; minPick = 100; AddMapEntry(new Color(99, 131, 199)); } @@ -46,8 +48,8 @@ namespace CalamityMod.Tiles frame++; if (frame >= (!CloseToPlayer ? 5 : FrameCount)) { - if (!CloseToPlayer && frame > 7) - frame = 6; + if (!CloseToPlayer && frame > 8) + frame = 7; else frame = !CloseToPlayer ? 0 : TalkingFrames; } @@ -70,5 +72,23 @@ namespace CalamityMod.Tiles } return true; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Tile trackTile = Main.tile[i, j]; + xPos += Main.tileFrame[trackTile.type] / 8 * 96; + yPos += Main.tileFrame[trackTile.type] % 8 * 112; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonHologram"); + Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; + Color drawColor = Lighting.GetColor(i, j); + + if (!trackTile.halfBrick() && trackTile.slope() == 0) + spriteBatch.Draw(glowmask, drawOffset, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.halfBrick()) + spriteBatch.Draw(glowmask, drawOffset + Vector2.UnitY * 8f, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + return false; + } } } diff --git a/Tiles/DraedonHologram.png b/Tiles/DraedonHologram.png index 996914de03..5e33cfac6e 100644 Binary files a/Tiles/DraedonHologram.png and b/Tiles/DraedonHologram.png differ diff --git a/UI/DraedonsItemChargerUI.cs b/UI/DraedonsItemChargerUI.cs index 511c20d966..41620446b1 100644 --- a/UI/DraedonsItemChargerUI.cs +++ b/UI/DraedonsItemChargerUI.cs @@ -35,7 +35,7 @@ namespace CalamityMod.UI bool cooldownComplete = depositWithdrawCooldown == 0; if (Main.netMode != NetmodeID.SinglePlayer) { - cooldownComplete = Main.time % 5 == 0; + cooldownComplete = Main.time % 7 == 0; } if (mouseRectangle.Intersects(FuelIconBounds) && fuel.stack > 0) Main.HoverItem = fuel.Clone(); diff --git a/UI/DraedonsLogUI.cs b/UI/DraedonsLogUI.cs index 0db909d24d..d85bc3492a 100644 --- a/UI/DraedonsLogUI.cs +++ b/UI/DraedonsLogUI.cs @@ -13,8 +13,8 @@ namespace CalamityMod.UI public int Page = 0; public int ArrowClickCooldown; public bool HoveringOverBook = false; - public const int TextStartOffsetX = 40; public const int TotalLinesPerPage = 16; + public const int TextStartOffsetX = 40; public override void Update() { if (Active) @@ -75,6 +75,7 @@ namespace CalamityMod.UI if (FadeTime >= FadeTimeMax - 4 && Active) { int textWidth = (int)(xScale * 2 * pageTexture.Width) - TextStartOffsetX; + textWidth = (int)(textWidth * Main.screenWidth / 2560f); List dialogLines = Utils.WordwrapString(placeholderText, Main.fontMouseText, textWidth, 250, out _).ToList(); dialogLines.RemoveAll(text => string.IsNullOrEmpty(text)); @@ -143,12 +144,12 @@ namespace CalamityMod.UI bool onNextPage = i - startingLine > TotalLinesPerPage; if (dialogLines[i] != null) { - int textDrawPositionX = Main.screenWidth / 2 - pageTexture.Width * 2 - TextStartOffsetX; - int textDrawPositionY = 50 + (i - startingLine) * 24 + (int)yPageTop; + int textDrawPositionX = Main.screenWidth / 2 - (int)((pageTexture.Width * 2) * Main.screenWidth / 2560f); + int textDrawPositionY = (int)(50 + (i - startingLine) * 24 * Main.screenHeight / 1440f) + (int)yPageTop; if (onNextPage) { - textDrawPositionX = Main.screenWidth / 2 + (int)(TextStartOffsetX * 1.5); - textDrawPositionY = 50 + (i - startingLine - (TotalLinesPerPage + 1)) * 24 + (int)yPageTop; + textDrawPositionX = Main.screenWidth / 2 + (int)(TextStartOffsetX * 1.5 * Main.screenWidth / 2560f); + textDrawPositionY = (int)(50 + (i - startingLine - (TotalLinesPerPage + 1)) * 24 * Main.screenHeight / 1440f) + (int)yPageTop; } Color drawColor = Color.Lerp(Color.Cyan, Color.DarkCyan, (float)Math.Cos(i * 0.4) * 0.5f + 0.5f); diff --git a/UI/PopupGUIManager.cs b/UI/PopupGUIManager.cs index abfee0bd6d..7f58903d74 100644 --- a/UI/PopupGUIManager.cs +++ b/UI/PopupGUIManager.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using System.Linq; +using Terraria; namespace CalamityMod.UI { @@ -14,11 +15,20 @@ namespace CalamityMod.UI public static void SuspendAll() { DraedonLogGUI.Active = false; + DraedonLogGUI.FadeTime = 0; } public static void UpdateAndDraw(SpriteBatch spriteBatch) { + if (Main.ingameOptionsWindow || Main.inFancyUI) + { + SuspendAll(); + return; + } if (AnyGUIsActive) { + Main.playerInventory = false; + if (Main.LocalPlayer.sign > 0 || Main.LocalPlayer.talkNPC > 0) + Main.CloseNPCChatOrSign(); GetActiveGUI.Update(); if (GetActiveGUI == null) return; diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 9bdd735350..cf29374c75 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -904,15 +904,20 @@ namespace CalamityMod.World })); - tasks.Insert(FinalIndex + 3, new PassLegacy("DraedonThings", (GenerationProgress progress) => + tasks.Insert(FinalIndex + 3, new PassLegacy("Rust and Dust", (GenerationProgress progress) => { List workshopPositions = new List(); - for (int i = 0; i < 10; i++) + int workshopCount = Main.maxTilesX / 600; + int labCount = Main.maxTilesX / 1100; + DraedonStructures.DraedonsLogWorkshopIndex = WorldGen.genRand.Next(workshopCount); + + for (int i = 0; i < workshopCount; i++) { DraedonStructures.PlaceWorkshop(out Point placementPosition, workshopPositions); + DraedonStructures.CurrentWorkshopIndex = i; workshopPositions.Add(placementPosition); } - for (int i = 0; i < 4; i++) + for (int i = 0; i < labCount; i++) { DraedonStructures.PlacePlagueLab(out Point placementPosition2, workshopPositions); workshopPositions.Add(placementPosition2); diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 5895edb45c..5eb9c57144 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -22,10 +22,11 @@ namespace CalamityMod.World } public static class DraedonStructures { - public static bool DraedonsLogPresentInWorld = false; + public static int CurrentWorkshopIndex; + public static int DraedonsLogWorkshopIndex; public static void FillWorkshopChest(Chest chest) { - int potionType = Utils.SelectRandom(Main.rand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); List contents = new List() { new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(8, 14 + 1)), @@ -36,11 +37,8 @@ namespace CalamityMod.World new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; - if (!DraedonsLogPresentInWorld) - { + if (CurrentWorkshopIndex == DraedonsLogWorkshopIndex) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - DraedonsLogPresentInWorld = true; - } for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -49,7 +47,7 @@ namespace CalamityMod.World } public static void FillLaboratoryChest(Chest chest) { - int potionType = Utils.SelectRandom(Main.rand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); List contents = new List() { new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(10, 17 + 1)), @@ -66,6 +64,31 @@ namespace CalamityMod.World chest.item[i].stack = contents[i].Stack; } } + public static bool ShouldAvoidLocation(Point placementPoint) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(placementPoint.X, placementPoint.Y); + if (tile.lava()) + return true; + if (tile.type == TileID.BlueDungeonBrick || + tile.type == TileID.GreenDungeonBrick || + tile.type == TileID.PinkDungeonBrick) + { + return true; + } + if (tile.type == TileID.LihzahrdBrick || + tile.wall == WallID.LihzahrdBrickUnsafe) + { + return true; + } + if (tile.type == TileID.Crimstone || + tile.wall == WallID.CrimstoneUnsafe || + tile.type == TileID.Ebonstone || + tile.wall == WallID.EbonstoneUnsafe) + { + return true; + } + return false; + } public static void PlaceWorkshop(out Point placementPoint, List workshopPoints) { int tries = 0; @@ -79,8 +102,7 @@ namespace CalamityMod.World Vector2 schematicSize = new Vector2(SchematicLoader.TileMaps["Workshop"].GetLength(0), SchematicLoader.TileMaps["Workshop"].GetLength(1)); int activeTilesInArea = 0; int xCheckArea = 40; - bool anyDungeonBricks = false; - bool anyLihzardBricks = false; + bool canGenerateInLocation = true; // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); @@ -92,25 +114,16 @@ namespace CalamityMod.World Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (tile.active()) { - if (tile.type == TileID.BlueDungeonBrick || - tile.type == TileID.GreenDungeonBrick || - tile.type == TileID.PinkDungeonBrick) - { - anyDungeonBricks = true; - } - if (tile.type == TileID.LihzahrdBrick || - tile.wall == WallID.LihzahrdBrickUnsafe) - { - anyLihzardBricks = true; - } + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; activeTilesInArea++; } } } - if (anyDungeonBricks || anyLihzardBricks || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) + if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) { tries++; - if (tries > 2500) + if (tries > 25000) return; goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) } @@ -129,8 +142,7 @@ namespace CalamityMod.World Vector2 schematicSize = new Vector2(SchematicLoader.TileMaps["Plague Research Facility"].GetLength(0), SchematicLoader.TileMaps["Plague Research Facility"].GetLength(1)); int activeTilesInArea = 0; int xCheckArea = 30; - bool anyDungeonBricks = false; - bool anyLihzardBricks = false; + bool canGenerateInLocation = true; // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); @@ -142,25 +154,16 @@ namespace CalamityMod.World Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (tile.active()) { - if (tile.type == TileID.BlueDungeonBrick || - tile.type == TileID.GreenDungeonBrick || - tile.type == TileID.PinkDungeonBrick) - { - anyDungeonBricks = true; - } - if (tile.type == TileID.LihzahrdBrick || - tile.wall == WallID.LihzahrdBrickUnsafe) - { - anyLihzardBricks = true; - } + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; activeTilesInArea++; } } } - if (anyLihzardBricks || anyDungeonBricks || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.3f) + if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) { tries++; - if (tries > 6000) + if (tries > 25000) return; goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) }