예제 #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;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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);
        }
예제 #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;
            }
        }
예제 #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
 }