Advertisement
sondrex76

Vampire stats v2.0

Nov 21st, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 22.86 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 Demonic_Vampire_Stats_v2._0
  12. {
  13.     public partial class Demonic_Vampire_Stats : Form
  14.     {
  15.         public double Species { get; set; }
  16.         public string Race { get; set; }
  17.         public double Age { get; set; }
  18.         public double State { get; set; }
  19.         public double Blood { get; set; }
  20.         public double BloodHealing { get; set; }
  21.         public double MinStrength { get; set; }
  22.         public double MinHealing { get; set; }
  23.         public double MinSight { get; set; }
  24.         public double MinHearing { get; set; }
  25.         public double MinSmell { get; set; }
  26.         public double MaxStrength { get; set; }
  27.         public double MaxHealing { get; set; }
  28.         public double MaxSight { get; set; }
  29.         public double MaxHearing { get; set; }
  30.         public double MaxSmell { get; set; }
  31.         public double CurrentStrength { get; set; }
  32.         public double CurrentHealing { get; set; }
  33.         public double CurrentSight { get; set; }
  34.         public double CurrentHearing { get; set; }
  35.         public double CurrentSmell { get; set; }
  36.         public string Changed { get; set; }
  37.         public int StrengthDivider { get; set; }
  38.         public int HealingDivider { get; set; }
  39.         public double SensesDivider { get; set; }
  40.         public double CompMultDiv { get; set; }
  41.         public double EquationComp { get; set; }
  42.         public double Squared { get; set; }
  43.         public double MultDiv { get; set; }
  44.         public double Level { get; set; }
  45.         public double StageMultStrength { get; set; }
  46.         public double StageMultHealing { get; set; }
  47.         public double MultStrength { get; set; }
  48.         public double MultHealing { get; set; }
  49.         public double FirstState { get; set; }
  50.         public double BloodMin { get; set; }
  51.         public double BloodMax { get; set; }
  52.         public double NormalBlood { get; set; }
  53.         public double BloodValue { get; set; }
  54.         public double BloodStage { get; set; }
  55.         public double BloodCrazed { get; set; }
  56.         public int Decimals { get; set; }
  57.         public double Procent { get; set; }
  58.         public bool Change { get; set; }
  59.         public double HalfTime { get; set; }
  60.  
  61.         public Demonic_Vampire_Stats()
  62.         {
  63.             InitializeComponent();
  64.             StrengthDivider = 5;
  65.             HealingDivider = 10;
  66.             SensesDivider = 13.333333;
  67.             Decimals = 2;
  68.         }
  69.         // Note: Blood min must be replaced by values based on logic(firt iteration already integrated).
  70.         private void Timer_Tick(object sender, EventArgs e)
  71.         {
  72.             if (Changed != txtAge.Text + txtBlood.Text + Tbspecies.Value + TbState.Value + RbDaysBloodless.Checked + Change)
  73.             {
  74.                 try
  75.                 {
  76.                     Age = double.Parse(txtAge.Text);
  77.  
  78.                     if (Age >= 0 && !String.IsNullOrEmpty(txtAge.Text) && double.Parse(txtBlood.Text) >= 0)
  79.                     {
  80.                         switch (Tbspecies.Value)
  81.                         {
  82.                             case 9:
  83.                                 MinStrength = 1500;
  84.                                 MinHealing = 1000;
  85.                                 MinHearing = 1000;
  86.                                 MinSight = 1000;
  87.                                 MinSmell = 1000;
  88.                                 MaxStrength = 1500;
  89.                                 MaxHealing = 1000;
  90.                                 MaxHearing = 1000;
  91.                                 MaxSight = 1000;
  92.                                 MaxSmell = 5000;
  93.                                 EquationComp = 1;
  94.                                 Squared = 1;
  95.                                 CompMultDiv = 1;
  96.                                 FirstState = 10;
  97.                                 BloodMax = 1;
  98.                                 Race = "Vezerak The Demon God of Vampires";
  99.                                 break;
  100.                             case 8:
  101.                                 MinStrength = 60;
  102.                                 MinHealing = 75;
  103.                                 MinHearing = 15;
  104.                                 MinSight = 80;
  105.                                 MinSmell = 90;
  106.                                 MaxStrength = 1200;
  107.                                 MaxHealing = 375;
  108.                                 MaxHearing = 60;
  109.                                 MaxSight = 400;
  110.                                 MaxSmell = 1200;
  111.                                 EquationComp = 750;
  112.                                 Squared = 3;
  113.                                 CompMultDiv = 150;
  114.                                 FirstState = 6;
  115.                                 NormalBlood = 8;
  116.                                 BloodMin = 0.005;
  117.                                 BloodMax = 10;
  118.                                 Race = "Vampire God";
  119.                                 break;
  120.                             case 7:
  121.                                 MinStrength = 30;
  122.                                 MinHealing = 50;
  123.                                 MinHearing = 12;
  124.                                 MinSight = 70;
  125.                                 MinSmell = 60;
  126.                                 MaxStrength = 450;
  127.                                 MaxHealing = 250;
  128.                                 MaxHearing = 48;
  129.                                 MaxSight = 280;
  130.                                 MaxSmell = 600;
  131.                                 EquationComp = 700;
  132.                                 Squared = 2.75;
  133.                                 CompMultDiv = 125;
  134.                                 FirstState = 4;
  135.                                 NormalBlood = 5;
  136.                                 BloodMin = 0.001;
  137.                                 BloodMax = 8;
  138.                                 Race = "Trueborn";
  139.                                 break;
  140.                             case 6:
  141.                                 MinStrength = 20;
  142.                                 MinHealing = 40;
  143.                                 MinHearing = 10;
  144.                                 MinSight = 60;
  145.                                 MinSmell = 50;
  146.                                 MaxStrength = 300;
  147.                                 MaxHealing = 200;
  148.                                 MaxHearing = 40;
  149.                                 MaxSight = 240;
  150.                                 MaxSmell = 300;
  151.                                 EquationComp = 650;
  152.                                 Squared = 2.5;
  153.                                 CompMultDiv = 100;
  154.                                 FirstState = 3;
  155.                                 NormalBlood = 4;
  156.                                 BloodMin = 0.0002;
  157.                                 BloodMax = 6.5;
  158.                                 Race = "Pureblood";
  159.                                 break;
  160.                             case 5:
  161.                                 MinStrength = 15;
  162.                                 MinHealing = 25;
  163.                                 MinHearing = 8;
  164.                                 MinSight = 50;
  165.                                 MinSmell = 40;
  166.                                 MaxStrength = 180;
  167.                                 MaxHealing = 125;
  168.                                 MaxHearing = 32;
  169.                                 MaxSight = 200;
  170.                                 MaxSmell = 240;
  171.                                 EquationComp = 600;
  172.                                 Squared = 2.25;
  173.                                 CompMultDiv = 75;
  174.                                 FirstState = 2.5;
  175.                                 NormalBlood = 3;
  176.                                 BloodMin = 0.0001;
  177.                                 BloodMax = 5;
  178.                                 Race = "Strong Firstborn";
  179.                                 break;
  180.                             case 4:
  181.                                 MinStrength = 10;
  182.                                 MinHealing = 20;
  183.                                 MinHearing = 7;
  184.                                 MinSight = 45;
  185.                                 MinSmell = 30;
  186.                                 MaxStrength = 120;
  187.                                 MaxHealing = 100;
  188.                                 MaxHearing = 28;
  189.                                 MaxSight = 180;
  190.                                 MaxSmell = 180;
  191.                                 EquationComp = 600;
  192.                                 Squared = 2.25;
  193.                                 CompMultDiv = 75;
  194.                                 FirstState = 2.5;
  195.                                 NormalBlood = 3;
  196.                                 BloodMin = 0.0001;
  197.                                 BloodMax = 5;
  198.                                 Race = "Firstborn";
  199.                                 break;
  200.                             case 3:
  201.                                 MinStrength = 7.5;
  202.                                 MinHealing = 15;
  203.                                 MinHearing = 6;
  204.                                 MinSight = 40;
  205.                                 MinSmell = 20;
  206.                                 MaxStrength = 75;
  207.                                 MaxHealing = 75;
  208.                                 MaxHearing = 24;
  209.                                 MaxSight = 120;
  210.                                 MaxSmell = 120;
  211.                                 EquationComp = 550;
  212.                                 Squared = 2;
  213.                                 CompMultDiv = 66.666666666;
  214.                                 FirstState = 2;
  215.                                 NormalBlood = 2;
  216.                                 BloodMin = 0.00002;
  217.                                 BloodMax = 4;
  218.                                 Race = "Strong Secondborn";
  219.                                 break;
  220.                             case 2:
  221.                                 MinStrength = 5;
  222.                                 MinHealing = 10;
  223.                                 MinHearing = 5;
  224.                                 MinSight = 35;
  225.                                 MinSmell = 15;
  226.                                 MaxStrength = 50;
  227.                                 MaxHealing = 50;
  228.                                 MaxHearing = 20;
  229.                                 MaxSight = 105;
  230.                                 MaxSmell = 90;
  231.                                 EquationComp = 550;
  232.                                 Squared = 2;
  233.                                 CompMultDiv = 66.666666666;
  234.                                 FirstState = 2;
  235.                                 NormalBlood = 2;
  236.                                 BloodMin = 0.00002;
  237.                                 BloodMax = 4;
  238.                                 Race = "Secondborn";
  239.                                 break;
  240.                             case 1:
  241.                                 MinStrength = 3.75;
  242.                                 MinHealing = 7.5;
  243.                                 MinHearing = 4;
  244.                                 MinSight = 33.333333;
  245.                                 MinSmell = 10;
  246.                                 MaxStrength = 30;
  247.                                 MaxHealing = 37.5;
  248.                                 MaxHearing = 16;
  249.                                 MaxSight = 100;
  250.                                 MaxSmell = 60;
  251.                                 EquationComp = 250;
  252.                                 Squared = 1.75;
  253.                                 CompMultDiv = 50;
  254.                                 FirstState = 1.666666666;
  255.                                 NormalBlood = 1.5;
  256.                                 BloodMin = 0.0000025;
  257.                                 BloodMax = 3.5;
  258.                                 Race = "Strong WeakBlood";
  259.                                 break;
  260.                             case 0:
  261.                                 MinStrength = 2.5;
  262.                                 MinHealing = 5;
  263.                                 MinHearing = 3;
  264.                                 MinSight = 30;
  265.                                 MinSmell = 7.5;
  266.                                 MaxStrength = 20;
  267.                                 MaxHealing = 25;
  268.                                 MaxHearing = 12;
  269.                                 MaxSight = 90;
  270.                                 MaxSmell = 45;
  271.                                 EquationComp = 250;
  272.                                 Squared = 1.75;
  273.                                 CompMultDiv = 50;
  274.                                 FirstState = 1.666666666;
  275.                                 NormalBlood = 1.5;
  276.                                 BloodMin = 0.0000025;
  277.                                 BloodMax = 3.5;
  278.                                 Race = "WeakBlood";
  279.                                 break;
  280.                         }
  281.  
  282.                         if (Change == true)
  283.                         {
  284.                             if (RbBloodAmount.Checked == true)
  285.                             {
  286.                                 lblBlood.Text = "L/Day";
  287.                                 if (double.Parse(txtBlood.Text) == NormalBlood || double.Parse(txtBlood.Text) == 0)
  288.                                     txtBlood.Text = "" + NormalBlood;
  289.                                 Decimals = 2;
  290.                             }
  291.                             else
  292.                             {
  293.                                 lblBlood.Text = "Days";
  294.                                 txtBlood.Text = "" + 0;
  295.                                 Decimals = 5;
  296.                             }
  297.                         }
  298.                         Change = false;
  299.  
  300.                         CurrentStrength = MinStrength;
  301.                         CurrentHealing = MinHealing;
  302.                         CurrentSight = MinSight;
  303.                         CurrentSmell = MinSmell;
  304.                         CurrentHearing = MinHearing;
  305.  
  306.                         if (Age >= 100000000000)
  307.                         {
  308.                             CurrentStrength = MaxStrength;
  309.                             CurrentHealing = MaxHealing;
  310.                             MultDiv = 1;
  311.                             CurrentSight = MaxSight;
  312.                             CurrentSmell = MaxSmell;
  313.                             CurrentHearing = MaxHearing;
  314.                         }
  315.                         else
  316.                         {
  317.                             Level = Age / EquationComp;
  318.                             Level = (System.Math.Pow(Level, (1.0 / Squared)));
  319.  
  320.                             if (Level >= CompMultDiv)
  321.                             {
  322.                                 MultDiv = 1;
  323.                             }
  324.                             else
  325.                             {
  326.                                 MultDiv = (CompMultDiv / (Level));
  327.                             }
  328.  
  329.                             for (Level = Level; Level >= 1; Level--)
  330.                             {
  331.                                 CurrentStrength = CurrentStrength + ((MaxStrength - CurrentStrength) / StrengthDivider);
  332.                                 CurrentHealing = CurrentHealing + ((MaxHealing - CurrentHealing) / HealingDivider);
  333.                                 CurrentSight = CurrentSight + ((MaxSight - CurrentSight) / SensesDivider);
  334.                                 CurrentSmell = CurrentSmell + ((MaxSmell - CurrentSmell) / SensesDivider);
  335.                                 CurrentHearing = CurrentHearing + ((MaxHearing - CurrentHearing) / SensesDivider);
  336.                             }
  337.  
  338.                             for (Level = Level; Level > 0 && Level < 1; Level = 0)
  339.                             {
  340.                                 CurrentStrength = CurrentStrength + (((MaxStrength - CurrentStrength) / StrengthDivider) * Level);
  341.                                 CurrentHealing = CurrentHealing + (((MaxHealing - CurrentHealing) / HealingDivider) * Level);
  342.                                 CurrentSight = CurrentSight + (((MaxSight - CurrentSight) / SensesDivider) * Level);
  343.                                 CurrentSmell = CurrentSmell + (((MaxSmell - CurrentSmell) / SensesDivider) * Level);
  344.                                 CurrentHearing = CurrentHearing + (((MaxHearing - CurrentHearing) / SensesDivider) * Level);
  345.                             }
  346.                         }
  347.  
  348.                         MultStrength = (1 + ((CurrentStrength - MinStrength) / (MaxStrength - MinStrength)) / MultDiv); // Multiplier multiplier strength
  349.  
  350.                         MultHealing = (1 + ((CurrentHealing - MinHealing) / (MaxHealing - MinHealing)) / MultDiv); // Multiplier multiplier healing
  351.  
  352.                         StageMultStrength = 1;
  353.  
  354.                         if (Tbspecies.Value != 9)
  355.                         {
  356.                             switch (TbState.Value)
  357.                             {
  358.                                 case 1:
  359.                                     StageMultStrength = 1;
  360.                                     StageMultHealing = 1;
  361.                                     break;
  362.                                 case 2:
  363.                                     StageMultStrength = FirstState;
  364.                                     StageMultHealing = 1 + ((MultStrength - 1) / 3);
  365.                                     break;
  366.                                 case 3:
  367.                                     StageMultStrength = FirstState * 1.5;
  368.                                     StageMultHealing = 1 + ((MultStrength - 1) / 3);
  369.                                     break;
  370.                                 case 4:
  371.                                     StageMultStrength = FirstState * 2.25;
  372.                                     StageMultHealing = 1 + ((MultStrength - 1) / 3);
  373.                                     break;
  374.                                 case 5:
  375.                                     StageMultStrength = FirstState * 4.5;
  376.                                     StageMultHealing = 1 + ((StageMultStrength - 1) / 3);
  377.                                     break;
  378.                             }
  379.                         }
  380.                         else
  381.                         {
  382.                                 MultStrength = 1;
  383.  
  384.                                 for (State = TbState.Value; State >= 2; State--)
  385.                                 {
  386.                                     MultStrength = MultStrength * 10;
  387.                                 }
  388.                                 MultHealing = MultStrength;
  389.                         }
  390.  
  391.                         BloodValue = 1;
  392.                         Blood = double.Parse(txtBlood.Text);
  393.  
  394.                         if (Blood < (NormalBlood * 10000))
  395.                         {
  396.                             if (RbBloodAmount.Checked == true)
  397.                             {
  398.                                 BloodStage = double.Parse(txtBlood.Text) / NormalBlood;
  399.  
  400.                                 if (Blood >= NormalBlood)
  401.                                 {
  402.                                     for (BloodStage = BloodStage; BloodStage >= 2; BloodStage--)
  403.                                     {
  404.                                         BloodValue = BloodValue + ((BloodMax - BloodValue) / 5);
  405.                                     }
  406.  
  407.                                     if (BloodStage > 1 && BloodStage < 2)
  408.                                     {
  409.                                         BloodValue = BloodValue + (((BloodMax - BloodValue) / 5) * BloodStage);
  410.                                     }
  411.  
  412.                                     BloodHealing = 1 + (BloodValue - 1) / 3;
  413.                                 }
  414.                                 else
  415.                                 {
  416.                                     BloodHealing = BloodValue = BloodMin + (Blood / NormalBlood);
  417.                                 }
  418.  
  419.                                 lblBlood.Text = "L/Day";
  420.                             }
  421.                             else
  422.                             {
  423.                                 HalfTime = NormalBlood * 2;
  424.                                 Procent = 10;
  425.  
  426.                                 for (BloodStage = Blood / HalfTime; BloodStage >= 1; BloodStage--)
  427.                                 {
  428.                                     BloodValue = BloodMin + BloodValue / 1.2;
  429.                                     BloodValue = Math.Round(BloodValue, Decimals);
  430.                                 }
  431.  
  432.                                 if (BloodStage < 1 && BloodStage > 0)
  433.                                 {
  434.                                     BloodValue = BloodMin + BloodValue / (1 + (0.2 * BloodStage));
  435.                                     BloodValue = Math.Round(BloodValue, Decimals);
  436.                                 }
  437.  
  438.                                 BloodHealing = BloodValue;
  439.                                 lblBlood.Text = "Days";
  440.                             }
  441.                         }
  442.                         else
  443.                         {
  444.                             if (RbBloodAmount.Checked == true)
  445.                             {
  446.                                 BloodValue = BloodMax;
  447.                             }
  448.                             else
  449.                             {
  450.                                 BloodValue = BloodMin;
  451.                             }
  452.                         }
  453.  
  454.                             CurrentStrength = CurrentStrength * MultStrength * BloodValue * StageMultStrength; // Strength
  455.                             CurrentHealing = CurrentHealing * MultHealing * BloodHealing * StageMultHealing; // Healing
  456.  
  457.                         CurrentStrength = Math.Round(CurrentStrength, Decimals);
  458.                         CurrentHealing = Math.Round(CurrentHealing, Decimals);
  459.                         CurrentSight = Math.Round(CurrentSight, 2);
  460.                         CurrentSmell = Math.Round(CurrentSmell, 2);
  461.                         CurrentHearing = Math.Round(CurrentHearing, 2);
  462.                     }
  463.  
  464.                     lblInfo.Text = "Info:\nRace: " + Race;
  465.                     lblInfo.Text += "\nStrength: " + CurrentStrength;
  466.                     lblInfo.Text += "\nHealing: " + CurrentHealing;
  467.                     lblInfo.Text += "\nSight: " + CurrentSight;
  468.                     lblInfo.Text += "\nSmell: " + CurrentSmell;
  469.                     lblInfo.Text += "\nHearing: " + CurrentHearing;
  470.                     //lblInfo.Text += "\nBlood: " + Procent;
  471.                     //lblInfo.Text += "\nBloodValue: " + BloodValue;
  472.                 }
  473.                 catch (FormatException)
  474.                 { }
  475.  
  476.                 Changed = txtAge.Text + txtBlood.Text + Tbspecies.Value + TbState.Value + RbDaysBloodless.Checked + Change;
  477.             }
  478.         }
  479.         private void RbDaysBloodless_CheckedChanged(object sender, EventArgs e)
  480.         {
  481.             Change = true;
  482.         }
  483.         private void Tbspecies_Scroll(object sender, EventArgs e)
  484.         {
  485.             Change = true;
  486.         }
  487.     }
  488. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement