Game/Catalog.cs
using System;
public enum GearSlot { Helm, Chest, Shoulders, Gauntlets, Thighs, Greaves, Boots, Shield }
public enum Enchant { None, Bleed, Poison, Death, Freeze }
public enum Spell { Fireball, Lightning, Freeze, Heal, Drain, Tremor }
public enum Potion { Health, Energy, Magicka }
/// <summary>Src = the S&S2 picture (resources/sad/ss/item/Src.png).</summary>
public record WeaponDef( int Id, int Src, string Name, int Min, int Max, int Strength, int Price );
public record GearDef( GearSlot Slot, int Index, int Src, string Name, int Level, int Points, int Price );
public record RaceDef( string Name, string[] Skins );
public record SpellDef( Spell Id, string Name, int Cost, int MinMagicka, int Price, string Icon, string Help );
public static class Catalog
{
public const string Art = "resources/sad/";
public static WeaponDef[] Weapons => GearData.Weapons;
public static GearDef[] Gear( GearSlot slot ) => GearData.Gear[(int)slot];
public static GearDef GearItem( GearSlot slot, int index ) => index >= 0 && index < Gear( slot ).Length ? Gear( slot )[index] : null;
public static readonly GearSlot[] Slots = Enum.GetValues<GearSlot>();
public static string ItemArt( int src ) => $"{Art}ss/item/{src}.png";
public static string SlotName( GearSlot s ) => s switch
{
GearSlot.Helm => "helmets",
GearSlot.Chest => "chest",
GearSlot.Shoulders => "shoulders",
GearSlot.Gauntlets => "gauntlets",
GearSlot.Thighs => "thighs",
GearSlot.Greaves => "greaves",
GearSlot.Boots => "boots",
_ => "shields"
};
public static readonly RaceDef[] Races =
{
new( "Human", new[] { "#f6c8a0", "#e8b088", "#c8925e", "#9a6a44", "#6a4630", "#fde2cc" } ),
new( "Elf", new[] { "#fde8d6", "#f4d6ba", "#e8dcf0", "#dcc8a8" } ),
new( "Orc", new[] { "#86ba52", "#64944a", "#98a868", "#5a8a64" } ),
new( "Devil", new[] { "#e0403a", "#b82a34", "#ee6a54", "#9a2a5a" } ),
new( "Undead", new[] { "#b4c4b4", "#a8b4cc", "#ccd4bc", "#98a898" } ),
};
public static int HairCount => GearData.HairCount;
public static int BeardCount => GearData.BeardCount;
public static readonly string[] HairColours = { "#2a2a2a", "#4a2c14", "#7a4a1e", "#b07032", "#d04a24", "#f0d070", "#f8f8f8", "#9a9a9a", "#4a7ae0", "#36ac52", "#b04ae0", "#ec5a98" };
public static readonly string[] ClothColours = { "#e02a2a", "#3a6ad8", "#36a844", "#f0c048", "#8a46de", "#2a2a2a", "#f6f6f6", "#ea8a34" };
// ---------------- magic ----------------
public static readonly SpellDef[] Spells =
{
new( Spell.Fireball, "Fireball", 15, 1, 150, "13", "Hurls a ball of fire. Damage grows with magicka." ),
new( Spell.Heal, "Heal", 20, 1, 200, "102", "Heals your wounds (in a duel it mends your armour)." ),
new( Spell.Freeze, "Freeze", 20, 3, 450, "137", "Freezes your opponent solid - they lose their next turn." ),
new( Spell.Tremor, "Tremor", 22, 4, 600, "114", "Shakes the ground and smashes armour to pieces." ),
new( Spell.Drain, "Drain Life", 25, 5, 900, "145", "Steals life from your opponent and gives it to you." ),
new( Spell.Lightning, "Lightning", 32, 8, 1500, "86", "A huge bolt from the sky. Very hard to survive." ),
};
public static SpellDef SpellInfo( Spell s ) => Spells.First( x => x.Id == s );
public static int PotionPrice( Potion p ) => p switch { Potion.Health => 60, Potion.Energy => 40, _ => 50 };
public static string PotionName( Potion p ) => p switch { Potion.Health => "Health Potion", Potion.Energy => "Energy Potion", _ => "Magicka Potion" };
public static string PotionArt( Potion p ) => p switch { Potion.Health => "ss/item/65.png", Potion.Energy => "ss/item/73.png", _ => "ss/item/69.png" };
public static string PotionHelp( Potion p ) => p switch
{
Potion.Health => "Drink in a fight to get back 35% of your health (in a duel: mends 35% of your armour).",
Potion.Energy => "Drink in a fight to get back 40 energy.",
_ => "Drink in a fight to get back 30 magicka."
};
public static string EnchantColour( Enchant e ) => e switch
{
Enchant.Bleed => "#ff4a4a",
Enchant.Poison => "#6aff4a",
Enchant.Death => "#d8d0ff",
Enchant.Freeze => "#7fd0ff",
_ => "#ffffff"
};
public static (int Min, int Max) EnchantRange( int tier ) => tier switch
{
1 => (4, 8),
2 => (9, 13),
3 => (14, 18),
_ => (0, 0)
};
public static int EnchantPrice( int tier ) => tier switch { 1 => 300, 2 => 900, 3 => 2000, _ => 0 };
public static string EnchantTierName( int tier ) => tier switch { 1 => "Weak", 2 => "Strong", 3 => "Mighty", _ => "" };
public static string EnchantIcon( Enchant e ) => e switch { Enchant.Bleed => "1121", Enchant.Poison => "145", Enchant.Death => "141", _ => "137" };
// ---------------- stats ----------------
public static int MaxHealth( int vitality ) => 50 + vitality * 10;
public static int MaxEnergy( int stamina ) => 40 + stamina * 10;
public static int MaxMagicka( int magicka ) => 10 + magicka * 10;
public static int Discount( int price, int charisma ) => (int)(price * (1f - Math.Min( 0.2f, charisma * 0.01f )));
/// <summary>Duels to win as a slave before the real arena opens.</summary>
public const int DuelsToFreedom = 3;
public static readonly string[] EnemyNames =
{
"Gorvak the Grim", "Lucius Ironhand", "Varro the Bold", "Titus Crane", "Mordo Skullsplitter", "Cassius Vane", "Brakka", "Old Septimus",
"Hrothgar Bonecrusher", "Silent Decimus", "Ulfar Redbeard", "Marcus the Mad", "Grimtusk", "Aulus Vex", "Kragg", "Nero Ashborn",
"Belisar", "The Pale Twins", "Draven Hollowsong", "Severus Thorn", "Zug Zug", "Fausta the Fierce", "Malakor", "Rufus Blackwater"
};
public static readonly string[] PrisonerNames =
{
"Smelly Bob", "Grubb", "Toothless Tam", "Wretched Ollo", "Pip the Thief", "Mad Mungo", "Little Bran", "Old Fennick",
"Slop", "Nervous Ned", "Crooked Kel", "Wheezy Will", "Gristle", "Dirty Dunstan", "Rat-Eye Rolo", "Bald Benedict"
};
public static readonly string[] PrisonerTitles = { "Fearful prisoner", "Starving prisoner", "Desperate prisoner", "Angry prisoner", "Crazed prisoner" };
}