Advertisement
ketura

intstat

Aug 25th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 23.18 KB | None | 0 0
  1.  
  2.     public class IntStat : NumericStat<Int32>
  3.     {
  4.         public override Int32 MaxValue { get { return Math.Min(Int32.MaxValue, MaxLimit); } }
  5.         public override Int32 MinValue { get { return Math.Max(Int32.MinValue, MinLimit); } }
  6.  
  7.         #region IComparable
  8.         public override int CompareTo(object obj)
  9.         {
  10.             if (obj == null)
  11.                 return 1;
  12.  
  13.             if(obj is Int32)
  14.             {
  15.                 return Value.CompareTo(obj);
  16.             }
  17.             if(obj is DecimalStat)
  18.             {
  19.                 return Value.CompareTo(((DecimalStat)obj).Value);
  20.             }
  21.  
  22.             if(obj is DoubleStat)
  23.             {
  24.                 return Value.CompareTo(((DoubleStat)obj).Value);
  25.             }
  26.  
  27.             if(obj is FloatStat)
  28.             {
  29.                 return Value.CompareTo(((FloatStat)obj).Value);
  30.             }
  31.  
  32.             if(obj is ByteStat)
  33.             {
  34.                 return Value.CompareTo(((ByteStat)obj).Value);
  35.             }
  36.  
  37.             if(obj is SByteStat)
  38.             {
  39.                 return Value.CompareTo(((SByteStat)obj).Value);
  40.             }
  41.  
  42.             if(obj is ShortStat)
  43.             {
  44.                 return Value.CompareTo(((ShortStat)obj).Value);
  45.             }
  46.  
  47.             if(obj is UShortStat)
  48.             {
  49.                 return Value.CompareTo(((UShortStat)obj).Value);
  50.             }
  51.  
  52.             if(obj is IntStat)
  53.             {
  54.                 return Value.CompareTo(((IntStat)obj).Value);
  55.             }
  56.  
  57.             if(obj is UIntStat)
  58.             {
  59.                 return Value.CompareTo(((UIntStat)obj).Value);
  60.             }
  61.  
  62.             if(obj is LongStat)
  63.             {
  64.                 return Value.CompareTo(((LongStat)obj).Value);
  65.             }
  66.  
  67.             if(obj is ULongStat)
  68.             {
  69.                 return Value.CompareTo(((ULongStat)obj).Value);
  70.             }
  71.  
  72.            
  73.             return Value.CompareTo(obj);
  74.         }
  75.         #endregion
  76.  
  77.         #region IConvertible
  78.  
  79.         public override TypeCode GetTypeCode()
  80.         {
  81.             return TypeCode.Int32;
  82.         }
  83.  
  84.         public override bool ToBoolean(IFormatProvider provider)
  85.         {
  86.             if(Value == 0)
  87.                 return false;
  88.             return true;
  89.         }
  90.  
  91.         public override char ToChar(IFormatProvider provider)
  92.         {
  93.             return Convert.ToChar(Value);
  94.         }
  95.  
  96.         public override sbyte ToSByte(IFormatProvider provider)
  97.         {
  98.             return Convert.ToSByte(Value);
  99.         }
  100.  
  101.         public override byte ToByte(IFormatProvider provider)
  102.         {
  103.             return Convert.ToByte(Value);
  104.         }
  105.  
  106.         public override short ToInt16(IFormatProvider provider)
  107.         {
  108.             return Convert.ToInt16(Value);
  109.         }
  110.  
  111.         public override ushort ToUInt16(IFormatProvider provider)
  112.         {
  113.             return Convert.ToUInt16(Value);
  114.         }
  115.  
  116.         public override int ToInt32(IFormatProvider provider)
  117.         {
  118.             return Convert.ToInt32(Value);
  119.         }
  120.  
  121.         public override uint ToUInt32(IFormatProvider provider)
  122.         {
  123.             return Convert.ToUInt32(Value);
  124.         }
  125.  
  126.         public override long ToInt64(IFormatProvider provider)
  127.         {
  128.             return Convert.ToInt64(Value);
  129.         }
  130.  
  131.         public override ulong ToUInt64(IFormatProvider provider)
  132.         {
  133.             return Convert.ToUInt64(Value);
  134.         }
  135.  
  136.         public override float ToSingle(IFormatProvider provider)
  137.         {
  138.             return Convert.ToSingle(Value);
  139.         }
  140.  
  141.         public override double ToDouble(IFormatProvider provider)
  142.         {
  143.             return Convert.ToDouble(Value);
  144.         }
  145.  
  146.         public override decimal ToDecimal(IFormatProvider provider)
  147.         {
  148.             return Convert.ToDecimal(Value);
  149.         }
  150.  
  151.         public override string ToString(IFormatProvider provider)
  152.         {
  153.             return Convert.ToString(Value);
  154.         }
  155.  
  156.         public override object ToType(Type conversionType, IFormatProvider provider)
  157.         {
  158.             return Convert.ChangeType(Value, conversionType);
  159.         }
  160.         #endregion
  161.  
  162.         #region Type Casting
  163.        
  164.         public static implicit operator Decimal(IntStat stat)
  165.         {
  166.             return Convert.ToDecimal(stat.Value);
  167.         }
  168.         public static explicit operator IntStat(DecimalStat stat)
  169.         {
  170.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  171.         }
  172.         public static explicit operator IntStat(Decimal num)
  173.         {
  174.             IntStat stat = new IntStat();
  175.             if((Int32)num > stat.MaxLimit)
  176.                 stat.Set(stat.MaxLimit);
  177.             else if((Int32)num < stat.MinLimit)
  178.                 stat.Set(stat.MinLimit);
  179.             else            stat.Set((Int32)num);
  180.             return stat;
  181.         }
  182.  
  183.         public static implicit operator Double(IntStat stat)
  184.         {
  185.             return Convert.ToDouble(stat.Value);
  186.         }
  187.         public static explicit operator IntStat(DoubleStat stat)
  188.         {
  189.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  190.         }
  191.         public static explicit operator IntStat(Double num)
  192.         {
  193.             IntStat stat = new IntStat();
  194.             if((Int32)num > stat.MaxLimit)
  195.                 stat.Set(stat.MaxLimit);
  196.             else if((Int32)num < stat.MinLimit)
  197.                 stat.Set(stat.MinLimit);
  198.             else            stat.Set((Int32)num);
  199.             return stat;
  200.         }
  201.  
  202.         public static implicit operator Single(IntStat stat)
  203.         {
  204.             return Convert.ToSingle(stat.Value);
  205.         }
  206.         public static explicit operator IntStat(FloatStat stat)
  207.         {
  208.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  209.         }
  210.         public static explicit operator IntStat(Single num)
  211.         {
  212.             IntStat stat = new IntStat();
  213.             if((Int32)num > stat.MaxLimit)
  214.                 stat.Set(stat.MaxLimit);
  215.             else if((Int32)num < stat.MinLimit)
  216.                 stat.Set(stat.MinLimit);
  217.             else            stat.Set((Int32)num);
  218.             return stat;
  219.         }
  220.  
  221.         public static explicit operator Byte(IntStat stat)
  222.         {
  223.             return Convert.ToByte(stat.Value);
  224.         }
  225.         public static explicit operator IntStat(ByteStat stat)
  226.         {
  227.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  228.         }
  229.         public static explicit operator IntStat(Byte num)
  230.         {
  231.             IntStat stat = new IntStat();
  232.             if((Int32)num > stat.MaxLimit)
  233.                 stat.Set(stat.MaxLimit);
  234.             else if((Int32)num < stat.MinLimit)
  235.                 stat.Set(stat.MinLimit);
  236.             else            stat.Set((Int32)num);
  237.             return stat;
  238.         }
  239.  
  240.         public static explicit operator SByte(IntStat stat)
  241.         {
  242.             return Convert.ToSByte(stat.Value);
  243.         }
  244.         public static implicit operator IntStat(SByteStat stat)
  245.         {
  246.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  247.         }
  248.         public static implicit operator IntStat(SByte num)
  249.         {
  250.             IntStat stat = new IntStat();
  251.             stat.Set((Int32)num);
  252.             return stat;
  253.         }
  254.  
  255.         public static explicit operator Int16(IntStat stat)
  256.         {
  257.             return Convert.ToInt16(stat.Value);
  258.         }
  259.         public static implicit operator IntStat(ShortStat stat)
  260.         {
  261.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  262.         }
  263.         public static implicit operator IntStat(Int16 num)
  264.         {
  265.             IntStat stat = new IntStat();
  266.             stat.Set((Int32)num);
  267.             return stat;
  268.         }
  269.  
  270.         public static explicit operator UInt16(IntStat stat)
  271.         {
  272.             return Convert.ToUInt16(stat.Value);
  273.         }
  274.         public static explicit operator IntStat(UShortStat stat)
  275.         {
  276.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  277.         }
  278.         public static explicit operator IntStat(UInt16 num)
  279.         {
  280.             IntStat stat = new IntStat();
  281.             if((Int32)num > stat.MaxLimit)
  282.                 stat.Set(stat.MaxLimit);
  283.             else if((Int32)num < stat.MinLimit)
  284.                 stat.Set(stat.MinLimit);
  285.             else            stat.Set((Int32)num);
  286.             return stat;
  287.         }
  288.  
  289.         public static implicit operator Int32(IntStat stat)
  290.         {
  291.             return Convert.ToInt32(stat.Value);
  292.         }
  293.  
  294.         public static implicit operator IntStat(Int32 num)
  295.         {
  296.             IntStat stat = new IntStat();
  297.             stat.Set((Int32)num);
  298.             return stat;
  299.         }
  300.  
  301.         public static explicit operator UInt32(IntStat stat)
  302.         {
  303.             return Convert.ToUInt32(stat.Value);
  304.         }
  305.         public static explicit operator IntStat(UIntStat stat)
  306.         {
  307.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  308.         }
  309.         public static explicit operator IntStat(UInt32 num)
  310.         {
  311.             IntStat stat = new IntStat();
  312.             if((Int32)num > stat.MaxLimit)
  313.                 stat.Set(stat.MaxLimit);
  314.             else if((Int32)num < stat.MinLimit)
  315.                 stat.Set(stat.MinLimit);
  316.             else            stat.Set((Int32)num);
  317.             return stat;
  318.         }
  319.  
  320.         public static implicit operator Int64(IntStat stat)
  321.         {
  322.             return Convert.ToInt64(stat.Value);
  323.         }
  324.         public static explicit operator IntStat(LongStat stat)
  325.         {
  326.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  327.         }
  328.         public static explicit operator IntStat(Int64 num)
  329.         {
  330.             IntStat stat = new IntStat();
  331.             if((Int32)num > stat.MaxLimit)
  332.                 stat.Set(stat.MaxLimit);
  333.             else if((Int32)num < stat.MinLimit)
  334.                 stat.Set(stat.MinLimit);
  335.             else            stat.Set((Int32)num);
  336.             return stat;
  337.         }
  338.  
  339.         public static explicit operator UInt64(IntStat stat)
  340.         {
  341.             return Convert.ToUInt64(stat.Value);
  342.         }
  343.         public static explicit operator IntStat(ULongStat stat)
  344.         {
  345.             return new IntStat(stat.Name, (Int32)stat.Value, (Int32)stat.MinValue, (Int32)stat.MaxValue, stat.Description, stat.Notes);
  346.         }
  347.         public static explicit operator IntStat(UInt64 num)
  348.         {
  349.             IntStat stat = new IntStat();
  350.             if((Int32)num > stat.MaxLimit)
  351.                 stat.Set(stat.MaxLimit);
  352.             else if((Int32)num < stat.MinLimit)
  353.                 stat.Set(stat.MinLimit);
  354.             else            stat.Set((Int32)num);
  355.             return stat;
  356.         }
  357.  
  358.         #endregion
  359.  
  360.         #region Operator Overloading
  361.        
  362.         public static IntStat operator +(IntStat lhs, Decimal rhs)
  363.         {
  364.             IntStat result = lhs.Copy();
  365.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  366.             return result;
  367.         }
  368.         public static IntStat operator -(IntStat lhs, Decimal rhs)
  369.         {
  370.             IntStat result = lhs.Copy();
  371.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  372.             return result;
  373.         }
  374.         public static IntStat operator *(IntStat lhs, Decimal rhs)
  375.         {
  376.             IntStat result = lhs.Copy();
  377.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  378.             return result;
  379.         }
  380.         public static IntStat operator /(IntStat lhs, Decimal rhs)
  381.         {
  382.             IntStat result = lhs.Copy();
  383.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  384.             return result;
  385.         }
  386.         public static IntStat operator %(IntStat lhs, Decimal rhs)
  387.         {
  388.             IntStat result = lhs.Copy();
  389.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  390.             return result;
  391.         }
  392.         public static IntStat operator ^(IntStat lhs, Decimal rhs)
  393.         {
  394.             IntStat result = lhs.Copy();
  395.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  396.             return result;
  397.         }
  398.         public static bool operator >(IntStat lhs, Decimal rhs)
  399.         {
  400.             return lhs.CompareTo(rhs) > 0;
  401.         }
  402.         public static bool operator <(IntStat lhs, Decimal rhs)
  403.         {
  404.             return lhs.CompareTo(rhs) < 0;
  405.         }
  406.  
  407.         public static IntStat operator +(IntStat lhs, Double rhs)
  408.         {
  409.             IntStat result = lhs.Copy();
  410.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  411.             return result;
  412.         }
  413.         public static IntStat operator -(IntStat lhs, Double rhs)
  414.         {
  415.             IntStat result = lhs.Copy();
  416.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  417.             return result;
  418.         }
  419.         public static IntStat operator *(IntStat lhs, Double rhs)
  420.         {
  421.             IntStat result = lhs.Copy();
  422.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  423.             return result;
  424.         }
  425.         public static IntStat operator /(IntStat lhs, Double rhs)
  426.         {
  427.             IntStat result = lhs.Copy();
  428.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  429.             return result;
  430.         }
  431.         public static IntStat operator %(IntStat lhs, Double rhs)
  432.         {
  433.             IntStat result = lhs.Copy();
  434.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  435.             return result;
  436.         }
  437.         public static IntStat operator ^(IntStat lhs, Double rhs)
  438.         {
  439.             IntStat result = lhs.Copy();
  440.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  441.             return result;
  442.         }
  443.         public static bool operator >(IntStat lhs, Double rhs)
  444.         {
  445.             return lhs.CompareTo(rhs) > 0;
  446.         }
  447.         public static bool operator <(IntStat lhs, Double rhs)
  448.         {
  449.             return lhs.CompareTo(rhs) < 0;
  450.         }
  451.  
  452.         public static IntStat operator +(IntStat lhs, Single rhs)
  453.         {
  454.             IntStat result = lhs.Copy();
  455.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  456.             return result;
  457.         }
  458.         public static IntStat operator -(IntStat lhs, Single rhs)
  459.         {
  460.             IntStat result = lhs.Copy();
  461.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  462.             return result;
  463.         }
  464.         public static IntStat operator *(IntStat lhs, Single rhs)
  465.         {
  466.             IntStat result = lhs.Copy();
  467.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  468.             return result;
  469.         }
  470.         public static IntStat operator /(IntStat lhs, Single rhs)
  471.         {
  472.             IntStat result = lhs.Copy();
  473.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  474.             return result;
  475.         }
  476.         public static IntStat operator %(IntStat lhs, Single rhs)
  477.         {
  478.             IntStat result = lhs.Copy();
  479.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  480.             return result;
  481.         }
  482.         public static IntStat operator ^(IntStat lhs, Single rhs)
  483.         {
  484.             IntStat result = lhs.Copy();
  485.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  486.             return result;
  487.         }
  488.         public static bool operator >(IntStat lhs, Single rhs)
  489.         {
  490.             return lhs.CompareTo(rhs) > 0;
  491.         }
  492.         public static bool operator <(IntStat lhs, Single rhs)
  493.         {
  494.             return lhs.CompareTo(rhs) < 0;
  495.         }
  496.  
  497.         public static IntStat operator +(IntStat lhs, Byte rhs)
  498.         {
  499.             IntStat result = lhs.Copy();
  500.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  501.             return result;
  502.         }
  503.         public static IntStat operator -(IntStat lhs, Byte rhs)
  504.         {
  505.             IntStat result = lhs.Copy();
  506.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  507.             return result;
  508.         }
  509.         public static IntStat operator *(IntStat lhs, Byte rhs)
  510.         {
  511.             IntStat result = lhs.Copy();
  512.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  513.             return result;
  514.         }
  515.         public static IntStat operator /(IntStat lhs, Byte rhs)
  516.         {
  517.             IntStat result = lhs.Copy();
  518.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  519.             return result;
  520.         }
  521.         public static IntStat operator %(IntStat lhs, Byte rhs)
  522.         {
  523.             IntStat result = lhs.Copy();
  524.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  525.             return result;
  526.         }
  527.         public static IntStat operator ^(IntStat lhs, Byte rhs)
  528.         {
  529.             IntStat result = lhs.Copy();
  530.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  531.             return result;
  532.         }
  533.         public static bool operator >(IntStat lhs, Byte rhs)
  534.         {
  535.             return lhs.CompareTo(rhs) > 0;
  536.         }
  537.         public static bool operator <(IntStat lhs, Byte rhs)
  538.         {
  539.             return lhs.CompareTo(rhs) < 0;
  540.         }
  541.  
  542.         public static IntStat operator +(IntStat lhs, SByte rhs)
  543.         {
  544.             IntStat result = lhs.Copy();
  545.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  546.             return result;
  547.         }
  548.         public static IntStat operator -(IntStat lhs, SByte rhs)
  549.         {
  550.             IntStat result = lhs.Copy();
  551.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  552.             return result;
  553.         }
  554.         public static IntStat operator *(IntStat lhs, SByte rhs)
  555.         {
  556.             IntStat result = lhs.Copy();
  557.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  558.             return result;
  559.         }
  560.         public static IntStat operator /(IntStat lhs, SByte rhs)
  561.         {
  562.             IntStat result = lhs.Copy();
  563.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  564.             return result;
  565.         }
  566.         public static IntStat operator %(IntStat lhs, SByte rhs)
  567.         {
  568.             IntStat result = lhs.Copy();
  569.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  570.             return result;
  571.         }
  572.         public static IntStat operator ^(IntStat lhs, SByte rhs)
  573.         {
  574.             IntStat result = lhs.Copy();
  575.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  576.             return result;
  577.         }
  578.         public static bool operator >(IntStat lhs, SByte rhs)
  579.         {
  580.             return lhs.CompareTo(rhs) > 0;
  581.         }
  582.         public static bool operator <(IntStat lhs, SByte rhs)
  583.         {
  584.             return lhs.CompareTo(rhs) < 0;
  585.         }
  586.  
  587.         public static IntStat operator +(IntStat lhs, Int16 rhs)
  588.         {
  589.             IntStat result = lhs.Copy();
  590.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  591.             return result;
  592.         }
  593.         public static IntStat operator -(IntStat lhs, Int16 rhs)
  594.         {
  595.             IntStat result = lhs.Copy();
  596.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  597.             return result;
  598.         }
  599.         public static IntStat operator *(IntStat lhs, Int16 rhs)
  600.         {
  601.             IntStat result = lhs.Copy();
  602.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  603.             return result;
  604.         }
  605.         public static IntStat operator /(IntStat lhs, Int16 rhs)
  606.         {
  607.             IntStat result = lhs.Copy();
  608.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  609.             return result;
  610.         }
  611.         public static IntStat operator %(IntStat lhs, Int16 rhs)
  612.         {
  613.             IntStat result = lhs.Copy();
  614.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  615.             return result;
  616.         }
  617.         public static IntStat operator ^(IntStat lhs, Int16 rhs)
  618.         {
  619.             IntStat result = lhs.Copy();
  620.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  621.             return result;
  622.         }
  623.         public static bool operator >(IntStat lhs, Int16 rhs)
  624.         {
  625.             return lhs.CompareTo(rhs) > 0;
  626.         }
  627.         public static bool operator <(IntStat lhs, Int16 rhs)
  628.         {
  629.             return lhs.CompareTo(rhs) < 0;
  630.         }
  631.  
  632.         public static IntStat operator +(IntStat lhs, UInt16 rhs)
  633.         {
  634.             IntStat result = lhs.Copy();
  635.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  636.             return result;
  637.         }
  638.         public static IntStat operator -(IntStat lhs, UInt16 rhs)
  639.         {
  640.             IntStat result = lhs.Copy();
  641.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  642.             return result;
  643.         }
  644.         public static IntStat operator *(IntStat lhs, UInt16 rhs)
  645.         {
  646.             IntStat result = lhs.Copy();
  647.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  648.             return result;
  649.         }
  650.         public static IntStat operator /(IntStat lhs, UInt16 rhs)
  651.         {
  652.             IntStat result = lhs.Copy();
  653.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  654.             return result;
  655.         }
  656.         public static IntStat operator %(IntStat lhs, UInt16 rhs)
  657.         {
  658.             IntStat result = lhs.Copy();
  659.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  660.             return result;
  661.         }
  662.         public static IntStat operator ^(IntStat lhs, UInt16 rhs)
  663.         {
  664.             IntStat result = lhs.Copy();
  665.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  666.             return result;
  667.         }
  668.         public static bool operator >(IntStat lhs, UInt16 rhs)
  669.         {
  670.             return lhs.CompareTo(rhs) > 0;
  671.         }
  672.         public static bool operator <(IntStat lhs, UInt16 rhs)
  673.         {
  674.             return lhs.CompareTo(rhs) < 0;
  675.         }
  676.  
  677.         public static IntStat operator +(IntStat lhs, Int32 rhs)
  678.         {
  679.             IntStat result = lhs.Copy();
  680.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  681.             return result;
  682.         }
  683.         public static IntStat operator -(IntStat lhs, Int32 rhs)
  684.         {
  685.             IntStat result = lhs.Copy();
  686.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  687.             return result;
  688.         }
  689.         public static IntStat operator *(IntStat lhs, Int32 rhs)
  690.         {
  691.             IntStat result = lhs.Copy();
  692.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  693.             return result;
  694.         }
  695.         public static IntStat operator /(IntStat lhs, Int32 rhs)
  696.         {
  697.             IntStat result = lhs.Copy();
  698.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  699.             return result;
  700.         }
  701.         public static IntStat operator %(IntStat lhs, Int32 rhs)
  702.         {
  703.             IntStat result = lhs.Copy();
  704.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  705.             return result;
  706.         }
  707.         public static IntStat operator ^(IntStat lhs, Int32 rhs)
  708.         {
  709.             IntStat result = lhs.Copy();
  710.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  711.             return result;
  712.         }
  713.         public static bool operator >(IntStat lhs, Int32 rhs)
  714.         {
  715.             return lhs.CompareTo(rhs) > 0;
  716.         }
  717.         public static bool operator <(IntStat lhs, Int32 rhs)
  718.         {
  719.             return lhs.CompareTo(rhs) < 0;
  720.         }
  721.  
  722.         public static IntStat operator +(IntStat lhs, UInt32 rhs)
  723.         {
  724.             IntStat result = lhs.Copy();
  725.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  726.             return result;
  727.         }
  728.         public static IntStat operator -(IntStat lhs, UInt32 rhs)
  729.         {
  730.             IntStat result = lhs.Copy();
  731.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  732.             return result;
  733.         }
  734.         public static IntStat operator *(IntStat lhs, UInt32 rhs)
  735.         {
  736.             IntStat result = lhs.Copy();
  737.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  738.             return result;
  739.         }
  740.         public static IntStat operator /(IntStat lhs, UInt32 rhs)
  741.         {
  742.             IntStat result = lhs.Copy();
  743.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  744.             return result;
  745.         }
  746.         public static IntStat operator %(IntStat lhs, UInt32 rhs)
  747.         {
  748.             IntStat result = lhs.Copy();
  749.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  750.             return result;
  751.         }
  752.         public static IntStat operator ^(IntStat lhs, UInt32 rhs)
  753.         {
  754.             IntStat result = lhs.Copy();
  755.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  756.             return result;
  757.         }
  758.         public static bool operator >(IntStat lhs, UInt32 rhs)
  759.         {
  760.             return lhs.CompareTo(rhs) > 0;
  761.         }
  762.         public static bool operator <(IntStat lhs, UInt32 rhs)
  763.         {
  764.             return lhs.CompareTo(rhs) < 0;
  765.         }
  766.  
  767.         public static IntStat operator +(IntStat lhs, Int64 rhs)
  768.         {
  769.             IntStat result = lhs.Copy();
  770.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  771.             return result;
  772.         }
  773.         public static IntStat operator -(IntStat lhs, Int64 rhs)
  774.         {
  775.             IntStat result = lhs.Copy();
  776.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  777.             return result;
  778.         }
  779.         public static IntStat operator *(IntStat lhs, Int64 rhs)
  780.         {
  781.             IntStat result = lhs.Copy();
  782.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  783.             return result;
  784.         }
  785.         public static IntStat operator /(IntStat lhs, Int64 rhs)
  786.         {
  787.             IntStat result = lhs.Copy();
  788.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  789.             return result;
  790.         }
  791.         public static IntStat operator %(IntStat lhs, Int64 rhs)
  792.         {
  793.             IntStat result = lhs.Copy();
  794.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  795.             return result;
  796.         }
  797.         public static IntStat operator ^(IntStat lhs, Int64 rhs)
  798.         {
  799.             IntStat result = lhs.Copy();
  800.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  801.             return result;
  802.         }
  803.         public static bool operator >(IntStat lhs, Int64 rhs)
  804.         {
  805.             return lhs.CompareTo(rhs) > 0;
  806.         }
  807.         public static bool operator <(IntStat lhs, Int64 rhs)
  808.         {
  809.             return lhs.CompareTo(rhs) < 0;
  810.         }
  811.  
  812.         public static IntStat operator +(IntStat lhs, UInt64 rhs)
  813.         {
  814.             IntStat result = lhs.Copy();
  815.             result.Set((Int32)(lhs.Value + (Int32)rhs));
  816.             return result;
  817.         }
  818.         public static IntStat operator -(IntStat lhs, UInt64 rhs)
  819.         {
  820.             IntStat result = lhs.Copy();
  821.             result.Set((Int32)(lhs.Value - (Int32)rhs));
  822.             return result;
  823.         }
  824.         public static IntStat operator *(IntStat lhs, UInt64 rhs)
  825.         {
  826.             IntStat result = lhs.Copy();
  827.             result.Set((Int32)(lhs.Value * (Int32)rhs));
  828.             return result;
  829.         }
  830.         public static IntStat operator /(IntStat lhs, UInt64 rhs)
  831.         {
  832.             IntStat result = lhs.Copy();
  833.             result.Set((Int32)(lhs.Value / (Int32)rhs));
  834.             return result;
  835.         }
  836.         public static IntStat operator %(IntStat lhs, UInt64 rhs)
  837.         {
  838.             IntStat result = lhs.Copy();
  839.             result.Set((Int32)(lhs.Value % (Int32)rhs));
  840.             return result;
  841.         }
  842.         public static IntStat operator ^(IntStat lhs, UInt64 rhs)
  843.         {
  844.             IntStat result = lhs.Copy();
  845.             result.Set((Int32)Math.Pow((double)lhs.Value, (double)rhs));
  846.             return result;
  847.         }
  848.         public static bool operator >(IntStat lhs, UInt64 rhs)
  849.         {
  850.             return lhs.CompareTo(rhs) > 0;
  851.         }
  852.         public static bool operator <(IntStat lhs, UInt64 rhs)
  853.         {
  854.             return lhs.CompareTo(rhs) < 0;
  855.         }
  856.        
  857.         #endregion
  858.  
  859.         public IntStat Copy()
  860.         {
  861.             return new IntStat(Name, Value, MinLimit, MaxLimit, Description, Notes);
  862.         }
  863.  
  864.         public IntStat() : this("UnnamedStat", 0, Int32.MinValue, Int32.MaxValue, null, null) { }
  865.         public IntStat(string name) : this(name, 0, Int32.MinValue, Int32.MaxValue, null, null) { }
  866.         public IntStat(string name, Int32 value) : this(name, value, Int32.MinValue, Int32.MaxValue, null, null) { }
  867.         public IntStat(string name, Int32 value, Int32 min, Int32 max) : this(name, value, min, max, null, null) { }
  868.         public IntStat(string name, Int32 value, Int32 min, Int32 max, string desc, string notes) : base(name, value, min, max, desc, notes) { }
  869.  
  870.         public override string ToString() { return Value.ToString(); }
  871.  
  872.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement