public void loadState(Stage stage) { if (stage == Stage.title) { gameStates[(int)stage] = new MenuState(this); } else if (stage == Stage.mainMenu) { gameStates[(int)stage] = new MainMenu(this); //townMusic.PlayLooping(); } else if (stage == Stage.easyState) { //townMusic.Stop(); dungeon = new dungeon(this, 2); gameStates[(int)stage] = dungeon; } else if (stage == Stage.mediumState) { //townMusic.Stop(); dungeon = new dungeon(this, 4); gameStates[(int)stage] = dungeon; } else if (stage == Stage.hardState) { //townMusic.Stop(); dungeon = new dungeon(this, 6); gameStates[(int)stage] = dungeon; } else if (stage == Stage.sanitarium) { //Sanitarium bs = new Sanitarium(this); //bs.player = player.currentCharacters[0]; gameStates[(int)stage] = new Sanitarium(this); } else if (stage == Stage.blacksmith) { gameStates[(int)stage] = new Blacksmith(this); } else if (stage == Stage.abbey) { gameStates[(int)stage] = new Abbey(this); } else if (stage == Stage.guild) { gameStates[(int)stage] = new Guild(this); } else if (stage == Stage.quest) { gameStates[(int)stage] = new Quest(this); } else if (stage == Stage.entryNewHero) { gameStates[(int)stage] = new EntryNewHero(this); } else if (stage == Stage.provision) { gameStates[(int)stage] = new Provision(this); } }
public BattleAreaState(GameStateManager gsm, dungeon dgn) { locSkill = new List <int>(); locSkill.Add(310); locSkill.Add(365); locSkill.Add(420); locSkill.Add(476); listEquip = new List <equip>(); listEquip.Add(new melee_arm_1()); listEquip.Add(new melee_arm_2()); listEquip.Add(new melee_weap_1()); listEquip.Add(new melee_weap_2()); listEquip.Add(new range_arm_1()); listEquip.Add(new range_arm_2()); listEquip.Add(new range_weap_1()); listEquip.Add(new range_weap_2()); listEquip.Add(new doctor_arm_1()); listEquip.Add(new doctor_arm_2()); listEquip.Add(new doctor_weap_1()); listEquip.Add(new doctor_weap_2()); listEquip.Add(new healer_arm_1()); listEquip.Add(new healer_arm_2()); listEquip.Add(new healer_weap_1()); listEquip.Add(new healer_weap_2()); Random r = new Random(); dropEquip = listEquip[r.Next(listEquip.Count)]; w = 50; h = 100; this.gsm = gsm; thisDungeon = dgn; int ind = r.Next(4) + 1; battle = false; battleInv = thisDungeon.battleInv; player = gsm.player.currentCharacters; object background = Properties.Resources.ResourceManager.GetObject("courtyard_area___" + ind + "_"); imgBack = (Image)background; imgpPlayer = (Image)Properties.Resources.ResourceManager.GetObject("panel_player2"); imgpInv = (Image)Properties.Resources.ResourceManager.GetObject("panel_inventory"); dmg_min = player[pilihHero].skills[pilih_attack].status_skill.dmg_min + ""; dmg_max = player[pilihHero].skills[pilih_attack].status_skill.dmg_max + ""; acc = player[pilihHero].skills[pilih_attack].status_skill.acc + ""; crit = player[pilihHero].skills[pilih_attack].status_skill.crit + "%"; prot = player[pilihHero].skills[pilih_attack].status_skill.def + ""; }
public BattleState(GameStateManager gsm, dungeon dgn) { locSkill = new List <int>(); locSkill.Add(310); locSkill.Add(365); locSkill.Add(420); locSkill.Add(476); player = gsm.player.currentCharacters; thisDungeon = dgn; battleInv = dgn.battleInv; player = gsm.player.currentCharacters; Random r = new Random(); this.gsm = gsm; gambar = new List <int>(); for (int i = 0; i < 5; i++) { gambar.Add(r.Next(5) + 1); } imgLast = (Image)last; imgDoor = (Image)door; x = 0; imgpPlayer = (Image)Properties.Resources.ResourceManager.GetObject("panel_player2"); imgpInv = (Image)Properties.Resources.ResourceManager.GetObject("panel_inventory"); //drawInventory(); //random barang jatuh for (int i = 0; i < 3; i++) { int typeInv = rand.Next(10); if (typeInv == 0) { int jumlah = rand.Next(1, 8); inv_found[i] = new LargeFood(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 1) { int jumlah = rand.Next(1, 8); inv_found[i] = new LargeFood(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 2) { int jumlah = rand.Next(1, 8); inv_found[i] = new SmallFood(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 3) { int jumlah = rand.Next(1, 8); inv_found[i] = new Torch(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 4) { int jumlah = rand.Next(1, 8); inv_found[i] = new Bandage(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 5) { int jumlah = rand.Next(1, 8); inv_found[i] = new Gold(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 6) { int jumlah = rand.Next(1, 8); inv_found[i] = new Jewel(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 7) { int jumlah = rand.Next(1, 8); inv_found[i] = new Key(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 8) { int jumlah = rand.Next(1, 8); inv_found[i] = new Shovel(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } else if (typeInv == 9) { int jumlah = rand.Next(1, 8); inv_found[i] = new TheCure(walk_and_found[i], 334, jumlah); inv_found_rect[i] = new Rectangle(walk_and_found[i], 334, 50, 50); } } inv = gsm.player.inventoryAktif; dmg_min = player[pilihHero].skills[pilih_attack].status_skill.dmg_min + ""; dmg_max = player[pilihHero].skills[pilih_attack].status_skill.dmg_max + ""; acc = player[pilihHero].skills[pilih_attack].status_skill.acc + ""; crit = player[pilihHero].skills[pilih_attack].status_skill.crit + "%"; prot = player[pilihHero].skills[pilih_attack].status_skill.def + ""; }
public battle(GameStateManager gsm, Image back, dungeon dgn) { thisDungeon = dgn; this.gsm = gsm; battleInv = thisDungeon.battleInv; player = new List <karakter>();; for (int i = 0; i < 4; i++) { try { player.Add(gsm.player.currentCharacters[i]); } catch (Exception) { } } Random rand = new Random(); musuh = new List <musuh>(); int a = rand.Next(1, 3); for (int i = 0; i < a; i++) { int b = rand.Next(1, 8); if (b == 1) { musuh.Add(new yeti(700 + i * 100)); } else if (b == 2) { musuh.Add(new Gargoyle(700 + i * 100)); } else if (b == 3) { musuh.Add(new Gargoyle(700 + i * 100)); } else if (b == 4) { musuh.Add(new Boarman(700 + i * 100)); } else if (b == 5) { musuh.Add(new Larry(700 + i * 100)); } else if (b == 6) { musuh.Add(new FlameEater(700 + i * 100)); } else { musuh.Add(new GiantGoblin(700 + i * 100)); } turnAttack.Add(new turn(0, i, musuh[i].speed)); } locSkill = new List <int>(); locSkill.Add(310); locSkill.Add(365); locSkill.Add(420); locSkill.Add(476); for (int i = 0; i < player.Count; i++) { player[i].x = 350 - 100 * i; turnAttack.Add(new turn(1, i, player[i].speed)); } for (int i = 0; i < turnAttack.Count - 1; i++) { for (int j = i; j < turnAttack.Count - i - 1; j++) { if (turnAttack[i].speed < turnAttack[j].speed) { turn temp = turnAttack[i]; turnAttack[i] = turnAttack[j]; turnAttack[j] = temp; } } } background = back; imgpPlayer = (Image)Properties.Resources.ResourceManager.GetObject("panel_player2"); imgpInv = (Image)Properties.Resources.ResourceManager.GetObject("panel_inventory"); if (turnAttack[0].jenis == 1) { pilihHero = turnAttack[0].ke; } else { pilihMusuh = turnAttack[0].ke; delay_aktif = true; } dmg_min = player[pilihHero].skills[pilih_attack].status_skill.dmg_min + ""; dmg_max = player[pilihHero].skills[pilih_attack].status_skill.dmg_max + ""; acc = player[pilihHero].skills[pilih_attack].status_skill.acc + ""; crit = player[pilihHero].skills[pilih_attack].status_skill.crit + "%"; prot = player[pilihHero].skills[pilih_attack].status_skill.def + ""; }