empi 0.19 → 0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d95cf3fd4165a2f088ce364e4a5e1a1511ee395a2f0f9a697528a8860d1b69d
4
- data.tar.gz: b1e56a884ed3f3db2909379e73ddd9d5079ecab4c7e80e92524d543e0ef0800b
3
+ metadata.gz: f44b7fcbf8da0bfeb456b1aa7515b343466669b84ce1bbb758da28c08c18bd47
4
+ data.tar.gz: 0d9da419f8352641e1a42829c38302b2306481a5c7015b7ed656c020980999e8
5
5
  SHA512:
6
- metadata.gz: bfb3d1398928e814bba042ac3017fb051df0073cead2fa24119f7c53406d3767a20c39e44de8631b3c17ebd53e0a9b7ea5ec7c9382a974b30fa2e27b16720755
7
- data.tar.gz: e4a85873b8bd9127b051ea262aadca0c251e3cfabbbea3a09bc211f067b8590fefb241b1236e6ab59855223fef4f44a8c7dfc094cb105b70c845ccc8d23de42f
6
+ metadata.gz: 905bf655272b2cb5b38fcd615b895a599b05376524cd5f904ee95fc4607f7d4a5f1edb4403bdade52dfb57bd8223a632f712de31b19cca38f0c06325edde65fa
7
+ data.tar.gz: 4674d0c6c7ba49ec9fb559ccf8ff808ced32beb91863cdca1d0bbf26de9766d6257c150e3a69c0a3bf1d28fc9c84e803d6dd120b3d64b7a08fa3e4ddd175e61d
data/lib/cursor.rb CHANGED
@@ -18,23 +18,23 @@ class Cursor
18
18
  def update(key)
19
19
  case key
20
20
  # Cardinal directions
21
- when Gosu::KbLeft, Gosu::KbA then
21
+ when Gosu::KbLeft, Gosu::KbA, Gosu::KB_NUMPAD_4 then
22
22
  move!(-1, 0) unless @x <= 0
23
- when Gosu::KbRight, Gosu::KbD then
23
+ when Gosu::KbRight, Gosu::KbD, Gosu::KB_NUMPAD_6 then
24
24
  move!(1, 0) unless @x >= MAPX
25
- when Gosu::KbUp, Gosu::KbW then
25
+ when Gosu::KbUp, Gosu::KbW, Gosu::KB_NUMPAD_8 then
26
26
  move!(0, -1) unless @y <= 0
27
- when Gosu::KbDown, Gosu::KbX then
27
+ when Gosu::KbDown, Gosu::KbX, Gosu::KB_NUMPAD_2 then
28
28
  move!(0, 1) unless @y >= MAPY
29
29
 
30
30
  # Intercardinal directions
31
- when Gosu::KbQ then
31
+ when Gosu::KbQ, Gosu::KB_NUMPAD_7 then
32
32
  move!(-1, -1) unless @x <= 0 || @y <= 0
33
- when Gosu::KbE then
33
+ when Gosu::KbE, Gosu::KB_NUMPAD_9 then
34
34
  move!(1, -1) unless @x >= MAPX || @y <= 0
35
- when Gosu::KbZ then
35
+ when Gosu::KbZ, Gosu::KB_NUMPAD_1 then
36
36
  move!(-1, 1) unless @x <= 0 || @y >= MAPY
37
- when Gosu::KbC then
37
+ when Gosu::KbC, Gosu::KB_NUMPAD_3 then
38
38
  move!(1, 1) unless @x >= MAPX || @y >= MAPY
39
39
 
40
40
  # Functions
@@ -45,7 +45,7 @@ class Cursor
45
45
  when Gosu::KbN then
46
46
  set_function_to_unit(FUNCNONE)
47
47
 
48
- when Gosu::KbReturn then
48
+ when Gosu::KbReturn, Gosu::KB_NUMPAD_5 then
49
49
  info
50
50
  end
51
51
 
