diff --git a/src/CustomMonster/Configuration.cs b/src/CustomMonster/Configuration.cs index b4b1ea71d..8d59c2fec 100644 --- a/src/CustomMonster/Configuration.cs +++ b/src/CustomMonster/Configuration.cs @@ -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; diff --git a/src/CustomMonster/CustomMonster.cs b/src/CustomMonster/CustomMonster.cs index 313c2b983..8f7bc0b80 100644 --- a/src/CustomMonster/CustomMonster.cs +++ b/src/CustomMonster/CustomMonster.cs @@ -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); #endregion #region 全局变量 @@ -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; } diff --git a/src/CustomMonster/CustomMonster.json b/src/CustomMonster/CustomMonster.json index 883cdfde6..1d2a55b78 100644 --- a/src/CustomMonster/CustomMonster.json +++ b/src/CustomMonster/CustomMonster.json @@ -6,7 +6,7 @@ "控制台广告": false, "配置说明": "版本①;难度直线提升,怪物最低3个人血量,几乎全Boss加强!", "启动错误报告": false, - "配置文件插件版本号": "1.0.4.38", + "配置文件插件版本号": "1.0.4.39", "启动死亡队友视角": false, "队友视角仅BOSS时": false, "队友视角流畅度": -1, diff --git a/src/CustomMonster/LNPC.cs b/src/CustomMonster/LNPC.cs index 09077fc0c..b026a1ed7 100644 --- a/src/CustomMonster/LNPC.cs +++ b/src/CustomMonster/LNPC.cs @@ -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)); @@ -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) @@ -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; @@ -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) { diff --git a/src/CustomMonster/LPrj.cs b/src/CustomMonster/LPrj.cs index 81c3f877b..97fe36afb 100644 --- a/src/CustomMonster/LPrj.cs +++ b/src/CustomMonster/LPrj.cs @@ -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 } diff --git a/src/CustomMonster/PlayerConditionGroup.cs b/src/CustomMonster/PlayerConditionGroup.cs index c84cee033..911674d0a 100644 --- a/src/CustomMonster/PlayerConditionGroup.cs +++ b/src/CustomMonster/PlayerConditionGroup.cs @@ -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; diff --git a/src/CustomMonster/ProjUpdateGroup.cs b/src/CustomMonster/ProjUpdateGroup.cs index e068a7e5a..1f3a1f614 100644 --- a/src/CustomMonster/ProjUpdateGroup.cs +++ b/src/CustomMonster/ProjUpdateGroup.cs @@ -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) diff --git a/src/CustomMonster/ProjectileConditionGroup.cs b/src/CustomMonster/ProjectileConditionGroup.cs new file mode 100644 index 000000000..082f0f97c --- /dev/null +++ b/src/CustomMonster/ProjectileConditionGroup.cs @@ -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 = ""; + } +} diff --git a/src/CustomMonster/README.en-US.md b/src/CustomMonster/README.en-US.md index 4e2ab1e3c..77f02328b 100644 --- a/src/CustomMonster/README.en-US.md +++ b/src/CustomMonster/README.en-US.md @@ -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 diff --git a/src/CustomMonster/README.md b/src/CustomMonster/README.md index c2da97678..50714d483 100644 --- a/src/CustomMonster/README.md +++ b/src/CustomMonster/README.md @@ -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 diff --git a/src/CustomMonster/Sundry.cs b/src/CustomMonster/Sundry.cs index eb796d806..675aa3fa1 100644 --- a/src/CustomMonster/Sundry.cs +++ b/src/CustomMonster/Sundry.cs @@ -1172,7 +1172,7 @@ public static bool PlayerRequirement(List 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; @@ -1203,7 +1203,7 @@ public static bool MonsterRequirement(List 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; @@ -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 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 更新弹幕和属性 @@ -1262,7 +1277,7 @@ public static void updataProjectile(List 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) { @@ -1496,10 +1511,23 @@ public static void updataProjectile(List 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); + } + } } } } diff --git a/src/CustomMonster/TimeGroup.cs b/src/CustomMonster/TimeGroup.cs index 1d6bae11e..7315a0f79 100644 --- a/src/CustomMonster/TimeGroup.cs +++ b/src/CustomMonster/TimeGroup.cs @@ -103,6 +103,9 @@ public class TimeGroup : ICloneable [JsonProperty(PropertyName = "玩家条件")] public List PlayerCondition = new List(); + [JsonProperty(PropertyName = "弹幕条件")] + public List ProjectileCondition = new List(); + [JsonProperty(PropertyName = "指示物条件")] public List IndicatorConditions = new List();