-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from 1242509682/master
add 挑战者模式 1.0.2
- Loading branch information
Showing
35 changed files
with
5,081 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.