mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
pre-hardmode summoner's ambition
This commit is contained in:
@@ -20,11 +20,27 @@ public class BossKillListener : GlobalNPC
|
||||
HandleBossKill(npc, "eye_of_cthulhu");
|
||||
break;
|
||||
case NPCID.EaterofWorldsHead:
|
||||
case NPCID.EaterofWorldsBody:
|
||||
case NPCID.EaterofWorldsTail:
|
||||
var foundEaterSegments = 0;
|
||||
foreach (var activeNpC in Main.ActiveNPCs)
|
||||
{
|
||||
if (activeNpC.friendly || activeNpC.townNPC) continue;
|
||||
if (activeNpC.type is not NPCID.EaterofWorldsBody
|
||||
and not NPCID.EaterofWorldsHead
|
||||
and not NPCID.EaterofWorldsTail
|
||||
) continue;
|
||||
if (++foundEaterSegments > 1) break;
|
||||
}
|
||||
|
||||
HandleBossKill(npc, "eater_of_worlds");
|
||||
break;
|
||||
case NPCID.BrainofCthulhu:
|
||||
HandleBossKill(npc, "brain_of_cthulhu");
|
||||
break;
|
||||
case NPCID.Deerclops:
|
||||
HandleBossKill(npc, "deerclops");
|
||||
break;
|
||||
case NPCID.QueenBee:
|
||||
HandleBossKill(npc, "queen_bee");
|
||||
break;
|
||||
@@ -45,10 +61,11 @@ public class BossKillListener : GlobalNPC
|
||||
{
|
||||
var modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
if (!npc.playerInteraction[player.whoAmI]) continue;
|
||||
if (modPlayer.KilledBosses.Add(bossKey))
|
||||
|
||||
if (modPlayer.SummonerAmbition && modPlayer.SummonerAmbitions.Add(bossKey))
|
||||
{
|
||||
ChatHelper.SendChatMessageToClient(
|
||||
NetworkText.FromLiteral("Your Ambition's potential grows stronger!"),
|
||||
NetworkText.FromLiteral("Your Summoner Ambition's potential grows stronger!"),
|
||||
Color.MediumPurple,
|
||||
player.whoAmI
|
||||
);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||
|
||||
namespace YHTMod.Changes;
|
||||
|
||||
public class SummonerOnHitEffects : GlobalProjectile
|
||||
{
|
||||
public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
var player = Main.player[projectile.owner];
|
||||
var modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
if (projectile.minion && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
if (modPlayer.SummonerAmbition)
|
||||
{
|
||||
if (
|
||||
modPlayer.SummonerAmbitions.Contains("deerclops")
|
||||
&& modPlayer.SummonerAmbitionDeerclopsCooldown == 0
|
||||
&& Main.rand.NextBool(10)
|
||||
)
|
||||
{
|
||||
modPlayer.SummonerAmbitionDeerclopsCooldown = 5 * 60;
|
||||
var direction = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
|
||||
direction.Normalize();
|
||||
direction *= Main.rand.NextFloat(4f, 8f);
|
||||
Projectile.NewProjectile(
|
||||
player.GetSource_OnHit(target),
|
||||
target.Center,
|
||||
direction,
|
||||
ProjectileID.InsanityShadowFriendly,
|
||||
projectile.damage / 2,
|
||||
0f,
|
||||
projectile.owner
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
modPlayer.SummonerAmbitions.Contains("queen_bee")
|
||||
&& Main.rand.NextBool(4)
|
||||
)
|
||||
{
|
||||
target.AddBuff(BuffID.Poisoned, 5 * 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.WhipSettings.Segments > 0)
|
||||
{
|
||||
projectile.damage = (int)(projectile.damage * 1.1);
|
||||
}
|
||||
|
||||
base.OnHitNPC(projectile, target, hit, damageDone);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user