Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.99 KB | None | 0 0
  1.  
  2. package GameGradle;
  3.  
  4.  
  5. import java.awt.Color;
  6. import java.awt.Container;
  7. import javax.swing.JFrame;
  8. import javax.swing.JLabel;
  9. import javax.swing.JPanel;
  10. import java.awt.Font;
  11. import java.awt.GridLayout;
  12. import java.awt.event.ActionEvent;
  13. import java.awt.event.ActionListener;
  14. import javax.swing.JButton;
  15. import javax.swing.JTextArea;
  16.  
  17. public class GameClassMain {
  18. JFrame gui;
  19. Container con;
  20. JPanel titleNamePanel, startButtonPanel, mainTextPanel, choiceButtonPanel, playerPanel;
  21. JLabel titleNameLabel, hpLabel, hpLabelNumber, weaponLabel, weaponLabelName;
  22. Font fontTitle = new Font("Times new Roman", Font.PLAIN,90);
  23. Font normalFont = new Font("Times new Roman", Font.PLAIN,30);
  24. JButton startButton, BTA,BTB,BTC,BTD;
  25. JTextArea mainTextArea;
  26. int yourHP, EnemyHP, playerPots = 3,potHeal, killRequirement;
  27. String weapon, position;
  28.  
  29. ChoiceHandler choicehandler = new ChoiceHandler ();
  30.  
  31. public GameClassMain() {
  32. gui = new JFrame();
  33. gui.setSize(800, 600);
  34. gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  35. gui.getContentPane().setBackground(Color.BLACK);
  36. gui.setLayout(null);
  37. gui.setVisible(true);
  38. gui.setResizable(false);
  39. gui.setLocationRelativeTo(null);
  40. con = gui.getContentPane();
  41.  
  42. titleNamePanel = new JPanel();
  43. titleNamePanel.setBounds(100,100,600,150);
  44. titleNamePanel.setBackground(Color.black);
  45. titleNameLabel = new JLabel("WOLFWIND");
  46. titleNameLabel.setForeground(Color.white);
  47. titleNameLabel.setFont(fontTitle);
  48.  
  49. startButtonPanel = new JPanel();
  50. startButtonPanel.setBounds(300,400,200,100);
  51. startButtonPanel.setBackground(Color.black);
  52.  
  53. startButton = new JButton ("START");
  54. startButton.setBackground(Color.black);
  55. startButton.setForeground(Color.white);
  56. startButton.setFont(normalFont);
  57. startButton.setFocusPainted(false);
  58.  
  59. titleNamePanel.add(titleNameLabel);
  60. startButtonPanel.add(startButton);
  61.  
  62. con.add(titleNamePanel);
  63. con.add(startButtonPanel);
  64. startButton.addActionListener(new ActionListener(){
  65.  
  66.  
  67. public void actionPerformed(ActionEvent event ){
  68.  
  69. createGameScreen();
  70. }
  71.  
  72.  
  73. public void createGameScreen(){
  74.  
  75.  
  76.  
  77.  
  78. titleNamePanel.setVisible(false);
  79. startButtonPanel.setVisible(false);
  80.  
  81. mainTextPanel = new JPanel ();
  82. mainTextPanel.setBounds(100,100,600,250);
  83. mainTextPanel.setBackground(Color.black);
  84. con.add(mainTextPanel);
  85.  
  86. mainTextArea = new JTextArea("Main text area test");
  87. mainTextArea.setBounds(100, 100, 600, 250);
  88. mainTextArea.setBackground(Color.black);
  89. mainTextArea.setForeground(Color.white);
  90. mainTextArea.setFont(normalFont);
  91. mainTextArea.setLineWrap(true);
  92. mainTextPanel.add(mainTextArea);
  93.  
  94. choiceButtonPanel = new JPanel ();
  95. choiceButtonPanel.setBounds(250,350,300,150);
  96. choiceButtonPanel.setBackground(Color.black);
  97. choiceButtonPanel.setLayout(new GridLayout(4,1));
  98. con.add(choiceButtonPanel);
  99.  
  100. BTA = new JButton("Choice 1");
  101. BTA.setBackground(Color.black);
  102. BTA.setForeground(Color.white);
  103. BTA.setFont(normalFont);
  104. BTA.setFocusPainted(false);
  105. BTA.addActionListener(new ChoiceHandler());
  106. BTA.setActionCommand("BT-A");
  107. choiceButtonPanel.add(BTA);
  108.  
  109. BTB = new JButton("Choice 2");
  110. BTB.setBackground(Color.black);
  111. BTB.setForeground(Color.white);
  112. BTB.setFont(normalFont);
  113. BTB.setFocusPainted(false);
  114. BTB.addActionListener(new ChoiceHandler());
  115. BTB.setActionCommand("BT-B");
  116. choiceButtonPanel.add(BTB);
  117.  
  118. BTC = new JButton("Choice 3");
  119. BTC.setBackground(Color.black);
  120. BTC.setForeground(Color.white);
  121. BTC.setFont(normalFont);
  122. BTC.setFocusPainted(false);
  123. BTC.addActionListener(new ChoiceHandler());
  124. BTC.setActionCommand("BT-C");
  125. choiceButtonPanel.add(BTC);
  126.  
  127. BTD = new JButton("Choice 4");
  128. BTD.setBackground(Color.black);
  129. BTD.setForeground(Color.white);
  130. BTD.setFont(normalFont);
  131. BTD.setFocusPainted(false);
  132. BTD.addActionListener(new ChoiceHandler());
  133. BTD.setActionCommand("BT-D");
  134. choiceButtonPanel.add(BTD);
  135.  
  136. playerPanel = new JPanel();
  137. playerPanel.setBounds(100,15,600,50);
  138. playerPanel.setBackground(Color.black);
  139. playerPanel.setLayout(new GridLayout(1,4));
  140. con.add(playerPanel);
  141. hpLabel = new JLabel("HP: ");
  142. hpLabel.setFont(normalFont);
  143. hpLabel.setForeground(Color.white);
  144. playerPanel.add(hpLabel);
  145. hpLabelNumber = new JLabel ();
  146. hpLabelNumber.setFont(normalFont);
  147. hpLabelNumber.setForeground(Color.white);
  148. playerPanel.add(hpLabelNumber);
  149. weaponLabel = new JLabel ("Weapon :");
  150. weaponLabel.setFont(normalFont);
  151. weaponLabel.setForeground(Color.white);
  152. playerPanel.add(weaponLabel);
  153. weaponLabelName = new JLabel();
  154. weaponLabelName.setFont(normalFont);
  155. weaponLabelName.setForeground(Color.white);
  156. playerPanel.add(weaponLabelName);
  157.  
  158. playerSetup();
  159. }
  160. public void playerSetup(){
  161. yourHP = 100;
  162. weapon = "None";
  163. weaponLabelName.setText(weapon);
  164. hpLabelNumber.setText("" + yourHP);
  165.  
  166. introA();
  167. }
  168.  
  169. public void introA(){
  170. mainTextArea.setText("Welome to Wolfwind!");
  171. position = "introA";
  172. BTA.setText(">");
  173. BTB.setText("");
  174. BTC.setText("");
  175. BTD.setText("");
  176. }
  177. public void introB(){
  178. mainTextArea.setText("You have been summond into another world");
  179. position = "introB";
  180. BTA.setText(">");
  181. BTB.setText("");
  182. BTC.setText("");
  183. BTD.setText("");
  184. }
  185.  
  186. //divider//Action listener Bracketting//
  187. class ChoiceHandler implements ActionListener{
  188. @Override
  189. public void actionPerformed(ActionEvent e ){
  190.  
  191.  
  192. String urChoice = event.getActionCommand;
  193.  
  194.  
  195.  
  196. switch (position){
  197. case "introA" : {
  198. switch (urChoice){
  199. case "BT-A" : introB();
  200.  
  201. case "introB" : {
  202. switch(urChoice){
  203. case "BT-A" : introC();
  204.  
  205.  
  206. }
  207. }
  208. case "introC" : {
  209. switch (urChoice){
  210. case "BT-A" : introD();
  211. }
  212. }
  213.  
  214. case "introD" :{
  215. switch (urChoice){
  216. case "BT-A" : introE();
  217. }
  218. }
  219. case "introE" :{
  220. switch (urChoice){
  221. case "BT-A" : Shield();
  222. case "BT-B" : Sword();
  223. case "BT-C" : Shield();
  224. case "BT-D" : Bow();
  225. }
  226. }
  227. case "ready" :{
  228. switch (urChoice){
  229. case "BT-A" : fightReady();
  230. case "BT-B" : ready();
  231. }
  232. }
  233. case "fightReady" :{
  234. switch (urChoice){
  235. case "BT-A" : IntroGobta();
  236. }
  237. }
  238. case "IntroGobta" :{
  239. switch (urChoice){
  240. case "BT-A" : IntroGobta();
  241. }
  242. }
  243. case "GobtaFight" :{
  244. switch (urChoice){
  245. case "BT-A" : playerAttackdefault();
  246. case "BT-B" : playerHeal();
  247. }
  248.  
  249. }
  250. case "playerAttack" :{
  251. switch(urChoice){
  252. case"BT-A" : if(EnemyHP < 1){
  253. win();
  254. }else{
  255. GobtaAttack();
  256. }
  257. case"BT-B" : playerHeal();
  258. }
  259. }
  260. case "GobtaAttack" :{
  261. switch (urChoice){
  262. case"BT-A" :
  263. if (yourHP < 1){
  264. lose();
  265. }else{
  266. GobtaFite();
  267. }
  268.  
  269. case"BT-B": playerHeal();
  270. }
  271. }
  272. case "win" :{
  273. switch(urChoice){
  274. case "BT-A" : equip1();
  275. }
  276. }
  277. case "equip1" : {
  278. switch(urChoice){
  279. case "BT-A":
  280. if("Sword".equals(weapon)){
  281. equip1A();
  282. } else{
  283. equip1B();
  284. }
  285. case "BT-B": arc1();
  286.  
  287. }
  288. }
  289. case "equip1A" :{
  290. switch(urChoice){
  291. case "BT-A" : arc1();
  292. }
  293. }
  294. case "equip1B" : {
  295. switch (urChoice){
  296. case "BT-A" : arc1();
  297. }
  298. }
  299. case"arc1" : {
  300. switch (urChoice){
  301. case "BT-A": arc1A();
  302. }
  303. }
  304. case"arc1A" :{
  305. switch (urChoice){
  306. case "BT-A" : arc1B();
  307. }
  308. } //dito na nag eedit kung saan patungo yung button mo and codes
  309. case "arc1B" :{
  310. switch (urChoice){
  311. case "BT-A" : arc1C();
  312. case "BT-B" : arc1B();
  313. }
  314. }
  315. case "arc1C" :{
  316. switch (urChoice){
  317. case "BT-A" : arc1D();
  318. }
  319. }
  320. case "arc1D" :{
  321. switch (urChoice){
  322. case "BT-A" : arc1E();
  323. }
  324. }
  325. case "arc1E" :{
  326. switch (urChoice){
  327. case "BT-A" : arc1F();
  328. }
  329. }
  330. case "arc1F" : {
  331. switch (urChoice){
  332. case "BT-A" : arc1G();
  333. }
  334. }
  335. case "arc1G" : {
  336. switch (urChoice){
  337. case "BT-A" : arc1H();
  338. }
  339. }
  340. case "arc1H" :{
  341. switch (urChoice){
  342. case "BT-A" : arc1I();
  343. }
  344. }
  345. case "arc1I" :{
  346. switch (urChoice){
  347. case "BT-A" : arc1J();
  348. }
  349. }
  350. case "arc1J" :{
  351. switch (urChoice){
  352. case "BT-A" : arc1K();
  353. }
  354. }
  355. case "arc1K" :{
  356. switch (urChoice){
  357. case "BT-A" : arc1L();
  358. }
  359. }
  360. case "arc1L" :{
  361. switch (urChoice){
  362. case "BT-A" : arc2();
  363. }
  364. }
  365. case "arc2" :{
  366. switch (urChoice){
  367. case "BT-A" : Woods();
  368. }
  369. }
  370. case "Woods" :{
  371. switch (urChoice){
  372. case "BT-A" : IntroHonk();
  373. }
  374. }
  375. case "IntroHonk" : {
  376. switch (urChoice){
  377. case "BT-A" : playerAttack1();
  378. case "BT-B" : IntroChise();
  379. }
  380. }
  381. case "playerAttack1" : {
  382. switch (urChoice){
  383. case "BT-A": if(EnemyHP < 1){
  384. winQuest1();
  385. }else{
  386. HonkAttack();
  387. }
  388. case "BT-B": playerHeal();
  389. }
  390. }
  391. case "HonkAttack" : {
  392. switch (urChoice){
  393. case"BT-A" :
  394. if (yourHP < 1){
  395. lose();
  396. }else{
  397. HonkFite();
  398. }
  399. case "BT-B": playerHeal();
  400. }
  401. }
  402. case "winQuest1" :{
  403. switch (urChoice){
  404. case "BT-A" : IntroChise();
  405. }
  406. }
  407. case "IntroChise" :{
  408. switch (urChoice){
  409. case "BT-A" : playerAttack1();
  410. case "BT-B" : IntroKumori();
  411. }
  412. }
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420. }
  421. }
  422. }
  423. }
  424.  
  425.  
  426. public void introC(){
  427. mainTextArea.setText("A new world with a ton of Decisions to choose from");
  428. position = "introC";
  429. BTA.setText(">");
  430. BTB.setText("");
  431. BTC.setText("");
  432. BTD.setText("");
  433. }
  434. public void introD(){
  435. mainTextArea.setText("Welcome, Hero! Please choose your class");
  436. position = "IntroD";
  437. BTA.setText(">");
  438. BTB.setText("");
  439. BTC.setText("");
  440. BTD.setText("");
  441.  
  442. }
  443. public void introE(){
  444. mainTextArea.setText("Welcome, Hero! Please choose your class");
  445. position = "IntroE";
  446. BTA.setText("Shield");
  447. BTB.setText("Spear");
  448. BTC.setText("Sword");
  449. BTD.setText("Bow");
  450. }
  451. public void Shield(){
  452. mainTextArea.setText("Congratulations!, You've chosen the Shield class!\n This class consist of a Shield which given by the Blacksmith Jonathan Grumbledoor");
  453. weapon = "Shield";
  454. weaponLabelName.setText(weapon);
  455. position = "Shield";
  456. BTA.setText(">");
  457. BTB.setText("");
  458. BTC.setText("");
  459. BTD.setText("");
  460. }
  461. public void Sword(){
  462. mainTextArea.setText("Congratulations! You've chosen the Sword class!\n This class consist of a Sword which given by the God of the Sun himself Amaterasu");
  463. weapon = "Sword";
  464. weaponLabelName.setText(weapon);
  465. position = "Sword";
  466. BTA.setText(">");
  467. BTB.setText("");
  468. BTC.setText("");
  469. BTD.setText("");
  470. }
  471. public void Spear(){
  472. mainTextArea.setText("Congratulations! You've chosen the Spear class!\n This class consist of a Spear which is given by the the Water Pillar Giyuu Tomioka");
  473. weapon = "Spear";
  474. weaponLabelName.setText(weapon);
  475. position = "Spear";
  476. BTA.setText(">");
  477. BTB.setText("");
  478. BTC.setText("");
  479. BTD.setText("");
  480. }
  481. public void Bow (){
  482. mainTextArea.setText("Congratulations! You've chosen the Bow class! \n This class consist of a Bow which is given by the High Elf Archer Violet Neverland");
  483. weapon = "Bow";
  484. weaponLabelName.setText(weapon);
  485. position = "Bow";
  486. BTA.setText(">");
  487. BTB.setText("");
  488. BTC.setText("");
  489. BTD.setText("");
  490. }
  491. public void ready(){
  492. mainTextArea.setText("Are you ready to fight hero?");
  493. position = "ready";
  494. BTA.setText("Yes");
  495. BTB.setText("No");
  496. BTC.setText("");
  497. BTB.setText("");
  498.  
  499. }
  500. public void fightReady(){
  501. mainTextArea.setText("Okay here is your first fight hero good luck!");
  502. position = "fightA";
  503. BTA.setText(">");
  504. BTB.setText("");
  505. BTC.setText("");
  506. BTD.setText("");
  507.  
  508. }
  509. public void IntroGobta(){
  510. mainTextArea.setText("Gobta the goblin appeared! What will you do?");
  511. position = "IntroGobta";
  512.  
  513. BTA.setText("Battle");
  514. BTB.setText("");
  515. BTC.setText("");
  516. BTD.setText("");
  517. }
  518. public void GobtaFite(){
  519. position = "GobtaFite";
  520. EnemyHP = 20;
  521.  
  522. mainTextArea.setText("Enemy HP:" + EnemyHP + "\n\nWhat will you do?");
  523. BTA.setText("Attack");
  524. BTB.setText("Drink Health Potion");
  525. BTC.setText("");
  526. BTD.setText("");
  527.  
  528. }
  529. public void IntroHonk(){
  530. mainTextArea.setText("Honk the Wizard appeared! What will you do?");
  531. position = "IntroHonk";
  532.  
  533. BTA.setText("Battle");
  534. BTB.setText("Run");
  535. BTC.setText("");
  536. BTD.setText("");
  537. }
  538. public void HonkFite(){
  539. position = "HonkFite";
  540. EnemyHP = 25;
  541. mainTextArea.setText("Enemy HP:" + EnemyHP + "\n\nWhat will you do?");
  542.  
  543. BTA.setText("Attack");
  544. BTB.setText("Drink Health Potion");
  545. BTC.setText("");
  546. BTD.setText("");
  547. }
  548. public void IntroChise(){
  549. position = "IntroChise";
  550. mainTextArea.setText("Chise the Skeleton appeared! What will you do?");
  551.  
  552. BTA.setText("Battle");
  553. BTB.setText("Run");
  554. BTC.setText("");
  555. BTD.setText("");
  556. }
  557. public void ChiseFite(){
  558. position = "ChiseFite";
  559. mainTextArea.setText("Enemy HP:" + EnemyHP + "\n\nWhat will you do?");
  560. EnemyHP = 30;
  561.  
  562. BTA.setText("Attack");
  563. BTB.setText("Drink Health Potion");
  564. BTC.setText("");
  565. BTD.setText("");
  566. }
  567. public void IntroKumori (){
  568. position ="IntroKumori";
  569. mainTextArea.setText("Kumori the Ghost! What will you do?");
  570.  
  571. BTA.setText("Battle");
  572. BTB.setText("Run");
  573. BTC.setText("");
  574. BTD.setText("");
  575. }
  576. public void KumoriFite (){
  577. position ="IntroKumori";
  578. EnemyHP = 30;
  579. mainTextArea.setText("Enemy HP:" + EnemyHP + "\n\nWhat will you do?");
  580.  
  581. BTA.setText("Battle");
  582. BTB.setText("Drink Health Potion");
  583. BTC.setText("");
  584. BTD.setText("");
  585. }
  586. public void IntroPanchi(){
  587. position = "IntroPanchi";
  588.  
  589. mainTextArea.setText("Panchi the Demon has appeared! What will you do?");
  590.  
  591. BTA.setText("Battle");
  592. BTB.setText("Run");
  593. BTC.setText("");
  594. BTD.setText("");
  595. }
  596. public void PanchiFite (){
  597. position ="PanchiFite";
  598. EnemyHP = 30;
  599. mainTextArea.setText("Enemy HP:" + EnemyHP + "\n\nWhat will you do?");
  600.  
  601. BTA.setText("Attack");
  602. BTB.setText("Drink Health Potion");
  603. BTC.setText("");
  604. BTD.setText("");
  605. }
  606. public void IntroCoomer(){
  607. position = "IntroCoomer";
  608.  
  609. mainTextArea.setText("Coomer the Boomer appeared! What would you do?");
  610.  
  611. BTA.setText("Attack");
  612. BTB.setText("Run");
  613. BTC.setText("");
  614. BTD.setText("");
  615.  
  616. }
  617. public void CoomerFite(){
  618. position = "CoomerFite";
  619.  
  620. mainTextArea.setText("Enemy HP:" + EnemyHP + "\n\nWhat will you do?");
  621.  
  622. BTA.setText(">");
  623. BTB.setText("");
  624. BTC.setText("");
  625. BTD.setText("");
  626. }
  627. public void playerAttackdefault(){
  628. position = "playerAttackdefault";
  629.  
  630. int playerDamage=0;
  631.  
  632. switch (weapon) {
  633. case "Shield":
  634. playerDamage = new java.util.Random().nextInt(2);
  635. break;
  636. case "Sword":
  637. playerDamage = new java.util.Random().nextInt(5);
  638. break;
  639. case "Spear":
  640. playerDamage = new java.util.Random().nextInt(4);
  641. break;
  642. case "Bow":
  643. playerDamage = new java.util.Random().nextInt(3);
  644. break;
  645. default:
  646. break;
  647. }
  648. mainTextArea.setText("You atttacked the monster and gave " + playerDamage + " damage!");
  649.  
  650. EnemyHP = EnemyHP - playerDamage;
  651.  
  652.  
  653. BTA.setText("Attack");
  654. BTB.setText("Drink Health Potion");
  655. BTC.setText("");
  656. BTD.setText("");
  657.  
  658. }
  659. public void playerAttack1(){
  660. position = "playerAttack1";
  661.  
  662. int playerDamage = 0;
  663.  
  664. switch (weapon) {
  665. case "Shield":
  666. playerDamage = new java.util.Random().nextInt(2);
  667. break;
  668. case "Nichirin Sword":
  669. playerDamage = new java.util.Random().nextInt(20);
  670. break;
  671. case "Spear":
  672. playerDamage = new java.util.Random().nextInt(4);
  673. break;
  674. case "Bow":
  675. playerDamage = new java.util.Random().nextInt(3);
  676. break;
  677. default:
  678. break;
  679. }
  680.  
  681. mainTextArea.setText("You atttacked the monster and gave " + playerDamage + " damage!");
  682. EnemyHP = EnemyHP - playerDamage;
  683.  
  684. BTA.setText("Attack");
  685. BTB.setText("Drink Health Potion");
  686. BTC.setText("");
  687. BTD.setText("");
  688.  
  689. }
  690. public void playerHeal(){
  691. position = "playerHeal";
  692.  
  693. playerPots--;
  694.  
  695. potHeal = 5;
  696.  
  697. yourHP = yourHP + potHeal;
  698.  
  699. mainTextArea.setText("You drinked an Instant health potion " + "\nYou now have " + yourHP + "HP!");
  700. mainTextArea.setText("\nYou only have " + playerPots + "left!");
  701. }
  702. public void GobtaAttack(){
  703. position = "GobtaAttack";
  704.  
  705. int monsterDamage = 0;
  706.  
  707. monsterDamage = new java.util.Random().nextInt(4);
  708.  
  709. mainTextArea.setText("The Enemy attacked you and gave " + monsterDamage +" damage!");
  710. yourHP = yourHP - monsterDamage;
  711. hpLabelNumber.setText(""+yourHP);
  712. BTA.setText(">");
  713. BTB.setText("");
  714. BTC.setText("");
  715. BTD.setText("");
  716. }
  717. public void HonkAttack(){
  718. position = "HonkAttack";
  719.  
  720. int monsterDamage = 0;
  721.  
  722. monsterDamage = new java.util.Random().nextInt(5);
  723.  
  724. mainTextArea.setText("The Enemy attacked you and gave " + monsterDamage +" damage!");
  725. yourHP = yourHP - monsterDamage;
  726. hpLabelNumber.setText(""+yourHP);
  727. BTA.setText(">");
  728. BTB.setText("");
  729. BTC.setText("");
  730. BTD.setText("");
  731.  
  732. }
  733. public void ChiseAttack(){
  734. position = "ChiseAttack";
  735.  
  736. int monsterDamage = 0;
  737.  
  738. monsterDamage = new java.util.Random().nextInt(6);
  739.  
  740. mainTextArea.setText("The Enemy attacked you and gave " + monsterDamage +" damage!");
  741. yourHP = yourHP - monsterDamage;
  742. hpLabelNumber.setText(""+yourHP);
  743.  
  744. BTA.setText(">");
  745. BTB.setText("");
  746. BTC.setText("");
  747. BTD.setText("");
  748. }
  749. public void KumoriAttack(){
  750. position = "KumoriAttack";
  751.  
  752. int monsterDamage = 0;
  753.  
  754. monsterDamage = new java.util.Random().nextInt(7);
  755.  
  756. mainTextArea.setText("The Enemy attacked you and gave " + monsterDamage +" damage!");
  757. yourHP = yourHP - monsterDamage;
  758. hpLabelNumber.setText(""+yourHP);
  759.  
  760. BTA.setText(">");
  761. BTB.setText("");
  762. BTC.setText("");
  763. BTD.setText("");
  764.  
  765. }
  766. public void PanchiAttack(){
  767. position = "KumoriAttack";
  768.  
  769. int monsterDamage = 0;
  770.  
  771. monsterDamage = new java.util.Random().nextInt(7);
  772.  
  773. mainTextArea.setText("The Enemy attacked you and gave " + monsterDamage +" damage!");
  774. yourHP = yourHP - monsterDamage;
  775. hpLabelNumber.setText(""+yourHP);
  776.  
  777. BTA.setText(">");
  778. BTB.setText("");
  779. BTC.setText("");
  780. BTD.setText("");
  781. }
  782. public void CoomerAttack(){
  783. position = "CoomerAttack";
  784. int monsterDamage = 0;
  785.  
  786. monsterDamage = new java.util.Random().nextInt(6);
  787.  
  788. mainTextArea.setText("The Enemy attacked you and gave " + monsterDamage +" damage!");
  789. yourHP = yourHP - monsterDamage;
  790. hpLabelNumber.setText(""+yourHP);
  791.  
  792. BTA.setText(">");
  793. BTB.setText("");
  794. BTC.setText("");
  795. BTD.setText("");
  796. }
  797. public void win(){
  798. position = "win";
  799.  
  800. mainTextArea.setText("You defeated the monster! \nThe monster dropped a Nichirin Sword");
  801.  
  802. BTA.setText(">");
  803. BTB.setText("");
  804. BTC.setText("");
  805. BTD.setText("");
  806. }
  807. public void winQuest1(){
  808. position = "winQuest1";
  809.  
  810. mainTextArea.setText("You defeated the monster!");
  811. mainTextArea.setText("\nQuest: Kill Monsters 1/5");
  812.  
  813. BTA.setText(">");
  814. BTB.setText("Go to the woods");
  815. BTC.setText("");
  816. BTD.setText("");
  817. }
  818. public void winQuest2(){
  819. position = "winQuest2";
  820.  
  821. mainTextArea.setText("You defeated the monster!");
  822. mainTextArea.setText("\nQuest: Kill Monsters 2/5");
  823.  
  824. BTA.setText("Go to the woods");
  825. BTB.setText("");
  826. BTC.setText("");
  827. BTD.setText("");
  828. }
  829. public void winQuest3() {
  830. position = "winQuest3";
  831.  
  832. mainTextArea.setText("You defeated the monster! \nYou dropped a Wooden Shield");
  833. mainTextArea.setText("\n\nQuest: Kill Monsters 3/5");
  834.  
  835. BTA.setText("Go to the woods");
  836. BTB.setText("");
  837. BTC.setText("");
  838. BTD.setText("");
  839. }
  840. public void winQuest4(){
  841. position = "winQuest4";
  842.  
  843. mainTextArea.setText("You defeated the monster!");
  844. mainTextArea.setText("\nQuest: Kill Monsters 4/5");
  845.  
  846. BTA.setText("Go to the woods");
  847. BTB.setText("");
  848. BTC.setText("");
  849. BTD.setText("");
  850. }
  851. public void winQuest5(){
  852. position = "winQuest5";
  853.  
  854. mainTextArea.setText("You defeated the monster!");
  855. mainTextArea.setText("\nCongratulations! You completed your quest!");
  856.  
  857. killRequirement = 5;
  858.  
  859. BTA.setText(">");
  860. BTB.setText("");
  861. BTC.setText("");
  862. BTD.setText("");
  863. }
  864. public void lose(){
  865. position = "lose";
  866. mainTextArea.setText("You died! \n\nGAME OVER");
  867.  
  868. BTA.setText("");
  869. BTB.setText("");
  870. BTC.setText("");
  871. BTD.setText("");
  872. BTA.setVisible(false);
  873. BTB.setVisible(false);
  874. BTC.setVisible(false);
  875. BTD.setVisible(false);
  876. }
  877. public void equip1(){
  878. position = "equip1";
  879. mainTextArea.setText("Would you like to equip this weapon?");
  880.  
  881. BTA.setText("Yes");
  882. BTB.setText("No");
  883. BTC.setText("");
  884. BTD.setText("");
  885. BTC.setVisible(false);
  886. BTD.setVisible(false);
  887. }
  888. public void equip1A(){
  889. position = "equip1A";
  890. mainTextArea.setText("Congratulations you've Equipped Nichirin Sword!");
  891. weapon = "Nichirin Sword";
  892. weaponLabelName.setText(weapon);
  893.  
  894. BTA.setText(">");
  895. BTB.setText("");
  896. BTC.setText("");
  897. BTD.setText("");
  898. BTB.setVisible(false);
  899. BTC.setVisible(false);
  900. BTD.setVisible(false);
  901. }
  902. public void equip1B(){
  903. position = "equip1A";
  904. mainTextArea.setText("Unfortunately you can't equip this sword.");
  905.  
  906. BTA.setText(">");
  907. BTB.setText("");
  908. BTC.setText("");
  909. BTD.setText("");
  910. BTB.setVisible(false);
  911. BTC.setVisible(false);
  912. BTD.setVisible(false);
  913. }
  914. public void arc1 (){
  915. position ="arc1";
  916. mainTextArea.setText("A long time ago there were 4 Cardinal weapons.\nShield, Sword, Spear, and Bow,");
  917.  
  918.  
  919. BTA.setText(">");
  920. BTB.setText("");
  921. BTC.setText("");
  922. BTD.setText("");
  923. BTB.setVisible(false);
  924. BTC.setVisible(false);
  925. BTD.setVisible(false);
  926.  
  927. }
  928. public void arc1A(){
  929. position ="arc1A";
  930. mainTextArea.setText("They lived in peace until the Demon Lord attacked. \nNow the 4 Cardinal weapons are working together to defeat the Demon Lord");
  931.  
  932.  
  933. BTA.setText(">");
  934. BTB.setText("");
  935. BTC.setText("");
  936. BTD.setText("");
  937. BTB.setVisible(false);
  938. BTC.setVisible(false);
  939. BTD.setVisible(false);
  940. }
  941. public void arc1B(){
  942. position ="arc1B";
  943. mainTextArea.setText("Do you have what it takes to defeat the Demon Lord?");
  944.  
  945. BTA.setText("Yes");
  946. BTB.setText("No");
  947. BTC.setText("");
  948. BTD.setText("");
  949. BTC.setVisible(false);
  950. BTD.setVisible(false);
  951.  
  952. }
  953. public void arc1C(){
  954. position = "arc1C";
  955. mainTextArea.setText("Good, Let's now Go to our adventure!");
  956.  
  957. BTA.setText(">");
  958. BTB.setText("");
  959. BTC.setText("");
  960. BTD.setText("");
  961. BTB.setVisible(false);
  962. BTC.setVisible(false);
  963. BTD.setVisible(false);
  964. }
  965. public void arc1D(){
  966. position = "arc1D";
  967. mainTextArea.setText("Me: Where am I?, What is this place?, Who are you?");
  968.  
  969. BTA.setText(">");
  970. BTB.setText("");
  971. BTC.setText("");
  972. BTD.setText("");
  973. BTB.setVisible(false);
  974. BTC.setVisible(false);
  975. BTD.setVisible(false);
  976. }
  977. public void arc1E(){
  978. position = "arc1E";
  979. mainTextArea.setText("Someone: Welcome hero!");
  980.  
  981. BTA.setText(">");
  982. BTB.setText("");
  983. BTC.setText("");
  984. BTD.setText("");
  985. BTB.setVisible(false);
  986. BTC.setVisible(false);
  987. BTD.setVisible(false);
  988. }
  989. public void arc1F(){
  990. position = "arc1F";
  991. mainTextArea.setText("Me: Who are you?, what do you want for me?");
  992.  
  993. BTA.setText(">");
  994. BTB.setText("");
  995. BTC.setText("");
  996. BTD.setText("");
  997.  
  998. }
  999. public void arc1G(){
  1000. position = "arc1G";
  1001. mainTextArea.setText("King: I'm the king of this land. \n I want you to defeat the Demon Lord named Morgo");
  1002.  
  1003. BTA.setText(">");
  1004. BTB.setText("");
  1005. BTC.setText("");
  1006. BTD.setText("");
  1007. BTB.setVisible(false);
  1008. BTC.setVisible(false);
  1009. BTD.setVisible(false);
  1010.  
  1011. }
  1012. public void arc1H(){
  1013. position ="arcH";
  1014. mainTextArea.setText("Me: Oh, Apologies, Who is this Demon Lord your majesty?");
  1015.  
  1016. BTA.setText(">");
  1017. BTB.setText("");
  1018. BTC.setText("");
  1019. BTD.setText("");
  1020. BTB.setVisible(false);
  1021. BTC.setVisible(false);
  1022. BTD.setVisible(false);
  1023.  
  1024.  
  1025. }
  1026. public void arc1I(){
  1027. position = "arc1I";
  1028. mainTextArea.setText("King: Morgo has been decimating Wolfwind city for the last 500 years");
  1029.  
  1030. BTA.setText(">");
  1031. BTB.setText("");
  1032. BTC.setText("");
  1033. BTD.setText("");
  1034. BTB.setVisible(false);
  1035. BTC.setVisible(false);
  1036. BTD.setVisible(false);
  1037. }
  1038. public void arc1J(){
  1039. position = "arc1J";
  1040. mainTextArea.setText("King: Now he's back for vengance");
  1041.  
  1042. BTA.setText(">");
  1043. BTB.setText("");
  1044. BTC.setText("");
  1045. BTD.setText("");
  1046. BTB.setVisible(false);
  1047. BTC.setVisible(false);
  1048. BTD.setVisible(false);
  1049. }
  1050. public void arc1K(){
  1051. position = "arc1K";
  1052. mainTextArea.setText("Me: I see, I will defeat Demon Lord Morgo for you majesty");
  1053.  
  1054. BTA.setText(">");
  1055. BTB.setText("");
  1056. BTC.setText("");
  1057. BTD.setText("");
  1058. BTB.setVisible(false);
  1059. BTC.setVisible(false);
  1060. BTD.setVisible(false);
  1061. }
  1062. public void arc1L(){
  1063. position = "arc1L";
  1064. mainTextArea.setText("King: Very well hero, may the odds be in your favor");
  1065.  
  1066. BTA.setText(">");
  1067. BTB.setText("");
  1068. BTC.setText("");
  1069. BTD.setText("");
  1070. BTB.setVisible(false);
  1071. BTC.setVisible(false);
  1072. BTD.setVisible(false);
  1073.  
  1074. }
  1075. public void arc2(){
  1076. position = "arc2";
  1077.  
  1078. mainTextArea.setText("You have obtained a quest!, Go Kill 5 Monsters");
  1079.  
  1080. BTA.setText("Go to the woods");
  1081. BTB.setText("");
  1082. BTC.setText("");
  1083. BTD.setText("");
  1084. BTB.setVisible(false);
  1085. BTC.setVisible(false);
  1086. BTD.setVisible(false);
  1087. //Dito ka natapos next arc na niyan yung pupunta yung hero sa woods walang laban dito.(Sige gagawa akong laban Idgas) hindi ko muna susundan yung nsa Main class sa ngayon gagawa akong revise
  1088. }
  1089. public void Woods (){
  1090. position = "Woods";
  1091.  
  1092. mainTextArea.setText("As you were walking you found some enemies!");
  1093.  
  1094. BTA.setText(">");
  1095. BTB.setText("");
  1096. BTC.setText("");
  1097. BTD.setText("");
  1098. BTB.setVisible(false);
  1099. BTC.setVisible(false);
  1100. BTD.setVisible(false);
  1101. }
  1102.  
  1103.  
  1104. }
  1105.  
  1106. });//Divider talaga ito pramis xd dito ka gagawa ng new public voids
  1107. }
  1108.  
  1109.  
  1110. }
  1111.  
  1112.  
  1113. class ChoiceHandler implements ActionListener {
  1114.  
  1115. public ChoiceHandler() {
  1116.  
  1117. }
  1118.  
  1119. @Override
  1120. public void actionPerformed(ActionEvent e) {
  1121.  
  1122. }
  1123.  
  1124. private static class ActionEvents {
  1125.  
  1126. public ActionEvents() {
  1127. }
  1128. }
  1129. }
  1130.  
  1131.  
  1132.  
  1133. class event {
  1134.  
  1135. static String getActionCommand;
  1136.  
  1137. public event() {
  1138.  
  1139. }
  1140.  
  1141.  
  1142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement