Merge pull request #113 from UncleDanny/draedons-arsenal-content

Updates and rebalances to Draedon's Arsenal content
This commit is contained in:
Cameron Ewell authored and GitHub committed 2020-07-18 22:10:46 -04:00
commit 9bc535a673
39 files changed
+217 -103

No files matched your search

+6 -5
View File
@@ -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();
+7 -2
View File
@@ -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
@@ -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;
@@ -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<DraedonHologram>();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

@@ -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;
@@ -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<GatlingLaserProj>();
item.shootSpeed = 24f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
@@ -72,7 +72,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 15);
recipe.AddIngredient(ModContent.ItemType<AuricBar>(), 5);
recipe.AddIngredient(ModContent.ItemType<LaserRifle>());
recipe.AddIngredient(ItemID.LaserMachinegun);
recipe.AddIngredient(ModContent.ItemType<T1000>());
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
@@ -36,7 +36,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.shoot = ModContent.ProjectileType<GaussRifleBlast>();
item.shootSpeed = 27f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
+1 -2
View File
@@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.Calamity().customRarity = CalamityRarity.RareVariant;
item.shoot = ModContent.ProjectileType<LaserRifleShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.shootSpeed = 5f;
item.Calamity().Chargeable = true;
}
@@ -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;
@@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.Calamity().customRarity = CalamityRarity.RareVariant;
item.shoot = ModContent.ProjectileType<PlasmaCasterShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.shootSpeed = 5f;
item.Calamity().Chargeable = true;
}
@@ -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()
+1 -1
View File
@@ -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;
+1 -2
View File
@@ -34,8 +34,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.rare = 3;
item.shoot = ModContent.ProjectileType<PulseRifleShot>();
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;
}
+1 -2
View File
@@ -41,8 +41,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.Calamity().customRarity = CalamityRarity.RareVariant;
item.shoot = ModContent.ProjectileType<PulseRifleShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.shootSpeed = 5f;
item.Calamity().Chargeable = true;
}
+2 -1
View File
@@ -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;
@@ -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()
+1 -2
View File
@@ -40,8 +40,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.Calamity().customRarity = CalamityRarity.RareVariant;
item.shoot = ModContent.ProjectileType<TeslaCannonShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.shootSpeed = 5f;
item.Calamity().Chargeable = true;
}
@@ -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;
@@ -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()
@@ -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;
@@ -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);
+2 -1
View File
@@ -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,
@@ -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;
@@ -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)
{
@@ -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
{
File renamed without changes.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

+11 -11
View File
@@ -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<DraedonTurretTile>();
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<DreadonLaser>();
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);
+4 -4
View File
@@ -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<DreadonLaser>(), 40, 4f);
Projectile.NewProjectileDirect(positionWorldCoords, velocity, ModContent.ProjectileType<DraedonLaser>(), 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<DreadonLaser>(), 40, 4f);
Projectile.NewProjectileDirect(positionWorldCoords, Vector2.Normalize(player.Center - positionWorldCoords).RotatedBy(angle) * 7f, ModContent.ProjectileType<DraedonLaser>(), 27, 4f);
}
}
}
+13 -1
View File
@@ -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<DraedonTurretTile>();
public override int ProjectileShot => ModContent.ProjectileType<DraedonLaser>();
public override Vector2 ShootCoordsOffset => new Vector2(22f + 4f * Direction, -2f);
public override float TargetDistanceCheck => 600f;
}
}
+19
View File
@@ -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;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

+24 -4
View File
@@ -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;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

+1 -1
View File
@@ -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();
+6 -5
View File
@@ -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<string> 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);
+10
View File
@@ -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;
+8 -3
View File
@@ -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<Point> workshopPositions = new List<Point>();
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);
+40 -37
View File
@@ -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<ChestItem> contents = new List<ChestItem>()
{
new ChestItem(ModContent.ItemType<DubiousPlating>(), 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<DraedonsLog>(), 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<ChestItem> contents = new List<ChestItem>()
{
new ChestItem(ModContent.ItemType<DubiousPlating>(), 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<Point> 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)
}