mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
first successful calamity boss perk integration
This commit is contained in:
+36
-27
@@ -1,3 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.NPCs.Crabulon;
|
||||
using CalamityMod.NPCs.DesertScourge;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Chat;
|
||||
@@ -8,17 +11,34 @@ using Terraria.ModLoader;
|
||||
namespace YHTMod.Changes;
|
||||
|
||||
public class BossKillListener : GlobalNPC {
|
||||
|
||||
private static readonly Dictionary<int, string> BossIds = new();
|
||||
|
||||
public override void Load() {
|
||||
BossIds.Add(NPCID.KingSlime, "king_slime");
|
||||
BossIds.Add(NPCID.EyeofCthulhu, "eye_of_cthulhu");
|
||||
BossIds.Add(NPCID.EaterofWorldsHead, "eater_of_worlds");
|
||||
BossIds.Add(NPCID.EaterofWorldsBody, "eater_of_worlds");
|
||||
BossIds.Add(NPCID.EaterofWorldsTail, "eater_of_worlds");
|
||||
BossIds.Add(NPCID.BrainofCthulhu, "brain_of_cthulhu");
|
||||
BossIds.Add(NPCID.Deerclops, "deerclops");
|
||||
BossIds.Add(NPCID.QueenBee, "queen_bee");
|
||||
BossIds.Add(NPCID.SkeletronHead, "skeletron");
|
||||
BossIds.Add(NPCID.WallofFlesh, "wall_of_flesh");
|
||||
|
||||
if (ModLoader.HasMod("CalamityMod")) {
|
||||
BossIds.Add(ModContent.NPCType<DesertScourgeHead>(), "desert_scourge");
|
||||
BossIds.Add(ModContent.NPCType<Crabulon>(), "crabulon");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(NPC npc) {
|
||||
switch (npc.type) {
|
||||
case NPCID.KingSlime:
|
||||
HandleBossKill(npc, "king_slime");
|
||||
break;
|
||||
case NPCID.EyeofCthulhu:
|
||||
HandleBossKill(npc, "eye_of_cthulhu");
|
||||
break;
|
||||
case NPCID.EaterofWorldsHead:
|
||||
case NPCID.EaterofWorldsBody:
|
||||
case NPCID.EaterofWorldsTail:
|
||||
string id = BossIds.GetValueOrDefault(npc.type, null);
|
||||
switch (id) {
|
||||
case null:
|
||||
base.OnKill(npc);
|
||||
return;
|
||||
case "eater_of_worlds": {
|
||||
int foundEaterSegments = 0;
|
||||
foreach (NPC activeNpC in Main.ActiveNPCs) {
|
||||
if (activeNpC.friendly || activeNpC.townNPC) continue;
|
||||
@@ -28,26 +48,15 @@ public class BossKillListener : GlobalNPC {
|
||||
) 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;
|
||||
case NPCID.SkeletronHead:
|
||||
HandleBossKill(npc, "skeletron");
|
||||
break;
|
||||
case NPCID.WallofFlesh:
|
||||
HandleBossKill(npc, "wall_of_flesh");
|
||||
if (foundEaterSegments > 1) {
|
||||
base.OnKill(npc);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HandleBossKill(npc, id);
|
||||
base.OnKill(npc);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using YHTMod.Buffs;
|
||||
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||
|
||||
namespace YHTMod.Changes;
|
||||
@@ -40,10 +41,16 @@ public class SummonerOnHitEffects : GlobalProjectile {
|
||||
}
|
||||
|
||||
// Whips
|
||||
if (projectile.WhipSettings.Segments > 0) {
|
||||
if (ProjectileID.Sets.IsAWhip[projectile.type]) {
|
||||
if (modPlayer.SummonerAmbitions.Contains("eye_of_cthulhu")) {
|
||||
projectile.damage = (int)(projectile.damage * 1.1);
|
||||
}
|
||||
|
||||
if (ModLoader.HasMod("CalamityMod")) {
|
||||
if (modPlayer.SummonerAmbitions.Contains("crabulon")) {
|
||||
target.AddBuff(ModContent.BuffType<ShroomGlowDebuff>(), 5 * 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.OnHitNPC(projectile, target, hit, damageDone);
|
||||
|
||||
Reference in New Issue
Block a user