diff --git a/Challenger/Challenger.CNPCs/BrainofCthulhu.cs b/Challenger/Challenger.CNPCs/BrainofCthulhu.cs new file mode 100644 index 000000000..22d5281db --- /dev/null +++ b/Challenger/Challenger.CNPCs/BrainofCthulhu.cs @@ -0,0 +1,112 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; + +namespace Challenger +{ + + internal class BrainofCthulhu : CNPC + { + public BrainofCthulhu(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + SetState(); + NPCAimedTarget targetData = npc.GetTargetData(true); + if (npc.ai[0] >= 0f || npc.ai[3] != 225f) + { + return; + } + switch (state) + { + case 1: + break; + case 2: + { + int num4 = Main.rand.Next(2, 5); + for (int j = 0; j < num4; j++) + { + float num5 = (float)Main.rand.NextDouble() - 0.5f; + float num6 = -0.25f * (float)Math.Cos(3.1415927410125732 * (double)num5); + Projectile.NewProjectile(null, ((NPCAimedTarget)(targetData)).Center * 2f - ((Entity)npc).Center, new Vector2(0f - num5, 0f - num6) * 17f, 811, 0, 0f, -1, 0f, 0f, 0f); + Projectile.NewProjectile(null, new Vector2((((NPCAimedTarget)(targetData)).Center - ((Entity)npc).Center).X * 2f, 0f) + ((Entity)npc).Center, new Vector2(0f - num5, num6) * 17f, 811, 0, 0f, -1, 0f, 0f, 0f); + Projectile.NewProjectile(null, new Vector2(0f, (((NPCAimedTarget)(targetData)).Center - ((Entity)npc).Center).Y * 2f) + ((Entity)npc).Center, new Vector2(num5, 0f - num6) * 17f, 811, 0, 0f, -1, 0f, 0f, 0f); + Projectile.NewProjectile(null, ((Entity)npc).Center, new Vector2(num5, num6) * 17f, 811, 15, 5f, -1, 0f, 0f, 0f); + } + break; + } + case 3: + { + int num = Main.rand.Next(4, 7); + for (int i = 0; i < num; i++) + { + float num2 = (float)Main.rand.NextDouble() - 0.5f; + float num3 = -0.25f * (float)Math.Cos(3.1415927410125732 * (double)num2); + Projectile.NewProjectile((IEntitySource)null, ((NPCAimedTarget)(targetData)).Center * 2f - ((Entity)npc).Center, new Vector2(0f - num2, 0f - num3) * 17f, 811, 14, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, new Vector2((((NPCAimedTarget)(targetData)).Center - ((Entity)npc).Center).X * 2f, 0f) + ((Entity)npc).Center, new Vector2(0f - num2, num3) * 17f, 811, 18, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, new Vector2(0f, (((NPCAimedTarget)(targetData)).Center - ((Entity)npc).Center).Y * 2f) + ((Entity)npc).Center, new Vector2(num2, 0f - num3) * 17f, 811, 18, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, new Vector2(num2, num3) * 17f, 811, 18, 5f, -1, 0f, 0f, 0f); + } + break; + } + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.98f) + { + if (state == 0) + { + state = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("畸形怪脑发现了新鲜的脑子", new Color(255, 94, 94)); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.5f) + { + if (state == 1) + { + state = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("你真的能分清真假血弹吗", new Color(255, 94, 94)); + } + } + return state; + } + if (state == 2) + { + state = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("虚虚实实,实实虚虚", new Color(255, 94, 94)); + } + } + return state; + } + + public override void OnHurtPlayers(GetDataHandlers.PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + int num = Main.rand.Next(1, 3); + if (num == 1) + { + global::Challenger.Challenger.SendPlayerText("糊你一脸", Color.Red, ((Entity)npc).Center + new Vector2(0f, -30f)); + } + else + { + global::Challenger.Challenger.SendPlayerText("哇哇嗷", Color.Red, ((Entity)npc).Center + new Vector2(0f, -30f)); + } + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/Creeper.cs b/Challenger/Challenger.CNPCs/Creeper.cs new file mode 100644 index 000000000..5d9a4d9ae --- /dev/null +++ b/Challenger/Challenger.CNPCs/Creeper.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace Challenger +{ + public class Creeper : CNPC + { + public Creeper(NPC npc) + : base(npc) + { + } + + public override void OnKilled() + { + int num = Main.rand.Next(2, 6); + for (int i = 0; i < num; i++) + { + float num2 = (float)Main.rand.NextDouble() - 0.5f; + float num3 = -0.25f * (float)Math.Cos(3.1415927410125732 * (double)num2); + Projectile.NewProjectile(null, npc.position, new Vector2(num2, num3) * 17f, 811, 15, 5f, -1, 0f, 0f, 0f); + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/Deerclops.cs b/Challenger/Challenger.CNPCs/Deerclops.cs new file mode 100644 index 000000000..623607502 --- /dev/null +++ b/Challenger/Challenger.CNPCs/Deerclops.cs @@ -0,0 +1,168 @@ +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; +using static TShockAPI.GetDataHandlers; + +namespace Challenger +{ + public class Deerclops : CNPC + { + private const float CooldownOfSkill0 = 350f; + + private float skill0 = 0f; + + public Deerclops(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + skill0 += 1f; + NPCAimedTarget targetData = npc.GetTargetData(true); + if (npc.ai[0] == 6f) + { + NPC? obj = npc; + obj.life += 2; + npc.StrikeNPC(0, 0f, 0, false, false, false, (Entity)null); + } + SetState(); + switch (state) + { + case 1: + if (npc.ai[0] == 5f && npc.ai[1] == 59f && Main.netMode != 1) + { + Vector2 val7 = default(Vector2); + Vector2 val8 = default(Vector2); + float num5 = default(float); + float num6 = default(float); + for (int m = 0; m < 3; m++) + { + Projectile.RandomizeInsanityShadowFor((Entity)(object)Main.player[npc.target], true,out val7, out val8, out num5, out num6 ); + Projectile.NewProjectile((IEntitySource)null, val7, val8, 965, 12, 0f, Main.myPlayer, num5, num6, 0f); + } + } + break; + case 2: + if (npc.ai[0] == 1f && npc.ai[1] == 30f) + { + Point val4 = Terraria.Utils.ToTileCoordinates(((Entity)npc).Top); + for (int k = 5; k < 20; k++) + { + npc.AI_123_Deerclops_ShootRubbleUp(ref targetData, ref val4, 20, 1, 200f, k); + } + if (Main.rand.Next(1) == 0 && npc.ai[1] == 79f) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 5f && npc.ai[1] == 59f && Main.netMode != 1) + { + Vector2 val5 = default(Vector2); + Vector2 val6 = default(Vector2); + float num3 = default(float); + float num4 = default(float); + for (int l = 0; l < 8; l++) + { + Projectile.RandomizeInsanityShadowFor((Entity)(object)Main.player[npc.target], true, out val5, out val6, out num3, out num4); + Projectile.NewProjectile((IEntitySource)null, val5, val6, 965, 12, 0f, Main.myPlayer, num3, num4, 0f); + } + } + if (skill0 >= 7f) + { + Projectile.NewProjectile((IEntitySource)null, targetData.Position + new Vector2((float)Main.rand.Next(-1536, 1536), -768f), Vector2.UnitY, 174, 5, 0f, -1, 0f, 0f, 0f); + skill0 = 0f; + } + break; + case 3: + if (npc.ai[0] == 1f && npc.ai[1] == 30f) + { + Point val = Terraria.Utils.ToTileCoordinates(((Entity)npc).Top); + for (int i = 5; i < 20; i++) + { + npc.AI_123_Deerclops_ShootRubbleUp(ref targetData, ref val, 20, 1, 200f, i); + } + if (Main.rand.Next(1) == 0 && npc.ai[1] == 79f) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 5f && npc.ai[1] == 59f && Main.netMode != 1) + { + Vector2 val2 = default(Vector2); + Vector2 val3 = default(Vector2); + float num = default(float); + float num2 = default(float); + for (int j = 0; j < 8; j++) + { + Projectile.RandomizeInsanityShadowFor((Entity)(object)Main.player[npc.target], true, out val2, out val3, out num, out num2); + Projectile.NewProjectile((IEntitySource)null, val2, val3, 965, 13, 0f, Main.myPlayer, num, num2, 0f); + } + } + if (skill0 >= 3f) + { + Projectile.NewProjectile((IEntitySource)null, targetData.Position + new Vector2((float)Main.rand.Next(-1024, 1024), -1024f), Vector2.UnitY * 3f, 174, 9, 5f, -1, 0f, 0f, 0f); + skill0 = 0f; + } + break; + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.8f) + { + if (state == 0) + { + state = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("远方的巨兽将会摧毁你所拥有的一切", new Color(111, 160, 213)); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.3f) + { + if (state == 1) + { + state = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("冰雪从天而降", new Color(111, 160, 213)); + } + } + return state; + } + if (state == 2) + { + state = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("你将受到灭顶之灾", new Color(111, 160, 213)); + } + } + return state; + } + + public override void OnHurtPlayers(PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + int num = Main.rand.Next(1, 3); + if (num == 1) + { + global::Challenger.Challenger.SendPlayerText("拆掉拆掉!", new Color(111, 160, 213), ((Entity)npc).Center + new Vector2(0f, -30f)); + } + else + { + global::Challenger.Challenger.SendPlayerText("嗷嗷", new Color(111, 160, 213), ((Entity)npc).Center + new Vector2(0f, -30f)); + } + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/EaterofWorldsBody.cs b/Challenger/Challenger.CNPCs/EaterofWorldsBody.cs new file mode 100644 index 000000000..e25c3ad11 --- /dev/null +++ b/Challenger/Challenger.CNPCs/EaterofWorldsBody.cs @@ -0,0 +1,129 @@ +using System; +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; + +namespace ChalleAnger +{ + public class EaterofWorldsBody : CNPC + { + public static int State; + + public EaterofWorldsBody(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + SetState(); + NPCAimedTarget targetData = npc.GetTargetData(true); + switch (State) + { + case 1: + if (Vector2.DistanceSquared(((NPCAimedTarget)(targetData)).Center, ((Entity)npc).Center) <= 250000f && Main.rand.Next(1200) == 0) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, -Vector2.UnitY * 6f, 671, 8, 0f, -1, 0f, 0f, 0f); + } + break; + case 2: + if (Vector2.DistanceSquared(((NPCAimedTarget)(targetData)).Center, ((Entity)npc).Center) <= 490000f && Main.rand.Next(800) == 0) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, -Vector2.UnitY * 12f, 671, 14, 0f, -1, 0f, 0f, 0f); + } + break; + case 3: + if (Vector2.DistanceSquared(((NPCAimedTarget)(targetData)).Center, ((Entity)npc).Center) <= 640000f && Main.rand.Next(300) == 0) + { + if (Main.rand.Next(2) == 0) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedByRandom(Terraria.Utils.DirectionTo(((Entity)npc).Center, ((NPCAimedTarget)(targetData)).Center), 0.1) * 12f, 671, 17, 0f, -1, 0f, 0f, 0f); + } + else + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, -Terraria.Utils.RotatedByRandom(Vector2.UnitY, 0.2) * 10f, 671, 17, 0f, -1, 0f, 0f, 0f); + } + } + break; + } + } + + public override int SetState() + { + int num = 0; + NPC[] array = Main.npc; + foreach (NPC val in array) + { + if ((val.type == 13 || val.type == 14 || val.type == 15) && ((Entity)val).active) + { + num++; + } + } + if (num > 66) + { + if (State == 0) + { + State = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("邪恶的蠕虫寻找新的受害者", new Color(177, 94, 255)); + } + } + return State; + } + if (num > 40) + { + if (State == 1) + { + State = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("有毒的鳞甲炸裂开来", new Color(177, 94, 255)); + } + } + return State; + } + if (State == 2) + { + State = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("怒不可遏", new Color(177, 94, 255)); + } + } + return State; + } + + public override void OnKilled() + { + if (State == 0 || State == 2) + { + int num = Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Vector2.Zero, 501, 13, 0f, -1, 0f, 0f, 0f); + Main.npc[num].timeLeft = 1; + CProjectile.Update(num); + for (int i = 0; i < 6; i++) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI / 3.0 * (double)i, default(Vector2)) * 5f, 909, 14, 0f, -1, 0f, 0f, 0f); + } + } + } + + public override void OnHurtPlayers(GetDataHandlers.PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + int num = Main.rand.Next(1, 3); + if (num == 1) + { + global::Challenger.Challenger.SendPlayerText("刺啦", new Color(177, 94, 255), npc.Center + new Vector2(0f, -30f)); + } + else + { + global::Challenger.Challenger.SendPlayerText("小心我爆炸的鳞甲", new Color(177, 94, 255), npc.Center + new Vector2(0f, -30f)); + } + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/EaterofWorldsHead.cs b/Challenger/Challenger.CNPCs/EaterofWorldsHead.cs new file mode 100644 index 000000000..833cd922b --- /dev/null +++ b/Challenger/Challenger.CNPCs/EaterofWorldsHead.cs @@ -0,0 +1,51 @@ +using System; +using ChalleAnger; +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; + +namespace Challenger +{ + public class EaterofWorldsHead : CNPC + { + public EaterofWorldsHead(NPC npc) + : base(npc) + { + } + + public override void OnKilled() + { + if (EaterofWorldsBody.State == 0 || EaterofWorldsBody.State == 2) + { + int num = Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Vector2.Zero, 501, 13, 0f, -1, 0f, 0f, 0f); + Main.projectile[num].timeLeft = 1; + CProjectile.Update(num); + for (int i = 0; i < 6; i++) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI / 3.0 * (double)i, default(Vector2)) * 5f, 909, 14, 0f, -1, 0f, 0f, 0f); + } + } + } + + public override void OnHurtPlayers(GetDataHandlers.PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + switch (Main.rand.Next(1, 4)) + { + case 1: + global::Challenger.Challenger.SendPlayerText("毒牙咬击", new Color(177, 94, 255), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + case 2: + global::Challenger.Challenger.SendPlayerText("创死你", new Color(177, 94, 255), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + default: + global::Challenger.Challenger.SendPlayerText("呜哇哇", new Color(177, 94, 255), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + } + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/EaterofWorldsTail.cs b/Challenger/Challenger.CNPCs/EaterofWorldsTail.cs new file mode 100644 index 000000000..c6b65bbe4 --- /dev/null +++ b/Challenger/Challenger.CNPCs/EaterofWorldsTail.cs @@ -0,0 +1,29 @@ +using ChalleAnger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; + +namespace Challenger +{ + public class EaterofWorldsTail : CNPC + { + public EaterofWorldsTail(NPC npc) + : base(npc) + { + } + + public override void OnKilled() + { + if (EaterofWorldsBody.State == 0 || EaterofWorldsBody.State == 2) + { + int num = Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Vector2.Zero, 501, 13, 0f, -1, 0f, 0f, 0f); + Main.projectile[num].timeLeft = 1; + CProjectile.Update(num); + for (int i = 0; i < 6; i++) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Utils.RotatedBy(Vector2.UnitY, Math.PI / 3.0 * (double)i, default(Vector2)) * 5f, 909, 14, 0f, -1, 0f, 0f, 0f); + } + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/EyeofCthulhu.cs b/Challenger/Challenger.CNPCs/EyeofCthulhu.cs new file mode 100644 index 000000000..94d5aa801 --- /dev/null +++ b/Challenger/Challenger.CNPCs/EyeofCthulhu.cs @@ -0,0 +1,241 @@ +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; +using static TShockAPI.GetDataHandlers; + +namespace Challenger +{ + public class EyeofCthulhu : CNPC + { + public const float CooldownOfSkill0 = 150f; + + public const float CooldownOfSkill1 = 150f; + + public const float CooldownOfSkill2 = 500f; + + public const int ProjectileSpeedOfState3 = 5; + + public float skill0 = 150f; + + public float skill1 = 150f; + + public float skill2 = 500f; + + public EyeofCthulhu(NPC npc) + : base(npc) + { + } + + private void Spawn(int number) + { + int num = NPC.CountNPCS(5); + if (num >= 20) + { + return; + } + if (20 - num > number) + { + for (int i = 0; i < number; i++) + { + NPC.NewNPC((IEntitySource)null, (int)((Entity)npc).Bottom.X + Main.rand.Next(-32, 33), (int)((Entity)npc).Bottom.Y, 5, 0, 0f, 0f, 0f, 0f, 255); + } + } + else + { + for (int j = 0; j < 20 - num; j++) + { + NPC.NewNPC((IEntitySource)null, (int)((Entity)npc).Bottom.X + Main.rand.Next(-32, 33), (int)((Entity)npc).Bottom.Y, 5, 0, 0f, 0f, 0f, 0f, 255); + } + } + } + + public override void NPCAI() + { + NPCAimedTarget targetData = npc.GetTargetData(true); + if (npc.ai[0] == 1f && npc.ai[1] % 2f == 0f) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.ToRotationVector2(npc.rotation) * 3f, 96, 8, 5f, -1, 0f, 0f, 0f); + } + SetState(); + switch (state) + { + case 1: + skill0 -= 1f; + if (skill0 < 0f && npc.ai[1] == 0f) + { + Vector2 val4 = ((Entity)npc).DirectionTo(targetData.Position); + if (npc.ai[2] == 40f) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Bottom, val4 * 8f, 96, 4, 5f, -1, 0f, 0f, 0f); + } + else if (npc.ai[2] == 80f) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Bottom, val4 * 10f, 96, 5, 5f, -1, 0f, 0f, 0f); + } + else if (npc.ai[2] == 100f) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Bottom, val4 * 10f, 96, 6, 6f, -1, 0f, 0f, 0f); + skill0 = 150f + (float)Main.rand.Next(100); + } + } + if (npc.ai[1] == 2f && (npc.ai[3] == 0f || npc.ai[3] == 1f || npc.ai[3] == 2f) && npc.ai[2] <= 2f) + { + NPC? obj3 = npc; + ((Entity)obj3).velocity = ((Entity)obj3).velocity + ((Entity)npc).velocity * 0.1f; + npc.netUpdate = true; + } + break; + case 2: + skill0 -= 1f; + if (skill0 < 0f && npc.ai[1] == 0f) + { + Vector2 val2 = ((Entity)npc).DirectionTo(targetData.Position); + if (npc.ai[2] == 120f) + { + if (Main.rand.Next(1, 3) == 1) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val2 * 12f, 96, 8, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, 0.1, default(Vector2)) * 11f, 96, 7, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, -0.1, default(Vector2)) * 11f, 96, 7, 5f, -1, 0f, 0f, 0f); + } + else + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, 0.1, default(Vector2)) * 11f, 96, 7, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, -0.1, default(Vector2)) * 11f, 96, 7, 5f, -1, 0f, 0f, 0f); + } + skill0 = 150f; + npc.ai[2] = 100f; + Spawn(2); + } + } + if (npc.ai[1] == 2f && (npc.ai[3] == 0f || npc.ai[3] == 1f || npc.ai[3] == 2f) && npc.ai[2] == 0f) + { + NPC? obj2 = npc; + ((Entity)obj2).velocity = ((Entity)obj2).velocity + ((Entity)npc).velocity; + Vector2 val3 = Terraria.Utils.SafeNormalize(((Entity)npc).velocity, Vector2.Zero); + npc.netUpdate = true; + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + val3 * 2f, val3 * 18f, 96, 5, 5f, -1, 0f, 0f, 0f); + } + break; + case 3: + skill1 -= 1f; + if (skill1 < 0f) + { + Spawn(3); + skill1 = 150f + (float)Main.rand.Next(51); + } + if (npc.ai[1] == 4f && npc.ai[2] % 15f == 0f) + { + int num2 = Collect.MyNewProjectile(null, ((Entity)npc).Center, Terraria.Utils.RotateRandom(Vector2.One, 6.2831854820251465) * 0.5f, 96, 6, 5f); + Main.projectile[num2].timeLeft = 240; + CProjectile.Update(num2); + } + if (npc.ai[1] == 4f && (npc.ai[3] == 0f || npc.ai[3] == 1f || npc.ai[3] == 2f) && npc.ai[2] == 0f) + { + NPC? obj4 = npc; + ((Entity)obj4).velocity = ((Entity)obj4).velocity + ((Entity)npc).velocity; + Vector2 val5 = Terraria.Utils.SafeNormalize(((Entity)npc).velocity, Vector2.Zero); + npc.netUpdate = true; + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + val5 * 2f, val5 * 20f, 96, 5, 5f, -1, 0f, 0f, 0f); + } + break; + case 4: + skill1 -= 1f; + skill2 -= 1f; + if (skill1 < 0f) + { + Spawn(3); + skill1 = 250f + (float)Main.rand.Next(150); + } + if (skill2 < 0f && npc.ai[1] == 4f && npc.ai[3] == 4f) + { + npc.ai[3] = 0f; + skill2 = 500f; + } + if (npc.ai[1] == 4f && npc.ai[2] % 10f == 0f) + { + int num = Collect.MyNewProjectile(null, ((Entity)npc).Center, Terraria.Utils.RotateRandom(Vector2.One, 6.2831854820251465) * 0.5f, 96, 9, 5f); + Main.projectile[num].timeLeft = 600; + CProjectile.Update(num); + } + if (npc.ai[1] == 4f && (npc.ai[3] == 0f || npc.ai[3] == 1f || npc.ai[3] == 2f) && npc.ai[2] == 0f) + { + NPC? obj = npc; + ((Entity)obj).velocity = ((Entity)obj).velocity + ((Entity)npc).velocity; + Vector2 val = Terraria.Utils.SafeNormalize(((Entity)npc).velocity, Vector2.Zero); + npc.netUpdate = true; + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + val * 2f, val * 30f, 96, 6, 5f, -1, 0f, 0f, 0f); + } + break; + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.7f) + { + if (state == 0) + { + state = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("燃烧!无法熄灭的火焰", new Color(200, 200, 200)); + } + } + return 0; + } + if ((float)npc.life >= (float)LifeMax * 0.4f) + { + if (state == 1) + { + state = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("你找到那颗子弹了吗", new Color(200, 200, 200)); + } + } + return 1; + } + if ((float)npc.life >= (float)LifeMax * 0.2f) + { + if (state == 2) + { + state = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("猪突猛进!", new Color(200, 200, 200)); + } + } + return 2; + } + if (state == 3) + { + state = 4; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("疯狗狂叫!!!", new Color(200, 200, 200)); + } + } + return 3; + } + + public override void OnHurtPlayers(PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + int num = Main.rand.Next(1, 3); + if (num == 1) + { + global::Challenger.Challenger.SendPlayerText("就这就这!", new Color(200, 200, 200), ((Entity)npc).Center + new Vector2(0f, -30f)); + } + else + { + global::Challenger.Challenger.SendPlayerText("看我创死你", new Color(200, 200, 200), ((Entity)npc).Center + new Vector2(0f, -30f)); + } + } + } + } + +} diff --git a/Challenger/Challenger.CNPCs/EyeofCthulhu_DemonEye.cs b/Challenger/Challenger.CNPCs/EyeofCthulhu_DemonEye.cs new file mode 100644 index 000000000..bc34e2942 --- /dev/null +++ b/Challenger/Challenger.CNPCs/EyeofCthulhu_DemonEye.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; + +namespace Challenger +{ + public class EyeofCthulhu_DemonEye : CNPC + { + public static readonly float CooldownOfSkill0 = 200f; + + public float skill0 = CooldownOfSkill0; + + public EyeofCthulhu_DemonEye(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + skill0 -= 1f; + NPCAimedTarget targetData = npc.GetTargetData(true); + Vector2 val = ((Entity)npc).DirectionTo(targetData.Position + new Vector2((float)Main.rand.Next(-32, 33), (float)Main.rand.Next(-32, 33))); + if (skill0 < 0f && val.X * ((Entity)npc).velocity.X > 0f && npc.HasPlayerTarget) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 6f, 84, 4, 5f, -1, 0f, 0f, 0f); + skill0 += CooldownOfSkill0 + (float)Main.rand.Next(51); + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/QueenBee.cs b/Challenger/Challenger.CNPCs/QueenBee.cs new file mode 100644 index 000000000..32794917f --- /dev/null +++ b/Challenger/Challenger.CNPCs/QueenBee.cs @@ -0,0 +1,184 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; +using static TShockAPI.GetDataHandlers; + +namespace Challenger +{ + + public class QueenBee : CNPC + { + private int timer = 0; + + public QueenBee(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + NPCAimedTarget targetData = npc.GetTargetData(true); + SetState(); + switch (state) + { + case 1: + if (npc.ai[0] == 0f && (npc.ai[1] == 1f || npc.ai[1] == 3f || npc.ai[1] == 5f) && npc.ai[2] == 0f && timer < 1) + { + timer++; + if ((((Entity)npc).direction == 1 && targetData.Position.X > ((Entity)npc).position.X) || (((Entity)npc).direction == -1 && targetData.Position.X < ((Entity)npc).position.X)) + { + NPC? obj5 = npc; + ((Entity)obj5).velocity = ((Entity)obj5).velocity + ((Entity)npc).velocity * 0.04f; + } + else + { + NPC? obj6 = npc; + ((Entity)obj6).velocity = ((Entity)obj6).velocity - ((Entity)npc).velocity * 0.04f; + } + npc.netUpdate = true; + } + else + { + timer = 0; + } + break; + case 2: + if (npc.ai[0] == 0f && (npc.ai[1] == 1f || npc.ai[1] == 3f || npc.ai[1] == 5f) && npc.ai[2] == 0f && timer < 1) + { + timer++; + if ((((Entity)npc).direction == 1 && targetData.Position.X > ((Entity)npc).position.X) || (((Entity)npc).direction == -1 && targetData.Position.X < ((Entity)npc).position.X)) + { + NPC? obj7 = npc; + ((Entity)obj7).velocity = ((Entity)obj7).velocity + ((Entity)npc).velocity * 0.07f; + } + else + { + NPC? obj8 = npc; + ((Entity)obj8).velocity = ((Entity)obj8).velocity - ((Entity)npc).velocity * 0.07f; + } + npc.netUpdate = true; + } + else + { + timer = 0; + } + break; + case 3: + if (npc.ai[0] == 0f && (npc.ai[1] == 1f || npc.ai[1] == 3f || npc.ai[1] == 5f) && npc.ai[2] == 0f && timer < 1) + { + timer++; + if ((((Entity)npc).direction == 1 && targetData.Position.X > ((Entity)npc).position.X) || (((Entity)npc).direction == -1 && targetData.Position.X < ((Entity)npc).position.X)) + { + NPC? obj3 = npc; + ((Entity)obj3).velocity = ((Entity)obj3).velocity + ((Entity)npc).velocity * 0.12f; + } + else + { + NPC? obj4 = npc; + ((Entity)obj4).velocity = ((Entity)obj4).velocity - ((Entity)npc).velocity * 0.12f; + } + npc.netUpdate = true; + } + else + { + timer = 0; + } + if (Main.rand.Next(6) == 0) + { + Projectile.NewProjectile(null as IEntitySource, ((Entity)npc).Bottom, Terraria.Utils.RotateRandom(Vector2.UnitY, Math.PI / 2.0) * -8f, 719, 12, 1f, -1, 0f, 0f, 0f); + } + break; + case 4: + if (npc.ai[0] == 0f && (npc.ai[1] == 1f || npc.ai[1] == 3f || npc.ai[1] == 5f) && npc.ai[2] == 0f && timer < 1) + { + timer++; + if ((((Entity)npc).direction == 1 && targetData.Position.X > ((Entity)npc).position.X) || (((Entity)npc).direction == -1 && targetData.Position.X < ((Entity)npc).position.X)) + { + NPC? obj = npc; + ((Entity)obj).velocity = ((Entity)obj).velocity + ((Entity)npc).velocity * 0.12f; + } + else + { + NPC? obj2 = npc; + ((Entity)obj2).velocity = ((Entity)obj2).velocity - ((Entity)npc).velocity * 0.12f; + } + npc.netUpdate = true; + } + else + { + timer = 0; + } + if (npc.ai[1] % 12f == 0f) + { + Projectile.NewProjectile(null, ((Entity)npc).position - new Vector2((float)Main.rand.Next(-1024, 1024), 384f), Vector2.UnitY * -3f, 719, 20, 1f, -1, 0f, 0f, 0f); + } + break; + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.7f) + { + if (state == 0) + { + state = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("谁人惊扰了我的蜂巢!", Color.Yellow); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.4f) + { + if (state == 1) + { + state = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("不许抢我的蜂蜜", Color.Yellow); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.2f) + { + if (state == 2) + { + state = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("毒刺射你一脸", Color.Yellow); + } + } + return state; + } + if (state == 3) + { + state = 4; + } + return state; + } + + public override void OnHurtPlayers(PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + switch (Main.rand.Next(1, 4)) + { + case 1: + global::Challenger.Challenger.SendPlayerText("嗡嗡", Color.Yellow, ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + case 2: + global::Challenger.Challenger.SendPlayerText("嗡嗡嗡嗡", Color.Yellow, ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + default: + global::Challenger.Challenger.SendPlayerText("吱嗡", Color.Yellow, ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + } + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/Skeletron.cs b/Challenger/Challenger.CNPCs/Skeletron.cs new file mode 100644 index 000000000..add9b7244 --- /dev/null +++ b/Challenger/Challenger.CNPCs/Skeletron.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; +using static TShockAPI.GetDataHandlers; + +namespace Challenger +{ + public class Skeletron : CNPC + { + private float rotate = 0f; + + private List surrandIndex = new List(); + + private const int MaxSurrandNum = 10; + + private int skill0 = 240; + + public Skeletron(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + skill0--; + SetState(); + NPCAimedTarget targetData = npc.GetTargetData(true); + switch (state) + { + case 1: + if (skill0 < 0) + { + Vector2 val = Terraria.Utils.DirectionTo(((Entity)npc).Center, ((NPCAimedTarget)(targetData)).Center); + Projectile.NewProjectile(null as IEntitySource, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.5235987901687622, default(Vector2)), 270, 11, 5f, -1, 0f, 0f, 0f); + skill0 = 220 + Main.rand.Next(-60, 61); + } + break; + case 2: + if (skill0 < 0) + { + for (int l = 0; l < 4; l++) + { + Projectile.NewProjectile(null as IEntitySource, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI / 2.0 * (double)l + (double)rotate, default(Vector2)) * 4f, 270, 12, 5f, -1, 0f, 0f, 0f); + } + skill0 = 160 + Main.rand.Next(-60, 61); + } + break; + case 3: + if (skill0 < 0) + { + int num3 = Main.rand.Next(4, 7); + for (int k = 0; k < num3; k++) + { + Projectile.NewProjectile(null as IEntitySource, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI * 2.0 / 5.0 * (double)k + (double)rotate, default(Vector2)) * 3f, 270, 15, 5f, -1, 0f, 0f, 0f); + } + skill0 = 120 + Main.rand.Next(-60, 61); + } + if (npc.ai[1] == 1f && npc.ai[2] % 10f == 0f) + { + int num4 = Projectile.NewProjectile(null, ((Entity)npc).Center, Vector2.Zero, 299, 15, 5f, -1, 0f, 0f, 0f); + Main.projectile[num4].timeLeft = 40; + CProjectile.Update(num4); + } + break; + case 4: + if (skill0 < 0) + { + int num = Main.rand.Next(5, 10); + if (Main.rand.Next(2) == 0) + { + for (int i = 0; i < num; i++) + { + Projectile.NewProjectile(null as IEntitySource, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI / 3.0 * (double)i + (double)rotate, default(Vector2)) * 3f, 270, 18, 30f, -1, 0f, 0f, 0f); + } + } + else + { + for (int j = 0; j < num; j++) + { + Projectile.NewProjectile(null as IEntitySource, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI / 4.0 * (double)j + (double)rotate, default(Vector2)) * 5f, 299, 18, 30f, -1, 0f, 0f, 0f); + } + } + skill0 = 100 + Main.rand.Next(-60, 31); + } + if (npc.ai[1] == 1f && npc.ai[2] % 5f == 0f) + { + int num2 = Projectile.NewProjectile(null, ((Entity)npc).Center, Vector2.Zero, 299, 20, 5f, -1, 0f, 0f, 0f); + Main.projectile[num2].timeLeft = 180; + CProjectile.Update(num2); + } + break; + } + if (ai[0] < 10f && Main.rand.Next(180) == 0) + { + int num5 = NPC.NewNPC(npc.GetSpawnSourceForNPCFromNPCAI(), (int)((Entity)npc).Center.X, (int)((Entity)npc).Center.Y, 34, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num5].lifeMax = 500; + Main.npc[num5].life = 501; + ai[0] += 1f; + surrandIndex.Add(num5); + } + ai[0] -= surrandIndex.RemoveAll((int x) => Main.npc[x] == null || !((Entity)Main.npc[x]).active || Main.npc[x].netID != 34); + rotate += 0.1f; + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.7f) + { + if (state == 0) + { + state = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("被封印的骷髅帝王苏醒", new Color(150, 143, 102)); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.4f) + { + if (state == 1) + { + state = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("嘎吱作响", new Color(150, 143, 102)); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.2f) + { + if (state == 2) + { + state = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("诅咒开始应验", new Color(150, 143, 102)); + } + } + return state; + } + if (state == 3) + { + state = 4; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("惨朽不堪", new Color(150, 143, 102)); + } + } + return state; + } + + public override void OnHurtPlayers(PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + switch (Main.rand.Next(1, 4)) + { + case 1: + global::Challenger.Challenger.SendPlayerText("再让我逮到一下你就玩玩", new Color(150, 143, 102), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + case 2: + global::Challenger.Challenger.SendPlayerText("创死你", new Color(150, 143, 102), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + default: + global::Challenger.Challenger.SendPlayerText("想再贴贴吗?", new Color(150, 143, 102), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + } + } + } + + public override void OnKilled() + { + for (int i = 0; i < 35; i++) + { + Projectile.NewProjectile(null, npc.Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI * 2.0 / 35.0 * (double)i, default(Vector2)) * 5f, 299, 21, 10f, -1, 0f, 0f, 0f); + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/SkeletronHand.cs b/Challenger/Challenger.CNPCs/SkeletronHand.cs new file mode 100644 index 000000000..82b5c65e1 --- /dev/null +++ b/Challenger/Challenger.CNPCs/SkeletronHand.cs @@ -0,0 +1,116 @@ +using System; +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; + +namespace Challenger +{ + public class SkeletronHand : CNPC + { + private int timer = 0; + + public SkeletronHand(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + SetState(); + switch (state - 1) + { + case 0: + if (npc.ai[2] == 2f || npc.ai[2] == 5f) + { + int num2 = Projectile.NewProjectile(null, ((Entity)npc).Center, Vector2.Zero, 299, 10, 5f, -1, 0f, 0f, 0f); + Main.projectile[num2].timeLeft = 30; + CProjectile.Update(num2); + } + break; + case 1: + if (npc.ai[2] == 2f || npc.ai[2] == 5f) + { + timer++; + if (timer % 5 == 0) + { + int num = Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Vector2.Zero, 299, 10, 5f, -1, 0f, 0f, 0f); + Main.projectile[num].timeLeft = 2400; + CProjectile.Update(num); + } + } + else + { + timer = 0; + } + break; + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.7f) + { + if (state == 0) + { + state = 1; + } + return state; + } + if (state == 1) + { + state = 2; + if (npc.ai[0] == -1f && global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("你打痛我左手了!!!", new Color(150, 143, 102)); + } + if (npc.ai[0] == 1f && global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("你打痛我右手了!!!", new Color(150, 143, 102)); + } + } + return state; + } + + public override void OnKilled() + { + if (npc.ai[0] == -1f) + { + double num = Main.rand.NextDouble() * 3.0; + for (int i = 0; i < 10; i++) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI / 5.0 * (double)i + num, default(Vector2)) * 5f, 270, 20, 30f, -1, 0f, 0f, 0f); + } + } + else + { + double num2 = Main.rand.NextDouble() * 3.0; + for (int j = 0; j < 10; j++) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.UnitY, Math.PI / 5.0 * (double)j + num2, default(Vector2)) * 5f, 299, 20, 30f, -1, 0f, 0f, 0f); + } + } + } + + public override void OnHurtPlayers(GetDataHandlers.PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + switch (Main.rand.Next(1, 4)) + { + case 1: + global::Challenger.Challenger.SendPlayerText("就这还想打倒我骷髅王爷爷", new Color(150, 143, 102), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + case 2: + global::Challenger.Challenger.SendPlayerText("看我一记耳光", new Color(150, 143, 102), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + default: + global::Challenger.Challenger.SendPlayerText("离地牢远点!!!", new Color(150, 143, 102), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + } + } + ((GetDataHandledEventArgs)e).Player.SetBuff(23, 60, false); + } + } +} diff --git a/Challenger/Challenger.CNPCs/Skeletron_Surrand.cs b/Challenger/Challenger.CNPCs/Skeletron_Surrand.cs new file mode 100644 index 000000000..98d6b7c9e --- /dev/null +++ b/Challenger/Challenger.CNPCs/Skeletron_Surrand.cs @@ -0,0 +1,34 @@ +using Challenger; +using Terraria; +using Terraria.DataStructures; + +namespace Challenger +{ + public class Skeletron_Surrand : CNPC + { + private int skill0 = 240; + + public Skeletron_Surrand(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + skill0--; + if (skill0 < 0) + { + int num = NPC.NewNPC(npc.GetSpawnSourceForNPCFromNPCAI(), (int)((Entity)npc).Center.X, (int)((Entity)npc).Center.Y, 33, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num].lifeMax = 100; + Main.npc[num].life = 101; + skill0 = 180 + Main.rand.Next(-60, 61); + } + } + + public override void OnKilled() + { + NPCAimedTarget targetData = npc.GetTargetData(true); + Projectile.NewProjectile(null, ((Entity)npc).Center, Utils.DirectionTo(((Entity)npc).Center, ((NPCAimedTarget)(targetData)).Center) * 5f, 270, 6, 30f, -1, 0f, 0f, 0f); + } + } +} diff --git a/Challenger/Challenger.CNPCs/SlimeKing.cs b/Challenger/Challenger.CNPCs/SlimeKing.cs new file mode 100644 index 000000000..24dea2ec1 --- /dev/null +++ b/Challenger/Challenger.CNPCs/SlimeKing.cs @@ -0,0 +1,218 @@ +using System; +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; + +namespace Challenger +{ + public class SlimeKing : CNPC + { + public readonly float CooldownOfSkill0 = 250f; + + public readonly float CooldownOfSkill1 = 250f; + + public readonly float CooldownOfSkill2 = 250f; + + public SlimeKing(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + NPCAimedTarget targetData = npc.GetTargetData(true); + if (npc.ai[0] > -200f && npc.ai[0] < -120f) + { + Point val = Terraria.Utils.ToTileCoordinates(((Entity)npc).Bottom); + int num = 20; + int num2 = 1; + val.X += ((Entity)npc).direction * 3; + int num3 = (int)(npc.ai[0] / 2f + 101f); + int num4 = 4; + int num5 = num3 / num4 * num4; + int num6 = num5 + num4; + if (num3 % num4 != 0) + { + num6 = num5; + } + for (int i = num5; i < num6 && i < num; i++) + { + int num7 = i * num2; + npc.AI_123_Deerclops_TryMakingSpike(ref val, ((Entity)npc).direction, num, i, num7); + npc.AI_123_Deerclops_TryMakingSpike(ref val, -((Entity)npc).direction, num, i, num7); + } + } + SetState(); + switch (state) + { + case 1: + ai[0] -= 1f; + + if (ai[0] < 0f && npc.ai[0] != -120f && npc.ai[0] != -200f) + { + Vector2 val3 = new Vector2(); + float directionX = (targetData.Position.X - ((Entity)npc).Center.X > 0f) ? 1f : -1f; + val3.X = directionX; + val3.Y = -2f; + + Entity entity = (Entity)npc; + entity.velocity.X += val3.X * (float)Main.rand.Next(5, 12); + entity.velocity.Y += val3.Y * (float)Main.rand.Next(1, 4); + + ai[0] = CooldownOfSkill0 + (float)Main.rand.Next(121); + npc.netUpdate = true; + } + break; + case 2: + ai[0] -= 1f; + ai[1] -= 1f; + + if (ai[0] < 0f && npc.ai[0] != -120f && npc.ai[0] != -200f) + { + Vector2 val5 = new Vector2(); + float directionX = (targetData.Position.X - ((Entity)npc).Center.X > 0f) ? 1f : -1f; + val5.X = directionX; + val5.Y = -2f; + + Entity entity = (Entity)npc; + entity.velocity += val5 * (float)Main.rand.Next(3, 7); + + ai[0] = CooldownOfSkill0 + (float)Main.rand.Next(81); + npc.netUpdate = true; + } + + if (ai[1] < 0f) + { + Projectile.NewProjectile(null, ((Entity)npc).Center, Vector2.Zero, 464, 16, 32f, -1, 0f, 0f, 0f); + ai[1] = CooldownOfSkill1 + (float)Main.rand.Next(151); + } + break; + case 3: + { + ai[1] -= 1f; + ai[2] -= 1f; + Vector2 val4 = ((Entity)npc).DirectionTo(targetData.Position); + ((Vector2)(val4)).Normalize(); + val4 *= 2.5f; + if (ai[1] < 0f) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Vector2.Zero, 464, 16, 64f, -1, 0f, 0f, 0f); + ai[1] = CooldownOfSkill1 + (float)Main.rand.Next(121); + } + if (ai[2] < 120f && ai[2] % 40f == 0f) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val4, 348, 18, 64f, -1, 0f, 0f, 0f); + } + if (ai[2] < 0f) + { + ai[2] = CooldownOfSkill2 + 300f; + } + break; + } + case 4: + { + ai[1] -= 1f; + ai[2] -= 1f; + if (ai[1] < 0f && ai[2] == 500f) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.One, Main.rand.NextDouble() * Math.PI, default(Vector2)), 464, 8, 64f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(Vector2.One, Main.rand.NextDouble() * Math.PI, default(Vector2)), 464, 8, 64f, -1, 0f, 0f, 0f); + ai[1] = CooldownOfSkill1 + (float)Main.rand.Next(151); + } + Vector2 val2 = ((Entity)npc).DirectionTo(targetData.Position); + ((Vector2)(val2)).Normalize(); + val2 *= 2.25f; + if (ai[2] < 180f && ai[2] % 60f == 0f) + { + if (Main.rand.Next(1, 3) == 2) + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val2, 348, 16, 64f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, 0.45, default(Vector2)), 348, 14, 64f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, -0.45, default(Vector2)), 348, 14, 64f, -1, 0f, 0f, 0f); + } + else + { + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, 0.4, default(Vector2)), 348, 14, 64f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val2, -0.4, default(Vector2)), 348, 14, 64f, -1, 0f, 0f, 0f); + } + } + if (ai[2] < 0f) + { + ai[2] = CooldownOfSkill2 + 200f; + } + break; + } + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.7f) + { + if (state == 0) + { + state = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("史莱姆王习得冰魔法归来", new Color(0, 146, 255)); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.4f) + { + if (state == 1) + { + state = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("寒风呼啸", new Color(0, 146, 255)); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.2f) + { + if (state == 2) + { + state = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("你感觉寒冷刺骨", new Color(0, 146, 255)); + } + } + return state; + } + if (state == 3) + { + state = 4; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("史莱姆王发怒了", new Color(0, 146, 255)); + } + } + return state; + } + + public override void OnHurtPlayers(GetDataHandlers.PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + switch (Main.rand.Next(1, 4)) + { + case 1: + global::Challenger.Challenger.SendPlayerText("走位真菜", new Color(0, 146, 255), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + case 2: + global::Challenger.Challenger.SendPlayerText("连我都打不过,回家喝奶吧你", new Color(0, 146, 255), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + default: + global::Challenger.Challenger.SendPlayerText("小辣鸡", new Color(0, 146, 255), ((Entity)npc).Center + new Vector2(0f, -30f)); + break; + } + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/WallofFlesh.cs b/Challenger/Challenger.CNPCs/WallofFlesh.cs new file mode 100644 index 000000000..35aee9101 --- /dev/null +++ b/Challenger/Challenger.CNPCs/WallofFlesh.cs @@ -0,0 +1,125 @@ +using System; +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; + +namespace Challenger +{ + public class WallofFlesh : CNPC + { + public static readonly float CooldownOfSkill0 = 150f; + + public static readonly float CooldownOfSkill1 = 120f; + + public float skill0 = CooldownOfSkill0; + + public float skill1 = CooldownOfSkill1; + + public WallofFlesh(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + skill0 -= 1f; + skill1 -= 1f; + NPCAimedTarget targetData = npc.GetTargetData(true); + Vector2 val = ((Entity)npc).DirectionTo(targetData.Position); + SetState(); + if (skill0 < 0f) + { + switch (state) + { + case 0: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 13f, 467, 14, 5f, -1, 0f, 0f, 0f); + skill0 = CooldownOfSkill0 + (float)Main.rand.Next(51); + break; + case 1: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 20f, 467, 18, 5f, -1, 0f, 0f, 0f); + skill0 = CooldownOfSkill0; + break; + case 2: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 26f, 467, 22, 5f, -1, 0f, 0f, 0f); + skill0 = CooldownOfSkill0 - 20f; + break; + } + } + if (skill1 < 0f) + { + switch (state) + { + case 0: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 14, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 14, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 14, 5f, -1, 0f, 0f, 0f); + skill1 = CooldownOfSkill0 + (float)Main.rand.Next(51); + break; + case 1: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 18, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 18, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 18, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 18, 5f, -1, 0f, 0f, 0f); + skill1 = CooldownOfSkill0; + break; + case 2: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 20, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 20, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 20, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 20, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 20, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center + new Vector2(0f, (float)Main.rand.Next(-200, 200)), (val + Terraria.Utils.RotateRandom(Vector2.One, Math.PI) * 0.2f) * 10f, 811, 20, 5f, -1, 0f, 0f, 0f); + skill1 = CooldownOfSkill0; + break; + } + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.6f) + { + if (state == 0) + { + state = 1; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("罪恶血祭召唤远古守卫", new Color(255, 77, 0)); + } + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.3f) + { + if (state == 1) + { + state = 2; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("付出代价吧!", new Color(255, 77, 0)); + } + } + return state; + } + if (state == 2) + { + state = 3; + if (global::Challenger.Challenger.config.EnableBroadcastConsumptionMode) + { + TSPlayer.All.SendMessage("速度与激情", new Color(255, 77, 0)); + } + } + return state; + } + + public override void OnHurtPlayers(GetDataHandlers.PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + global::Challenger.Challenger.SendPlayerText("咬碎你", new Color(0, 146, 255), npc.Center); + } + } + } +} diff --git a/Challenger/Challenger.CNPCs/WallofFleshEye.cs b/Challenger/Challenger.CNPCs/WallofFleshEye.cs new file mode 100644 index 000000000..f4407c18d --- /dev/null +++ b/Challenger/Challenger.CNPCs/WallofFleshEye.cs @@ -0,0 +1,106 @@ +using Challenger; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using TShockAPI; + +namespace Challenger +{ + + public class WallofFleshEye : CNPC + { + public static readonly float CooldownOfSkill0 = 140f; + + public float skill0 = CooldownOfSkill0; + + public WallofFleshEye(NPC npc) + : base(npc) + { + } + + public override void NPCAI() + { + skill0 -= 1f; + if (skill0 < 0f) + { + NPCAimedTarget targetData = npc.GetTargetData(true); + Vector2 val = ((Entity)npc).DirectionTo(targetData.Position); + SetState(); + switch (state) + { + case 0: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 8f, 83, 12, 5f, -1, 0f, 0f, 0f); + skill0 += CooldownOfSkill0 + (float)Main.rand.Next(100); + break; + case 1: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 9f, 83, 12, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, -0.1, default(Vector2)) * 8f, 83, 12, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.1, default(Vector2)) * 8f, 83, 12, 5f, -1, 0f, 0f, 0f); + skill0 += CooldownOfSkill0 + (float)Main.rand.Next(80); + break; + case 2: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 9f, 83, 14, 20f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.1, default(Vector2)) * 10f, 83, 14, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, -0.1, default(Vector2)) * 10f, 83, 14, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.2, default(Vector2)) * 8f, 83, 14, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, -0.2, default(Vector2)) * 8f, 83, 14, 5f, -1, 0f, 0f, 0f); + skill0 += CooldownOfSkill0 + (float)Main.rand.Next(30); + break; + case 3: + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, val * 15f, 83, 15, 20f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.1, default(Vector2)) * 15f, 83, 15, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, -0.1, default(Vector2)) * 15f, 83, 15, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.15, default(Vector2)) * 14f, 83, 15, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, -0.15, default(Vector2)) * 14f, 83, 15, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.2, default(Vector2)) * 13f, 83, 15, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, -0.2, default(Vector2)) * 13f, 83, 15, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, 0.25, default(Vector2)) * 12f, 83, 15, 5f, -1, 0f, 0f, 0f); + Projectile.NewProjectile((IEntitySource)null, ((Entity)npc).Center, Terraria.Utils.RotatedBy(val, -0.25, default(Vector2)) * 12f, 83, 15, 5f, -1, 0f, 0f, 0f); + skill0 += CooldownOfSkill0; + break; + } + } + } + + public override int SetState() + { + if ((float)npc.life >= (float)LifeMax * 0.7f) + { + if (state == 0) + { + state = 1; + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.4f) + { + if (state == 1) + { + state = 2; + } + return state; + } + if ((float)npc.life >= (float)LifeMax * 0.2f) + { + if (state == 2) + { + state = 3; + } + return state; + } + if (state == 3) + { + state = 4; + } + return state; + } + + public override void OnHurtPlayers(GetDataHandlers.PlayerDamageEventArgs e) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + global::Challenger.Challenger.SendPlayerText("这么想看清我的卡姿兰大眼是吧", new Color(0, 146, 255), ((Entity)npc).Center + new Vector2(0f, -30f)); + } + } + } +} diff --git a/Challenger/Challenger.CProjs/BeetleHeal.cs b/Challenger/Challenger.CProjs/BeetleHeal.cs new file mode 100644 index 000000000..a76efd8cd --- /dev/null +++ b/Challenger/Challenger.CProjs/BeetleHeal.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using TShockAPI; + +namespace Challenger +{ + public class BeetleHeal : CProjectile + { + private BeetleHeal(Projectile projectile, float[] ai, int lable) + : base(projectile, ai, lable) + { + } + + public override void ProjectileAI() + { + Player val = global::Challenger.Challenger.NearWeakestPlayer(proj.Center, 640000f, Main.player[proj.owner]); + if (val != null && proj.owner != val.whoAmI) + { + Projectile? obj = proj; + obj.Center = obj.Center + (val.Center - proj.Center).SafeNormalize(Vector2.Zero) * 10f; + } + if (proj.active && proj.timeLeft <= ai[1] - 60f) + { + if (ai[0] > 200f) + { + ai[0] = 200f; + } + else if (ai[0] < 0f) + { + ai[0] = 0f; + } + try + { + int num = (int)ai[0]; + TSPlayer[] players = TShock.Players; + foreach (TSPlayer val2 in players) + { + if (val2 == null || !val2.Active || !val2.TPlayer.active || val2.TPlayer.dead || val2.Index == proj.owner) + { + continue; + } + Vector2 val3 = proj.Center - val2.TPlayer.Center; + if (((Vector2)val3).LengthSquared() <= val2.TPlayer.width * val2.TPlayer.height) + { + global::Challenger.Challenger.HealPlayer(val2.TPlayer, num, visible: false); + val2.SetBuff(95, 300, false); + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + global::Challenger.Challenger.SendPlayerText($"甲虫治疗 + {num} 治疗者:{Main.player[proj.owner].name}", new Color(210, 0, 255), val2.TPlayer.Center + new Vector2(Main.rand.Next(-60, 61), Main.rand.Next(61))); + val2.SendMessage($"你被 {Main.player[proj.owner].name} 治疗了 {num} 点生命值", new Color(210, 0, 255)); + } + else + { + global::Challenger.Challenger.SendPlayerText($"{num}", new Color(0, 255, 0), val2.TPlayer.Center + new Vector2(Main.rand.Next(-60, 61), Main.rand.Next(61))); + } + CKill(); + return; + } + } + } + catch (Exception ex) + { + TShock.Log.Error("代码异常4:" + ex.ToString()); + Console.WriteLine("代码异常4:" + ex.ToString()); + } + } + Update(); + } + + public static BeetleHeal NewCProjectile(Vector2 position, Vector2 velocity, int owner, float[] ai, int lable) + { + int num = Collect.MyNewProjectile(Projectile.GetNoneSource(), position, velocity, 121, 0, 0f, owner); + BeetleHeal beetleHeal = new BeetleHeal(Main.projectile[num], ai, lable); + beetleHeal.ai[1] = beetleHeal.proj.timeLeft; + Collect.cprojs[num] = beetleHeal; + beetleHeal.Update(); + return beetleHeal; + } + } +} diff --git a/Challenger/Challenger.CProjs/BloodBagProj.cs b/Challenger/Challenger.CProjs/BloodBagProj.cs new file mode 100644 index 000000000..be538cc31 --- /dev/null +++ b/Challenger/Challenger.CProjs/BloodBagProj.cs @@ -0,0 +1,146 @@ +using Microsoft.Xna.Framework; +using Terraria; +using TShockAPI; + +namespace Challenger +{ + public class BloodBagProj : CProjectile + { + public float v; + + private BloodBagProj(Projectile projectile, float[] ai, int lable) + : base(projectile, ai, lable) + { + } + + public override void ProjectileAI() + { + NPC val = null; + if (ai[3] != -1f) + { + val = Main.npc[(int)ai[3]]; + } + if (NPC.downedAncientCultist) + { + v = 20f; + } + else if (NPC.downedFishron || NPC.downedEmpressOfLight) + { + v = 18f; + } + else if (NPC.downedGolemBoss) + { + v = 15f; + } + else if (NPC.downedPlantBoss) + { + v = 13f; + } + else if (NPC.downedMechBossAny) + { + v = 11f; + } + else if (Main.hardMode) + { + v = 8f; + } + else if (NPC.downedBoss3) + { + v = 6f; + } + else if (NPC.downedBoss2) + { + v = 4.5f; + } + else if (NPC.downedBoss1) + { + v = 3.5f; + } + else + { + v = 2f; + } + if (val != null && (val.type == 134 || val.type == 135 || val.type == 136)) + { + v = 25f; + } + if ((int)ai[3] != -1 && val != null && val.active) + { + Projectile? obj = proj; + obj.Center = obj.Center + (val.Center - proj.Center).SafeNormalize(Vector2.Zero) * v; + } + else + { + val = global::Challenger.Challenger.NearestWeakestNPC(proj.position, 4000000f); + if (val != null) + { + Projectile? obj2 = proj; + obj2.Center = obj2.Center + (val.Center - proj.Center).SafeNormalize(Vector2.Zero) * v; + ai[3] = val.whoAmI; + } + } + Vector2 val2; + if (val != null && val.active && proj.active) + { + val2 = proj.position - val.Center; + if (((Vector2)val2).LengthSquared() <= val.width * val.height / 2) + { + NPC obj3 = val; + obj3.life += (int)ai[4]; + if (val.lifeMax < val.life) + { + val.lifeMax = val.life + 1; + } + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + global::Challenger.Challenger.SendPlayerText($"敌怪治疗 + {(int)ai[4]}", new Color(190, 255, 0), val.Center); + } + else + { + val.HealEffect((int)ai[4], true); + } + CKill(); + TSPlayer.All.SendData((PacketTypes)23, null, val.whoAmI, 0f, 0f, 0f, 0); + return; + } + } + if (proj.active && proj.timeLeft <= ai[1] - 60f) + { + Player[] player = Main.player; + foreach (Player val3 in player) + { + if (val3 == null || !val3.active) + { + continue; + } + val2 = proj.Center - val3.Center; + if (((Vector2)val2).LengthSquared() <= val3.width * val3.height / 2 && !val3.dead) + { + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + global::Challenger.Challenger.HealPlayer(Main.player[val3.whoAmI], (int)ai[0], visible: false); + global::Challenger.Challenger.SendPlayerText($"血包治疗 + {(int)ai[0]}", new Color(0, 255, 0), val3.Center); + } + else + { + global::Challenger.Challenger.HealPlayer(Main.player[val3.whoAmI], (int)ai[0]); + } + CKill(); + return; + } + } + } + Update(); + } + + public static BloodBagProj NewCProjectile(Vector2 position, Vector2 velocity, int owner, int lable, float[] ai) + { + int num = Collect.MyNewProjectile(Projectile.GetNoneSource(), position, velocity, 125, 0, 0f, owner); + BloodBagProj bloodBagProj = new BloodBagProj(Main.projectile[num], ai, lable); + bloodBagProj.ai[1] = bloodBagProj.proj.timeLeft; + Collect.cprojs[num] = bloodBagProj; + Update(num); + return bloodBagProj; + } + } +} diff --git a/Challenger/Challenger.CProjs/CrystalLeafShot.cs b/Challenger/Challenger.CProjs/CrystalLeafShot.cs new file mode 100644 index 000000000..ef4e2070e --- /dev/null +++ b/Challenger/Challenger.CProjs/CrystalLeafShot.cs @@ -0,0 +1,41 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using TShockAPI; + +namespace Challenger +{ + public class CrystalLeafShot : CProjectile + { + public CrystalLeafShot(Projectile projectile) + : base(projectile) + { + } + + public CrystalLeafShot(Projectile projectile, float[] ai, int lable) + : base(projectile, ai, lable) + { + } + + public override void MyEffect() + { + try + { + if (lable == 0 && proj.type == 227) + { + int num = Collect.MyNewProjectile(Projectile.GetNoneSource(), Main.player[proj.owner].Center + new Vector2(0f, -60f), proj.velocity.RotatedBy(-0.05, default), 227, 75, 5f, proj.owner); + Collect.cprojs[num] = new CrystalLeafShot(Main.projectile[num], new float[0], 1); + Update(num); + num = Collect.MyNewProjectile(Projectile.GetNoneSource(), Main.player[proj.owner].Center + new Vector2(0f, -60f), proj.velocity.RotatedBy(0.05, default), 227, 75, 5f, proj.owner); + Collect.cprojs[num] = new CrystalLeafShot(Main.projectile[num], new float[0], 1); + Update(num); + } + } + catch (Exception ex) + { + TShock.Log.Error("CrystalLeafShot -> MyEffect 异常:" + ex.ToString()); + Console.WriteLine("CrystalLeafShot -> MyEffect 异常:" + ex.ToString()); + } + } + } +} diff --git a/Challenger/Challenger.CProjs/FossiArmorProj.cs b/Challenger/Challenger.CProjs/FossiArmorProj.cs new file mode 100644 index 000000000..8e82b493e --- /dev/null +++ b/Challenger/Challenger.CProjs/FossiArmorProj.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using Terraria; +using TShockAPI; + +namespace Challenger +{ + public class FossiArmorProj : CProjectile + { + private FossiArmorProj(Projectile projectile, float[] ai, int lable) + : base(projectile, ai, lable) + { + } + + public override void ProjectileAI() + { + proj.Center = Main.player[proj.owner].Center + new Vector2(0f, -48f); + TSPlayer.All.SendData((PacketTypes)27, "", proj.whoAmI, 0f, 0f, 0f, 0); + if (Main.time % 10.0 == 0.0) + { + NPC val = global::Challenger.Challenger.NearestHostileNPC(proj.Center, 62500f); + if (val != null) + { + int num = Collect.MyNewProjectile(Projectile.GetNoneSource(), proj.Center, proj.Center.DirectionTo(val.Center) * 18f, 732, 10, 8f, proj.owner); + Update(num); + } + } + } + + public static FossiArmorProj NewCProjectile(Vector2 position, Vector2 velocity, int owner, float[] ai, int lable) + { + int num = Collect.MyNewProjectile(Projectile.GetNoneSource(), position, velocity, 597, 0, 0f, owner); + FossiArmorProj fossiArmorProj = new FossiArmorProj(Main.projectile[num], ai, lable); + fossiArmorProj.proj.tileCollide = false; + Collect.cprojs[num] = fossiArmorProj; + Update(num); + return fossiArmorProj; + } + } +} diff --git a/Challenger/Challenger.CProjs/Honey.cs b/Challenger/Challenger.CProjs/Honey.cs new file mode 100644 index 000000000..d3468114c --- /dev/null +++ b/Challenger/Challenger.CProjs/Honey.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Terraria; +using TShockAPI; + +namespace Challenger +{ + public class Honey : CProjectile + { + private Honey(Projectile projectile, float[] ai, int lable) + : base(projectile, ai, lable) + { + } + + public override void ProjectileAI() + { + if (lable == 1) + { + if (proj.active && proj.timeLeft < ai[0] - 30f) + { + Player[] player = Main.player; + foreach (Player val in player) + { + if (val == null || val.dead) + { + continue; + } + Vector2 val2 = proj.Center - val.Center; + if (((Vector2)val2).LengthSquared() <= val.width * val.height / 2) + { + int num = Main.rand.Next(5, 12); + if (val.whoAmI != proj.owner) + { + num = Main.rand.Next(8, 16); + } + if (global::Challenger.Challenger.config.EnableConsumptionMode) + { + global::Challenger.Challenger.HealPlayer(Main.player[val.whoAmI], num, visible: false); + global::Challenger.Challenger.SendPlayerText($"蜂糖罐治疗 + {num}", new Color(232, 229, 74), val.Center); + } + else + { + global::Challenger.Challenger.HealPlayer(Main.player[val.whoAmI], num); + } + TShock.Players[val.whoAmI].SetBuff(48, 300, false); + CKill(); + break; + } + } + } + if (proj.timeLeft < 120) + { + CKill(); + if (!global::Challenger.Challenger.honey.TryAdd(proj.whoAmI, 0)) + { + global::Challenger.Challenger.honey[proj.whoAmI] = 0; + } + } + } + else if (lable == 2 && proj.active && proj.timeLeft < ai[0] - 60f) + { + int num2 = Collect.MyNewProjectile(proj.GetProjectileSource_FromThis(), proj.Center, Vector2.Zero, 566, 30, 0f, proj.owner); + Main.projectile[num2].usesLocalNPCImmunity = true; + Update(num2); + CKill(); + if (!global::Challenger.Challenger.honey.TryAdd(proj.whoAmI, 0)) + { + global::Challenger.Challenger.honey[proj.whoAmI] = 0; + } + } + } + + public static Honey NewCProjectile(Vector2 position, Vector2 velocity, int lable, int owner, float[] ai) + { + int num = Collect.MyNewProjectile(Projectile.GetNoneSource(), position, velocity, 346, 0, 0f, owner, 0f, lable - 1); + Honey honey = new Honey(Main.projectile[num], ai, lable); + honey.ai[0] = honey.proj.timeLeft; + Collect.cprojs[num] = honey; + Update(num); + return honey; + } + } +} diff --git a/Challenger/Challenger.CProjs/SpectreArmorProj.cs b/Challenger/Challenger.CProjs/SpectreArmorProj.cs new file mode 100644 index 000000000..3d73ef37e --- /dev/null +++ b/Challenger/Challenger.CProjs/SpectreArmorProj.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace Challenger +{ + internal class SpectreArmorProj : CProjectile + { + private SpectreArmorProj(Projectile projectile, float[] ai, int lable) + : base(projectile, ai, lable) + { + } + + public override void ProjectileAI() + { + if (lable == 1) + { + Vector2 one = Vector2.One; + one = (proj.Center - Main.player[proj.owner].Center).SafeNormalize(Vector2.UnitY * 100f); + Vector2 val = one; + Vector2 val2 = default; + one = val.RotatedBy(1.03, val2) * 100f; + proj.Center = Main.player[proj.owner].Center + one; + Update(); + NPC val3 = Challenger.NearestHostileNPC(proj.Center, 1000000f); + if (Main.rand.Next(40) == 0 && val3 != null) + { + val2 = val3.Center - proj.Center; + float num = ((Vector2)val2).LengthSquared() / 1000000f; + int damage = (int)(40f + (1f - num) * 120f); + Vector2 val4 = (val3.Center - proj.Center).SafeNormalize(Vector2.Zero); + int num2 = Collect.MyNewProjectile(null, proj.Center, val4 * 4f, 356, damage, 0f, proj.owner); + Main.projectile[num2].timeLeft = 480; + Update(num2); + } + } + } + + public static SpectreArmorProj NewCProjectile(Vector2 position, Vector2 velocity, int owner, float[] ai, int lable) + { + int num = Collect.MyNewProjectile(null, position, velocity, 299, 0, 0f, owner); + SpectreArmorProj spectreArmorProj = new SpectreArmorProj(Main.projectile[num], ai, lable); + Collect.cprojs[num] = spectreArmorProj; + Update(num); + return spectreArmorProj; + } + } +} diff --git a/Challenger/Challenger.CProjs/SpiderArmorProj.cs b/Challenger/Challenger.CProjs/SpiderArmorProj.cs new file mode 100644 index 000000000..cd62c53d6 --- /dev/null +++ b/Challenger/Challenger.CProjs/SpiderArmorProj.cs @@ -0,0 +1,39 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; + +namespace Challenger +{ + + public class SpiderArmorProj : CProjectile + { + private SpiderArmorProj(Projectile projectile, float[] ai, int lable) + : base(projectile, ai, lable) + { + } + + public override void PreProjectileKilled() + { + if (proj.type == 249 && lable == 2012) + { + for (int i = 0; i < 15; i++) + { + Vector2 val = Vector2.UnitY.RotatedBy((double)((float)Math.PI * 2f / 15f * i + (float)Math.PI / 15f), default); + int num = Collect.MyNewProjectile(proj.GetProjectileSource_FromThis(), proj.Center, val * 4f, 265, 40, 5f, proj.owner); + Update(num); + } + lable = 0; + } + } + + public static SpiderArmorProj NewCProjectile(Vector2 position, Vector2 velocity, int lable, int owner, float[] ai) + { + int num = Collect.MyNewProjectile(Projectile.GetNoneSource(), position, velocity, 249, 20, 0f, owner); + SpiderArmorProj spiderArmorProj = new SpiderArmorProj(Main.projectile[num], ai, lable); + spiderArmorProj.lable = 2012; + spiderArmorProj.Update(); + Collect.cprojs[num] = spiderArmorProj; + return spiderArmorProj; + } + } +} diff --git a/Challenger/Challenger.csproj b/Challenger/Challenger.csproj new file mode 100644 index 000000000..0d0932af1 --- /dev/null +++ b/Challenger/Challenger.csproj @@ -0,0 +1,3 @@ + + + diff --git a/Challenger/Challenger/CNPC.cs b/Challenger/Challenger/CNPC.cs new file mode 100644 index 000000000..8a38ed62b --- /dev/null +++ b/Challenger/Challenger/CNPC.cs @@ -0,0 +1,147 @@ +using System.Collections.Generic; +using Terraria; +using TerrariaApi.Server; +using TShockAPI; +using static TShockAPI.GetDataHandlers; + +namespace Challenger +{ + public class CNPC + { + public NPC? npc; + + private int netID; + + private int index; + + public float[] ai; + + public int state; + + public int LifeMax; + + public HashSet AccOfObsidian; + + private bool _isActive; + + public bool isActive + { + get + { + return npc != null && npc.netID == netID && ((Entity)npc).whoAmI == index && ((Entity)npc).active && _isActive; + } + set + { + _isActive = value; + } + } + + public CNPC() + { + npc = null; + netID = 0; + index = 0; + ai = new float[8]; + state = 0; + LifeMax = 0; + AccOfObsidian = new HashSet(); + isActive = false; + } + + public CNPC(NPC? npc) + { + if (npc == null) + { + this.npc = null; + netID = 0; + index = 0; + ai = new float[8]; + state = 0; + LifeMax = 0; + isActive = false; + } + else + { + this.npc = npc; + netID = npc.netID; + index = ((Entity)npc).whoAmI; + ai = new float[8]; + state = 0; + LifeMax = npc.life; + isActive = ((Entity)npc).active; + } + AccOfObsidian = new HashSet(); + } + + public CNPC(NPC? npc, float[] ai, int state) + { + if (npc == null) + { + this.npc = null; + netID = 0; + index = 0; + ai = new float[8]; + state = 0; + LifeMax = 0; + isActive = false; + } + else + { + this.npc = npc; + netID = npc.netID; + index = ((Entity)npc).whoAmI; + this.ai = ai; + this.state = state; + LifeMax = npc.life; + isActive = ((Entity)npc).active; + } + AccOfObsidian = new HashSet(); + } + + public virtual void NPCAI() + { + } + + public virtual int SetState() + { + return 0; + } + + public virtual void OnHurtPlayers(PlayerDamageEventArgs e) + { + } + + public virtual void OnKilled() + { + if (AccOfObsidian.Count == 0) + { + return; + } + try + { + if (npc.boss || npc.rarity > 1 || npc.lifeMax > 7000) + { + return; + } + foreach (string item in AccOfObsidian) + { + TSPlayer[] players = TShock.Players; + foreach (TSPlayer val in players) + { + if (val != null && val.Active && val.Name == item) + { + npc.NPCLoot_DropItems(val.TPlayer); + } + } + } + } + catch + { + } + } + + public virtual void WhenHurtByPlayer(NpcStrikeEventArgs args) + { + } + } +} \ No newline at end of file diff --git a/Challenger/Challenger/CPlayer.cs b/Challenger/Challenger/CPlayer.cs new file mode 100644 index 000000000..9e1d752f8 --- /dev/null +++ b/Challenger/Challenger/CPlayer.cs @@ -0,0 +1,78 @@ +using Terraria; +using TShockAPI; + +namespace Challenger +{ + public class CPlayer + { + public TSPlayer? me; + + public bool tips; + + public int index = 255; + + private bool _isActive; + + public int ExtraLife = 0; + + public int ExtraMana = 0; + + public bool FossilArmorEffectProj = false; + + public int FossilArmorEffectProjIndex = -1; + + public int CrimsonArmorEffectTimer = 0; + + public int ShadowArmorEffectTimer = 0; + + public int SpiderArmorEffectTimer = 0; + + public bool HallowedArmorState = true; + + public bool ChlorophyteArmorEffectLife = false; + + public bool TurtleArmorEffectLife = false; + + public bool TikiArmorEffectLife = false; + + public bool BeetleArmorEffectLife = false; + + public bool SpectreArmorEffectLife = false; + + public int SpectreArmorEffectProjIndex = -1; + + public bool SpectreArmorEffectMana = false; + + public int CthulhuShieldTime = 0; + + public bool isActive + { + get + { + return me != null && me.Active && index == me.Index && index == ((Entity)me.TPlayer).whoAmI && me.TPlayer != null && ((Entity)me.TPlayer).active && _isActive; + } + set + { + _isActive = value; + } + } + + public CPlayer(TSPlayer? me, bool tips) + { + if (me == null) + { + this.me = new TSPlayer(-1); + index = 255; + this.tips = true; + isActive = false; + } + else + { + this.me = me; + index = me.Index; + this.tips = tips; + isActive = true; + } + } + } +} \ No newline at end of file diff --git a/Challenger/Challenger/CProjectile.cs b/Challenger/Challenger/CProjectile.cs new file mode 100644 index 000000000..96a131b19 --- /dev/null +++ b/Challenger/Challenger/CProjectile.cs @@ -0,0 +1,153 @@ +using Terraria; +using TShockAPI; + +namespace Challenger +{ + public class CProjectile + { + public Projectile? proj; + + private int type; + + private int index; + + private int owner; + + public float[] ai; + + public int lable; + + private bool _isActive; + + public bool isActive + { + get + { + return proj != null && proj.type == type && proj.whoAmI == index && proj.owner == owner && Main.player[owner].active && proj.active && _isActive; + } + set + { + _isActive = value; + } + } + + protected CProjectile() + { + proj = null; + type = 0; + index = 0; + owner = 0; + ai = new float[8]; + lable = 0; + isActive = false; + } + + protected CProjectile(Projectile? proj) + { + if (proj == null) + { + this.proj = null; + type = 0; + index = 0; + owner = 0; + ai = new float[8]; + lable = 0; + isActive = false; + } + else + { + this.proj = proj; + type = proj.type; + index = ((Entity)proj).whoAmI; + owner = proj.owner; + ai = new float[8]; + lable = 0; + isActive = ((Entity)proj).active; + } + } + + protected CProjectile(Projectile? proj, float[] ai, int lable) + { + if (proj == null) + { + this.proj = null; + type = 0; + index = 0; + owner = 0; + this.ai = new float[8]; + this.lable = 0; + isActive = false; + } + else + { + this.proj = proj; + type = proj.type; + index = ((Entity)proj).whoAmI; + owner = proj.owner; + this.ai = ai; + this.lable = lable; + isActive = ((Entity)proj).active; + } + } + + public static void CKill(int index) + { + if (Main.projectile[index] != null && ((Entity)Main.projectile[index]).active) + { + Main.projectileIdentity[Main.projectile[index].owner, Main.projectile[index].identity] = -1; + Main.projectile[index].timeLeft = 0; + if (Main.getGoodWorld && Main.projectile[index].aiStyle == 16) + { + Main.projectile[index].TryGettingHitByOtherPlayersExplosives(); + } + ((Entity)Main.projectile[index]).active = false; + TSPlayer.All.SendData((PacketTypes)29, "", Main.projectile[index].identity, (float)Main.projectile[index].owner, 0f, 0f, 0); + if (Collect.cprojs[index] != null) + { + Collect.cprojs[index].isActive = false; + } + } + } + + public void CKill() + { + if (proj != null && ((Entity)proj).active) + { + Main.projectileIdentity[proj.owner, proj.identity] = -1; + proj.timeLeft = 0; + if (Main.getGoodWorld && proj.aiStyle == 16) + { + proj.TryGettingHitByOtherPlayersExplosives(); + } + ((Entity)proj).active = false; + TSPlayer.All.SendData((PacketTypes)29, "", proj.identity, (float)proj.owner, 0f, 0f, 0); + if (Collect.cprojs[((Entity)proj).whoAmI] != null) + { + Collect.cprojs[((Entity)proj).whoAmI].isActive = false; + } + } + } + + public static void Update(int index) + { + TSPlayer.All.SendData((PacketTypes)27, (string)null, index, 0f, 0f, 0f, 0); + } + + public void Update() + { + TSPlayer.All.SendData((PacketTypes)27, (string)null, index, 0f, 0f, 0f, 0); + } + + public virtual void ProjectileAI() + { + } + + public virtual void PreProjectileKilled() + { + } + + public virtual void MyEffect() + { + } + } +} \ No newline at end of file diff --git a/Challenger/Challenger/Challenger.cs b/Challenger/Challenger/Challenger.cs new file mode 100644 index 000000000..54d2f7645 --- /dev/null +++ b/Challenger/Challenger/Challenger.cs @@ -0,0 +1,1928 @@ +using Microsoft.Xna.Framework; +using Newtonsoft.Json; +using System.Text; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.Localization; +using TerrariaApi.Server; +using TShockAPI; +using TShockAPI.Hooks; +using static OTAPI.Hooks.NPC; +using static TShockAPI.GetDataHandlers; +using static TShockAPI.Hooks.GeneralHooks; +using OTAPI; +using System.IO; +using ChalleAnger; +using System.Configuration; +using Google.Protobuf.WellKnownTypes; + +namespace Challenger +{ + [ApiVersion(2, 1)] + public class Challenger : TerrariaPlugin + { + public string configPath = Path.Combine(TShock.SavePath, "ChallengerConfig.json"); + + internal static Config config = new Config(); + + public static long Timer = 0L; + + public static Dictionary honey = new Dictionary(); + + public override string Author => "z枳 & 星夜神花 修改:羽学"; + + public override string Description => "增强游戏难度,更好的游戏体验"; + + public override string Name => "Challenger"; + + public override Version Version => new Version(1, 0, 0, 2); + + public Challenger(Main game) + : base(game) + { + } + + public override void Initialize() + { + LoadConfig(); + GeneralHooks.ReloadEvent += new GeneralHooks.ReloadEventD(LoadConfig); + ServerApi.Hooks.GameUpdate.Register((TerrariaPlugin)(object)this, (HookHandler)OnGameUpdate); + GetDataHandlers.PlayerDamage.Register((EventHandler)PlayerSufferDamage, (HandlerPriority)3, false); + GetDataHandlers.NewProjectile.Register((EventHandler)OnProjSpawn, (HandlerPriority)3, false); + ServerApi.Hooks.ProjectileAIUpdate.Register((TerrariaPlugin)(object)this, (HookHandler)OnProjAIUpdate); + GetDataHandlers.ProjectileKill.Register((EventHandler)OnProjKilled, (HandlerPriority)3, false); + ServerApi.Hooks.NpcAIUpdate.Register((TerrariaPlugin)(object)this, (HookHandler)OnNPCAI); + Hooks.NPC.Killed += OnNPCKilled; + ServerApi.Hooks.NpcStrike.Register((TerrariaPlugin)(object)this, (HookHandler)OnNpcStrike); + GetDataHandlers.PlayerSlot.Register((EventHandler)OnHoldItem, (HandlerPriority)3, false); + ServerApi.Hooks.NetGreetPlayer.Register((TerrariaPlugin)(object)this, (HookHandler)OnGreetPlayer); + ServerApi.Hooks.ServerLeave.Register((TerrariaPlugin)(object)this, (HookHandler)OnServerLeave); + Commands.ChatCommands.Add(new Command("challenger.enable", new CommandDelegate(EnableModel), new string[1] { "cenable" }) + { + HelpText = "输入 /cenable 来启用挑战模式,再次使用取消" + }); + Commands.ChatCommands.Add(new Command("challenger.tip", new CommandDelegate(EnableTips), new string[1] { "ctip" }) + { + HelpText = "输入 /ctip 来启用内容提示,如各种物品的强化文字提示,再次使用取消" + }); + Commands.ChatCommands.Add(new Command("challenger.fun", new CommandDelegate(Function), new string[1] { "cf" }) + { + HelpText = "输入 /cf 来实现某些技能的或状态的切换" + }); + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + GeneralHooks.ReloadEvent -= new ReloadEventD(LoadConfig); + ServerApi.Hooks.GameUpdate.Deregister((TerrariaPlugin)(object)this, (HookHandler)OnGameUpdate); + GetDataHandlers.PlayerDamage.UnRegister((EventHandler)PlayerSufferDamage); + ServerApi.Hooks.ProjectileAIUpdate.Deregister((TerrariaPlugin)(object)this, (HookHandler)OnProjAIUpdate); + GetDataHandlers.ProjectileKill.UnRegister((EventHandler)OnProjKilled); + ServerApi.Hooks.NpcAIUpdate.Deregister((TerrariaPlugin)(object)this, (HookHandler)OnNPCAI); + Hooks.NPC.Killed -= OnNPCKilled; + ServerApi.Hooks.NpcStrike.Deregister((TerrariaPlugin)(object)this, (HookHandler)OnNpcStrike); + GetDataHandlers.PlayerSlot.UnRegister((EventHandler)OnHoldItem); + ServerApi.Hooks.NetGreetPlayer.Deregister((TerrariaPlugin)(object)this, (HookHandler)OnGreetPlayer); + ServerApi.Hooks.ServerLeave.Deregister((TerrariaPlugin)(object)this, (HookHandler)OnServerLeave); + } + base.Dispose(disposing); + } + + #region 配置文件创建与重读加载方法 + private static void LoadConfig(ReloadEventArgs args = null!) + { + //调用Configuration.cs文件Read和Write方法 + config = Config.Read(Config.FilePath); + config.Write(Config.FilePath); + if (args != null && args.Player != null) + { + args.Player.SendSuccessMessage("[挑战者模式]重新加载配置完毕。"); + } + } + #endregion + + + + public void TouchedAndBeSucked(PlayerDamageEventArgs e) + { + NPC val = Main.npc[e.PlayerDeathReason._sourceNPCIndex]; + int num = ((e.Damage > 1500) ? 1500 : e.Damage); + NPC val2 = NearestWeakestNPC(val.Center, 4000000f); + int num2 = e.PlayerDeathReason._sourceNPCIndex; + float num3; + if ((val2 != null && !val2.boss) || val2 == null) + { + num3 = ((float)num * 0.8f + (float)val.lifeMax * 0.05f) * config.BloodAbsorptionRatio; + } + else + { + num3 = ((float)num * 0.5f + (float)val.lifeMax * 0.008f) * config.BloodAbsorptionRatioForBoss; + num2 = ((Entity)val2).whoAmI; + } + Vector2 center = ((Entity)Main.player[((GetDataHandledEventArgs)e).Player.Index]).Center; + float num4 = ((num - Main.player[((GetDataHandledEventArgs)e).Player.Index].statDefense >= 0) ? (num - Main.player[((GetDataHandledEventArgs)e).Player.Index].statDefense) : 0); + num4 = (1f - Main.player[((GetDataHandledEventArgs)e).Player.Index].endurance) * num4 * 0.6f; + if (num4 > 400f) + { + num4 = 400f; + } + else if (num4 < 0f) + { + num4 = 0f; + } + BloodBagProj.NewCProjectile(center, Vector2.Zero, ((GetDataHandledEventArgs)e).Player.Index, 0, new float[8] { num4, 0f, 0f, num2, num3, 0f, 0f, 0f }); + } + + public void ProjAndBeSucked(PlayerDamageEventArgs e) + { + Vector2 center = ((Entity)Main.player[((GetDataHandledEventArgs)e).Player.Index]).Center; + NPC val = NearestWeakestNPC(center, 9000000f); + int num = ((e.Damage > 1500) ? 1500 : e.Damage); + float num2 = ((val == null || !val.boss) ? ((float)num * config.BloodAbsorptionRatio) : (((float)num + (float)val.lifeMax * 0.008f) * config.BloodAbsorptionRatioForBoss)); + float num3 = ((num - Main.player[((GetDataHandledEventArgs)e).Player.Index].statDefense >= 0) ? (num - Main.player[((GetDataHandledEventArgs)e).Player.Index].statDefense) : 0); + num3 = (1f - Main.player[((GetDataHandledEventArgs)e).Player.Index].endurance) * num3 * 0.6f; + if (num3 > 400f) + { + num3 = 400f; + } + else if (num3 < 0f) + { + num3 = 0f; + } + BloodBagProj.NewCProjectile(center, Vector2.Zero, ((GetDataHandledEventArgs)e).Player.Index, 0, new float[8] { num3, 0f, 0f, -1f, num2, 0f, 0f, 0f }); + } + + public void AnglerArmorEffect(Player player) + { + Item[] armor = player.armor; + if (armor[0].type == 2367 && armor[1].type == 2368 && armor[2].type == 2369 && Timer % 120 == 0) + { + TShock.Players[((Entity)player).whoAmI].SetBuff(106, 180, false); + TShock.Players[((Entity)player).whoAmI].SetBuff(123, 180, false); + TShock.Players[((Entity)player).whoAmI].SetBuff(121, 180, false); + TShock.Players[((Entity)player).whoAmI].SetBuff(122, 180, false); + } + } + + public void NinjaArmorEffect(PlayerDamageEventArgs e) + { + if (config.NinjaArmorEffect) + { + Item[] armor = Main.player[((GetDataHandledEventArgs)e).Player.Index].armor; + if (armor[0].type == 256 && armor[1].type == 257 && armor[2].type == 258 && Main.rand.Next(4) == 0) + { + int index = Collect.MyNewProjectile(null, ((Entity)Main.player[((GetDataHandledEventArgs)e).Player.Index]).Center, -Vector2.UnitY, 196, 0, 0f, ((GetDataHandledEventArgs)e).Player.Index); + CProjectile.Update(index); + NetMessage.SendData(62, -1, -1, (NetworkText)null, ((GetDataHandledEventArgs)e).Player.Index, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((GetDataHandledEventArgs)e).Player.Index, 0f, 0f, 0f, 0, 0, 0); + SendPlayerText(e.Damage, Color.Green, ((Entity)Main.player[((GetDataHandledEventArgs)e).Player.Index]).Center); + if (config.EnableConsumptionMode) + { + SendPlayerText("闪避锁血成功!", Color.White, ((Entity)Main.player[((GetDataHandledEventArgs)e).Player.Index]).Center + new Vector2((float)Main.rand.Next(-60, 61), (float)Main.rand.Next(61))); + } + } + } + } + + public void FossilArmorEffect(Player player) + { + if (config.FossilArmorEffect) + { + + Item[] armor = player.armor; + bool flag = armor[0].type == 3374 && armor[1].type == 3375 && armor[2].type == 3376; + if (flag && !Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProj) + { + FossiArmorProj fossiArmorProj = FossiArmorProj.NewCProjectile(((Entity)player).Center, Vector2.Zero, ((Entity)player).whoAmI, new float[0], 0); + Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProjIndex = ((Entity)fossiArmorProj.proj).whoAmI; + Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProj = true; + } + else if (flag && Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProj && !Collect.cprojs[Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProjIndex].isActive) + { + FossiArmorProj fossiArmorProj2 = FossiArmorProj.NewCProjectile(player.Center, Vector2.Zero, player.whoAmI, new float[0], 0); + Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProjIndex = ((Entity)fossiArmorProj2.proj).whoAmI; + } + else if (!flag && Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProj) + { + CProjectile.CKill(Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProjIndex); + Collect.cplayers[((Entity)player).whoAmI].FossilArmorEffectProj = false; + } + } + } + + public void CrimsonArmorEffect(NpcStrikeEventArgs args) + { + CPlayer cPlayer = Collect.cplayers[((Entity)args.Player).whoAmI]; + if (args.Player.armor[0].type != 792 || args.Player.armor[1].type != 793 || args.Player.armor[2].type != 794 || !args.Critical || Timer - cPlayer.CrimsonArmorEffectTimer < 300 || !args.Npc.CanBeChasedBy((object)null, false)) + { + return; + } + NPC[] array = NearAllHostileNPCs(((Entity)args.Player).Center, 102400f); + if (!array.Any()) + { + return; + } + int num = 0; + NPC[] array2 = array; + foreach (NPC val in array2) + { + int num2 = ((10 - num > 0) ? (10 - num) : 0); + num++; + if (num2 == 0) + { + break; + } + Projectile.NewProjectile((IEntitySource)null, ((Entity)val).Center, Vector2.Zero, 305, 0, 0f, -1, (float)((Entity)args.Player).whoAmI, (float)num2, 0f); + } + cPlayer.CrimsonArmorEffectTimer = (int)Timer; + } + + public void ShadowArmorEffect(NpcStrikeEventArgs args) + { + Item[] armor = args.Player.armor; + if ((armor[0].netID == 102 || armor[0].netID == 956) && (armor[1].netID == 101 || armor[1].netID == 957) && (armor[2].netID == 100 || armor[2].netID == 958) && args.Critical && Timer - Collect.cplayers[((Entity)args.Player).whoAmI].ShadowArmorEffectTimer >= 60) + { + int num = Main.rand.Next(2, 6); + for (int i = 0; i < num; i++) + { + int num2 = Collect.MyNewProjectile(null, ((Entity)args.Player).Center, new Vector2((float)Math.Cos(Main.rand.NextDouble() * 6.2831854820251465), (float)Math.Sin(Main.rand.NextDouble() * 6.2831854820251465)), 307, 20, 2f, ((Entity)args.Player).whoAmI); + Projectile obj = Main.projectile[num2]; + obj.scale *= 0.5f; + CProjectile.Update(num2); + } + Collect.cplayers[((Entity)args.Player).whoAmI].ShadowArmorEffectTimer = (int)Timer; + } + } + + public void MeteorArmorEffect(NpcStrikeEventArgs? args, Player? player) + { + if (args != null) + { + Item[] armor = args.Player.armor; + if (armor[0].netID == 123 && armor[1].netID == 124 && armor[2].netID == 125 && args.Critical && args.Npc.CanBeChasedBy((object)null, false)) + { + Player player2 = args.Player; + player2.statMana += 3; + if (config.EnableConsumptionMode) + { + HealPlayerMana(args.Player, 5, visible: false); + SendPlayerText(TShock.Players[((Entity)args.Player).whoAmI], "陨石回魔 + 3", new Color(6, 0, 255), ((Entity)args.Player).Center); + } + else + { + HealPlayerMana(args.Player, 5); + } + } + } + else if (player != null) + { + if (config.MeteorArmorEffect) + { + Item[] armor2 = player.armor; + if (armor2[0].netID == 123 && armor2[1].netID == 124 && armor2[2].netID == 125 && Timer % 120 == 0) + { + int index = Collect.MyNewProjectile(null, ((Entity)player).Center + new Vector2((float)Main.rand.Next(-860, 861), -600f), Terraria.Utils.RotateRandom(Vector2.UnitY, 0.3) * 16f, 725, 1000, 0f, ((Entity)player).whoAmI); + CProjectile.Update(index); + } + } + } + } + + public void JungleArmorEffect(Player player) + { + if (config.JungleArmorEffect) + { + Item[] armor = player.armor; + if ((armor[0].type == 228 || armor[0].type == 960) && (armor[1].type == 229 || armor[1].type == 961) && (armor[2].type == 230 || armor[2].type == 962) && Main.rand.Next(15) == 0) + { + int index = Collect.MyNewProjectile(player.GetProjectileSource_Accessory(armor[0]), ((Entity)player).Center, Terraria.Utils.RotatedByRandom(Vector2.One, 6.2831854820251465) * 1.5f, Main.rand.Next(569, 572), 15, 8f, ((Entity)player).whoAmI); + CProjectile.Update(index); + } + } + } + + public void BeeArmorEffect(Player player) + { + if (config.BeeArmorEffect) + { + Item[] armor = player.armor; + if (armor[0].type == 2361 && armor[1].type == 2362 && armor[2].type == 2363 && Timer % 120 == 0) + { + TShock.Players[((Entity)player).whoAmI].SetBuff(48, 150, false); + } + if (armor[0].type == 2361 && armor[1].type == 2362 && armor[2].type == 2363 && Main.rand.Next(70) == 0) + { + Honey.NewCProjectile(((Entity)player).Center, -Terraria.Utils.RotatedByRandom(Vector2.UnitY, 0.7853981852531433) * 5.5f, 1, ((Entity)player).whoAmI, new float[1]); + } + } + } + + public void NecroArmor(GetDataHandlers.PlayerDamageEventArgs? e, NpcStrikeEventArgs? args) + { + if (config.NecroArmor) + { + if (e != null) + { + Item[] armor = Main.player[((GetDataHandledEventArgs)e).Player.Index].armor; + if ((armor[0].type == 151 || armor[0].type == 959) && armor[1].type == 152 && armor[2].type == 153) + { + for (int i = 0; i < 8; i++) + { + Vector2 velocity = Terraria.Utils.RotatedBy(Vector2.UnitY, (double)((float)Math.PI / 4f * (float)i + (float)Math.PI / 8f), default(Vector2)) * 4f; + int index = Collect.MyNewProjectile(null, ((Entity)Main.player[((GetDataHandledEventArgs)e).Player.Index]).Center, velocity, 532, 20, 5f, ((GetDataHandledEventArgs)e).Player.Index); + CProjectile.Update(index); + } + } + } + else if (args != null) + { + Item[] armor2 = args.Player.armor; + if ((armor2[0].type == 151 || armor2[0].type == 959) && armor2[1].type == 152 && armor2[2].type == 153 && Main.rand.Next(3) == 0) + { + Vector2 val = ((Entity)args.Player).Center + Terraria.Utils.RotatedByRandom(Vector2.One, 3.1415927410125732) * 0.1f * (float)Main.rand.Next(0, 500); + int index2 = Collect.MyNewProjectile(null, val, (((Entity)args.Npc).Center + new Vector2(0f, -10f) - val) * 0.02f, 117, 20, 2f, ((Entity)args.Player).whoAmI); + CProjectile.Update(index2); + } + } + } + } + + public void ObsidianArmorEffect(NpcStrikeEventArgs args) + { + if (config.ObsidianArmorEffect) + { + Item[] armor = args.Player.armor; + if (armor[0].type != 3266 || armor[1].type != 3267 || armor[2].type != 3268 || !args.Npc.CanBeChasedBy((object)null, false) || args.Npc.SpawnedFromStatue) + { + return; + } + try + { + if (!args.Npc.boss && args.Npc.rarity <= 1 && args.Npc.lifeMax <= 7000) + { + Collect.cnpcs[((Entity)args.Npc).whoAmI].AccOfObsidian.Add(args.Player.name); + } + } + catch + { + } + } + } + + public void MoltenArmor(Player player) + { + var any = config.MoltenArmor; + + Item[] armor = player.armor; + if (armor[0].type == 231 && armor[1].type == 232 && armor[2].type == 233 && Timer % 120 == 0) + { + TShock.Players[((Entity)player).whoAmI].SetBuff(1, 180, false); + TShock.Players[((Entity)player).whoAmI].SetBuff(any, 180, false); + } + } + + public void SpiderArmorEffect(NpcStrikeEventArgs? args, Player? player) + { + if (args != null) + { + Item[] armor = args.Player.armor; + if (armor[0].type == 2370 && armor[1].type == 2371 && armor[2].type == 2372) + { + args.Npc.AddBuff(70, 180, false); + args.Npc.AddBuff(20, 360, false); + } + return; + } + Item[] armor2 = player.armor; + if (armor2[0].type == 2370 && armor2[1].type == 2371 && armor2[2].type == 2372 && Timer - Collect.cplayers[((Entity)player).whoAmI].SpiderArmorEffectTimer >= 60 && player.controlUp) + { + NPC val = NearestHostileNPC(((Entity)player).Center, 360000f); + if (val != null) + { + SpiderArmorProj.NewCProjectile(((Entity)player).Center, Terraria.Utils.SafeNormalize(((Entity)val).Center - ((Entity)player).Center, Vector2.Zero) * 17f, 0, ((Entity)player).whoAmI, new float[0]); + } + else + { + SpiderArmorProj.NewCProjectile(((Entity)player).Center, Vector2.Zero, 0, ((Entity)player).whoAmI, new float[0]); + } + Collect.cplayers[((Entity)player).whoAmI].SpiderArmorEffectTimer = (int)Timer; + } + } + + public void CrystalAssassinArmorEffect(Player? player, GetDataHandlers.PlayerDamageEventArgs? e) + { + if (config.CrystalAssassinArmorEffect) + { + Item[] armor; + Vector2 center; + int num; + int num2; + if (player != null) + { + armor = player.armor; + center = ((Entity)player).Center; + num = 90; + num2 = ((Entity)player).whoAmI; + } + else + { + armor = Main.player[((GetDataHandledEventArgs)e).Player.Index].armor; + center = ((Entity)Main.player[((GetDataHandledEventArgs)e).Player.Index]).Center; + num = 94; + num2 = ((GetDataHandledEventArgs)e).Player.Index; + } + if (armor[0].type == 4982 && armor[1].type == 4983 && armor[2].type == 4984 && (Timer % 50 == 0L || e != null) && (NearestHostileNPC(((Entity)Main.player[num2]).Center, 360000f) != null || e != null)) + { + for (int i = 0; i < 20; i++) + { + Vector2 velocity = Terraria.Utils.RotatedBy(Vector2.UnitY, (double)((float)Math.PI / 10f * (float)i + (float)Math.PI / 20f), default(Vector2)) * (float)((num == 94) ? 4 : 5); + int index = Collect.MyNewProjectile(Main.player[num2].GetProjectileSource_Item(armor[0]), center, velocity, num, (num == 94) ? 70 : 40, 5f, num2); + CProjectile.Update(index); + } + } + } + } + + public void ForbiddenArmorEffect(Player player) + { + if (config.ForbiddenArmorEffect) + { + Item[] armor = player.armor; + if (armor[0].type == 3776 && armor[1].type == 3777 && armor[2].type == 3778 && Main.rand.Next(20) == 0) + { + NPC val = NearestHostileNPC(((Entity)player).Center, 1000000f); + Vector2 postion = ((Entity)player).Center + Terraria.Utils.RotatedByRandom(Vector2.UnitX, 6.2831854820251465) * (float)Main.rand.Next(100); + int index = ((val == null) ? Collect.MyNewProjectile(null, postion, Vector2.Zero, 659, 45, 0f, ((Entity)player).whoAmI, -2f) : Collect.MyNewProjectile(null, postion, Vector2.Zero, 659, 45, 0f, ((Entity)player).whoAmI, ((Entity)val).whoAmI)); + CProjectile.Update(index); + } + } + } + + public void FrostArmorEffect(Player player) + { + if (config.FrostArmorEffect) + { + Item[] armor = player.armor; + if (armor[0].type == 684 && armor[1].type == 685 && armor[2].type == 686 && Timer % 7 == 0) + { + Vector2 postion = ((Entity)player).Center + new Vector2((float)Main.rand.Next(-860, 861), -600f); + int index = Collect.MyNewProjectile(null, postion, Vector2.UnitY, 344, 50, 0f, ((Entity)player).whoAmI, 0f, Main.rand.Next(3)); + CProjectile.Update(index); + } + } + } + + public void HallowedArmorEffect(NpcStrikeEventArgs args) + { + var any = config.HallowedArmorEffect; + + if (args.KnockBack == 1.14514f || Main.player[((Entity)args.Player).whoAmI].ownedProjectileCounts[156] + Main.player[((Entity)args.Player).whoAmI].ownedProjectileCounts[157] >= 75) + { + return; + } + Item[] armor = args.Player.armor; + if ((armor[1].type == 551 || armor[1].type == 4900) && (armor[2].type == 552 || armor[2].type == 4901) && (armor[0].type == 559 || armor[0].type == 553 || armor[0].type == 558 || armor[0].type == 4873 || armor[0].type == 4896 || armor[0].type == 4897 || armor[0].type == 4898 || armor[0].type == 4899)) + { + if (Collect.cplayers[((Entity)args.Player).whoAmI].HallowedArmorState) + { + int damage = (int)((double)args.Damage * any); + double num = Main.rand.NextDouble(); + Vector2 val = ((Entity)args.Npc).Center + new Vector2((float)Math.Cos(num * 6.2831854820251465), (float)Math.Sin(num * 6.2831854820251465)) * 300f; + Vector2 velocity = Terraria.Utils.SafeNormalize(((Entity)args.Npc).Center - val, Vector2.Zero) * 20f; + int index = Collect.MyNewProjectile(null, val, velocity, 156, damage, 1.14514f, ((Entity)args.Player).whoAmI); + CProjectile.Update(index); + } + else + { + int damage = (int)((double)args.Damage * any); + double num2 = Main.rand.NextDouble(); + Vector2 val2 = ((Entity)args.Npc).Center + new Vector2((float)Math.Cos(num2 * 6.2831854820251465), (float)Math.Sin(num2 * 6.2831854820251465)) * 300f; + Vector2 velocity2 = Terraria.Utils.SafeNormalize(((Entity)args.Npc).Center - val2, Vector2.Zero) * 18f; + int index2 = Collect.MyNewProjectile(null, val2, velocity2, 157, damage, 1.14514f, ((Entity)args.Player).whoAmI); + CProjectile.Update(index2); + } + } + } + + public void ChlorophyteArmorEffect(Player player) + { + var Any = config.ChlorophyteArmorEffect; + + Item[] armor = player.armor; + bool flag = (armor[0].type == 1001 || armor[0].type == 1002 || armor[0].type == 1003) && armor[1].type == 1004 && armor[2].type == 1005; + if (flag && !Collect.cplayers[((Entity)player).whoAmI].ChlorophyteArmorEffectLife) + { + player.statLifeMax += Any; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife += Any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].ChlorophyteArmorEffectLife = true; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 + {Any}", new Color(0, 255, 255), ((Entity)player).Center); + } + } + if (!flag && Collect.cplayers[((Entity)player).whoAmI].ChlorophyteArmorEffectLife) + { + player.statLifeMax -= Any; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife -= Any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].ChlorophyteArmorEffectLife = false; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 - {Any}", new Color(255, 0, 156), player.Center); + } + } + } + + public void TurtleArmorEffect(Player player) + { + var Any = config.TurtleArmorEffect; + + Item[] armor = player.armor; + bool flag = armor[0].type == 1316 && armor[1].type == 1317 && armor[2].type == 1318; + if (flag && Timer % 180 == 0) + { + int num = Main.rand.Next(15, 25); + for (int i = 0; i < num; i++) + { + Vector2 val = Terraria.Utils.RotatedBy(Vector2.UnitY, (double)((float)Math.PI * 2f / (float)num * (float)i + (float)Math.PI * 2f / (float)(num * 2)), default(Vector2)) * (Terraria.Utils.NextFloat(Main.rand) * 3f + 9f); + if (val.Y > 0f) + { + val.Y *= 0.5f; + } + int index = Collect.MyNewProjectile(Projectile.GetNoneSource(), ((Entity)player).Center, val, 249, 60, 5f, ((Entity)player).whoAmI); + CProjectile.Update(index); + } + } + if (flag && !Collect.cplayers[((Entity)player).whoAmI].TurtleArmorEffectLife) + { + player.statLifeMax += Any; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife += Any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].TurtleArmorEffectLife = true; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 + {Any}", new Color(0, 255, 255), ((Entity)player).Center); + } + } + if (!flag && Collect.cplayers[((Entity)player).whoAmI].TurtleArmorEffectLife) + { + player.statLifeMax -= Any; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife -= Any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].TurtleArmorEffectLife = false; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 - {Any}", new Color(255, 0, 156), ((Entity)player).Center); + } + } + } + + public void TikiArmorEffect(Player? pl, ProjectileAiUpdateEventArgs? args, int mode = 0) + { + var Any = config.TikiArmorEffect; + + if (args != null) + { + Item[] armor = Main.player[args.Projectile.owner].armor; + Player val = Main.player[args.Projectile.owner]; + bool flag = armor[0].type == 1159 && armor[1].type == 1160 && armor[2].type == 1161; + int num; + int num2; + if (mode == 0) + { + num = 13; + num2 = 48; + } + else + { + num = 20; + num2 = 70; + } + if (flag && args.Projectile.ai[0] >= (float)num && args.Projectile.ai[0] <= (float)num2 && args.Projectile.ai[0] % 3f == 0f) + { + List list = new List(); + Projectile.FillWhipControlPoints(args.Projectile, list); + Vector2 val2 = list[list.Count - 2]; + int index = Collect.MyNewProjectile(null, val2, (val2 - ((Entity)val).Center) * 0.004f, 228, (int)((float)args.Projectile.damage * 0.4f), 0f, ((Entity)val).whoAmI); + CProjectile.Update(index); + } + return; + } + Item[] armor2 = pl.armor; + bool flag2 = armor2[0].type == 1159 && armor2[1].type == 1160 && armor2[2].type == 1161; + if (flag2 && !Collect.cplayers[((Entity)pl).whoAmI].TikiArmorEffectLife) + { + pl.statLifeMax += Any; + Collect.cplayers[((Entity)pl).whoAmI].ExtraLife += Any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)pl).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)pl).whoAmI].TikiArmorEffectLife = true; + if (config.EnableConsumptionMode) + { + Challenger.SendPlayerText($"生命值上限 + {Any}", new Color(0, 255, 255), ((Entity)pl).Center); + } + } + if (!flag2 && Collect.cplayers[((Entity)pl).whoAmI].TikiArmorEffectLife) + { + pl.statLifeMax -= Any; + Collect.cplayers[((Entity)pl).whoAmI].ExtraLife -= Any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)pl).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)pl).whoAmI].TikiArmorEffectLife = false; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 - {Any}", new Color(255, 0, 156), ((Entity)pl).Center); + } + } + } + + public void BeetleArmorEffect(Player? player, GetDataHandlers.PlayerDamageEventArgs? e, NpcStrikeEventArgs? args) + { + var any1 = config.BeetleArmorEffect_1; + var any2 = config.BeetleArmorEffect_2; + + if (player != null) + { + Item[] armor = player.armor; + bool flag = armor[0].type == 2199 && (armor[1].type == 2200 || armor[1].type == 2201) && armor[2].type == 2202; + if (flag && !Collect.cplayers[((Entity)player).whoAmI].BeetleArmorEffectLife) + { + player.statLifeMax += any1; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife += any1; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].BeetleArmorEffectLife = true; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 + {any1}", new Color(0, 255, 255), ((Entity)player).Center); + } + } + if (!flag && Collect.cplayers[((Entity)player).whoAmI].BeetleArmorEffectLife) + { + player.statLifeMax -= any1; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife -= any1; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].BeetleArmorEffectLife = false; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 - {any1}", new Color(255, 0, 156), ((Entity)player).Center); + } + } + return; + } + if (e != null) + { + Item[] armor2 = Main.player[((GetDataHandledEventArgs)e).Player.Index].armor; + if (armor2[0].type == 2199 && (armor2[1].type == 2200 || armor2[1].type == 2201) && armor2[2].type == 2202) + { + Vector2 center = ((Entity)Main.player[((Entity)((GetDataHandledEventArgs)e).Player.TPlayer).whoAmI]).Center; + int num = (int)((double)e.Damage * 0.3); + BeetleHeal.NewCProjectile(center, Vector2.Zero, ((Entity)((GetDataHandledEventArgs)e).Player.TPlayer).whoAmI, new float[2] { num, 0f }, 0); + } + return; + } + Item[] armor3 = args.Player.armor; + bool flag2 = armor3[0].type == 2199 && (armor3[1].type == 2200 || armor3[1].type == 2201) && armor3[2].type == 2202; + bool flag3 = false; + for (int i = 3; i < 10; i++) + { + if (armor3[i].type == 938 || armor3[i].type == 3998 || armor3[i].type == 3997) + { + flag3 = true; + break; + } + } + if (flag2 && args.KnockBack != 20.114f) + { + double num2 = Main.rand.NextDouble(); + Vector2 val = ((Entity)args.Npc).Center + new Vector2((float)Math.Cos(num2 * 6.2831854820251465), (float)Math.Sin(num2 * 6.2831854820251465)) * 250f; + Vector2 velocity = Terraria.Utils.SafeNormalize(((Entity)args.Npc).Center - val, Vector2.Zero) * 20f; + int index = Collect.MyNewProjectile(Projectile.GetNoneSource(), val, velocity, 301, flag3 ? ((int)((float)args.Damage * any2)) : ((int)((float)args.Damage * 0.45f)), 20.114f, ((Entity)args.Player).whoAmI); + CProjectile.Update(index); + } + } + + public void ShroomiteArmorEffect(Projectile? projectile, NpcStrikeEventArgs? args) + { + if (config.ShroomiteArmorEffect) + { + Vector2 val; + if (projectile != null) + { + if (Main.player[projectile.owner].ownedProjectileCounts[131] >= 100 || projectile.knockBack == 1.14514f) + { + return; + } + Item[] armor = Main.player[projectile.owner].armor; + bool flag = (armor[0].type == 1546 || armor[0].type == 1547 || armor[0].type == 1548) && armor[1].type == 1549 && armor[2].type == 1550; + bool flag2 = projectile.type == 90 || projectile.type == 92 || projectile.type == 640 || projectile.type == 631; + if (!(!flag2 && flag) || !projectile.ranged) + { + return; + } + val = ((Entity)projectile).Center - ((Entity)Main.player[projectile.owner]).Center; + if (((Vector2)(val)).LengthSquared() <= 921600f) + { + int num = Main.rand.Next(1, 5); + for (int i = 0; i < num; i++) + { + Vector2 unitY = Vector2.UnitY; + double num2 = (double)((float)Math.PI * 2f / (float)num * (float)i) + Main.time % 3.0; + val = default(Vector2); + Vector2 velocity = Terraria.Utils.RotatedBy(unitY, num2, val) * 20f; + int index = Collect.MyNewProjectile(Projectile.GetNoneSource(), ((Entity)projectile).Center, velocity, 131, (int)((float)projectile.damage * 0.32f), 1.14514f, projectile.owner); + CProjectile.Update(index); + } + } + + } + else + { + if (args.Player.ownedProjectileCounts[131] >= 100 || args.KnockBack == 1.14514f) + { + return; + } + Item[] armor2 = args.Player.armor; + if ((armor2[0].type == 1546 || armor2[0].type == 1547 || armor2[0].type == 1548) && armor2[1].type == 1549 && armor2[2].type == 1550) + { + int num3 = Main.rand.Next(1, 4); + for (int j = 0; j < num3; j++) + { + Vector2 unitY2 = Vector2.UnitY; + double num4 = (double)((float)Math.PI * 2f / (float)num3 * (float)j) + Main.time % 3.14; + val = default(Vector2); + Vector2 val2 = Terraria.Utils.RotatedBy(unitY2, num4, val) * 70f; + int index2 = Collect.MyNewProjectile(null, ((Entity)args.Npc).Center + val2, Vector2.Zero, 131, (int)((float)args.Damage * 0.25f), 1.14514f, ((Entity)args.Player).whoAmI); + CProjectile.Update(index2); + } + } + } + } + } + + public void SpectreArmorEffect(Player player) + { + var any = config.SpectreArmorEffect; + + Item[] armor = player.armor; + bool flag = armor[0].type == 1503 && armor[1].type == 1504 && armor[2].type == 1505; + if (flag && !Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectLife) + { + player.statLifeMax += any; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife += any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectLife = true; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 + {any}", new Color(0, 255, 255), ((Entity)player).Center); + } + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex = ((Entity)SpectreArmorProj.NewCProjectile(((Entity)player).Center + Vector2.UnitY * 100f, Vector2.Zero, ((Entity)player).whoAmI, new float[0], 1).proj).whoAmI; + } + else if (flag && Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectLife && !Collect.cprojs[Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex].isActive) + { + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex = ((Entity)SpectreArmorProj.NewCProjectile(((Entity)player).Center + Vector2.UnitY * 100f, Vector2.Zero, ((Entity)player).whoAmI, new float[0], 1).proj).whoAmI; + } + else if (!flag && Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectLife) + { + player.statLifeMax -= any; + Collect.cplayers[((Entity)player).whoAmI].ExtraLife -= any; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectLife = false; + if (config.EnableConsumptionMode) + { + SendPlayerText($"生命值上限 - {any}", new Color(255, 0, 156), ((Entity)player).Center); + } + CProjectile.CKill(Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex); + } + flag = armor[0].type == 2189 && armor[1].type == 1504 && armor[2].type == 1505; + if (flag && !Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectMana) + { + player.statManaMax += any; + Collect.cplayers[((Entity)player).whoAmI].ExtraMana += any; + NetMessage.SendData(42, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectMana = true; + if (config.EnableConsumptionMode) + { + SendPlayerText($"魔力值上限 + {any}", new Color(0, 255, 255), ((Entity)player).Center + new Vector2(0f, 32f)); + } + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex = ((Entity)SpectreArmorProj.NewCProjectile(((Entity)player).Center + Vector2.UnitY * 100f, Vector2.Zero, ((Entity)player).whoAmI, new float[0], 1).proj).whoAmI; + } + else if (flag && Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectMana && !Collect.cprojs[Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex].isActive) + { + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex = SpectreArmorProj.NewCProjectile(((Entity)player).Center + Vector2.UnitY * 100f, Vector2.Zero, ((Entity)player).whoAmI, new float[0], 1).proj.whoAmI; + } + if (!flag && Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectMana) + { + player.statManaMax -= any; + Collect.cplayers[((Entity)player).whoAmI].ExtraMana -= any; + NetMessage.SendData(42, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectMana = false; + if (config.EnableConsumptionMode) + { + SendPlayerText($"魔力值上限 - {any}", new Color(255, 0, 156), ((Entity)player).Center + new Vector2(0f, 32f)); + } + CProjectile.CKill(Collect.cplayers[((Entity)player).whoAmI].SpectreArmorEffectProjIndex); + } + } + + public void SpookyArmorEffect(ProjectileAiUpdateEventArgs args, int mode = 0) + { + if (config.SpookyArmorEffect) + { + Item[] armor = Main.player[args.Projectile.owner].armor; + Player val = Main.player[args.Projectile.owner]; + bool flag = armor[0].type == 1832 && armor[1].type == 1833 && armor[2].type == 1834; + int num = ((mode == 0) ? 13 : 35); + int num2 = ((mode == 0) ? 48 : 70); + int type = (Main.dayTime ? 316 : 321); + if (flag && args.Projectile.ai[0] >= (float)num && args.Projectile.ai[0] <= (float)num2 && args.Projectile.ai[0] % 4f == 0f) + { + List list = new List(); + Projectile.FillWhipControlPoints(args.Projectile, list); + Vector2 val2 = list[list.Count - 2]; + int index = Collect.MyNewProjectile(null, val2, (val2 - ((Entity)val).Center) * 0.008f, type, (int)((double)args.Projectile.damage * 0.2), 0f, ((Entity)val).whoAmI); + CProjectile.Update(index); + } + } + } + + public void HivePack(Player player) + { + if (config.HivePack) + { + if (Main.rand.Next(30) == 0) + { + Honey.NewCProjectile(((Entity)player).Center, -Terraria.Utils.RotatedByRandom(Vector2.UnitY, 1.5707963705062866) * 7f, 2, ((Entity)player).whoAmI, new float[1]); + } + } + } + + public void RoyalGel(Player player) + { + if (config.RoyalGel) + { + if (Timer % 120 == 0) + { + int num = Item.NewItem((IEntitySource)null, ((Entity)player).Center + new Vector2((float)Main.rand.Next(-860, 861), -600f), new Vector2(36f, 36f), 23, 1, false, 0, false, false); + Main.item[num].color = new Color(Main.rand.Next(256), Main.rand.Next(256), Main.rand.Next(256)); + TSPlayer.All.SendData((PacketTypes)88, (string)null, num, 1f, 0f, 0f, 0); + } + } + } + + public void CthulhuShield(Player player) + { + if (player.dashDelay == -1 && Timer - Collect.cplayers[((Entity)player).whoAmI].CthulhuShieldTime >= 720) + { + NetMessage.SendData(62, -1, -1, (NetworkText)null, ((Entity)player).whoAmI, 2f, 0f, 0f, 0, 0, 0); + Collect.cplayers[((Entity)player).whoAmI].CthulhuShieldTime = (int)Timer; + } + if (Timer - Collect.cplayers[((Entity)player).whoAmI].CthulhuShieldTime == 720) + { + SendPlayerText(TShock.Players[((Entity)player).whoAmI], "克苏鲁之盾冷却完成", new Color(255, 183, 183), ((Entity)player).Center); + } + } + + public void WormScarf(Player player) + { + var Any = config.WormScarf; + + bool flag = false; + for (int i = 0; i < 22; i++) + { + if (player.buffType[i] == 39 || player.buffType[i] == 69 || player.buffType[i] == 44 || player.buffType[i] == 46 || player.buffType[i] == Any) + { + flag = true; + player.buffType[i] = 0; + } + } + if (flag) + { + TShock.Players[((Entity)player).whoAmI].SendData((PacketTypes)50, "", ((Entity)player).whoAmI, 0f, 0f, 0f, 0); + } + } + + public void VolatileGelatin(NpcStrikeEventArgs args) + { + if (args.Npc.CanBeChasedBy((object)null, false) && !args.Npc.SpawnedFromStatue) + { + int num = Main.rand.Next(700); + if (num >= 90 && num < 100) + { + Item.NewItem((IEntitySource)null, ((Entity)args.Npc).Center, new Vector2(20f, 20f), 502, 1, false, 0, false, false); + } + else if (num >= 80 && num < 90 && Main.BestiaryTracker.Kills.GetKillCount(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[-4]) > 0) + { + Item.NewItem((IEntitySource)null, ((Entity)args.Npc).Center, new Vector2(20f, 20f), 3111, 1, false, 0, false, false); + } + else if (num >= 60 && num < 80) + { + Item.NewItem((IEntitySource)null, ((Entity)args.Npc).Center, new Vector2(20f, 20f), 409, 1, false, 0, false, false); + } + else if (num >= 40 && num < 60) + { + Item.NewItem((IEntitySource)null, ((Entity)args.Npc).Center, new Vector2(20f, 20f), 23, 1, false, 0, false, false); + } + } + } + + public void DisplayTips(TSPlayer tsplayer, short type) + { + switch (type) + { + case 2367: + case 2368: + case 2369: + SendPlayerText(tsplayer, "【垂钓套装】\n挑战模式奖励:给予永久的声纳、钓鱼、宝匣、镇\n定Buff", new Color(91, 101, 132), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 256: + case 257: + case 258: + SendPlayerText(tsplayer, "【忍者套装】\n挑战模式奖励:有四分之一概率闪避非致命伤害并\n释放烟雾", Color.Black, ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 3374: + case 3375: + case 3376: + SendPlayerText(tsplayer, "【化石套装】\n挑战模式奖励:在头上召唤一个琥珀光球,向敌人\n抛出极快的闪电矢", new Color(232, 205, 119), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -32f)); + break; + case 792: + case 793: + case 794: + SendPlayerText(tsplayer, "【猩红套装】\n挑战模式奖励:暴击时从周围每个敌怪处吸取一定\n血量随着敌怪数目增多吸血量-1,冷却 5秒", new Color(209, 46, 93), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 100: + case 101: + case 102: + case 956: + case 957: + case 958: + SendPlayerText(tsplayer, "【暗影套装】\n挑战模式奖励:暴击时从玩家周围生成吞噬怪飞弹\n攻击周围敌人,冷却 1秒", new Color(95, 91, 207), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 123: + case 124: + case 125: + SendPlayerText(tsplayer, "【陨石套装】\n挑战模式奖励:暴击时恢复些许魔力,间歇地降下\n高伤害落星攻击敌人", new Color(128, 15, 12), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 228: + case 229: + case 230: + case 960: + case 961: + case 962: + SendPlayerText(tsplayer, "【丛林套装】\n挑战模式奖励:间歇地从玩家周围生成伤害性的孢子", new Color(101, 151, 8), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -16f)); + break; + case 151: + case 152: + case 153: + case 959: + SendPlayerText(tsplayer, "【死灵套装】\n挑战模式奖励:受到伤害时,向四周飞溅骨头;攻\n击时偶尔发射骨箭", new Color(113, 113, 36), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 2361: + case 2362: + case 2363: + SendPlayerText(tsplayer, "【蜜蜂套装】\n挑战模式奖励:给予永久的蜂蜜增益;不间断地向\n四周撒蜂糖罐,玩家接触后回血并给予15秒蜂蜜增\n益;对玩家自身的治疗量略低于对其他玩家", new Color(232, 229, 74), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -32f)); + break; + case 3266: + case 3267: + case 3268: + SendPlayerText(tsplayer, "【黑曜石套装】\n挑战模式奖励:因为盗贼的祝福,掉落物会尝试掉落两次\n(仅对非boss生物和非高血量怪物有效)", new Color(90, 83, 160), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 231: + case 232: + case 233: + SendPlayerText(tsplayer, "【狱炎套装】\n挑战模式奖励:免疫岩浆,给予永久的地狱火增益", new Color(255, 27, 0), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -16f)); + break; + case 2370: + case 2371: + case 2372: + SendPlayerText(tsplayer, "【蜘蛛套装】\n挑战模式奖励:攻击时,给予敌人中毒和剧毒减益\n,按“up”键生成一个毒牙药水瓶,砸中敌人时爆炸", new Color(184, 79, 29), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -32f)); + break; + case 4982: + case 4983: + case 4984: + SendPlayerText(tsplayer, "【水晶刺客套装】\n挑战模式奖励:当有敌人在附近时,自身释放出水\n晶碎片;若玩家被击中,释放出更强大的碎片", new Color(221, 83, 146), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 3776: + case 3777: + case 3778: + SendPlayerText(tsplayer, "【禁戒套装】\n挑战模式奖励:释放自动寻的灵焰魂火攻击附近的\n敌人", new Color(222, 171, 26), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 684: + case 685: + case 686: + SendPlayerText(tsplayer, "【寒霜套装】\n挑战模式奖励:你周围开始下雪", new Color(31, 193, 229), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -16f)); + break; + case 551: + case 552: + case 553: + case 558: + case 559: + case 4873: + case 4896: + case 4897: + case 4898: + case 4899: + case 4900: + case 4901: + SendPlayerText(tsplayer, "【神圣套装】\n挑战模式奖励:击中敌人时召唤光与暗剑气,输入\n“/cf”切换剑气类型", new Color(179, 179, 203), Main.player[tsplayer.Index].Center + new Vector2(0f, -16f)); + break; + case 1001: + case 1002: + case 1003: + case 1004: + case 1005: + SendPlayerText(tsplayer, "【叶绿套装】\n挑战模式奖励:释放不精确的叶绿水晶矢,丛林之\n力给你更高的生命上限", new Color(103, 209, 0), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 1316: + case 1317: + case 1318: + SendPlayerText(tsplayer, "【海龟套装】\n挑战模式奖励:增加60血上限,自动在附近释放爆\n炸碎片", new Color(169, 104, 69), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 1159: + case 1160: + case 1161: + SendPlayerText(tsplayer, "【提基套装】\n挑战模式奖励:增加20血上限,在鞭子的轨迹上留\n下孢子", Color.Green, ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 2199: + case 2200: + case 2201: + case 2202: + SendPlayerText(tsplayer, "【甲虫套装】\n挑战模式奖励:增加60血上限,敌人的伤害的一部\n分会治疗周围的队友并给予buff;当装备帕拉丁盾\n或其上级合成物时,帕拉丁之锤伤害翻倍", new Color(101, 75, 120), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -32f)); + break; + case 1546: + case 1547: + case 1548: + case 1549: + case 1550: + SendPlayerText(tsplayer, "【蘑菇套装】\n挑战模式奖励:射弹会不稳定地留下蘑菇", new Color(47, 36, 237), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -16f)); + break; + case 1503: + case 1504: + case 1505: + case 2189: + SendPlayerText(tsplayer, "【幽魂套装】\n挑战模式奖励:根据头饰选择增加40血上限或80魔\n力上限;召唤 2个幽魂诅咒环绕玩家,向附近敌人攻击", new Color(166, 169, 218), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 1832: + case 1833: + case 1834: + SendPlayerText(tsplayer, "【阴森套装】\n挑战模式奖励:使用鞭子时,甩出蝙蝠或南\n瓜头", new Color(85, 75, 126), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, -24f)); + break; + case 3090: + SendPlayerText(tsplayer, "【皇家凝胶】\n挑战模式奖励:天空开始下凝胶小雨", new Color(0, 189, 238), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, 0f)); + break; + case 3097: + SendPlayerText(tsplayer, "【克苏鲁之盾】\n挑战模式奖励:冲刺时获得一小段无敌时间,冷却\n12秒", new Color(255, 199, 199), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, 0f)); + break; + case 3223: + SendPlayerText(tsplayer, "【混乱之脑】\n挑战模式奖励:输入“/cf”混乱周围所有敌怪", new Color(241, 108, 108), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, 0f)); + break; + case 3224: + SendPlayerText(tsplayer, "【蠕虫围巾】\n挑战模式奖励:免疫寒冷,霜火,灵液和咒火", new Color(166, 127, 231), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, 0f)); + break; + case 5113: + SendPlayerText(tsplayer, "【收音机零件】\n挑战模式奖励:输入“/cf”收听天气预报,在困难\n模式中可以收听世界先知预报", new Color(167, 218, 251), ((Entity)Main.player[tsplayer.Index]).Center + new Vector2(0f, 0f)); + break; + case 3333: + SendPlayerText(tsplayer, "【蜜蜂背包】\n挑战模式奖励:不间断地向四周扔出毒蜂罐,爆炸\n后释放一只蜜蜂", new Color(232, 229, 74), ((Entity)Main.player[tsplayer.Index]).Center); + break; + case 4987: + SendPlayerText(tsplayer, "【挥发明胶】\n挑战模式奖励:击中敌人有概率掉落碎魔晶,珍珠\n石,凝胶等", new Color(232, 229, 74), ((Entity)Main.player[tsplayer.Index]).Center); + break; + } + } + + private void OnGreetPlayer(GreetPlayerEventArgs args) + { + if (Collect.cplayers[args.Who] == null || !Collect.cplayers[args.Who].isActive) + { + Collect.cplayers[args.Who] = new CPlayer(TShock.Players[args.Who], tips: true); + } + if (config.enableChallenge) + { + TShock.Players[args.Who].SendMessage("世界已开启挑战模式,祝您好运!", new Color(255, 82, 165)); + } + else + { + TShock.Players[args.Who].SendMessage("世界已关闭挑战模式,快乐游玩吧", new Color(82, 155, 119)); + } + } + + private void OnServerLeave(LeaveEventArgs args) + { + if (args == null || TShock.Players[args.Who] == null) + { + return; + } + try + { + if (Collect.cplayers[args.Who] != null) + { + if (Collect.cplayers[args.Who].ExtraLife > 0) + { + Player obj = Main.player[args.Who]; + obj.statLifeMax -= Collect.cplayers[args.Who].ExtraLife; + NetMessage.SendData(16, -1, -1, NetworkText.Empty, args.Who, 0f, 0f, 0f, 0, 0, 0); + } + if (Collect.cplayers[args.Who].ExtraMana > 0) + { + Player obj2 = Main.player[args.Who]; + obj2.statManaMax -= Collect.cplayers[args.Who].ExtraMana; + NetMessage.SendData(42, -1, -1, NetworkText.Empty, args.Who, 0f, 0f, 0f, 0, 0, 0); + } + for (int i = 0; i < 1000; i++) + { + if (Collect.cprojs[i] != null && Collect.cprojs[i].isActive) + { + Collect.cprojs[i].CKill(); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine("Challenger.OnServerLeave异常3:" + ex.Message); + TShock.Log.Error("Challenger.OnServerLeave异常3:" + ex.Message); + } + Collect.cplayers[args.Who].isActive = false; + } + + private void OnGameUpdate(EventArgs args) + { + Timer++; + if (!config.enableChallenge) + { + return; + } + if (Collect.worldevent != 0) + { + switch (Collect.worldevent) + { + case 1: + if (Main.time == 1.0 && !Main.dayTime) + { + TSPlayer.Server.SetFullMoon(); + Collect.worldevent = 0; + } + break; + case 2: + if (Main.time == 1.0 && !Main.dayTime) + { + TSPlayer.Server.SetBloodMoon(true); + Collect.worldevent = 0; + } + break; + case 3: + if (Main.time == 1.0 && Main.dayTime) + { + TSPlayer.Server.SetEclipse(true); + Collect.worldevent = 0; + } + break; + case 4: + if (Main.time == 1.0 && !Main.dayTime && !LanternNight.LanternsUp) + { + LanternNight.ToggleManualLanterns(); + Collect.worldevent = 0; + } + break; + case 5: + if (Main.time == 1.0 && !Main.dayTime) + { + WorldGen.spawnMeteor = false; + WorldGen.dropMeteor(); + Collect.worldevent = 0; + } + break; + } + } + TSPlayer[] players = TShock.Players; + foreach (TSPlayer val in players) + { + if (val == null || Collect.cplayers[val.Index] == null || !Collect.cplayers[val.Index].isActive) + { + continue; + } + Player tPlayer = val.TPlayer; + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(tPlayer.armor[0].type).Append(tPlayer.armor[1].type).Append(tPlayer.armor[2].type); + switch (stringBuilder.ToString()) + { + case "228229230": + case "960961962": + case "228961230": + case "228229962": + case "960229230": + case "960961230": + case "960229962": + case "228961962": + JungleArmorEffect(tPlayer); + break; + case "231232233": + MoltenArmor(tPlayer); + break; + case "236723682369": + AnglerArmorEffect(tPlayer); + break; + case "236123622363": + BeeArmorEffect(tPlayer); + break; + case "123124125": + MeteorArmorEffect(null, tPlayer); + break; + case "237023712372": + SpiderArmorEffect(null, tPlayer); + break; + case "377637773778": + ForbiddenArmorEffect(tPlayer); + break; + case "498249834984": + CrystalAssassinArmorEffect(tPlayer, null); + break; + case "684685686": + FrostArmorEffect(tPlayer); + break; + default: + if (Timer % 5 == 0) + { + FossilArmorEffect(tPlayer); + ChlorophyteArmorEffect(tPlayer); + TurtleArmorEffect(tPlayer); + TikiArmorEffect(tPlayer, null); + BeetleArmorEffect(tPlayer, null, null); + SpectreArmorEffect(tPlayer); + } + break; + } + if (Timer % 4 != 0) + { + continue; + } + Item[] armor = tPlayer.armor; + for (int j = 3; j < 10; j++) + { + switch (armor[j].type) + { + case 3333: + HivePack(tPlayer); + break; + case 3090: + RoyalGel(tPlayer); + break; + case 3224: + WormScarf(tPlayer); + break; + case 3097: + CthulhuShield(tPlayer); + break; + } + } + } + if (honey.Count == 0) + { + return; + } + foreach (KeyValuePair item in honey) + { + if (item.Value < 4) + { + CProjectile.CKill(item.Key); + honey[item.Key]++; + } + else + { + honey.Remove(item.Key); + } + } + } + + private void OnHoldItem(object? sender, PlayerSlotEventArgs e) + { + if (e.Slot == 58 && e.Stack != 0 && config.enableChallenge && Collect.cplayers[((GetDataHandledEventArgs)e).Player.Index] != null && Collect.cplayers[((GetDataHandledEventArgs)e).Player.Index].isActive && Collect.cplayers[((GetDataHandledEventArgs)e).Player.Index].tips) + { + DisplayTips(((GetDataHandledEventArgs)e).Player, e.Type); + } + } + + private void OnNpcStrike(NpcStrikeEventArgs args) + { + if (!config.enableChallenge) + { + return; + } + switch (args.Player.armor[2].type) + { + case 794: + CrimsonArmorEffect(args); + break; + case 100: + case 958: + ShadowArmorEffect(args); + break; + case 125: + MeteorArmorEffect(args, null); + break; + case 3268: + ObsidianArmorEffect(args); + break; + case 153: + NecroArmor(null, args); + break; + case 2372: + SpiderArmorEffect(args, null); + break; + case 552: + case 4901: + HallowedArmorEffect(args); + break; + case 2202: + BeetleArmorEffect(null, null, args); + break; + case 1550: + ShroomiteArmorEffect(null, args); + break; + } + Item[] armor = args.Player.armor; + for (int i = 3; i < 10; i++) + { + int type = armor[i].type; + int num = type; + if (num == 4987) + { + VolatileGelatin(args); + } + } + if (Collect.cnpcs[((Entity)args.Npc).whoAmI] != null && Collect.cnpcs[((Entity)args.Npc).whoAmI].isActive) + { + Collect.cnpcs[((Entity)args.Npc).whoAmI].WhenHurtByPlayer(args); + } + } + + private void OnNPCKilled(object? sender, KilledEventArgs e) + { + if (config.enableChallenge) + { + NPC npc = e.Npc; + if (Collect.cnpcs[((Entity)npc).whoAmI] != null && Collect.cnpcs[((Entity)npc).whoAmI].isActive) + { + Collect.cnpcs[((Entity)npc).whoAmI].OnKilled(); + } + } + } + + private void OnNPCAI(NpcAiUpdateEventArgs args) + { + if (!config.enableChallenge) + { + return; + } + if (config.enableBossAI) + { + if (Collect.cnpcs[((Entity)args.Npc).whoAmI] == null || !Collect.cnpcs[((Entity)args.Npc).whoAmI].isActive) + { + if (args.Npc.lifeMax > 5 && !Collect.noneedlifeNPC.Contains(args.Npc.netID)) + { + args.Npc.lifeMax = (int)((float)args.Npc.lifeMax * config.lifeXnum); + args.Npc.life = args.Npc.lifeMax + 1; + } + else if (args.Npc.lifeMax == 1) + { + args.Npc.lifeMax = 100; + args.Npc.life = 101; + } + switch (args.Npc.netID) + { + case 50: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new SlimeKing(args.Npc); + break; + case 4: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new EyeofCthulhu(args.Npc); + break; + case 5: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new EyeofCthulhu_DemonEye(args.Npc); + break; + case 266: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new BrainofCthulhu(args.Npc); + break; + case 267: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new Creeper(args.Npc); + break; + case 13: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new EaterofWorldsHead(args.Npc); + break; + case 14: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new EaterofWorldsBody(args.Npc); + break; + case 15: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new EaterofWorldsTail(args.Npc); + break; + case 668: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new Deerclops(args.Npc); + break; + case 35: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new Skeletron(args.Npc); + break; + case 36: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new SkeletronHand(args.Npc); + break; + case 34: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new Skeletron_Surrand(args.Npc); + break; + case 222: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new QueenBee(args.Npc); + break; + case 114: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new WallofFleshEye(args.Npc); + break; + case 113: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new WallofFlesh(args.Npc); + break; + default: + Collect.cnpcs[((Entity)args.Npc).whoAmI] = new CNPC(args.Npc); + break; + } + } + else + { + Collect.cnpcs[((Entity)args.Npc).whoAmI].NPCAI(); + } + } + } + private void OnProjSpawn(object? sender, NewProjectileEventArgs e) + { + if (config.enableChallenge) + { + short type = e.Type; + short num = type; + if (num == 227) + { + Collect.cprojs[e.Identity] = new CrystalLeafShot(Main.projectile[e.Identity]); + Collect.cprojs[e.Identity].MyEffect(); + } + } + } + + private void OnProjAIUpdate(ProjectileAiUpdateEventArgs args) + { + if (!config.enableChallenge) + { + return; + } + if (Collect.cprojs[((Entity)args.Projectile).whoAmI] != null && Collect.cprojs[((Entity)args.Projectile).whoAmI].isActive) + { + Collect.cprojs[((Entity)args.Projectile).whoAmI].ProjectileAI(); + return; + } + switch (args.Projectile.type) + { + case 841: + case 912: + case 913: + case 914: + case 952: + TikiArmorEffect(null, args); + SpookyArmorEffect(args); + break; + case 847: + case 848: + case 849: + case 915: + TikiArmorEffect(null, args, 1); + SpookyArmorEffect(args, 1); + break; + } + } + + private void OnProjKilled(object? sender, ProjectileKillEventArgs e) + { + if (e.ProjectileIndex < 0 || e.ProjectileIndex > 999) + { + return; + } + Projectile projectile = Main.projectile[e.ProjectileIndex]; + if (config.enableChallenge) + { + if (Collect.cprojs[e.ProjectileIndex] != null) + { + Collect.cprojs[e.ProjectileIndex].PreProjectileKilled(); + } + ShroomiteArmorEffect(projectile, null); + } + } + + private void PlayerSufferDamage(object? sender, PlayerDamageEventArgs e) + { + if (!config.enableChallenge) + { + return; + } + if (config.enableMonsterSucksBlood) + { + if (e.PlayerDeathReason._sourceNPCIndex != -1) + { + TouchedAndBeSucked(e); + } + else if (e.PlayerDeathReason._sourceProjectileType != -1) + { + ProjAndBeSucked(e); + } + } + if (e.PlayerDeathReason._sourceNPCIndex != -1) + { + int sourceNPCIndex = e.PlayerDeathReason._sourceNPCIndex; + if (Collect.cnpcs[sourceNPCIndex] != null && Collect.cnpcs[sourceNPCIndex].isActive) + { + Collect.cnpcs[sourceNPCIndex].OnHurtPlayers(e); + } + } + else if (e.PlayerDeathReason._sourceProjectileType == -1) + { + } + if (!e.PVP) + { + switch (Main.player[((GetDataHandledEventArgs)e).Player.Index].armor[2].type) + { + case 153: + NecroArmor(e, null); + break; + case 258: + NinjaArmorEffect(e); + break; + case 4984: + CrystalAssassinArmorEffect(null, e); + break; + case 2202: + BeetleArmorEffect(null, e, null); + break; + } + } + } + + private void EnableTips(CommandArgs args) + { + if (args.Parameters.Any()) + { + args.Player.SendInfoMessage("输入 /ctip 来启用内容提示,如各种物品装备的修改文字提示,再次使用取消"); + } + else if (!config.enableChallenge) + { + args.Player.SendInfoMessage("挑战模式已关闭,无法开启文字提示"); + } + else if (Collect.cplayers[args.Player.Index] != null && Collect.cplayers[args.Player.Index].isActive && Collect.cplayers[args.Player.Index].tips) + { + Collect.cplayers[args.Player.Index].tips = false; + args.Player.SendMessage("文字提示已取消", new Color(45, 187, 45)); + } + else if (Collect.cplayers[args.Player.Index] != null && Collect.cplayers[args.Player.Index].isActive && !Collect.cplayers[args.Player.Index].tips) + { + Collect.cplayers[args.Player.Index].tips = true; + args.Player.SendMessage("文字提示已启用", new Color(45, 187, 45)); + } + } + + private void EnableModel(CommandArgs args) + { + if (args.Parameters.Any()) + { + args.Player.SendInfoMessage("输入 /cenable 来启用挑战模式,再次使用取消"); + return; + } + if (config.enableChallenge) + { + config.enableChallenge = false; + LinqExt.ForEach((IEnumerable)Collect.cprojs, (Action)delegate (CProjectile x) + { + if (x != null) + { + x.CKill(); + x.isActive = false; + } + }); + LinqExt.ForEach((IEnumerable)Collect.cnpcs, (Action)delegate (CNPC x) + { + if (x != null) + { + x.isActive = false; + } + }); + LinqExt.ForEach((IEnumerable)Collect.cplayers, (Action)delegate (CPlayer x) + { + if (x != null && x.isActive) + { + Player tPlayer = x.me.TPlayer; + tPlayer.statLifeMax -= x.ExtraLife; + Player tPlayer2 = x.me.TPlayer; + tPlayer2.statManaMax -= x.ExtraMana; + NetMessage.SendData(16, -1, -1, (NetworkText)null, x.me.Index, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(42, -1, -1, (NetworkText)null, x.me.Index, 0f, 0f, 0f, 0, 0, 0); + x.isActive = false; + } + }); + File.WriteAllText(configPath, JsonConvert.SerializeObject((object)config, (Formatting)1)); + TSPlayer.All.SendMessage("挑战模式已取消,您觉得太难了?[操作来自:" + args.Player.Name + "]", new Color(82, 155, 119)); + return; + } + config.enableChallenge = true; + File.WriteAllText(configPath, JsonConvert.SerializeObject((object)config, (Formatting)1)); + Player[] player = Main.player; + foreach (Player val in player) + { + if (val != null && ((Entity)val).active && TShock.Players[((Entity)val).whoAmI].IsLoggedIn) + { + Collect.cplayers[((Entity)val).whoAmI] = new CPlayer(TShock.Players[((Entity)val).whoAmI], tips: true); + } + } + TSPlayer.All.SendMessage("挑战模式启用,祝您愉快。[操作来自:" + args.Player.Name + "]", new Color(255, 82, 165)); + } + + private void Function(CommandArgs args) + { + if (!config.enableChallenge) + { + args.Player.SendInfoMessage("未启用挑战模式!"); + return; + } + if (!args.Player.Active) + { + args.Player.SendInfoMessage("请在游戏里使用该指令"); + return; + } + try + { + Item[] armor = args.Player.TPlayer.armor; + if ((armor[1].type == 551 || armor[1].type == 4900) && (armor[2].type == 552 || armor[2].type == 4901) && (armor[0].type == 559 || armor[0].type == 553 || armor[0].type == 558 || armor[0].type == 4873 || armor[0].type == 4896 || armor[0].type == 4897 || armor[0].type == 4898 || armor[0].type == 4899)) + { + Collect.cplayers[args.Player.Index].HallowedArmorState = !Collect.cplayers[args.Player.Index].HallowedArmorState; + if (Collect.cplayers[args.Player.Index].HallowedArmorState) + { + SendPlayerText(args.Player, "神圣剑辉已启用", new Color(255, 255, 0), ((Entity)args.Player.TPlayer).Center); + args.Player.SendMessage("神圣剑辉已启用", new Color(255, 255, 0)); + } + else + { + SendPlayerText(args.Player, "永夜剑辉已启用", new Color(255, 0, 255), ((Entity)args.Player.TPlayer).Center); + args.Player.SendMessage("永夜剑辉已启用", new Color(255, 0, 255)); + } + return; + } + for (int i = 3; i < 10; i++) + { + switch (armor[i].type) + { + case 3223: + { + NPC[] array = NearAllHostileNPCs(((Entity)args.Player.TPlayer).Center, 360000f); + int num2 = 0; + NPC[] array2 = array; + foreach (NPC val in array2) + { + if (((Entity)val).active) + { + num2++; + NetMessage.SendData(53, -1, -1, (NetworkText)null, ((Entity)val).whoAmI, 31f, 300f, 0f, 0, 0, 0); + } + } + TSPlayer.All.SendMessage(args.Player.Name + " 发动了混乱之脑迷惑,成功迷惑了附近 " + num2 + "个敌人", new Color(241, 108, 108)); + return; + } + case 5113: + { + int num = Main.rand.Next(Main.hardMode ? 19 : 23); + if (num >= 6 && num <= 10 && !Main.hardMode) + { + num = 15; + } + switch (num) + { + case 0: + case 11: + Main.StartRain(); + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:即将下雨", new Color(167, 218, 251)); + TSPlayer.All.SendData((PacketTypes)7, "", 0, 0f, 0f, 0f, 0); + break; + case 1: + case 12: + Main.StopRain(); + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:不会下雨", new Color(167, 218, 251)); + TSPlayer.All.SendData((PacketTypes)7, "", 0, 0f, 0f, 0f, 0); + break; + case 2: + case 13: + Main.windSpeedTarget = 0f; + Main.windSpeedCurrent = 0f; + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:不会有风", new Color(167, 218, 251)); + TSPlayer.All.SendData((PacketTypes)7, "", 0, 0f, 0f, 0f, 0); + break; + case 3: + case 14: + Main.windSpeedTarget = 1f; + Main.windSpeedCurrent = 1f; + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:即将挂起风", new Color(167, 218, 251)); + TSPlayer.All.SendData((PacketTypes)7, "", 0, 0f, 0f, 0f, 0); + break; + case 4: + Main.windSpeedTarget = 2f; + Main.windSpeedCurrent = 2f; + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:即将挂起狂风", new Color(167, 218, 251)); + TSPlayer.All.SendData((PacketTypes)7, "", 0, 0f, 0f, 0f, 0); + break; + case 5: + if (Sandstorm.Happening) + { + Sandstorm.StopSandstorm(); + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:不会有沙尘暴", new Color(167, 218, 251)); + } + else + { + Sandstorm.StartSandstorm(); + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:即将刮起沙尘暴", new Color(167, 218, 251)); + } + break; + case 6: + Collect.worldevent = 1; + TSPlayer.All.SendMessage($"{args.Player.Name} 收听了 {Main.worldName} 世界先知广播:{(Main.dayTime ? "今晚" : "明晚")}满月", new Color(72, 182, 252)); + break; + case 7: + Collect.worldevent = 2; + TSPlayer.All.SendMessage($"{args.Player.Name} 收听了 {Main.worldName} 世界先知广播:{(Main.dayTime ? "今晚" : "明晚")}血月", new Color(72, 182, 252)); + break; + case 8: + Collect.worldevent = 3; + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 世界先知广播:明天日食", new Color(72, 182, 252)); + break; + case 9: + Collect.worldevent = 4; + TSPlayer.All.SendMessage($"{args.Player.Name} 收听了 {Main.worldName} 世界先知广播:{(Main.dayTime ? "今晚" : "明晚")}灯笼夜", new Color(72, 182, 252)); + break; + case 10: + Collect.worldevent = 5; + TSPlayer.All.SendMessage($"{args.Player.Name} 收听了 {Main.worldName} 世界先知广播:{(Main.dayTime ? "今晚" : "明晚")}有流星", new Color(72, 182, 252)); + break; + default: + Collect.worldevent = 0; + TSPlayer.All.SendMessage(args.Player.Name + " 收听了 " + Main.worldName + " 天气预报收音广播:顺其自然,不会发生任何事件", new Color(167, 218, 251)); + break; + } + return; + } + } + } + args.Player.SendInfoMessage("没有套装效果启用"); + } + catch (Exception ex) + { + args.Player.SendInfoMessage("状态异常,使用失败: " + ex.ToString()); + Console.WriteLine(ex.ToString()); + TShock.Log.Error(ex.ToString()); + } + } + + public static NPC? NearestHostileNPC(Vector2 pos, float distanceSquared) + { + NPC result = null; + NPC[] npc = Main.npc; + foreach (NPC val in npc) + { + if (((Entity)val).active && val.CanBeChasedBy((object)null, false)) + { + float num = distanceSquared; + Vector2 val2 = ((Entity)val).Center - pos; + if (num > ((Vector2)(val2)).LengthSquared()) + { + val2 = ((Entity)val).Center - pos; + distanceSquared = ((Vector2)(val2)).LengthSquared(); + result = val; + } + } + } + return result; + } + + public static NPC? NearestWeakestNPC(Vector2 pos, float distanceSquared) + { + NPC val = null; + bool flag = false; + float num = 0f; + float num2 = 1000f; + float num3 = distanceSquared; + int num4 = -1; + NPC[] npc = Main.npc; + foreach (NPC val2 in npc) + { + Vector2 val3 = ((Entity)val2).Center - pos; + float num5 = ((Vector2)(val3)).LengthSquared(); + if (val2.boss && ((Entity)val2).active && distanceSquared > num5 && val2.value >= num) + { + num = val2.value; + val = val2; + flag = true; + } + if (((Entity)val2).active && !flag && val2.CanBeChasedBy((object)null, false) && distanceSquared > num5 && (float)val2.life * 1f / (float)val2.lifeMax <= num2) + { + if (val2.lifeMax - val2.life > 1) + { + num2 = (float)val2.life * 1f / (float)val2.lifeMax; + val = val2; + } + else if (num3 > num5) + { + num3 = num5; + num4 = ((Entity)val2).whoAmI; + } + } + } + if (val == null && num4 != -1) + { + val = Main.npc[num4]; + } + return val; + } + + public static NPC[] NearAllHostileNPCs(Vector2 pos, float distanceSquared) + { + List list = new List(); + NPC[] npc = Main.npc; + foreach (NPC val in npc) + { + if (((Entity)val).active && val.CanBeChasedBy(null, false)) + { + Vector2 val2 = ((Entity)val).Center - pos; + if (distanceSquared > ((Vector2)(val2)).LengthSquared()) + { + list.Add(val); + } + } + } + return list.ToArray(); + } + + public static Player? NearWeakestPlayer(Vector2 pos, float distanceSquared, Player? dontHealPlayer = null) + { + Player result = null; + int num = 0; + Player[] player = Main.player; + foreach (Player val in player) + { + if (!val.dead) + { + Vector2 val2 = ((Entity)val).Center - pos; + if (((Vector2)(val2)).LengthSquared() < distanceSquared && val.statLifeMax - val.statLife > num && (dontHealPlayer == null || ((Entity)dontHealPlayer).whoAmI != ((Entity)val).whoAmI)) + { + result = val; + num = val.statLifeMax - val.statLife; + } + } + } + return result; + } + + public static void HealPlayer(Player player, int num, bool visible = true) + { + player.statLife += num; + if (visible) + { + Rectangle val = default(Rectangle); + Rectangle r = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height); + CombatText.NewText(val, CombatText.HealLife, num, false, false); + Color healLife = CombatText.HealLife; + NetMessage.SendData(81, -1, -1, null, (int)((Color)(healLife)).PackedValue, (float)((Rectangle)(val)).Center.X, (float)((Rectangle)(val)).Center.Y, (float)num, 0, 0, 0); + } + NetMessage.SendData(16, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + + public static void HealPlayerMana(Player player, int num, bool visible = true) + { + player.statMana += num; + if (visible) + { + Rectangle val = default(Rectangle); + Rectangle r = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height); + CombatText.NewText(val, CombatText.HealLife, num, false, false); + Color healMana = CombatText.HealMana; + NetMessage.SendData(81, -1, -1, (NetworkText)null, (int)((Color)(healMana)).PackedValue, (float)((Rectangle)(val)).Center.X, (float)((Rectangle)(val)).Center.Y, (float)num, 0, 0, 0); + } + NetMessage.SendData(42, -1, -1, NetworkText.Empty, ((Entity)player).whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + + public static void SendPlayerText(TSPlayer player, string text, Color color, Vector2 position) + { + player.SendData((PacketTypes)119, text, (int)color.packedValue, position.X, position.Y, 0f, 0); + } + + public static void SendPlayerText(string text, Color color, Vector2 position) + { + TSPlayer.All.SendData((PacketTypes)119, text, (int)color.packedValue, position.X, position.Y, 0f, 0); + } + + public static void SendPlayerText(TSPlayer player, int text, Color color, Vector2 position) + { + player.SendData((PacketTypes)81, (string)null, (int)color.packedValue, position.X, position.Y, (float)text, 0); + } + + public static void SendPlayerText(int text, Color color, Vector2 position) + { + TSPlayer.All.SendData((PacketTypes)81, (string)null, (int)color.packedValue, position.X, position.Y, (float)text, 0); + } + } +} \ No newline at end of file diff --git a/Challenger/Challenger/Collect.cs b/Challenger/Challenger/Collect.cs new file mode 100644 index 000000000..d5c3b3987 --- /dev/null +++ b/Challenger/Challenger/Collect.cs @@ -0,0 +1,202 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Utilities; +using static Terraria.UI.ItemSlot; + +namespace Challenger +{ + internal static class Collect + { + public static CProjectile[] cprojs = new CProjectile[1000]; + + public static CNPC[] cnpcs = new CNPC[200]; + + public static CPlayer[] cplayers = new CPlayer[255]; + + public static int worldevent = 0; + + public static HashSet noneedlifeNPC = new HashSet { 115, 116, 488 }; + + public static int MyNewProjectile(IEntitySource spawnSource, float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner = 255, float ai0 = 0f, float ai1 = 0f, float ai2 = 0f) + { + if (Owner == -1) + { + Owner = Main.myPlayer; + } + int num = -1; + for (int num2 = 899; num2 >= 0; num2--) + { + if (!((Entity)Main.projectile[num2]).active) + { + num = num2; + break; + } + } + if (num == -1) + { + num = Projectile.FindOldestProjectile(); + } + Projectile val = Main.projectile[num]; + val.SetDefaults(Type); + ((Entity)val).position.X = X - (float)((Entity)val).width * 0.5f; + ((Entity)val).position.Y = Y - (float)((Entity)val).height * 0.5f; + val.owner = Owner; + ((Entity)val).velocity.X = SpeedX; + ((Entity)val).velocity.Y = SpeedY; + val.damage = Damage; + val.knockBack = KnockBack; + val.identity = num; + val.gfxOffY = 0f; + val.stepSpeed = 1f; + ((Entity)val).wet = Collision.WetCollision(((Entity)val).position, ((Entity)val).width, ((Entity)val).height); + if (val.ignoreWater) + { + ((Entity)val).wet = false; + } + ((Entity)val).honeyWet = Collision.honey; + ((Entity)val).shimmerWet = Collision.shimmer; + Main.projectileIdentity[Owner, num] = num; + Projectile.FindBannerToAssociateTo(spawnSource, val); + if (val.aiStyle == 1) + { + while (((Entity)val).velocity.X >= 16f || ((Entity)val).velocity.X <= -16f || ((Entity)val).velocity.Y >= 16f || ((Entity)val).velocity.Y < -16f) + { + Projectile val2 = val; + ((Entity)val2).velocity.X = ((Entity)val2).velocity.X * 0.97f; + Projectile val3 = val; + ((Entity)val3).velocity.Y = ((Entity)val3).velocity.Y * 0.97f; + } + } + if (Type == 434) + { + val.ai[0] = ((Entity)val).position.X; + val.ai[1] = ((Entity)val).position.Y; + } + if (Type > 0 && Type < ProjectileID.Count) + { + if (ProjectileID.Sets.NeedsUUID[Type]) + { + val.projUUID = val.identity; + } + + // Use a guard clause to avoid accessing Main.projectile when not needed + if (ProjectileID.Sets.StardustDragon[Type] && val.ai[0] >= 0) + { + int projUUID = Main.projectile[(int)val.ai[0]].projUUID; + if (projUUID >= 0) + { + val.ai[0] = projUUID; + } + } + } + if (Type == 249) + { + val.frame = Main.rand.Next(5); + } + val.ai[0] = ai0; + val.ai[1] = ai1; + val.ai[2] = ai2; + return num; + } + + public static int MyNewProjectile(IEntitySource spawnSource, Vector2 postion, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner = -1, float ai0 = 0f, float ai1 = 0f, float ai2 = 0f) + { + return MyNewProjectile(spawnSource, postion.X, postion.Y, velocity.X, velocity.Y, Type, Damage, KnockBack, Owner, ai0, ai1, ai2); + } + + public static int MyNewItem(IEntitySource source, Vector2 pos, Vector2 randomBox, int Type, int Stack = 1, bool noBroadcast = false, int prefixGiven = 0, bool noGrabDelay = false, bool reverseLookup = false) + { + return MyNewItem(source, (int)pos.X, (int)pos.Y, (int)randomBox.X, (int)randomBox.Y, Type, Stack, noBroadcast, prefixGiven, noGrabDelay, reverseLookup); + } + + public static int MyNewItem(IEntitySource source, int X, int Y, int Width, int Height, int Type, int Stack = 1, bool noBroadcast = false, int pfix = 0, bool noGrabDelay = false, bool reverseLookup = false) + { + if (WorldGen.gen) + { + return 0; + } + if (Main.rand == null) + { + Main.rand = new UnifiedRandom(); + } + if (Main.tenthAnniversaryWorld) + { + if (Type == 58) + { + Type = Utils.NextFromList(Main.rand, new short[3] { 1734, 1867, 58 }); + } + if (Type == 184) + { + Type = Utils.NextFromList(Main.rand, new short[3] { 1735, 1868, 184 }); + } + } + if (Main.halloween) + { + if (Type == 58) + { + Type = 1734; + } + if (Type == 184) + { + Type = 1735; + } + } + if (Main.xMas) + { + if (Type == 58) + { + Type = 1867; + } + if (Type == 184) + { + Type = 1868; + } + } + if (Type > 0 && Item.cachedItemSpawnsByType[Type] != -1) + { + Item.cachedItemSpawnsByType[Type] += Stack; + return 400; + } + Main.item[400] = new Item(); + int num = 400; + if (Main.netMode != 1) + { + num = Item.PickAnItemSlotToSpawnItemOn(reverseLookup, num); + } + Main.timeItemSlotCannotBeReusedFor[num] = 0; + Main.item[num] = new Item(); + Item val = Main.item[num]; + val.SetDefaults(Type); + val.Prefix(pfix); + val.stack = Stack; + ((Entity)val).position.X = X + Width / 2 - ((Entity)val).width / 2; + ((Entity)val).position.Y = Y + Height / 2 - ((Entity)val).height / 2; + ((Entity)val).wet = Collision.WetCollision(((Entity)val).position, ((Entity)val).width, ((Entity)val).height); + ((Entity)val).velocity.X = (float)Main.rand.Next(-30, 31) * 0.1f; + ((Entity)val).velocity.Y = (float)Main.rand.Next(-40, -15) * 0.1f; + if (Type == 859 || Type == 4743) + { + ((Entity)val).velocity = ((Entity)val).velocity * 0f; + } + if (Type == 520 || Type == 521 || (val.type >= 0 && ItemID.Sets.NebulaPickup[val.type])) + { + ((Entity)val).velocity.X = (float)Main.rand.Next(-30, 31) * 0.1f; + ((Entity)val).velocity.Y = (float)Main.rand.Next(-30, 31) * 0.1f; + } + val.active = true; + val.timeSinceItemSpawned = ItemID.Sets.OverflowProtectionTimeOffset[val.type]; + Item.numberOfNewItems++; + if (Options.HighlightNewItems && val.type >= 0 && !ItemID.Sets.NeverAppearsAsNewInInventory[val.type]) + { + val.newAndShiny = true; + } + else if (Main.netMode == 0) + { + val.playerIndexTheItemIsReservedFor = Main.myPlayer; + } + return num; + } + } +} \ No newline at end of file diff --git a/Challenger/Challenger/Config.cs b/Challenger/Challenger/Config.cs new file mode 100644 index 000000000..1f2392941 --- /dev/null +++ b/Challenger/Challenger/Config.cs @@ -0,0 +1,177 @@ +using Newtonsoft.Json; +using System.Configuration; +using System.Text; +using TShockAPI; + +namespace Challenger +{ + public class Config + { + public static readonly string FilePath = Path.Combine(TShock.SavePath, "ChallengerConfig.json"); + + [JsonProperty("是否启用挑战模式")] + public bool enableChallenge = true; + + [JsonProperty("是否启用BOSS魔改")] + public bool enableBossAI = false; + + [JsonProperty("是否启用怪物吸血")] + public bool enableMonsterSucksBlood = true; + + [JsonProperty("吸血比率")] + public float BloodAbsorptionRatio = 0.25f; + + [JsonProperty("吸血比率对于Boss")] + public float BloodAbsorptionRatioForBoss = 0.5f; + + [JsonProperty("启用话痨模式")] + public bool EnableConsumptionMode = false; + + [JsonProperty("启用广播话痨模式")] + public bool EnableBroadcastConsumptionMode = false; + + [JsonProperty("所有怪物血量倍数")] + public float lifeXnum = 1.00f; + + [JsonProperty("皇家凝胶是否下凝胶雨")] + public bool RoyalGel = true; + + [JsonProperty("蠕虫围巾还能免疫什么DeBuff")] + public int WormScarf = 0; + + [JsonProperty("蜜蜂背包是否扔毒蜂罐")] + public bool HivePack = true; + + [JsonProperty("化石套是否出琥珀光球")] + public bool FossilArmorEffect = true; + + [JsonProperty("丛林套是否环绕伤害孢子")] + public bool JungleArmorEffect = true; + + [JsonProperty("忍者套是否会闪避")] + public bool NinjaArmorEffect = true; + + [JsonProperty("流星套是否下落星")] + public bool MeteorArmorEffect = true; + + [JsonProperty("蜜蜂套是否撒蜂糖罐")] + public bool BeeArmorEffect = true; + + [JsonProperty("死灵套是否产生额外弹幕")] + public bool NecroArmor = true; + + [JsonProperty("黑曜石套是否盗窃双倍掉落物")] + public bool ObsidianArmorEffect = true; + + [JsonProperty("狱岩套给什么永久BUFF")] + public int MoltenArmor = 116; + + [JsonProperty("水晶刺客套是否释放水晶碎片")] + public bool CrystalAssassinArmorEffect = true; + + [JsonProperty("禁戒套是否释放灵焰魂火")] + public bool ForbiddenArmorEffect = true; + + [JsonProperty("寒霜套是否下北极弹幕")] + public bool FrostArmorEffect = true; + + [JsonProperty("神圣套额外弹幕多少伤害/默认55%")] + public double HallowedArmorEffect = 0.55; + + [JsonProperty("叶绿套加多少血")] + public int ChlorophyteArmorEffect = 100; + + [JsonProperty("海龟套加多少血")] + public int TurtleArmorEffect = 60; + + [JsonProperty("提基套加多少血")] + public int TikiArmorEffect = 20; + + [JsonProperty("阴森套是否出南瓜弹幕")] + public bool SpookyArmorEffect = true; + + [JsonProperty("蘑菇套是否产蘑菇")] + public bool ShroomiteArmorEffect = true; + + [JsonProperty("幽灵套加多少血和魔力")] + public int SpectreArmorEffect = 60; + + + [JsonProperty("甲虫套加多少血")] + public int BeetleArmorEffect_1 = 60; + + [JsonProperty("甲虫套带骑士盾时给圣锤加多少伤害/默认90%")] + public float BeetleArmorEffect_2 = 0.9f; + + + + + #region 读取与创建配置文件方法 + + //创建 写入你 👆 上面的参数 + public void Write(string path) + { + using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write)) + using (var sw = new StreamWriter(fs, new UTF8Encoding(false))) + { + var str = JsonConvert.SerializeObject(this, Formatting.Indented); + sw.Write(str); + } + } + + // 从文件读取配置 + public static Config Read(string path) + { + if (!File.Exists(path)) + { + var c = new Config(); + c.Write(path); + return c; + } + else + { + using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) + using (var sr = new StreamReader(fs)) + { + var json = sr.ReadToEnd(); + var cf = JsonConvert.DeserializeObject(json); + return cf!; + } + } + } + #endregion + + #region 原配置文件方法 + /* + public Config() + { + } + + + public static Config LoadConfig() + { + if (!File.Exists(configPath)) + { + Config config = new Config(b1: true, b2: true, 0.25f, 0.5f, b3: false, b4: false, 1.25f,b6: false); + File.WriteAllText(configPath, JsonConvert.SerializeObject((object)config, (Formatting)1)); + return config; + } + return JsonConvert.DeserializeObject(File.ReadAllText(configPath)); + } + + + public Config(bool b1, bool b2, float f1, float f2, bool b3, bool b4, float b5,bool b6) + { + enableChallenge = b1; + enableMonsterSucksBlood = b2; + BloodAbsorptionRatio = f1; + BloodAbsorptionRatioForBoss = f2; + EnableConsumptionMode = b3; + EnableBroadcastConsumptionMode = b4; + this.lifeXnum = b5; + enableBossAI = b6; + } + */ + #endregion + } +} \ No newline at end of file diff --git a/Challenger/Microsoft/CodeAnalysis/EmbeddedAttribute.cs b/Challenger/Microsoft/CodeAnalysis/EmbeddedAttribute.cs new file mode 100644 index 000000000..3ab6afd7d --- /dev/null +++ b/Challenger/Microsoft/CodeAnalysis/EmbeddedAttribute.cs @@ -0,0 +1,10 @@ +using System.Runtime.CompilerServices; + +namespace Microsoft +{ + [CompilerGenerated] + internal class EmbeddedAttribute : Attribute + { + + } +} \ No newline at end of file diff --git a/Challenger/Microsoft/CodeAnalysis/NullableAttribute.cs b/Challenger/Microsoft/CodeAnalysis/NullableAttribute.cs new file mode 100644 index 000000000..ec15c7792 --- /dev/null +++ b/Challenger/Microsoft/CodeAnalysis/NullableAttribute.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.CompilerServices; +using Microsoft.CodeAnalysis; + +namespace Challenger +{ + [CompilerGenerated] + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] + internal sealed class NullableAttribute : Attribute + { + public readonly byte[] NullableFlags; + + public NullableAttribute(byte P_0) + { + NullableFlags = new byte[1] { P_0 }; + } + + public NullableAttribute(byte[] P_0) + { + NullableFlags = P_0; + } + } +} diff --git a/Challenger/Microsoft/CodeAnalysis/NullableContextAttribute.cs b/Challenger/Microsoft/CodeAnalysis/NullableContextAttribute.cs new file mode 100644 index 000000000..5c46d97a7 --- /dev/null +++ b/Challenger/Microsoft/CodeAnalysis/NullableContextAttribute.cs @@ -0,0 +1,18 @@ +using System; +using System.Runtime.CompilerServices; +using Microsoft.CodeAnalysis; + +namespace Challenger +{ + [CompilerGenerated] + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] + internal sealed class NullableContextAttribute : Attribute + { + public readonly byte Flag; + + public NullableContextAttribute(byte P_0) + { + Flag = P_0; + } + } +} diff --git a/Challenger/README.md b/Challenger/README.md new file mode 100644 index 000000000..e39c4a7de --- /dev/null +++ b/Challenger/README.md @@ -0,0 +1,104 @@ +# ShowArmors 发送装备 + +- 作者: 星夜神花、枳、羽学 +- 出处: bbstr.net,[github](https://github.com/skywhale-zhi/Challenger) +- 这是一个Tshock服务器插件主要用于修改服务器BOSSAI的魔改与装备套装、饰品被动技能等 +- 并使玩家受伤时会被抽出血包,血包会给附近的敌怪回血(boss优先),若玩家能拦截住血包就能给自己回血。 +- 并允许通过修改配置文件控制所有怪物的血量倍数 +- +- 修改的套装增强效果有: +- 垂钓套装:给予永久的声纳、钓鱼、宝匣、镇定Buff​ +- 忍者套:有四分之一概率闪避非致命伤害并释放烟雾​ +- 化石套:在头上召唤一个琥珀光球,向敌人抛出极快的闪电矢​ +- 暗影套:暴击时从玩家周围生成吞噬怪飞弹攻击周围敌人,冷却 1秒​ +- 猩红套:暴击时从周围每个敌怪处吸取一定血量随着敌怪数目增多吸血量-1,冷却 5秒​ +- 陨石套:暴击时恢复些许魔力,间歇地降下高伤害落星攻击敌人​ +- 蜜蜂套:给予永久的蜂蜜增益;不间断地向四周撒蜂糖罐,玩家接触后回血并给予15秒蜂蜜增益; +对玩家自身的治疗量略低于对其他玩家​ +- 丛林套(远古钴):间歇地从玩家周围生成伤害性的孢子​ +- 死灵套:受到伤害时,向四周飞溅骨头;攻击时偶尔发射骨箭​ +- 黑曜石套:因为盗贼的祝福,掉落物会尝试掉落两次(仅对非boss生物和非高血量怪物有效)​ +- 熔岩套:免疫岩浆,给予永久的地狱火增益​ +- 蜘蛛套:攻击时,给予敌人中毒和剧毒减益,按“up”键生成一个毒牙药水瓶,砸中敌人时爆炸"​ +- 水晶刺客套:当有敌人在附近时,自身释放出水晶碎片;若玩家被击中,释放出更强大的碎片​ +- 寒霜套:你周围开始下雪​(冰雪女王掉落武器“北极”弹幕) +- 禁戒套:释放自动寻的灵焰魂火攻击附近的敌人​ +- 神圣套(远古神圣):击中敌人时召唤光与暗剑气,输入“/cf”切换剑气类型​ +- 叶绿套:释放不精确的叶绿水晶矢,丛林之力给你更高的生命上限​ +- 海龟套:增加60血上限,自动在附近释放爆炸碎片​ +- 提基套:增加20血上限,在鞭子的轨迹上留下孢子​ +- 甲虫套:增加60血上限,敌人的伤害的一部分会治疗周围的队友并给予buff; +当装备圣骑士盾或其上级合成物时,圣骑士锤伤害翻倍​ +- 蘑菇套:射弹会不稳定地留下蘑菇​ +- 阴森套:使用鞭子时,甩出蝙蝠或南瓜头​ +- 幽魂套:根据头饰选择增加40血上限或80魔力上限;召唤 2个幽魂诅咒环绕玩家,向附近敌人攻击​ +- 皇家凝胶:天空开始下凝胶小雨​ +- 克苏鲁之盾:冲刺时获得一小段无敌时间,冷却12秒​ +- 混乱之脑:输入“/cf”混乱周围所有敌怪​ +- 蠕虫围巾:免疫寒冷,霜火,灵液和咒火​ +- 收音机零件:输入“/cf”收听天气预报,在困难模式中可以收听世界先知预报​ +- 蜜蜂背包:不间断地向四周扔出毒蜂罐,爆炸后释放一只蜜蜂​ +- 挥发明胶:击中敌人有概率掉落碎魔晶,珍珠石,凝胶等​ +- +- 【目前存在的问题】:增加的效果造成的伤害不会算作玩家造成的,但依然可以杀死怪物 + +## 更新日志 + +``` +1.0.2 +羽学添加了大量配置项,允许自定义开启或修改某些饰品的被动技能 +可修改配置项来决定是否开启BOSS_AI的魔改 + +1.0.1 +玩家受伤时会被抽出血包,血包会给附近的敌怪回血(boss优先),若玩家能拦截住血包就能给自己回血 +``` + +## 指令 + +| 语法 | 别名 | 权限 | 说明 | +| -------------- | :---------:| :------------: | :------: | +| /cenable | challenger.enable | 启用挑战模式,再次使用解除| +| /tips | challenger.tips | 启用内容提示,如各种物品的文字提示,再次使用取消| +| /cf | 无 | 用于切换或触发装备被动技能类型 | + +## 配置 + +``` +{ + "是否启用挑战模式": true, + "是否启用BOSS魔改": false, + "是否启用怪物吸血": true, + "吸血比率": 0.25, + "吸血比率对于Boss": 0.5, + "启用话痨模式": false, + "启用广播话痨模式": false, + "所有怪物血量倍数": 1.0, + "皇家凝胶是否下凝胶雨": true, + "蠕虫围巾还能免疫什么DeBuff": 0, + "蜜蜂背包是否扔毒蜂罐": true, + "化石套是否出琥珀光球": true, + "丛林套是否环绕伤害孢子": true, + "忍者套是否会闪避": true, + "流星套是否下落星": true, + "蜜蜂套是否撒蜂糖罐": true, + "死灵套是否产生额外弹幕": true, + "黑曜石套是否盗窃双倍掉落物": true, + "狱岩套给什么永久BUFF": 116, + "水晶刺客套是否释放水晶碎片": true, + "禁戒套是否释放灵焰魂火": true, + "寒霜套是否下北极弹幕": true, + "神圣套额外弹幕多少伤害/默认55%": 0.55, + "叶绿套加多少血": 100, + "海龟套加多少血": 60, + "提基套加多少血": 20, + "阴森套是否出南瓜弹幕": true, + "蘑菇套是否产蘑菇": true, + "幽灵套加多少血和魔力": 60, + "甲虫套加多少血": 60, + "甲虫套带骑士盾时给圣锤加多少伤害/默认90%": 0.9 +} +``` + +## 反馈 +- 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin +- 国内社区trhub.cn 或 TShock官方群等 \ No newline at end of file diff --git a/Plugin.sln b/Plugin.sln index d33e43e40..ddd12f1e1 100644 --- a/Plugin.sln +++ b/Plugin.sln @@ -110,6 +110,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Economics.Regain", "Economi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimultaneousUseFix", "SimultaneousUseFix\SimultaneousUseFix.csproj", "{32A38583-1944-4542-8424-4427D16491FE}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Challenger", "Challenger\Challenger.csproj", "{CAE3975F-26E7-4F0B-A5F3-DD070BA37142}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -526,6 +528,14 @@ Global {32A38583-1944-4542-8424-4427D16491FE}.Release|Any CPU.Build.0 = Release|Any CPU {32A38583-1944-4542-8424-4427D16491FE}.Release|x64.ActiveCfg = Release|Any CPU {32A38583-1944-4542-8424-4427D16491FE}.Release|x64.Build.0 = Release|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Debug|x64.ActiveCfg = Debug|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Debug|x64.Build.0 = Debug|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Release|Any CPU.Build.0 = Release|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Release|x64.ActiveCfg = Release|Any CPU + {CAE3975F-26E7-4F0B-A5F3-DD070BA37142}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index 32914749c..13ffa9453 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,4 @@ | [PersonalPermission](PersonalPermission/README.md) | 为玩家单独设置权限 | 无 | | [ItemPreserver](ItemPreserver/README.md) | 指定物品不消耗 | 无 | | [SimultaneousUseFix](SimultaneousUseFix/README.md) | 解决卡双锤卡星旋机枪之类的问题|[Chireiden.TShock.Omni](https://github.com/sgkoishi/yaaiomni/releases)| +| [Challenger](Challenger/README.md) | 挑战者模式 | 无 | \ No newline at end of file