data/lib/empi.rb CHANGED
@@ -5,8 +5,8 @@ require_relative './army'
5
5
  require_relative './cursor'
6
6
  require_relative './infopane'
7
7
  require_relative './map'
8
- require_relative './tile'
9
8
  require_relative './ship'
9
+ require_relative './tile'
10
10
  require_relative './town'
11
11
 
12
12
  TILESIZE = 50
@@ -36,7 +36,7 @@ class GameWindow < Gosu::Window
36
36
  height = (MAPY + 2) * TILESIZE, \
37
37
  fullscreen = false)
38
38
  super
39
- self.caption = 'Empi: Ruby Edition 0.19 dev'
39
+ self.caption = 'Empi: Ruby Edition 0.20 dev'
40
40
 
41
41
  @infopane = Infopane.new
42
42
  @map = Map.new(@infopane)
@@ -52,7 +52,7 @@ class GameWindow < Gosu::Window
52
52
  # Process given button to cursor
53
53
  def update
54
54
  case(@button)
55
- when -1 then # no keys pressed
55
+ when -1, nil then # no keys pressed (yet)
56
56
  return
57
57
  when Gosu::KbEscape then
58
58
  close
@@ -60,7 +60,7 @@ class GameWindow < Gosu::Window
60
60
  new_turn
61
61
  when Gosu::KbH then
62
62
  help
63
- when Gosu::KbJ then
63
+ when Gosu::KbJ, Gosu::KB_NUMPAD_0 then
64
64
  @cursor.switch_freeroam!
65
65
  else
66
66
  @cursor.update(@button)
data/lib/infopane.rb CHANGED
@@ -1,3 +1,5 @@
1
+ LINE_HEIGHT = 20
2
+
1
3
  # Score, turn and event texts
2
4
  class Infopane
3
5
  attr_writer :text, :act_fact
@@ -14,10 +16,10 @@ class Infopane
14
16
 
15
17
  def draw
16
18
  turnscore = Gosu::Image.from_text(
17
- self, "Turn: #{@turn}, Score: #{@score[0]} - #{@score[1]}", Gosu.default_font_name, 20)
19
+ "Turn: #{@turn}, Score: #{@score[0]} - #{@score[1]}", LINE_HEIGHT)
18
20
  turnscore.draw(XTEXT, YTEXT, ZTEXT)
19
21
 
20
- text = Gosu::Image.from_text(self, "#{@text}", Gosu.default_font_name, 20)
22
+ text = Gosu::Image.from_text("#{@text}", LINE_HEIGHT)
21
23
  text.draw(XTEXT, (TILESIZE / 2) + YTEXT, ZTEXT)
22
24
  end
23
25
 
File without changes
data/lib/tile.rb CHANGED
@@ -15,14 +15,14 @@ class Tile
15
15
  @infopane = infopane
16
16
 
17
17
  case(loaded_symbol)
18
- when SYMBOL_SEA then
19
- @terrain = TILE_SEA
20
- @image = Gosu::Image.new(dir_path + '/media/sea.png')
21
- when SYMBOL_GROUND then
22
- @terrain = TILE_GROUND
23
- @image = Gosu::Image.new(dir_path + '/media/ground.png')
24
- else
25
- abort("tile.initialize(): Unknown terrain symbol (#{loaded_symbol})")
18
+ when SYMBOL_SEA then
19
+ @terrain = TILE_SEA
20
+ @image = Gosu::Image.new(dir_path + '/media/sea.png')
21
+ when SYMBOL_GROUND then
22
+ @terrain = TILE_GROUND
23
+ @image = Gosu::Image.new(dir_path + '/media/ground.png')
24
+ else
25
+ abort("tile.initialize(): Unknown terrain symbol (#{loaded_symbol})")
26
26
  end
27
27
  end
28
28
 
data/lib/town.rb CHANGED
@@ -14,9 +14,9 @@ class Town < Unit
14
14
  @moves_max = 0
15
15
  @cargo_max = 10
16
16
 
17
+ @project = nil
17
18
  @parts_built = 0
