21 files changed
+116
-47
No files matched your search
@@ -25,16 +25,16 @@ namespace CalamityMod.DataStructures
|
||||
|
||||
private Vector2 PrivateEvaluate(Vector2[] points, float T)
|
||||
{
|
||||
if (points.Length > 2)
|
||||
while (points.Length > 2)
|
||||
{
|
||||
Vector2[] nextPoints = new Vector2[points.Length - 1];
|
||||
for (int k = 0; k < points.Length - 1; k++)
|
||||
nextPoints[k] = Vector2.Lerp(points[k], points[k + 1], T);
|
||||
|
||||
return PrivateEvaluate(nextPoints, T);
|
||||
points = nextPoints;
|
||||
}
|
||||
else
|
||||
return Vector2.Lerp(points[0], points[1], T);
|
||||
|
||||
return Vector2.Lerp(points[0], points[1], T);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,10 @@ namespace CalamityMod.DataStructures
|
||||
OldDirection = direction;
|
||||
}
|
||||
|
||||
Rotation = (aheadPosition - Center).ToRotation();
|
||||
Center = aheadPosition - (aheadPosition - Center).SafeNormalize(Vector2.Zero) * 24f;
|
||||
Vector2 offsetDirection = (aheadPosition - Center).SafeNormalize(Vector2.Zero);
|
||||
offsetDirection = offsetDirection.ToRotation().AngleTowards(idealRotation, 0.2f).ToRotationVector2();
|
||||
Rotation = offsetDirection.ToRotation();
|
||||
Center = aheadPosition - offsetDirection * 20f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,7 +501,7 @@ namespace CalamityMod.ILEditing
|
||||
private static void ManipulateSoundMuffleFactor(ILContext il)
|
||||
{
|
||||
ILCursor cursor = new ILCursor(il);
|
||||
cursor.GotoNext(MoveType.Before, i => i.MatchStloc(30));
|
||||
cursor.GotoNext(MoveType.After, i => i.MatchStloc(20));
|
||||
|
||||
cursor.Emit(OpCodes.Ldloc, 20);
|
||||
cursor.EmitDelegate<Func<float, float>>(originalMuffleFactor =>
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace CalamityMod.Items
|
||||
#endregion
|
||||
|
||||
#region Enchantment Variables
|
||||
public bool CannotBeEnchanted = false;
|
||||
public Enchantment? AppliedEnchantment = null;
|
||||
public float DischargeEnchantExhaustion = 0;
|
||||
public float DischargeExhaustionRatio
|
||||
@@ -627,6 +628,10 @@ namespace CalamityMod.Items
|
||||
case ItemID.StarCannon:
|
||||
item.UseSound = null;
|
||||
break;
|
||||
|
||||
case ItemID.EoCShield:
|
||||
CannotBeEnchanted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (CalamityLists.quadrupleDamageBuffList?.Contains(item.type) ?? false)
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -139,8 +140,12 @@ namespace CalamityMod.Items.Mounts.Minecarts
|
||||
Color segmentColor = Lighting.GetColor((int)segmentDrawPosition.X / 16, (int)segmentDrawPosition.Y / 16);
|
||||
Vector2 origin = segmentTexture.Size() * 0.5f;
|
||||
float segmentRotation = segment.Rotation - DelegateMethods.Minecart.rotation;
|
||||
DrawData segmentDrawData = new DrawData(segmentTexture, segmentDrawPosition - Main.screenPosition, null, segmentColor, segmentRotation, origin, Vector2.One, SpriteEffects.None, 0)
|
||||
{
|
||||
shader = Mount.currentShader
|
||||
};
|
||||
|
||||
playerDrawData.Add(new DrawData(segmentTexture, segmentDrawPosition - Main.screenPosition, null, segmentColor, segmentRotation, origin, Vector2.One, SpriteEffects.None, 0));
|
||||
playerDrawData.Add(segmentDrawData);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
item.shoot = ModContent.ProjectileType<GiantIbanRobotOfDoom>();
|
||||
item.shootSpeed = 10f;
|
||||
item.summon = true;
|
||||
item.Calamity().CannotBeEnchanted = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -31,6 +32,7 @@ namespace CalamityMod.Items.Weapons.Typeless
|
||||
item.value = CalamityGlobalItem.Rarity11BuyPrice;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.shoot = ModContent.ProjectileType<RelicOfDeliveranceSpear>();
|
||||
item.Calamity().CannotBeEnchanted = true;
|
||||
}
|
||||
|
||||
// Terraria seems to really dislike high crit values in SetDefaults
|
||||
|
||||
+30
-10
@@ -251,8 +251,11 @@ namespace CalamityMod.NPCs
|
||||
// 4 - Check if malice is active and Boss Rush isn't. If so, set this to true.
|
||||
public bool CurrentlyEnraged;
|
||||
|
||||
// Collections
|
||||
public static SortedDictionary<int, int> BossRushHPChanges = new SortedDictionary<int, int>
|
||||
// Other Boss Rush stuff
|
||||
public bool DoesNotDisappearInBossRush;
|
||||
|
||||
// Collections
|
||||
public static SortedDictionary<int, int> BossRushHPChanges = new SortedDictionary<int, int>
|
||||
{
|
||||
// Tier 1
|
||||
{ NPCID.QueenBee, 315000 }, // 30 seconds
|
||||
@@ -2109,7 +2112,7 @@ namespace CalamityMod.NPCs
|
||||
if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type))
|
||||
npc.buffImmune[BuffType<Enraged>()] = false;
|
||||
|
||||
if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC)
|
||||
if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC && !npc.Calamity().DoesNotDisappearInBossRush)
|
||||
BossRushForceDespawnOtherNPCs(npc, mod);
|
||||
|
||||
if (NPC.LunarApocalypseIsUp)
|
||||
@@ -2860,6 +2863,9 @@ namespace CalamityMod.NPCs
|
||||
#region Boss Rush Force Despawn Other NPCs
|
||||
private void BossRushForceDespawnOtherNPCs(NPC npc, Mod mod)
|
||||
{
|
||||
if (BossRushEvent.BossRushStage >= BossRushEvent.Bosses.Count)
|
||||
return;
|
||||
|
||||
if (!BossRushEvent.Bosses[BossRushEvent.BossRushStage].HostileNPCsToNotDelete.Contains(npc.type))
|
||||
{
|
||||
npc.active = false;
|
||||
@@ -3392,17 +3398,31 @@ namespace CalamityMod.NPCs
|
||||
// Bullseyes are visually larger on bosses, so account for that.
|
||||
float baseBullseyeRadius = npc.IsABoss() ? 116f : 54f;
|
||||
bool hasCollidedWithBullseye;
|
||||
|
||||
// Custom math to determine if a direction would hit a target if the hitbox would not delete the projectile before it can.
|
||||
// This can be visualized as using the NPC center as an anchor point, determining the direction to the bullseye from that anchor point,
|
||||
// calculating the maximum amount of angular error there can be before a hit would not happen, and checking if the projectile's direction
|
||||
// to the bullseye is within that margin of error.
|
||||
if (projectile.penetrate <= 1 && projectile.penetrate != -1)
|
||||
hasCollidedWithBullseye = projectile.WithinRange(bullseye.Center, bullseye.scale * baseBullseyeRadius);
|
||||
else
|
||||
{
|
||||
// Directions to the bullseye relative to the NPC's center and the projectile that hit the NPC.
|
||||
Vector2 directionToBullseye = projectile.SafeDirectionTo(bullseye.Center, Vector2.UnitY);
|
||||
Vector2 orthogonalEdgeOffset = Vector2.UnitX.RotatedBy(directionToBullseye.ToRotation() + MathHelper.PiOver2) * baseBullseyeRadius;
|
||||
Vector2 edgeVector = projectile.Center - bullseye.Center + orthogonalEdgeOffset;
|
||||
float inaccuracyLimit = directionToBullseye.AngleBetween(edgeVector);
|
||||
float orthogonalityToIdealDirection = directionToBullseye.AngleBetween(projectile.velocity);
|
||||
hasCollidedWithBullseye = orthogonalityToIdealDirection < inaccuracyLimit && projectile.WithinRange(bullseye.Center, bullseye.scale * baseBullseyeRadius);
|
||||
Vector2 bullseyeCenterOffsetDirection = npc.SafeDirectionTo(bullseye.Center);
|
||||
|
||||
// Use SOH-CAH-TOA to compute the angle which is needed to reach the edge of the bullseye from the center of the NPC.
|
||||
// The length of the hypotenuse is the distance from the center of the NPC to the bullseye while the opposite side length is
|
||||
// the circular hitbox radius of the bullseye. These are sufficient to calculate the angular margin of error.
|
||||
// If an NPC has a tiny hitbox the arcsine will fail and return NaN, meaning any hit at all will cause a bullseye to be hit.
|
||||
// In these cases, simply set the "limit" to an extremely large value.
|
||||
float angularOffsetToEdgeOfBullseye = (float)Math.Asin(baseBullseyeRadius / npc.Distance(bullseye.Center));
|
||||
if (float.IsNaN(angularOffsetToEdgeOfBullseye))
|
||||
angularOffsetToEdgeOfBullseye = 1000f;
|
||||
float orthogonalityToBullseye = directionToBullseye.AngleBetween(bullseyeCenterOffsetDirection);
|
||||
|
||||
hasCollidedWithBullseye = orthogonalityToBullseye < angularOffsetToEdgeOfBullseye;
|
||||
}
|
||||
else
|
||||
hasCollidedWithBullseye = projectile.WithinRange(bullseye.Center, bullseye.scale * baseBullseyeRadius);
|
||||
|
||||
// Do a very high amount of damage if hitting a bullseye.
|
||||
if (hasCollidedWithBullseye && bullseye.ai[1] == 0f)
|
||||
|
||||
@@ -33,7 +33,9 @@ namespace CalamityMod.NPCs.Other
|
||||
npc.knockBackResist = 0f;
|
||||
npc.netAlways = true;
|
||||
npc.aiStyle = -1;
|
||||
npc.canGhostHeal = false;
|
||||
npc.Calamity().DoesNotGenerateRage = true;
|
||||
npc.Calamity().DoesNotDisappearInBossRush = true;
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 181445;
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.Other
|
||||
npc.knockBackResist = 0f;
|
||||
npc.netAlways = true;
|
||||
npc.aiStyle = 0;
|
||||
npc.Calamity().DoesNotDisappearInBossRush = true;
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 101010;
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace CalamityMod.NPCs.Other
|
||||
npc.knockBackResist = 0f;
|
||||
npc.netAlways = true;
|
||||
npc.aiStyle = -1;
|
||||
npc.Calamity().DoesNotGenerateRage = true;
|
||||
npc.Calamity().DoesNotDisappearInBossRush = true;
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 24660;
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace CalamityMod.NPCs.Other
|
||||
npc.netAlways = true;
|
||||
npc.aiStyle = -1;
|
||||
npc.Calamity().DoesNotGenerateRage = true;
|
||||
npc.Calamity().DoesNotDisappearInBossRush = true;
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 51740;
|
||||
|
||||
@@ -2255,7 +2255,7 @@ namespace CalamityMod.Projectiles
|
||||
}
|
||||
}
|
||||
|
||||
if (modPlayer.flamingItemEnchant && !projectile.minion)
|
||||
if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj)
|
||||
target.AddBuff(BuffType<VulnerabilityHex>(), 420);
|
||||
|
||||
if (modPlayer.farProximityRewardEnchant)
|
||||
|
||||
@@ -150,6 +150,9 @@ namespace CalamityMod.Projectiles.Summon
|
||||
// Direction affecting.
|
||||
if (target.Center.X - spawnPosition.X < 0)
|
||||
fireAngle += MathHelper.Pi;
|
||||
if (projectile.direction == (target.Center.X < spawnPosition.X).ToDirectionInt())
|
||||
fireAngle += MathHelper.Pi;
|
||||
|
||||
idealRotation = fireAngle;
|
||||
|
||||
// Shoot the actual canister.
|
||||
|
||||
@@ -152,7 +152,9 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
Vector2 spawnPosition = Target.Center + Vector2.UnitY.RotatedByRandom(0.27f) * 1150f;
|
||||
Vector2 shootVelocity = (Target.Center - spawnPosition).SafeNormalize(-Vector2.UnitY).RotatedByRandom(0.09f) * Main.rand.NextFloat(19f, 31f);
|
||||
Projectile.NewProjectile(spawnPosition, shootVelocity, rng.Get(), projectile.damage, projectile.knockBack, projectile.owner);
|
||||
int soul = Projectile.NewProjectile(spawnPosition, shootVelocity, rng.Get(), projectile.damage, projectile.knockBack, projectile.owner);
|
||||
if (Main.projectile.IndexInRange(soul))
|
||||
Main.projectile[soul].Calamity().forceMinion = true;
|
||||
}
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace CalamityMod.Skies
|
||||
if (draedon == -1 || !Main.npc[draedon].active)
|
||||
return Draedon.ExoMechIsPresent;
|
||||
|
||||
if (Main.npc[draedon].ModNPC<Draedon>().DefeatTimer <= 0 && !Draedon.ExoMechIsPresent)
|
||||
if ((Main.npc[draedon]?.ModNPC<Draedon>()?.DefeatTimer ?? 0) <= 0 && !Draedon.ExoMechIsPresent)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace CalamityMod.TileEntities
|
||||
DecryptionCountdown--;
|
||||
|
||||
// Gradually consume cells.
|
||||
if (DecryptionCountdown % 5 == 4)
|
||||
if (DecryptionCountdown % 5 == 0)
|
||||
{
|
||||
InputtedCellCount = InitialCellCountBeforeDecrypting - (int)(DecryptionCellCost * DecryptionCompletion);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace CalamityMod.UI.CalamitasEnchants
|
||||
if (!Main.npc.IndexInRange(NPCIndex) || !Main.npc[NPCIndex].active)
|
||||
return false;
|
||||
|
||||
Rectangle validTalkArea = Utils.CenteredRectangle(Main.LocalPlayer.Center, new Vector2(Player.tileRangeX * 2f, Player.tileRangeY) * 16f);
|
||||
Rectangle validTalkArea = Utils.CenteredRectangle(Main.LocalPlayer.Center, new Vector2(Player.tileRangeX * 3f, Player.tileRangeY * 2f) * 16f);
|
||||
return validTalkArea.Intersects(Main.npc[NPCIndex].Hitbox);
|
||||
}
|
||||
|
||||
|
||||
@@ -155,14 +155,14 @@ namespace CalamityMod.UI.CalamitasEnchants
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant",
|
||||
null,
|
||||
player => player.Calamity().cursedSummonsEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.summon),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.summon),
|
||||
|
||||
new Enchantment("Aflame", "Lights enemies ablaze on hit but also causes the user to take damage over time when holding this item.",
|
||||
200,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame",
|
||||
null,
|
||||
player => player.Calamity().flamingItemEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && !item.summon),
|
||||
item => item.IsEnchantable() && item.damage > 0 && !item.summon),
|
||||
|
||||
new Enchantment("Oblatory", "Reduces mana cost and greatly increases damage but sometimes causes this item to use your life.",
|
||||
300,
|
||||
@@ -173,35 +173,35 @@ namespace CalamityMod.UI.CalamitasEnchants
|
||||
item.mana = (int)Math.Ceiling(item.mana * 0.6);
|
||||
},
|
||||
player => player.Calamity().lifeManaEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.magic && item.mana > 0),
|
||||
|
||||
new Enchantment("Resentful", "Makes the damage of projectiles vary based on how far the hit target is from you. The farther, the more damage, and vice versa.",
|
||||
400,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful",
|
||||
null,
|
||||
player => player.Calamity().farProximityRewardEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None),
|
||||
|
||||
new Enchantment("Bloodthirsty", "Makes the damage of projectiles vary based on how far the hit target is from you. The closer, the more damage, and vice versa.",
|
||||
500,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty",
|
||||
null,
|
||||
player => player.Calamity().closeProximityRewardEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None),
|
||||
|
||||
new Enchantment("Ephemeral", "Causes the damage output of this item to discharge from exhaustive use. Its damage returns naturally when not being used. It starts off with more damage than it normally would have.",
|
||||
600,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral",
|
||||
null,
|
||||
player => player.Calamity().dischargingItemEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && !item.summon),
|
||||
item => item.IsEnchantable() && item.damage > 0 && !item.summon),
|
||||
|
||||
new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.",
|
||||
700,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound",
|
||||
null,
|
||||
player => player.Calamity().explosiveMinionsEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.summon),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.summon),
|
||||
|
||||
new Enchantment("Tainted", "Removes projectile shooting capabilities of this item. In exchange, two skeletal arms are released on use that slice at the mouse position.",
|
||||
800,
|
||||
@@ -237,28 +237,28 @@ namespace CalamityMod.UI.CalamitasEnchants
|
||||
Main.projectile[blade].localAI[0] = -80f;
|
||||
}
|
||||
},
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None),
|
||||
|
||||
new Enchantment("Traitorous", "Causes this item to sometimes release a monster that hurts both you and enemies when you have less than 50% mana.",
|
||||
900,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous",
|
||||
null,
|
||||
player => player.Calamity().manaMonsterEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.magic && item.mana > 0),
|
||||
|
||||
new Enchantment("Withering", "You heal when hurt based on damage you've dealt. After being hurt, the weapon rapidly drains your life to deal massive damage.",
|
||||
1000,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered",
|
||||
null,
|
||||
player => player.Calamity().witheringWeaponEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && !item.summon),
|
||||
item => item.IsEnchantable() && item.damage > 0 && !item.summon),
|
||||
|
||||
new Enchantment("Persecuted", "When attacked, or over time, demon portals appear near you. If sufficiently damaged they are friendly; otherwise they attack you.",
|
||||
1100,
|
||||
"CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted",
|
||||
null,
|
||||
player => player.Calamity().persecutedEnchant = true,
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None),
|
||||
|
||||
new Enchantment("Lecherous", "Spawns a resilient brimstone orb that stays between you and your mouse that interferes with your homing weapons. It releases a bunch of hearts on death.",
|
||||
1200,
|
||||
@@ -288,7 +288,7 @@ namespace CalamityMod.UI.CalamitasEnchants
|
||||
CalamityNetcode.NewNPC_ClientSide(player.Center, orbType, player);
|
||||
}
|
||||
},
|
||||
item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None),
|
||||
item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.summon),
|
||||
};
|
||||
|
||||
// Special disenchantment thing. This is separated from the list on purpose.
|
||||
@@ -301,7 +301,7 @@ namespace CalamityMod.UI.CalamitasEnchants
|
||||
item.Calamity().AppliedEnchantment = null;
|
||||
item.Calamity().DischargeEnchantExhaustion = 0;
|
||||
},
|
||||
item => item.maxStack == 1 && item.shoot >= ProjectileID.None);
|
||||
item => item.IsEnchantable() && item.shoot >= ProjectileID.None);
|
||||
|
||||
ItemUpgradeRelationship = new Dictionary<int, int>()
|
||||
{
|
||||
|
||||
+11
-11
@@ -82,8 +82,8 @@ namespace CalamityMod.UI
|
||||
{
|
||||
if (canSummonDraedon)
|
||||
{
|
||||
costVerificationLocation.X -= 15f;
|
||||
summonButtonCenter.X += 15f;
|
||||
costVerificationLocation.X -= GeneralScale * 15f;
|
||||
summonButtonCenter.X += GeneralScale * 15f;
|
||||
}
|
||||
DrawCostVerificationButton(codebreakerTileEntity, costVerificationLocation);
|
||||
}
|
||||
@@ -91,16 +91,16 @@ namespace CalamityMod.UI
|
||||
else if (codebreakerTileEntity.DecryptionCountdown > 0)
|
||||
{
|
||||
if (!AwaitingCloseConfirmation)
|
||||
DisplayDecryptCancelButton(codebreakerTileEntity, costVerificationLocation - Vector2.UnitY * 30f);
|
||||
DisplayDecryptCancelButton(codebreakerTileEntity, costVerificationLocation - Vector2.UnitY * GeneralScale * 30f);
|
||||
else
|
||||
DisplayDecryptCancelButton(codebreakerTileEntity, textPanelCenter + Vector2.UnitY * 110f);
|
||||
DisplayDecryptCancelButton(codebreakerTileEntity, textPanelCenter + Vector2.UnitY * GeneralScale * 110f);
|
||||
}
|
||||
|
||||
if (canSummonDraedon)
|
||||
HandleDraedonSummonButton(codebreakerTileEntity, summonButtonCenter);
|
||||
|
||||
if (codebreakerTileEntity.DecryptionCountdown > 0 || AwaitingDecryptionTextClose)
|
||||
HandleDecryptionStuff(codebreakerTileEntity, backgroundTexture, backgroundTopLeft, schematicSlotDrawCenter + Vector2.UnitY * 80f);
|
||||
HandleDecryptionStuff(codebreakerTileEntity, backgroundTexture, backgroundTopLeft, schematicSlotDrawCenter + Vector2.UnitY * GeneralScale * 80f);
|
||||
if (codebreakerTileEntity.DecryptionCountdown > 0 && AwaitingCloseConfirmation)
|
||||
DrawDecryptCancelConfirmationText(textPanelCenter);
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace CalamityMod.UI
|
||||
spriteBatch.Draw(schematicIconBG, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconBG.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f);
|
||||
if (codebreakerTileEntity.HeldSchematicID != 0)
|
||||
spriteBatch.Draw(schematicIconTexture, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f);
|
||||
HandleSchematicSlotInteractions(codebreakerTileEntity, schematicSlotDrawCenter, cellTexture.Size());
|
||||
HandleSchematicSlotInteractions(codebreakerTileEntity, schematicSlotDrawCenter, cellTexture.Size() * GeneralScale);
|
||||
|
||||
// Create a temporary item for drawing purposes.
|
||||
// If cells are present, make the item reflect that.
|
||||
@@ -262,11 +262,11 @@ namespace CalamityMod.UI
|
||||
|
||||
// And draw the cells to the right of the text.
|
||||
Texture2D cellTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/PowerCell");
|
||||
Vector2 offsetDrawPosition = new Vector2(drawPosition.X + ChatManager.GetStringSize(Main.fontMouseText, text, Vector2.One, -1f).X + GeneralScale * 15f, drawPosition.Y + GeneralScale * 30f);
|
||||
Vector2 offsetDrawPosition = new Vector2(drawPosition.X + ChatManager.GetStringSize(Main.fontMouseText, text, Vector2.One, -1f).X * GeneralScale + GeneralScale * 15f, drawPosition.Y + GeneralScale * 30f);
|
||||
Main.spriteBatch.Draw(cellTexture, offsetDrawPosition, null, Color.White, 0f, cellTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f);
|
||||
|
||||
// Display the cell quantity numerically below the drawn cells.
|
||||
Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontItemStack, totalCellsCost.ToString(), offsetDrawPosition.X - 11f, offsetDrawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), GeneralScale * 0.75f);
|
||||
Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontItemStack, totalCellsCost.ToString(), offsetDrawPosition.X - GeneralScale * 11f, offsetDrawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), GeneralScale * 0.75f);
|
||||
}
|
||||
|
||||
public static void DrawCostVerificationButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition)
|
||||
@@ -360,7 +360,7 @@ namespace CalamityMod.UI
|
||||
public static void HandleDecryptionStuff(TECodebreaker codebreakerTileEntity, Texture2D backgroundTexture, Vector2 backgroundTopLeft, Vector2 barCenter)
|
||||
{
|
||||
Texture2D textPanelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen");
|
||||
Vector2 textPanelCenter = backgroundTopLeft + Vector2.UnitX * backgroundTexture.Width + textPanelTexture.Size() * new Vector2(-0.5f, 0.5f);
|
||||
Vector2 textPanelCenter = backgroundTopLeft + Vector2.UnitX * backgroundTexture.Width * GeneralScale + textPanelTexture.Size() * new Vector2(-0.5f, 0.5f) * GeneralScale;
|
||||
Main.spriteBatch.Draw(textPanelTexture, textPanelCenter, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f);
|
||||
|
||||
// Generate gibberish and use slowly insert the real text.
|
||||
@@ -382,7 +382,7 @@ namespace CalamityMod.UI
|
||||
text[i] = trueMessage[i];
|
||||
|
||||
// Define the initial text draw position.
|
||||
Vector2 currentTextDrawPosition = backgroundTopLeft + new Vector2(backgroundTexture.Width - textPanelTexture.Width + textPadding, 6f);
|
||||
Vector2 currentTextDrawPosition = backgroundTopLeft + new Vector2(backgroundTexture.Width - textPanelTexture.Width + textPadding, 6f) * GeneralScale;
|
||||
|
||||
// Draw the lines of text. A maximum of 10 may be drawn and the vertical offset per line is 16 pixels.
|
||||
foreach (string line in Utils.WordwrapString(text.ToString(), Main.fontMouseText, (int)(textPanelTexture.Width * 1.5 - textPadding * 2), 10, out _))
|
||||
@@ -392,7 +392,7 @@ namespace CalamityMod.UI
|
||||
continue;
|
||||
|
||||
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, line, currentTextDrawPosition, Color.Cyan, 0f, Vector2.Zero, new Vector2(0.6f) * GeneralScale);
|
||||
currentTextDrawPosition.Y += 16;
|
||||
currentTextDrawPosition.Y += GeneralScale * 16f;
|
||||
}
|
||||
|
||||
// Handle special drawing when decryption is ongoing.
|
||||
|
||||
@@ -198,6 +198,29 @@ namespace CalamityMod
|
||||
return moved;
|
||||
}
|
||||
|
||||
public static bool IsEnchantable(this Item item)
|
||||
{
|
||||
// If the item is air just immediately return false.
|
||||
// It will not have a CalamityGlobalItem instance to use and attempting to do anything with it
|
||||
// would just result in errors.
|
||||
if (item.IsAir)
|
||||
return false;
|
||||
|
||||
// Items with a max stack greater than one cannot be enchanted, due to problems with data duplication.
|
||||
if (item.maxStack > 1)
|
||||
return false;
|
||||
|
||||
// Ammo cannot be enchanted because it is practically useless when held directly.
|
||||
if (item.ammo != AmmoID.None)
|
||||
return false;
|
||||
|
||||
// Ignore items that explicitly say to not be enchanted.
|
||||
if (item.Calamity().CannotBeEnchanted)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a given item is enchanted based on Calamitas' special system.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user