mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-23 12:39:35 +08:00
更新地区类
This commit is contained in:
parent
5a4c8fe196
commit
ca1247cbf5
@ -7,12 +7,34 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
public class Region : BaseEntity
|
||||
{
|
||||
public string Description { get; set; } = "";
|
||||
public HashSet<Character> Organisms { get; } = [];
|
||||
public string Category { get; set; } = "";
|
||||
public HashSet<Character> Characters { get; } = [];
|
||||
public HashSet<Unit> Units { get; } = [];
|
||||
public HashSet<Item> Crops { get; } = [];
|
||||
public string Weather { get; set; } = "";
|
||||
public int Temperature { get; set; } = 15;
|
||||
public Dictionary<string, int> Weathers { get; } = [];
|
||||
public RarityType Difficulty { get; set; } = RarityType.OneStar;
|
||||
|
||||
public bool ChangeWeather(string weather)
|
||||
{
|
||||
if (Weathers.TryGetValue(weather, out int temperature))
|
||||
{
|
||||
Weather = weather;
|
||||
Temperature = temperature;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ChangeRandomWeather()
|
||||
{
|
||||
if (Weathers.Count == 0) return false;
|
||||
Weather = Weathers.Keys.ElementAt(Random.Shared.Next(Weathers.Count));
|
||||
Temperature = Weathers[Weather];
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Equals(IBaseEntity? other)
|
||||
{
|
||||
return other is Region && other.GetIdName() == GetIdName();
|
||||
@ -28,13 +50,19 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
builder.AppendLine($"温度:{Temperature} °C");
|
||||
builder.AppendLine($"{Description}");
|
||||
|
||||
if (Organisms.Count > 0)
|
||||
if (Characters.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 生物 ==");
|
||||
builder.AppendLine(string.Join(",", Organisms.Select(o => o.Name)));
|
||||
builder.AppendLine($"== 头目 ==");
|
||||
builder.AppendLine(string.Join(",", Characters.Select(o => o.Name)));
|
||||
}
|
||||
|
||||
if (Organisms.Count > 0)
|
||||
if (Units.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 生物 ==");
|
||||
builder.AppendLine(string.Join(",", Units.Select(o => o.Name)));
|
||||
}
|
||||
|
||||
if (Crops.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 作物 ==");
|
||||
builder.AppendLine(string.Join(",", Crops.Select(c => c.Name)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user