Advertisement
sondrex76

Giants v0.521

Oct 30th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 13.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Giant_stats_calucator
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.             timer.Start();
  19.         }
  20.         public double HumanHeight { get; set; }
  21.         public double Multiplier { get; set; }
  22.         public double MultiplierWeight { get; set; }
  23.         public int MaxStrengthGiants { get; set; }
  24.         public int MinStrengthGiants { get; set; }
  25.         public int MaxWeigthGiants { get; set; }
  26.         public int MinWeigthGiants { get; set; }
  27.         public int MultiplierMin { get; set; }
  28.         public int MultiplierMax { get; set; }
  29.         public double MaxHeight { get; set; }
  30.         public double GiantHeight { get; set; }
  31.         public string StringStrength { get; set; }
  32.         public string StringWeight { get; set; }
  33.         public double HumanStrength { get; set; }
  34.         public double GiantStrength { get; set; }
  35.         public int HumanWeight { get; set; }
  36.         public double GiantWeight { get; set; }
  37.         public double WeightDivider { get; set; }
  38.         public double StrengthDivider { get; set; }
  39.         public double RoundedMultiplier { get; set; }
  40.         public double MaxStrengthHuman { get; set; }
  41.         public double WeigthMaxHuman { get; set; }
  42.         public double MaxHumanHeight { get; set; }
  43.         public double MinhumanHeight { get; set; }
  44.         public double MinHumanHeight { get; set; }
  45.         public double MinWeightHuman { get; set; }
  46.         public double MinStrengthHuman { get; set; }
  47.         public double RelativeMaxHeight { get; set; }
  48.         public double RelativeMinheight { get; set; }
  49.         public double CurrentMaxStrength { get; set; }
  50.         public double CurrentMinStrength { get; set; }
  51.         public double CurrentMaxweigth { get; set; }
  52.         public double CurrentMinWeight { get; set; }
  53.         public double StrengthMultiplier { get; set; }
  54.         public double LifeLengthMultiplier { get; set; }
  55.         public double LifeLengthMin { get; set; }
  56.         public double LifeLengthMax { get; set; }
  57.         public double NormalMinLife { get; set; }
  58.         public double NormalMaxLife { get; set; }
  59.         public double LifeLengthVariable { get; set; }
  60.         public string PreviusValues { get; set; }
  61.  
  62.         private void Activate_Click(object sender, EventArgs e)
  63.         {
  64.             HumanHeight = TbHeight.Value;  
  65.             HumanStrength = TbStrength.Value;  
  66.             HumanWeight = TbWeight.Value;    
  67.             Multiplier = TbMultiplier.Value;
  68.  
  69.             Multiplier = Multiplier / 100;
  70.             HumanHeight = HumanHeight / 100;
  71.  
  72.             switch (TbMode.Value)
  73.             {
  74.                 case 1:
  75.                     WeightDivider = 2.5;
  76.                     StrengthDivider = 3;
  77.                     MultiplierWeight = 3;
  78.                     StrengthMultiplier = 3;
  79.                     NormalMinLife = 45;
  80.                     NormalMaxLife = 65;
  81.                     MaxHeight = 18.5;
  82.                     LifeLengthVariable = 1.5;
  83.                     break;
  84.                 case 2:
  85.                     WeightDivider = 2.5;
  86.                     StrengthDivider = 1.75;
  87.                     MultiplierWeight = 3;
  88.                     StrengthMultiplier = 3;
  89.                     NormalMinLife = 145;
  90.                     NormalMaxLife = 185;
  91.                     MaxHeight = 13.5;
  92.                     LifeLengthVariable = 2;
  93.                     break;
  94.                 case 3:
  95.                     WeightDivider = 1;
  96.                     StrengthDivider = 1;
  97.                     MultiplierWeight = 2;
  98.                     StrengthMultiplier = 3;
  99.                     NormalMinLife = 70;
  100.                     NormalMaxLife = 95;
  101.                     LifeLengthVariable = 1;
  102.                     MaxHeight = 1;
  103.                     break;
  104.                 case 4:
  105.                     WeightDivider = 1;
  106.                     StrengthDivider = 1;
  107.                     MultiplierWeight = 3;
  108.                     StrengthMultiplier = 3;
  109.                     LifeLengthVariable = 1;
  110.                     MaxHeight = 1;
  111.                     break;
  112.             }
  113.  
  114.             if (TbMode.Value != 4)
  115.             {
  116.                 LifeLengthMultiplier = Multiplier * LifeLengthVariable * (Multiplier / MaxHeight);
  117.                 LifeLengthMin = Math.Round(LifeLengthMultiplier * NormalMinLife);
  118.                 LifeLengthMax = Math.Round(LifeLengthMultiplier * NormalMaxLife);
  119.                 LifeLengthMultiplier = Math.Round(LifeLengthMultiplier, 2, MidpointRounding.ToEven);
  120.                 lblpotage.Text = "Expected life length is " + LifeLengthMin + " to " + LifeLengthMax + " years." + "   (" + LifeLengthMultiplier + ")";
  121.             }
  122.             else
  123.                 lblpotage.Text = "She can never die of age or mortal harm";
  124.  
  125.  
  126.             GiantHeight = HumanHeight * Multiplier;
  127.  
  128.             GiantStrength = System.Math.Pow(Multiplier, MultiplierWeight) * HumanStrength / StrengthDivider;
  129.             GiantWeight = System.Math.Pow(Multiplier, StrengthMultiplier) * HumanWeight / WeightDivider;
  130.  
  131.             if (GiantStrength > 1000000)
  132.             {
  133.                 GiantStrength = GiantStrength / 1000000;
  134.                 StringStrength = "M Kg";
  135.             }
  136.             else
  137.             {
  138.                 GiantStrength = GiantStrength / 1000;
  139.                 StringStrength = "T";
  140.             }
  141.  
  142.             if (GiantWeight > 1000000)
  143.             {
  144.                 GiantWeight = GiantWeight / 1000000;
  145.                 StringWeight = "M Kg";
  146.             }
  147.             else
  148.             {
  149.                 GiantWeight = GiantWeight / 1000;
  150.                 StringWeight = "T";
  151.             }
  152.             GiantHeight = Math.Round(GiantHeight, 2);
  153.             GiantStrength = Math.Round(GiantStrength, 2);
  154.             GiantWeight = Math.Round(GiantWeight, 2);
  155.  
  156.             lblMultiplier.Text = "" + Multiplier;
  157.             lblHeightHuman.Text = HumanHeight + "m";
  158.             lblStrengthHuman.Text = HumanStrength + "Kg";
  159.             lblWeightHuman.Text = HumanWeight + "Kg";
  160.             lblHeight.Text = "Height: " + GiantHeight + "m";
  161.             lblStrength.Text = "Strength: " + GiantStrength + StringStrength;
  162.             lblWeight.Text = "Weight: " + GiantWeight + StringWeight;
  163.         }
  164.  
  165.         protected override void OnShown(EventArgs e)
  166.         {
  167.             Activate.PerformClick();
  168.             lblMode.Text = "Giants";
  169.  
  170.         }
  171.         private void TbHeight_Scroll(object sender, EventArgs e)
  172.         {
  173.             HumanHeight = TbHeight.Value;
  174.  
  175.             switch (TbMode.Value)
  176.             {
  177.                 case 1:
  178.                     MaxStrengthHuman = 300;
  179.                     WeigthMaxHuman = 125;
  180.                     MaxHumanHeight = 230;
  181.                     MinHumanHeight = 100;
  182.                     MinWeightHuman = 20;
  183.                     MinStrengthHuman = 30;
  184.                     break;
  185.                 case 2:
  186.                     MaxStrengthHuman = 250;
  187.                     WeigthMaxHuman = 75;
  188.                     MinHumanHeight = 100;
  189.                     MaxHumanHeight = 165;
  190.                     MinWeightHuman = 20;
  191.                     MinStrengthHuman = 30;
  192.                     break;
  193.                 case 3:
  194.                     MaxStrengthHuman = 250;
  195.                     WeigthMaxHuman = 130;
  196.                     MinHumanHeight = 100;
  197.                     MaxHumanHeight = 230;
  198.                     MinWeightHuman = 20;
  199.                     MinStrengthHuman = 30;
  200.                     break;
  201.                 case 4:
  202.                     MaxStrengthHuman = 187;
  203.                     WeigthMaxHuman = 63;
  204.                     MinHumanHeight = 177;
  205.                     MaxHumanHeight = 179;
  206.                     MinWeightHuman = 61;
  207.                     MinStrengthHuman = 185;
  208.                     break;
  209.             }
  210.  
  211.             if (TbMode.Value != 4)
  212.             {
  213.                 RelativeMaxHeight = (HumanHeight) / (MaxHumanHeight);
  214.                 RelativeMinheight = (HumanHeight) / (MinHumanHeight);
  215.  
  216.                 CurrentMaxStrength = (MaxStrengthHuman * RelativeMaxHeight);
  217.                 CurrentMinStrength = (MinStrengthHuman * RelativeMinheight);
  218.                 CurrentMaxweigth = (WeigthMaxHuman * RelativeMaxHeight);
  219.                 CurrentMinWeight = (MinWeightHuman * RelativeMinheight);
  220.  
  221.                 TbStrength.Maximum = (int)CurrentMaxStrength;
  222.                 TbStrength.Minimum = (int)CurrentMinStrength;
  223.                 TbStrength.Value = (int)((CurrentMaxStrength + CurrentMinStrength) / 2);
  224.  
  225.                 TbWeight.Minimum = (int)CurrentMinWeight;
  226.                 TbWeight.Maximum = (int)CurrentMaxweigth;
  227.                 TbWeight.Value = (int)((CurrentMaxweigth + CurrentMinWeight) / 2);
  228.             }
  229.             else
  230.             {
  231.                 TbStrength.Maximum = 187;
  232.                 TbStrength.Minimum = 185;
  233.                 TbStrength.Value = 186;
  234.  
  235.                 TbWeight.Maximum = 63;
  236.                 TbWeight.Minimum = 61;
  237.                 TbWeight.Value = 62;
  238.             }
  239.         }
  240.  
  241.         private void TbStrength_Scroll(object sender, EventArgs e)
  242.         { }
  243.  
  244.         private void TbWeight_Scroll(object sender, EventArgs e)
  245.         { }
  246.  
  247.         private void TbMultiplier_Scroll(object sender, EventArgs e)
  248.         { }
  249.  
  250.         private void TbMode_Scroll(object sender, EventArgs e)
  251.         {
  252.  
  253.             switch (TbMode.Value)
  254.             {
  255.                 case 1: // Giants
  256.                     MultiplierMin = 1850;  
  257.                     MultiplierMax = 1300;  
  258.                     MaxStrengthGiants = 300;
  259.                     MinStrengthGiants = 30;
  260.                     MaxWeigthGiants = 125;
  261.                     MinWeigthGiants = 20;
  262.  
  263.                     TbHeight.Maximum = 225;
  264.                     TbHeight.Minimum = 100;
  265.                     TbHeight.Value = 170;
  266.                    
  267.                     lblMode.Text = "Giants";
  268.                     break;
  269.                 case 2: // Tigrissess
  270.                     MaxStrengthGiants = 250;
  271.                     MinStrengthGiants = 50;
  272.                     MaxWeigthGiants = 75;
  273.                     MinWeigthGiants = 25;
  274.                     MultiplierMin = 1350;
  275.                     MultiplierMax = 1050;
  276.  
  277.                     TbHeight.Maximum = 165;
  278.                     TbHeight.Minimum = 100;
  279.                     TbHeight.Value = 140;
  280.  
  281.                     lblMode.Text = "Giant Tigri";
  282.                     break;
  283.                 case 3: // Realistic
  284.                     MaxStrengthGiants = 250;
  285.                     MinStrengthGiants = 50;
  286.                     MaxWeigthGiants = 130;
  287.                     MinWeigthGiants = 30;
  288.                     MultiplierMin = 5000;
  289.                     MultiplierMax = 500;
  290.                    
  291.                     TbHeight.Maximum = 225;
  292.                     TbHeight.Minimum = 100;
  293.                     TbHeight.Value = 175;
  294.                     lblMode.Text = "Realistic giants";
  295.                     break;
  296.                 case 4: // Avina
  297.                     MaxStrengthGiants = 187;
  298.                     MinStrengthGiants = 185;
  299.                     MaxWeigthGiants = 63;
  300.                     MinWeigthGiants = 61;
  301.                     MultiplierMin = 4051;
  302.                     MultiplierMax = 4049;
  303.  
  304.                     TbHeight.Maximum = 179;
  305.                     TbHeight.Minimum = 177;
  306.                     TbHeight.Value = 178;
  307.                     lblMode.Text = "Avina ";
  308.                     break;
  309.             }
  310.  
  311.             TbStrength.Maximum = MaxStrengthGiants;
  312.             TbStrength.Minimum = MinStrengthGiants;
  313.             TbStrength.Value = (MaxStrengthGiants + MinStrengthGiants) / 2;
  314.  
  315.             TbWeight.Maximum = MaxWeigthGiants;
  316.             TbWeight.Minimum = MinWeigthGiants;
  317.             TbWeight.Value = (MaxWeigthGiants + MinWeigthGiants) / 2;
  318.  
  319.             TbMultiplier.Maximum = MultiplierMin;
  320.             TbMultiplier.Minimum = MultiplierMax;
  321.             TbMultiplier.Value = (MultiplierMin + MultiplierMax) / 2;
  322.         }
  323.  
  324.         private void Round_Click(object sender, EventArgs e)
  325.         {
  326.             Multiplier = TbMultiplier.Value;
  327.             Multiplier = Multiplier / 100;
  328.  
  329.             try
  330.             {
  331.                 RoundedMultiplier = Math.Round((double)Multiplier, 1, MidpointRounding.ToEven);
  332.  
  333.                 if (RoundedMultiplier == Multiplier)
  334.                     RoundedMultiplier = Math.Round((double)Multiplier, MidpointRounding.ToEven);
  335.  
  336.                 RoundedMultiplier = RoundedMultiplier * 100;
  337.  
  338.                 TbMultiplier.Value = Convert.ToInt32(RoundedMultiplier);
  339.             }
  340.             catch (ArgumentOutOfRangeException)
  341.             { }
  342.             PreviusValues = "" + TbMultiplier.Value + TbWeight.Value + TbStrength.Value + TbHeight.Value;
  343.             Activate.PerformClick();
  344.         }
  345.  
  346.         private void CB_SelectedIndexChanged(object sender, EventArgs e)
  347.         {
  348.  
  349.         }
  350.  
  351.         private void Form1_Load(object sender, EventArgs e)
  352.         {
  353.  
  354.         }
  355.  
  356.         private void timer_Tick(object sender, EventArgs e)
  357.         {
  358.             if (PreviusValues != ("" + TbMultiplier.Value + TbWeight.Value + TbStrength.Value + TbHeight.Value))
  359.             {
  360.                 PreviusValues = "" + TbMultiplier.Value + TbWeight.Value + TbStrength.Value + TbHeight.Value;
  361.                 Activate.PerformClick();
  362.             }
  363.         }
  364.     }
  365. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement