Skip to content

MuharremTozan/Agentic-Duel / .agent/skills/unity-decorator-pattern

unity-decorator-pattern

Verified

Dynamically modify object behavior by wrapping. Perfect for buffs, debuffs, and stat calculations.

FileKindSize
SKILL.mdskill md723 B
assets/code/Decorator.cs.txtmarkdown1.7 KB
references/guide.mdmarkdown1.7 KB

assets/code/Decorator.cs.txt

View on GitHub
namespace 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;
    }
}
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall