diff --git a/CalamityLists.cs b/CalamityLists.cs index ef301ee5e9..4c52812920 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1776,7 +1776,8 @@ namespace CalamityMod NPCID.SmallBaldZombie, NPCID.BigZombie, NPCID.SmallZombie, - NPCID.MaggotZombie + NPCID.MaggotZombie, + NPCType() // halloween zombies not included because they don't drop shackles or zombie arms }; diff --git a/Gores/BucketZombie/BucketZombie.png b/Gores/BucketZombie/BucketZombie.png new file mode 100644 index 0000000000..ad58d14616 Binary files /dev/null and b/Gores/BucketZombie/BucketZombie.png differ diff --git a/Gores/BucketZombie/BucketZombie2.png b/Gores/BucketZombie/BucketZombie2.png new file mode 100644 index 0000000000..f79aecdb51 Binary files /dev/null and b/Gores/BucketZombie/BucketZombie2.png differ diff --git a/Gores/BucketZombie/BucketZombie3.png b/Gores/BucketZombie/BucketZombie3.png new file mode 100644 index 0000000000..5706ea8e3d Binary files /dev/null and b/Gores/BucketZombie/BucketZombie3.png differ diff --git a/Gores/BucketZombie/BucketZombie4.png b/Gores/BucketZombie/BucketZombie4.png new file mode 100644 index 0000000000..fc15e70c5d Binary files /dev/null and b/Gores/BucketZombie/BucketZombie4.png differ diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 21097320aa..52c4a3888f 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -150,6 +150,7 @@ AuroraSpirit.DisplayName: Aurora Spirit BloodlettingServant.DisplayName: Bloodletting Servant BloomSlime.DisplayName: Bloom Slime Bohldohr.DisplayName: Bohldohr +BucketZombie.DisplayName: "{$NPCName.Zombie}" CladCrab.DisplayName: Clad Crab Cnidrion.DisplayName: Cnidrion CrawlerAmber.DisplayName: Amber Crawler diff --git a/NPCs/NormalNPCs/BucketZombie.cs b/NPCs/NormalNPCs/BucketZombie.cs new file mode 100644 index 0000000000..824b6ebfc2 --- /dev/null +++ b/NPCs/NormalNPCs/BucketZombie.cs @@ -0,0 +1,124 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Summon; +using CalamityMod.World; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.NormalNPCs +{ + // This is intended to be a new variant for the vanilla Zombie + public class BucketZombie : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 3; + NPCID.Sets.Zombies[Type] = true; + } + + public override void SetDefaults() + { + AIType = NPCID.Zombie; + AnimationType = NPCID.Zombie; + NPC.aiStyle = NPCAIStyleID.Fighter; + NPC.CloneDefaults(NPCID.Zombie); + NPC.lifeMax = 50; + NPC.defense = 15; + NPC.damage = 16; + NPC.knockBackResist = 0.45f; + NPC.value = Item.buyPrice(0, 0, 1, 0); + Banner = NPCID.Zombie; + BannerItem = ItemID.ZombieBanner; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override bool PreAI() + { + if (CalamityWorld.revenge) + { + VanillaNPCAIOverrides.RegularEnemies.RevengeanceAndDeathAI.BuffedFighterAI(NPC, Mod); + return false; + } + return true; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("CommonBestiaryFlavor.Zombie") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.05f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie4").Type, 1f); + } + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + // Copy over all loot from real Zombies + List zombieRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.Zombie, false); + foreach (var v in zombieRules) + { + npcLoot.Add(v); + } + npcLoot.Add(ItemID.EmptyBucket, 10); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) + { + // Takes greatly reduced damage from sentries because thats how it is in Plants versus Zombies + // Pumpoem will be none the wiser + if (projectile.IsMinionOrSentryRelated) + { + modifiers.SourceDamage *= 0.05f; + SoundEngine.PlaySound(SoundID.NPCHit4 with { Pitch = -1, Volume = 0.8f }, NPC.Center); + + // Just straight up reflect them in gfb + if (Main.zenithWorld) + { + projectile.velocity *= -1; + modifiers.SetMaxDamage(1); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/BucketZombie.png b/NPCs/NormalNPCs/BucketZombie.png new file mode 100644 index 0000000000..9a24d61249 Binary files /dev/null and b/NPCs/NormalNPCs/BucketZombie.png differ diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index b7d968484d..b983ecd7e8 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -1346,7 +1346,7 @@ PrepareToShoot: if (npc.ai[3] < (float)aiGateValue && (Main.eclipse || !Main.dayTime || (double)npc.position.Y > Main.worldSurface * 16.0 || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.Yeti || npcType == NPCID.ElfArcher)) || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.GoblinPeon || npcType == NPCID.GoblinThief || npcType == NPCID.GoblinWarrior || npcType == NPCID.GoblinArcher || npcType == NPCID.GoblinSummoner)) || (npcType == NPCID.GoblinScout || (Main.invasionType == InvasionID.PirateInvasion && npcType >= 212 && npcType <= 216)) || (Main.invasionType == InvasionID.MartianMadness && (npcType == NPCID.BrainScrambler || npcType == NPCID.RayGunner || npcType == NPCID.MartianOfficer || npcType == NPCID.GrayGrunt || npcType == NPCID.MartianEngineer || npcType == NPCID.GigaZapper || npcType == NPCID.Scutlix || npcType == NPCID.MartianWalker)) || (npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy || npcType == NPCID.SkeletonArcher || npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() || npcType == NPCID.CorruptPenguin || npcType == NPCID.FaceMonster || npcType == NPCID.SnowFlinx || npcType == NPCID.Lihzahrd || npcType == NPCID.LihzahrdCrawler || npcType == NPCID.IcyMerman || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.SeaSnail || npcType == NPCID.BloodCrawler || npcType == NPCID.IceGolem || npcType == NPCID.ZombieMushroom || npcType == NPCID.ZombieMushroomHat || npcType == NPCID.AnomuraFungus || npcType == NPCID.MushiLadybug || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite || npcType == NPCID.CrimsonBunny || npcType == NPCID.CrimsonPenguin || npcType == NPCID.NebulaSoldier || (npcType == NPCID.StardustSoldier && (npc.ai[1] >= 180f || npc.ai[1] < 90f))) || (npcType == NPCID.StardustSpiderBig || npcType == NPCID.VortexRifleman || npcType == NPCID.VortexSoldier || npcType == NPCID.VortexHornet || npcType == NPCID.VortexLarva || npcType == NPCID.WalkingAntlion || npcType == NPCID.SolarDrakomire || npcType == NPCID.SolarSolenian || (npcType >= 524 && npcType <= 527)) || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark || npcType == NPCID.DesertScorpionWalk || npcType == NPCID.DesertBeast)) { - if ((npcType == NPCID.Zombie || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == NPCID.Skeleton || (npcType >= NPCID.BoneThrowingSkeleton && npcType <= NPCID.BoneThrowingSkeleton4) || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.SkeletonArcher || npcType == NPCID.BaldZombie || npcType == NPCID.UndeadViking || npcType == NPCID.ZombieEskimo || npcType == NPCID.Frankenstein || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.ArmoredViking || npcType == NPCID.FemaleZombie || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.ZombieRaincoat || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.ZombieSuperman || npcType == NPCID.ZombiePixie || npcType == NPCID.ZombieDoctor || npcType == NPCID.GreekSkeleton) && Main.rand.NextBool(1000)) + if ((npcType == NPCID.Zombie || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == NPCID.Skeleton || (npcType >= NPCID.BoneThrowingSkeleton && npcType <= NPCID.BoneThrowingSkeleton4) || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.SkeletonArcher || npcType == NPCID.BaldZombie || npcType == NPCID.UndeadViking || npcType == NPCID.ZombieEskimo || npcType == NPCID.Frankenstein || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.ArmoredViking || npcType == NPCID.FemaleZombie || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.ZombieRaincoat || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.ZombieSuperman || npcType == NPCID.ZombiePixie || npcType == NPCID.ZombieDoctor || npcType == NPCID.GreekSkeleton || npcType == ModContent.NPCType()) && Main.rand.NextBool(1000)) { SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); } @@ -1947,6 +1947,10 @@ PrepareToShoot: { velocityMax = 1.05f; } + if (npcType == ModContent.NPCType()) + { + velocityMax = 0.85f; + } if (npcType == NPCID.BloodZombie) { float playerDistance = (Main.player[npc.target].Center - npc.Center).Length(); @@ -1965,7 +1969,7 @@ PrepareToShoot: } velocityMax *= 0.8f; } - if (npcType == NPCID.BloodZombie || npcType == NPCID.Zombie || npcType == NPCID.BaldZombie || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.FemaleZombie || npcType == NPCID.ZombieRaincoat || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater) + if (npcType == NPCID.BloodZombie || npcType == NPCID.Zombie || npcType == NPCID.BaldZombie || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.FemaleZombie || npcType == NPCID.ZombieRaincoat || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == ModContent.NPCType()) { velocityMax *= 1f + (1f - npc.scale); }