Advertisement
ketura

tttt

Aug 23rd, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.32 KB | None | 0 0
  1.  
  2.  
  3. using System;
  4.  
  5. using XGEFCore;
  6.  
  7. public class DecimalStat : Stat<Decimal>
  8. {
  9.     public virtual Decimal MaxValue { get; }
  10.     public virtual Decimal MinValue { get; }
  11.  
  12.     public override Decimal Value { get; protected set; }
  13.  
  14.     public override Decimal Modify(Decimal amount)
  15.     {
  16.         Value = Value + amount;
  17.         ClampValue();
  18.         return Value;
  19.     }
  20.  
  21.     protected virtual void ClampValue()
  22.     {
  23.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  24.     }
  25.  
  26.     public virtual Decimal Add(Decimal amount)
  27.     {
  28.         return Modify(amount);
  29.     }
  30.  
  31.     public virtual Decimal Subtract(Decimal amount)
  32.     {
  33.         return Add(-amount);
  34.     }
  35.  
  36.     public virtual Decimal Set(Decimal amount)
  37.     {
  38.         return Add(amount - Value);
  39.     }
  40. }
  41.  
  42. public class DoubleStat : Stat<Double>
  43. {
  44.     public virtual Double MaxValue { get; }
  45.     public virtual Double MinValue { get; }
  46.  
  47.     public override Double Value { get; protected set; }
  48.  
  49.     public override Double Modify(Double amount)
  50.     {
  51.         Value = Value + amount;
  52.         ClampValue();
  53.         return Value;
  54.     }
  55.  
  56.     protected virtual void ClampValue()
  57.     {
  58.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  59.     }
  60.  
  61.     public virtual Double Add(Double amount)
  62.     {
  63.         return Modify(amount);
  64.     }
  65.  
  66.     public virtual Double Subtract(Double amount)
  67.     {
  68.         return Add(-amount);
  69.     }
  70.  
  71.     public virtual Double Set(Double amount)
  72.     {
  73.         return Add(amount - Value);
  74.     }
  75. }
  76.  
  77. public class FloatStat : Stat<Single>
  78. {
  79.     public virtual Single MaxValue { get; }
  80.     public virtual Single MinValue { get; }
  81.  
  82.     public override Single Value { get; protected set; }
  83.  
  84.     public override Single Modify(Single amount)
  85.     {
  86.         Value = Value + amount;
  87.         ClampValue();
  88.         return Value;
  89.     }
  90.  
  91.     protected virtual void ClampValue()
  92.     {
  93.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  94.     }
  95.  
  96.     public virtual Single Add(Single amount)
  97.     {
  98.         return Modify(amount);
  99.     }
  100.  
  101.     public virtual Single Subtract(Single amount)
  102.     {
  103.         return Add(-amount);
  104.     }
  105.  
  106.     public virtual Single Set(Single amount)
  107.     {
  108.         return Add(amount - Value);
  109.     }
  110. }
  111.  
  112. public class ByteStat : Stat<Byte>
  113. {
  114.     public virtual Byte MaxValue { get; }
  115.     public virtual Byte MinValue { get; }
  116.  
  117.     public override Byte Value { get; protected set; }
  118.  
  119.     public override Byte Modify(Byte amount)
  120.     {
  121.         Value = Value + amount;
  122.         ClampValue();
  123.         return Value;
  124.     }
  125.  
  126.     protected virtual void ClampValue()
  127.     {
  128.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  129.     }
  130.  
  131.     public virtual Byte Add(Byte amount)
  132.     {
  133.         return Modify(amount);
  134.     }
  135.  
  136.     public virtual Byte Subtract(Byte amount)
  137.     {
  138.         return Add(-amount);
  139.     }
  140.  
  141.     public virtual Byte Set(Byte amount)
  142.     {
  143.         return Add(amount - Value);
  144.     }
  145. }
  146.  
  147. public class SByteStat : Stat<SByte>
  148. {
  149.     public virtual SByte MaxValue { get; }
  150.     public virtual SByte MinValue { get; }
  151.  
  152.     public override SByte Value { get; protected set; }
  153.  
  154.     public override SByte Modify(SByte amount)
  155.     {
  156.         Value = Value + amount;
  157.         ClampValue();
  158.         return Value;
  159.     }
  160.  
  161.     protected virtual void ClampValue()
  162.     {
  163.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  164.     }
  165.  
  166.     public virtual SByte Add(SByte amount)
  167.     {
  168.         return Modify(amount);
  169.     }
  170.  
  171.     public virtual SByte Subtract(SByte amount)
  172.     {
  173.         return Add(-amount);
  174.     }
  175.  
  176.     public virtual SByte Set(SByte amount)
  177.     {
  178.         return Add(amount - Value);
  179.     }
  180. }
  181.  
  182. public class ShortStat : Stat<Int16>
  183. {
  184.     public virtual Int16 MaxValue { get; }
  185.     public virtual Int16 MinValue { get; }
  186.  
  187.     public override Int16 Value { get; protected set; }
  188.  
  189.     public override Int16 Modify(Int16 amount)
  190.     {
  191.         Value = Value + amount;
  192.         ClampValue();
  193.         return Value;
  194.     }
  195.  
  196.     protected virtual void ClampValue()
  197.     {
  198.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  199.     }
  200.  
  201.     public virtual Int16 Add(Int16 amount)
  202.     {
  203.         return Modify(amount);
  204.     }
  205.  
  206.     public virtual Int16 Subtract(Int16 amount)
  207.     {
  208.         return Add(-amount);
  209.     }
  210.  
  211.     public virtual Int16 Set(Int16 amount)
  212.     {
  213.         return Add(amount - Value);
  214.     }
  215. }
  216.  
  217. public class UShortStat : Stat<UInt16>
  218. {
  219.     public virtual UInt16 MaxValue { get; }
  220.     public virtual UInt16 MinValue { get; }
  221.  
  222.     public override UInt16 Value { get; protected set; }
  223.  
  224.     public override UInt16 Modify(UInt16 amount)
  225.     {
  226.         Value = Value + amount;
  227.         ClampValue();
  228.         return Value;
  229.     }
  230.  
  231.     protected virtual void ClampValue()
  232.     {
  233.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  234.     }
  235.  
  236.     public virtual UInt16 Add(UInt16 amount)
  237.     {
  238.         return Modify(amount);
  239.     }
  240.  
  241.     public virtual UInt16 Subtract(UInt16 amount)
  242.     {
  243.         return Add(-amount);
  244.     }
  245.  
  246.     public virtual UInt16 Set(UInt16 amount)
  247.     {
  248.         return Add(amount - Value);
  249.     }
  250. }
  251.  
  252. public class IntStat : Stat<Int32>
  253. {
  254.     public virtual Int32 MaxValue { get; }
  255.     public virtual Int32 MinValue { get; }
  256.  
  257.     public override Int32 Value { get; protected set; }
  258.  
  259.     public override Int32 Modify(Int32 amount)
  260.     {
  261.         Value = Value + amount;
  262.         ClampValue();
  263.         return Value;
  264.     }
  265.  
  266.     protected virtual void ClampValue()
  267.     {
  268.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  269.     }
  270.  
  271.     public virtual Int32 Add(Int32 amount)
  272.     {
  273.         return Modify(amount);
  274.     }
  275.  
  276.     public virtual Int32 Subtract(Int32 amount)
  277.     {
  278.         return Add(-amount);
  279.     }
  280.  
  281.     public virtual Int32 Set(Int32 amount)
  282.     {
  283.         return Add(amount - Value);
  284.     }
  285. }
  286.  
  287. public class UIntStat : Stat<UInt32>
  288. {
  289.     public virtual UInt32 MaxValue { get; }
  290.     public virtual UInt32 MinValue { get; }
  291.  
  292.     public override UInt32 Value { get; protected set; }
  293.  
  294.     public override UInt32 Modify(UInt32 amount)
  295.     {
  296.         Value = Value + amount;
  297.         ClampValue();
  298.         return Value;
  299.     }
  300.  
  301.     protected virtual void ClampValue()
  302.     {
  303.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  304.     }
  305.  
  306.     public virtual UInt32 Add(UInt32 amount)
  307.     {
  308.         return Modify(amount);
  309.     }
  310.  
  311.     public virtual UInt32 Subtract(UInt32 amount)
  312.     {
  313.         return Add(-amount);
  314.     }
  315.  
  316.     public virtual UInt32 Set(UInt32 amount)
  317.     {
  318.         return Add(amount - Value);
  319.     }
  320. }
  321.  
  322. public class LongStat : Stat<Int64>
  323. {
  324.     public virtual Int64 MaxValue { get; }
  325.     public virtual Int64 MinValue { get; }
  326.  
  327.     public override Int64 Value { get; protected set; }
  328.  
  329.     public override Int64 Modify(Int64 amount)
  330.     {
  331.         Value = Value + amount;
  332.         ClampValue();
  333.         return Value;
  334.     }
  335.  
  336.     protected virtual void ClampValue()
  337.     {
  338.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  339.     }
  340.  
  341.     public virtual Int64 Add(Int64 amount)
  342.     {
  343.         return Modify(amount);
  344.     }
  345.  
  346.     public virtual Int64 Subtract(Int64 amount)
  347.     {
  348.         return Add(-amount);
  349.     }
  350.  
  351.     public virtual Int64 Set(Int64 amount)
  352.     {
  353.         return Add(amount - Value);
  354.     }
  355. }
  356.  
  357. public class ULongStat : Stat<UInt64>
  358. {
  359.     public virtual UInt64 MaxValue { get; }
  360.     public virtual UInt64 MinValue { get; }
  361.  
  362.     public override UInt64 Value { get; protected set; }
  363.  
  364.     public override UInt64 Modify(UInt64 amount)
  365.     {
  366.         Value = Value + amount;
  367.         ClampValue();
  368.         return Value;
  369.     }
  370.  
  371.     protected virtual void ClampValue()
  372.     {
  373.         Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
  374.     }
  375.  
  376.     public virtual UInt64 Add(UInt64 amount)
  377.     {
  378.         return Modify(amount);
  379.     }
  380.  
  381.     public virtual UInt64 Subtract(UInt64 amount)
  382.     {
  383.         return Add(-amount);
  384.     }
  385.  
  386.     public virtual UInt64 Set(UInt64 amount)
  387.     {
  388.         return Add(amount - Value);
  389.     }
  390. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement