mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
configure a code style that is not completely cursed
This commit is contained in:
@@ -7,12 +7,9 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace YHTMod.Changes;
|
||||
|
||||
public class BossKillListener : GlobalNPC
|
||||
{
|
||||
public override void OnKill(NPC npc)
|
||||
{
|
||||
switch (npc.type)
|
||||
{
|
||||
public class BossKillListener : GlobalNPC {
|
||||
public override void OnKill(NPC npc) {
|
||||
switch (npc.type) {
|
||||
case NPCID.KingSlime:
|
||||
HandleBossKill(npc, "king_slime");
|
||||
break;
|
||||
@@ -22,9 +19,8 @@ public class BossKillListener : GlobalNPC
|
||||
case NPCID.EaterofWorldsHead:
|
||||
case NPCID.EaterofWorldsBody:
|
||||
case NPCID.EaterofWorldsTail:
|
||||
var foundEaterSegments = 0;
|
||||
foreach (var activeNpC in Main.ActiveNPCs)
|
||||
{
|
||||
int foundEaterSegments = 0;
|
||||
foreach (NPC activeNpC in Main.ActiveNPCs) {
|
||||
if (activeNpC.friendly || activeNpC.townNPC) continue;
|
||||
if (activeNpC.type is not NPCID.EaterofWorldsBody
|
||||
and not NPCID.EaterofWorldsHead
|
||||
@@ -55,15 +51,12 @@ public class BossKillListener : GlobalNPC
|
||||
base.OnKill(npc);
|
||||
}
|
||||
|
||||
private static void HandleBossKill(NPC npc, string bossKey)
|
||||
{
|
||||
foreach (var player in Main.ActivePlayers)
|
||||
{
|
||||
var modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
private static void HandleBossKill(NPC npc, string bossKey) {
|
||||
foreach (Player player in Main.ActivePlayers) {
|
||||
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
if (!npc.playerInteraction[player.whoAmI]) continue;
|
||||
|
||||
if (modPlayer.SummonerAmbition && modPlayer.SummonerAmbitions.Add(bossKey))
|
||||
{
|
||||
if (modPlayer.SummonerAmbition && modPlayer.SummonerAmbitions.Add(bossKey)) {
|
||||
ChatHelper.SendChatMessageToClient(
|
||||
NetworkText.FromLiteral("Your Summoner Ambition's potential grows stronger!"),
|
||||
Color.MediumPurple,
|
||||
|
||||
+6
-10
@@ -8,19 +8,15 @@ using YHTMod.Items.ArcaneMissile;
|
||||
|
||||
namespace YHTMod.Changes;
|
||||
|
||||
public class NpcLoot : GlobalNPC
|
||||
{
|
||||
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
|
||||
{
|
||||
var id = npc.type;
|
||||
public class NpcLoot : GlobalNPC {
|
||||
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot) {
|
||||
int id = npc.type;
|
||||
|
||||
if (NPCID.Sets.CountsAsCritter[id])
|
||||
{
|
||||
if (NPCID.Sets.CountsAsCritter[id]) {
|
||||
npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<MithrilPebbleOfPigSmiting>(), 400));
|
||||
}
|
||||
|
||||
switch (id)
|
||||
{
|
||||
switch (id) {
|
||||
case NPCID.Plantera:
|
||||
npcLoot.Add(ItemDropRule.Common(ItemID.ChlorophyteOre, 1, 60, 80));
|
||||
break;
|
||||
@@ -29,4 +25,4 @@ public class NpcLoot : GlobalNPC
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,24 +5,19 @@ 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)
|
||||
{
|
||||
public class SummonerOnHitEffects : GlobalProjectile {
|
||||
public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) {
|
||||
Player player = Main.player[projectile.owner];
|
||||
YhtPlayer 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));
|
||||
Vector2 direction = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
|
||||
direction.Normalize();
|
||||
direction *= Main.rand.NextFloat(4f, 8f);
|
||||
Projectile.NewProjectile(
|
||||
@@ -39,18 +34,16 @@ public class SummonerOnHitEffects : GlobalProjectile
|
||||
if (
|
||||
modPlayer.SummonerAmbitions.Contains("queen_bee")
|
||||
&& Main.rand.NextBool(4)
|
||||
)
|
||||
{
|
||||
) {
|
||||
target.AddBuff(BuffID.Poisoned, 5 * 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.WhipSettings.Segments > 0)
|
||||
{
|
||||
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