18
19
  @parts_needed = 0
19
- @project = nil
20
20
 
21
21
  set_function!(FUNCBUILD)
22
22
  end
@@ -48,7 +48,7 @@ class Town < Unit
48
48
  def set_function!(func)
49
49
  super
50
50
 
51
- if @faction != 0 and func == FUNCBUILD # neutral towns dom't need projects either
51
+ if @faction != 0 and func == FUNCBUILD # neutral towns don't need projects either
52
52
  set_project!
53
53
  end
54
54
  end
data/lib/unit.rb CHANGED
@@ -122,7 +122,7 @@ class Unit
122
122
  uu.y = @y
123
123
  }
124
124
 
125
- else # if you are going to be transported
125
+ else # if you are going to be transported
126
126
  newcoords_unit.cargo.insert(-1, self) # -1 = to the end
127
127
  puts PROMPT + to_s + ' got loaded into '+ newcoords_unit.to_s
128
128
  @moves_left = 1 unless newcoords_unit.can_build? # use all your left moves unless you are getting loaded into a town
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: empi
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.19'
4
+ version: '0.20'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Detros
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-04 00:00:00.000000000 Z
11
+ date: 2020-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -48,11 +48,10 @@ extra_rdoc_files: []
48
48
  files:
49
49
  - lib/army.rb
50
50
  - lib/cursor.rb
51
- - lib/docu/Empi v18.png
52
- - lib/docu/info.txt
53
51
  - lib/empi.rb
54
52
  - lib/infopane.rb
55
53
  - lib/map.rb
54
+ - lib/media/Empi v18.png
56
55
  - lib/media/army.png
57
56
  - lib/media/cursor.png
58
57
  - lib/media/ground.png
@@ -71,7 +70,12 @@ files:
71
70
  homepage: http://www.bay12forums.com/smf/index.php?topic=157538
72
71
  licenses:
73
72
  - CC-BY-SA-3.0
74
- metadata: {}
73
+ metadata:
74
+ source_code_uri: https://gitlab.com/rasunadon/empi
75
+ bug_tracker_uri: https://gitlab.com/rasunadon/empi/issues
76
+ documentation_uri: https://gitlab.com/rasunadon/empi/blob/master/README.md
77
+ changelog_uri: https://gitlab.com/rasunadon/empi/blob/master/CHANGELOG.md
78
+ homepage_uri: http://www.bay12forums.com/smf/index.php?topic=157538
75
79
  post_install_message:
76
80
  rdoc_options: []
77
81
  require_paths:
