nimbuses spawned by summons are supposed to be friendly

This commit is contained in:
2026-01-26 18:08:53 +01:00
parent a545325b12
commit a68b762f0a
2 changed files with 20 additions and 4 deletions
+1 -2
View File
@@ -11,9 +11,8 @@ public class SummonerAmbitionBuff : ModBuff {
} }
public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) {
YhtPlayer modPlayer = Main.LocalPlayer.TryGetModPlayer<YhtPlayer>(out var mp) ? mp : null; YhtPlayer modPlayer = Main.LocalPlayer.TryGetModPlayer(out YhtPlayer mp) ? mp : null;
if (modPlayer == null) return; if (modPlayer == null) return;
tip = Language.GetTextValue("Mods.YHTMod.Buffs.SummonerAmbitionBuff.Description", tip = Language.GetTextValue("Mods.YHTMod.Buffs.SummonerAmbitionBuff.Description",
modPlayer.SummonerAmbitions.Count); modPlayer.SummonerAmbitions.Count);
} }
+19 -2
View File
@@ -1,4 +1,5 @@
using Terraria; using Terraria;
using Terraria.DataStructures;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;
using YHTMod.Buffs; using YHTMod.Buffs;
@@ -7,6 +8,22 @@ using Vector2 = Microsoft.Xna.Framework.Vector2;
namespace YHTMod.Changes; namespace YHTMod.Changes;
public class SummonerOnHitEffects : GlobalProjectile { public class SummonerOnHitEffects : GlobalProjectile {
public override void OnSpawn(Projectile projectile, IEntitySource source) {
if (ModLoader.HasMod("CalamityMod") && projectile.type == ModContent.ProjectileType<CalamityMod.Projectiles.Boss.ShaderainHostile>()) {
if (source is EntitySource_Parent { Entity: Projectile parentProj }) {
int shadeType = ModContent.ProjectileType<CalamityMod.Projectiles.Boss.ShadeNimbusHostile>();
if (parentProj.type == shadeType && parentProj.friendly && !parentProj.hostile) {
projectile.friendly = true;
projectile.hostile = false;
projectile.DamageType = DamageClass.Summon;
projectile.damage = parentProj.damage;
}
}
}
base.OnSpawn(projectile, source);
}
public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) {
Player player = Main.player[projectile.owner]; Player player = Main.player[projectile.owner];
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>(); YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
@@ -69,7 +86,7 @@ public class SummonerOnHitEffects : GlobalProjectile {
if (!modPlayer.SummonerAmbitions.Contains("perforators")) return; if (!modPlayer.SummonerAmbitions.Contains("perforators")) return;
if (modPlayer.SummonerAmbitionPerforatorsCooldown != 0) return; if (modPlayer.SummonerAmbitionPerforatorsCooldown != 0) return;
if (!Main.rand.NextBool(10)) return; if (!Main.rand.NextBool(10)) return;
modPlayer.SummonerAmbitionPerforatorsCooldown = 3 * 60; modPlayer.SummonerAmbitionPerforatorsCooldown = 20 * 60;
Vector2 direction = new(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); Vector2 direction = new(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
direction.Normalize(); direction.Normalize();
direction *= Main.rand.NextFloat(4f, 5f); direction *= Main.rand.NextFloat(4f, 5f);
@@ -99,7 +116,7 @@ public class SummonerOnHitEffects : GlobalProjectile {
int projectileId = Projectile.NewProjectile( int projectileId = Projectile.NewProjectile(
modPlayer.Player.GetSource_OnHit(target), modPlayer.Player.GetSource_OnHit(target),
target.Center, target.Center,
new Vector2(0, 1f), new Vector2(0, -0.25f),
projectileType, projectileType,
(int) (projectile.damage * 0.75f), (int) (projectile.damage * 0.75f),
0f, 0f,