Fixed Ares arms in the deathray phase
This commit is contained in:
1 parent
2f1aff2863
commit
87e9d5b2f5
2 files changed
+40
-4
No files matched your search
@@ -835,14 +835,33 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
Color armGlowmaskColor = afterimageBaseColor;
|
||||
armGlowmaskColor.A = 184;
|
||||
|
||||
(int, bool)[] armProperties = new (int, bool)[]
|
||||
{
|
||||
// Laser arm.
|
||||
(-1, true),
|
||||
|
||||
// Gauss arm.
|
||||
(1, true),
|
||||
|
||||
// Telsa arm.
|
||||
(-1, false),
|
||||
|
||||
// Plasma arm.
|
||||
(1, false),
|
||||
};
|
||||
|
||||
// Swap out arm positions as necessary.
|
||||
if (AIState == (int)Phase.Deathrays)
|
||||
CalamityUtils.SwapArrayIndices(ref armProperties, 1, 3);
|
||||
|
||||
if (laserArm != -1)
|
||||
DrawArm(spriteBatch, Main.npc[laserArm].Center, armGlowmaskColor, -1, true);
|
||||
DrawArm(spriteBatch, Main.npc[laserArm].Center, armGlowmaskColor, armProperties[0].Item1, armProperties[0].Item2);
|
||||
if (gaussArm != -1)
|
||||
DrawArm(spriteBatch, Main.npc[gaussArm].Center, armGlowmaskColor, 1, true);
|
||||
DrawArm(spriteBatch, Main.npc[gaussArm].Center, armGlowmaskColor, armProperties[1].Item1, armProperties[1].Item2);
|
||||
if (teslaArm != -1)
|
||||
DrawArm(spriteBatch, Main.npc[teslaArm].Center, armGlowmaskColor, -1, false);
|
||||
DrawArm(spriteBatch, Main.npc[teslaArm].Center, armGlowmaskColor, armProperties[2].Item1, armProperties[2].Item2);
|
||||
if (plasmaArm != -1)
|
||||
DrawArm(spriteBatch, Main.npc[plasmaArm].Center, armGlowmaskColor, 1, false);
|
||||
DrawArm(spriteBatch, Main.npc[plasmaArm].Center, armGlowmaskColor, armProperties[3].Item1, armProperties[3].Item2);
|
||||
|
||||
Texture2D texture = Main.npcTexture[npc.type];
|
||||
Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height);
|
||||
|
||||
@@ -29,6 +29,23 @@ namespace CalamityMod
|
||||
NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), textColor.Value);
|
||||
}
|
||||
|
||||
// Yes, this method has a use that Utils.Swap does not; You cannot use refs on array indices.
|
||||
// The CLR will not allow that. As such, a custom method must be used to achieve this.
|
||||
|
||||
/// <summary>
|
||||
/// Swaps two array indices based on a temporary variable.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the array.</typeparam>
|
||||
/// <param name="array">The array.</param>
|
||||
/// <param name="index1">The first index to swap.</param>
|
||||
/// <param name="index2">The second index to swap.</param>
|
||||
public static void SwapArrayIndices<T>(ref T[] array, int index1, int index2)
|
||||
{
|
||||
T temp = array[index1];
|
||||
array[index1] = array[index2];
|
||||
array[index2] = temp;
|
||||
}
|
||||
|
||||
public static T[] ShuffleArray<T>(T[] array, Random rand = null)
|
||||
{
|
||||
if (rand is null)
|
||||
|
||||
Reference in new issue
Block a user