1 // Copyright (C) 2019 Kazuhiro Fujieda <fujieda@users.osdn.me>
\r
3 // Licensed under the Apache License, Version 2.0 (the "License");
\r
4 // you may not use this file except in compliance with the License.
\r
5 // You may obtain a copy of the License at
\r
7 // http://www.apache.org/licenses/LICENSE-2.0
\r
9 // Unless required by applicable law or agreed to in writing, software
\r
10 // distributed under the License is distributed on an "AS IS" BASIS,
\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 // See the License for the specific language governing permissions and
\r
13 // limitations under the License.
\r
17 namespace KancolleSniffer.Model
\r
19 public class AirCorpsFighterPower
\r
21 public Model.Range AirCombat;
\r
22 public Model.Range Interception;
\r
23 public bool Difference;
\r
25 public AirCorpsFighterPower(Range fighterPower)
\r
27 AirCombat = new Model.Range(fighterPower.Min.AirCombat, fighterPower.Max.AirCombat);
\r
28 Interception = new Model.Range(fighterPower.Min.Interception, fighterPower.Max.Interception);
\r
29 Difference = Interception.Min != AirCombat.Min;
\r
34 public double AirCombat { get; }
\r
35 public double Interception { get; }
\r
37 public Pair(double airCombat, double interception)
\r
39 AirCombat = airCombat;
\r
40 Interception = interception;
\r
43 public static Pair Max(Pair value1, Pair value2)
\r
45 return new Pair(Math.Max(value1.AirCombat, value2.AirCombat),
\r
46 Math.Max(value1.Interception, value2.Interception));
\r
49 public static Pair operator +(Pair lhs, Pair rhs)
\r
51 return new Pair(lhs.AirCombat + rhs.AirCombat, lhs.Interception + rhs.Interception);
\r
54 public static Pair operator +(Pair lhs, double rhs)
\r
56 return new Pair(lhs.AirCombat + rhs, lhs.Interception + rhs);
\r
59 public static Pair operator *(Pair lhs, Pair rhs)
\r
61 return new Pair(lhs.AirCombat * rhs.AirCombat, lhs.Interception * rhs.Interception);
\r
64 public static Pair operator *(Pair lhs, double rhs)
\r
66 return new Pair(lhs.AirCombat * rhs, lhs.Interception * rhs);
\r
71 return new Pair((int)AirCombat, (int)Interception);
\r
77 public Pair Min { get; }
\r
78 public Pair Max { get; }
\r
80 public Range(Pair min, Pair max)
\r
86 public Range(Pair base_, RangeD range)
\r
88 Min = (base_ + range.Min).Floor();
\r
89 Max = (base_ + range.Max).Floor();
\r
92 public static Range operator +(Range lhs, Range rhs)
\r
94 return new Range(lhs.Min + rhs.Min, lhs.Max + rhs.Max);
\r
97 public static Range operator *(Range lhs, Pair rhs)
\r
99 return new Range(lhs.Min * rhs, lhs.Max * rhs);
\r
102 public Range Floor()
\r
104 return new Range(Min.Floor(), Max.Floor());
\r