Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.93 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. using System.Media;
  11.  
  12. namespace MainForm
  13. {
  14. public partial class Form1 : Form
  15. {
  16. Random rnd = new Random();
  17. public static double buyprice1 = 1;
  18. public static double buyprice10 = 0;
  19. public static double smhp = 10;
  20. public static double gold = 0;
  21. public static double mhp = smhp;
  22. public static double attack = 1;
  23. public static int kill = 0;
  24. public string map = "";
  25. public void mob()
  26. {
  27. if (map == "Forest")
  28. {
  29. switch (rnd.Next(3))
  30. {
  31. case 0:
  32. Image myimage = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlers\Imp.png");
  33. this.pictureBox1.BackgroundImage = myimage;
  34. break;
  35. case 1:
  36. Image myimage2 = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlers\Behemoth.png");
  37. this.pictureBox1.BackgroundImage = myimage2;
  38. break;
  39. case 2:
  40. Image myimage3 = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlers\Delf_m.png");
  41. this.pictureBox1.BackgroundImage = myimage3;
  42. break;
  43. }
  44. }
  45. else if (map == "Crystal")
  46. {
  47. switch (rnd.Next(3))
  48. {
  49. case 0:
  50. Image myimage4 = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlers\Assassin.png");
  51. this.pictureBox1.BackgroundImage = myimage4;
  52. break;
  53. case 1:
  54. Image myimage5 = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlers\Captain.png");
  55. this.pictureBox1.BackgroundImage = myimage5;
  56. break;
  57. case 2:
  58. Image myimage6 = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlers\Cleric_f.png");
  59. this.pictureBox1.BackgroundImage = myimage6;
  60. break;
  61. }
  62. }
  63. }
  64. public void mapp()
  65. {
  66. switch (rnd.Next(2))
  67. {
  68. case 0:
  69. map = "Forest";
  70. Image back1 = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlebacks2\Forest2.png");
  71. this.BackgroundImage = back1;
  72. break;
  73. case 1:
  74. map = "Crystal";
  75. Image back2 = new Bitmap(@"D:\Projects\Iconscollection\Graphics\Battlebacks2\Crystal.png");
  76. this.BackgroundImage = back2;
  77. break;
  78. }
  79. }
  80. public Form1()
  81. {
  82. InitializeComponent();
  83. ExitBut.Hide();
  84. attacklab.Text = attack.ToString();
  85. mapp();
  86. mob();
  87. hplab.Text = String.Format("{0:F2}", mhp);
  88. Color Colour = ColorTranslator.FromHtml("#282c35");
  89. errorlab.BackColor = Colour;
  90. buyprice10 = buyprice1 * 1.1;
  91. for (int i = 1; i < 10; i++)
  92. {
  93. buyprice10 = buyprice10 * 1.1;
  94. }
  95. }
  96.  
  97. private void Form1_Load(object sender, EventArgs e)
  98. {
  99.  
  100. }
  101.  
  102. private void button1_Click_1(object sender, EventArgs e)
  103. {
  104.  
  105. }
  106.  
  107. private void ExitBut_Click(object sender, EventArgs e)
  108. {
  109. Environment.Exit(0);
  110. }
  111.  
  112. private void UpgradeBut_Click(object sender, EventArgs e)
  113. {
  114. ExitBut.Hide();
  115. autobut.Show();
  116. attackbut.Show();
  117. stealbut.Show();
  118. defbut.Show();
  119. autospeedbut.Show();
  120. }
  121.  
  122. private void InfoBut_Click_1(object sender, EventArgs e)
  123. {
  124. ExitBut.Hide();
  125. autobut.Hide();
  126. attackbut.Hide();
  127. stealbut.Hide();
  128. defbut.Hide();
  129. autospeedbut.Hide();
  130. buy1but.Hide();
  131. pricebut.Hide();
  132. buy10but.Hide();
  133. price10but.Hide();
  134. }
  135.  
  136. private void SetBut_Click(object sender, EventArgs e)
  137. {
  138. ExitBut.Show();
  139. autobut.Hide();
  140. attackbut.Hide();
  141. stealbut.Hide();
  142. defbut.Hide();
  143. autospeedbut.Hide();
  144. buy1but.Hide();
  145. pricebut.Hide();
  146. buy10but.Hide();
  147. price10but.Hide();
  148. }
  149.  
  150. private void pictureBox1_Click(object sender, EventArgs e)
  151. {
  152. mhp = (mhp - attack);
  153. if (mhp <= 0)
  154. {
  155. kill++;
  156. if (kill % 10 == 0)
  157. {
  158. mapp();
  159. }
  160. gold = gold + (kill * 5);
  161. mob();
  162. smhp = smhp * 1.1;
  163. mhp = smhp;
  164. if (gold >= 1000)
  165. {
  166. double thousand = gold / 1000;
  167. goldlab.Text = String.Format("{0:F2}", thousand)+"K";
  168. }
  169. else goldlab.Text = String.Format("{0:F2}", gold);
  170.  
  171. killlab.Text = kill.ToString();
  172. hplab.Text = String.Format("{0:F2}", mhp);
  173. }
  174. }
  175.  
  176. private void goldlab_Click(object sender, EventArgs e)
  177. {
  178.  
  179. }
  180.  
  181. private void killlab_Click(object sender, EventArgs e)
  182. {
  183.  
  184. }
  185.  
  186. private void buy1but_Click(object sender, EventArgs e)
  187. {
  188. errorlab.Text = "";
  189. if (gold >= buyprice1)
  190. {
  191. gold = gold - buyprice1;
  192. buyprice1 = buyprice1 * 1.1;
  193. if (gold>=1000000000)
  194. {
  195. double billion = gold / 1000000000;
  196. goldlab.Text = String.Format("{0:F2}", billion) + "B";
  197. }
  198. else if (gold>=1000000)
  199. {
  200. double million = gold / 1000000;
  201. goldlab.Text = String.Format("{0:F2}", million) + "M";
  202. }
  203. else if (gold >= 1000)
  204. {
  205. double thousand = gold / 1000;
  206. goldlab.Text = String.Format("{0:F2}", thousand) + "K";
  207. }
  208. else goldlab.Text = String.Format("{0:F2}", gold);
  209. attack = attack * 1.09999;
  210. attacklab.Text = String.Format("{0:F2}", attack);
  211. if (buyprice1 >= 1000000000)
  212. {
  213. double billion = buyprice1 / 1000000000;
  214. pricebut.Text = String.Format("{0:F2}", billion) + "B";
  215. }
  216. else if (buyprice1 >= 1000000)
  217. {
  218. double million = buyprice1/ 1000000;
  219. pricebut.Text = String.Format("{0:F2}", million) + "M";
  220. }
  221. else if (buyprice1 >= 1000)
  222. {
  223. double thousand = buyprice1 / 1000;
  224. pricebut.Text = String.Format("{0:F2}", thousand) + "K";
  225. }
  226. else pricebut.Text = String.Format("{0:F2}", buyprice1);
  227. }
  228. else
  229. {
  230. errorlab.Text = "Not Enough Gold";
  231. errorlab.Show();
  232. }
  233.  
  234. }
  235.  
  236. private void attackbut_Click(object sender, EventArgs e)
  237. {
  238. buy1but.Show();
  239. pricebut.Show();
  240. price10but.Show();
  241. buy10but.Show();
  242. if (buyprice1 >= 1000000000)
  243. {
  244. double billion = buyprice1 / 1000000000;
  245. pricebut.Text = String.Format("{0:F2}", billion) + "B";
  246. }
  247. else if (buyprice1 >= 1000000)
  248. {
  249. double million = buyprice1 / 1000000;
  250. pricebut.Text = String.Format("{0:F2}", million) + "M";
  251. }
  252. else if (buyprice1 >= 1000)
  253. {
  254. double thousand = buyprice1 / 1000;
  255. pricebut.Text = String.Format("{0:F2}", thousand) + "K";
  256. }
  257. else pricebut.Text = String.Format("{0:F2}", buyprice1);
  258. if (buyprice10 >= 1000000000)
  259. {
  260. double billion = buyprice10 / 1000000000;
  261. price10but.Text = String.Format("{0:F2}", billion) + "B";
  262. }
  263. else if (buyprice10 >= 1000000)
  264. {
  265. double million = buyprice10 / 1000000;
  266. price10but.Text = String.Format("{0:F2}", million) + "M";
  267. }
  268. else if (buyprice10 >= 1000)
  269. {
  270. double thousand = buyprice10 / 1000;
  271. price10but.Text = String.Format("{0:F2}", thousand) + "K";
  272. }
  273. else price10but.Text = String.Format("{0:F2}", buyprice10);
  274. }
  275.  
  276. private void UI_Click(object sender, EventArgs e)
  277. {
  278.  
  279. }
  280.  
  281. private void buy10but_Click(object sender, EventArgs e)
  282. {
  283. errorlab.Text = "";
  284. if (gold >= buyprice10)
  285. {
  286. gold = gold - buyprice10;
  287. buyprice1 = buyprice10 * 1.1;
  288. buyprice10 = buyprice1 * 1.1;
  289. for (int i = 0; i < 9; i++)
  290. {
  291. buyprice10 = buyprice10 * 1.1;
  292. }
  293. if (gold >= 1000000000)
  294. {
  295. double billion = gold / 1000000000;
  296. goldlab.Text = String.Format("{0:F2}", billion) + "B";
  297. }
  298. else if (gold >= 1000000)
  299. {
  300. double million = gold / 1000000;
  301. goldlab.Text = String.Format("{0:F2}", million) + "M";
  302. }
  303. else if (gold >= 1000)
  304. {
  305. double thousand = gold / 1000;
  306. goldlab.Text = String.Format("{0:F2}", thousand) + "K";
  307. }
  308. else goldlab.Text = String.Format("{0:F2}", gold);
  309. for (int i = 0; i < 10; i++)
  310. {
  311. attack = attack * 1.099;
  312. }
  313. attacklab.Text = String.Format("{0:F2}", attack);
  314. if (buyprice10 >= 1000000000)
  315. {
  316. double billion = buyprice10 / 1000000000;
  317. price10but.Text = String.Format("{0:F2}", billion) + "B";
  318. }
  319. else if (buyprice10 >= 1000000)
  320. {
  321. double million = buyprice10 / 1000000;
  322. price10but.Text = String.Format("{0:F2}", million) + "M";
  323. }
  324. else if (buyprice10 >= 1000)
  325. {
  326. double thousand = buyprice10 / 1000;
  327. price10but.Text = String.Format("{0:F2}", thousand) + "K";
  328. }
  329. else price10but.Text = String.Format("{0:F2}", buyprice10);
  330. if (buyprice1 >= 1000000000)
  331. {
  332. double billion = buyprice1 / 1000000000;
  333. pricebut.Text = String.Format("{0:F2}", billion) + "B";
  334. }
  335. else if (buyprice1 >= 1000000)
  336. {
  337. double million = buyprice1 / 1000000;
  338. pricebut.Text = String.Format("{0:F2}", million) + "M";
  339. }
  340. else if (buyprice1 >= 1000)
  341. {
  342. double thousand = buyprice1 / 1000;
  343. pricebut.Text = String.Format("{0:F2}", thousand) + "K";
  344. }
  345. else pricebut.Text = String.Format("{0:F2}", buyprice1);
  346.  
  347. }
  348. else
  349. {
  350. errorlab.Text = "Not Enough Gold";
  351. errorlab.Show();
  352. }
  353. }
  354. }
  355. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement