43 |
Switch to LCD mode (Resets game)
44 |
Note to 7DRL reviewers: this is the post 7DRL version, please check here for the 7drl edition
45 |
How to play
46 |
47 |
Your goal is to become a Monster master by defeating the gym leaders of the 8 cities in your region.
48 |
Pick your starter monster (using ,). Then find the exit to route 1 from your hometown.
49 |
When you find wild monster, use "r" to release your selected monster in a given direction. He will automatically fight nearby
50 | enemies with his default skill
51 |
If you want to use a different skill, press the key as indicated on the right bar
52 |
To call back your monster, use "P"
53 |
To use catchballs or potions, go to the "I"nventory and select a direction
54 |
55 |
Keyboard Commands
56 |
57 |
58 | | Arrow keys | Move around. |
59 |
60 |
61 | QWE ASD ZXC |
62 |
63 |
64 | | Numpad |
65 |
66 |
67 | | I | Show Inventory. |
68 |
69 |
70 | | , | Pick up items. |
71 |
72 |
73 | | 1 to 6 | Select monster slot. |
74 |
75 |
76 | | R | Release selected monster. |
77 |
78 |
79 | | P | Pull back selected monster. |
80 |
81 |
82 | | V,B,N,M | Use monster skills. |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/js/ca/Matrix.class.js:
--------------------------------------------------------------------------------
1 | function Matrix(map, w, h){
2 | if (map){
3 | this.values = map;
4 | this.futureValues = map;
5 | } else {
6 | this.values = [];
7 | this.futureValues = [];
8 | }
9 | }
10 |
11 | Matrix.prototype = {
12 | setFuture: function(value, x, y){
13 | this.futureValues[x][y] = value;
14 | },
15 | setPresent: function (value, x, y){
16 | this.values[x][y] = value;
17 | },
18 | get: function(x, y){
19 | return this.values[x][y];
20 | },
21 | getWidth: function(){
22 | return this.values.length;
23 | },
24 | getHeight: function(){
25 | return this.values[0].length;
26 | },
27 | advance: function(){
28 | for (var x = 0; x < this.values.length; x++){
29 | for (var y = 0; y < this.values[0].length; y++){
30 | this.values[x][y] = this.futureValues[x][y];
31 | }
32 | }
33 | },
34 | getSurroundingCount: function(x, y, type){
35 | var upIndex = (y == 0 ? this.getHeight()-1 : y-1);
36 | var downIndex = (y == this.getHeight()-1 ? 0 : y+1);
37 | var rightIndex = (x == this.getWidth()-1 ? 0 : x+1);
38 | var leftIndex = (x == 0 ? this.getWidth()-1 : x-1);
39 | var count =
40 | (this.values[leftIndex][upIndex] == type ? 1 : 0) +
41 | (this.values[leftIndex][y] == type ? 1 : 0) +
42 | (this.values[leftIndex][downIndex] == type ? 1 : 0) +
43 | (this.values[rightIndex][upIndex] == type ? 1 : 0) +
44 | (this.values[rightIndex][y] == type ? 1 : 0) +
45 | (this.values[rightIndex][downIndex] == type ? 1 : 0) +
46 | (this.values[x][downIndex] == type ? 1 : 0) +
47 | (this.values[x][upIndex] == type ? 1 : 0) ;
48 | return count;
49 | },
50 | getSurroundingCountNoWrap: function(x, y, type){
51 | var count =
52 | (y==0||x==0?0:(this.values[x-1][y-1] == type ? 1 : 0)) +
53 | (x==0?0:(this.values[x-1][y] == type ? 1 : 0)) +
54 | (x==0||y==this.getHeight()-1?0:(this.values[x-1][y+1] == type ? 1 : 0)) +
55 | (y==0||x==this.getWidth()-1?0:(this.values[x+1][y-1] == type ? 1 : 0)) +
56 | (x==this.getWidth()-1?0:(this.values[x+1][y] == type ? 1 : 0)) +
57 | (x==this.getWidth()-1||y==this.getHeight()-1?0:(this.values[x+1][y+1] == type ? 1 : 0)) +
58 | (y==this.getHeight()-1?0:(this.values[x][y+1] == type ? 1 : 0)) +
59 | (y==0?0:(this.values[x][y-1] == type ? 1 : 0)) ;
60 | return count;
61 | },
62 | clean: function(){
63 | this.values = [];
64 | this.futureValues = [];
65 | },
66 | getArrays: function(){
67 | return this.values;
68 | },
69 | addHotSpot: function(value, x, y){
70 | if (!x) x = Random.n(5,this.getWidth()-5);
71 | if (!y) y = Random.n(5,this.getHeight()-5);
72 | this.values[x][y] = value;
73 | this.futureValues[x][y] = value;
74 | },
75 | addShoweredHotSpot: function(value, shower, showers, maxDist, x, y){
76 | if (!x) x = Random.n(5,this.getWidth()-5);
77 | if (!y) y = Random.n(5,this.getHeight()-5);
78 | var xs = showers;
79 | for (var i = 0; i < xs; i++){
80 | var xdif = maxDist - Random.n(0,maxDist*2);
81 | var ydif = maxDist - Random.n(0,maxDist*2);
82 | if (this.isValid(x+xdif, y+ydif))
83 | this.futureValues[x+xdif][y+ydif] = shower;
84 | }
85 | this.futureValues[x][y] = value;
86 | },
87 | isValid: function(x, y){
88 | return x>=0 && y >= 0 && x < this.getWidth() && y < this.getHeight();
89 | }
90 | }
91 |
92 | module.exports = Matrix;
--------------------------------------------------------------------------------
/src/js/Level.class.js:
--------------------------------------------------------------------------------
1 | var Distance = require('./Distance');
2 | var Random = require('./Random');
3 | var Being = require('./Being.class');
4 |
5 | var Level = function(game, id){
6 | this.init(game, id);
7 | }
8 |
9 | Level.prototype = {
10 | init: function(game, id){
11 | this.map = [];
12 | this.beings = [];
13 | this.beingsList = [];
14 | this.exits = [];
15 | this.exitsMap = [];
16 | this.items = [];
17 | this.spawnPositions = []; // For respawning
18 | this.spawnCounter = 200;
19 |
20 | this.storePlaces = []; // For restocking
21 |
22 | this.game = game;
23 | this.id = id;
24 | this.player = game.player;
25 | },
26 | getBeing: function(x, y){
27 | if (!this.beings[x])
28 | return false;
29 | return this.beings[x][y];
30 | },
31 | respawnMonsters: function(){
32 | var initialPopulation = this.initialPopulation + Random.n(0,5);
33 | var currentMonsters = this.beingsList.length;
34 | initialPopulation -= currentMonsters;
35 | var level = this;
36 | for (var i = 0; i < initialPopulation; i++){
37 | var spawnPosition = level.spawnPositions.length > 0 ? Random.from(level.spawnPositions) : false;
38 | if (spawnPosition){
39 | var x = spawnPosition.x;
40 | var y = spawnPosition.y;
41 | }
42 | if (!spawnPosition || level.getBeing(x, y)){
43 | // Place somewhere else
44 | x = Random.n(0,this.map.length-1);
45 | y = Random.n(0,this.map[0].length-1);
46 | }
47 | if (Distance.distance(x,y,this.game.player.x, this.game.player.y) < 12){
48 | continue;
49 | }
50 | var wm = Random.fromWeighted(this.wildMonsters);
51 | var being = new Being(level.game, level, wm.race, wm.level);
52 | level.addBeing(being, x, y);
53 | if (wm.race.aggressive){
54 | being.intent = 'CHASE';
55 | } else if (wm.race.trainer){
56 | being.intent = 'TRAINER';
57 | } else {
58 | being.intent = 'STILL';
59 | }
60 | }
61 | },
62 | beingsTurn: function(){
63 | this.spawnCounter--;
64 | if (this.spawnCounter === 0){
65 | this.respawnMonsters();
66 | }
67 | this.beingsList.sort(this.speedSorter);
68 | /*
69 | this.beingsList.map(function(monster, i){
70 | console.log(i+": "+monster.race.name+" "+monster.getEffectiveSpeed());
71 | })
72 | */
73 | for (var i = 0; i < this.beingsList.length; i++){
74 | this.beingsList[i].endTurn();
75 | this.beingsList[i].act();
76 | }
77 | this.player.updateFOV();
78 | this.game.display.refresh();
79 | this.game.input.inputEnabled = true;
80 | },
81 | speedSorter: function(a, b){
82 | return b.getEffectiveSpeed() - a.getEffectiveSpeed();
83 | },
84 | addBeing: function(being, x, y){
85 | this.beingsList.push(being);
86 | if (!this.beings[x])
87 | this.beings[x] = [];
88 | being.x = x;
89 | being.y = y;
90 | this.beings[x][y] = being;
91 | },
92 | removeBeing: function(being){
93 | this.beings[being.x][being.y] = false;
94 | this.beingsList.splice(this.beingsList.indexOf(being), 1);
95 | },
96 | getCell: function(x, y){
97 | try {
98 | return this.map[x][y];
99 | } catch (e){
100 | // Catch OOB
101 | return false;
102 | }
103 | },
104 | canWalkTo: function(x, y){
105 | try {
106 | if (this.map[x][y].solid){
107 | return false;
108 | }
109 | } catch (e){
110 | // Catch OOB
111 | return false;
112 | }
113 | if (this.beings[x] && this.beings[x][y]){
114 | return false;
115 | }
116 | return true;
117 | },
118 | addExit: function(x,y, levelId, tile){
119 | if (!this.exits[x])
120 | this.exits[x] = [];
121 | this.exits[x][y] = levelId;
122 | this.exitsMap[levelId] = {
123 | x: x,
124 | y: y
125 | };
126 | },
127 | getExit: function(levelId){
128 | return this.exitsMap[levelId];
129 | },
130 | addItem: function(item, x, y){
131 | if (!this.items[x])
132 | this.items[x] = [];
133 | this.items[x][y] = item;
134 | },
135 | getItem: function(x, y){
136 | if (!this.items[x])
137 | return false;
138 | return this.items[x][y];
139 | },
140 | removeItem: function(x, y){
141 | if (!this.items[x])
142 | this.items[x] = [];
143 | this.items[x][y] = false;
144 | },
145 | }
146 |
147 | module.exports = Level;
--------------------------------------------------------------------------------
/static-lib/unicodetiles/input.js:
--------------------------------------------------------------------------------
1 | /// File: input.js
2 | /// This file contains a very simple input system.
3 |
4 | /*jshint browser:true */
5 |
6 | /// Namespace: ut
7 | /// Container namespace.
8 | var ut = ut || {};
9 |
10 | /// Constants: Keycodes
11 | /// KEY_BACKSPACE - 8
12 | /// KEY_TAB - 9
13 | /// KEY_ENTER - 13
14 | /// KEY_SHIFT - 16
15 | /// KEY_CTRL - 17
16 | /// KEY_ALT - 18
17 | /// KEY_ESCAPE - 27
18 | /// KEY_SPACE - 32
19 | /// KEY_LEFT - 37
20 | /// KEY_UP - 38
21 | /// KEY_RIGHT - 39
22 | /// KEY_DOWN - 40
23 | /// KEY_0 - 48
24 | /// KEY_1 - 49
25 | /// KEY_2 - 50
26 | /// KEY_3 - 51
27 | /// KEY_4 - 52
28 | /// KEY_5 - 53
29 | /// KEY_6 - 54
30 | /// KEY_7 - 55
31 | /// KEY_8 - 56
32 | /// KEY_9 - 57
33 | /// KEY_A - 65
34 | /// KEY_B - 66
35 | /// KEY_C - 67
36 | /// KEY_D - 68
37 | /// KEY_E - 69
38 | /// KEY_F - 70
39 | /// KEY_G - 71
40 | /// KEY_H - 72
41 | /// KEY_I - 73
42 | /// KEY_J - 74
43 | /// KEY_K - 75
44 | /// KEY_L - 76
45 | /// KEY_M - 77
46 | /// KEY_N - 78
47 | /// KEY_O - 79
48 | /// KEY_P - 80
49 | /// KEY_Q - 81
50 | /// KEY_R - 82
51 | /// KEY_S - 83
52 | /// KEY_T - 84
53 | /// KEY_U - 85
54 | /// KEY_V - 86
55 | /// KEY_W - 87
56 | /// KEY_X - 88
57 | /// KEY_Y - 89
58 | /// KEY_Z - 90
59 | /// KEY_NUMPAD0 - 96
60 | /// KEY_NUMPAD1 - 97
61 | /// KEY_NUMPAD2 - 98
62 | /// KEY_NUMPAD3 - 99
63 | /// KEY_NUMPAD4 - 100
64 | /// KEY_NUMPAD5 - 101
65 | /// KEY_NUMPAD6 - 102
66 | /// KEY_NUMPAD7 - 103
67 | /// KEY_NUMPAD8 - 104
68 | /// KEY_NUMPAD9 - 105
69 | /// KEY_F1 - 112
70 | /// KEY_F2 - 113
71 | /// KEY_F3 - 114
72 | /// KEY_F4 - 115
73 | /// KEY_F5 - 116
74 | /// KEY_F6 - 117
75 | /// KEY_F7 - 118
76 | /// KEY_F8 - 119
77 | /// KEY_F9 - 120
78 | /// KEY_F10 - 121
79 | /// KEY_F11 - 122
80 | /// KEY_F12 - 123
81 | /// KEY_COMMA - 188
82 | /// KEY_DASH - 189
83 | /// KEY_PERIOD - 190
84 |
85 | ut.KEY_BACKSPACE = 8;
86 | ut.KEY_TAB = 9;
87 | ut.KEY_ENTER = 13;
88 | ut.KEY_SHIFT = 16;
89 | ut.KEY_CTRL = 17;
90 | ut.KEY_ALT = 18;
91 | ut.KEY_ESCAPE = 27;
92 | ut.KEY_SPACE = 32;
93 | ut.KEY_LEFT = 37;
94 | ut.KEY_UP = 38;
95 | ut.KEY_RIGHT = 39;
96 | ut.KEY_DOWN = 40;
97 |
98 | ut.KEY_0 = 48;
99 | ut.KEY_1 = 49;
100 | ut.KEY_2 = 50;
101 | ut.KEY_3 = 51;
102 | ut.KEY_4 = 52;
103 | ut.KEY_5 = 53;
104 | ut.KEY_6 = 54;
105 | ut.KEY_7 = 55;
106 | ut.KEY_8 = 56;
107 | ut.KEY_9 = 57;
108 | ut.KEY_A = 65;
109 | ut.KEY_B = 66;
110 | ut.KEY_C = 67;
111 | ut.KEY_D = 68;
112 | ut.KEY_E = 69;
113 | ut.KEY_F = 70;
114 | ut.KEY_G = 71;
115 | ut.KEY_H = 72;
116 | ut.KEY_I = 73;
117 | ut.KEY_J = 74;
118 | ut.KEY_K = 75;
119 | ut.KEY_L = 76;
120 | ut.KEY_M = 77;
121 | ut.KEY_N = 78;
122 | ut.KEY_O = 79;
123 | ut.KEY_P = 80;
124 | ut.KEY_Q = 81;
125 | ut.KEY_R = 82;
126 | ut.KEY_S = 83;
127 | ut.KEY_T = 84;
128 | ut.KEY_U = 85;
129 | ut.KEY_V = 86;
130 | ut.KEY_W = 87;
131 | ut.KEY_X = 88;
132 | ut.KEY_Y = 89;
133 | ut.KEY_Z = 90;
134 | ut.KEY_NUMPAD0 = 96;
135 | ut.KEY_NUMPAD1 = 97;
136 | ut.KEY_NUMPAD2 = 98;
137 | ut.KEY_NUMPAD3 = 99;
138 | ut.KEY_NUMPAD4 = 100;
139 | ut.KEY_NUMPAD5 = 101;
140 | ut.KEY_NUMPAD6 = 102;
141 | ut.KEY_NUMPAD7 = 103;
142 | ut.KEY_NUMPAD8 = 104;
143 | ut.KEY_NUMPAD9 = 105;
144 | ut.KEY_F1 = 112;
145 | ut.KEY_F2 = 113;
146 | ut.KEY_F3 = 114;
147 | ut.KEY_F4 = 115;
148 | ut.KEY_F5 = 116;
149 | ut.KEY_F6 = 117;
150 | ut.KEY_F7 = 118;
151 | ut.KEY_F8 = 119;
152 | ut.KEY_F9 = 120;
153 | ut.KEY_F10 = 121;
154 | ut.KEY_F11 = 122;
155 | ut.KEY_F12 = 123;
156 |
157 | ut.KEY_COMMA = 188;
158 | ut.KEY_DASH = 189;
159 | ut.KEY_PERIOD = 190;
160 |
161 |
162 | ut.pressedKeys = {};
163 | ut.keyRepeatDelay = 150;
164 |
165 | /// Function: isKeyPressed
166 | /// Checks if given key is pressed down. You must call