Exemplo n.º 1
0
        private DeltaMode Mode; // WHETHER TO ADD OR REMOVE THE CARD IN QUESITON

        public CardListDelta(T list, Card c, int i, DeltaMode m)
            : base(list)
        {
            SendableCard = new SendableTarget <Card>("card", c); // TODO: shouldn't have to know what to name this...
            Index        = i;
            Mode         = m;
        }
Exemplo n.º 2
0
        public UnitAbilityDelta(Unit target, Unit source, Ability a, DeltaMode m, GameManager gm)
            : base(target, source)
        {
            //Console.WriteLine($"UnitAbilityDelta Constructor Target Null: {Target == null}");
            //Console.WriteLine($"UnitAbilityDelta Constructor Source Null: {Source == null}");

            Ability     = a;
            Mode        = m;
            GameManager = gm;
        }
Exemplo n.º 3
0
        public DeltaCommand(CacheItem item, DeltaMode mode, ulong delta)
        {
            Condition.Requires(item).IsNotNull(
                "When executing increment/decrement command, cache item should be specified.");
            Condition.Requires(mode).IsNotEqualTo(DeltaMode.None,
                "When executing increment/decrement command against item '{0}', delta mode should be specified."
                    .FormatString(item));

            _item = item;
            _deltaMode = mode;
            _delta = delta;
        }
Exemplo n.º 4
0
        public DeltaCommand(CacheItem item, DeltaMode mode, ulong delta)
        {
            Condition.Requires(item).IsNotNull(
                "When executing increment/decrement command, cache item should be specified.");
            Condition.Requires(mode).IsNotEqualTo(DeltaMode.None,
                                                  "When executing increment/decrement command against item '{0}', delta mode should be specified."
                                                  .FormatString(item));

            _item      = item;
            _deltaMode = mode;
            _delta     = delta;
        }
Exemplo n.º 5
0
        public void SetDelta(float valArg, DeltaMode mode = DeltaMode.Const)
        {
            float fin = value;

            switch (mode)
            {
            case DeltaMode.Const:
                fin += valArg;
                break;

            case DeltaMode.Percentage:
                fin *= (1 + valArg);
                break;
            }
            value = MathFunc.Clamp(fin, min, max);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Add one trace
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="val">Value.</param>
        /// <param name="mode">Mode.</param>
        public void AddTrace(string name, float valArg, DeltaMode mode = DeltaMode.Const)
        {
            switch (mode)
            {
            case DeltaMode.Const:
                if (!constTraces.ContainsKey(name))
                {
                    constTraces.Add(name, valArg);
                }
                break;

            case DeltaMode.Percentage:
                if (!percTraces.ContainsKey(name))
                {
                    percTraces.Add(name, valArg);
                }
                break;
            }
        }
Exemplo n.º 7
0
 public CardListDelta(XmlElement from, IdIssuer <T> issuer, CardLoader cl)
     : base(from, issuer, cl)
 {
     this.Index = Int32.Parse(from.Attributes["index"].Value);
     this.Mode  = from.Attributes["mode"].Value == "add" ? DeltaMode.ADD : DeltaMode.REMOVE; // use remove as default b/c more likely to error if chosen eroniously
 }