├── nbproject ├── private │ ├── config.properties │ ├── private.properties │ └── private.xml ├── genfiles.properties ├── project.xml └── project.properties ├── assets └── res │ ├── inf │ ├── doc.txt │ ├── musics.inf │ ├── player_levels.inf │ ├── enemies.inf │ ├── tileset.inf │ └── spells.inf │ ├── audio │ ├── boss.mid │ ├── intro.mid │ ├── town.mid │ ├── world.mid │ ├── battle.mid │ ├── dungeon.mid │ ├── ending.mid │ ├── tinypsg.sf2 │ ├── tantegel.mid │ └── sound_effects.sf2 │ ├── image │ ├── chars.png │ ├── dq1.png │ ├── title.png │ ├── ending.png │ ├── enemies.png │ ├── tileset.png │ ├── blue_fire.png │ ├── monsters.png │ ├── bitmap_font.png │ ├── ol_presents.png │ ├── title_shine.png │ └── battle_backgrounds.png │ ├── event │ ├── rock_mountain_cave.evt │ ├── hauksness.evt │ ├── erdricks_cave.evt │ ├── world.evt │ ├── swamp_cave.evt │ ├── shrine.evt │ ├── kol.evt │ ├── rimuldar.evt │ └── brecconary.evt │ └── map │ ├── kol.map │ ├── hauksness.map │ ├── swamp_cave.map │ ├── shrine.map │ ├── erdricks_cave.map │ └── rock_mountain_cave.map ├── manifest.mf ├── dist ├── JavaDragonQuest1.jar └── README.TXT ├── screenshots ├── screenshot_0.png ├── screenshot_1.png ├── screenshot_2.png ├── screenshot_3.png └── screenshot_4.png ├── README.md └── src ├── main └── Main.java └── dq1 └── core ├── PlayerLevel.java ├── Input.java ├── Spell.java ├── BitmapFont.java ├── Tile.java ├── Util.java ├── Animation.java ├── Settings.java ├── Credits.java ├── OLPresents.java ├── Shop.java ├── Magic.java ├── Enemy.java ├── Event.java ├── Debug.java ├── Item.java ├── Audio.java └── View.java /nbproject/private/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/res/inf/doc.txt: -------------------------------------------------------------------------------- 1 | all 4 possible endings: 2 | https://www.youtube.com/watch?v=1oSyuE9Phb0 3 | 4 | -------------------------------------------------------------------------------- /manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /assets/res/audio/boss.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/boss.mid -------------------------------------------------------------------------------- /assets/res/audio/intro.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/intro.mid -------------------------------------------------------------------------------- /assets/res/audio/town.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/town.mid -------------------------------------------------------------------------------- /assets/res/audio/world.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/world.mid -------------------------------------------------------------------------------- /assets/res/image/chars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/chars.png -------------------------------------------------------------------------------- /assets/res/image/dq1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/dq1.png -------------------------------------------------------------------------------- /assets/res/image/title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/title.png -------------------------------------------------------------------------------- /dist/JavaDragonQuest1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/dist/JavaDragonQuest1.jar -------------------------------------------------------------------------------- /assets/res/audio/battle.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/battle.mid -------------------------------------------------------------------------------- /assets/res/audio/dungeon.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/dungeon.mid -------------------------------------------------------------------------------- /assets/res/audio/ending.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/ending.mid -------------------------------------------------------------------------------- /assets/res/audio/tinypsg.sf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/tinypsg.sf2 -------------------------------------------------------------------------------- /assets/res/image/ending.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/ending.png -------------------------------------------------------------------------------- /assets/res/image/enemies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/enemies.png -------------------------------------------------------------------------------- /assets/res/image/tileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/tileset.png -------------------------------------------------------------------------------- /screenshots/screenshot_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/screenshots/screenshot_0.png -------------------------------------------------------------------------------- /screenshots/screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/screenshots/screenshot_1.png -------------------------------------------------------------------------------- /screenshots/screenshot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/screenshots/screenshot_2.png -------------------------------------------------------------------------------- /screenshots/screenshot_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/screenshots/screenshot_3.png -------------------------------------------------------------------------------- /screenshots/screenshot_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/screenshots/screenshot_4.png -------------------------------------------------------------------------------- /assets/res/audio/tantegel.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/tantegel.mid -------------------------------------------------------------------------------- /assets/res/image/blue_fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/blue_fire.png -------------------------------------------------------------------------------- /assets/res/image/monsters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/monsters.png -------------------------------------------------------------------------------- /assets/res/image/bitmap_font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/bitmap_font.png -------------------------------------------------------------------------------- /assets/res/image/ol_presents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/ol_presents.png -------------------------------------------------------------------------------- /assets/res/image/title_shine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/title_shine.png -------------------------------------------------------------------------------- /assets/res/audio/sound_effects.sf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/audio/sound_effects.sf2 -------------------------------------------------------------------------------- /assets/res/image/battle_backgrounds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/criticalfault/JavaDragonQuest1/HEAD/assets/res/image/battle_backgrounds.png -------------------------------------------------------------------------------- /nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | do.jlink=false 3 | jlink.strip=false 4 | user.properties.file=C:\\Users\\admin\\AppData\\Roaming\\NetBeans\\11.2\\build.properties 5 | -------------------------------------------------------------------------------- /nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=8240c912 2 | build.xml.script.CRC32=781ce630 3 | build.xml.stylesheet.CRC32=f85dc8f2@1.93.0.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=8240c912 7 | nbproject/build-impl.xml.script.CRC32=783d7ac4 8 | nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.93.0.48 9 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | JavaDragonQuest1 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /assets/res/inf/musics.inf: -------------------------------------------------------------------------------- 1 | # id midi_file start_tick_position loop_start_tick loop_end_tick loop_count 2 | music intro, intro, 0, 4000, 16320, -1 3 | music tantegel, tantegel, 0, 0, 30720, -1 4 | music world, world, 0, 0, 4908, -1 5 | music town, town, 1300, 1400, 78200, -1 6 | music dungeon, dungeon, 680, 400, 9686, -1 7 | music battle, battle, 500, 5700, 24950, -1 8 | music boss, boss, 0, 0, 8640, -1 9 | music ending, ending, 0, 41248, 41248, 0 -------------------------------------------------------------------------------- /assets/res/inf/player_levels.inf: -------------------------------------------------------------------------------- 1 | level_last 30 2 | # Lv Str Agi HP MP XP 3 | level 1 , 4 , 4 , 15 , 0 , 0 4 | level 2 , 5 , 4 , 22 , 0 , 7 5 | level 3 , 7 , 6 , 24 , 5 , 23 6 | level 4 , 7 , 8 , 31 , 16 , 47 7 | level 5 , 12 , 10 , 35 , 20 , 110 8 | level 6 , 16 , 10 , 38 , 24 , 220 9 | level 7 , 18 , 17 , 40 , 26 , 450 10 | level 8 , 22 , 20 , 46 , 29 , 800 11 | level 9 , 30 , 22 , 50 , 36 , 1300 12 | level 10 , 35 , 31 , 54 , 40 , 2000 13 | level 11 , 40 , 35 , 62 , 50 , 2900 14 | level 12 , 48 , 40 , 63 , 58 , 4000 15 | level 13 , 52 , 48 , 70 , 64 , 5500 16 | level 14 , 60 , 55 , 78 , 70 , 7500 17 | level 15 , 68 , 64 , 86 , 72 , 10000 18 | level 16 , 72 , 70 , 92 , 95 , 13000 19 | level 17 , 72 , 78 , 100 , 100 , 16000 20 | level 18 , 85 , 84 , 115 , 108 , 19000 21 | level 19 , 87 , 86 , 130 , 115 , 22000 22 | level 20 , 92 , 88 , 138 , 128 , 26000 23 | level 21 , 95 , 90 , 149 , 135 , 30000 24 | level 22 , 97 , 90 , 158 , 146 , 34000 25 | level 23 , 99 , 94 , 165 , 153 , 38000 26 | level 24 , 103 , 98 , 170 , 161 , 42000 27 | level 25 , 113 , 100 , 174 , 161 , 46000 28 | level 26 , 117 , 105 , 180 , 168 , 50000 29 | level 27 , 125 , 107 , 189 , 175 , 54000 30 | level 28 , 130 , 115 , 195 , 180 , 58000 31 | level 29 , 135 , 120 , 200 , 190 , 62000 32 | level 30 , 140 , 130 , 210 , 200 , 65535 33 | -------------------------------------------------------------------------------- /dist/README.TXT: -------------------------------------------------------------------------------- 1 | ======================== 2 | BUILD OUTPUT DESCRIPTION 3 | ======================== 4 | 5 | When you build an Java application project that has a main class, the IDE 6 | automatically copies all of the JAR 7 | files on the projects classpath to your projects dist/lib folder. The IDE 8 | also adds each of the JAR files to the Class-Path element in the application 9 | JAR files manifest file (MANIFEST.MF). 10 | 11 | To run the project from the command line, go to the dist folder and 12 | type the following: 13 | 14 | java -jar "JavaDragonQuest1.jar" 15 | 16 | To distribute this project, zip up the dist folder (including the lib folder) 17 | and distribute the ZIP file. 18 | 19 | Notes: 20 | 21 | * If two JAR files on the project classpath have the same name, only the first 22 | JAR file is copied to the lib folder. 23 | * Only JAR files are copied to the lib folder. 24 | If the classpath contains other types of files or folders, these files (folders) 25 | are not copied. 26 | * If a library on the projects classpath also has a Class-Path element 27 | specified in the manifest,the content of the Class-Path element has to be on 28 | the projects runtime path. 29 | * To set a main class in a standard Java project, right-click the project node 30 | in the Projects window and choose Properties. Then click Run and enter the 31 | class name in the Main Class field. Alternatively, you can manually type the 32 | class name in the manifest Main-Class element. 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dragon Quest 1 / Dragon Warrior 1 (remake) 2 | 3 | Dragon Quest 1 / Dragon Warrior 1 implemented in java 8 using only standard libraries (java 2D, AWT, Swing & Java Sound API), so no external libraries required. 4 | 5 | 6 | ## Win64 Executable / Runnable jar / Source code - v0.0.3 (java 8) 7 | 8 | https://github.com/leonardo-ono/JavaDragonQuest1/releases/tag/v0.0.3 9 | 10 | 11 | ## Keyboard Controls 12 | 13 | [Arrow] keys: move player 14 | 15 | [X] key: confirm 16 | 17 | [Z] key: cancel 18 | 19 | 20 | ## Video 21 | 22 | [![video](http://img.youtube.com/vi/EjklKCcPskg/0.jpg)](http://www.youtube.com/watch?v=EjklKCcPskg) 23 | 24 | click the image above to see the gameplay video 25 | 26 | 27 | ## Screenshots 28 | 29 | ![](https://raw.githubusercontent.com/leonardo-ono/JavaDragonQuest1/master/screenshots/screenshot_1.png) 30 | 31 | ![](https://raw.githubusercontent.com/leonardo-ono/JavaDragonQuest1/master/screenshots/screenshot_2.png) 32 | 33 | ![](https://raw.githubusercontent.com/leonardo-ono/JavaDragonQuest1/master/screenshots/screenshot_3.png) 34 | 35 | ![](https://raw.githubusercontent.com/leonardo-ono/JavaDragonQuest1/master/screenshots/screenshot_4.png) 36 | 37 | ![](https://raw.githubusercontent.com/leonardo-ono/JavaDragonQuest1/master/screenshots/screenshot_0.png) 38 | 39 | 40 | ## References 41 | 42 | * http://www.realmofdarkness.net/dq/nes-dw/ 43 | * Battle formulas & original assembly source code explained - https://gamefaqs.gamespot.com/nes/563408-dragon-warrior/faqs/61640 44 | * Complete Guide by Colin Moriarty (Guide and Walkthrough) - https://gamefaqs.gamespot.com/nes/563408-dragon-warrior/faqs/10739 45 | 46 | -------------------------------------------------------------------------------- /src/main/Main.java: -------------------------------------------------------------------------------- 1 | package main; 2 | 3 | import dq1.core.Game; 4 | import dq1.core.Resource; 5 | import static dq1.core.Settings.*; 6 | import dq1.core.View; 7 | import java.awt.Color; 8 | import java.awt.Dimension; 9 | import java.util.logging.Level; 10 | import java.util.logging.Logger; 11 | import javax.swing.JFrame; 12 | import javax.swing.SwingUtilities; 13 | 14 | /** 15 | * Main class. 16 | * 17 | * Game entry point. 18 | * 19 | * @author Leonardo Ono (ono.leo80@gmail.com) 20 | */ 21 | public class Main { 22 | 23 | public static void main(String[] args) { 24 | SwingUtilities.invokeLater(() -> { 25 | try { 26 | View.getCanvas().setBackground(Color.BLACK); 27 | View.getCanvas().setPreferredSize( 28 | new Dimension(VIEWPORT_WIDTH, VIEWPORT_HEIGHT)); 29 | 30 | JFrame frame = new JFrame(); 31 | frame.setIconImage(Resource.getImage("dq1")); 32 | frame.setTitle("Dragon Quest 1 / Dragon Warrior 1"); 33 | frame.getContentPane().add(View.getCanvas()); 34 | frame.setResizable(false); 35 | frame.pack(); 36 | frame.setLocationRelativeTo(null); 37 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 38 | frame.setVisible(true); 39 | 40 | View.start(); 41 | View.getCanvas().requestFocus(); 42 | Game.start(); 43 | } catch (Exception ex) { 44 | Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); 45 | System.exit(-1); 46 | } 47 | }); 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /assets/res/event/rock_mountain_cave.evt: -------------------------------------------------------------------------------- 1 | ; --- rock mountain cave --- 2 | ; -------------------------- 3 | 4 | 5 | ; save_point {event_id} {pos_col} {pos_row} 6 | ; --- 7 | save_point save_point_1 20 15 8 | 9 | 10 | ;chest {event_id} {pos_col} {pos_row} {item_id / gold_{value}} {persistent->true|false} 11 | ;--- 12 | ; herb (id = 41) 13 | chest chest_1 25 17 41 false 14 | 15 | ; fighter's ring (id = 70) 16 | chest chest_2 52 14 70 false 17 | 18 | ; torch (id = 43) 19 | chest chest_3 53 14 43 false 20 | 21 | ; death's necklace (id = 61) 22 | chest chest_4 51 18 61 true 23 | 24 | ; gold 10~17 25 | chest chest_5 60 21 gold_10_17 false 26 | 27 | 28 | ;teleport {event_id} {sprite_id} {pos_col} {pos_row} {map_id} \ 29 | ; {player_col} {player_row} {player_direction} \ 30 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 31 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 32 | ; {resetRepel->true|false] 33 | ; --- 34 | teleport teleport_1 28 12 19 world 33 61 down default_sound true world false false false true 35 | teleport teleport_2 29 11 12 rock_mountain_cave 51 12 right default_sound true dungeon true true false false 36 | teleport teleport_3 29 18 17 rock_mountain_cave 57 17 right default_sound true dungeon true true false false 37 | teleport teleport_4 29 24 24 rock_mountain_cave 63 24 right default_sound true dungeon true true false false 38 | teleport teleport_5 28 50 12 rock_mountain_cave 12 12 right default_sound true dungeon true true false false 39 | teleport teleport_6 28 56 17 rock_mountain_cave 19 17 right default_sound true dungeon true true false false 40 | teleport teleport_7 28 62 24 rock_mountain_cave 23 24 left default_sound true dungeon true true false false 41 | -------------------------------------------------------------------------------- /src/dq1/core/PlayerLevel.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | /** 4 | * PlayerLevel class. 5 | * 6 | * @author Leonardo Ono (ono.leo80@gmail.com) 7 | */ 8 | public class PlayerLevel { 9 | 10 | public static int lastLevel; 11 | 12 | private final int lv; 13 | private final int str; 14 | private final int agi; 15 | private final int hp; 16 | private final int mp; 17 | private final int xp; 18 | 19 | public PlayerLevel(int lv, int str, int agi, int hp, int mp, int xp) { 20 | this.lv = lv; 21 | this.str = str; 22 | this.agi = agi; 23 | this.hp = hp; 24 | this.mp = mp; 25 | this.xp = xp; 26 | } 27 | 28 | public PlayerLevel(String serializedData) { 29 | String[] args = serializedData.trim().split(","); 30 | String[] h = args[0].trim().split("\\s+"); 31 | lv = Integer.parseInt(h[1]); 32 | str = Integer.parseInt(args[1].trim()); 33 | agi = Integer.parseInt(args[2].trim()); 34 | hp = Integer.parseInt(args[3].trim()); 35 | mp = Integer.parseInt(args[4].trim()); 36 | xp = Integer.parseInt(args[5].trim()); 37 | } 38 | 39 | public int getLv() { 40 | return lv; 41 | } 42 | 43 | public int getStr() { 44 | return str; 45 | } 46 | 47 | public int getAgi() { 48 | return agi; 49 | } 50 | 51 | public int getHP() { 52 | return hp; 53 | } 54 | 55 | public int getMP() { 56 | return mp; 57 | } 58 | 59 | public int getXP() { 60 | return xp; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "PlayerLevel{" + "lv=" + lv + ", str=" + str + ", agi=" 66 | + agi + ", hp=" + hp + ", mp=" + mp + ", xp=" + xp + '}'; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/dq1/core/Input.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import java.awt.event.KeyEvent; 4 | import java.awt.event.KeyListener; 5 | import java.util.HashSet; 6 | import java.util.Set; 7 | 8 | /** 9 | * Input class. 10 | * 11 | * @author Leonardo Ono (ono.leo80@gmail.com) 12 | */ 13 | public class Input implements KeyListener { 14 | 15 | private static Set keyPressed = new HashSet<>(); 16 | private static Set keyPressedConsumed = new HashSet<>(); 17 | private static KeyListener listener; 18 | 19 | public static void setListener(KeyListener listener) { 20 | Input.listener = listener; 21 | } 22 | 23 | public static synchronized boolean isKeyPressed(int keyCode) { 24 | return keyPressed.contains(keyCode); 25 | } 26 | 27 | public static synchronized boolean isKeyJustPressed(int keyCode) { 28 | if (!keyPressedConsumed.contains(keyCode) 29 | && keyPressed.contains(keyCode)) { 30 | 31 | keyPressedConsumed.add(keyCode); 32 | return true; 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public synchronized void keyTyped(KeyEvent e) { 39 | if (listener != null) { 40 | listener.keyTyped(e); 41 | } 42 | } 43 | 44 | @Override 45 | public synchronized void keyPressed(KeyEvent e) { 46 | keyPressed.add(e.getKeyCode()); 47 | if (listener != null) { 48 | listener.keyPressed(e); 49 | } 50 | } 51 | 52 | @Override 53 | public synchronized void keyReleased(KeyEvent e) { 54 | keyPressed.remove(e.getKeyCode()); 55 | keyPressedConsumed.remove(e.getKeyCode()); 56 | if (listener != null) { 57 | listener.keyReleased(e); 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /assets/res/event/hauksness.evt: -------------------------------------------------------------------------------- 1 | ; --- hauksness --- 2 | ; ------------------ 3 | 4 | ; save_point {event_id} {pos_col} {pos_row} 5 | ; --- 6 | save_point save_point_1 22 22 7 | 8 | 9 | ; axe knight - guards the erdrick's armor item (id = 22) 10 | ; --- 11 | event erdricks_armor_guardian_enemy 12 | animation tileset 6 7 100 13 | create_animation static 1 14 | location 28 22 15 | movement STATIC 16 | visible true 17 | blocked false 18 | fire_required false 19 | script 20 | on_map_enter: 21 | if ##player_armor_id "==" 22 "hide_event" 22 | change_event_visibility "erdricks_armor_guardian_enemy" 1 23 | ret 24 | hide_event: 25 | change_event_visibility "erdricks_armor_guardian_enemy" 0 26 | ret 27 | 28 | on_event_trigger: 29 | ; player already has erdrick's armor ? 30 | if ##player_armor_id "==" 22 "exit" 31 | ; axe knight (id = 33) 32 | ; start_battle {"battle_result_global_var"} {enemy_id} {tile_id} {player_cant_run->1=true|0=false} {enemy_will_not_run->1=true|0=false} {music_id} 33 | ; return result = 0 -> player is dead 34 | ; 1 -> player battle win 35 | ; 2 -> player ran away 36 | ; 3 -> enemy ran away 37 | start_battle "##battle_result" 33 0 0 1 "boss" 38 | if ##battle_result "==" 0 "exit" 39 | if ##battle_result "==" 1 "enemy_defeated" 40 | enemy_not_defeated: 41 | walk_event "player" "left" 42 | ;walk_event "player" "stay" 43 | change_player_animation "right" 44 | goto "exit" 45 | enemy_defeated: 46 | trigger_event "item_erdricks_armor" "on_event_trigger" 47 | goto "exit" 48 | exit: 49 | ret 50 | script_end 51 | event_end 52 | 53 | 54 | ; item_on_ground {event_id} {pos_col} {pos_row} {item_id} {persistent->true/false} 55 | ; --- 56 | ; erdrick's armor item (id = 22) 57 | item_on_ground item_erdricks_armor 28 22 22 false 58 | -------------------------------------------------------------------------------- /assets/res/map/kol.map: -------------------------------------------------------------------------------- 1 | # reference: http://www.realmofdarkness.net/dq/wp-content/img/nes/dw/maps/kol-3.png 2 | 3 | map_name Kol 4 | map_tileset tileset 5 | map_music town 6 | map_out_of_bounds_tile_id 1 7 | map_is_dark false 8 | map_repel_has_no_effect true 9 | map_reset_repel_on_enter true 10 | map_reset_light_on_enter true 11 | # col1 row1 col2 row2 teleportMapId teleportCol teleportRow teleportPlayerDirection areaUseFadeEffect, areaMusicId, areaIsDark, areaRepelHasNoEffect, areaResetRepel, areaResetLight 12 | map_area 0 0 23 23 world 108 14 down true world false false false true 13 | map_rows 24 14 | map_cols 24 15 | map_data 16 | 30,30,30,0,1,1,1,30,30,30,30,30,1,1,1,1,1,1,1,1,30,30,30,30 17 | 30,32,30,0,0,1,1,30,32,32,32,30,1,1,1,1,1,1,30,17,30,32,32,30 18 | 30,33,30,35,0,1,1,32,32,19,32,32,4,4,4,4,4,4,32,32,32,32,32,30 19 | 35,32,35,35,0,1,1,30,32,32,32,30,1,4,1,1,1,1,30,33,30,30,30,30 20 | 35,35,35,0,0,30,30,30,30,32,30,30,1,4,1,1,1,1,30,32,30,1,1,1 21 | 0,35,0,0,0,30,1,1,1,1,1,1,1,4,1,1,1,1,30,30,30,1,1,1 22 | 0,0,0,0,1,30,1,1,1,1,1,1,1,4,1,1,1,1,1,1,1,1,0,1 23 | 1,0,0,1,1,30,1,1,1,1,1,1,1,4,1,1,1,1,1,0,0,0,0,1 24 | 1,1,30,30,30,30,30,30,1,1,1,1,4,4,4,1,1,1,0,0,0,1,0,0 25 | 1,1,1,1,1,1,1,30,1,1,1,4,4,4,4,4,1,1,1,0,1,0,0,1 26 | 30,30,30,30,30,1,1,30,1,1,4,4,4,4,4,4,4,1,30,30,30,30,30,30 27 | 30,32,32,32,30,1,1,30,1,4,4,4,4,4,4,4,4,4,30,32,32,30,32,30 28 | 30,32,32,32,30,1,4,32,4,4,4,4,4,4,4,4,4,4,32,32,32,33,32,30 29 | 30,32,32,32,30,1,4,30,1,4,4,4,4,4,4,4,4,4,30,32,32,30,32,30 30 | 30,32,30,30,30,32,4,30,1,1,4,4,4,4,4,4,4,1,30,30,30,30,30,30 31 | 30,32,30,32,32,32,32,30,1,1,1,4,4,4,4,4,1,1,1,1,1,1,1,1 32 | 30,32,30,32,30,30,30,30,30,30,30,1,4,4,4,1,1,1,1,1,1,1,1,1 33 | 30,32,32,32,30,32,32,32,32,32,30,1,1,4,1,1,1,1,30,30,30,30,1,1 34 | 30,32,30,32,30,32,0,32,0,32,30,1,1,4,4,4,4,4,4,4,4,30,1,1 35 | 30,32,30,32,32,32,32,32,32,32,30,1,30,30,30,30,30,1,4,4,4,30,1,1 36 | 30,32,32,32,30,32,32,32,32,32,30,30,30,32,32,32,30,1,4,4,4,30,1,1 37 | 30,30,32,30,30,32,0,32,0,32,32,32,32,33,32,32,30,1,1,4,1,1,1,1 38 | 1,0,0,0,30,32,32,32,32,32,30,30,30,32,32,32,30,1,1,4,1,1,1,1 39 | 1,1,0,0,30,30,30,30,30,30,30,1,30,30,30,30,30,1,1,4,1,1,1,1 40 | -------------------------------------------------------------------------------- /assets/res/event/erdricks_cave.evt: -------------------------------------------------------------------------------- 1 | ; --- erdrick's cave --- 2 | ; ---------------------- 3 | 4 | 5 | ; save_point {event_id} {pos_col} {pos_row} 6 | ; --- 7 | save_point save_point_1 55 12 8 | 9 | 10 | ; chest with eldrick's tablet (id = 51) 11 | ; note: this item will not be added to the player's inventory 12 | ; --- 13 | event chest_1 14 | animation tileset 6 7 100 15 | create_animation static 23 16 | location 55 15 17 | movement STATIC 18 | visible true 19 | blocked false 20 | fire_required true 21 | script 22 | on_map_enter: 23 | if_set #chest_1_opened "hide_event" 24 | change_event_visibility "chest_1" 1 25 | ret 26 | hide_event: 27 | change_event_visibility "chest_1" 0 28 | ret 29 | 30 | on_event_trigger: 31 | show_player_simplified_status 32 | change_event_visibility "chest_1" 0 33 | force_redraw 34 | set #chest_1_opened 1 35 | ; 13 = chest opened sound 36 | play_sound 13 37 | found_item: 38 | set #chest_001_item_id 51 39 | set $$chest_item_name "Eldrick's Tablet" 40 | show_dialog 0 0 @@chest_found_item_1 41 | show_dialog 0 2 @@chest_found_item_2 42 | 43 | show_dialog 0 2 @@item_erdricks_tablet_1 44 | show_dialog 0 0 "" 45 | show_dialog 1 2 @@item_erdricks_tablet_2 46 | show_dialog 1 2 @@item_erdricks_tablet_3 47 | show_dialog 1 2 @@item_erdricks_tablet_4 48 | show_dialog 1 2 @@item_erdricks_tablet_5 49 | show_dialog 1 2 @@item_erdricks_tablet_6 50 | show_dialog 1 1 @@item_erdricks_tablet_7 51 | 52 | close_dialog 53 | hide_player_simplified_status 54 | ret 55 | script_end 56 | event_end 57 | 58 | 59 | ;teleport {event_id} {sprite_id} {pos_col} {pos_row} {map_id} \ 60 | ; {player_col} {player_row} {player_direction} \ 61 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 62 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 63 | ; {resetRepel->true|false] {resetLight->true|false] 64 | ;--- 65 | teleport teleport_0 28 12 12 world 32 16 down default_sound true world false false false true 66 | teleport teleport_1 29 21 21 erdricks_cave 55 21 right default_sound true dungeon true true false false 67 | teleport teleport_2 28 54 21 erdricks_cave 20 21 left default_sound true dungeon true true false false 68 | 69 | -------------------------------------------------------------------------------- /src/dq1/core/Spell.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | /** 4 | * Spell class. 5 | * 6 | * @author Leonardo Ono (ono.leo@gmail.com) 7 | */ 8 | public class Spell { 9 | 10 | public static final Spell EMPTY 11 | = new Spell(0, "", 0, 0, false, false); 12 | 13 | private final int id; 14 | private final String name; 15 | private final int level; 16 | private final int mp; 17 | private final boolean useInBattle; 18 | private final boolean useInMap; 19 | 20 | private Script script; 21 | 22 | public Spell(int id, String name, int level, int mp 23 | , boolean useInBattle, boolean useInMap) { 24 | 25 | this.id = id; 26 | this.name = name; 27 | this.level = level; 28 | this.mp = mp; 29 | this.useInBattle = useInBattle; 30 | this.useInMap = useInMap; 31 | } 32 | 33 | public Spell(String serializedData) { 34 | String[] args = serializedData.trim().split(","); 35 | String[] h = args[0].trim().split("\\s+"); 36 | id = Integer.parseInt(h[1]); 37 | name = args[1].trim(); 38 | level = Integer.parseInt(args[2].trim()); 39 | mp = Integer.parseInt(args[3].trim()); 40 | useInBattle = Boolean.parseBoolean(args[4].trim()); 41 | useInMap = Boolean.parseBoolean(args[5].trim()); 42 | } 43 | 44 | public int getId() { 45 | return id; 46 | } 47 | 48 | public String getName() { 49 | return name; 50 | } 51 | 52 | public int getLevel() { 53 | return level; 54 | } 55 | 56 | public int getMp() { 57 | return mp; 58 | } 59 | 60 | public boolean isUseInBattle() { 61 | return useInBattle; 62 | } 63 | 64 | public boolean isUseInMap() { 65 | return useInMap; 66 | } 67 | 68 | public Script getScript() { 69 | return script; 70 | } 71 | 72 | public void setScript(Script script) { 73 | this.script = script; 74 | } 75 | 76 | // return boolean -> cast successfully 77 | public boolean cast(String when) throws Exception { 78 | if (script != null) { 79 | return script.execute(when); 80 | } 81 | return false; 82 | } 83 | 84 | @Override 85 | public String toString() { 86 | return "Spell{" + "id=" + id + ", name=" + name + ", level=" + level 87 | + ", mp=" + mp + ", useInBattle=" + useInBattle 88 | + ", useInMap=" + useInMap + '}'; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/dq1/core/BitmapFont.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import static dq1.core.Settings.*; 4 | import java.awt.Graphics2D; 5 | import java.awt.Image; 6 | import java.awt.image.BufferedImage; 7 | 8 | /** 9 | * BitmapFont class. 10 | * 11 | * @author Leonardo Ono (ono.leo80@gmail.com) 12 | */ 13 | public class BitmapFont { 14 | 15 | public static BufferedImage bitmapFontImage; 16 | public static BufferedImage[] letters; 17 | 18 | public static int letterWidth; 19 | public static int letterHeight; 20 | public static int letterVerticalSpacing = 0; 21 | public static int letterHorizontalSpacing = 0; 22 | 23 | static { 24 | loadFont(RES_BITMAP_FONT_IMAGE, 16, 16); 25 | } 26 | 27 | public static void drawText(Graphics2D g, String text, int col, int row) { 28 | if (letters == null) { 29 | return; 30 | } 31 | int x = col * letterWidth; 32 | int y = row * letterHeight; 33 | int px = 0; 34 | int py = 0; 35 | for (int i=0; i COLORS = new HashMap<>(); 53 | 54 | // example: red color = 0xff0000 55 | public static Color getColor(String encodedColor) { 56 | Color color = COLORS.get(encodedColor); 57 | if (color == null) { 58 | if (encodedColor.startsWith("0x") && encodedColor.length() == 10) { 59 | int r = Integer.parseUnsignedInt( 60 | encodedColor.substring(2, 4), 16); 61 | 62 | int g = Integer.parseUnsignedInt( 63 | encodedColor.substring(4, 6), 16); 64 | 65 | int b = Integer.parseUnsignedInt( 66 | encodedColor.substring(6, 8), 16); 67 | 68 | int a = Integer.parseUnsignedInt( 69 | encodedColor.substring(8, 10), 16); 70 | 71 | color = new Color(r, g, b, a); 72 | COLORS.put(encodedColor, color); 73 | } 74 | else { 75 | color = Color.decode(encodedColor); 76 | COLORS.put(encodedColor, color); 77 | } 78 | } 79 | return color; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/dq1/core/Animation.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import java.awt.Graphics2D; 4 | import java.awt.image.BufferedImage; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * Animation class. 10 | * 11 | * @author Leonardo Ono (ono.leo80@gmail.com) 12 | */ 13 | public class Animation { 14 | 15 | private final BufferedImage image; 16 | private final int cols; 17 | private final int rows; 18 | private int animationSpeed = 60; 19 | private final Map animationsFrames 20 | = new HashMap<>(); 21 | 22 | private BufferedImage[] currentAnimation; 23 | private String currentAnimationId; 24 | private int frameIndex; // divided by 1000 25 | 26 | public Animation( 27 | BufferedImage image, int cols, int rows, int animationSpeed) { 28 | 29 | this.image = image; 30 | this.cols = cols; 31 | this.rows = rows; 32 | this.animationSpeed = animationSpeed; 33 | } 34 | 35 | public int getAnimationSpeed() { 36 | return animationSpeed; 37 | } 38 | 39 | public void setAnimationSpeed(int animationSpeed) { 40 | this.animationSpeed = animationSpeed; 41 | } 42 | 43 | public void createAnimation(String id, int[] frames) { 44 | BufferedImage[] animationFrames = new BufferedImage[frames.length]; 45 | for (int i = 0; i < frames.length; i++) { 46 | int index = frames[i]; 47 | animationFrames[i] = getFrameImage(index); 48 | } 49 | animationsFrames.put(id, animationFrames); 50 | change(id); 51 | } 52 | 53 | public BufferedImage getFrameImage(int frameIndex) { 54 | if (image != null) { 55 | int frameWidth = image.getWidth() / cols; 56 | int frameHeight = image.getHeight() / rows; 57 | int ix = (frameIndex % cols) * frameWidth; 58 | int iy = (frameIndex / cols) * frameHeight; 59 | return image.getSubimage(ix, iy, frameWidth, frameHeight); 60 | } 61 | return null; 62 | } 63 | 64 | public void change(String id) { 65 | if (currentAnimationId != null && currentAnimationId.equals(id)) { 66 | return; 67 | } 68 | frameIndex = 0; 69 | currentAnimation = animationsFrames.get(id); 70 | currentAnimationId = id; 71 | } 72 | 73 | public void update() { 74 | if (currentAnimation != null) { 75 | frameIndex += animationSpeed; 76 | } 77 | } 78 | 79 | public void draw(Graphics2D g, int x, int y) { 80 | if (currentAnimation != null) { 81 | int index = (frameIndex / 1000) % currentAnimation.length; 82 | BufferedImage imageFrame = currentAnimation[index]; 83 | g.drawImage(imageFrame, x, y, null); 84 | } 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/dq1/core/Settings.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import java.awt.event.KeyEvent; 4 | 5 | /** 6 | * (Project) Settings class. 7 | * 8 | * @author Leonardo Ono (ono.leo80@gmail.com) 9 | */ 10 | public class Settings { 11 | 12 | // --- display --- 13 | 14 | public static final int CANVAS_WIDTH = 256; 15 | public static final int CANVAS_HEIGHT = 240; 16 | 17 | public static final int VIEWPORT_WIDTH = (int) (CANVAS_WIDTH * 2.5); 18 | public static final int VIEWPORT_HEIGHT = (int) (CANVAS_HEIGHT * 2.0); 19 | 20 | // --- input --- 21 | 22 | public static int KEY_LEFT = KeyEvent.VK_LEFT; 23 | public static int KEY_RIGHT = KeyEvent.VK_RIGHT; 24 | public static int KEY_UP = KeyEvent.VK_UP; 25 | public static int KEY_DOWN = KeyEvent.VK_DOWN; 26 | public static int KEY_CONFIRM = KeyEvent.VK_X; 27 | public static int KEY_CANCEL = KeyEvent.VK_Z; 28 | 29 | // --- resources --- 30 | 31 | public static final String RES_IMAGE_FILE_EXT = ".png"; 32 | public static final String RES_SOUND_FILE_EXT = ".sf2"; 33 | public static final String RES_MUSIC_FILE_EXT = ".mid"; 34 | public static final String RES_INF_FILE_EXT = ".inf"; 35 | public static final String RES_MAP_FILE_EXT = ".map"; 36 | public static final String RES_EVENT_FILE_EXT = ".evt"; 37 | 38 | public static final String RES_IMAGE_PATH = "/res/image/"; 39 | public static final String RES_SOUND_PATH = "/res/audio/"; 40 | public static final String RES_MUSIC_PATH = "/res/audio/"; 41 | public static final String RES_INF_PATH = "/res/inf/"; 42 | public static final String RES_MAP_PATH = "/res/map/"; 43 | public static final String RES_EVENT_PATH = "/res/event/"; 44 | 45 | public static final String RES_SOUND_BANK = "tinypsg"; 46 | public static final String RES_SOUND_EFFECTS = "sound_effects"; 47 | 48 | public static final String RES_MUSICS_INF = "musics"; 49 | public static final String RES_ENEMIES_INF = "enemies"; 50 | public static final String RES_ITEMS_INF = "items"; 51 | public static final String RES_SPELLS_INF = "spells"; 52 | public static final String RES_PLAYER_LEVELS_INF = "player_levels"; 53 | public static final String RES_TILESET_INF = "tileset"; 54 | public static final String RES_TEXTS_INF = "texts"; 55 | 56 | public static final String RES_BITMAP_FONT_IMAGE = "bitmap_font"; 57 | public static final String RES_TILESET_IMAGE = "tileset"; 58 | public static final String RES_CHARS_IMAGE = "chars"; 59 | public static final String RES_SAVE_POINT_IMAGE = "blue_fire"; 60 | public static final String RES_BATTLE_ENEMIES_IMAGE = "enemies"; 61 | public static final String RES_BATTLE_BACKGROUNDS_IMAGE 62 | = "battle_backgrounds"; 63 | 64 | public static final String BATTLE_MUSIC_ID = "battle"; 65 | 66 | } 67 | -------------------------------------------------------------------------------- /nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 6 | application.title=JavaDragonQuest1 7 | application.vendor=admin 8 | build.classes.dir=${build.dir}/classes 9 | build.classes.excludes=**/*.java,**/*.form 10 | # This directory is removed when the project is cleaned: 11 | build.dir=build 12 | build.generated.dir=${build.dir}/generated 13 | build.generated.sources.dir=${build.dir}/generated-sources 14 | # Only compile against the classpath explicitly listed here: 15 | build.sysclasspath=ignore 16 | build.test.classes.dir=${build.dir}/test/classes 17 | build.test.results.dir=${build.dir}/test/results 18 | # Uncomment to specify the preferred debugger connection transport: 19 | #debug.transport=dt_socket 20 | debug.classpath=\ 21 | ${run.classpath} 22 | debug.modulepath=\ 23 | ${run.modulepath} 24 | debug.test.classpath=\ 25 | ${run.test.classpath} 26 | debug.test.modulepath=\ 27 | ${run.test.modulepath} 28 | # Files in build.classes.dir which should be excluded from distribution jar 29 | dist.archive.excludes= 30 | # This directory is removed when the project is cleaned: 31 | dist.dir=dist 32 | dist.jar=${dist.dir}/JavaDragonQuest1.jar 33 | dist.javadoc.dir=${dist.dir}/javadoc 34 | dist.jlink.dir=${dist.dir}/jlink 35 | dist.jlink.output=${dist.jlink.dir}/JavaDragonQuest1 36 | endorsed.classpath= 37 | excludes= 38 | includes=** 39 | jar.compress=false 40 | javac.classpath= 41 | # Space-separated list of extra javac options 42 | javac.compilerargs= 43 | javac.deprecation=false 44 | javac.external.vm=true 45 | javac.modulepath= 46 | javac.processormodulepath= 47 | javac.processorpath=\ 48 | ${javac.classpath} 49 | javac.source=1.8 50 | javac.target=1.8 51 | javac.test.classpath=\ 52 | ${javac.classpath}:\ 53 | ${build.classes.dir} 54 | javac.test.modulepath=\ 55 | ${javac.modulepath} 56 | javac.test.processorpath=\ 57 | ${javac.test.classpath} 58 | javadoc.additionalparam= 59 | javadoc.author=false 60 | javadoc.encoding=${source.encoding} 61 | javadoc.html5=false 62 | javadoc.noindex=false 63 | javadoc.nonavbar=false 64 | javadoc.notree=false 65 | javadoc.private=false 66 | javadoc.splitindex=true 67 | javadoc.use=true 68 | javadoc.version=false 69 | javadoc.windowtitle= 70 | # The jlink additional root modules to resolve 71 | jlink.additionalmodules= 72 | # The jlink additional command line parameters 73 | jlink.additionalparam= 74 | jlink.launcher=true 75 | jlink.launcher.name=JavaDragonQuest1 76 | main.class=main.Main 77 | manifest.file=manifest.mf 78 | meta.inf.dir=${src.dir}/META-INF 79 | mkdist.disabled=false 80 | platform.active=JDK_1.8 81 | run.classpath=\ 82 | ${javac.classpath}:\ 83 | ${build.classes.dir} 84 | # Space-separated list of JVM arguments used when running the project. 85 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 86 | # To set system properties for unit tests define test-sys-prop.name=value: 87 | run.jvmargs= 88 | run.modulepath=\ 89 | ${javac.modulepath} 90 | run.test.classpath=\ 91 | ${javac.test.classpath}:\ 92 | ${build.test.classes.dir} 93 | run.test.modulepath=\ 94 | ${javac.test.modulepath} 95 | source.encoding=UTF-8 96 | src.assets.dir=assets 97 | src.dir=src 98 | test.src.dir=test 99 | -------------------------------------------------------------------------------- /assets/res/inf/enemies.inf: -------------------------------------------------------------------------------- 1 | #Group 1: #00 (Slime) - #19 (Druinlord) 2 | #Group 2: #20 (Drollmagi) - #29 (Werewolf) 3 | #Group 3: #30 (Green Dragon) - #34 (Blue Dragon) 4 | #Group 4: #35 (Stoneman) - #39 (Dragonlord second form) 5 | 6 | # ID Enemy Name Str Agi HP Pat SR DR XP GP Group_ID Final_boss 7 | 00, Slime , 05, 03, 03, 00, 0F, 01, 01, 02, 01, false 8 | 01, Red Slime , 07, 03, 04, 00, 0F, 01, 01, 03, 01, false 9 | 02, Drakee , 09, 06, 06, 00, 0F, 01, 02, 03, 01, false 10 | 03, Ghost , 0B, 08, 07, 00, 0F, 04, 03, 05, 01, false 11 | 04, Magician , 0B, 0C, 0D, 02, 00, 01, 04, 0C, 01, false 12 | 05, Magidrakee , 0E, 0E, 0F, 02, 00, 01, 05, 0C, 01, false 13 | 06, Scorpion , 12, 10, 14, 00, 0F, 01, 06, 10, 01, false 14 | 07, Druin , 14, 12, 16, 00, 0F, 02, 07, 10, 01, false 15 | 08, Poltergeist , 12, 14, 17, 03, 00, 06, 08, 12, 01, false 16 | 09, Droll , 18, 18, 19, 00, 0E, 02, 0A, 19, 01, false 17 | 0A, Drakeema , 16, 1A, 14, 92, 20, 06, 0B, 14, 01, false 18 | 0B, Skeleton , 1C, 16, 1E, 00, 0F, 04, 0B, 1E, 01, false 19 | 0C, Warlock , 1C, 16, 1E, 12, 31, 02, 0D, 23, 01, false 20 | 0D, Metal Scorpion , 24, 2A, 16, 00, 0F, 02, 0E, 28, 01, false 21 | 0E, Wolf , 28, 1E, 22, 00, 1F, 02, 10, 32, 01, false 22 | 0F, Wraith , 2C, 22, 24, 90, 70, 04, 11, 3C, 01, false 23 | 10, Metal Slime , 0A, FF, 04, 03, FF, F1, 73, 06, 01, false 24 | 11, Specter , 28, 26, 24, 13, 31, 04, 12, 46, 01, false 25 | 12, Wolflord , 32, 24, 26, 60, 47, 02, 14, 50, 01, false 26 | 13, Druinlord , 2F, 28, 23, B1, F0, 04, 14, 55, 01, false 27 | 14, Drollmagi , 34, 32, 26, 60, 22, 01, 16, 5A, 02, false 28 | 15, Wyvern , 38, 30, 2A, 00, 4F, 02, 18, 64, 02, false 29 | 16, Rogue Scorpion , 3C, 5A, 23, 00, 7F, 02, 1A, 6E, 02, false 30 | 17, Wraith Knight , 44, 38, 2E, B0, 50, 34, 1C, 78, 02, false 31 | 18, Golem , 78, 3C, 46, 00, FF, F0, 05, 0A, 02, false 32 | 19, Goldman , 30, 28, 32, 00, DF, 01, 06, C8, 02, false 33 | 1A, Knight , 4C, 4E, 37, 60, 67, 01, 21, 82, 02, false 34 | 1B, Magiwyvern , 4E, 44, 3A, 20, 20, 02, 22, 8C, 02, false 35 | 1C, Demon Knight , 4F, 40, 32, 00, FF, FF, 25, 96, 02, false 36 | 1D, Werewolf , 56, 46, 3C, 00, 7F, 07, 28, 9B, 02, false 37 | 1E, Green Dragon , 58, 4A, 41, 09, 7F, 22, 2D, A0, 03, false 38 | 1F, Starwyvern , 56, 50, 41, F9, 80, 12, 2B, A0, 03, false 39 | 20, Wizard , 50, 46, 41, 06, F7, F2, 32, A5, 03, false 40 | 21, Axe Knight , 5E, 52, 46, 10, F3, 11, 36, A5, 03, false 41 | 22, Blue Dragon , 62, 54, 46, 09, FF, 72, 3C, 96, 03, false 42 | 23, Stoneman , 64, 28, A0, 00, 2F, 71, 41, 8C, 04, false 43 | 24, Armored Knight , 69, 56, 5A, F5, F7, 12, 46, 8C, 04, false 44 | 25, Red Dragon , 78, 5A, 64, 19, F7, F2, 64, 8C, 04, false 45 | 26, Dragonlord , 5A, 4B, 64, 57, FF, F0, 00, 00, 04, true 46 | 27, Dragonlord , 8C, C8, 82, 0E, FF, F0, 00, 00, 04, true 47 | 48 | -------------------------------------------------------------------------------- /src/dq1/core/Credits.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import java.awt.Graphics2D; 4 | import java.awt.image.BufferedImage; 5 | import java.io.File; 6 | import javax.imageio.ImageIO; 7 | 8 | /** 9 | * 10 | * @author admin 11 | */ 12 | public class Credits { 13 | 14 | static String msg = "\n\n" + 15 | "Original Credits\n" + 16 | "\n" + 17 | "\n" + 18 | "\n" + 19 | "Dragon Warrior Staff:\n" + 20 | "\n" + 21 | "\n" + 22 | "\n" + 23 | "Scenario Written by: \n" + 24 | "\n" + 25 | " Yuji Horii\n" + 26 | "\n" + 27 | "\n" + 28 | "\n" + 29 | "Character Designed by: \n" + 30 | "\n" + 31 | " Akira Toriyama\n" + 32 | "\n" + 33 | "\n" + 34 | "\n" + 35 | "Music Composed by: \n" + 36 | "\n" + 37 | " Koichi Sugiyama\n" + 38 | "\n" + 39 | "\n" + 40 | "\n" + 41 | "Programmed by: \n" + 42 | "\n" + 43 | " Koichi Nakamura\n" + 44 | " Koji Yoshida\n" + 45 | " Takenori Yamamori\n" + 46 | "\n" + 47 | "\n" + 48 | "\n" + 49 | "CG Designed by: \n" + 50 | "\n" + 51 | " Takashi Yasuno\n" + 52 | "\n" + 53 | "\n" + 54 | "\n" + 55 | "Scenario Assisted by: \n" + 56 | "\n" + 57 | " Hiroshi Miyaoka\n" + 58 | "\n" + 59 | "\n" + 60 | "\n" + 61 | "Assisted by: \n" + 62 | "\n" + 63 | " Rika Suzuki\n" + 64 | " Tadashi Fukuzawa\n" + 65 | "\n" + 66 | "\n" + 67 | "\n" + 68 | "Special Thanks to: \n" + 69 | "\n" + 70 | " Kazuhiko Torishima\n" + 71 | "\n" + 72 | "\n" + 73 | "\n" + 74 | "Translation Staff:\n" + 75 | "\n" + 76 | "\n" + 77 | "\n" + 78 | "Translated by: \n" + 79 | "\n" + 80 | " Toshiko Watson\n" + 81 | "\n" + 82 | "\n" + 83 | "\n" + 84 | "Revised Text by: \n" + 85 | "\n" + 86 | " Scott Pelland\n" + 87 | "\n" + 88 | "\n" + 89 | "\n" + 90 | "Technical Support by: \n" + 91 | "\n" + 92 | " Doug Baker\n" + 93 | "\n" + 94 | "\n" + 95 | "\n" + 96 | "Programmed by: \n" + 97 | "\n" + 98 | " Kenichi Masuta\n" + 99 | " Manabu Yamana\n" + 100 | "\n" + 101 | "\n" + 102 | "\n" + 103 | "CG Designed by: \n" + 104 | "\n" + 105 | " Satoshi Fudaba\n" + 106 | "\n" + 107 | "\n" + 108 | "\n" + 109 | "Special Thanks to: \n" + 110 | "\n" + 111 | " Howard Phillips\n" + 112 | "\n" + 113 | "\n" + 114 | "\n" + 115 | "Directed by: \n" + 116 | "\n" + 117 | " Koichi Nakamura\n" + 118 | "\n" + 119 | "\n" + 120 | "\n" + 121 | "Produced by: \n" + 122 | "\n" + 123 | " Yukinobu Chida\n" + 124 | "\n" + 125 | "\n" + 126 | "\n" + 127 | "Java PC version by: \n" + 128 | "\n" + 129 | " O.L.\n" + 130 | "\n" + 131 | "\n" + 132 | "\n" + 133 | "Based on DRAGON QUEST\n" + 134 | "\n" + 135 | "\n" + 136 | "\n" + 137 | "Copyright\n" + 138 | "\n" + 139 | "\n" + 140 | "\n" + 141 | "Armor Project 1986-1989\n" + 142 | "Bird Studio 1986-1989\n" + 143 | "Koichi Sugiyama 1986-1989\n" + 144 | "Chun Soft 1986-1989\n" + 145 | "Enix 1986-1989\n" + 146 | "O.L. 2021-2021\n" + 147 | "\n" + 148 | "\n"; 149 | 150 | public static void main(String[] args) throws Exception { 151 | BitmapFont font = new BitmapFont(); 152 | BufferedImage result = new BufferedImage(256, 240 * 10, BufferedImage.TYPE_INT_RGB); 153 | Graphics2D g = (Graphics2D) result.getGraphics(); 154 | String[] lines = msg.split("\n"); 155 | int lineNumber = 0; 156 | for (String line : lines) { 157 | font.drawText(g, line, 3, lineNumber); 158 | lineNumber++; 159 | } 160 | ImageIO.write(result, "png", new File("d:/dq1_credits.png")); 161 | } 162 | 163 | } 164 | -------------------------------------------------------------------------------- /assets/res/inf/tileset.inf: -------------------------------------------------------------------------------- 1 | # tileset size imageFileName,tileWidth,tileHeight 2 | tileset 3 | 16 4 | 17 5 | 6 | # tileset extra information 7 | # tileId,propertyName=propertyValue[,propertyName=propertyValue[,...]] 8 | 9 | 0,blocked=false,damagePerStep=0,battleBackgroundId=0,enemy_probability=1/24 10 | 1,blocked=false,damagePerStep=0,battleBackgroundId=1,enemy_probability=1/16 11 | 2,blocked=false,damagePerStep=0,battleBackgroundId=2,enemy_probability=1/16 12 | 3,blocked=true,damagePerStep=0,battleBackgroundId=2,enemy_probability=0/1 13 | 4,blocked=false,damagePerStep=0,battleBackgroundId=3,enemy_probability=1/8 14 | 5,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=1/8 15 | 16 | 6,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 17 | 7,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 18 | 8,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 19 | 9,blocked=false,damagePerStep=0,battleBackgroundId=0,enemy_probability=1/24 20 | 10,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 21 | 11,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 22 | 23 | 12,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 24 | 13,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 25 | 14,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 26 | 15,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 27 | 16,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 28 | 17,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 29 | 30 | 18,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 31 | 19,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 32 | 20,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 33 | 21,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 34 | 22,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 35 | 23,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 36 | 37 | 24,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 38 | 25,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 39 | 26,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 40 | 27,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 41 | 28,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 42 | 29,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 43 | 44 | 30,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 45 | 31,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 46 | 32,blocked=false,damagePerStep=0,battleBackgroundId=9,enemy_probability=1/16 47 | 33,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 48 | 34,blocked=false,damagePerStep=15,battleBackgroundId=12,enemy_probability=1/16 49 | 35,blocked=false,damagePerStep=2,battleBackgroundId=4,enemy_probability=1/16 50 | 51 | 36,blocked=true,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 52 | 53 | # use tiles below to avoid enemies encounters 54 | 55 | 37,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 56 | 38,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 57 | 39,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 58 | 40,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 59 | 41,blocked=false,damagePerStep=0,battleBackgroundId=12,enemy_probability=0/1 60 | 61 | # --- enemy_probability --- 62 | #Zone 0 63 | #Grasslands: 1/48 64 | #Bridge: 1/48 65 | #Forest: 1/32 66 | #Hills: 1/32 67 | #Desert: 1/16 (There is only one square of desert in this region) 68 | # 69 | #Every other zone, including dungeons 70 | #Grasslands: 1/24 71 | #Swamp: 1/16 72 | #Forest: 1/16 73 | #Hills: 1/8 74 | #Desert: 1/8 75 | # 76 | #Stairs: 1/24 77 | #Chest: 1/24 78 | #Barrier: 1/16 79 | #Brick: 1/16 80 | 81 | -------------------------------------------------------------------------------- /src/dq1/core/OLPresents.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.awt.Graphics2D; 6 | import java.awt.geom.AffineTransform; 7 | import java.awt.image.BufferedImage; 8 | import javax.swing.JPanel; 9 | 10 | /** 11 | * OLPresents class. 12 | * 13 | * @author Leonardo Ono (ono.leo80@gmail.com) 14 | */ 15 | public class OLPresents extends JPanel { 16 | 17 | private static final BufferedImage OFFSCREEN; 18 | private static final Graphics2D G1; 19 | private static final BufferedImage OFFSCREEN2; 20 | private static final Graphics2D G2; 21 | private static final BufferedImage BLOCK; 22 | private static final BufferedImage[] WALLS = new BufferedImage[2]; 23 | private static final AffineTransform CAMERA_TRANSFORM 24 | = new AffineTransform(); 25 | 26 | private static final Color[] COLORS = new Color[32]; 27 | private static double angle = 0; 28 | private static double value = 10; 29 | 30 | static { 31 | BufferedImage olPresents = Resource.getImage("ol_presents"); 32 | BLOCK = olPresents.getSubimage(0, 0, 24, 24); 33 | WALLS[0] = olPresents.getSubimage(24, 0, 24, 24); 34 | WALLS[1] = olPresents.getSubimage(48, 0, 24, 24); 35 | OFFSCREEN = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); 36 | OFFSCREEN2 = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); 37 | G1 = (Graphics2D) OFFSCREEN.getGraphics(); 38 | G2 = (Graphics2D) OFFSCREEN2.getGraphics(); 39 | for (int i = 0; i < COLORS.length; i++) { 40 | int c = (int) (255 * (i / 31.0)); 41 | COLORS[i] = new Color(0, 0, 0, c); 42 | } 43 | } 44 | 45 | public static void reset() { 46 | angle = 0; 47 | value = 10; 48 | } 49 | 50 | public static boolean update() { 51 | angle = -0.7725 + value; 52 | if (value > 2.5) { 53 | value -= 0.0795; 54 | } 55 | else { 56 | value *= 0.9825; 57 | value -= 0.008; 58 | } 59 | if (value < 0.01) { 60 | value = 0; 61 | return false; 62 | } 63 | return true; 64 | } 65 | 66 | public static void draw(Graphics g) { 67 | G1.setBackground(new Color(0, 0, 0, 255)); 68 | G1.clearRect(0, 0, 256, 256); 69 | int dx = (int) (0 * Math.sin(angle)); 70 | int dy = (int) (164 * (value / 10.0)); 71 | CAMERA_TRANSFORM.setToIdentity(); 72 | CAMERA_TRANSFORM.translate(128 + dx, 164 - dy); 73 | CAMERA_TRANSFORM.rotate(-angle); 74 | CAMERA_TRANSFORM.translate(-12, -12); 75 | G1.drawImage(BLOCK, CAMERA_TRANSFORM, null); 76 | G2.setColor(Color.BLACK); 77 | G2.fillRect(0, 0, 256, 256); 78 | for (int y = 0; y < 250; y += 1) { 79 | double scale = y / 256.0; 80 | int x1 = (int) (128 * scale); 81 | int x2 = (int) (256 - 128 * scale); 82 | G2.drawImage(OFFSCREEN, 0, y, 256, y + 1, x1, y, x2, y + 1, null); 83 | } 84 | G1.clearRect(0, 0, 256, 256); 85 | outer: 86 | for (int x = 0; x < 256; x++) { 87 | for (int y = 255; y >= 0; y--) { 88 | int c = OFFSCREEN2.getRGB(x, y); 89 | if (c == -16777216) { 90 | OFFSCREEN2.setRGB(x, y, Color.BLUE.getRGB()); 91 | } 92 | else { 93 | double height = 12.0 / (1.0 - y / 256.0); 94 | int textureIndex = (c >> 8) & 255; // green 95 | if (textureIndex < 2) { 96 | int dx1 = x; 97 | int dy1 = (int) (128 - height); 98 | int dx2 = dx1 + 1; 99 | int dy2 = (int) (128 + height); 100 | int sx1 = (c & 255); 101 | int sy1 = 0; 102 | int sx2 = sx1 + 1; 103 | int sy2 = 24; 104 | G1.drawImage(WALLS[textureIndex] 105 | , dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null); 106 | } 107 | if (textureIndex < 2) { 108 | continue outer; 109 | } 110 | } 111 | } 112 | } 113 | g.drawImage(OFFSCREEN, 0, 0, 256, 240, null); 114 | int c = (int) (32 * (value / 10.0)); 115 | g.setColor(COLORS[c]); 116 | g.fillRect(0, 0, 256, 240); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /assets/res/map/hauksness.map: -------------------------------------------------------------------------------- 1 | # reference: http://www.realmofdarkness.net/dq/wp-content/img/nes/dw/maps/hauksness-3.png 2 | 3 | map_name Hauksness 4 | map_tileset tileset 5 | map_type dungeon 6 | map_out_of_bounds_tile_id 36 7 | map_is_dark true 8 | map_repel_has_no_effect true 9 | map_reset_repel_on_enter true 10 | map_reset_light_on_enter true 11 | # col1 row1 col2 row2 teleportMapId teleportCol teleportRow teleportPlayerDirection areaUseFadeEffect, areaMusicId, areaIsDark, areaRepelHasNoEffect, areaResetRepel, areaResetLight 12 | map_area 10 10 29 29 world 29 93 down true world false false false true 13 | map_rows 40 14 | map_cols 40 15 | map_data 16 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 17 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 18 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 19 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 20 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 21 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 22 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 23 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 24 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 25 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 26 | 4,4,4,4,4,4,4,4,4,4,30,30,4,4,0,30,30,4,30,30,30,30,30,30,30,32,32,30,35,30,4,4,4,4,4,4,4,4,4,4 27 | 4,4,4,4,4,4,4,4,4,4,30,4,4,0,1,30,4,32,32,33,32,30,1,0,0,4,32,35,35,30,4,4,4,4,4,4,4,4,4,4 28 | 4,4,4,4,4,4,4,4,4,4,4,4,4,1,0,30,30,32,32,30,32,30,0,0,0,32,35,35,4,30,4,4,4,4,4,4,4,4,4,4 29 | 4,4,4,4,4,4,4,4,4,4,4,0,0,0,35,35,30,30,32,30,30,30,0,35,0,32,32,35,4,4,4,4,4,4,4,4,4,4,4,4 30 | 4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,35,35,0,32,0,0,0,1,0,0,32,32,0,4,30,4,4,4,4,4,4,4,4,4,4 31 | 4,4,4,4,4,4,4,4,4,4,30,0,32,32,32,4,35,4,32,32,32,4,4,32,32,4,32,0,0,30,4,4,4,4,4,4,4,4,4,4 32 | 4,4,4,4,4,4,4,4,4,4,30,0,32,32,32,32,4,32,32,4,4,4,32,32,32,32,32,0,1,0,4,4,4,4,4,4,4,4,4,4 33 | 4,4,4,4,4,4,4,4,4,4,0,0,32,32,0,4,4,4,0,1,0,0,0,0,0,0,32,0,0,1,4,4,4,4,4,4,4,4,4,4 34 | 4,4,4,4,4,4,4,4,4,4,30,0,32,32,0,4,30,30,30,30,4,30,32,32,32,30,32,30,30,0,4,4,4,4,4,4,4,4,4,4 35 | 4,4,4,4,4,4,4,4,4,4,32,32,4,32,0,30,32,32,32,4,4,30,35,0,30,32,33,35,30,4,4,4,4,4,4,4,4,4,4,4 36 | 4,4,4,4,4,4,4,4,4,4,32,4,32,32,0,30,30,30,33,30,30,30,0,35,30,32,35,35,30,35,4,4,4,4,4,4,4,4,4,4 37 | 4,4,4,4,4,4,4,4,4,4,1,1,32,32,1,30,4,4,32,32,32,30,1,0,30,30,35,30,30,35,4,4,4,4,4,4,4,4,4,4 38 | 4,4,4,4,4,4,4,4,4,4,1,0,4,32,1,30,4,30,32,30,4,30,1,1,4,4,35,35,1,30,4,4,4,4,4,4,4,4,4,4 39 | 4,4,4,4,4,4,4,4,4,4,30,0,32,4,1,30,32,32,32,4,4,4,1,4,0,30,30,30,30,4,4,4,4,4,4,4,4,4,4,4 40 | 4,4,4,4,4,4,4,4,4,4,30,0,32,32,0,30,30,32,32,30,30,30,4,0,0,30,4,4,4,30,4,4,4,4,4,4,4,4,4,4 41 | 4,4,4,4,4,4,4,4,4,4,30,35,4,32,0,4,4,1,32,4,32,32,32,32,4,32,32,33,4,30,4,4,4,4,4,4,4,4,4,4 42 | 4,4,4,4,4,4,4,4,4,4,35,35,32,32,0,0,4,0,32,1,0,0,0,0,0,30,32,30,4,4,4,4,4,4,4,4,4,4,4,4 43 | 4,4,4,4,4,4,4,4,4,4,4,35,32,4,32,32,32,32,4,0,0,0,35,0,0,30,30,30,30,30,4,4,4,4,4,4,4,4,4,4 44 | 4,4,4,4,4,4,4,4,4,4,30,35,35,35,0,0,0,0,0,0,0,35,35,35,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 45 | 4,4,4,4,4,4,4,4,4,4,4,4,35,30,30,30,30,0,30,35,35,35,35,30,30,30,4,30,30,30,4,4,4,4,4,4,4,4,4,4 46 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 47 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 48 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 49 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 50 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 51 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 52 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 53 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 54 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 55 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 56 | 57 | # monsters zone 58 | zone_rows 1 59 | zone_cols 1 60 | zone_tiles_per_row 40 61 | zone_tiles_per_col 40 62 | zone_offset_rows 0 63 | zone_offset_cols 0 64 | # note: zone_data needs to be in decimal 65 | zone_data 66 | 13 67 | 68 | # zone <-> enemies 69 | zone_enemies_rows 20 70 | zone_enemies_cols 5 71 | # note: zone_enemies_data needs to be in hexadecimal 72 | zone_enemies_data 73 | 00,00,01,00,01,00 74 | 01,01,00,01,02,01 75 | 02,00,03,02,03,01 76 | 03,01,01,02,03,04 77 | 04,03,04,05,05,06 78 | 05,03,04,05,06,0B 79 | 06,05,06,0B,0C,0E 80 | 07,0B,0C,0D,0E,0E 81 | 08,0D,0F,12,12,19 82 | 09,0F,15,12,15,19 83 | 0A,15,16,17,1A,1C 84 | 0B,17,1A,1B,1C,10 85 | 0C,1A,1B,1C,1D,1F 86 | 0D,1D,1E,1F,1F,20 87 | 0E,08,09,0A,0B,0C 88 | 0F,11,12,13,14,17 89 | 10,1D,1E,1F,20,21 90 | 11,20,21,22,22,23 91 | 12,20,23,24,24,25 92 | 13,03,04,06,07,07 93 | -------------------------------------------------------------------------------- /src/dq1/core/Shop.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import dq1.core.Script.ScriptCommand; 4 | import static dq1.core.Settings.*; 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Shop class. 10 | * 11 | * @author Leonardo Ono (ono.leo80@gmail.com) 12 | */ 13 | public class Shop { 14 | 15 | private static final List ITEMS = new ArrayList<>(); 16 | 17 | @ScriptCommand(name = "clear_shop") 18 | public static void clearShop() { 19 | ITEMS.clear(); 20 | } 21 | 22 | @ScriptCommand(name = "add_shop_item") 23 | public static void addShopItem(int itemId, int buyPrice, int sellPrice) { 24 | Item item = Resource.getItemById(itemId); 25 | item.setBuy(buyPrice >= 0 ? buyPrice : item.getBuyOriginal()); 26 | item.setSell(sellPrice >= 0 ? sellPrice : item.getSellOriginal()); 27 | ITEMS.add(item); 28 | } 29 | 30 | public static Item showShopBuyItem() { 31 | Dialog.drawBoxBorder(3, 9, 3, 27, 4); 32 | 33 | Item returnItem = null; 34 | 35 | int row = 4; 36 | for (Item itemTmp : ITEMS) { 37 | Dialog.drawBoxBorder(3, 9, row + 1, 27, row + 2); 38 | 39 | Dialog.printText(3, 9, row 40 | , (char) Dialog.getBOX_BORDER().left + " " 41 | + (char) Dialog.getBOX_BORDER().right); 42 | 43 | Dialog.printText(3, 9, row + 1 44 | , (char) Dialog.getBOX_BORDER().left + " " 45 | + (char) Dialog.getBOX_BORDER().right); 46 | 47 | int maxCols = itemTmp.getMaxCount() > 1 ? 8 : 9; 48 | String[] names = itemTmp.getName().trim().split("\\s+"); 49 | String[] nameLine = new String[] { "", "" }; 50 | int nameLineIndex = 0; 51 | int nameLineLength = 0; 52 | for (int i = 0; i < names.length; i++) { 53 | if (nameLineLength + names[i].length() > maxCols) { 54 | nameLineIndex++; 55 | nameLineLength = 0; 56 | } 57 | nameLineLength += names[i].length(); 58 | nameLine[nameLineIndex] += names[i] 59 | + (nameLineLength < maxCols ? " " : ""); 60 | 61 | nameLineLength += nameLineLength < maxCols ? 1 : 0; 62 | } 63 | Dialog.printText(3, 11, row, nameLine[0]); 64 | Dialog.printText(3, 12, row + 1, nameLine[1]); 65 | 66 | String itemCountStr = Util.formatRight("" + itemTmp.getBuy(), 5); 67 | Dialog.printText(3, 27 - itemCountStr.length() 68 | , row, itemCountStr); 69 | row += 2; 70 | } 71 | 72 | if (ITEMS.isEmpty()) { 73 | View.getOffscreenGraphics2D(3).clearRect( 74 | 18 * 8, 5 * 8, 12 * 8, (2 * ITEMS.size() + 2) * 8); 75 | 76 | Dialog.print(0, 0, Game.getText("$$player_items_empty")); 77 | Game.sleep(500); 78 | } 79 | else { 80 | 81 | int selectedItem = 0; 82 | 83 | // for appropriate cursor start blink time 84 | long blinkTime = System.nanoTime(); 85 | 86 | while (true) { 87 | for (int r = 0; r < ITEMS.size(); r++) { 88 | Dialog.print(3, 10, 4 + 2 * r, ' '); 89 | } 90 | 91 | // blink cursor 92 | if ((int) ((System.nanoTime() - blinkTime) 93 | * 0.0000000035) % 2 == 0) { 94 | 95 | Dialog.print(3, 10, 4 + 2 * selectedItem, 2); 96 | } 97 | 98 | if (Input.isKeyJustPressed(KEY_UP) 99 | && selectedItem > 0) { 100 | 101 | selectedItem--; 102 | blinkTime = System.nanoTime(); 103 | } 104 | else if (Input.isKeyJustPressed(KEY_DOWN) 105 | && selectedItem < ITEMS.size() - 1) { 106 | 107 | selectedItem++; 108 | blinkTime = System.nanoTime(); 109 | } 110 | else if (Input.isKeyJustPressed(KEY_CONFIRM)) { 111 | Audio.playSound(Audio.SOUND_MENU_CONFIRMED); 112 | returnItem = ITEMS.get(selectedItem); 113 | break; 114 | } 115 | else if (Input.isKeyJustPressed(KEY_CANCEL)) { 116 | returnItem = null; 117 | break; 118 | } 119 | View.refresh(); 120 | Game.sleep(1000 / 60); 121 | } 122 | } 123 | View.getOffscreenGraphics2D(3).clearRect( 124 | 9 * 8, 3 * 8, 27 * 8, (2 * ITEMS.size() + 4) * 8); 125 | 126 | View.refresh(); 127 | return returnItem; 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /src/dq1/core/Magic.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import static dq1.core.Settings.*; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | /** 8 | * Magic class. 9 | * 10 | * Set of spells available for player. 11 | * This is the equivalent "Inventory" for spells. 12 | * 13 | * @author Leonardo Ono (ono.leo80@gmail.com) 14 | */ 15 | public class Magic { 16 | 17 | private static final List SPELLS_ID = new ArrayList<>(); 18 | 19 | // return null -> canceled 20 | public static Spell showSelectSpellDialog() { 21 | Spell returnSpell = null; 22 | Dialog.drawBoxBorder(3, 18, 3, 29, 4); 23 | Dialog.printText(3, 22, 3, Game.getText("@@map_menu_spell")); 24 | 25 | Dialog.print(3, 21, 3, 15); 26 | 27 | Dialog.printText(3, 18, 4 28 | , (char) Dialog.getBOX_BORDER().left + " " 29 | + (char) Dialog.getBOX_BORDER().right); 30 | 31 | int row = 5; 32 | SPELLS_ID.clear(); 33 | for (Integer spellId : Resource.getSPELLS().keySet()) { 34 | Spell spellTmp = Resource.getSpellById(spellId); 35 | 36 | if (Player.getLV() < spellTmp.getLevel()) { 37 | continue; 38 | } 39 | 40 | SPELLS_ID.add(spellId); 41 | 42 | Dialog.drawBoxBorder(3, 18, row + 1, 29, row + 2); 43 | 44 | Dialog.printText(3, 18, row 45 | , (char) Dialog.getBOX_BORDER().left + " " 46 | + (char) Dialog.getBOX_BORDER().right); 47 | 48 | Dialog.printText(3, 18, row + 1 49 | , (char) Dialog.getBOX_BORDER().left + " " 50 | + (char) Dialog.getBOX_BORDER().right); 51 | 52 | String[] names = spellTmp.getName().trim().split("\\s+"); 53 | String[] nameLine = new String[] { "", "" }; 54 | int nameLineIndex = 0; 55 | int nameLineLength = 0; 56 | for (int i = 0; i < names.length; i++) { 57 | if (nameLineLength + names[i].length() > 9) { 58 | nameLineIndex++; 59 | nameLineLength = 0; 60 | } 61 | nameLineLength += names[i].length(); 62 | nameLine[nameLineIndex] 63 | += names[i] + (nameLineLength < 9 ? " " : ""); 64 | 65 | nameLineLength += nameLineLength < 9 ? 1 : 0; 66 | } 67 | Dialog.printText(3, 20, row, nameLine[0]); 68 | Dialog.printText(3, 21, row + 1, nameLine[1]); 69 | row += 2; 70 | } 71 | 72 | if (SPELLS_ID.isEmpty()) { 73 | View.getOffscreenGraphics2D(3).clearRect( 74 | 18 * 8, 3 * 8, 12 * 8, (2 * SPELLS_ID.size() + 3) * 8); 75 | 76 | Battle.hideMainMenu(); 77 | Dialog.print(0, 0, Game.getText("@@player_cannot_use_spell_yet")); 78 | Game.sleep(500); 79 | } 80 | else { 81 | 82 | int selectedSpell = 0; 83 | 84 | // wait for appropriate cursor start blink time 85 | long blinkTime = System.nanoTime(); 86 | 87 | while (true) { 88 | for (int r = 0; r < SPELLS_ID.size(); r++) { 89 | Dialog.print(3, 19, 5 + 2 * r, ' '); 90 | } 91 | 92 | // blink cursor 93 | if ((int) ((System.nanoTime() - blinkTime) 94 | * 0.0000000035) % 2 == 0) { 95 | 96 | Dialog.print(3, 19, 5 + 2 * selectedSpell, 2); 97 | } 98 | 99 | if (Input.isKeyJustPressed(KEY_UP) 100 | && selectedSpell > 0) { 101 | 102 | selectedSpell--; 103 | blinkTime = System.nanoTime(); 104 | } 105 | else if (Input.isKeyJustPressed(KEY_DOWN) 106 | && selectedSpell < SPELLS_ID.size() - 1) { 107 | 108 | selectedSpell++; 109 | blinkTime = System.nanoTime(); 110 | } 111 | else if (Input.isKeyJustPressed(KEY_CONFIRM)) { 112 | Audio.playSound(Audio.SOUND_MENU_CONFIRMED); 113 | returnSpell 114 | = Resource.getSpellById(SPELLS_ID.get(selectedSpell)); 115 | break; 116 | } 117 | else if (Input.isKeyJustPressed(KEY_CANCEL)) { 118 | returnSpell = null; 119 | break; 120 | } 121 | View.refresh(); 122 | Game.sleep(1000 / 60); 123 | } 124 | } 125 | 126 | View.getOffscreenGraphics2D(3).clearRect( 127 | 18 * 8, 3 * 8, 12 * 8, (2 * SPELLS_ID.size() + 3) * 8); 128 | 129 | return returnSpell; 130 | } 131 | 132 | public static Spell getSpellByLevel(int level) { 133 | for (Spell spell : Resource.getSPELLS().values()) { 134 | if (spell.getLevel() == level) { 135 | return spell; 136 | } 137 | } 138 | return null; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /assets/res/event/world.evt: -------------------------------------------------------------------------------- 1 | ; --- overworld --- 2 | ; ----------------- 3 | 4 | ; item_on_ground {event_id} {pos_col} {pos_row} {item_id} {persistent->true/false} 5 | ; --- 6 | ; erdrick's token item (id = 57) 7 | item_on_ground item_erdricks_token 87 117 57 false 8 | 9 | 10 | ;teleport {event_id} {sprite_id} {pos_col} {pos_row} \ 11 | ; {map_id} {player_col} {player_row} {player_direction} \ 12 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 13 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 14 | ; {resetRepel->true|false] {resetLight->true|false] 15 | ;--- 16 | teleport teleport_1 11 52 45 \ 17 | brecconary 10 25 right \ 18 | default_sound true \ 19 | town false true \ 20 | false true 21 | 22 | teleport teleport_2 11 77 106 \ 23 | cantlin 26 11 down \ 24 | default_sound true \ 25 | town false true \ 26 | false true 27 | 28 | teleport teleport_3 10 52 52 \ 29 | charlock_castle 22 31 right \ 30 | default_sound true \ 31 | dungeon false true \ 32 | false true 33 | 34 | teleport teleport_4 5 32 16 \ 35 | erdricks_cave 13 12 right \ 36 | default_sound true \ 37 | dungeon true true \ 38 | false true 39 | 40 | teleport teleport_5 11 6 6 \ 41 | garinham 9 24 right \ 42 | default_sound true \ 43 | town false true \ 44 | false true 45 | 46 | teleport teleport_6 11 29 93 \ 47 | hauksness 10 20 right \ 48 | default_sound true \ 49 | dungeon false true \ 50 | false true 51 | 52 | teleport teleport_7 11 108 14 \ 53 | kol 19 23 up \ 54 | default_sound true \ 55 | town false true \ 56 | false true 57 | 58 | teleport teleport_8 11 106 76 \ 59 | rimuldar 40 24 left \ 60 | default_sound true \ 61 | town false true \ 62 | false true 63 | 64 | teleport teleport_9 5 33 61 \ 65 | rock_mountain_cave 13 19 right \ 66 | default_sound true \ 67 | dungeon true true \ 68 | false true 69 | 70 | teleport teleport_10 29 85 5 \ 71 | shrine 17 21 right \ 72 | default_sound true \ 73 | tantegel false true \ 74 | false true 75 | 76 | teleport teleport_11 29 112 113 \ 77 | shrine 47 16 right \ 78 | default_sound true \ 79 | tantegel false true \ 80 | false true 81 | 82 | teleport teleport_12 5 108 48 \ 83 | swamp_cave 12 12 right \ 84 | default_sound true \ 85 | dungeon true true \ 86 | false true 87 | 88 | teleport teleport_13 5 108 53 \ 89 | swamp_cave 13 41 right \ 90 | default_sound true \ 91 | dungeon true true \ 92 | false true 93 | 94 | teleport teleport_14 10 47 47 \ 95 | tantegel_castle 21 39 up \ 96 | default_sound true \ 97 | tantegel false true \ 98 | false true 99 | 100 | 101 | ; golem - guards at the outskirts of the town of cantlin. 102 | ; note: it's necessary to defeat the golem just once. 103 | ; --- 104 | event cantlin_guardian_enemy 105 | animation tileset 6 7 100 106 | create_animation static 41 107 | location 77 104 108 | movement STATIC 109 | visible true 110 | blocked false 111 | fire_required false 112 | script 113 | on_map_enter: 114 | if ##game_state_dragon_lord_defeated "!=" 0 "hide_event" 115 | if_set ##cantlin_guardian_enemy_defeated "hide_event" 116 | change_event_visibility "cantlin_guardian_enemy" 1 117 | ret 118 | hide_event: 119 | change_event_visibility "cantlin_guardian_enemy" 0 120 | ret 121 | 122 | on_event_trigger: 123 | if_set ##cantlin_guardian_enemy_defeated "exit" 124 | ; golem (id = 24) 125 | ; start_battle {"battle_result_global_var"} {enemy_id} {tile_id} {player_cant_run->1=true|0=false} {enemy_will_not_run->1=true|0=false} {music_id} 126 | ; return result = 0 -> player is dead 127 | ; 1 -> player battle win 128 | ; 2 -> player ran away 129 | ; 3 -> enemy ran away 130 | start_battle "##battle_result" 24 0 0 1 "boss" 131 | if ##battle_result "==" 0 "exit" 132 | if ##battle_result "==" 1 "enemy_defeated" 133 | enemy_not_defeated: 134 | walk_event "player" "up" 135 | ;walk_event "player" "stay" 136 | change_player_animation "down" 137 | goto "exit" 138 | enemy_defeated: 139 | set ##cantlin_guardian_enemy_defeated 1 140 | goto "exit" 141 | exit: 142 | ret 143 | script_end 144 | event_end 145 | 146 | 147 | ; bridge (created by rainbow drop item) 148 | ; --- 149 | event bridge 150 | animation tileset 6 7 100 151 | create_animation static 19 152 | location 68 51 153 | movement STATIC 154 | visible true 155 | blocked true 156 | fire_required true 157 | script 158 | on_map_enter: 159 | if_set ##rainbow_drop_bridge_created "show_bridge" 160 | hide_bridge: 161 | change_tile 68 53 21 162 | ret 163 | show_bridge: 164 | change_tile 68 53 9 165 | ret 166 | script_end 167 | event_end 168 | 169 | 170 | -------------------------------------------------------------------------------- /assets/res/event/swamp_cave.evt: -------------------------------------------------------------------------------- 1 | ; --- swamp cave --- 2 | ; ------------------ 3 | 4 | 5 | ; save_point {event_id} {pos_col} {pos_row} 6 | ; --- 7 | save_point save_point_1 15 23 8 | 9 | 10 | ; door {event_name} {sprite_id} {pos_col} {pos_row} {persistent} 11 | ; note: the door that keeps the princess is not persistent. 12 | ; if you leave the cave, it will appear again. 13 | ;--- 14 | door door_1 22 17 32 false 15 | 16 | 17 | ;teleport {event_id} {sprite_id} {pos_col} {pos_row} \ 18 | ; {map_id} {player_col} {player_row} {player_direction} \ 19 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 20 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 21 | ; {resetRepel->true|false] {resetLight->true|false] 22 | ;--- 23 | teleport teleport_1 28 11 12 \ 24 | world 108 48 up \ 25 | default_sound true \ 26 | world false false \ 27 | false true 28 | 29 | teleport teleport_2 28 12 41 \ 30 | world 108 53 down \ 31 | default_sound true \ 32 | world false false \ 33 | false true 34 | 35 | 36 | ; green dragon - princess guardian enemy 37 | ; note: it's necessary to defeat the green dragon just once. if you leave 38 | ; the cave and enter again, the dragon will not appear again. 39 | ; --- 40 | event princess_guardian_enemy 41 | animation tileset 6 7 100 42 | create_animation static 32 43 | location 16 26 44 | movement STATIC 45 | visible true 46 | blocked false 47 | fire_required false 48 | script 49 | on_map_enter: 50 | if ##game_state_dragon_lord_defeated "!=" 0 "hide_event" 51 | if_set ##princess_guardian_enemy_defeated "hide_event" 52 | change_event_visibility "princess_guardian_enemy" 1 53 | ret 54 | hide_event: 55 | change_event_visibility "princess_guardian_enemy" 0 56 | ret 57 | 58 | on_event_trigger: 59 | if_set ##princess_guardian_enemy_defeated "exit" 60 | ; green dragon (id = 30) 61 | ; start_battle {"battle_result_global_var"} {enemy_id} {tile_id} {player_cant_run->1=true|0=false} {enemy_will_not_run->1=true|0=false} {music_id} 62 | ; return result = 0 -> player is dead 63 | ; 1 -> player battle win 64 | ; 2 -> player ran away 65 | ; 3 -> enemy ran away 66 | start_battle "##battle_result" 30 32 0 1 "boss" 67 | if ##battle_result "==" 0 "exit" 68 | if ##battle_result "==" 1 "enemy_defeated" 69 | enemy_not_defeated: 70 | walk_event "player" "up" 71 | ;walk_event "player" "stay" 72 | change_player_animation "down" 73 | goto "exit" 74 | enemy_defeated: 75 | set ##princess_guardian_enemy_defeated 1 76 | goto "exit" 77 | exit: 78 | ret 79 | script_end 80 | event_end 81 | 82 | 83 | ; princess 84 | ; --- 85 | event princess 86 | animation chars 16 8 100 87 | create_animation left 82 83 88 | create_animation up 84 85 89 | create_animation right 86 87 90 | create_animation down 80 81 91 | location 17 30 92 | movement STATIC 93 | visible true 94 | blocked true 95 | fire_required true 96 | script 97 | on_map_enter: 98 | if ##game_state_princess_rescued ">" 0 "hide_event" 99 | change_event_animation "princess" "down" 100 | change_event_visibility "princess" 1 101 | ret 102 | hide_event: 103 | change_event_visibility "princess" 0 104 | ret 105 | 106 | on_event_trigger: 107 | ;@@swamp_cave_princess_1 = Thou art brave indeed to rescue me, $$player_name . 108 | ;@@swamp_cave_princess_2 = I am Gwaelin, daughter of Lorik. 109 | ;@@swamp_cave_princess_3 = Will thou take me to the castle? 110 | ;@@swamp_cave_princess_3_no = But thou must. 111 | ;@@swamp_cave_princess_3_yes = | Princess Gwaelin embraces thee. 112 | ;@@swamp_cave_princess_4 = I'm so happy! 113 | show_player_simplified_status 114 | change_event_turn_to_player "princess" 115 | force_redraw 116 | show_dialog 1 2 @@swamp_cave_princess_1 117 | show_dialog 1 2 @@swamp_cave_princess_2 118 | ask_again: 119 | show_dialog 1 0 @@swamp_cave_princess_3 120 | sleep 250 121 | if_option_menu_select 9 3 2 @@option_yes @@option_no "yes_label" "no_label" "no_label" 122 | yes_label: 123 | show_dialog 0 0 @@swamp_cave_princess_3_yes 124 | save_current_music 125 | stop_music 126 | set ##game_state_princess_rescued 1 127 | change_event_visibility "princess" 0 128 | set_player_state "princess" 129 | change_player_animation $$player_direction 130 | force_redraw 131 | ; princess rescued sound (id = 28) 132 | play_sound 28 133 | sleep 7000 134 | restore_play_saved_music 135 | show_dialog 1 1 @@swamp_cave_princess_4 136 | goto "exit" 137 | no_label: 138 | show_dialog 1 2 @@swamp_cave_princess_3_no 139 | goto "ask_again" 140 | exit: 141 | hide_player_simplified_status 142 | close_dialog 143 | ret 144 | script_end 145 | event_end -------------------------------------------------------------------------------- /src/dq1/core/Enemy.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | /** 4 | * Enemy class. 5 | * 6 | * @author Leonardo Ono (ono.leo80@gmail.com) 7 | */ 8 | public class Enemy { 9 | 10 | private final int id; 11 | private final String name; 12 | private final int str; 13 | private final int agi; 14 | private int hp; 15 | private final int hpMax; 16 | private final int pat; 17 | private final int sr; 18 | private final int dr; 19 | private final int xp; 20 | private final int gpMax; 21 | private int gp; 22 | 23 | // 0~3 used for initiative and blocking player's running logic 24 | private final int groupId; 25 | 26 | private final boolean finalBoss; 27 | 28 | private boolean statusASleep; 29 | private int statusASleepTurn; 30 | private boolean statusStopSpell; 31 | 32 | public Enemy(String serializedData) { 33 | String[] args = serializedData.trim().split(","); 34 | 35 | id = Integer.parseInt(args[0].trim(), 16); 36 | name = args[1].trim(); 37 | str = Integer.parseInt(args[2].trim(), 16); 38 | agi = Integer.parseInt(args[3].trim(), 16); 39 | hpMax = Integer.parseInt(args[4].trim(), 16); 40 | pat = Integer.parseInt(args[5].trim(), 16); 41 | sr = Integer.parseInt(args[6].trim(), 16); 42 | dr = Integer.parseInt(args[7].trim(), 16); 43 | xp = Integer.parseInt(args[8].trim(), 16); 44 | gpMax = Integer.parseInt(args[9].trim(), 16); 45 | groupId = Integer.parseInt(args[10].trim(), 16); 46 | finalBoss = Boolean.parseBoolean(args[11].trim()); 47 | statusASleep = false; 48 | statusASleepTurn = 0; 49 | statusStopSpell = false; 50 | } 51 | 52 | public int getId() { 53 | return id; 54 | } 55 | 56 | public String getName() { 57 | return name; 58 | } 59 | 60 | public int getStr() { 61 | return str; 62 | } 63 | 64 | public int getAgi() { 65 | return agi; 66 | } 67 | 68 | public int getHP() { 69 | return hp; 70 | } 71 | 72 | public int getHPMax() { 73 | return hpMax; 74 | } 75 | 76 | public int getPat() { 77 | return pat; 78 | } 79 | 80 | public int getSR() { 81 | return sr; 82 | } 83 | 84 | public int getDR() { 85 | return dr; 86 | } 87 | 88 | public int getXP() { 89 | return xp; 90 | } 91 | 92 | public int getGP() { 93 | return gp; 94 | } 95 | 96 | public int getGPMax() { 97 | return gpMax; 98 | } 99 | 100 | public int getGroupId() { 101 | return groupId; 102 | } 103 | 104 | public boolean isFinalBoss() { 105 | return finalBoss; 106 | } 107 | 108 | public boolean isStatusASleep() { 109 | return statusASleep; 110 | } 111 | 112 | public void setStatusASleep(boolean statusASleep) { 113 | this.statusASleep = statusASleep; 114 | statusASleepTurn = 0; 115 | } 116 | 117 | public int getStatusASleepTurn() { 118 | return statusASleepTurn; 119 | } 120 | 121 | public void incStatusASleepTurn() { 122 | this.statusASleepTurn++; 123 | } 124 | 125 | public boolean isStatusStopSpell() { 126 | return statusStopSpell; 127 | } 128 | 129 | public void setStatusStopSpell(boolean statusStopSpell) { 130 | this.statusStopSpell = statusStopSpell; 131 | } 132 | 133 | public void hit(int damage) { 134 | hp -= damage; 135 | if (hp < 0) hp = 0; 136 | } 137 | 138 | public void heal(int hpHeal) { 139 | hp += hpHeal; 140 | if (hp > hpMax) hp = hpMax; 141 | } 142 | 143 | public boolean isDefeated() { 144 | return hp == 0; 145 | } 146 | 147 | public void reset() { 148 | hp = hpMax - (Util.random(256) * hpMax) / 1024; 149 | gp = (gpMax * (Util.random(64) + 192)) / 256; 150 | statusASleep = false; 151 | statusASleepTurn = 0; 152 | statusStopSpell = false; 153 | } 154 | 155 | public boolean isSpecialMove1() { 156 | int chance = pat & 0b00110000; 157 | chance = chance >> 4; 158 | return Util.random(3) + 1 <= chance; 159 | } 160 | 161 | public int getSpecialMove1() { 162 | int move = pat & 0b11000000; 163 | return (move >> 6); 164 | } 165 | 166 | public boolean isSpecialMove2() { 167 | int chance = pat & 0b00000011; 168 | return Util.random(3) + 1 <= chance; 169 | } 170 | 171 | public int getSpecialMove2() { 172 | int move = pat & 0b00001100; 173 | return (move >> 2); 174 | } 175 | 176 | public boolean checkResistedSleep() { 177 | int sleepResistance = sr >> 4; 178 | return Util.random(16) < sleepResistance; 179 | } 180 | 181 | public boolean checkResistedStopSpell() { 182 | int stopSpellResistance = (sr & 0xf0) >> 4; 183 | return Util.random(16) < stopSpellResistance; 184 | } 185 | 186 | public boolean checkResistedHurt() { 187 | int hurtResistance = (dr & 0xf0) >> 4; 188 | return Util.random(16) < hurtResistance; 189 | } 190 | 191 | public boolean checkResistedAttack() { 192 | int dodge = dr & 0x0f; 193 | return Util.random(64) < dodge; 194 | } 195 | 196 | @Override 197 | public String toString() { 198 | return "Enemy{" + "id=" + id + ", name=" + name + ", str=" + str 199 | + ", agi=" + agi + ", hp=" + hp + ", hpMax=" + hpMax 200 | + ", pat=" + pat + ", sr=" + sr + ", dr=" + dr + ", xp=" + xp 201 | + ", gpMax=" + gpMax + ", gp=" + gp + ", groupId=" + groupId 202 | + ", finalBoss=" + finalBoss + '}'; 203 | } 204 | 205 | } 206 | -------------------------------------------------------------------------------- /assets/res/map/swamp_cave.map: -------------------------------------------------------------------------------- 1 | # reference: http://www.realmofdarkness.net/dq/wp-content/img/nes/dw/maps/swamp-cave-2.png 2 | 3 | map_name Swamp Cave 4 | map_tileset tileset 5 | map_music dungeon 6 | map_out_of_bounds_tile_id 36 7 | map_is_dark true 8 | map_repel_has_no_effect true 9 | map_reset_repel_on_enter true 10 | map_reset_light_on_enter true 11 | map_rows 54 12 | map_cols 30 13 | map_data 14 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 15 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 16 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 17 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 18 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 19 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 20 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 21 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 22 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 23 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 24 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 25 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 26 | 36,36,36,36,36,36,36,36,36,36,30,32,32,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 27 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,32,30,30,30,30,36,36,36,36,36,36,36,36,36,36 28 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 29 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 30 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 31 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 32 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,30,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 33 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 34 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 35 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 36 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 37 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 38 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 39 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,32,40,32,30,30,36,36,36,36,36,36,36,36,36,36 40 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,40,30,30,30,36,36,36,36,36,36,36,36,36,36 41 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,32,40,32,30,30,36,36,36,36,36,36,36,36,36,36 42 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 43 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 44 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 45 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 46 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 47 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 48 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 49 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 50 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 51 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,30,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 52 | 36,36,36,36,36,36,36,36,36,36,30,30,30,32,32,32,30,30,30,30,36,36,36,36,36,36,36,36,36,36 53 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 54 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,30,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 55 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 56 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 57 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 58 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 59 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 60 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 61 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 62 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 63 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 64 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 65 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 66 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 67 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 68 | 69 | # monsters zone 70 | zone_rows 1 71 | zone_cols 1 72 | zone_tiles_per_row 54 73 | zone_tiles_per_col 30 74 | zone_offset_rows 0 75 | zone_offset_cols 0 76 | # note: zone_data needs to be in decimal 77 | zone_data 78 | 19 79 | 80 | # zone <-> enemies 81 | zone_enemies_rows 20 82 | zone_enemies_cols 5 83 | # note: zone_enemies_data needs to be in hexadecimal 84 | zone_enemies_data 85 | 00,00,01,00,01,00 86 | 01,01,00,01,02,01 87 | 02,00,03,02,03,01 88 | 03,01,01,02,03,04 89 | 04,03,04,05,05,06 90 | 05,03,04,05,06,0B 91 | 06,05,06,0B,0C,0E 92 | 07,0B,0C,0D,0E,0E 93 | 08,0D,0F,12,12,19 94 | 09,0F,15,12,15,19 95 | 0A,15,16,17,1A,1C 96 | 0B,17,1A,1B,1C,10 97 | 0C,1A,1B,1C,1D,1F 98 | 0D,1D,1E,1F,1F,20 99 | 0E,08,09,0A,0B,0C 100 | 0F,11,12,13,14,17 101 | 10,1D,1E,1F,20,21 102 | 11,20,21,22,22,23 103 | 12,20,23,24,24,25 104 | 13,03,04,06,07,07 105 | -------------------------------------------------------------------------------- /assets/res/map/shrine.map: -------------------------------------------------------------------------------- 1 | # reference: http://www.realmofdarkness.net/dq/wp-content/img/nes/dw/maps/northern-shrine-2.png 2 | 3 | map_name Shrine 4 | map_tileset tileset 5 | map_music tantegel 6 | map_out_of_bounds_tile_id 36 7 | map_is_dark true 8 | map_repel_has_no_effect true 9 | map_reset_repel_on_enter true 10 | map_reset_light_on_enter true 11 | map_rows 34 12 | map_cols 68 13 | map_data 14 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 15 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 16 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 17 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 18 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 19 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 20 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 21 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 22 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 23 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 24 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 25 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 26 | 30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,32,32,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,32,32,32,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30 27 | 30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,32,32,32,32,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,32,30,32,30,32,32,30,30,30,30,30,30,30,30,30,30,30,30 28 | 30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,30,30,30,30,30,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,30,30,32,32,32,30,30,32,30,30,30,30,30,30,30,30,30,30,30,30 29 | 30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,32,32,30,32,30,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,30,30,30,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30 30 | 30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,32,32,32,32,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,32,30,32,30,32,30,32,30,30,30,30,30,30,30,30,30,30,30,30 31 | 30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,32,32,30,32,30,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,32,32,32,30,32,30,32,30,30,30,30,30,30,30,30,30,30,30,30 32 | 30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,30,30,30,30,30,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,30,30,30,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30 33 | 30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,32,32,32,32,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,30,30,32,32,32,30,30,32,30,30,30,30,30,30,30,30,30,30,30,30 34 | 30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,32,32,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,32,30,32,30,32,32,30,30,30,30,30,30,30,30,30,30,30,30 35 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,32,32,32,32,32,32,32,32,32,30,30,30,30,30,30,30,30,30,30,30,30 36 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 37 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 38 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 39 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 40 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 41 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 42 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 43 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 44 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 45 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 46 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 47 | 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30 48 | -------------------------------------------------------------------------------- /assets/res/map/erdricks_cave.map: -------------------------------------------------------------------------------- 1 | # reference: http://www.realmofdarkness.net/dq/wp-content/img/nes/dw/maps/erdricks-cave-2.png 2 | 3 | map_name Erdrick's Cave 4 | map_tileset tileset 5 | map_type dungeon 6 | map_out_of_bounds_tile_id 36 7 | map_is_dark true 8 | map_repel_has_no_effect true 9 | map_reset_repel_on_enter true 10 | map_reset_light_on_enter true 11 | map_rows 34 12 | map_cols 68 13 | map_data 14 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 15 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 16 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 17 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 18 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 19 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 20 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 21 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 22 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 23 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 24 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 25 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 26 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,30,32,32,32,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 27 | 36,36,36,36,36,36,36,36,36,36,30,30,30,32,30,32,30,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,30,30,32,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 28 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 29 | 36,36,36,36,36,36,36,36,36,36,30,30,30,32,30,30,30,32,30,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,32,30,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 30 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,30,32,32,32,30,32,32,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,30,32,30,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 31 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,30,32,32,32,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,30,32,30,32,30,30,30,30,36,36,36,36,36,36,36,36,36,36 32 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,30,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,32,30,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 33 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,32,30,32,30,30,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,30,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 34 | 36,36,36,36,36,36,36,36,36,36,30,30,30,32,32,32,32,32,30,32,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,32,30,32,32,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 35 | 36,36,36,36,36,36,36,36,36,36,30,30,30,32,30,32,30,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,30,32,32,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 36 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 37 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 38 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 39 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 40 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 41 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 42 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 43 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 44 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 45 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 46 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 47 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 48 | -------------------------------------------------------------------------------- /assets/res/event/shrine.evt: -------------------------------------------------------------------------------- 1 | --- northern shrine --- 2 | ----------------------- 3 | 4 | ; save_point {event_id} {pos_col} {pos_row} 5 | ; --- 6 | save_point save_point_1 13 12 7 | 8 | 9 | ;chest {event_id} {pos_col} {pos_row} {item_id / gold_{value}} {persistent->true|false} 10 | ;--- 11 | ; staff of rain (id = 54) 12 | chest chest_1 15 16 54 false 13 | 14 | 15 | ;teleport {event_id} {sprite_id} {pos_col} {pos_row} \ 16 | ; {map_id} {player_col} {player_row} {player_direction} \ 17 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 18 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 19 | ; {resetRepel->true|false] {resetLight->true|false] 20 | ;--- 21 | teleport teleport_1 28 16 21 \ 22 | world 85 5 down \ 23 | default_sound true \ 24 | world false false \ 25 | false true 26 | 27 | 28 | ; northern shrine old man 29 | ; --- 30 | event northern_shrine_old_man 31 | animation chars 16 8 100 32 | create_animation down 40 41 33 | create_animation left 42 43 34 | create_animation up 44 45 35 | create_animation right 46 47 36 | location 16 16 37 | movement STATIC 38 | visible true 39 | blocked true 40 | fire_required true 41 | script 42 | on_map_enter: 43 | ; if player saved game before taking the chest 44 | if_set #talked_after_bring_silver_harp "waiting_for_take_item" 45 | change_event_location "northern_shrine_old_man" 16 16 46 | change_event_animation "northern_shrine_old_man" "right" 47 | ret 48 | waiting_for_take_item: 49 | change_event_location "northern_shrine_old_man" 16 15 50 | change_event_animation "northern_shrine_old_man" "down" 51 | ret 52 | 53 | on_event_trigger: 54 | ;@@northern_shrine_old_man_1 = Thy bravery must be proven. 55 | ;@@northern_shrine_old_man_2 = Thus, I propose a test. 56 | ;@@northern_shrine_old_man_3 = There is a Silver Harp that beckons to the creatures of the Dragonlord. 57 | ;@@northern_shrine_old_man_4 = Bring this to me and I will reward thee with the Staff of Rain. 58 | ;@@northern_shrine_old_man_5 = Thou hast brought the harp. Good. 59 | ;@@northern_shrine_old_man_6 = I have been waiting long for one such as thee. 60 | ;@@northern_shrine_old_man_7 = Take the Treasure Chest. 61 | ;@@northern_shrine_old_man_8 = Thou hast no business here. | Go away. 62 | change_event_turn_to_player "northern_shrine_old_man" 63 | force_redraw 64 | ; rainbow drop item item (id = 58) 65 | if ##player_item_58 ">" 0 "player_has_staff_of_rain" 66 | ; staff of rain item (id = 54) 67 | if ##player_item_54 ">" 0 "player_has_staff_of_rain" 68 | if_set #talked_after_bring_silver_harp "just_take_the_item" 69 | ; silver harp item (id = 53) 70 | if ##player_item_53 ">" 0 "player_has_silver_harp" 71 | player_without_silver_harp: 72 | show_dialog 1 2 @@northern_shrine_old_man_1 73 | show_dialog 1 2 @@northern_shrine_old_man_2 74 | show_dialog 1 2 @@northern_shrine_old_man_3 75 | show_dialog 1 1 @@northern_shrine_old_man_4 76 | goto "exit" 77 | player_has_silver_harp: 78 | set #talked_after_bring_silver_harp 1 79 | ; silver harp item (id = 53) 80 | drop_item 53 81 | show_dialog 1 2 @@northern_shrine_old_man_5 82 | show_dialog 1 2 @@northern_shrine_old_man_6 83 | show_dialog 1 2 @@northern_shrine_old_man_7 84 | close_dialog 85 | walk_event "northern_shrine_old_man" "stay" 86 | walk_event "northern_shrine_old_man" "up" 87 | change_event_animation "northern_shrine_old_man" "down" 88 | walk_event "northern_shrine_old_man" "stay" 89 | force_redraw 90 | goto "exit" 91 | just_take_the_item: 92 | show_dialog 1 1 @@northern_shrine_old_man_7 93 | change_event_animation "northern_shrine_old_man" "down" 94 | goto "exit" 95 | player_has_staff_of_rain: 96 | show_dialog 1 1 @@northern_shrine_old_man_8 97 | if_set #talked_after_bring_silver_harp "player_has_staff_of_rain_exit_down" 98 | player_has_staff_of_rain_exit_right: 99 | change_event_animation "northern_shrine_old_man" "right" 100 | goto "exit" 101 | player_has_staff_of_rain_exit_down: 102 | change_event_animation "northern_shrine_old_man" "down" 103 | goto "exit" 104 | exit: 105 | close_dialog 106 | ret 107 | script_end 108 | event_end 109 | 110 | 111 | --- southern shrine --- 112 | ----------------------- 113 | 114 | ; save_point {event_id} {pos_col} {pos_row} 115 | ; --- 116 | save_point save_point_1 51 19 117 | 118 | 119 | ;chest {event_id} {pos_col} {pos_row} {item_id / gold_{value}} {persistent->true|false} 120 | ;--- 121 | ; rainbow drop (id = 58) 122 | chest chest_1 51 17 58 false 123 | 124 | 125 | ;teleport {event_id} {sprite_id} {pos_col} {pos_row} \ 126 | ; {map_id} {player_col} {player_row} {player_direction} \ 127 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 128 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 129 | ; {resetRepel->true|false] {resetLight->true|false] 130 | ;--- 131 | teleport teleport_2 28 46 16 \ 132 | world 112 113 down \ 133 | default_sound true \ 134 | world false false \ 135 | false true 136 | 137 | 138 | ; southern shrine old man 139 | ; --- 140 | event southern_shrine_old_man 141 | animation chars 16 8 100 142 | create_animation left 42 43 143 | location 50 17 144 | movement STATIC 145 | visible true 146 | blocked true 147 | fire_required true 148 | script 149 | on_event_trigger: 150 | ;@@southern_shrine_old_man_1 = In thy task thou hast failed. Alas, I fear thou art not the one Erdrick predicted would save us. 151 | ;@@southern_shrine_old_man_2 = Go now! 152 | ;@@southern_shrine_old_man_3 = Now the sun and rain shall meet and the Rainbow Drop passes to thy keeping. 153 | ;@@southern_shrine_old_man_4 = Thou hast no business here. | Go away. 154 | ; rainbow drop item (id = 58) 155 | if ##player_item_58 ">" 0 "player_already_has_rainbow_drop" 156 | ; staff of rain item (id = 54) 157 | if ##player_item_54 "==" 0 "player_has_not_all_items" 158 | ; stone of sunlight (id = 55) 159 | if ##player_item_55 "==" 0 "player_has_not_all_items" 160 | ; erdrick's token (id = 57) 161 | if ##player_item_57 "==" 0 "player_has_not_all_items" 162 | player_has_all_items: 163 | drop_item 54 164 | drop_item 55 165 | ; note: erdrick's token item (id = 57) is not removed from player 166 | add_inventory_item 58 167 | show_dialog 1 0 @@southern_shrine_old_man_3 168 | sleep 500 169 | screen_flash 2 10 "0xffff00" 30 170 | wait_for_any_key 171 | close_dialog 172 | ret 173 | player_has_not_all_items: 174 | show_dialog 1 2 @@southern_shrine_old_man_1 175 | show_dialog 1 0 @@southern_shrine_old_man_2 176 | sleep 500 177 | screen_flash 2 5 "0xffffff" 30 178 | close_dialog 179 | teleport "world" 112 113 "down" 1 "world" 0 0 0 1 180 | ret 181 | player_already_has_rainbow_drop: 182 | show_dialog 1 1 @@southern_shrine_old_man_4 183 | close_dialog 184 | ret 185 | script_end 186 | event_end 187 | -------------------------------------------------------------------------------- /src/dq1/core/Event.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import static dq1.core.Event.MovementType.*; 4 | import java.awt.Color; 5 | import java.awt.Graphics2D; 6 | import java.awt.Point; 7 | import java.awt.Rectangle; 8 | import java.awt.image.BufferedImage; 9 | 10 | /** 11 | * Event class. 12 | * 13 | * @author Leonardo Ono (ono.leo80@gmail.com) 14 | */ 15 | public class Event { 16 | 17 | public static enum MovementType { STATIC, RANDOM } 18 | private static final String[] ANIMATION_IDS 19 | = {"down", "left", "up", "right"}; 20 | 21 | private String id; 22 | private String type; 23 | private Animation animation; 24 | private MovementType movementType = MovementType.STATIC; 25 | private int x; 26 | private int y; 27 | private boolean visible = true; 28 | private boolean blocked = true; 29 | private boolean fireRequired = false; 30 | private Script script; 31 | 32 | private int walking = -1; 33 | private int walkDx; 34 | private int walkDy; 35 | private final Point currentWalkTile = new Point(); 36 | private final Point targetWalkTile = new Point(); 37 | private Rectangle walkArea; 38 | 39 | public Event() { 40 | } 41 | 42 | public String getId() { 43 | return id; 44 | } 45 | 46 | public void setId(String id) { 47 | this.id = id; 48 | } 49 | 50 | public String getType() { 51 | return type; 52 | } 53 | 54 | public void setType(String type) { 55 | this.type = type; 56 | } 57 | 58 | public Animation getAnimation() { 59 | return animation; 60 | } 61 | 62 | public void setAnimation( 63 | BufferedImage image, int cols, int rows, int animationSpeed) { 64 | 65 | animation = new Animation(image, cols, rows, animationSpeed); 66 | } 67 | 68 | public void createAnimation(String animationId, int[] frameIndices) { 69 | animation.createAnimation(animationId, frameIndices); 70 | } 71 | 72 | public void changeAnimation(String animationId) { 73 | animation.change(animationId); 74 | } 75 | 76 | public MovementType getMovementType() { 77 | return movementType; 78 | } 79 | 80 | public void setMovementType(MovementType movementType) { 81 | this.movementType = movementType; 82 | } 83 | 84 | public int getX() { 85 | return x; 86 | } 87 | 88 | public int getY() { 89 | return y; 90 | } 91 | 92 | public void setLocation(int x, int y) { 93 | this.x = x; 94 | this.y = y; 95 | currentWalkTile.setLocation(x / 16, y / 16); 96 | targetWalkTile.setLocation(-1, -1); 97 | } 98 | 99 | public boolean isVisible() { 100 | return visible; 101 | } 102 | 103 | public void setVisible(boolean visible) { 104 | this.visible = visible; 105 | } 106 | 107 | public boolean isBlocked() { 108 | return blocked; 109 | } 110 | 111 | public boolean isBlocked(int row, int col) { 112 | return visible && blocked 113 | && ((currentWalkTile.x == col && currentWalkTile.y == row) 114 | || (targetWalkTile.x == col && targetWalkTile.y == row)); 115 | } 116 | 117 | public void setBlocked(boolean blocked) { 118 | this.blocked = blocked; 119 | } 120 | 121 | public Point getTargetWalkTile() { 122 | return targetWalkTile; 123 | } 124 | 125 | public boolean isFireRequired() { 126 | return fireRequired; 127 | } 128 | 129 | public void setFireRequired(boolean fireRequired) { 130 | this.fireRequired = fireRequired; 131 | } 132 | 133 | public Script getScript() { 134 | return script; 135 | } 136 | 137 | public void setScript(Script script) { 138 | this.script = script; 139 | } 140 | 141 | public Rectangle getWalkArea() { 142 | return walkArea; 143 | } 144 | 145 | public void setWalkArea(int x, int y, int width, int height) { 146 | if (walkArea == null) { 147 | walkArea = new Rectangle(); 148 | } 149 | walkArea.setBounds(x, y, width, height); 150 | } 151 | 152 | public void update() { 153 | if (animation != null) { 154 | animation.update(); 155 | } 156 | if (walking == 0) { 157 | walking--; 158 | currentWalkTile.setLocation(targetWalkTile); 159 | targetWalkTile.setLocation(-1, -1); 160 | } 161 | else if (walking < 0 && movementType == RANDOM) { 162 | handleMovement(); 163 | } 164 | else { 165 | walking--; 166 | x += walkDx; 167 | y += walkDy; 168 | } 169 | } 170 | 171 | private void walk(int dx, int dy) { 172 | TileMap currentMap = Game.getCurrentMap(); 173 | 174 | int targetX = x + dx * 16; 175 | int targetY = y + dy * 16; 176 | 177 | // outside of walking area 178 | if (walkArea != null && !walkArea.contains(targetX, targetY)) { 179 | return; 180 | } 181 | 182 | if (!currentMap.isBlocked(targetX, targetY) || (dx == 0 && dy == 0)) { 183 | targetWalkTile.setLocation(targetX / 16, targetY / 16); 184 | walking = 16; 185 | walkDx = dx; 186 | walkDy = dy; 187 | } 188 | } 189 | 190 | public void handleMovement() { 191 | int[][] directions = {{0, 1}, {-1, 0}, {0, -1}, {1, 0} 192 | , {0, 0}, {0, 0}, {0, 0}, {0, 0} 193 | , {0, 0}, {0, 0}, {0, 0}, {0, 0}}; 194 | int r = (int) (12 * Math.random()); 195 | int[] direction = directions[r]; 196 | walk(direction[0], direction[1]); 197 | if (r < 4) { 198 | animation.change(ANIMATION_IDS[r]); 199 | } 200 | } 201 | 202 | private static final boolean DEBUG_MODE = false; 203 | private static final String DEBUG_EVENT_ID = "soldier_tantegel_castle_1"; 204 | private static final Color DEBUG_EVENT_COLOR = new Color(0, 0, 255, 128); 205 | private static final Color DEBUG_AREA_COLOR = new Color(0, 255, 0, 128); 206 | 207 | public void draw(Graphics2D g) { 208 | if (animation != null) { 209 | int ex = x - Player.getX() + 8 * 16 - 8; 210 | int ey = y - Player.getY() + 7 * 16; 211 | animation.draw(g, ex, ey); 212 | 213 | // debug walking area 214 | if (DEBUG_MODE && walkArea != null && id.equals(DEBUG_EVENT_ID)) { 215 | g.setColor(DEBUG_AREA_COLOR); 216 | g.fillRect(walkArea.x - Player.getX() + 8 * 16 - 8 217 | , walkArea.y - Player.getY() + 7 * 16 218 | , walkArea.width, walkArea.height); 219 | 220 | g.setColor(DEBUG_EVENT_COLOR); 221 | g.fillRect(ex, ey, 16, 16); 222 | } 223 | } 224 | } 225 | 226 | public void turnToPlayer() { 227 | turnTo(Player.getY() / 16, Player.getX() / 16); 228 | } 229 | 230 | public void turnTo(int rowTarget, int colTarget) { 231 | int dx = colTarget - x / 16; 232 | int dy = rowTarget - y / 16; 233 | if (dy > 0) { 234 | changeAnimation("down"); 235 | } 236 | else if (dx < 0) { 237 | changeAnimation("left"); 238 | } 239 | else if (dy < 0) { 240 | changeAnimation("up"); 241 | } 242 | else if (dx > 0) { 243 | changeAnimation("right"); 244 | } 245 | } 246 | 247 | public void clearLocalVars() { 248 | if (script != null) { 249 | script.clearLocalVars(); 250 | } 251 | } 252 | 253 | // return: exit map 254 | public boolean execute(String label) throws Exception { 255 | boolean exitMap = false; 256 | if (script != null) { 257 | exitMap = script.execute(label); 258 | } 259 | return exitMap; 260 | } 261 | 262 | } 263 | -------------------------------------------------------------------------------- /src/dq1/core/Debug.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import static dq1.core.Player.getLV; 4 | import java.awt.event.KeyEvent; 5 | import java.util.logging.Level; 6 | import java.util.logging.Logger; 7 | 8 | /** 9 | * Debug class. 10 | * 11 | * @author Leonardo Ono (ono.leo80@gmail.com) 12 | */ 13 | public class Debug { 14 | 15 | public static void update() { 16 | if (1 == 1) { 17 | return; 18 | } 19 | 20 | 21 | if (Input.isKeyJustPressed(KeyEvent.VK_B)) { 22 | try { 23 | Battle.start("##res", 33, 0, 1, 1, "boss"); 24 | } catch (Exception ex) { 25 | Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex); 26 | } 27 | } 28 | 29 | 30 | if (Input.isKeyJustPressed(KeyEvent.VK_1)) { 31 | Script.setGlobalValue("##game_state_dragon_lord_defeated", 1); 32 | System.out.println("dragon lord defeated"); 33 | } 34 | if (Input.isKeyJustPressed(KeyEvent.VK_2)) { 35 | Script.setGlobalValue("##game_state_dragon_lord_defeated", 0); 36 | System.out.println("dragon lord NOT defeated"); 37 | } 38 | if (Input.isKeyJustPressed(KeyEvent.VK_3)) { 39 | Script.setGlobalValue("##game_state_princess_rescued", 0); 40 | System.out.println("princess not rescued"); 41 | } 42 | if (Input.isKeyJustPressed(KeyEvent.VK_4)) { 43 | Script.setGlobalValue("##game_state_princess_rescued", 1); 44 | System.out.println("princess rescued / player carrying princess"); 45 | Player.setState("princess"); 46 | Player.changeDirection("down"); 47 | } 48 | if (Input.isKeyJustPressed(KeyEvent.VK_5)) { 49 | Script.setGlobalValue("##game_state_princess_rescued", 2); 50 | System.out.println("princess rescued already in tantegel"); 51 | } 52 | 53 | if (Input.isKeyJustPressed(KeyEvent.VK_L)) { 54 | //Player.setLocation(113, 111); // southern shrine 55 | //Player.setLocation(5, 84); // northern shrine 56 | //Player.setLocation(53, 70); // rainbow drop 57 | //Player.setLocation(35, 287); // ??? 58 | //Player.setLocation(15, 108); // kol 59 | //Player.setLocation(117, 87); // erdricks token 60 | try { 61 | //Game.teleport("tantegel_castle", 97, 16, "right", 1, "tantegel", 0, 0, 0, 1); 62 | //Game.teleport("rimuldar", 40, 24, "left", 1, "town", 0, 0, 0, 1); 63 | Game.teleport("charlock_castle", 294, 35, "up", 1, "dungeon", 0, 0, 0, 1); 64 | //Game.teleport("garinham", 9, 24, "right", 1, "town", 0, 0, 0, 1); 65 | //Game.teleport("cantlin", 26, 11, "down", 1, "town", 0, 0, 0, 1); 66 | //Game.teleport("kol", 19, 23, "up", 1, "town", 0, 0, 0, 1); 67 | //Game.teleport("world", 32, 16, "down", 1, "world", 0, 0, 0, 1); // erdrick's cave 68 | //Game.teleport("world", 52, 52, "down", 1, "world", 0, 0, 0, 1); // charlock castle 69 | //Game.teleport("world", 77, 103, "down", 1, "world", 0, 0, 0, 1); // golem cantlin 70 | //Game.teleport("world", 108, 15, "up", 1, "world", 0, 0, 0, 1); // kol 71 | //Game.teleport("world", 108, 48, "up", 1, "world", 0, 0, 0, 1); // swamp cave 72 | //Game.teleport("world", 107, 76, "left", 1, "world", 0, 0, 0, 1); // rimuldar 73 | //Game.teleport("world", 52, 45, "left", 1, "world", 0, 0, 0, 1); // brecconary 74 | //Game.teleport("world", 6, 6, "left", 1, "world", 0, 0, 0, 1); // garinham 75 | //Game.teleport("world", 47 + 40, 47 + 70, "left", 1, "world", 0, 0, 0, 1); // erdrick's token 76 | //Game.teleport("world", 29, 93, "left", 1, "world", 0, 0, 0, 1); // hauksness 77 | //Game.teleport("swamp_cave", 16, 25, "down", 1, "dungeon", 1, 1, 0, 1); // swamp cave 78 | //Game.teleport("world", 85, 5, "left", 1, "world", 0, 0, 0, 1); // northern shrine 79 | //Game.teleport("world", 112, 113, "left", 1, "world", 0, 0, 0, 1); // southern shrine 80 | } catch (Exception ex) { 81 | Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex); 82 | } 83 | } 84 | 85 | if (Input.isKeyJustPressed(KeyEvent.VK_W)) { 86 | try { 87 | Game.teleport("world", 77, 105, "down", 1, "world", 0, 0, 0, 1); // golem cantlin 88 | } catch (Exception ex) { 89 | Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex); 90 | } 91 | } 92 | 93 | if (Input.isKeyJustPressed(KeyEvent.VK_U)) { 94 | System.out.println("level up!"); 95 | Player.levelUp(); 96 | 97 | int currentLevel = getLV(); 98 | PlayerLevel playerLevel = Resource.getPlayerLevel(currentLevel); 99 | PlayerLevel playerLevelNext = Resource.getPlayerLevel(currentLevel + 1); 100 | int expDif = playerLevelNext.getXP() - playerLevel.getXP(); 101 | Script.setGlobalValue("##player_e", playerLevel.getXP() + (int) (expDif * Math.random())); 102 | 103 | Dialog.close(); 104 | } 105 | 106 | if (Input.isKeyJustPressed(KeyEvent.VK_E)) { 107 | boolean enabled = Game.getCurrentMap().isEnemiesEncounterEnabled(); 108 | Game.getCurrentMap().setEnemiesEncounterEnabled(!enabled); 109 | System.out.println("enemies enabled = " + (!enabled)); 110 | } 111 | 112 | if (Input.isKeyJustPressed(KeyEvent.VK_9)) { 113 | Player.equipPlayer(14); 114 | } 115 | 116 | if (Input.isKeyJustPressed(KeyEvent.VK_A)) { 117 | // for (int i = 0; i < 100; i++) { 118 | // Script.setGlobalValue("##player_item_" + i, 0); 119 | // } 120 | 121 | Inventory.addItem(42); 122 | Inventory.addItem(43); 123 | Inventory.addItem(46); 124 | Inventory.addItem(46); 125 | Inventory.addItem(46); 126 | //Script.setGlobalValue("##player_weapon_id", 0); 127 | //Script.setGlobalValue("##player_armor_id", 0); 128 | //Script.setGlobalValue("##player_shield_id", 0); 129 | //Player.equipPlayer(14); 130 | //Player.equipPlayer(26); 131 | } 132 | 133 | if (Input.isKeyJustPressed(KeyEvent.VK_S)) { 134 | int lv = 30; 135 | int str = 25; 136 | int agi = 25; 137 | int hp = 5; 138 | int mp = 50; 139 | int hpMax = 50; 140 | int mpMax = 50; 141 | int gp = 999; 142 | int xp = 0; 143 | 144 | Script.setGlobalValue("##player_str", str); 145 | Script.setGlobalValue("##player_agi", agi); 146 | Script.setGlobalValue("##player_max_hp", hpMax); 147 | Script.setGlobalValue("##player_max_mp", mpMax); 148 | 149 | Script.setGlobalValue("##player_lv", lv); 150 | Script.setGlobalValue("##player_hp", hp); 151 | Script.setGlobalValue("##player_mp", mp); 152 | Script.setGlobalValue("##player_g", gp); 153 | Script.setGlobalValue("##player_e", xp); 154 | } 155 | 156 | if (Input.isKeyJustPressed(KeyEvent.VK_M)) { 157 | Script.setGlobalValue("##player_mp", 999); 158 | } 159 | 160 | if (Input.isKeyJustPressed(KeyEvent.VK_E)) { 161 | Player.equipPlayer(22); 162 | } 163 | 164 | if (Input.isKeyJustPressed(KeyEvent.VK_G)) { 165 | Player.incG(100); 166 | } 167 | 168 | if (Input.isKeyJustPressed(KeyEvent.VK_D)) { 169 | //setLocation(46, 75); 170 | //Script.setGlobalValue("##player_item_46", 6); 171 | //Script.setGlobalValue("##player_hp", 5); 172 | //Script.setGlobalValue("##player_mp", 6); 173 | 174 | Script.setGlobalValue("##player_g", 1000); 175 | Script.setGlobalValue("##game_state_dragon_lord_defeated", 0); 176 | Script.setGlobalValue("##game_state_princess_rescued", 0); 177 | 178 | // Set removeKeys = new HashSet<>(); 179 | // for (String key : Script.getVARS().keySet()) { 180 | // if (key.startsWith("##player_item_")) { 181 | // removeKeys.add(key); 182 | // } 183 | // } 184 | // for (String key : removeKeys) { 185 | // Script.getVARS().remove(key); 186 | // } 187 | 188 | Script.setGlobalValue("##player_weapon_id", -1); 189 | Script.setGlobalValue("##player_armor_id", -1); 190 | Script.setGlobalValue("##player_shield_id", -1); 191 | 192 | } 193 | } 194 | 195 | } 196 | -------------------------------------------------------------------------------- /src/dq1/core/Item.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import static dq1.core.Item.Type.*; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | /** 8 | * Item class. 9 | * events: 10 | * -> on_use_when_map -> ret 0->return to menu | 1->exit main menu 11 | * consume_item item_id (needs to consume manually) 12 | 13 | * -> on_use_when_battle -> ret 0->keep turn | 1->pass turn to enemy 14 | * consume_item item_id (needs to consume manually) 15 | * 16 | * Notes: * using a item will not consume it automatically. 17 | * 18 | * * blocking dialog messages or wait_for_fire_key must be called 19 | * manually (if this is the desired behaviour). 20 | * 21 | * @author Leonardo Ono (ono.leo80@gmail.com) 22 | */ 23 | public class Item { 24 | 25 | public static final Item EMPTY = new Item(0, ITEM, "", 0, 0, 0, 0, 0 26 | , false, false, false, 0, false, false, false, false, 0); 27 | 28 | public static enum Type { ITEM, WEAPON, ARMOR, SHIELD }; 29 | 30 | private final int id; 31 | private final Type type; 32 | private final String name; 33 | private int buy; 34 | private int sell; 35 | private final int buyOriginal; 36 | private final int sellOriginal; 37 | private final int atk; 38 | private final int def; 39 | private final int maxCount; 40 | private final boolean useInBattle; 41 | private final boolean useInMap; 42 | private final boolean disposable; 43 | private final int itemsPerSlot; 44 | private final boolean immuneToStopSpell; 45 | private final boolean relievesHurt; 46 | private final boolean relievesBreath; 47 | // protects against terrain tiles like swamp and barrier tiles 48 | private final boolean protectsTerrain; 49 | private final int healPerStepInMilli; 50 | private List parentItems = new ArrayList<>(); 51 | private Script script; 52 | 53 | public Item(int id, Type type, String name 54 | , int buy, int sell, int atk, int def 55 | , int maxCount, boolean useInBattle, boolean useInMap 56 | , boolean disposable, int itemsPerSlot, boolean immuneToStopSpell 57 | , boolean relievesHurt, boolean relievesBreath 58 | , boolean protectsTerrain, int healPerStepInMilli) { 59 | 60 | this.id = id; 61 | this.type = type; 62 | this.name = name; 63 | this.buy = buy; 64 | this.sell = sell; 65 | this.buyOriginal = buy; 66 | this.sellOriginal = sell; 67 | this.atk = atk; 68 | this.def = def; 69 | this.maxCount = maxCount; 70 | this.useInBattle = useInBattle; 71 | this.useInMap = useInMap; 72 | this.disposable = disposable; 73 | this.itemsPerSlot = itemsPerSlot; 74 | this.immuneToStopSpell = immuneToStopSpell; 75 | this.relievesHurt = relievesHurt; 76 | this.relievesBreath = relievesBreath; 77 | this.protectsTerrain = protectsTerrain; 78 | this.healPerStepInMilli = healPerStepInMilli; 79 | } 80 | 81 | public Item(String serializedData) { 82 | String[] args = serializedData.trim().split(","); 83 | String[] h = args[0].trim().split("\\s+"); 84 | id = Integer.parseInt(h[1]); 85 | type = Type.valueOf(h[0].toUpperCase()); 86 | name = args[1].trim(); 87 | buy = Integer.parseInt(args[2].trim()); 88 | sell = Integer.parseInt(args[3].trim()); 89 | buyOriginal = buy; 90 | sellOriginal = sell; 91 | atk = Integer.parseInt(args[4].trim()); 92 | def = Integer.parseInt(args[5].trim()); 93 | maxCount = Integer.parseInt(args[6].trim()); 94 | useInBattle = Boolean.parseBoolean(args[7].trim()); 95 | useInMap = Boolean.parseBoolean(args[8].trim()); 96 | disposable = Boolean.parseBoolean(args[9].trim()); 97 | itemsPerSlot = Integer.parseInt(args[10].trim()); 98 | immuneToStopSpell = Boolean.parseBoolean(args[11].trim()); 99 | relievesHurt = Boolean.parseBoolean(args[12].trim()); 100 | relievesBreath = Boolean.parseBoolean(args[13].trim()); 101 | protectsTerrain = Boolean.parseBoolean(args[14].trim()); 102 | healPerStepInMilli = Integer.parseInt(args[15].trim()); 103 | } 104 | 105 | public int getId() { 106 | return id; 107 | } 108 | 109 | public Type getType() { 110 | return type; 111 | } 112 | 113 | public String getName() { 114 | return name; 115 | } 116 | 117 | public int getBuy() { 118 | return buy; 119 | } 120 | 121 | public void setBuy(int buy) { 122 | this.buy = buy; 123 | } 124 | 125 | public int getSell() { 126 | return sell; 127 | } 128 | 129 | public void setSell(int sell) { 130 | this.sell = sell; 131 | } 132 | 133 | public int getBuyOriginal() { 134 | return buyOriginal; 135 | } 136 | 137 | public int getSellOriginal() { 138 | return sellOriginal; 139 | } 140 | 141 | public int getAtk() { 142 | return atk; 143 | } 144 | 145 | public int getDef() { 146 | return def; 147 | } 148 | 149 | public int getMaxCount() { 150 | return maxCount; 151 | } 152 | 153 | public boolean isUseInBattle() { 154 | return useInBattle; 155 | } 156 | 157 | public boolean isDisposable() { 158 | return disposable; 159 | } 160 | 161 | public boolean isUseInMap() { 162 | return useInMap; 163 | } 164 | 165 | public int getItemsPerSlot() { 166 | return itemsPerSlot; 167 | } 168 | 169 | public boolean isImmuneToStopSpell() { 170 | return immuneToStopSpell; 171 | } 172 | 173 | public boolean isRelievesHurt() { 174 | return relievesHurt; 175 | } 176 | 177 | public boolean isRelievesBreath() { 178 | return relievesBreath; 179 | } 180 | 181 | public boolean isProtectsTerrain() { 182 | return protectsTerrain; 183 | } 184 | 185 | public int getHealPerStepInMilli() { 186 | return healPerStepInMilli; 187 | } 188 | 189 | public void addParentItem(int itemId) { 190 | if (!containsParentItem(itemId)) { 191 | parentItems.add(itemId); 192 | } 193 | } 194 | 195 | public boolean containsParentItem(int itemId) { 196 | return parentItems.contains(itemId); 197 | } 198 | 199 | public boolean hasPlayerParentItem() { 200 | for (Integer itemId : parentItems) { 201 | Item itemTmp = Resource.getItemById(itemId); 202 | switch (itemTmp.getType()) { 203 | case WEAPON: 204 | if (Player.getWeapon().getId() == itemId) { 205 | return true; 206 | } 207 | break; 208 | case ARMOR: 209 | if (Player.getArmor().getId() == itemId) { 210 | return true; 211 | } 212 | break; 213 | case SHIELD: 214 | if (Player.getShield().getId() == itemId) { 215 | return true; 216 | } 217 | break; 218 | case ITEM: 219 | Integer itemCount = (Integer) 220 | Script.getGlobalValue("##player_item_" + itemId); 221 | if (itemCount != null && itemCount > 0) { 222 | return true; 223 | } 224 | break; 225 | } 226 | } 227 | return false; 228 | } 229 | 230 | public Script getScript() { 231 | return script; 232 | } 233 | 234 | public void setScript(Script script) { 235 | this.script = script; 236 | } 237 | 238 | public boolean isEquip() { 239 | return type != ITEM; 240 | } 241 | 242 | // return boolean -> used successfully 243 | public boolean use(String label) throws Exception { 244 | if (script != null) { 245 | if (script.execute(label)) { 246 | return true; 247 | } 248 | } 249 | return false; 250 | } 251 | 252 | @Override 253 | public String toString() { 254 | return "Item{" + "id=" + id + ", type=" + type + ", name=" + name 255 | + ", buy=" + buy + ", sell=" + sell 256 | + ", buyOriginal=" + buyOriginal 257 | + ", sellOriginal=" + sellOriginal + ", atk=" + atk 258 | + ", def=" + def + ", maxCount=" + maxCount 259 | + ", useInBattle=" + useInBattle + ", useInMap=" + useInMap 260 | + ", disposable=" + disposable + ", itemsPerSlot=" + itemsPerSlot 261 | + ", immuneToStopSpell=" + immuneToStopSpell 262 | + ", relievesHurt=" + relievesHurt 263 | + ", relievesBreath=" + relievesBreath 264 | + ", protectsTerrain=" + protectsTerrain 265 | + ", healPerStepInMilli=" + healPerStepInMilli + '}'; 266 | } 267 | 268 | } 269 | -------------------------------------------------------------------------------- /assets/res/inf/spells.inf: -------------------------------------------------------------------------------- 1 | # http://www.realmofdarkness.net/dq/nes-dw-spells/ 2 | # https://strategywiki.org/wiki/Dragon_Warrior/Spells 3 | 4 | # use always dialog_show 0 0 "message" to not block the UI for wait for key press in battle 5 | # when called from map (field), wait_for_fire_key must be called manually 6 | 7 | # id name lvl mp use_battle use_map type/target 8 | 9 | #Your first spell is one of the most useful. If your HP is low, chant the Heal Spell to raise your HP by 10~17 points. 10 | spell 1, Heal , 3 , 4 , true, true, Heal hero 11 | script 12 | ; map: ret 0->cast spell return to menu | 1->cast spell and exit menu 13 | on_use_when_map: 14 | heal_player 10 17 15 | show_player_simplified_status 16 | wait_for_any_key 17 | ret 1 18 | 19 | ; battle: ret 0->keep player turn | 1->pass the turn to enemy 20 | on_use_when_battle: 21 | heal_player 10 17 22 | show_player_simplified_status 23 | ret 1 24 | script_end 25 | 26 | 27 | #Hurl magic fire balls at the enemy with Hurt. You can go far with this spell, damaging enemies for 8~12 HP. 28 | spell 2, Hurt , 4 , 2 , true, true, Attack enemy 29 | script 30 | on_use_when_map: 31 | sleep 500 32 | show_dialog 0 1 @@player_cast_spell_but_nothing_happened 33 | ; map: ret 0->cast spell return to menu | 1->cast spell and exit menu 34 | ret 1 35 | 36 | on_use_when_battle: 37 | check_battle_enemy_resisted_hurt "##battle_enemy_resisted_hurt" 38 | if ##battle_enemy_resisted_hurt "==" 1 "enemy_resisted_to_spell" 39 | hit_enemy 5 12 40 | goto "when_battle_exit" 41 | enemy_resisted_to_spell: 42 | sleep 500 43 | show_dialog 0 0 @@spell_will_not_work 44 | goto "when_battle_exit" 45 | when_battle_exit: 46 | ; battle: ret 0->keep player turn | 1->pass the turn to enemy 47 | ret 1 48 | script_end 49 | 50 | 51 | #Sleep is used during a battle to put the enemy to sleep. It doesn't always work. 52 | spell 3, Sleep , 7 , 2 , true, true, Disable enemy 53 | script 54 | on_use_when_map: 55 | sleep 500 56 | show_dialog 0 1 @@player_cast_spell_but_nothing_happened 57 | ; map: ret 0->cast spell return to menu | 1->cast spell and exit menu 58 | ret 1 59 | 60 | on_use_when_battle: 61 | check_battle_enemy_resisted_sleep "##battle_enemy_resisted_sleep" 62 | if ##battle_enemy_resisted_sleep "==" 1 "enemy_resisted_to_spell" 63 | sleep_enemy 64 | show_dialog 0 0 @@spell_sleep_success 65 | goto "when_battle_exit" 66 | enemy_resisted_to_spell: 67 | sleep 500 68 | show_dialog 0 0 @@spell_will_not_work 69 | goto "when_battle_exit" 70 | when_battle_exit: 71 | ; battle: ret 0->keep player turn | 1->pass the turn to enemy 72 | ret 1 73 | script_end 74 | 75 | 76 | #Did you forget to bring a torch into the cave? If you have Radiant, it doesn't matter. 77 | spell 4, Radiant , 9 , 3 , false, true, Field 78 | script 79 | ; map: ret 0->cast spell return to menu | 1->cast spell and exit menu 80 | on_use_when_map: 81 | if ##current_map_is_dark "!=" 1 "map_is_not_dark" 82 | map_dark: 83 | sleep 500 84 | ; sound_id = 3 -> using torch sound 85 | play_sound 3 86 | player_cast_radiant_spell 87 | consume_item 43 88 | force_redraw 89 | ret 1 90 | map_is_not_dark: 91 | sleep 500 92 | show_dialog 0 1 @@player_cast_spell_but_nothing_happened 93 | ret 1 94 | 95 | ; battle: ret 0->keep player turn | 1->pass the turn to enemy 96 | on_use_when_battle: 97 | ; this spell can't be used in battle, so ret value is irrelevant 98 | ret 1 99 | script_end 100 | 101 | 102 | #When you encounter an enemy who uses magic, cast this spell to protect yourself. Very few monsters resist this spell! 103 | spell 5, StopSpell , 10 , 2 , true, true, Disable enemy 104 | script 105 | on_use_when_map: 106 | sleep 500 107 | show_dialog 0 1 @@player_cast_spell_but_nothing_happened 108 | ; map: ret 0->cast spell return to menu | 1->cast spell and exit menu 109 | ret 1 110 | 111 | on_use_when_battle: 112 | check_battle_enemy_resisted_stop_spell "##battle_enemy_resisted_stop_spell" 113 | if ##battle_enemy_resisted_stop_spell "==" 1 "enemy_resisted_to_spell" 114 | stop_spell_enemy 115 | show_dialog 0 0 @@spell_stop_spell_success 116 | goto "when_battle_exit" 117 | enemy_resisted_to_spell: 118 | sleep 500 119 | show_dialog 0 0 @@spell_will_not_work 120 | goto "when_battle_exit" 121 | when_battle_exit: 122 | ; battle: ret 0->keep player turn | 1->pass the turn to enemy 123 | ret 1 124 | script_end 125 | 126 | 127 | #Deep in the underground caves and dungeons lurk terrible creatures. Escape from these places by chanting Outside. 128 | spell 6, Outside , 12 , 6 , false, true, Field 129 | script 130 | ; map: ret 0->use item and return to menu | 1->use item and exit menu 131 | on_use_when_map: 132 | if ##current_map_is_dark "!=" 1 "map_is_not_dark" 133 | map_is_dark: 134 | sleep 500 135 | teleport $$player_outside_map ##player_outside_col ##player_outside_row "down" 1 $$player_outside_music_id 0 0 0 1 136 | ; sound_id = 19 -> stairs sound 137 | play_sound 19 138 | ret 1 139 | map_is_not_dark: 140 | sleep 500 141 | show_dialog 0 1 @@player_cast_spell_but_nothing_happened 142 | ret 1 143 | 144 | ; battle: ret 0->keep turn | 1->pass turn to enemy 145 | on_use_when_battle: 146 | ; this item can't be used in battle, so ret value is irrelevant 147 | ret 1 148 | script_end 149 | 150 | 151 | #Return whisks you back to Tantegel Castle from anywhere in the overworld of Alefgard. 152 | spell 7, Return , 13 , 8 , false, true, Field 153 | script 154 | ; map: ret 0->use item and return to menu | 1->use item and exit menu 155 | on_use_when_map: 156 | if ##current_map_is_dark "==" 1 "map_is_dark" 157 | map_is_not_dark: 158 | sleep 500 159 | ; sound_id = 21 -> wings sound 160 | play_sound 21 161 | teleport "world" 46 47 "down" 1 "world" 0 0 0 1 162 | ret 1 163 | map_is_dark: 164 | sleep 500 165 | show_dialog 0 1 @@player_cast_spell_but_nothing_happened 166 | ret 1 167 | 168 | ; battle: ret 0->keep turn | 1->pass turn to enemy 169 | on_use_when_battle: 170 | ; this item can't be used in battle, so ret value is irrelevant 171 | ret 1 172 | script_end 173 | 174 | 175 | #Like sprinkling Fairy Water, Repel keeps monsters at a healthy distance when you are in the countryside. The effect lasts for 127 steps. 176 | spell 8, Repel , 15 , 2 , false, true, Field 177 | script 178 | ; map: ret 0->use item and return to menu | 1->use item and exit menu 179 | on_use_when_map: 180 | set_player_repel_counter 128 "Repel" 181 | wait_for_any_key 182 | ret 1 183 | 184 | ; battle: ret 0->keep turn | 1->pass turn to enemy 185 | on_use_when_battle: 186 | ; this spell can't be used in battle, so ret value is irrelevant 187 | ret 1 188 | script_end 189 | 190 | 191 | #More potent than Heal, Healmore restores 85~100 HP each time you chant it. 192 | spell 9, HealMore , 17 , 10 , true, true, Heal hero 193 | script 194 | on_use_when_map: 195 | heal_player 85 100 196 | show_player_simplified_status 197 | wait_for_any_key 198 | ; map: ret 0->cast spell return to menu | 1->cast spell and exit menu 199 | ret 1 200 | 201 | on_use_when_battle: 202 | heal_player 85 100 203 | show_player_simplified_status 204 | ; battle: ret 0->keep player turn | 1->pass the turn to enemy 205 | ret 1 206 | script_end 207 | 208 | 209 | # More devastating than Hurt; with Hurtmore you can challenge even the strongest enemies. Deals 58~65 damage. 210 | spell 10, Hurtmore , 19 , 5 , true, true, Attack enemy 211 | script 212 | on_use_when_map: 213 | show_dialog 0 1 @@player_cast_spell_but_nothing_happened 214 | ; map: ret 0->cast spell return to menu | 1->cast spell and exit menu 215 | ret 1 216 | 217 | on_use_when_battle: 218 | check_battle_enemy_resisted_hurt "##battle_enemy_resisted_hurt" 219 | if ##battle_enemy_resisted_hurt "==" 1 "enemy_resisted_to_spell" 220 | hit_enemy 58 65 221 | goto "when_battle_exit" 222 | enemy_resisted_to_spell: 223 | sleep 500 224 | show_dialog 0 0 @@spell_will_not_work 225 | goto "when_battle_exit" 226 | when_battle_exit: 227 | ; battle: ret 0->keep player turn | 1->pass the turn to enemy 228 | ret 1 229 | script_end 230 | -------------------------------------------------------------------------------- /assets/res/event/kol.evt: -------------------------------------------------------------------------------- 1 | ; --- kol --- 2 | ; ----------- 3 | 4 | 5 | ; save_point {event_id} {pos_col} {pos_row} 6 | ; --- 7 | save_point save_point_1 22 1 8 | 9 | 10 | ;door {event_name} {sprite_id} {pos_col} {pos_row} {persistent} 11 | ;--- 12 | door door_0 22 7 12 false 13 | door door_1 22 1 14 false 14 | 15 | 16 | ;chest {event_id} {pos_col} {pos_row} {item_id / gold_{value}} {persistent->true|false} 17 | ;--- 18 | chest chest_0 15 20 gold_1 false 19 | chest chest_1 15 21 gold_1 false 20 | chest chest_2 15 22 gold_1 false 21 | 22 | 23 | ; item_on_ground {event_id} {pos_col} {pos_row} {item_id} {persistent->true/false} 24 | ; --- 25 | ; fairy flute (id = 52) 26 | item_on_ground item_on_ground_1 9 6 52 false 27 | 28 | 29 | ;inn {event_name} {pos_col} {pos_row} {inn_price} 30 | ; --- 31 | inn inn_1 19 3 20 32 | 33 | 34 | ;shop_item {event_name} {pos_col} {pos_row} \ 35 | ; {item_id} {buy_price->value|default_price} {sell_price->value|default_price} \ 36 | ; {item_id} {buy_price->value|default_price} {sell_price->value|default_price} \ 37 | ; {item_id} {buy_price->value|default_price} {sell_price->value|default_price} 38 | ; --- 39 | shop_item shop_item_1 13 21 \ 40 | ; herb item (id = 41) 41 | 41 default_price default_price \ 42 | ; torch item (id = 43) 43 | 43 default_price default_price \ 44 | ; dragon's scale item (id = 44) 45 | 44 default_price default_price \ 46 | ; wings item (id = 42) 47 | 42 default_price default_price 48 | 49 | 50 | ;shop_equip {event_name} {pos_col} {pos_row} \ 51 | ; {item_id} {buy_price->value|default_price} {sell_price->value|default_price} \ 52 | ; {item_id} {buy_price->value|default_price} {sell_price->value|default_price} \ 53 | ; {item_id} {buy_price->value|default_price} {sell_price->value|default_price} 54 | ; --- 55 | shop_equip shop_equip_1 21 12 \ 56 | ; copper sword (id = 13) 57 | 13 default_price default_price \ 58 | ; hand axe (id = 16) 59 | 16 default_price default_price \ 60 | ; half plate (id = 24) 61 | 24 default_price default_price \ 62 | ; full plate (id = 23) 63 | 23 default_price default_price \ 64 | ; small shield (id = 32) 65 | 32 default_price default_price 66 | 67 | 68 | ;npc {event_id} {sprite_start_id} {pos_col} {pos_row} 69 | ; STATIC {sprite_direction} | RANDOM {rect_col} {rect_row} {rect_width} {rect_height} 70 | ; {texts_global_var_0} ... {texts_global_var_n} | conditional_msgs 71 | ; {var_a} {comparisson_operator} {var_b} {messages_count} {texts_global_var_0} ... {texts_global_var_n} 72 | ; {var_c} {comparisson_operator} {var_d} {messages_count} {texts_global_var_0} ... {texts_global_var_n} 73 | ; {var_e} {comparisson_operator} options 2 (no. of options) 2 (default start option [not implemented!]) 0 (cancel_option / -1 will force to choose one of options) 74 | ; {yes_text} {messages_count} {texts_global_var_0} ... {texts_global_var_n} 75 | ; {no_text} {messages_count} {texts_global_var_0} ... {texts_global_var_n} 76 | ; --- 77 | ; sprite_start_id description 78 | ; 0 0 hero 79 | ; 1 8 boy 80 | ; 2 16 hero 81 | ; 3 24 girl 82 | ; 4 32 hero 83 | ; 5 40 old_man 84 | ; 6 48 hero 85 | ; 7 56 merchant 86 | ; 8 64 hero_princess 87 | ; 9 72 warrior 88 | ;10 80 princess 89 | ;11 88 dragon_lord 90 | ;12 96 guard 91 | ;13 104 guard_bugle 92 | ;14 106 king 93 | ; --- 94 | npc npc_shop_item 56 14 21 \ 95 | STATIC left \ 96 | @@empty 97 | 98 | npc npc_shop_equip 56 22 12 \ 99 | STATIC left \ 100 | @@empty 101 | 102 | npc npc_inn 56 19 4 \ 103 | STATIC up \ 104 | @@empty 105 | 106 | 107 | ;@@kol_old_man_1 = This is the village of Kol. 108 | ;@@kol_old_man_2 = In legends it is said that fairies know how to put Golem to sleep. 109 | ;@@kol_old_man_3_a = Though thou art as brave as thy ancestor, $$player_name , thou cannot defeat the great Dragonlord with such weapons. 110 | ;@@kol_old_man_3_b = Thou shouldst come here again. 111 | ;@@kol_old_man_3_c = Finally thou hast obtained it, $$player_name . 112 | ;@@kol_old_man_4 = Hast thou found the flute? 113 | ;@@kol_old_man_4_no = Howard had it, but he went to Rimuldar and never returned. 114 | ;@@kol_old_man_4_yes = Go to the town of Cantlin. 115 | 116 | npc old_man_1 40 20 19 \ 117 | RANDOM 9 9 15 15 \ 118 | conditional_msgs \ 119 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 120 | ; ##game_state_princess_rescued == 1 1 @@kol_old_man \ 121 | 1 == 1 1 @@kol_old_man_1 122 | 123 | npc old_man_2 40 19 8 \ 124 | RANDOM 12 3 12 9 \ 125 | conditional_msgs \ 126 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 127 | ; ##game_state_princess_rescued == 1 1 @@kol_old_man \ 128 | 1 == 1 1 @@kol_old_man_2 129 | 130 | # reference: https://www.youtube.com/watch?v=H-jkOhOTNLA&t=135s 131 | 132 | npc old_man_3_a 40 1 1 \ 133 | STATIC down \ 134 | @@empty 135 | 136 | npc old_man_3_b 112 1 2 \ 137 | STATIC down \ 138 | conditional_msgs \ 139 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 140 | ; ##game_state_princess_rescued == 1 1 @@kol_old_man \ 141 | ##player_armor_id == 22 1 @@kol_old_man_3_c \ 142 | 1 == 1 2 @@kol_old_man_3_a @@kol_old_man_3_b 143 | 144 | npc old_man_4 40 2 12 \ 145 | RANDOM 0 10 5 4 \ 146 | conditional_msgs \ 147 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 148 | ; ##game_state_princess_rescued == 1 1 @@kol_old_man \ 149 | 1 == 1 1 @@kol_old_man_4 options 2 0 1 \ 150 | @@option_yes 1 @@kol_old_man_4_yes \ 151 | @@option_no 1 @@kol_old_man_4_no 152 | 153 | 154 | ;@@kol_boy_1_a = Dreadful is the South Island. 155 | ;@@kol_boy_1_b = Great strength and skill and wit only will bring thee back from that place. 156 | ;@@kol_boy_2 = Art thou the descendant of Erdrick? | Hast thou any proof? 157 | 158 | npc boy_1 8 14 14 \ 159 | RANDOM 7 5 11 15 \ 160 | conditional_msgs \ 161 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 162 | ; ##game_state_princess_rescued == 1 1 @@empty \ 163 | 1 == 1 2 @@kol_boy_1_a @@kol_boy_1_b 164 | 165 | npc boy_2 8 5 12 \ 166 | RANDOM 0 9 9 15 \ 167 | conditional_msgs \ 168 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 169 | ; ##game_state_princess_rescued == 1 1 @@empty \ 170 | 1 == 1 1 @@kol_boy_2 171 | 172 | ;@@kol_guard_1 = Golem is afraid of the music of the flute, so 'tis said. 173 | ;@@kol_guard_2 = Rimuldar is the place to buy keys. 174 | 175 | npc guard_1 96 13 9 \ 176 | RANDOM 7 0 11 16 \ 177 | conditional_msgs \ 178 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 179 | ; ##game_state_princess_rescued == 1 1 @@garinham_old_man \ 180 | 1 == 1 1 @@kol_guard_1 181 | 182 | npc guard_2 96 1 23 \ 183 | STATIC down \ 184 | conditional_msgs \ 185 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 186 | ; ##game_state_princess_rescued == 1 1 @@garinham_old_man \ 187 | 1 == 1 1 @@kol_guard_2 188 | 189 | 190 | ;@@kol_girl_1 = Please, save us from the minions of the Dragonlord. 191 | ;@@kol_girl_2 = This bath cures rheumatism. 192 | 193 | npc girl_1 24 11 15 \ 194 | RANDOM 6 6 14 16 \ 195 | conditional_msgs \ 196 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 197 | ; ##game_state_princess_rescued == 1 1 @@empty \ 198 | 1 == 1 1 @@kol_girl_1 199 | 200 | npc girl_2 24 12 1 \ 201 | STATIC down \ 202 | conditional_msgs \ 203 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 204 | ; ##game_state_princess_rescued == 1 1 @@empty \ 205 | 1 == 1 1 @@kol_girl_2 206 | 207 | 208 | ;@@kol_warrior_1 = East of Hauksness there is a town, 'tis said, where one may purchase weapons of extraordinary quality. 209 | ;@@kol_warrior_2 = Hast thou seen Nester? | I think he may need help. 210 | 211 | npc warrior_1 72 20 13 \ 212 | STATIC down \ 213 | conditional_msgs \ 214 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 215 | ; ##game_state_princess_rescued == 1 1 @@empty \ 216 | 1 == 1 1 @@kol_warrior_1 217 | 218 | npc warrior_2 72 6 6 \ 219 | RANDOM 4 0 14 13 \ 220 | conditional_msgs \ 221 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 222 | ; ##game_state_princess_rescued == 1 1 @@empty \ 223 | 1 == 1 1 @@kol_warrior_2 224 | 225 | 226 | ;@@kol_merchant_1 = Hast thou been to the southern island? 227 | ;@@kol_merchant_1_yes = I have heard that powerful enemies live there. 228 | ;@@kol_merchant_1_no = To the south, I believe, there is a town called Rimuldar. 229 | 230 | npc merchant_1 56 7 19 \ 231 | RANDOM 5 16 5 8 \ 232 | conditional_msgs \ 233 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 234 | ; ##game_state_princess_rescued == 1 1 @@empty \ 235 | 1 == 1 1 @@kol_merchant_1 options 2 0 1 \ 236 | @@option_yes 1 @@kol_merchant_1_yes \ 237 | @@option_no 1 @@kol_merchant_1_no 238 | -------------------------------------------------------------------------------- /assets/res/map/rock_mountain_cave.map: -------------------------------------------------------------------------------- 1 | # reference: http://www.realmofdarkness.net/dq/wp-content/img/nes/dw/maps/rockmountain-cave-2.png 2 | 3 | map_name Rock Mountain Cave 4 | map_tileset tileset 5 | map_music dungeon 6 | map_out_of_bounds_tile_id 36 7 | map_is_dark true 8 | map_repel_has_no_effect true 9 | map_reset_repel_on_enter true 10 | map_reset_light_on_enter true 11 | map_rows 38 12 | map_cols 76 13 | map_data 14 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 15 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 16 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 17 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 18 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 19 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 20 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 21 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 22 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 23 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 24 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 25 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 26 | 36,36,36,36,36,36,36,36,36,36,30,32,32,32,32,32,30,30,30,30,32,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,30,32,32,32,32,32,32,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 27 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,32,32,32,32,32,32,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,30,32,30,32,30,32,30,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 28 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,30,30,30,30,30,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,32,32,30,32,30,32,30,32,32,32,30,32,30,30,36,36,36,36,36,36,36,36,36,36 29 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,32,32,32,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,32,32,30,30,30,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 30 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,32,30,30,30,30,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,30,32,32,30,30,32,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 31 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,30,32,32,32,32,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,32,30,32,32,32,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 32 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,32,30,30,32,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,30,32,30,32,32,30,30,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 33 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,32,32,32,30,32,32,32,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,30,32,30,30,30,30,32,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 34 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,32,30,30,30,30,30,32,32,32,30,32,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,32,30,30,32,32,32,32,30,32,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 35 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,30,32,32,32,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,30,30,30,32,32,32,32,32,30,30,32,30,30,36,36,36,36,36,36,36,36,36,36 36 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,32,30,32,30,32,30,30,30,32,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,32,32,32,30,30,30,30,32,30,30,30,30,36,36,36,36,36,36,36,36,36,36 37 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,32,30,32,32,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,32,32,30,32,32,32,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 38 | 36,36,36,36,36,36,36,36,36,36,30,30,32,30,32,30,32,30,30,30,32,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,30,30,30,30,30,30,30,32,30,32,30,32,32,30,30,36,36,36,36,36,36,36,36,36,36 39 | 36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,32,32,32,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,32,32,32,32,32,32,32,32,32,30,32,32,32,32,30,30,36,36,36,36,36,36,36,36,36,36 40 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 41 | 36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,36 42 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 43 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 44 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 45 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 46 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 47 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 48 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 49 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 50 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 51 | 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36 52 | 53 | # monsters zone 54 | zone_rows 1 55 | zone_cols 2 56 | zone_tiles_per_row 38 57 | zone_tiles_per_col 38 58 | zone_offset_rows 0 59 | zone_offset_cols 0 60 | # note: zone_data needs to be in decimal 61 | zone_data 62 | 19,14 63 | 64 | # zone <-> enemies 65 | zone_enemies_rows 20 66 | zone_enemies_cols 5 67 | # note: zone_enemies_data needs to be in hexadecimal 68 | zone_enemies_data 69 | 00,00,01,00,01,00 70 | 01,01,00,01,02,01 71 | 02,00,03,02,03,01 72 | 03,01,01,02,03,04 73 | 04,03,04,05,05,06 74 | 05,03,04,05,06,0B 75 | 06,05,06,0B,0C,0E 76 | 07,0B,0C,0D,0E,0E 77 | 08,0D,0F,12,12,19 78 | 09,0F,15,12,15,19 79 | 0A,15,16,17,1A,1C 80 | 0B,17,1A,1B,1C,10 81 | 0C,1A,1B,1C,1D,1F 82 | 0D,1D,1E,1F,1F,20 83 | 0E,08,09,0A,0B,0C 84 | 0F,11,12,13,14,17 85 | 10,1D,1E,1F,20,21 86 | 11,20,21,22,22,23 87 | 12,20,23,24,24,25 88 | 13,03,04,06,07,07 89 | -------------------------------------------------------------------------------- /src/dq1/core/Audio.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import dq1.core.Script.ScriptCommand; 4 | import static dq1.core.Settings.*; 5 | import java.util.logging.Level; 6 | import java.util.logging.Logger; 7 | import javax.sound.midi.InvalidMidiDataException; 8 | import javax.sound.midi.MidiChannel; 9 | import javax.sound.midi.MidiSystem; 10 | import javax.sound.midi.MidiUnavailableException; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Sequencer; 13 | import javax.sound.midi.Soundbank; 14 | import javax.sound.midi.Synthesizer; 15 | 16 | /** 17 | * Audio class. 18 | * 19 | * @author Leonardo Ono (ono.leo80@gmail.com) 20 | */ 21 | public class Audio { 22 | 23 | public static int SOUND_NPC_DIALOG = 1; 24 | public static int SOUND_MENU_CONFIRMED = 2; 25 | public static int SOUND_TORCH_USED = 3; 26 | public static int SOUND_BLOCKED = 4; 27 | public static int SOUND_SWAMP = 5; 28 | public static int SOUND_PLAYER_HIT = 6; 29 | public static int SOUND_PLAYER_WILL_ATTACK = 7; 30 | public static int SOUND_ENEMY_WILL_ATTACK = 8; 31 | public static int SOUND_ENEMY_DODGING = 9; 32 | public static int SOUND_ENEMY_MISSED_ATTACK = 10; 33 | public static int SOUND_BARRIER_XXX = 11; // ??? 34 | public static int SOUND_ENEMY_HIT = 12; 35 | public static int SOUND_CHEST_OPENED = 13; 36 | public static int SOUND_SHOW_OPTIONS_MENU = 14; 37 | public static int SOUND_DOOR_OPENED = 15; 38 | public static int SOUND_CRITICAL_ATTACK = 16; 39 | public static int SOUND_RUN_AWAY = 17; 40 | public static int SOUND_SPELL = 18; 41 | public static int SOUND_ENTRANCE_OR_STAIRS = 19; 42 | public static int SOUND_DRAGON_LORD_BREATHING_FIRE = 20; 43 | public static int SOUND_WYVERN_WING = 21; 44 | public static int SOUND_BATTLE_WIN = 22; 45 | public static int SOUND_LEVEL_UP = 23; 46 | public static int SOUND_SILVER_HARP = 24; 47 | public static int SOUND_FAIRY_FLUTE = 25; 48 | public static int SOUND_CURSED = 26; 49 | public static int SOUND_RAINBOW_BRIDGE = 27; 50 | public static int SOUND_PRINCESS_RESCUED = 28; 51 | public static int SOUND_INN = 29; 52 | public static int SOUND_PLAYER_DEAD = 30; 53 | 54 | private static Synthesizer musicSynth; 55 | private static boolean musicInitialized; 56 | private static Sequencer sequencer; 57 | private static int musicVolume; 58 | private static Music currentMusic; 59 | 60 | private static boolean soundInitialized; 61 | private static Synthesizer synth; 62 | private static int soundVolume; 63 | 64 | //id midi_file start_tick_position loop_start_tick loop_end_tick 65 | public static class Music { 66 | public String id; 67 | public Sequence sequence; 68 | public long startTickPosition; 69 | public long loopStartTick; 70 | public long loopEndTick; 71 | public int loopCount; 72 | 73 | public Music(String serializedData) { 74 | String[] args = serializedData.trim().split(","); 75 | String[] h = args[0].trim().split("\\s+"); 76 | id = h[1].trim(); 77 | sequence = Resource.loadMusicSequence(args[1].trim()); 78 | startTickPosition = Long.parseLong(args[2].trim()); 79 | loopStartTick = Long.parseLong(args[3].trim()); 80 | loopEndTick = Long.parseLong(args[4].trim()); 81 | loopCount = Integer.parseInt(args[5].trim()); 82 | } 83 | } 84 | 85 | public static void start() { 86 | try { 87 | musicSynth = MidiSystem.getSynthesizer(); 88 | musicSynth.open(); 89 | Soundbank msb = Resource.loadSoundBank(RES_SOUND_BANK); 90 | musicSynth.loadAllInstruments(msb); 91 | setMusicVolume(4); 92 | 93 | sequencer = MidiSystem.getSequencer(false); 94 | sequencer.open(); 95 | sequencer.getTransmitter().setReceiver(musicSynth.getReceiver()); 96 | 97 | musicInitialized = true; 98 | } catch (MidiUnavailableException ex) { 99 | Logger.getLogger(Audio.class.getName()).log(Level.SEVERE, null, ex); 100 | musicInitialized = false; 101 | } 102 | try { 103 | synth = MidiSystem.getSynthesizer(); 104 | synth.open(); 105 | Soundbank sb = Resource.loadSoundBank(RES_SOUND_EFFECTS); 106 | synth.loadAllInstruments(sb); 107 | soundInitialized = true; 108 | setSoundVolume(7); 109 | } catch (MidiUnavailableException ex) { 110 | Logger.getLogger(Audio.class.getName()).log(Level.SEVERE, null, ex); 111 | soundInitialized = false; 112 | } 113 | } 114 | 115 | public static int getSoundVolume() { 116 | return soundVolume; 117 | } 118 | 119 | // volume 0~9 120 | @ScriptCommand(name = "set_sound_volume") 121 | public static void setSoundVolume(int volume) { 122 | MidiChannel[] channels = synth.getChannels(); 123 | for (int i = 0; i < channels.length; i++) { 124 | channels[i].controlChange(7, (int) (127 * (volume / 9.0))); 125 | channels[i].controlChange(39, (int) (127 * (volume / 9.0))); 126 | } 127 | soundVolume = volume; 128 | Script.setGlobalValue("##game_config_sound_volume", volume); 129 | } 130 | 131 | @ScriptCommand(name = "play_sound") 132 | public static void playSound(int soundId) { 133 | if (soundInitialized) { 134 | synth.getChannels()[1].noteOff(soundId, 200); 135 | synth.getChannels()[1].noteOn(soundId, 200); 136 | } 137 | } 138 | 139 | public static Music getCurrentMusic() { 140 | return currentMusic; 141 | } 142 | 143 | public static int getMusicVolume() { 144 | return musicVolume; 145 | } 146 | 147 | // volume 0~9 148 | @ScriptCommand(name = "set_music_volume") 149 | public static void setMusicVolume(int volume) { 150 | MidiChannel[] channels = musicSynth.getChannels(); 151 | for (int i = 0; i < channels.length; i++) { 152 | channels[i].controlChange(7, (int) (127 * (volume / 9.0))); 153 | channels[i].controlChange(39, (int) (127 * (volume / 9.0))); 154 | } 155 | musicVolume = volume; 156 | Script.setGlobalValue("##game_config_music_volume", volume); 157 | } 158 | 159 | @ScriptCommand(name = "play_music") 160 | public static void playMusic(String musicId) { 161 | try { 162 | if (musicInitialized) { 163 | Music music = Resource.getMusic(musicId); 164 | Audio.currentMusic = music; 165 | sequencer.stop(); 166 | sequencer.setSequence(music.sequence); 167 | //System.out.println("tick length: " 168 | // + sequencer.getTickLength()); 169 | sequencer.setLoopStartPoint(0); 170 | sequencer.setLoopEndPoint(0); 171 | sequencer.setTickPosition(0); 172 | sequencer.setLoopEndPoint(music.loopEndTick); 173 | sequencer.setLoopStartPoint(music.loopStartTick); 174 | sequencer.setTickPosition(music.startTickPosition); 175 | sequencer.setLoopCount(music.loopCount); 176 | sequencer.start(); 177 | } 178 | } 179 | catch (InvalidMidiDataException ex) { 180 | Logger.getLogger(Audio.class.getName()).log(Level.SEVERE, null, ex); 181 | musicInitialized = false; 182 | } 183 | } 184 | 185 | @ScriptCommand(name = "pause_music") 186 | public static void pauseMusic() { 187 | if (musicInitialized) { 188 | sequencer.stop(); 189 | } 190 | } 191 | 192 | @ScriptCommand(name = "resume_music") 193 | public static void resumeMusic() { 194 | if (musicInitialized) { 195 | sequencer.start(); 196 | } 197 | } 198 | 199 | @ScriptCommand(name = "stop_music") 200 | public static void stopMusic() { 201 | if (musicInitialized) { 202 | sequencer.stop(); 203 | } 204 | currentMusic = null; 205 | } 206 | 207 | private static String savedCurrentMusicId; 208 | 209 | @ScriptCommand(name = "save_current_music") 210 | public static void saveCurrentMusic() { 211 | savedCurrentMusicId = currentMusic.id; 212 | } 213 | 214 | @ScriptCommand(name = "restore_play_saved_music") 215 | public static void restoreAndPlaySavedMusic() { 216 | playMusic(savedCurrentMusicId); 217 | } 218 | 219 | public static void applyConfigValues() { 220 | Integer configMusicVolume = 5; 221 | try { 222 | configMusicVolume = (Integer) 223 | Script.getGlobalValue("##game_config_music_volume"); 224 | } 225 | catch (Exception e) { } 226 | Integer configSoundVolume = 5; 227 | try { 228 | configSoundVolume = (Integer) 229 | Script.getGlobalValue("##game_config_sound_volume"); 230 | } 231 | catch (Exception e) { } 232 | setMusicVolume(configMusicVolume); 233 | setSoundVolume(configSoundVolume); 234 | } 235 | 236 | public static void main(String[] args) { 237 | Resource.loadMusics("musics"); 238 | Audio.start(); 239 | //Audio.playMusic("tantegel");//ok 240 | //Audio.playMusic("world");//ok 241 | //Audio.playMusic("battle");//ok 242 | //Audio.playMusic("boss");//ok 243 | //Audio.playMusic("intro");//ok 244 | Audio.playMusic("ending");//ok 245 | Audio.setMusicVolume(40); 246 | } 247 | 248 | } 249 | -------------------------------------------------------------------------------- /src/dq1/core/View.java: -------------------------------------------------------------------------------- 1 | package dq1.core; 2 | 3 | import static dq1.core.Game.sleep; 4 | import dq1.core.Script.ScriptCommand; 5 | import java.awt.AlphaComposite; 6 | import java.awt.Canvas; 7 | import java.awt.Color; 8 | import java.awt.Composite; 9 | import java.awt.Graphics; 10 | import java.awt.Graphics2D; 11 | import java.awt.Shape; 12 | import java.awt.geom.Ellipse2D; 13 | import java.awt.image.BufferStrategy; 14 | import java.awt.image.BufferedImage; 15 | import static java.awt.image.BufferedImage.TYPE_INT_ARGB; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | /** 20 | * View class. 21 | * 22 | * @author Leonardo Ono (ono.leo80@gmail.com) 23 | */ 24 | public class View { 25 | 26 | private static final Canvas CANVAS = new Canvas(); 27 | private static BufferStrategy bs; 28 | private static BufferedImage backbuffer; 29 | private static BufferedImage offscreenTmp; 30 | private static Graphics2D bg; 31 | private static Graphics2D og2dTmp; 32 | 33 | private static final BufferedImage[] LAYERS = new BufferedImage[4]; 34 | private static final Graphics2D[] OG2DS = new Graphics2D[4]; 35 | 36 | // <0 = map is not dark 37 | private static int lightRadiusLayer0 = -1; 38 | 39 | public static Canvas getCanvas() { 40 | return CANVAS; 41 | } 42 | 43 | public static BufferedImage getOffscreen(int layer) { 44 | return LAYERS[layer - 1]; 45 | } 46 | 47 | public static Graphics2D getOffscreenGraphics2D(int layer) { 48 | return OG2DS[layer - 1]; 49 | } 50 | 51 | public static int getLightRadiusLayer0() { 52 | return lightRadiusLayer0; 53 | } 54 | 55 | public static void setLightRadiusLayer0(int lightRadiusLayer0) { 56 | View.lightRadiusLayer0 = lightRadiusLayer0; 57 | } 58 | 59 | public static void start() { 60 | CANVAS.createBufferStrategy(2); 61 | bs = CANVAS.getBufferStrategy(); 62 | for (int i = 0; i < 4; i++) { 63 | LAYERS[i] = new BufferedImage(256, 240, TYPE_INT_ARGB); 64 | OG2DS[i] = (Graphics2D) LAYERS[i].getGraphics(); 65 | OG2DS[i].setBackground(new Color(0, 0, 0, 0)); 66 | } 67 | backbuffer = new BufferedImage(256, 240, TYPE_INT_ARGB); 68 | bg = (Graphics2D) backbuffer.getGraphics(); 69 | offscreenTmp = new BufferedImage(256, 240, TYPE_INT_ARGB); 70 | og2dTmp = (Graphics2D) offscreenTmp.getGraphics(); 71 | og2dTmp.setBackground(new Color(0, 0, 0, 0)); 72 | CANVAS.addKeyListener(new Input()); 73 | } 74 | 75 | private static int effectX = 0; 76 | private static int effectLayer = 0; 77 | private static Color effectColor; 78 | 79 | @ScriptCommand(name = "screen_shake") 80 | public static void shake(int layer, int count, int speed) { 81 | effectLayer = layer; 82 | for (int i = 0; i < count; i++) { 83 | int maxX = (int) (9 * ((count - i) / (double) count)) + 1; 84 | for (int s = 0; s < 16; s++) { 85 | double a = (2 * Math.PI) * (s / 10.0); 86 | effectX = (int) (maxX * Math.sin(a)); 87 | refresh(); 88 | Game.sleep(speed); 89 | } 90 | } 91 | effectLayer = 0; 92 | effectX = 0; 93 | } 94 | 95 | // encodedColor = hexa or octal string. example "0xffffff" 96 | @ScriptCommand(name = "screen_flash") 97 | public static void flash( 98 | int layer, int count, String encodedColor, int speed) { 99 | 100 | flash(layer, count, Util.getColor(encodedColor), speed); 101 | } 102 | 103 | public static void flash(int layer, int count, Color color, int speed) { 104 | effectLayer = layer; 105 | for (int i = 0; i < count * 2; i++) { 106 | effectColor = (i % 2) == 0 ? color : null; 107 | refresh(); 108 | Game.sleep(speed); 109 | } 110 | effectLayer = 0; 111 | effectColor = null; 112 | } 113 | 114 | public static void flashLayer4(int count, Color color, int speed) { 115 | og2dTmp.drawImage(LAYERS[3], 0, 0, null); 116 | for (int i = 0; i < count * 2; i++) { 117 | OG2DS[3].clearRect(0, 0, 256, 240); 118 | OG2DS[3].drawImage(offscreenTmp, 0, 0, null); 119 | Color flashColor = (i % 2) == 0 ? color : null; 120 | if (flashColor != null) { 121 | Composite originalComp = OG2DS[3].getComposite(); 122 | Composite comp 123 | = AlphaComposite.getInstance(AlphaComposite.SRC_IN); 124 | 125 | OG2DS[3].setComposite(comp); 126 | OG2DS[3].setColor(flashColor); 127 | OG2DS[3].fillRect(0, 0, 256, 240); 128 | OG2DS[3].setComposite(originalComp); 129 | } 130 | refresh(); 131 | Game.sleep(speed); 132 | } 133 | OG2DS[3].drawImage(offscreenTmp, 0, 0, null); 134 | og2dTmp.clearRect(0, 0, 256, 240); 135 | refresh(); 136 | } 137 | 138 | public final static Map LIGHTS = new HashMap<>(); 139 | 140 | @ScriptCommand(name = "screen_refresh") 141 | public static void refresh() { 142 | bg.clearRect(0, 0, 256, 240); 143 | Shape originalClip = null; 144 | for (int i = 0; i < LAYERS.length; i++) { 145 | if (i == 0 && lightRadiusLayer0 >= 0) { 146 | originalClip = bg.getClip(); 147 | Shape light = LIGHTS.get(lightRadiusLayer0); 148 | if (light == null) { 149 | light = new Ellipse2D.Double( 150 | 128 - lightRadiusLayer0, 120 - lightRadiusLayer0 151 | , 2 * lightRadiusLayer0, 2 * lightRadiusLayer0); 152 | LIGHTS.put(i, light); 153 | } 154 | bg.setClip(light); 155 | } 156 | bg.drawImage(LAYERS[i] 157 | , i < effectLayer ? effectX : 0, 0, 256, 240, null); 158 | 159 | if (i == 0 && lightRadiusLayer0 >= 0) { 160 | bg.setClip(originalClip); 161 | } 162 | if (effectLayer > 0 163 | && i + 1 == effectLayer && effectColor != null) { 164 | 165 | bg.setColor(effectColor); 166 | bg.fillRect(0, 0, 256, 240); 167 | } 168 | } 169 | 170 | do { 171 | do { 172 | Graphics g = bs.getDrawGraphics(); 173 | g.drawImage(backbuffer, 0, 0, 174 | CANVAS.getWidth(), CANVAS.getHeight(), null); 175 | 176 | g.dispose(); 177 | } while (bs.contentsRestored()); 178 | bs.show(); 179 | } 180 | while (bs.contentsLost()); 181 | } 182 | 183 | private static final int[][] DIRECTIONS 184 | = { { 1, 0 }, { 0, -1 }, { -1, 0 }, { 0, 1 } }; 185 | 186 | // it will use the layer 4 187 | public static void showBattleBackgroundImageAnimation( 188 | BufferedImage battleBackgroundImage) { 189 | 190 | int row = 3; 191 | int col = 3; 192 | for (int i = 0; i < 13; i++) { 193 | int s = i / 2 + 1; 194 | for (int j = 0; j < s; j++) { 195 | int sx1 = col * 16; 196 | int sy1 = row * 16; 197 | int sx2 = sx1 + 16; 198 | int sy2 = sy1 + 16; 199 | int dx1 = col * 16 + 72; 200 | int dy1 = row * 16 + 64 - 8; 201 | int dx2 = dx1 + 16; 202 | int dy2 = dy1 + 16; 203 | OG2DS[1].drawImage(battleBackgroundImage 204 | , dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null); 205 | 206 | refresh(); 207 | Game.sleep(10); 208 | row += DIRECTIONS[i % 4][0]; 209 | col += DIRECTIONS[i % 4][1]; 210 | } 211 | } 212 | } 213 | 214 | private static final Color[] FADE_COLORS = new Color[25]; 215 | 216 | static { 217 | for (int i = 0; i < 25; i++) { 218 | FADE_COLORS[i] = new Color(0, 0, 0, (int) (255 * (i / 24.0))); 219 | } 220 | } 221 | 222 | @ScriptCommand(name = "screen_fade_in") 223 | public static void fadeIn() { 224 | Graphics2D g3 = getOffscreenGraphics2D(3); 225 | for (int i = 24; i >= 0; i--) { 226 | g3.setBackground(FADE_COLORS[i]); 227 | g3.clearRect(0, 0, 256, 240); 228 | View.refresh(); 229 | sleep(1000 / 60); 230 | } 231 | } 232 | 233 | @ScriptCommand(name = "screen_fade_out") 234 | public static void fadeOut() { 235 | Graphics2D g3 = getOffscreenGraphics2D(3); 236 | g3.setColor(new Color(0, 0, 0, 16)); 237 | for (int i = 0; i < 25; i++) { 238 | g3.setBackground(FADE_COLORS[i]); 239 | g3.clearRect(0, 0, 256, 240); 240 | View.refresh(); 241 | sleep(1000 / 60); 242 | } 243 | } 244 | 245 | @ScriptCommand(name = "screen_clear") 246 | public static void clear(int layer, String color) { 247 | View.getOffscreenGraphics2D(layer).setBackground(Util.getColor(color)); 248 | View.getOffscreenGraphics2D(layer).clearRect(0, 0, 256, 240); 249 | } 250 | 251 | @ScriptCommand(name = "screen_fill") 252 | public static void fill(int layer, String color) { 253 | View.getOffscreenGraphics2D(layer).setColor(Util.getColor(color)); 254 | View.getOffscreenGraphics2D(layer).fillRect(0, 0, 256, 240); 255 | View.getOffscreenGraphics2D(layer).setColor( 256 | Util.getColor("0x00000000")); 257 | } 258 | 259 | @ScriptCommand(name = "screen_show_image") 260 | public static void showImage(int layer, String imageId, int x, int y) { 261 | BufferedImage image = Resource.getImage(imageId); 262 | View.getOffscreenGraphics2D(layer).drawImage(image, x, y, null); 263 | View.refresh(); 264 | } 265 | 266 | } 267 | -------------------------------------------------------------------------------- /assets/res/event/rimuldar.evt: -------------------------------------------------------------------------------- 1 | ; --- rimuldar --- 2 | ; ---------------- 3 | 4 | 5 | ; save_point {event_id} {pos_col} {pos_row} 6 | ; --- 7 | save_point save_point_1 28 33 8 | 9 | 10 | ;door {event_name} {sprite_id} {pos_col} {pos_row} {persistent} 11 | ;--- 12 | door door_1 22 32 31 false 13 | door door_2 22 33 33 false 14 | 15 | 16 | ;chest {event_id} {pos_col} {pos_row} {item_id / gold_{value}} {persistent->true|false} 17 | ;--- 18 | ; wings (id = 42) 19 | chest chest_1 35 33 42 false 20 | 21 | 22 | ;teleport {event_id} {sprite_id} {pos_col} {pos_row} \ 23 | ; {map_id} {player_col} {player_row} {player_direction} \ 24 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 25 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 26 | ; {resetRepel->true|false] {resetLight->true|false] 27 | ;--- 28 | teleport teleport_1 31 21 30 \ 29 | rimuldar 94 11 down \ 30 | no_sound false \ 31 | town false true \ 32 | false true 33 | 34 | teleport teleport_2 31 22 30 \ 35 | rimuldar 95 11 down \ 36 | no_sound false \ 37 | town false true \ 38 | false true 39 | 40 | teleport teleport_3 31 16 13 \ 41 | rimuldar 64 11 right \ 42 | no_sound false \ 43 | town false true \ 44 | false true 45 | 46 | teleport teleport_4 36 63 11 \ 47 | rimuldar 15 13 left \ 48 | no_sound false \ 49 | town false true \ 50 | false true 51 | 52 | teleport teleport_5 36 94 10 \ 53 | rimuldar 21 29 up \ 54 | no_sound false \ 55 | town false true \ 56 | false true 57 | 58 | teleport teleport_6 36 95 10 \ 59 | rimuldar 22 29 up \ 60 | no_sound false \ 61 | town false true \ 62 | false true 63 | 64 | 65 | ;inn {event_name} {pos_col} {pos_row} {inn_price} 66 | ; --- 67 | inn inn_1 28 28 55 68 | 69 | 70 | shop_equip shop_equip_1 34 18 \ 71 | ; copper sword (id = 13) 72 | 13 default_price default_price \ 73 | ; hand axe (id = 16) 74 | 16 default_price default_price \ 75 | ; broad sword (id = 11) 76 | 11 default_price default_price \ 77 | ; half plate (id = 24) 78 | 24 default_price default_price \ 79 | ; full plate (id = 23) 80 | 23 default_price default_price \ 81 | ; magic armor (id = 26) 82 | 26 default_price default_price 83 | 84 | 85 | ; shop_keys {event_name} {pos_col} {pos_row} {key_price} 86 | ;--- 87 | shop_keys shop_keys_1_a 63 14 53 88 | 89 | 90 | ;npc {event_id} {sprite_start_id} {pos_col} {pos_row} \ 91 | ; STATIC {sprite_direction} | RANDOM {rect_col} {rect_row} {rect_width} {rect_height} \ 92 | ; {texts_global_var_0} ... {texts_global_var_n} | conditional_msgs \ 93 | ; {var_a} {comparisson_operator} {var_b} {messages_count} {texts_global_var_0} ... {texts_global_var_n} \ 94 | ; {var_c} {comparisson_operator} {var_d} {messages_count} {texts_global_var_0} ... {texts_global_var_n} \ 95 | ; {var_e} {comparisson_operator} options 2 (no. of options) 2 (default start option [not implemented!]) 0 (cancel_option / -1 will force to choose one of options) \ 96 | ; {yes_text} {messages_count} {texts_global_var_0} ... {texts_global_var_n} \ 97 | ; {no_text} {messages_count} {texts_global_var_0} ... {texts_global_var_n} 98 | ; --- 99 | ; sprite_start_id description 100 | ; 0 0 hero 101 | ; 1 8 boy 102 | ; 2 16 hero 103 | ; 3 24 girl 104 | ; 4 32 hero 105 | ; 5 40 old_man 106 | ; 6 48 hero 107 | ; 7 56 merchant 108 | ; 8 64 hero_princess 109 | ; 9 72 warrior 110 | ;10 80 princess 111 | ;11 88 dragon_lord 112 | ;12 96 guard 113 | ;13 104 guard_bugle 114 | ;14 106 king 115 | ;15 112 transparent 116 | ; --- 117 | npc npc_shop_equip 56 34 17 \ 118 | STATIC down \ 119 | @@empty 120 | 121 | npc npc_inn 56 27 28 \ 122 | STATIC right \ 123 | @@empty 124 | 125 | npc shop_keys_1_b 40 63 15 \ 126 | STATIC up \ 127 | @@empty 128 | 129 | 130 | ;@@rimuldar_old_man_1_a = Over the western part of this island Erdrick created a rainbow. 131 | ;@@rimuldar_old_man_1_b = 'Tis also said that he entered the darkness from a hidden entrance in the room of the Dragonlord. 132 | ;@@rimuldar_old_man_2 = This is a magic place. | Hast thou found a magic temple? 133 | ;@@rimuldar_old_man_2_yes = In this temple do the sun and rain meet. 134 | ;@@rimuldar_old_man_2_no = Go to the south. 135 | ;@@rimuldar_old_man_3 = Good day,I am Howard. Four steps south of the bath in Kol thou shalt find a magic item. 136 | 137 | npc old_man_1 40 17 23 \ 138 | STATIC left \ 139 | conditional_msgs \ 140 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 141 | ; ##game_state_princess_rescued == 1 1 @@kol_old_man \ 142 | 1 == 1 2 @@rimuldar_old_man_1_a @@rimuldar_old_man_1_b 143 | 144 | npc old_man_2_a 40 87 14 \ 145 | STATIC right \ 146 | @@empty 147 | 148 | npc old_man_2_b 112 88 14 \ 149 | RANDOM 68 14 3 5 \ 150 | conditional_msgs \ 151 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 152 | ; ##game_state_princess_rescued == 1 1 @@empty \ 153 | 1 == 1 1 @@rimuldar_old_man_2 options 2 0 1 \ 154 | @@option_yes 1 @@rimuldar_old_man_2_yes \ 155 | @@option_no 1 @@rimuldar_old_man_2_no 156 | 157 | npc old_man_3 40 31 33 \ 158 | STATIC down \ 159 | conditional_msgs \ 160 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 161 | ; ##game_state_princess_rescued == 1 1 @@kol_old_man \ 162 | 1 == 1 1 @@rimuldar_old_man_3 163 | 164 | 165 | ;@@rimuldar_boy_1 = Welcome to the town of Rimuldar. 166 | ;@@rimuldar_boy_2 = Art thou the descendant of Erdrick? | Hast thou any proof? 167 | ;@@rimuldar_boy_3 = Heed my warning! Travel not to the south for there the monsters are fierce and terrible. 168 | ;@@rimuldar_boy_4 = I am Orwick, and I am waiting for my girl friend. 169 | 170 | npc boy_1 8 24 22 \ 171 | RANDOM 17 17 16 12 \ 172 | conditional_msgs \ 173 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 174 | ; ##game_state_princess_rescued == 1 1 @@empty \ 175 | 1 == 1 1 @@rimuldar_boy_1 176 | 177 | npc boy_2 8 22 18 \ 178 | RANDOM 21 17 3 2 \ 179 | conditional_msgs \ 180 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 181 | ; ##game_state_princess_rescued == 1 1 @@empty \ 182 | 1 == 1 1 @@rimuldar_boy_2 183 | 184 | npc boy_3 8 93 15 \ 185 | RANDOM 87 13 9 5 \ 186 | conditional_msgs \ 187 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 188 | ; ##game_state_princess_rescued == 1 1 @@empty \ 189 | 1 == 1 1 @@rimuldar_boy_3 190 | 191 | npc boy_4 8 38 10 \ 192 | STATIC down \ 193 | conditional_msgs \ 194 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 195 | ; ##game_state_princess_rescued == 1 1 @@empty \ 196 | 1 == 1 1 @@rimuldar_boy_4 197 | 198 | 199 | ;@@rimuldar_guard_1 = Thou shalt find the Stones of Sunlight in Tantegel Castle, if thou has not found them yet. 200 | 201 | npc guard_1 96 19 25 \ 202 | RANDOM 12 17 14 12 \ 203 | conditional_msgs \ 204 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 205 | ; ##game_state_princess_rescued == 1 1 @@empty \ 206 | 1 == 1 1 @@rimuldar_guard_1 207 | 208 | 209 | ;@@rimuldar_girl_1 = No, I have no tomatoes. | I have no tomatoes today. 210 | ;@@rimuldar_girl_2 = Who art thou? | Leave at once or I will call my friends. 211 | ;@@rimuldar_girl_3 = Before long the enemy will arrive. 212 | ;@@rimuldar_girl_4 = Orwick is late again. I'm starving. 213 | 214 | npc girl_1 24 33 24 \ 215 | RANDOM 23 17 16 16 \ 216 | conditional_msgs \ 217 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 218 | ; ##game_state_princess_rescued == 1 1 @@empty \ 219 | 1 == 1 1 @@rimuldar_girl_1 220 | 221 | npc girl_2 24 26 18 \ 222 | STATIC up \ 223 | conditional_msgs \ 224 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 225 | ; ##game_state_princess_rescued == 1 1 @@empty \ 226 | 1 == 1 1 @@rimuldar_girl_2 227 | 228 | npc girl_3 24 92 12 \ 229 | RANDOM 89 12 7 6 \ 230 | conditional_msgs \ 231 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 232 | ; ##game_state_princess_rescued == 1 1 @@empty \ 233 | 1 == 1 1 @@rimuldar_girl_3 234 | 235 | npc girl_4 24 11 36 \ 236 | STATIC down \ 237 | conditional_msgs \ 238 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 239 | ; ##game_state_princess_rescued == 1 1 @@empty \ 240 | 1 == 1 1 @@rimuldar_girl_4 241 | 242 | 243 | ;@@rimuldar_warrior_1 = You are $$player_name ? | It has been long since last we met. 244 | ;@@rimuldar_warrior_2 = The scales of the Dragonlord are as hard as steel. 245 | ;@@rimuldar_warrior_3_a = All true warriors wear a ring. 246 | ;@@rimuldar_warrior_3_b = Is that a wedding ring? | Thou seems too young to be married. 247 | ;@@rimuldar_warrior_4 = In this world is there any sword that can pierce the scales of the Dragonlord? 248 | 249 | npc warrior_1 72 35 29 \ 250 | RANDOM 34 28 2 3 \ 251 | conditional_msgs \ 252 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 253 | ; ##game_state_princess_rescued == 1 1 @@empty \ 254 | 1 == 1 1 @@rimuldar_warrior_1 255 | 256 | npc warrior_2 72 34 21 \ 257 | RANDOM 33 19 3 3 \ 258 | conditional_msgs \ 259 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 260 | ; ##game_state_princess_rescued == 1 1 @@empty \ 261 | 1 == 1 1 @@rimuldar_warrior_2 262 | 263 | npc warrior_3 72 26 36 \ 264 | RANDOM 24 29 10 9 \ 265 | conditional_msgs \ 266 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 267 | ; ##game_state_princess_rescued == 1 1 @@empty \ 268 | ##player_put_fighters_ring == 1 1 @@rimuldar_warrior_3_b \ 269 | 1 == 1 1 @@rimuldar_warrior_3_a 270 | 271 | npc warrior_4 72 89 16 \ 272 | RANDOM 87 11 7 7 \ 273 | conditional_msgs \ 274 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 275 | ; ##game_state_princess_rescued == 1 1 @@empty \ 276 | 1 == 1 1 @@rimuldar_warrior_4 277 | 278 | 279 | ;@@rimuldar_merchant_1 = Welcome! 280 | 281 | npc merchant_1 56 13 14 \ 282 | STATIC up \ 283 | conditional_msgs \ 284 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 285 | ; ##game_state_princess_rescued == 1 1 @@empty \ 286 | 1 == 1 1 @@rimuldar_merchant_1 287 | -------------------------------------------------------------------------------- /assets/res/event/brecconary.evt: -------------------------------------------------------------------------------- 1 | ; --- brecconary --- 2 | ; ------------------ 3 | 4 | ; save_point {event_id} {pos_col} {pos_row} 5 | ; --- 6 | save_point save_point_1 17 35 7 | 8 | 9 | ; door {event_name} {sprite_id} {pos_col} {pos_row} {persistent} 10 | ;--- 11 | door door_1 22 15 33 false 12 | door door_2 22 31 16 false 13 | 14 | 15 | ; teleport {event_id} {sprite_id} {pos_col} {pos_row} \ 16 | ; {map_id} {player_col} {player_row} {player_direction} \ 17 | ; {sound_id|no_sound|default_sound} {use_fade_effect->true|false] 18 | ; {musicId} {isDark->true|false} {repelHasNoEffect->true|false} 19 | ; {resetRepel->true|false] {resetLight->true|false] 20 | ;--- 21 | teleport teleport_1 31 32 34 \ 22 | brecconary 61 11 down \ 23 | no_sound false \ 24 | town false true \ 25 | false true 26 | 27 | teleport teleport_2 31 31 15 \ 28 | brecconary 87 13 up \ 29 | no_sound false \ 30 | town false true \ 31 | false true 32 | 33 | teleport teleport_3 36 61 10 \ 34 | brecconary 32 33 up \ 35 | no_sound false \ 36 | town false true \ 37 | false true 38 | 39 | teleport teleport_4 36 87 14 \ 40 | brecconary 31 16 down \ 41 | no_sound false \ 42 | town false true \ 43 | false true 44 | 45 | 46 | ; inn {event_name} {pos_col} {pos_row} {inn_price} 47 | ; --- 48 | inn inn_1 19 31 6 49 | 50 | 51 | shop_item shop_item_1 63 12 \ 52 | ; herb (id = 41) 53 | 41 default_price default_price \ 54 | ; torch (id = 43) 55 | 43 default_price default_price \ 56 | ; dragon's scale (id = 44) 57 | 44 default_price default_price 58 | 59 | 60 | shop_equip shop_equip_1 15 15 \ 61 | ; bamboo pole (id = 10) 62 | 10 default_price default_price \ 63 | ; club (id = 12) 64 | 12 default_price default_price \ 65 | ; copper sword (id = 13) 66 | 13 default_price default_price \ 67 | ; clothes (id = 21) 68 | 21 default_price default_price \ 69 | ; leather armor (id = 25) 70 | 25 default_price default_price \ 71 | ; small shield (id = 32) 72 | 32 default_price default_price 73 | 74 | 75 | ; shop_fairy_water {event_name} {pos_col} {pos_row} {fairy_water_price} 76 | ; --- 77 | shop_fairy_water shop_fairy_water_1 89 12 38 78 | 79 | 80 | ; npc {event_id} {sprite_start_id} {pos_col} {pos_row} \ 81 | ; STATIC {sprite_direction} | RANDOM {rect_col} {rect_row} {rect_width} {rect_height} \ 82 | ; {texts_global_var_0} ... {texts_global_var_n} | conditional_msgs \ 83 | ; {var_a} {comparisson_operator} {var_b} {messages_count} {texts_global_var_0} ... {texts_global_var_n} \ 84 | ; {var_c} {comparisson_operator} {var_d} {messages_count} {texts_global_var_0} ... {texts_global_var_n} \ 85 | ; {var_e} {comparisson_operator} options 2 (no. of options) 2 (default start option [not implemented!]) 0 (cancel_option / -1 will force to choose one of options) \ 86 | ; {yes_text} {messages_count} {texts_global_var_0} ... {texts_global_var_n} \ 87 | ; {no_text} {messages_count} {texts_global_var_0} ... {texts_global_var_n} 88 | ; --- 89 | ; sprite_start_id description 90 | ; 0 0 hero 91 | ; 1 8 boy 92 | ; 2 16 hero 93 | ; 3 24 girl 94 | ; 4 32 hero 95 | ; 5 40 old_man 96 | ; 6 48 hero 97 | ; 7 56 merchant 98 | ; 8 64 hero_princess 99 | ; 9 72 warrior 100 | ;10 80 princess 101 | ;11 88 dragon_lord 102 | ;12 96 guard 103 | ;13 104 guard_bugle 104 | ;14 106 king 105 | ; --- 106 | npc npc_shop_item 56 64 12 \ 107 | STATIC left \ 108 | @@empty 109 | 110 | npc npc_shop_equip 56 15 14 \ 111 | STATIC down \ 112 | @@empty 113 | 114 | npc npc_inn 56 20 31 \ 115 | STATIC left \ 116 | @@empty 117 | 118 | npc npc_shop_fairy_water 24 90 12 \ 119 | STATIC left \ 120 | @@empty 121 | 122 | 123 | ;@@brecconary_boy_1 = Thou art most welcome in Brecconary. 124 | ;@@brecconary_boy_2 = Go north to the seashore, then follow the coastline west until thou hath reached Garinham. 125 | ;@@brecconary_boy_3 = There is a town where magic keys can be purchased. 126 | ;@@brecconary_boy_4 = Enter where thou can. 127 | ;@@brecconary_boy_5_a = Within sight of Tantegel Castle to the south is Charlock, 128 | ;@@brecconary_boy_5_b = The fortress of the Dragonlord. 129 | 130 | npc boy_1 8 11 23 \ 131 | STATIC down \ 132 | conditional_msgs \ 133 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 134 | ; ##game_state_princess_rescued == 1 1 @@empty \ 135 | 1 == 1 1 @@brecconary_boy_1 136 | 137 | npc boy_2 8 26 13 \ 138 | RANDOM 16 11 14 16 \ 139 | conditional_msgs \ 140 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 141 | ; ##game_state_princess_rescued == 1 1 @@empty \ 142 | 1 == 1 1 @@brecconary_boy_2 143 | 144 | npc boy_3 8 30 20 \ 145 | STATIC down \ 146 | conditional_msgs \ 147 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 148 | ; ##game_state_princess_rescued == 1 1 @@empty \ 149 | 1 == 1 1 @@brecconary_boy_3 150 | 151 | npc boy_4 8 30 33 \ 152 | STATIC up \ 153 | conditional_msgs \ 154 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 155 | ; ##game_state_princess_rescued == 1 1 @@empty \ 156 | 1 == 1 1 @@brecconary_boy_4 157 | 158 | npc boy_5 8 38 36 \ 159 | RANDOM 33 30 6 9 \ 160 | conditional_msgs \ 161 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 162 | ; ##game_state_princess_rescued == 1 1 @@empty \ 163 | 1 == 1 2 @@brecconary_boy_5_a @@brecconary_boy_5_b 164 | 165 | 166 | ;@@brecconary_girl_1 = Welcome! | Enter the shop and speak to its keeper across the desk. 167 | ;@@brecconary_girl_2 = No,I am not Princess Gwaelin. 168 | 169 | npc girl_1 24 14 17 \ 170 | STATIC down \ 171 | conditional_msgs \ 172 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 173 | ; ##game_state_princess_rescued == 1 1 @@empty \ 174 | 1 == 1 1 @@brecconary_girl_1 175 | 176 | npc girl_2 24 22 26 \ 177 | RANDOM 15 18 15 10 \ 178 | conditional_msgs \ 179 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 180 | ; ##game_state_princess_rescued == 1 1 @@empty \ 181 | 1 == 1 1 @@brecconary_girl_2 182 | 183 | 184 | ;@@brecconary_old_man_1 = Watch thy Hit Points when in the Poisonous Marsh. 185 | ;@@brecconary_old_man_2_a = If thou art cursed, come again. 186 | ;@@brecconary_old_man_2_b = I will free thee from thy curse. 187 | ;@@brecconary_old_man_2_c = Now, go. 188 | 189 | npc old_man_1 40 33 18 \ 190 | RANDOM 22 13 16 16 \ 191 | conditional_msgs \ 192 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 193 | ; ##game_state_princess_rescued == 1 1 @@kol_old_man \ 194 | 1 == 1 1 @@brecconary_old_man_1 195 | 196 | ; reference: https://www.youtube.com/watch?v=MN8FJvfadFM 197 | ; old man 2 - free player from curse 198 | ; --- 199 | event old_man_2 200 | animation chars 16 8 100 201 | create_animation left 42 43 202 | create_animation up 44 45 203 | create_animation right 46 47 204 | create_animation down 40 41 205 | location 34 20 206 | movement STATIC 207 | visible true 208 | blocked true 209 | fire_required true 210 | script 211 | on_event_trigger: 212 | is_player_cursed "##player_is_cursed" 213 | if ##player_is_cursed "==" 1 "player_cursed" 214 | player_not_cursed: 215 | show_dialog 1 1 @@brecconary_old_man_2_a 216 | goto "exit" 217 | player_cursed: 218 | remove_player_all_curses 219 | show_dialog 1 2 @@brecconary_old_man_2_b 220 | show_dialog 1 1 @@brecconary_old_man_2_c 221 | goto "exit" 222 | exit: 223 | close_dialog 224 | ret 225 | script_end 226 | event_end 227 | 228 | 229 | ;@@brecconary_guard_1_a = Tell King Lorik that the search for his daughter hath failed. 230 | ;@@brecconary_guard_1_b = I am almost gone.... 231 | ;@@brecconary_guard_1_c = Who touches me? | I see nothing, nor can I hear. 232 | ;@@brecconary_guard_2 = See King Lorik when thy experience levels are raised. 233 | 234 | npc guard_1 96 20 36 \ 235 | STATIC up \ 236 | conditional_msgs \ 237 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 238 | ##game_state_princess_rescued > 0 1 @@brecconary_guard_1_c \ 239 | 1 == 1 2 @@brecconary_guard_1_a @@brecconary_guard_1_b 240 | 241 | npc guard_2 96 38 23 \ 242 | RANDOM 35 17 5 11 \ 243 | conditional_msgs \ 244 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 245 | ; ##game_state_princess_rescued == 1 1 @@empty \ 246 | 1 == 1 1 @@brecconary_guard_2 247 | 248 | 249 | ;@@brecconary_warrior_1_a = Many have been the warriors who have perished on this quest. 250 | ;@@brecconary_warrior_1_b = But for thee I wish success, $$player_name . 251 | ;@@brecconary_warrior_2_a = Beware the bridges! 252 | ;@@brecconary_warrior_2_b = Danger grows when thou crosses. 253 | ;@@brecconary_warrior_3 = Art thou the descendant of Erdrick? | Hast thou any proof? 254 | ;@@brecconary_warrior_4 = Some say that Garin's grave is home to a Silver Harp. 255 | 256 | npc warrior_1 72 25 32 \ 257 | RANDOM 20 23 16 16 \ 258 | conditional_msgs \ 259 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 260 | ; ##game_state_princess_rescued == 1 1 @@empty \ 261 | 1 == 1 2 @@brecconary_warrior_1_a @@brecconary_warrior_1_b 262 | 263 | npc warrior_2 72 38 11 \ 264 | STATIC down \ 265 | conditional_msgs \ 266 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 267 | ; ##game_state_princess_rescued == 1 1 @@empty \ 268 | 1 == 1 2 @@brecconary_warrior_2_a @@brecconary_warrior_2_b 269 | 270 | npc warrior_3 72 14 29 \ 271 | RANDOM 11 23 16 16 \ 272 | conditional_msgs \ 273 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 274 | ; ##game_state_princess_rescued == 1 1 @@empty \ 275 | 1 == 1 1 @@brecconary_warrior_3 276 | 277 | npc warrior_4 72 13 32 \ 278 | RANDOM 12 30 4 8 \ 279 | conditional_msgs \ 280 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 281 | ; ##game_state_princess_rescued == 1 1 @@empty \ 282 | 1 == 1 1 @@brecconary_warrior_4 283 | 284 | 285 | ;@@brecconary_merchant_1 = Please,save us from the minions of the Dragonlord. 286 | 287 | npc merchant_1 56 12 12 \ 288 | RANDOM 11 11 16 16 \ 289 | conditional_msgs \ 290 | ##game_state_dragon_lord_defeated == 1 1 @@dragon_lord_defeated_1 \ 291 | ; ##game_state_princess_rescued == 1 1 @@empty \ 292 | 1 == 1 1 @@brecconary_merchant_1 293 | 294 | --------------------------------------------------------------------------------