Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新插件 自定义怪物v1.0.4.39 #620

Merged
merged 4 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CustomMonster/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Configuration
public bool ErrorLogs = false;

[JsonProperty(PropertyName = "配置文件插件版本号", Order = 5)]
public string Version = "1.0.4.38";
public string Version = "1.0.4.39";

[JsonProperty(PropertyName = "启动死亡队友视角", Order = 6)]
public bool DeathPerspective = false;
Expand Down
4 changes: 2 additions & 2 deletions src/CustomMonster/CustomMonster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TestPlugin : TerrariaPlugin
public override string Author => "GK 阁下 羽学";
public override string Description => "自定义怪物出没时的血量,当然不止这些!";
public override string Name => "自定义怪物血量";
public override Version Version => new Version(1, 0, 4, 40);
public override Version Version => new Version(1, 0, 4, 39);
ACaiCat marked this conversation as resolved.
Show resolved Hide resolved
#endregion

#region 全局变量
Expand Down Expand Up @@ -1471,7 +1471,7 @@ public void OnUpdate(object sender, ElapsedEventArgs e)
continue;
}
}
if ((item5.FacingDirectionCondition == 1 && (val3.direction != 1 || val3.directionY != 0)) || (item5.FacingDirectionCondition == 2 && (val3.direction != 1 || val3.directionY != 1)) || (item5.FacingDirectionCondition == 3 && (val3.direction != 0 || val3.directionY != 1)) || (item5.FacingDirectionCondition == 4 && (val3.direction != -1 || val3.directionY != 1)) || (item5.FacingDirectionCondition == 5 && (val3.direction != -1 || val3.directionY != 0)) || (item5.FacingDirectionCondition == 6 && (val3.direction != -1 || val3.directionY != -1)) || (item5.FacingDirectionCondition == 7 && (val3.direction != 0 || val3.directionY != -1)) || (item5.FacingDirectionCondition == 8 && (val3.direction != 1 || val3.directionY != -1)) || (item5.FacingDirectionCondition == 9 && val3.direction != 1) || (item5.FacingDirectionCondition == 10 && val3.directionY != 1) || (item5.FacingDirectionCondition == 11 && val3.direction != -1) || (item5.FacingDirectionCondition == 12 && val3.directionY != -1) || item5.TriggerNumerator <= 0 || item5.TriggerDenominator <= 0 || (item5.TriggerNumerator < item5.TriggerDenominator && rd.Next(1, item5.TriggerDenominator + 1) > item5.TriggerNumerator) || Sundry.NPCKillRequirement(item5.KilledNPC) || !lNPC2.haveMarkers(item5.IndicatorConditions, val3) || Sundry.AIRequirement(item5.AiConditions, val3) || Sundry.MonsterRequirement(item5.MonsterCondition, val3) || Sundry.PlayerRequirement(item5.PlayerCondition, val3))
if ((item5.FacingDirectionCondition == 1 && (val3.direction != 1 || val3.directionY != 0)) || (item5.FacingDirectionCondition == 2 && (val3.direction != 1 || val3.directionY != 1)) || (item5.FacingDirectionCondition == 3 && (val3.direction != 0 || val3.directionY != 1)) || (item5.FacingDirectionCondition == 4 && (val3.direction != -1 || val3.directionY != 1)) || (item5.FacingDirectionCondition == 5 && (val3.direction != -1 || val3.directionY != 0)) || (item5.FacingDirectionCondition == 6 && (val3.direction != -1 || val3.directionY != -1)) || (item5.FacingDirectionCondition == 7 && (val3.direction != 0 || val3.directionY != -1)) || (item5.FacingDirectionCondition == 8 && (val3.direction != 1 || val3.directionY != -1)) || (item5.FacingDirectionCondition == 9 && val3.direction != 1) || (item5.FacingDirectionCondition == 10 && val3.directionY != 1) || (item5.FacingDirectionCondition == 11 && val3.direction != -1) || (item5.FacingDirectionCondition == 12 && val3.directionY != -1) || item5.TriggerNumerator <= 0 || item5.TriggerDenominator <= 0 || (item5.TriggerNumerator < item5.TriggerDenominator && rd.Next(1, item5.TriggerDenominator + 1) > item5.TriggerNumerator) || Sundry.NPCKillRequirement(item5.KilledNPC) || !lNPC2.haveMarkers(item5.IndicatorConditions, val3) || Sundry.AIRequirement(item5.AiConditions, val3) || Sundry.MonsterRequirement(item5.MonsterCondition, val3) || Sundry.PlayerRequirement(item5.PlayerCondition, val3) || Sundry.ProjectileRequirement(item5.ProjectileCondition, val3))
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CustomMonster/CustomMonster.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"控制台广告": false,
"配置说明": "版本①;难度直线提升,怪物最低3个人血量,几乎全Boss加强!",
"启动错误报告": false,
"配置文件插件版本号": "1.0.4.38",
"配置文件插件版本号": "1.0.4.39",
"启动死亡队友视角": false,
"队友视角仅BOSS时": false,
"队友视角流畅度": -1,
Expand Down
9 changes: 4 additions & 5 deletions src/CustomMonster/LNPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public LNPC(int index, int playercount, int life, MonsterGroup config, int maxti
#region 设置或更新指定名称的标记(Marker)的
public void setMarkers(string name, int num, bool reset)
{
var name2 = name;
if (!this.Markers!.Exists(t => t.IndName == name))
{
this.Markers.Add(new IndicatorGroup2(name, 0));
Expand All @@ -119,9 +118,9 @@ public void setMarkers(string name, int num, bool reset)
public void setMarkers(string name, int num, bool reset, string inname, float infactor, string inop, int rmin, int rmax, ref Random rd, NPC npc)
{
var name2 = name;
if (!this.Markers!.Exists((IndicatorGroup2 t) => t.IndName == name))
if (!this.Markers!.Exists((IndicatorGroup2 t) => t.IndName == name2))
{
this.Markers.Add(new IndicatorGroup2(name, 0));
this.Markers.Add(new IndicatorGroup2(name2, 0));
}
var num2 = 0;
if (rmax > rmin)
Expand All @@ -131,7 +130,7 @@ public void setMarkers(string name, int num, bool reset, string inname, float in
var num3 = this.addMarkersIn(inname, infactor, npc);
foreach (var marker in this.Markers)
{
if (marker.IndName == name)
if (marker.IndName == name2)
{
marker.IndStack = reset ? Sundry.intoperation(inop, 0, num + num2 + num3) : Sundry.intoperation(inop, marker.IndStack, num + num2 + num3);
break;
Expand All @@ -154,7 +153,7 @@ public int addMarkersIn(string inname, float infactor, NPC npc)
{
num = npc.whoAmI;
}
else if (npc != null)
else if(npc != null)
{
switch (inname)
{
Expand Down
15 changes: 0 additions & 15 deletions src/CustomMonster/LPrj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,5 @@ public LPrj(int index, int useIndex, int type, string notes)
this.Type = type;
this.Notes = notes;
}

#region 在满足条件时销毁游戏世界中对应的弹幕。
public void clear(string notes)
{
if ((!(notes != "") || !(this.Notes != notes)) && this.Index >= 0)
{
var index = this.Index;
this.Index = -1;
if (Main.projectile[index] != null && Main.projectile[index].active && Main.projectile[index].type == this.Type && Main.projectile[index].owner == Main.myPlayer)
{
Main.projectile[index].Kill();
}
}
}
#endregion
}

3 changes: 3 additions & 0 deletions src/CustomMonster/PlayerConditionGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class PlayerConditionGroup
[JsonProperty(PropertyName = "范围内")]
public int InRange = 0;

[JsonProperty(PropertyName = "生命值")]
public int Life = 0;

[JsonProperty(PropertyName = "符合数")]
public int SuitNum = 0;

Expand Down
5 changes: 4 additions & 1 deletion src/CustomMonster/ProjUpdateGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ public class ProjUpdateGroup
[JsonProperty(PropertyName = "弹幕Y轴注入指示物名")]
public string ProjectileYIndicatorName = "";

[JsonProperty(PropertyName = "销毁弹幕")]
[JsonProperty(PropertyName = "持续时间")]
public int Duration = -1;

[JsonProperty(PropertyName = "清除弹幕")]
public bool DestroyProjectile = false;

public ProjUpdateGroup(int id, string note)
Expand Down
29 changes: 29 additions & 0 deletions src/CustomMonster/ProjectileConditionGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Newtonsoft.Json;

namespace CustomMonster;

public class ProjectileConditionGroup
{
[JsonProperty(PropertyName = "弹幕ID")]
public int ProjectileID = 0;

[JsonProperty(PropertyName = "查标志")]
public string CheckSign = "";

[JsonProperty(PropertyName = "范围内")]
public int Range = 0;

[JsonProperty(PropertyName = "符合数")]
public int SuitNum = 0;

[JsonProperty(PropertyName = "全局弹幕")]
public bool FullProjectile = false;

public ProjectileConditionGroup(int id, int range, int num)
{
this.ProjectileID = id;
this.Range = range;
this.SuitNum = num;
this.CheckSign = "";
}
}
5 changes: 5 additions & 0 deletions src/CustomMonster/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@
## Update Log

```
December 21, 2024
Integrated with GK's latest version 1.0.4.39
Add Projectile Condition Section

December 16, 2024
Integrated the latest version 1.0.4.38 by GK
Add Projectile Update Section

October 14, 2024
Integrated the latest version 1.0.4.36 by GK
Expand Down
5 changes: 5 additions & 0 deletions src/CustomMonster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@

## 更新日志
```
2024年12月21日
整合了GK最新版的1.0.4.39
加入弹幕条件节

2024年12月16日
整合了GK最新版的1.0.4.38
加入更新弹幕节

2024年10月14日
整合了GK最新版的1.0.4.36
Expand Down
50 changes: 39 additions & 11 deletions src/CustomMonster/Sundry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ public static bool PlayerRequirement(List<PlayerConditionGroup> Rmonster, NPC np
continue;
}
var num = 0;
num = (monster.StartRange <= 0) ? TShock.Players.Count((TSPlayer p) => p != null && p.Active && !p.Dead && p.TPlayer.statLife > 0 && npc.WithinRange(p.TPlayer.Center, monster.InRange << 4)) : TShock.Players.Count((TSPlayer p) => p != null && p.Active && !p.Dead && p.TPlayer.statLife > 0 && !npc.WithinRange(p.TPlayer.Center, monster.StartRange << 4) && npc.WithinRange(p.TPlayer.Center, monster.InRange << 4));
num = (monster.StartRange <= 0) ? TShock.Players.Count(p => p != null && p.Active && !p.Dead && p.TPlayer.statLife > 0 && (monster.Life == 0 || ((monster.Life > 0) ? (p.TPlayer.statLife >= monster.Life) : (p.TPlayer.statLife < Math.Abs(monster.Life)))) && Npc.WithinRange(p.TPlayer.Center, monster.InRange << 4)) : TShock.Players.Count(p => p != null && p.Active && !p.Dead && p.TPlayer.statLife > 0 && (monster.Life == 0 || ((monster.Life > 0) ? (p.TPlayer.statLife >= monster.Life) : (p.TPlayer.statLife < Math.Abs(monster.Life)))) && !Npc.WithinRange(p.TPlayer.Center, monster.StartRange << 4) && Npc.WithinRange(p.TPlayer.Center, monster.InRange << 4));
if (monster.SuitNum == 0)
{
continue;
Expand Down Expand Up @@ -1203,7 +1203,7 @@ public static bool MonsterRequirement(List<MonsterConditionGroup> Rmonster, NPC
foreach (var monster in Rmonster)
{
var num = 0;
num = (monster.Range <= 0) ? Main.npc.Count((NPC p) => p != null && p.active && (monster.NPCID == 0 || p.netID == monster.NPCID) && p.whoAmI != npc.whoAmI && (monster.LifeRate == 0 || p.lifeMax < 1 || ((monster.LifeRate > 0) ? (p.life * 100 / p.lifeMax >= monster.LifeRate) : (p.life * 100 / p.lifeMax < Math.Abs(monster.LifeRate)))) && (monster.Indicator == null || (LNpcs![p.whoAmI] != null && LNpcs[p.whoAmI].haveMarkers(monster.Indicator, npc))) && (monster.CheckSign == "" || (LNpcs![p.whoAmI] != null && LNpcs[p.whoAmI].Config != null && LNpcs[p.whoAmI].Config!.Sign == monster.CheckSign))) : Main.npc.Count((NPC p) => p != null && p.active && (monster.NPCID == 0 || p.netID == monster.NPCID) && p.whoAmI != npc.whoAmI && npc.WithinRange(p.Center, monster.Range << 4) && (monster.LifeRate == 0 || p.lifeMax < 1 || ((monster.LifeRate > 0) ? (p.life * 100 / p.lifeMax >= monster.LifeRate) : (p.life * 100 / p.lifeMax < Math.Abs(monster.LifeRate)))) && (monster.Indicator == null || (LNpcs![p.whoAmI] != null && LNpcs[p.whoAmI].haveMarkers(monster.Indicator, npc))) && (monster.CheckSign == "" || (LNpcs![p.whoAmI] != null && LNpcs[p.whoAmI].Config != null && LNpcs[p.whoAmI].Config!.Sign == monster.CheckSign)));
num = (monster.Range <= 0) ? Main.npc.Count(p => p != null && p.active && (monster.NPCID == 0 || p.netID == monster.NPCID) && p.whoAmI != Npc.whoAmI && (monster.LifeRate == 0 || p.lifeMax < 1 || ((monster.LifeRate > 0) ? (p.life * 100 / p.lifeMax >= monster.LifeRate) : (p.life * 100 / p.lifeMax < Math.Abs(monster.LifeRate)))) && (monster.Indicator == null || (LNpcs![p.whoAmI] != null && LNpcs[p.whoAmI].haveMarkers(monster.Indicator, Npc))) && (monster.CheckSign == "" || (LNpcs![p.whoAmI] != null && LNpcs[p.whoAmI].Config != null && LNpcs[p.whoAmI].Config!.Sign == monster.CheckSign))) : Main.npc.Count(p => p != null && p.active && (monster.NPCID == 0 || p.netID == monster.NPCID) && p.whoAmI != Npc.whoAmI && Npc.WithinRange(p.Center, monster.Range << 4) && (monster.LifeRate == 0 || p.lifeMax < 1 || ((monster.LifeRate > 0) ? (p.life * 100 / p.lifeMax >= monster.LifeRate) : (p.life * 100 / p.lifeMax < Math.Abs(monster.LifeRate)))) && (monster.Indicator == null || (LNpcs![p.whoAmI] != null && LNpcs[p.whoAmI].haveMarkers(monster.Indicator, Npc))) && (monster.CheckSign == "" || (LNpcs != null && LNpcs[p.whoAmI].Config != null && LNpcs[p.whoAmI].Config!.Sign == monster.CheckSign)));
if (monster.SuitNum == 0)
{
continue;
Expand Down Expand Up @@ -1233,20 +1233,35 @@ public static float StrToFloat(string FloatString, float DefaultFloat = 0f)
}
#endregion

#region 清理弹幕使用记录
public static void clearPrjsOfUse(int useIndex, string notes)
#region 检查弹幕条件是否满足。
public static bool ProjectileRequirement(List<ProjectileConditionGroup> Rmonster, NPC npc)
{
lock (LPrjs!)
var Npc = npc;
var result = false;
foreach (var rmonster in Rmonster)
{
for (var i = 0; i < LPrjs.Count(); i++)
var num = 0;
num = (rmonster.Range <= 0) ? Main.projectile.Count(p => p != null && p.active && p.owner == Main.myPlayer && (rmonster.ProjectileID == 0 || p.type == rmonster.ProjectileID) && (!rmonster.FullProjectile || (LPrjs![p.whoAmI] != null && LPrjs[p.whoAmI].UseI == Npc.whoAmI)) && (rmonster.CheckSign == "" || (LPrjs![p.whoAmI] != null && LPrjs![p.whoAmI].Notes == rmonster.CheckSign))) : Main.projectile.Count(p => p != null && p.active && p.owner == Main.myPlayer && (rmonster.ProjectileID == 0 || p.type == rmonster.ProjectileID) && Npc.WithinRange(p.Center, rmonster.Range << 4) && (!rmonster.FullProjectile || (LPrjs![p.whoAmI] != null && LPrjs[p.whoAmI].UseI == Npc.whoAmI)) && (rmonster.CheckSign == "" || (LPrjs![p.whoAmI] != null && LPrjs[p.whoAmI].Notes == rmonster.CheckSign)));
if (rmonster.SuitNum == 0)
{
continue;
}
if (rmonster.SuitNum > 0)
{
if (LPrjs[i] != null && LPrjs[i].Index >= 0 && LPrjs[i].UseI == useIndex)
if (num < rmonster.SuitNum)
{
LPrjs[i].clear(notes);
result = true;
break;
}
}
else if (num >= Math.Abs(rmonster.SuitNum))
{
result = true;
break;
}
}
}
return result;
}
#endregion

#region 更新弹幕和属性
Expand All @@ -1262,7 +1277,7 @@ public static void updataProjectile(List<ProjUpdateGroup> Projectiles, NPC npc,
var flag = false;
lock (LPrjs!)
{
for (var i = 0; i < LPrjs.Count(); i++)
for (var i = 0; i < LPrjs.Length; i++)
{
if (LPrjs[i] == null || LPrjs[i].Index < 0 || LPrjs[i].Type != Proj.ProjectileID || !(LPrjs[i].Notes == Proj.Sign) || LPrjs[i].UseI != npc.whoAmI)
{
Expand Down Expand Up @@ -1496,10 +1511,23 @@ public static void updataProjectile(List<ProjUpdateGroup> Projectiles, NPC npc,
}
}
}
if (Proj.DestroyProjectile)
if (Proj.Duration == 0)
{
Main.projectile[index].Kill();
}
else if (Proj.Duration > 0)
{
Main.projectile[index].timeLeft = Proj.Duration;
}
if (Proj.DestroyProjectile)
{
Main.projectile[index].active = false;
Main.projectile[index].type = 0;
if (!list.Contains(index))
{
list.Add(index);
}
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/CustomMonster/TimeGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public class TimeGroup : ICloneable
[JsonProperty(PropertyName = "玩家条件")]
public List<PlayerConditionGroup> PlayerCondition = new List<PlayerConditionGroup>();

[JsonProperty(PropertyName = "弹幕条件")]
public List<ProjectileConditionGroup> ProjectileCondition = new List<ProjectileConditionGroup>();

[JsonProperty(PropertyName = "指示物条件")]
public List<IndicatorGroup2> IndicatorConditions = new List<IndicatorGroup2>();

Expand Down
Loading