SkillType - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Skills

SkillType Class

A skill is an ability that a Person can have which influences their behavior in some way.
The SkillType class contains underlying data for a Skill instance, like its name and maximum level.

public class SkillType

Inheritance System.Object 🡒 SkillType

Constructors

SkillType.SkillType(string, TextureRegion, int, SkillCategory) Constructor

Creates a new skill type with the given settings

public SkillType(string name, MLEM.Textures.TextureRegion texture, int maxLevel, TinyLife.Skills.SkillCategory categories);

Parameters

name System.String
The skill's name

texture MLEM.Textures.TextureRegion
The skill's icon

maxLevel System.Int32
The skill's maximum level. Should be 5 or 10 for consistency.

categories SkillCategory
A combined flag of categories that this skill has

Fields

SkillType.Categories Field

The SkillCategory combined flag that this skill type has.
The skill categories it has are used to determine skill gain from things like the TinyLife.PersonalityType.Creative personality type.

public readonly SkillCategory Categories;

Field Value

SkillCategory

SkillType.MaxLevel Field

The maximum level that this skill can reach.
Most skills should default to 5 or 10 for consistency.

public readonly int MaxLevel;

Field Value

System.Int32

SkillType.Name Field

The name of this skill type

public readonly string Name;

Field Value

System.String

SkillType.Texture Field

The texture region of this skill type's icon

public readonly TextureRegion Texture;

Field Value

MLEM.Textures.TextureRegion

SkillType.Types Field

A registry of all skill types that exist in the game and mods.
Use Register(SkillType) to register custom skill types.

public static readonly IDictionary<string,SkillType> Types;

Field Value

System.Collections.Generic.IDictionary<System.String,SkillType>

Methods

SkillType.GetRandomQuality(Person, Random, bool, bool) Method

Returns a semi-randomly generated Quality for the given Person based on their level of this skill.
The higher the skill level is, the more likely it is for higher qualities to be returned.

public TinyLife.Skills.Quality GetRandomQuality(TinyLife.Objects.Person person, System.Random random, bool modifyEmotions=true, bool alwaysAllowAverage=false);

Parameters

person Person
The person that has this skill

random System.Random
The random that should be used for calculation

modifyEmotions System.Boolean
Whether the given person should receive emotions based on the quality, defaults to true

alwaysAllowAverage System.Boolean
Whether or not Average should always be part of the random choice, defaults to false

Returns

Quality
A random quality based on the person's skill level

SkillType.Register(SkillType) Method

Registers a new SkillType to the Types registry

public static TinyLife.Skills.SkillType Register(TinyLife.Skills.SkillType type);

Parameters

type SkillType
The type to register

Returns

SkillType
The registered type, for chaining