Minion fixes

This commit is contained in:
Xyk committed 2026-01-13 11:41:35 -08:00
1 parent f02b4226bc
commit 56e6d24336
2 files changed
+38 -9

No files matched your search

+23 -7
View File
@@ -39,27 +39,43 @@ namespace CalamityMod.Items.Weapons.Summon
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float usedMinionSlots = 0;
foreach (var minions in Main.ActiveProjectiles)
{
if (minions.owner == player.whoAmI)
usedMinionSlots += minions.minionSlots;
}
bool hasSlotsForSummon = true;
if (usedMinionSlots + 1 > player.maxMinions)
hasSlotsForSummon = false;
player.AddBuff(Item.buffType, 2);
for (int i = 0; i < 3; i++)
int projCount = player.ownedProjectileCounts[type] + (hasSlotsForSummon ? 3 : 0);
if (hasSlotsForSummon)
{
var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1);
minion.originalDamage = Item.damage;
for (int i = 0; i < 3; i++)
{
var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1);
minion.originalDamage = Item.damage;
}
}
float angleMax = MathHelper.ToRadians(360f);
if (player.ownedProjectileCounts[type] == 1)
if (projCount == 100)
angleMax = 0f;
float index = 1f;
if (player.ownedProjectileCounts[Item.shoot] > 30)
if (projCount > 30)
{
angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f);
angleMax += MathHelper.ToRadians((projCount - 30) * 2.5f);
}
angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuitive than using a min function
foreach (Projectile p in Main.ActiveProjectiles)
{
if (p.type == type && p.owner == player.whoAmI)
{
p.ai[1] = index / player.ownedProjectileCounts[type] * angleMax - angleMax / 2f;
int adjustedProjCount = (int)(projCount);
Main.NewText("index: " + index.ToString() + " | projCount: " + adjustedProjCount.ToString() + " | angleMax: " + angleMax.ToString());
p.ai[1] = index / adjustedProjCount * angleMax - angleMax / 2f;
p.netUpdate = true;
index++;
}
+15 -2
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon
// There's a long cooldown on commanding blades
// This is so you don't just hold down right click, since now it's optimal to only command blades when all are ready
if (player.altFunctionUse == 2)
return 0.1f;
return 0.37f;
else
return 1f;
}
@@ -57,6 +57,17 @@ namespace CalamityMod.Items.Weapons.Summon
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float usedMinionSlots = 0;
foreach (var minions in Main.ActiveProjectiles)
{
if (minions.owner == player.whoAmI)
usedMinionSlots += minions.minionSlots;
}
bool hasSlotsForSummon = true;
if (usedMinionSlots + 1 > player.maxMinions)
hasSlotsForSummon = false;
// Call all active blades to attack if they are charged
// The check to see if a blade is charged is done in the blade itself
if (player.altFunctionUse == 2)
@@ -89,7 +100,7 @@ namespace CalamityMod.Items.Weapons.Summon
SoundEngine.PlaySound(SoundID.Item101 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) }, player.Center);
}
}
else // Toss out the summon
else if (hasSlotsForSummon) // Toss out the summon
{
player.AddBuff(Item.buffType, 2);
SoundEngine.PlaySound(SoundID.Item1, player.Center);
@@ -117,6 +128,8 @@ namespace CalamityMod.Items.Weapons.Summon
}
}
}
return false;
}
public override void UseItemFrame(Player player) // Player hand animation when you command the blades