public static void StatusEffects_RemoveTrait(Trait __state) { CustomTrait trait = __state?.GetHook <CustomTrait>(); if (__state != null && RogueFramework.IsDebugEnabled(DebugFlags.Traits)) { RogueFramework.LogDebug($"Removing trait {trait} ({__state.traitName}, {__state.GetStatusEffects().agent.agentName})."); } trait?.OnRemoved(); }
/// <summary> /// <para>Creates a new <see cref="CustomTrait"/> with the specified <paramref name="id"/>, <paramref name="name"/> and <paramref name="description"/>.</para> /// </summary> public static CustomTrait CreateCustomTrait(string id, bool unlockedFromStart, CustomNameInfo name, CustomNameInfo description) { CustomTrait customTrait = GetCustomTrait(id); if (customTrait != null) { string message = string.Concat("A CustomTrait with Id \"", id, "\" already exists!"); Logger.LogError(message); throw new ArgumentException(message, nameof(id)); } CustomTraits.Add(customTrait = new CustomTrait(id, CreateCustomName(id, "StatusEffect", name), CreateCustomName(id, "Description", description) )); customTrait.Unlocked = unlockedFromStart; PluginInstance.Setup(customTrait); Logger.LogDebug(string.Concat("A CustomTrait with Id \"", id, "\" was created.")); return(customTrait); }