• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

無人機動兵器ダンジョン探索ゲーム JAVAベース


Commit MetaInfo

Revisão48 (tree)
Hora2015-08-21 18:01:19
Autormanjihq

Mensagem de Log

プレイヤー以外の機体も階段降りて新しい階に移動出来るようにしてみた

Mudança Sumário

Diff

--- CarnageHack2/trunk/src/CarnageHack/OkeDungeon.java (revision 47)
+++ CarnageHack2/trunk/src/CarnageHack/OkeDungeon.java (revision 48)
@@ -167,7 +167,7 @@
167167 }
168168 floor.add(dungeon);
169169 if (usebone == false) {
170- plot_init_enemy();
170+ plot_init_enemy(current_floor);
171171 }
172172 pcOke = pc;
173173 viewBaseOke = pcOke;
@@ -414,6 +414,39 @@
414414 }
415415
416416 /**
417+ * 新しいフロアを生成
418+ *
419+ * @return 階数
420+ */
421+ public int generate_floor() {
422+ int new_floor = floor.size();
423+ DungeonFloor dungeon;
424+ boolean usebone;
425+ dungeon = load_bone_file();
426+ if (dungeon == null) {
427+ dungeon = new DungeonFloor(new_floor);
428+ usebone = false;
429+ } else {
430+ usebone = true;
431+ }
432+ floor.add(dungeon);
433+ if (usebone == false) {
434+ plot_init_enemy(new_floor);
435+ }
436+ if (higefloor == new_floor) {
437+ //plot hige
438+ do {
439+ higex = (int) (Math.random() * (DungeonFloor.FLOOR_X - 2))
440+ + 1;
441+ higey = (int) (Math.random() * (DungeonFloor.FLOOR_Y - 2))
442+ + 1;
443+ } while (dungeon.iswall(higex, higey) == true);
444+ dungeon.clear_downstairs();
445+ }
446+ return new_floor;
447+ }
448+
449+ /**
417450 * 階数を一つ降りる
418451 *
419452 * @return 移動後の階数
@@ -422,31 +455,9 @@
422455 DungeonFloor dungeon;
423456 current_floor++;
424457 if (current_floor >= floor.size()) {
425- boolean usebone;
426- dungeon = load_bone_file();
427- if (dungeon == null) {
428- dungeon = new DungeonFloor(current_floor);
429- usebone = false;
430- } else {
431- usebone = true;
432- }
433- floor.add(dungeon);
434- if (usebone == false) {
435- plot_init_enemy();
436- }
437- if (higefloor == current_floor) {
438- //plot hige
439- do {
440- higex = (int) (Math.random() * (DungeonFloor.FLOOR_X - 2))
441- + 1;
442- higey = (int) (Math.random() * (DungeonFloor.FLOOR_Y - 2))
443- + 1;
444- } while (dungeon.iswall(higex, higey) == true);
445- dungeon.clear_downstairs();
446- }
447- } else {
448- dungeon = (DungeonFloor) floor.get(current_floor);
458+ current_floor = generate_floor();
449459 }
460+ dungeon = (DungeonFloor) floor.get(current_floor);
450461 pcOke.set_x(dungeon.get_up_stairsx());
451462 pcOke.set_y(dungeon.get_up_stairsy());
452463 pcOke.set_floor(current_floor);
@@ -995,7 +1006,7 @@
9951006 if (turn_count == 1800) {
9961007 turn_count = 0;
9971008 if (CarnageHack.dice100() > 70) {
998- plot_init_enemy();
1009+ plot_init_enemy(current_floor);
9991010 }
10001011 }
10011012 if (pcOke.isdead() == true || pcOke.get_fuel() == 0) {
@@ -1027,11 +1038,12 @@
10271038 * OKEデータを管理リストへ追加
10281039 *
10291040 * @param p OKEデータ
1041+ * @param n 階数
10301042 */
1031- public void addOke(Oke p) {
1043+ public void addOke(Oke p, int n) {
10321044 int x;
10331045 int y;
1034- DungeonFloor dungeon = (DungeonFloor) floor.get(current_floor);
1046+ DungeonFloor dungeon = (DungeonFloor) floor.get(n);
10351047 do {
10361048 x = (int) (Math.random() * (DungeonFloor.FLOOR_X - 2)) + 1;
10371049 y = (int) (Math.random() * (DungeonFloor.FLOOR_Y - 2)) + 1;
@@ -1038,21 +1050,23 @@
10381050 } while (dungeon.iswall(x, y) == true);
10391051 p.set_x(x);
10401052 p.set_y(y);
1041- p.set_floor(current_floor);
1053+ p.set_floor(n);
10421054 oke.add(p);
10431055 }
10441056
10451057 /**
10461058 * 敵OKEを発生させる
1059+ *
1060+ * @param n
10471061 */
1048- public void makeNewOke() {
1062+ public void makeNewOke(int n) {
10491063 Oke p = new Oke(Oke.IFF_ENEMY,
1050- (int) (Math.random() * (current_floor + 1) * 100) + (current_floor
1051- / 5 + 1) * 100,
1064+ (int) (Math.random() * (n + 1) * 100)
1065+ + (n / 5 + 1) * 100,
10521066 CarnageHack.makeNewHard(),
10531067 CarnageHack.makeNewSoft(this),
10541068 null);
1055- addOke(p);
1069+ addOke(p, n);
10561070 }
10571071
10581072 /**
@@ -1092,11 +1106,12 @@
10921106 /**
10931107 * 敵OKEの初期配備
10941108 */
1095- private void plot_init_enemy() {
1096- int nmax = (int) (Math.random() * ((current_floor / 5) + 1) * 3) + 1;
1109+ private void plot_init_enemy(int nfloor) {
1110+ int nmax;
10971111 int i;
1112+ nmax = (int) (Math.random() * ((nfloor / 5) + 1) * 3) + 1;
10981113 for (i = 0; i < nmax; i++) {
1099- makeNewOke();
1114+ makeNewOke(nfloor);
11001115 }
11011116 }
11021117
--- CarnageHack2/trunk/src/CarnageHack/Oke.java (revision 47)
+++ CarnageHack2/trunk/src/CarnageHack/Oke.java (revision 48)
@@ -605,10 +605,14 @@
605605 } else {
606606 df = dungeon.get_floor(floor + 1);
607607 if (df != null) {
608- x = df.get_up_stairsx();
609- y = df.get_up_stairsy();
610608 floor++;
609+ } else {
610+ //new floor
611+ floor = dungeon.generate_floor();
612+ df = dungeon.get_floor(floor);
611613 }
614+ x = df.get_up_stairsx();
615+ y = df.get_up_stairsy();
612616 }
613617 action = ACTION_NONE;
614618 status = STATUS_NORMAL;