mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2026-01-19 14:08:22 +00:00
物品添加分类和标签属性;修复AI自动化死循环问题;活动和任务系统改进
This commit is contained in:
parent
82d8f927fe
commit
11afb4dc95
@ -86,16 +86,18 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
if (Status != newState)
|
||||
{
|
||||
Status = newState;
|
||||
}
|
||||
|
||||
foreach (Quest quest in Quests)
|
||||
{
|
||||
if (newState == ActivityState.InProgress)
|
||||
if (Status == ActivityState.InProgress)
|
||||
{
|
||||
if (quest.Status == QuestState.NotStarted && quest.QuestType == QuestType.Progressive)
|
||||
{
|
||||
quest.Status = QuestState.InProgress;
|
||||
}
|
||||
}
|
||||
else if (newState == ActivityState.Ended)
|
||||
else if (Status == ActivityState.Ended)
|
||||
{
|
||||
if (quest.Status == QuestState.NotStarted || quest.Status == QuestState.InProgress)
|
||||
{
|
||||
@ -104,7 +106,6 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool AllowUserAccess(long userId, long questId = 0)
|
||||
{
|
||||
@ -149,15 +150,23 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
UserGetActivityInfo?.Invoke(args);
|
||||
}
|
||||
|
||||
public string ToString(bool showQuests)
|
||||
public string ToString(bool showQuests, bool isSubActivity = false)
|
||||
{
|
||||
UpdateState();
|
||||
StringBuilder builder = new();
|
||||
|
||||
if (!isSubActivity)
|
||||
{
|
||||
builder.AppendLine($"☆--- {Name} ---☆");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine($"==[ {Name} ]==");
|
||||
}
|
||||
|
||||
builder.AppendLine($"{Description}");
|
||||
builder.AppendLine($"活动状态:{CommonSet.GetActivityStatus(Status)}");
|
||||
builder.AppendLine(GetTimeString());
|
||||
builder.AppendLine(GetTimeString(!isSubActivity));
|
||||
|
||||
if (showQuests && Quests.Count > 0)
|
||||
{
|
||||
|
||||
@ -7,6 +7,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public string Description { get; set; } = "";
|
||||
public QuestState Status { get; set; } = QuestState.NotStarted;
|
||||
public bool Global { get; set; } = false;
|
||||
public long CharacterId { get; set; } = 0;
|
||||
public long RegionId { get; set; } = 0;
|
||||
public string NeedyExploreCharacterName { get; set; } = "";
|
||||
|
||||
@ -32,6 +32,16 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// </summary>
|
||||
public virtual string BackgroundStory { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 物品的分类
|
||||
/// </summary>
|
||||
public virtual string Category { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 物品的标签
|
||||
/// </summary>
|
||||
public virtual List<string> Tags { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 物品类型
|
||||
/// </summary>
|
||||
@ -448,6 +458,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
if (itemtype != "") itemtype = $" {itemtype}";
|
||||
|
||||
builder.AppendLine($"{itemquality + itemtype}");
|
||||
if (!string.IsNullOrWhiteSpace(Category)) builder.AppendLine(Category);
|
||||
|
||||
if (isShowInStore && Price > 0)
|
||||
{
|
||||
@ -593,6 +604,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
if (sellandtrade.Count > 0) builder.AppendLine(string.Join(" ", sellandtrade).Trim());
|
||||
if (Description != "") builder.AppendLine($"{Description}");
|
||||
if (IsEquipment && Character != null) builder.AppendLine($"装备于:{Character.ToStringWithLevelWithOutUser()}");
|
||||
if (Tags.Count > 0) builder.AppendLine($"标签:{string.Join(",", Tags)}");
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
|
||||
@ -35,6 +35,16 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
case nameof(Item.BackgroundStory):
|
||||
result.BackgroundStory = reader.GetString() ?? "";
|
||||
break;
|
||||
case nameof(Item.Category):
|
||||
result.Category = reader.GetString() ?? "";
|
||||
break;
|
||||
case nameof(Item.Tags):
|
||||
string[] tags = NetworkUtility.JsonDeserialize<string[]>(ref reader, options) ?? [];
|
||||
foreach (string tag in tags)
|
||||
{
|
||||
result.Tags.Add(tag);
|
||||
}
|
||||
break;
|
||||
case nameof(Item.ItemType):
|
||||
result.ItemType = (ItemType)reader.GetInt32();
|
||||
break;
|
||||
@ -129,6 +139,9 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
writer.WriteString(nameof(Item.Description), value.Description);
|
||||
writer.WriteString(nameof(Item.GeneralDescription), value.GeneralDescription);
|
||||
writer.WriteString(nameof(Item.BackgroundStory), value.BackgroundStory);
|
||||
writer.WriteString(nameof(Item.Category), value.Category);
|
||||
writer.WritePropertyName(nameof(Item.Tags));
|
||||
JsonSerializer.Serialize(writer, value.Tags, options);
|
||||
writer.WriteNumber(nameof(Item.ItemType), (int)value.ItemType);
|
||||
writer.WriteNumber(nameof(Item.WeaponType), (int)value.WeaponType);
|
||||
writer.WriteNumber(nameof(Item.EquipSlotType), (int)value.EquipSlotType);
|
||||
|
||||
@ -32,6 +32,9 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
case nameof(Quest.Status):
|
||||
result.Status = (QuestState)reader.GetInt32();
|
||||
break;
|
||||
case nameof(Quest.Global):
|
||||
result.Global = reader.GetBoolean();
|
||||
break;
|
||||
case nameof(Quest.CharacterId):
|
||||
result.CharacterId = reader.GetInt64();
|
||||
break;
|
||||
@ -109,6 +112,7 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
writer.WriteString(nameof(Quest.Name), value.Name);
|
||||
writer.WriteString(nameof(Quest.Description), value.Description);
|
||||
writer.WriteNumber(nameof(Quest.Status), (int)value.Status);
|
||||
writer.WriteBoolean(nameof(Quest.Global), value.Global);
|
||||
writer.WriteNumber(nameof(Quest.CharacterId), value.CharacterId);
|
||||
writer.WriteNumber(nameof(Quest.RegionId), value.RegionId);
|
||||
writer.WriteString(nameof(Quest.NeedyExploreCharacterName), value.NeedyExploreCharacterName);
|
||||
|
||||
@ -1486,6 +1486,12 @@ namespace Milimoe.FunGame.Core.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (!decided && (isAI || cancelTimes == 0))
|
||||
{
|
||||
baseTime += 5;
|
||||
type = CharacterActionType.EndTurn;
|
||||
}
|
||||
|
||||
if (type == CharacterActionType.None)
|
||||
{
|
||||
WriteLine($"[ {character} ] 放弃了行动!");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user