data/lib/docu/info.txt DELETED
@@ -1,372 +0,0 @@
1
- /-- /// /-/ -/-
2
- /-- ||| /-/ |
3
- /-- ||| | -/-
4
-
5
- Empi: Ruby Edition
6
- ====================
7
- CC-BY-SA 3.0, Detros
8
- http://www.bay12forums.com/smf/index.php?topic=157538
9
- https://rubygems.org/gems/empi
10
- rasunadon@seznam.cz
11
-
12
-
13
- v19 dev
14
- =========
15
- - units which can't build will not only protest against such function but also not set it
16
- fixed: units which can't build can still have function set to build
17
- - added link to the gem page to the header of this Info file
18
- - defenders of capturable units need to be dealt with before it can be captured
19
- fixed: capturing town with units leaves those enemy units inside
20
- - destroyed transporters first destroy their cargo
21
- fixed: destroyed transport ships don't give points for their lost cargo
22
- - apparently fixed in v0.18 with storing of last unit in cursor
23
- fixed: transported units show in infopane info of their transport instead when selected
24
- - cargo part of info shown even for empty transporters
25
- - UnitFunction stores its unit
26
- fixed: transported units don't function properly, their transports secretly function instead of them
27
- - preliminary work done on setting build projects
28
- - towns say what their project and its progress are
29
- - parts are first build and then checked so building process takes one less turn now
30
- - captured towns have their build process reset
31
- - reworded function parts of unit info
32
-
33
- newly found issues
34
- --------------------
35
- ! passing a Window to Image.from_text has been deprecated since Gosu 0.9
36
- ! Fontconfig error: failed reading config file
37
- ! no way to list cargo in loaded maps
38
- ! units loaded from tile can spawn on unsuitable terrain
39
-
40
- file changes
41
- --------------
42
- army.rb
43
- PARTS_TO_BE_BUILT
44
-
45
- cursor.rb
46
- removed debug printouts from to_next_unit!()
47
-
48
- empi.rb
49
- added Build function to help
50
-
51
- ship
52
- PARTS_TO_BE_BUILT
53
-
54
- unit.rb
55
- set_function(func) properly returns if it tries to set build function for unit which can't build
56
- capture(by_whom) renamed to capture!(by_whom)
57
- destroy(by_whom) renamed to destroy!(by_whom)
58
- tile_check() renamed to is_terrain_suitable?()
59
- +engage!(by_whom) - Process engagement targeted at this unit
60
- +attack!(by_whom) - Process attack targeted at this unit
61
- capture!(by_whom) checks if unit can be captured and if capturing faction is different from current one
62
- destroy!(by_whom) removes from cargo of its transporter when transported
63
- cargo part shortened in info()
64
- positive cargo_max used instead of cargo size to show cargo part of info
65
- simplified calling of UnitFunction in function!
66
- set_function(func) renamed to set_function!(func)
67
- PARTS_TO_BE_BUILT
68
- moved build part of capture! to Town
69
- moved build part of set_function! to Town
70
- +can_be_built?
71
-
72
- unitFunction.rb
73
- removed PARTS_NEEDED
74
- @unit
75
- states project and its state when building in func!()
76
- loading needed unit parameters from its stored unit in func!()
77
- +info() - Set function part of long info string of unit
78
-
79
- town.rb
80
- @parts_needed
81
- @project
82
- +build_info - Tell the state of current build project
83
- +capture!(by_whom) - Process capture targeted at this town and reset build process
84
- +set_function(func) - Set desired function and possibly also project
85
- +set_project! - Set desired project
86
-
87
- save/m02-err.esf
88
- copy of m02 with two extra units on unsuitable terrain
89
-
90
- v18 dev
91
- =========
92
- - help is now listing all keys
93
- - help shown after the first load of new map
94
- - units use all left moves when loaded, unless they are loaded into towns
95
- - even units with 0 moves left show their moves in their info
96
- - added "End of turn" marker
97
- - added licensing/contact info also to this info file and not just to gem specs
98
- - several exception handlers added to Cursor
99
- - units stored in Tile class
100
- fixed: units are still stored via Map class instead of Tile one
101
- - movement and function keys processed in Cursor, movement checked in Unit
102
- fixed: units are still accessed via Window class instead of Cursor one
103
- - moving of cursor stores the current unit so it can possibly get moved (again)
104
- - function setting of units separated to its own method
105
- - autodisabling of freeroam mode on each end of turn moved to the start of next turn
106
-
107
- newly found issues
108
- --------------------
109
- ! help should be shown after each load of new map
110
- ! transported units can't get commands from freeroaming cursor
111
- ! transported units don't function properly, their transports secretly function instead of them
112
- ! unit info shown twice at the start of the first turn
113
- ! units which can't build can still have function set to build (though they do protest)
114
-
115
- file changes
116
- --------------
117
- empi.rb
118
- help shown at the start of game
119
- added End turn and End game keys to help()
120
- "End of turn" marker
121
- removed calling of @map.draw_units
122
- removed search for next movable unit
123
-
124
- map.rb
125
- all_map_units() uses indirect access via get_unit()
126
- get_unit(), set_unit() access given coordinates of @tiles
127
- draw_units() and @units removed
128
-
129
- unit.rb
130
- removed processing of movement and function keys
131
- info() uses @moves_max > 0 instead of can_move()
132
- check_movement() sets @moves_left to 1 when unit is loaded so it then gets lowered to 0
133
-
134
- cursor.rb
135
- switch_freeroam() renamed to switch_freeroam!()
136
- +move! - Move by given change of coordinates
137
- +to_next_unit! - Find next unit to target with cursor
138
- @unit
139
- +set_function_to_unit(func) - Tries to set function <func> to currently selected unit
140
-
141
- tile.rb
142
- @unit
143
-
144
- infopane.rb
145
- removed one space from score output
146
-
147
- docu/Empi v18.png
148
- docu/Empi v18 - printouts.png
149
-
150
- v17 dev
151
- =========
152
- - selected map: m02
153
- - terrain stuff separated to Tile class
154
- ! units are still stored via Map class instead of Tile one
155
- ! units are still accessed via Window class instead of Cursor one
156
- - removed debug printout from Unit class
157
- - moving transports don't leave their cargo behind
158
- - capturing done only by armies
159
- fixed: all units can capture towns (armies visiting towns are left allowed for now)
160
- - only towns can be captured, other units do battle
161
- fixed: battling units capture instead of damaging
162
- ! capturing town with units leaves those enemy units inside
163
- ! damaged units are destroyed
164
- - printouts tweaked
165
- fixed: transported units show only info of their transport instead when selected
166
- ! transported units show in infopane info of their transport instead when selected
167
- ! destroyed transport ships don't give points for their lost cargo
168
-
169
- file changes
170
- --------------
171
- empi.rb
172
- cursor prints out info() even for not moved units
173
- (say, when friend unit without avaiable cargo capacity was on the destination tile)
174
- added PROMPT to responding printouts
175
-
176
- cursor.rb
177
- info() shows info of transported units too
178
-
179
- map.rb
180
- TILE constants moved to tile.rb
181
- initialize() sets tile and leaves processing of loaded symbol to it
182
- tile() returns object of tile instead directly its terrain type
183
- +all_tiles - Return all tiles
184
- draw_tiles
185
-
186
- unit.rb
187
- removed debug printout used for checking of units leaving towns
188
- added PROMPT to responding printouts
189
- check_movement() makes sure cargo is moved too
190
- check_movement() checks if moved unit has enough move points
191
- check_movement() print outs are more detailed
192
- tile_check() doesn't check terrain type for transported units
193
- info() prints out also max cargo capacity
194
- fixed comparing of functions in set_function()
195
- +can_capture?
196
- +can_be_captured?
197
- can_move() renamed to can_move?()
198
- reset_moves() renamed to reset_moves!()
199
-
200
- army.rb
201
- can capture
202
-
203
- town.rb
204
- can be captured
205
-
206
- save/m02.esf
207
- +two ships, one for each faction
208
-
209
- tile.rb
210
-
211
-
212
- v16 dev
213
- =========
214
- - units on sentry duty say so when functioning
215
- - neutral units can't have functions
216
- - links to media and save files use full path
217
- - towns build armies
218
- fixed: no building of units
219
- ! hardcoded unit type to be built
220
- - units can transport other units
221
- - newly built units are stored in town instead of map
222
- fixed: new units are saved in map instead of the towns that built them
223
- ! transported units are never drawn
224
- ! transported units show only info of their transport instead when selected
225
- ! all units can capture and visit towns
226
-
227
- file changes
228
- --------------
229
- map.rb
230
- initialize() uses full paths to files
231
- all_units renamed to all_map_units() - Return only units directly on map
232
- +all_transported_units() - Return only units transported by other units
233
- +all_units() - Return both map units and transported units
234
- draw_units() draws only map units
235
-
236
- unit.rb
237
- +@cargo, @cargo_max
238
- +can_transport?() - Unit is able to both transport other units and currently has some space left
239
- set_function() checks for @faction == 0
240
- checking of movement separated from update()
241
- +check_movement() - Processes move of unit and takes care of its (un)loading or attack
242
- capture() makes newly captured towns start building
243
-
244
- town.rb
245
- initialize() uses full path to file
246
- +parts_built
247
- +@cargo_max set to 10
248
-
249
- army.rb
250
- initialize() uses full path to file
251
-
252
- ship.rb
253
- initialize() uses full path to file
254
- +@cargo_max set to 3
255
-
256
- unitFunction.rb
257
- +FUNCBUILD case in func!()
258
- FUNCSENTRY case in func!() sets "ret" even when unit keeps sentrying
259
-
260
-
261
- v15 dev
262
- =========
263
- - selected map: m03
264
- - units referenced only from map
265
- fixed: no destruction of units
266
- - loading of units from file
267
- fixed: no loading
268
- - checks of loaded terrain tiles and units
269
- - map stored as [row, column], not [xx, yy]
270
-
271
- file changes
272
- --------------
273
- empi.rb
274
- -scenario_units() - Return list of units for given scenario
275
-
276
- map.rb
277
- load_map() now loads units too
278
- load_head() now returns number of units to load too
279
- load_map(), tile(), get_unit(), set_unit() use rr and cc instead of xx and yy
280
- +load_unit() - Load one unit from given line
281
- +draw_units() - Draw all units
282
-
283
- save/m01.esf
284
- 8 units from old empi.scenario_units()
285
-
286
- save/m02.esf
287
- 10 units similar to old empi.scenario_units()
288
-
289
- save/m03.esf
290
-
291
-
292
- v14 dev
293
- =========
294
- - loading of terrain tiles from file
295
- fixed: hardcoded starting scenario
296
- ! hardcoded save file name
297
- ! hardcoded map size
298
-
299
- file changes
300
- --------------
301
- empi.rb
302
- TILE constants moved to map.rb
303
-
304
- map.rb
305
- -scenario_tiles() - Return map tile for given scenario
306
- +load_map() - Load map from file (for now only terrain tiles)
307
- +load_head() - Load head row of file
308
-
309
- unit.rb
310
- removed generic unit image
311
-
312
- save/m01.esf
313
- save/m02.esf
314
-
315
-
316
- older versions
317
- ================
318
- - towns and armies
319
- - functions none and sentry
320
- - armor and movement points
321
- - movement of units
322
- - rudimentary terrain checking after move
323
- - capturing of units
324
- - turn and score counting
325
- - command line and screen text output
326
- - next available unit / freeroam cursor
327
-
328
-
329
- current state
330
- ===============
331
- old wishlist
332
- ! no panning of map
333
- !x no destruction of units
334
- !x no building of units
335
- ! no victory conditions
336
- !x battling units capture instead of damaging
337
- ! attacker always wins
338
- ! player playing both factions at once
339
- !x hardcoded starting scenario
340
- ! no fog of war
341
- ! no saving
342
- !x no loading
343
- ! no title screen
344
- ! no highscore screen
345
- ! no settings
346
- ! no sound, no music
347
-
348
- new problems
349
- ! hardcoded save file name
350
- ! hardcoded map size
351
- ! hardcoded unit type to be built
352
- ! transported units are never drawn
353
- !x transported units show only info of their transport instead when selected
354
- !x all units can capture towns
355
- !x all units can visit towns
356
- !x units are still stored via Map class instead of Tile one
357
- !x units are still accessed via Window class instead of Cursor one
358
- !x capturing town with units leaves those enemy units inside
359
- ! damaged units are destroyed
360
- !x transported units show in infopane info of their transport instead when selected
361
- !x destroyed transport ships don't give points for their lost cargo
362
- ! help should be shown after each load of new map
363
- ! transported units can't get commands from freeroaming cursor
364
- !x transported units don't function properly, their transports secretly function instead of them
365
- ! unit info shown twice at the start of the first turn
366
- !x units which can't build can still have function set to build
367
- ! passing a Window to Image.from_text has been deprecated since Gosu 0.9
368
- ! Fontconfig error: failed reading config file
369
- ! no way to list cargo in loaded maps
370
- ! units loaded from tile can spawn on unsuitable terrain
371
-
372
- (! thing to fix, !x fixed thing)