From 765c89dde608dca4afcc862b3723e3974757b5bb Mon Sep 17 00:00:00 2001 From: milimoe Date: Tue, 4 Feb 2025 23:05:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1=E7=B1=BB?= =?UTF-8?q?=EF=BC=9B=E6=B7=BB=E5=8A=A0=E5=9C=B0=E5=8C=BA=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/System/Quest.cs | 28 ++++++++++++++++--- Entity/System/Region.cs | 48 +++++++++++++++++++++++++++++++++ Library/Constant/ConstantSet.cs | 12 +++++++++ 3 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 Entity/System/Region.cs diff --git a/Entity/System/Quest.cs b/Entity/System/Quest.cs index 3c57a3a..b754f56 100644 --- a/Entity/System/Quest.cs +++ b/Entity/System/Quest.cs @@ -6,13 +6,18 @@ namespace Milimoe.FunGame.Core.Entity public class Quest : BaseEntity { public string Description { get; set; } = ""; - public int EstimatedMinutes { get; set; } = 0; public QuestState Status { get; set; } = 0; - public int CharacterIndex { get; set; } = 0; - public Dictionary Awards { get; set; } = []; + public long CharacterId { get; set; } = 0; + public long RegionId { get; set; } = 0; + public double CreditsAward { get; set; } = 0; + public double MaterialsAward { get; set; } = 0; + public HashSet Awards { get; set; } = []; + public Dictionary AwardsCount { get; set; } = []; + public string AwardsString { get; set; } = ""; public DateTime? StartTime { get; set; } = null; public DateTime? SettleTime { get; set; } = null; public QuestType QuestType { get; set; } = QuestType.Continuous; + public int EstimatedMinutes { get; set; } = 0; public int Progress { get; set; } = 0; public int MaxProgress { get; set; } = 100; @@ -24,6 +29,21 @@ namespace Milimoe.FunGame.Core.Entity progressString = $"\r\n当前进度:{Progress}/{MaxProgress}"; } + List awards = []; + if (CreditsAward > 0) + { + awards.Add($"{General.GameplayEquilibriumConstant.InGameCurrency} * {CreditsAward}"); + } + if (MaterialsAward > 0) + { + awards.Add($"{General.GameplayEquilibriumConstant.InGameMaterial} * {MaterialsAward}"); + } + foreach (Item item in Awards) + { + awards.Add($"[{ItemSet.GetQualityTypeName(item.QualityType)}|{ItemSet.GetItemTypeName(item.ItemType)}] {item.Name} * {AwardsCount[item.Name]}"); + } + AwardsString = string.Join(",", awards); + return $"{Id}. {Name}\r\n" + $"{Description}\r\n" + (QuestType == QuestType.Continuous ? $"需要时间:{EstimatedMinutes} 分钟\r\n" : "") + @@ -32,7 +52,7 @@ namespace Milimoe.FunGame.Core.Entity $"\r\n预计在 {Math.Max(Math.Round((StartTime.Value.AddMinutes(EstimatedMinutes) - DateTime.Now).TotalMinutes, MidpointRounding.ToPositiveInfinity), 1)} 分钟后完成" : "") + "\r\n" : "") + - $"完成奖励:{string.Join(",", Awards.Select(kv => kv.Key + " * " + kv.Value))}\r\n" + + $"完成奖励:{AwardsString}\r\n" + $"任务状态:{GetStatus()}" + progressString + (SettleTime.HasValue ? $"\r\n结算时间:{SettleTime.Value.ToString(General.GeneralDateTimeFormatChinese)}" : ""); } diff --git a/Entity/System/Region.cs b/Entity/System/Region.cs new file mode 100644 index 0000000..59ed028 --- /dev/null +++ b/Entity/System/Region.cs @@ -0,0 +1,48 @@ +using System.Text; +using Milimoe.FunGame.Core.Interface.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Core.Entity +{ + public class Region : BaseEntity + { + public string Description { get; set; } = ""; + public HashSet Organisms { get; } = []; + public HashSet Crops { get; } = []; + public string Weather { get; set; } = ""; + public int Temperature { get; set; } = 15; + public RarityType Difficulty { get; set; } = RarityType.OneStar; + + public override bool Equals(IBaseEntity? other) + { + return other is Region && other.GetIdName() == GetIdName(); + } + + public override string ToString() + { + StringBuilder builder = new(); + + builder.AppendLine($"☆--- {Name} ---☆"); + builder.AppendLine($"编号:{Id}"); + builder.AppendLine($"天气:{Weather}"); + builder.AppendLine($"温度:{Temperature} °C"); + builder.AppendLine($"{Description}"); + + if (Organisms.Count > 0) + { + builder.AppendLine($"== 生物 =="); + builder.AppendLine(string.Join(",", Organisms.Select(o => o.Name))); + } + + if (Organisms.Count > 0) + { + builder.AppendLine($"== 作物 =="); + builder.AppendLine(string.Join(",", Crops.Select(c => c.Name))); + } + + builder.AppendLine($"探索难度:{CharacterSet.GetRarityTypeName(Difficulty)}"); + + return builder.ToString().Trim(); + } + } +} diff --git a/Library/Constant/ConstantSet.cs b/Library/Constant/ConstantSet.cs index 9aa9da5..1e6dcb0 100644 --- a/Library/Constant/ConstantSet.cs +++ b/Library/Constant/ConstantSet.cs @@ -392,6 +392,18 @@ namespace Milimoe.FunGame.Core.Library.Constant _ => "角色现在完全行动不能" }; } + + public static string GetRarityTypeName(RarityType type) + { + return type switch + { + RarityType.TwoStar => "★★", + RarityType.ThreeStar => "★★★", + RarityType.FourStar => "★★★★", + RarityType.FiveStar => "★★★★★", + _ => "★" + }; + } } public class ItemSet