Skip to content

Instantly share code, notes, and snippets.

@zaafar
Last active March 4, 2022 16:58
Show Gist options
  • Save zaafar/6b4e49e97781368111c73c137b0d3fc8 to your computer and use it in GitHub Desktop.
Save zaafar/6b4e49e97781368111c73c137b0d3fc8 to your computer and use it in GitHub Desktop.
Dynamic Condition Interfaces
/// <summary>
/// The structure that can be queried using DynamicCondition
/// </summary>
public interface IDynamicConditionState
{
/// <summary>
/// The ailment list
/// </summary>
IReadOnlyCollection<string> Ailments { get; }
/// <summary>
/// The current animation
/// </summary>
Animation Animation { get; }
/// <summary>
/// The buff list
/// </summary>
IBuffDictionary Buffs { get; }
/// <summary>
/// The flask information
/// </summary>
IFlasksInfo Flasks { get; }
/// <summary>
/// The vitals information
/// </summary>
IVitalsInfo Vitals { get; }
/// <summary>
/// Number of friendly nearby monsters
/// </summary>
int FriendlyMonsterCount { get; }
/// <summary>
/// Calculates the number of nearby monsters given a rarity selector
/// </summary>
/// <param name="rarity">The rarity selector for monster search</param>
/// <returns></returns>
int MonsterCount(MonsterRarity rarity);
}
/// <summary>
/// Describes a set of buffs applied to the player
/// </summary>
public interface IBuffDictionary
{
/// <summary>
/// Returns a buff description
/// </summary>
/// <param name="id">The buff id</param>
IStatusEffect this[string id] { get; }
/// <summary>
/// Checks whether the buff is present
/// </summary>
bool Has(string id);
}
/// <summary>
/// The structure describing a flask state
/// </summary>
public interface IFlaskInfo
{
/// <summary>
/// Whether the flask effect is active now
/// </summary>
bool Active { get; init; }
/// <summary>
/// Current charge amount of a flask
/// </summary>
int Charges { get; init; }
}
/// <summary>
/// Information about a set of flasks
/// </summary>
public interface IFlasksInfo
{
/// <summary>
/// Provides access to the flask array
/// </summary>
/// <param name="i">The flask index (0-based)</param>
IFlaskInfo this[int i] { get; }
/// <summary>
/// The flask in the first slot;
/// </summary>
IFlaskInfo Flask1 { get; }
/// <summary>
/// The flask in the second slot;
/// </summary>
IFlaskInfo Flask2 { get; }
/// <summary>
/// The flask in the third slot;
/// </summary>
IFlaskInfo Flask3 { get; }
/// <summary>
/// The flask in the fourth slot;
/// </summary>
IFlaskInfo Flask4 { get; }
/// <summary>
/// The flask in the fifth slot;
/// </summary>
IFlaskInfo Flask5 { get; }
}
/// <summary>
/// Information about a status effect
/// </summary>
public interface IStatusEffect
{
/// <summary>
/// Amount of stacks of the effect
/// </summary>
int Charges { get; init; }
/// <summary>
/// Whether it exists on the player currently
/// </summary>
bool Exists { get; init; }
/// <summary>
/// Time left in percent from total time
/// </summary>
double PercentTimeLeft { get; }
/// <summary>
/// Time left in seconds
/// </summary>
double TimeLeft { get; init; }
/// <summary>
/// Total time the effect will last
/// </summary>
double TotalTime { get; init; }
}
/// <summary>
/// Information about a vital
/// </summary>
public interface IVital
{
/// <summary>
/// Current value
/// </summary>
double Current { get; }
/// <summary>
/// Maximum value
/// </summary>
double Max { get; }
/// <summary>
/// Value in percent from the max
/// </summary>
double Percent { get; }
}
/// <summary>
/// Information about player vitals
/// </summary>
public interface IVitalsInfo
{
/// <summary>
/// Energy shield information
/// </summary>
IVital ES { get; }
/// <summary>
/// Health information
/// </summary>
IVital HP { get; }
/// <summary>
/// Mana information
/// </summary>
IVital Mana { get; }
}
[Flags]
public enum MonsterRarity
{
Normal = 1 << 0,
Magic = 1 << 1,
Rare = 1 << 2,
Unique = 1 << 3,
Any = Normal | Magic | Rare | Unique,
AtLeastRare = Rare | Unique
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment