Ejemplo n.º 1
0
 public static Pixel GetAggregate(List <Pixel> pixels, StackingType type)
 {
     if (type == StackingType.Mean)
     {
         return(GetPixelAverage(pixels));
     }
     if (type == StackingType.Median)
     {
         pixels = pixels.OrderBy(p => p.GetLuma()).ToList();
         float indexf = pixels.Count / 2f;
         int   index  = (int)indexf;
         if (index != indexf)
         {
             List <Pixel> input = new List <Pixel>();
             input.Add(pixels[index]);
             input.Add(pixels[index + 1]);
             return(GetPixelAverage(input));
         }
         else
         {
             return(pixels[index]);
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
        public void StatusReaderTestAllValues()
        {
            string       key             = "TEST_KEY";
            double       maxStack        = 10;
            double       interval        = 10;
            StackingType type            = StackingType.Refresh;
            string       intervalFormula = $"{LConstants.MAX_F}(10,5)";
            string       formula         = $"{ LConstants.HARM_F }({ LConstants.TargetKeyword},{ LConstants.TargetKeyword},T,$0)";

            string jsonStr = $"{{\"{GcConstants.General.KEY}\":\"{key}\",";

            jsonStr += $"\"{GcConstants.Statuses.MAX_STACK}\":\"{maxStack}\",";
            jsonStr += $"\"{GcConstants.Statuses.STACK_TYPE}\":\"{type.ToString().ToLower()}\",";
            jsonStr += $"\"{GcConstants.Statuses.INTERVAL}\":\"{intervalFormula}\",";
            jsonStr += $"\"{GcConstants.General.FORMULA}\":\"{formula}\"}}";

            JObject        json   = JObject.Parse(jsonStr);
            StatusTemplate status = Reader.FromJSON(json);

            Assert.AreEqual(maxStack, status.MaxStacks.Resolve().Value.ToDouble());
            Assert.AreEqual(interval, status.Interval.Resolve().Value.ToDouble());
            Assert.AreEqual(type, status.Type);
            Assert.AreEqual(interval, status.Interval.Resolve().Value.ToDouble());
        }
 /// <summary>
 /// Create a party wide wind attack up <see cref="Ability"/> with optional <see cref="extraEffects"/>.
 /// </summary>
 /// <param name="strength">The strength of the elemental attack up buff. Must be greater than 0.</param>
 /// <param name="turnDuration">The duration of the buff.</param>
 /// <param name="stackingType">The frame on which the buff will apply (used to resolve stacking effects).</param>
 /// <param name="extraEffects">Optional list of additional effects which will be applied on top of the elemental attack up buff.</param>
 public static Ability WindAttackUpForParty(uint strength, uint turnDuration, StackingType stackingType, params AbilityEffect[] extraEffects)
 {
     throw new NotImplementedException();
 }
 public static Ability DamageCutForParty(uint strength, StackingType stackingType)
 {
     throw new NotImplementedException();
 }