Skip to content

Commit

Permalink
Fix attributes of th12.3 chara-related enums
Browse files Browse the repository at this point in the history
  • Loading branch information
y-iihoshi committed Jan 5, 2025
1 parent 54b9e52 commit b2b5cd4
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 78 deletions.
40 changes: 8 additions & 32 deletions TemplateGenerator/Models/Th123/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,6 @@ namespace TemplateGenerator.Models.Th123;

public class Definitions : Th105.Definitions
{
private static readonly IEnumerable<(Chara, string, string)> CharacterNamesImpl =
[
(Chara.Reimu, "霊夢", "博麗 霊夢"),
(Chara.Marisa, "魔理沙", "霧雨 魔理沙"),
(Chara.Sakuya, "咲夜", "十六夜 咲夜"),
(Chara.Alice, "アリス", "アリス・マーガトロイド"),
(Chara.Patchouli, "パチュリー", "パチュリー・ノーレッジ"),
(Chara.Youmu, "妖夢", "魂魄 妖夢"),
(Chara.Remilia, "レミリア", "レミリア・スカーレット"),
(Chara.Yuyuko, "幽々子", "西行寺 幽々子"),
(Chara.Yukari, "紫", "八雲 紫"),
(Chara.Suika, "萃香", "伊吹 萃香"),
(Chara.Reisen, "鈴仙", "鈴仙・優曇華院・イナバ"),
(Chara.Aya, "文", "射命丸 文"),
(Chara.Komachi, "小町", "小野塚 小町"),
(Chara.Iku, "衣玖", "永江 衣玖"),
(Chara.Tenshi, "天子", "比那名居 天子"),
(Chara.Sanae, "早苗", "東風谷 早苗"),
(Chara.Cirno, "チルノ", "チルノ"),
(Chara.Meiling, "美鈴", "紅 美鈴"),
(Chara.Utsuho, "空", "霊烏路 空"),
(Chara.Suwako, "諏訪子", "洩矢 諏訪子"),
];

private static readonly IEnumerable<(Chara, CardType, int)> NumCardsPerCharacterAndTypeImpl =
EnumHelper.Cartesian<Chara, CardType>().Select(
static pair => (pair.First, pair.Second, pair.Second == CardType.System
Expand All @@ -45,23 +21,23 @@ public class Definitions : Th105.Definitions
public static new string Title { get; } = StringResources.TH123;

public static new IReadOnlyDictionary<string, (string Id, string ShortName, string LongName)> CharacterNames { get; } =
CharacterNamesImpl.ToDictionary(
static tuple => tuple.Item1.ToShortName(),
static tuple => (tuple.Item1.ToString(), tuple.Item2, tuple.Item3));
EnumHelper<Chara>.Enumerable.Where(static chara => chara != Chara.Catfish).ToDictionary(
static chara => chara.ToPattern(),
static chara => (chara.ToString(), chara.ToCharaName(), chara.ToCharaFullName()));

public static IReadOnlyDictionary<string, (string Id, string ShortName, string LongName)> StoryCharacterNames { get; } =
CharacterNamesImpl.Where(static tuple => HasStory(tuple.Item1)).ToDictionary(
static tuple => tuple.Item1.ToShortName(),
static tuple => (tuple.Item1.ToString(), tuple.Item2, tuple.Item3));
EnumHelper<Chara>.Enumerable.Where(static chara => HasStory(chara)).ToDictionary(
static chara => chara.ToPattern(),
static chara => (chara.ToString(), chara.ToCharaName(), chara.ToCharaFullName()));

public static new IReadOnlyDictionary<string, int> NumCardsPerCharacter { get; } =
StageInfoTable.ToDictionary(
static pair => pair.Key.ToShortName(),
static pair => pair.Key.ToPattern(),
static pair => pair.Value.Sum(static stageInfo => stageInfo.CardIds.Count()) * EnumHelper<Level>.NumValues);

public static new IReadOnlyDictionary<(string Chara, string CardType), int> NumCardsPerCharacterAndType { get; } =
NumCardsPerCharacterAndTypeImpl.ToDictionary(
static tuple => (tuple.Item1.ToShortName(), tuple.Item2.ToPattern()),
static tuple => (tuple.Item1.ToPattern(), tuple.Item2.ToPattern()),
static tuple => tuple.Item3);

public static new IReadOnlyDictionary<string, int> MaxNumCardsPerType { get; } =
Expand Down
63 changes: 42 additions & 21 deletions ThScoreFileConverter.Core/Models/Th123/Chara.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,126 +17,147 @@ public enum Chara
/// <summary>
/// Hakurei Reimu.
/// </summary>
[EnumAltName("RM")]
[Pattern("RM")]
[Character(nameof(Reimu))]
Reimu,

/// <summary>
/// Kirisame Marisa.
/// </summary>
[EnumAltName("MR")]
[Pattern("MR")]
[Character(nameof(Marisa))]
Marisa,

/// <summary>
/// Izayoi Sakuya.
/// </summary>
[EnumAltName("SK")]
[Pattern("SK")]
[Character(nameof(Sakuya))]
Sakuya,

/// <summary>
/// Alice Margatroid.
/// </summary>
[EnumAltName("AL")]
[Pattern("AL")]
[Character(nameof(Alice))]
Alice,

/// <summary>
/// Patchouli Knowledge.
/// </summary>
[EnumAltName("PC")]
[Pattern("PC")]
[Character(nameof(Patchouli))]
Patchouli,

/// <summary>
/// Konpaku Youmu.
/// </summary>
[EnumAltName("YM")]
[Pattern("YM")]
[Character(nameof(Youmu))]
Youmu,

/// <summary>
/// Remilia Scarlet.
/// </summary>
[EnumAltName("RL")]
[Pattern("RL")]
[Character(nameof(Remilia))]
Remilia,

/// <summary>
/// Saigyouji Yuyuko.
/// </summary>
[EnumAltName("YU")]
[Pattern("YU")]
[Character(nameof(Yuyuko))]
Yuyuko,

/// <summary>
/// Yakumo Yukari.
/// </summary>
[EnumAltName("YK")]
[Pattern("YK")]
[Character(nameof(Yukari))]
Yukari,

/// <summary>
/// Ibuki Suika.
/// </summary>
[EnumAltName("SU")]
[Pattern("SU")]
[Character(nameof(Suika))]
Suika,

/// <summary>
/// Reisen Udongein Inaba.
/// </summary>
[EnumAltName("RS")]
[Pattern("RS")]
[Character(nameof(Reisen))]
Reisen,

/// <summary>
/// Shameimaru Aya.
/// </summary>
[EnumAltName("AY")]
[Pattern("AY")]
[Character(nameof(Aya))]
Aya,

/// <summary>
/// Onozuka Komachi.
/// </summary>
[EnumAltName("KM")]
[Pattern("KM")]
[Character(nameof(Komachi))]
Komachi,

/// <summary>
/// Nagae Iku.
/// </summary>
[EnumAltName("IK")]
[Pattern("IK")]
[Character(nameof(Iku))]
Iku,

/// <summary>
/// Hinanawi Tenshi.
/// </summary>
[EnumAltName("TN")]
[Pattern("TN")]
[Character(nameof(Tenshi))]
Tenshi,

/// <summary>
/// Kochiya Sanae.
/// </summary>
[EnumAltName("SN")]
[Pattern("SN")]
[Character(nameof(Sanae))]
Sanae,

/// <summary>
/// Cirno.
/// </summary>
[EnumAltName("CI")]
[Pattern("CI")]
[Character(nameof(Cirno))]
Cirno,

/// <summary>
/// Hong Meiling.
/// </summary>
[EnumAltName("ML")]
[Pattern("ML")]
[Character(nameof(Meiling))]
Meiling,

/// <summary>
/// Reiuji Utsuho.
/// </summary>
[EnumAltName("UT")]
[Pattern("UT")]
[Character(nameof(Utsuho))]
Utsuho,

/// <summary>
/// Moriya Suwako.
/// </summary>
[EnumAltName("SW")]
[Pattern("SW")]
[Character(nameof(Suwako))]
Suwako,

/// <summary>
/// Giant Catfish; Oonamazu.
/// </summary>
[EnumAltName("NM")]
[Pattern("NM")]
[Character(nameof(Catfish))]
Catfish = 0x15,
}
Loading

0 comments on commit b2b5cd4

Please sign in to comment.