MuharremTozan/Agentic-Duel / .agent/skills/unity-decorator-pattern
unity-decorator-pattern
VerifiedDynamically modify object behavior by wrapping. Perfect for buffs, debuffs, and stat calculations.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 723 B |
| assets/code/Decorator.cs.txt | markdown | 1.7 KB |
| references/guide.md | markdown | 1.7 KB |
assets/code/Decorator.cs.txt
View on GitHubnamespace Standard.Patterns {
/// <summary>
/// Core decorator interface for wrapping and modifying values.
/// </summary>
public interface IDecorator<T> {
T GetValue();
}
/// <summary>
/// Base decorator implementation for numeric stat modifications.
/// Use this for buffs, debuffs, and dynamic stat calculations.
/// </summary>
public abstract class StatDecorator : IDecorator<float> {
protected IDecorator<float> _wrapped;
protected StatDecorator(IDecorator<float> wrapped) {
_wrapped = wrapped;
}
public abstract float GetValue();
}
/// <summary>
/// Concrete base stat (no decoration).
/// </summary>
public class BaseStat : IDecorator<float> {
private float _value;
public BaseStat(float value) {
_value = value;
}
public float GetValue() => _value;
}
/// <summary>
/// Percentage modifier decorator (e.g., +20% damage).
/// </summary>
public class PercentageModifier : StatDecorator {
private float _percentage;
public PercentageModifier(IDecorator<float> wrapped, float percentage) : base(wrapped) {
_percentage = percentage;
}
public override float GetValue() => _wrapped.GetValue() * (1 + _percentage);
}
/// <summary>
/// Flat modifier decorator (e.g., +10 armor).
/// </summary>
public class FlatModifier : StatDecorator {
private float _amount;
public FlatModifier(IDecorator<float> wrapped, float amount) : base(wrapped) {
_amount = amount;
}
public override float GetValue() => _wrapped.GetValue() + _amount;
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |