gemwarrior 0.11.5 → 0.12.0

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
  SHA1:
3
- metadata.gz: e9d23f8af0559e0e1e4e9c10e8efe4633b93a656
4
- data.tar.gz: cf8fd7b6329334e50775ac624c876aa153497c22
3
+ metadata.gz: ca163fbb7cece3ec0bc218816843eaadab24bb3d
4
+ data.tar.gz: 9a9d951320df240ee8fdbd6fb6e5c9d328bda03c
5
5
  SHA512:
6
- metadata.gz: 4eff96e788a696225658496179f81ce76667283e1aa2f7acf205030dec885ebd273a0a720db045b5bb880e644316f7e8ca2e83ed8011fd4ca9645fbd7296dbe1
7
- data.tar.gz: bc0a5e110535abded6e6336692fc015f02c303e8c99a44da63e83e34650fe8896326ccbe25057ef88eb034167d6e124024ac8a571a161d258bd8f9b49c9d68ea
6
+ metadata.gz: 79b84db6709a927ef8d510b5a05d627693bab51b90867c2620af5cf17ace03d5a82945c704bc6250fa81ec6f1ac877f614d6f673b663de7e14ed0c6ab2cb0624
7
+ data.tar.gz: 6394216a50f001837169412e2b21fe6ea0b3ab5fd5828a7f4b4f4dc5620a96f20231c22958b42ff853ec6478c79e713bbad0203bb1a233cb1422577288da115f
@@ -8,7 +8,7 @@ locations:
8
8
  :x: 5
9
9
  :y: 0
10
10
  :z: 0
11
- locs_connected:
11
+ paths:
12
12
  :north: true
13
13
  :east: true
14
14
  :south: false
@@ -79,7 +79,7 @@ locations:
79
79
  :x: 6
80
80
  :y: 0
81
81
  :z: 0
82
- locs_connected:
82
+ paths:
83
83
  :north: false
84
84
  :east: true
85
85
  :south: false
@@ -102,7 +102,7 @@ locations:
102
102
  :x: 7
103
103
  :y: 0
104
104
  :z: 0
105
- locs_connected:
105
+ paths:
106
106
  :north: true
107
107
  :east: true
108
108
  :south: false
@@ -152,7 +152,7 @@ locations:
152
152
  :x: 7
153
153
  :y: 1
154
154
  :z: 0
155
- locs_connected:
155
+ paths:
156
156
  :north: false
157
157
  :east: true
158
158
  :south: true
@@ -175,7 +175,7 @@ locations:
175
175
  :x: 8
176
176
  :y: 1
177
177
  :z: 0
178
- locs_connected:
178
+ paths:
179
179
  :north: false
180
180
  :east: false
181
181
  :south: true
@@ -212,7 +212,7 @@ locations:
212
212
  :x: 8
213
213
  :y: 1
214
214
  :z: -1
215
- locs_connected:
215
+ paths:
216
216
  :north: true
217
217
  :east: false
218
218
  :south: false
@@ -236,7 +236,7 @@ locations:
236
236
  :x: 8
237
237
  :y: 2
238
238
  :z: -1
239
- locs_connected:
239
+ paths:
240
240
  :north: true
241
241
  :east: false
242
242
  :south: true
@@ -260,7 +260,7 @@ locations:
260
260
  :x: 8
261
261
  :y: 3
262
262
  :z: -1
263
- locs_connected:
263
+ paths:
264
264
  :north: true
265
265
  :east: false
266
266
  :south: true
@@ -284,7 +284,7 @@ locations:
284
284
  :x: 8
285
285
  :y: 4
286
286
  :z: -1
287
- locs_connected:
287
+ paths:
288
288
  :north: false
289
289
  :east: false
290
290
  :south: true
@@ -308,7 +308,7 @@ locations:
308
308
  :x: 7
309
309
  :y: 4
310
310
  :z: -1
311
- locs_connected:
311
+ paths:
312
312
  :north: false
313
313
  :east: true
314
314
  :south: false
@@ -332,7 +332,7 @@ locations:
332
332
  :x: 6
333
333
  :y: 4
334
334
  :z: -1
335
- locs_connected:
335
+ paths:
336
336
  :north: true
337
337
  :east: true
338
338
  :south: false
@@ -356,7 +356,7 @@ locations:
356
356
  :x: 6
357
357
  :y: 5
358
358
  :z: -1
359
- locs_connected:
359
+ paths:
360
360
  :north: false
361
361
  :east: false
362
362
  :south: true
@@ -380,7 +380,7 @@ locations:
380
380
  :x: 5
381
381
  :y: 5
382
382
  :z: -1
383
- locs_connected:
383
+ paths:
384
384
  :north: true
385
385
  :east: true
386
386
  :south: false
@@ -404,7 +404,7 @@ locations:
404
404
  :x: 4
405
405
  :y: 5
406
406
  :z: -1
407
- locs_connected:
407
+ paths:
408
408
  :north: false
409
409
  :east: true
410
410
  :south: false
@@ -441,7 +441,7 @@ locations:
441
441
  :x: 5
442
442
  :y: 6
443
443
  :z: -1
444
- locs_connected:
444
+ paths:
445
445
  :north: true
446
446
  :east: false
447
447
  :south: true
@@ -465,7 +465,7 @@ locations:
465
465
  :x: 5
466
466
  :y: 7
467
467
  :z: -1
468
- locs_connected:
468
+ paths:
469
469
  :north: false
470
470
  :east: false
471
471
  :south: true
@@ -501,7 +501,7 @@ locations:
501
501
  :x: 5
502
502
  :y: 7
503
503
  :z: 0
504
- locs_connected:
504
+ paths:
505
505
  :north: true
506
506
  :east: false
507
507
  :south: false
@@ -524,7 +524,7 @@ locations:
524
524
  :x: 4
525
525
  :y: 7
526
526
  :z: 0
527
- locs_connected:
527
+ paths:
528
528
  :north: true
529
529
  :east: true
530
530
  :south: false
@@ -547,7 +547,7 @@ locations:
547
547
  :x: 3
548
548
  :y: 7
549
549
  :z: 0
550
- locs_connected:
550
+ paths:
551
551
  :north: true
552
552
  :east: true
553
553
  :south: false
@@ -570,7 +570,7 @@ locations:
570
570
  :x: 2
571
571
  :y: 7
572
572
  :z: 0
573
- locs_connected:
573
+ paths:
574
574
  :north: true
575
575
  :east: true
576
576
  :south: false
@@ -593,7 +593,7 @@ locations:
593
593
  :x: 1
594
594
  :y: 7
595
595
  :z: 0
596
- locs_connected:
596
+ paths:
597
597
  :north: true
598
598
  :east: true
599
599
  :south: false
@@ -616,7 +616,7 @@ locations:
616
616
  :x: 1
617
617
  :y: 8
618
618
  :z: 0
619
- locs_connected:
619
+ paths:
620
620
  :north: false
621
621
  :east: true
622
622
  :south: true
@@ -651,7 +651,7 @@ locations:
651
651
  :x: 2
652
652
  :y: 8
653
653
  :z: 0
654
- locs_connected:
654
+ paths:
655
655
  :north: false
656
656
  :east: true
657
657
  :south: true
@@ -674,7 +674,7 @@ locations:
674
674
  :x: 3
675
675
  :y: 8
676
676
  :z: 0
677
- locs_connected:
677
+ paths:
678
678
  :north: false
679
679
  :east: true
680
680
  :south: true
@@ -697,7 +697,7 @@ locations:
697
697
  :x: 4
698
698
  :y: 8
699
699
  :z: 0
700
- locs_connected:
700
+ paths:
701
701
  :north: false
702
702
  :east: true
703
703
  :south: true
@@ -720,7 +720,7 @@ locations:
720
720
  :x: 5
721
721
  :y: 8
722
722
  :z: 0
723
- locs_connected:
723
+ paths:
724
724
  :north: false
725
725
  :east: false
726
726
  :south: true
@@ -742,7 +742,7 @@ locations:
742
742
  :x: 8
743
743
  :y: 0
744
744
  :z: 0
745
- locs_connected:
745
+ paths:
746
746
  :north: true
747
747
  :east: false
748
748
  :south: false
@@ -777,7 +777,7 @@ locations:
777
777
  :x: 4
778
778
  :y: 0
779
779
  :z: 0
780
- locs_connected:
780
+ paths:
781
781
  :north: true
782
782
  :east: true
783
783
  :south: false
@@ -812,7 +812,7 @@ locations:
812
812
  :x: 4
813
813
  :y: 1
814
814
  :z: 0
815
- locs_connected:
815
+ paths:
816
816
  :north: false
817
817
  :east: false
818
818
  :south: true
@@ -835,7 +835,7 @@ locations:
835
835
  :x: 3
836
836
  :y: 1
837
837
  :z: 0
838
- locs_connected:
838
+ paths:
839
839
  :north: false
840
840
  :east: true
841
841
  :south: true
@@ -870,7 +870,7 @@ locations:
870
870
  :x: 3
871
871
  :y: 0
872
872
  :z: 0
873
- locs_connected:
873
+ paths:
874
874
  :north: true
875
875
  :east: false
876
876
  :south: false
@@ -904,7 +904,7 @@ locations:
904
904
  :x: 2
905
905
  :y: 0
906
906
  :z: 0
907
- locs_connected:
907
+ paths:
908
908
  :north: true
909
909
  :east: true
910
910
  :south: false
@@ -926,7 +926,7 @@ locations:
926
926
  :x: 2
927
927
  :y: 1
928
928
  :z: 0
929
- locs_connected:
929
+ paths:
930
930
  :north: false
931
931
  :east: false
932
932
  :south: true
@@ -948,7 +948,7 @@ locations:
948
948
  :x: 1
949
949
  :y: 1
950
950
  :z: 0
951
- locs_connected:
951
+ paths:
952
952
  :north: true
953
953
  :east: true
954
954
  :south: true
@@ -970,7 +970,7 @@ locations:
970
970
  :x: 1
971
971
  :y: 0
972
972
  :z: 0
973
- locs_connected:
973
+ paths:
974
974
  :north: true
975
975
  :east: true
976
976
  :south: false
@@ -992,7 +992,7 @@ locations:
992
992
  :x: 0
993
993
  :y: 1
994
994
  :z: 0
995
- locs_connected:
995
+ paths:
996
996
  :north: true
997
997
  :east: true
998
998
  :south: false
@@ -1026,7 +1026,7 @@ locations:
1026
1026
  :x: 0
1027
1027
  :y: 2
1028
1028
  :z: 0
1029
- locs_connected:
1029
+ paths:
1030
1030
  :north: false
1031
1031
  :east: true
1032
1032
  :south: true
@@ -1048,7 +1048,7 @@ locations:
1048
1048
  :x: 1
1049
1049
  :y: 2
1050
1050
  :z: 0
1051
- locs_connected:
1051
+ paths:
1052
1052
  :north: false
1053
1053
  :east: false
1054
1054
  :south: true
@@ -1070,7 +1070,7 @@ locations:
1070
1070
  :x: 5
1071
1071
  :y: 1
1072
1072
  :z: 0
1073
- locs_connected:
1073
+ paths:
1074
1074
  :north: true
1075
1075
  :east: false
1076
1076
  :south: true
@@ -1092,7 +1092,7 @@ locations:
1092
1092
  :x: 5
1093
1093
  :y: 2
1094
1094
  :z: 0
1095
- locs_connected:
1095
+ paths:
1096
1096
  :north: true
1097
1097
  :east: false
1098
1098
  :south: true
@@ -1115,7 +1115,7 @@ locations:
1115
1115
  :x: 5
1116
1116
  :y: 3
1117
1117
  :z: 0
1118
- locs_connected:
1118
+ paths:
1119
1119
  :north: false
1120
1120
  :east: true
1121
1121
  :south: true
@@ -1139,7 +1139,7 @@ locations:
1139
1139
  :x: 6
1140
1140
  :y: 3
1141
1141
  :z: 0
1142
- locs_connected:
1142
+ paths:
1143
1143
  :north: true
1144
1144
  :east: true
1145
1145
  :south: false
@@ -1163,7 +1163,7 @@ locations:
1163
1163
  :x: 7
1164
1164
  :y: 3
1165
1165
  :z: 0
1166
- locs_connected:
1166
+ paths:
1167
1167
  :north: false
1168
1168
  :east: true
1169
1169
  :south: false
@@ -1202,7 +1202,7 @@ locations:
1202
1202
  :x: 8
1203
1203
  :y: 3
1204
1204
  :z: 0
1205
- locs_connected:
1205
+ paths:
1206
1206
  :north: false
1207
1207
  :east: false
1208
1208
  :south: false
@@ -1234,7 +1234,7 @@ locations:
1234
1234
  :x: 4
1235
1235
  :y: 3
1236
1236
  :z: 0
1237
- locs_connected:
1237
+ paths:
1238
1238
  :north: true
1239
1239
  :east: true
1240
1240
  :south: false
@@ -1257,7 +1257,7 @@ locations:
1257
1257
  :x: 3
1258
1258
  :y: 3
1259
1259
  :z: 0
1260
- locs_connected:
1260
+ paths:
1261
1261
  :north: false
1262
1262
  :east: true
1263
1263
  :south: false
@@ -1277,7 +1277,7 @@ locations:
1277
1277
  :x: 4
1278
1278
  :y: 4
1279
1279
  :z: 0
1280
- locs_connected:
1280
+ paths:
1281
1281
  :north: false
1282
1282
  :east: false
1283
1283
  :south: true
@@ -1300,7 +1300,7 @@ locations:
1300
1300
  :x: 4
1301
1301
  :y: 5
1302
1302
  :z: 0
1303
- locs_connected:
1303
+ paths:
1304
1304
  :north: false
1305
1305
  :east: false
1306
1306
  :south: true
@@ -1323,7 +1323,7 @@ locations:
1323
1323
  :x: 6
1324
1324
  :y: 4
1325
1325
  :z: 0
1326
- locs_connected:
1326
+ paths:
1327
1327
  :north: true
1328
1328
  :east: false
1329
1329
  :south: true
@@ -1346,7 +1346,7 @@ locations:
1346
1346
  :x: 6
1347
1347
  :y: 5
1348
1348
  :z: 0
1349
- locs_connected:
1349
+ paths:
1350
1350
  :north: false
1351
1351
  :east: true
1352
1352
  :south: true
@@ -1369,7 +1369,7 @@ locations:
1369
1369
  :x: 7
1370
1370
  :y: 5
1371
1371
  :z: 0
1372
- locs_connected:
1372
+ paths:
1373
1373
  :north: true
1374
1374
  :east: false
1375
1375
  :south: false
@@ -1392,7 +1392,7 @@ locations:
1392
1392
  :x: 7
1393
1393
  :y: 6
1394
1394
  :z: 0
1395
- locs_connected:
1395
+ paths:
1396
1396
  :north: true
1397
1397
  :east: false
1398
1398
  :south: true
@@ -1415,7 +1415,7 @@ locations:
1415
1415
  :x: 7
1416
1416
  :y: 7
1417
1417
  :z: 0
1418
- locs_connected:
1418
+ paths:
1419
1419
  :north: true
1420
1420
  :east: true
1421
1421
  :south: true
@@ -1449,7 +1449,7 @@ locations:
1449
1449
  :x: 8
1450
1450
  :y: 7
1451
1451
  :z: 0
1452
- locs_connected:
1452
+ paths:
1453
1453
  :north: true
1454
1454
  :east: false
1455
1455
  :south: false
@@ -1498,7 +1498,7 @@ locations:
1498
1498
  :x: 8
1499
1499
  :y: 8
1500
1500
  :z: 0
1501
- locs_connected:
1501
+ paths:
1502
1502
  :north: false
1503
1503
  :east: false
1504
1504
  :south: true
@@ -1556,7 +1556,7 @@ locations:
1556
1556
  :x: 7
1557
1557
  :y: 8
1558
1558
  :z: 0
1559
- locs_connected:
1559
+ paths:
1560
1560
  :north: false
1561
1561
  :east: true
1562
1562
  :south: true
@@ -1590,7 +1590,7 @@ locations:
1590
1590
  :x: 3
1591
1591
  :y: 5
1592
1592
  :z: 0
1593
- locs_connected:
1593
+ paths:
1594
1594
  :north: false
1595
1595
  :east: true
1596
1596
  :south: false
@@ -1664,7 +1664,7 @@ locations:
1664
1664
  :x: 8
1665
1665
  :y: 6
1666
1666
  :z: 1
1667
- locs_connected:
1667
+ paths:
1668
1668
  :north: true
1669
1669
  :east: true
1670
1670
  :south: false
@@ -1699,7 +1699,7 @@ locations:
1699
1699
  :x: 8
1700
1700
  :y: 7
1701
1701
  :z: 1
1702
- locs_connected:
1702
+ paths:
1703
1703
  :north: false
1704
1704
  :east: false
1705
1705
  :south: true
@@ -1763,7 +1763,7 @@ locations:
1763
1763
  :x: 7
1764
1764
  :y: 6
1765
1765
  :z: 1
1766
- locs_connected:
1766
+ paths:
1767
1767
  :north: true
1768
1768
  :east: true
1769
1769
  :south: false
@@ -1797,7 +1797,7 @@ locations:
1797
1797
  :x: 7
1798
1798
  :y: 7
1799
1799
  :z: 1
1800
- locs_connected:
1800
+ paths:
1801
1801
  :north: true
1802
1802
  :east: false
1803
1803
  :south: true
@@ -1820,7 +1820,7 @@ locations:
1820
1820
  :x: 7
1821
1821
  :y: 8
1822
1822
  :z: 1
1823
- locs_connected:
1823
+ paths:
1824
1824
  :north: false
1825
1825
  :east: true
1826
1826
  :south: true
@@ -1856,7 +1856,7 @@ locations:
1856
1856
  :x: 8
1857
1857
  :y: 8
1858
1858
  :z: 1
1859
- locs_connected:
1859
+ paths:
1860
1860
  :north: false
1861
1861
  :east: true
1862
1862
  :south: false
@@ -1893,7 +1893,7 @@ locations:
1893
1893
  :x: 8
1894
1894
  :y: 9
1895
1895
  :z: 1
1896
- locs_connected:
1896
+ paths:
1897
1897
  :north: false
1898
1898
  :east: false
1899
1899
  :south: true
@@ -1928,7 +1928,7 @@ locations:
1928
1928
  :x: 9
1929
1929
  :y: 8
1930
1930
  :z: 1
1931
- locs_connected:
1931
+ paths:
1932
1932
  :north: false
1933
1933
  :east: false
1934
1934
  :south: true
@@ -1963,7 +1963,7 @@ locations:
1963
1963
  :x: 9
1964
1964
  :y: 7
1965
1965
  :z: 1
1966
- locs_connected:
1966
+ paths:
1967
1967
  :north: true
1968
1968
  :east: false
1969
1969
  :south: true
@@ -1986,7 +1986,7 @@ locations:
1986
1986
  :x: 9
1987
1987
  :y: 6
1988
1988
  :z: 1
1989
- locs_connected:
1989
+ paths:
1990
1990
  :north: true
1991
1991
  :east: false
1992
1992
  :south: false
@@ -2033,7 +2033,7 @@ locations:
2033
2033
  :x: 5
2034
2034
  :y: 5
2035
2035
  :z: 2
2036
- locs_connected:
2036
+ paths:
2037
2037
  :north: false
2038
2038
  :east: false
2039
2039
  :south: false
@@ -19,7 +19,7 @@ module Gemwarrior
19
19
  def use(world)
20
20
  forest_southwest = world.location_by_name('forest-southwest')
21
21
 
22
- if forest_southwest.locs_connected[:west].eql? false
22
+ if forest_southwest.paths[:west].eql? false
23
23
  if !self.used
24
24
  puts 'Many books look interesting, including one specific volume entitled "Use Me Again to Attempt Unlocking the Way", by Not Very Subtle.'
25
25
  puts
@@ -33,7 +33,7 @@ module Gemwarrior
33
33
 
34
34
  case answer
35
35
  when 'mineral'
36
- forest_southwest.locs_connected[:west] = true
36
+ forest_southwest.paths[:west] = true
37
37
  puts
38
38
  Animation.run(phrase: OPEN_TEXT)
39
39
  puts
@@ -13,7 +13,7 @@ module Gemwarrior
13
13
  ERROR_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
14
14
 
15
15
  attr_accessor :coords,
16
- :locs_connected,
16
+ :paths,
17
17
  :danger_level,
18
18
  :monster_level_range,
19
19
  :items,
@@ -21,6 +21,19 @@ module Gemwarrior
21
21
  :bosses_abounding,
22
22
  :checked_for_monsters
23
23
 
24
+ def initialize(options)
25
+ self.name = options.fetch(:name)
26
+ self.description = options.fetch(:description)
27
+ self.coords = options.fetch(:coords)
28
+ self.paths = options.fetch(:paths)
29
+ self.danger_level = options.fetch(:danger_level)
30
+ self.monster_level_range = options.fetch(:monster_level_range)
31
+ self.items = options.fetch(:items)
32
+ self.monsters_abounding = options.fetch(:monsters_abounding)
33
+ self.bosses_abounding = options.fetch[:bosses_abounding]
34
+ self.checked_for_monsters = false
35
+ end
36
+
24
37
  def describe
25
38
  desc_text = name.ljust(30).upcase.colorize(:green)
26
39
  desc_text << coords.values.to_a.to_s.colorize(:white)
@@ -40,19 +53,6 @@ module Gemwarrior
40
53
  desc_text
41
54
  end
42
55
 
43
- def initialize(options)
44
- self.name = options.fetch(:name)
45
- self.description = options.fetch(:description)
46
- self.coords = options.fetch(:coords)
47
- self.locs_connected = options.fetch(:locs_connected)
48
- self.danger_level = options.fetch(:danger_level)
49
- self.monster_level_range = options.fetch(:monster_level_range)
50
- self.items = options.fetch(:items)
51
- self.monsters_abounding = options.fetch(:monsters_abounding)
52
- self.bosses_abounding = options.fetch[:bosses_abounding]
53
- self.checked_for_monsters = false
54
- end
55
-
56
56
  def contains_item?(item_name)
57
57
  self.items.map{|i| i.name.downcase}.include?(item_name.downcase)
58
58
  end
@@ -66,7 +66,7 @@ module Gemwarrior
66
66
  end
67
67
 
68
68
  def add_item(item_name_to_add)
69
- all_items = GameItems.data || GameWeapons.data
69
+ all_items = GameItems.data | GameWeapons.data | GameArmor.data
70
70
  all_items.each do |game_item|
71
71
  if game_item.name.eql?(item_name_to_add)
72
72
  self.items.push(game_item)
@@ -78,7 +78,7 @@ module Gemwarrior
78
78
 
79
79
  def remove_item(item_name)
80
80
  if contains_item?(item_name)
81
- items.reject! { |item| item.name == item_name }
81
+ self.items.delete_at(items.index(items.find { |i| i.name.downcase == item_name.downcase }))
82
82
  else
83
83
  ERROR_ITEM_REMOVE_INVALID
84
84
  end
@@ -100,7 +100,7 @@ module Gemwarrior
100
100
  when 'w'
101
101
  direction = 'west'
102
102
  end
103
- locs_connected[direction.to_sym]
103
+ paths[direction.to_sym]
104
104
  end
105
105
 
106
106
  def monster_by_name(monster_name)
@@ -132,7 +132,36 @@ module Gemwarrior
132
132
  end
133
133
 
134
134
  def list_items
135
- items.length > 0 ? items.map(&:name) : []
135
+ if items.empty?
136
+ []
137
+ else
138
+ item_hash = {}
139
+ self.items.map(&:name).each do |i|
140
+ i_sym = i.to_sym
141
+ if item_hash.keys.include? i_sym
142
+ item_hash[i_sym] += 1
143
+ else
144
+ item_hash[i_sym] = 1
145
+ end
146
+ end
147
+
148
+ if item_hash.length == 1
149
+ item_hash.each do |i, q|
150
+ q > 1 ? "#{q} #{i}s" : i
151
+ end
152
+ else
153
+ item_arr = []
154
+ item_hash.each do |i, q|
155
+ if q > 1
156
+ item_arr.push("#{i.to_s.colorize(:yellow)}#{'s'.colorize(:yellow)} x#{q}")
157
+ else
158
+ item_arr.push(i)
159
+ end
160
+ end
161
+
162
+ return item_arr
163
+ end
164
+ end
136
165
  end
137
166
 
138
167
  def list_monsters
@@ -145,7 +174,7 @@ module Gemwarrior
145
174
 
146
175
  def list_paths
147
176
  valid_paths = []
148
- locs_connected.each do |key, value|
177
+ self.paths.each do |key, value|
149
178
  if value
150
179
  valid_paths.push(key.to_s)
151
180
  end
@@ -49,7 +49,7 @@ module Gemwarrior
49
49
 
50
50
  # unlock northward travel
51
51
  river_bridge.description = 'The path northward on this well-constructed bridge is no longer blocked after your brutal scuffle with Jaspern, and yet the flowing river below seems unperturbed.'
52
- river_bridge.locs_connected[:north] = true
52
+ river_bridge.paths[:north] = true
53
53
  return
54
54
  end
55
55
 
@@ -76,9 +76,10 @@ module Gemwarrior
76
76
 
77
77
  abilities = ''
78
78
  if special_abilities.empty?
79
- abilities = 'none...yet(?)'
79
+ abilities = " none...yet(?)\n"
80
80
  else
81
81
  special_abilities.each do |sp|
82
+ abilities << "\n"
82
83
  abilities << " #{Formatting.upstyle(sp.to_s).ljust(15).colorize(:yellow)}: #{PlayerLevels.get_ability_description(sp)}\n"
83
84
  end
84
85
  end
@@ -96,7 +97,7 @@ module Gemwarrior
96
97
  self_text << " (#{net_defense} w/ #{armor_slot})".colorize(:yellow) unless net_defense.nil?
97
98
  self_text << "\n"
98
99
  self_text << "DEXTERITY : #{self.dexterity}\n"
99
- self_text << "ABILITIES :\n"
100
+ self_text << "ABILITIES :"
100
101
  self_text << "#{abilities}"
101
102
 
102
103
  if GameOptions.data['debug_mode']
@@ -583,7 +583,7 @@ module Gemwarrior
583
583
  if param1.nil?
584
584
  ERROR_DROP_PARAM_MISSING
585
585
  else
586
- world.player.inventory.drop_item(param1)
586
+ world.player.inventory.drop_item(param1, player_cur_location)
587
587
  end
588
588
  when 'equip', 'eq'
589
589
  if param1.nil?
@@ -4,6 +4,9 @@
4
4
  require 'colorize'
5
5
  require 'matrext'
6
6
 
7
+ require_relative 'entities/armor/iron_helmet'
8
+ require_relative 'entities/items/herb'
9
+ require_relative 'entities/weapons/dagger'
7
10
  require_relative 'misc/animation'
8
11
  require_relative 'misc/audio'
9
12
  require_relative 'misc/formatting'
@@ -18,7 +21,7 @@ module Gemwarrior
18
21
  class Game
19
22
  # CONSTANTS
20
23
  INVENTORY_DEFAULT = Inventory.new
21
- INVENTORY_DEBUG = Inventory.new([Herb.new])
24
+ INVENTORY_DEBUG = Inventory.new([Herb.new, Herb.new, Herb.new])
22
25
  ROX_DEFAULT = 0
23
26
  ROX_DEBUG = 300
24
27
 
@@ -17,6 +17,10 @@ module Gemwarrior
17
17
  def self.data
18
18
  @@data ||= []
19
19
  end
20
+
21
+ def self.get(name)
22
+ self.data.find { |i| i.name.downcase == name.downcase }
23
+ end
20
24
  end
21
25
 
22
26
  module GameCreatures
@@ -28,6 +32,10 @@ module Gemwarrior
28
32
  def self.data
29
33
  @@data ||= []
30
34
  end
35
+
36
+ def self.get(name)
37
+ self.data.find { |i| i.name.downcase == name.downcase }
38
+ end
31
39
  end
32
40
 
33
41
  module GameItems
@@ -39,6 +47,10 @@ module Gemwarrior
39
47
  def self.data
40
48
  @@data ||= []
41
49
  end
50
+
51
+ def self.get(name)
52
+ self.data.find { |i| i.name.downcase == name.downcase }
53
+ end
42
54
  end
43
55
 
44
56
  module GameMonsters
@@ -50,6 +62,10 @@ module Gemwarrior
50
62
  def self.data
51
63
  @@data ||= []
52
64
  end
65
+
66
+ def self.get(name)
67
+ self.data.find { |i| i.name.downcase == name.downcase }
68
+ end
53
69
  end
54
70
 
55
71
  module GamePeople
@@ -61,6 +77,10 @@ module Gemwarrior
61
77
  def self.data
62
78
  @@data ||= []
63
79
  end
80
+
81
+ def self.get(name)
82
+ self.data.find { |i| i.name.downcase == name.downcase }
83
+ end
64
84
  end
65
85
 
66
86
  module GameWeapons
@@ -72,5 +92,9 @@ module Gemwarrior
72
92
  def self.data
73
93
  @@data ||= []
74
94
  end
95
+
96
+ def self.get(name)
97
+ self.data.find { |i| i.name.downcase == name.downcase }
98
+ end
75
99
  end
76
100
  end
@@ -14,6 +14,7 @@ module Gemwarrior
14
14
  ERROR_ITEM_EQUIP_NONARMAMENT = 'That item cannot be equipped.'
15
15
  ERROR_ITEM_UNEQUIP_INVALID = 'You do not possess anything called that to unequip.'
16
16
  ERROR_ITEM_UNEQUIP_NONARMAMENT = 'That item cannot be unequipped.'
17
+ VOWELS = 'aeiou'
17
18
 
18
19
  attr_accessor :items,
19
20
  :weapon,
@@ -29,8 +30,50 @@ module Gemwarrior
29
30
  self.items.nil? || self.items.empty?
30
31
  end
31
32
 
33
+ def contents
34
+ is_empty? ? nil : list_contents
35
+ end
36
+
32
37
  def list_contents
33
- is_empty? ? '[empty]' : "#{self.items.map(&:name).join(', ')}"
38
+ if is_empty?
39
+ 'You possess nothing.'
40
+ else
41
+ item_hash = {}
42
+ self.items.map(&:name).each do |i|
43
+ i_sym = i.to_sym
44
+ if item_hash.keys.include? i_sym
45
+ item_hash[i_sym] += 1
46
+ else
47
+ item_hash[i_sym] = 1
48
+ end
49
+ end
50
+
51
+ if item_hash.length == 1
52
+ item_hash.each do |i, q|
53
+ if q > 1
54
+ return "You have #{q} #{i.to_s.colorize(:yellow)}#{'s'.colorize(:yellow)}."
55
+ else
56
+ article = VOWELS.include?(i[0]) ? 'an' : 'a'
57
+ return "You have #{article} #{i.to_s.colorize(:yellow)}."
58
+ end
59
+ end
60
+ else
61
+ item_list_text = 'You have '
62
+ item_arr = []
63
+ item_hash.each do |i, q|
64
+ if q > 1
65
+ item_arr.push("#{q} #{i.to_s.colorize(:yellow)}#{'s'.colorize(:yellow)}")
66
+ else
67
+ article = VOWELS.include?(i[0]) ? 'an' : 'a'
68
+ item_arr.push("#{article} #{i.to_s.colorize(:yellow)}")
69
+ end
70
+ end
71
+
72
+ item_arr[-1].replace("and #{item_arr[-1]}.")
73
+
74
+ return item_list_text << item_arr.join(', ')
75
+ end
76
+ end
34
77
  end
35
78
 
36
79
  def contains_item?(item_name)
@@ -77,10 +120,10 @@ module Gemwarrior
77
120
  i.equipped = true
78
121
  if i.is_weapon
79
122
  self.weapon = i
80
- return "The #{i.name} has taken charge, and been equipped."
123
+ return "The #{i.name.colorize(:yellow)} has taken charge, and been equipped."
81
124
  elsif i.is_armor
82
125
  self.armor = i
83
- return "The #{i.name} has fortified, and has been equipped."
126
+ return "The #{i.name.colorize(:yellow)} has fortified, and has been equipped."
84
127
  end
85
128
  else
86
129
  return ERROR_ITEM_EQUIP_NONARMAMENT
@@ -100,10 +143,10 @@ module Gemwarrior
100
143
  i.equipped = false
101
144
  if i.is_weapon
102
145
  self.weapon = nil
103
- return "The #{i.name} has been demoted to unequipped."
146
+ return "The #{i.name.colorize(:yellow)} has been demoted to unequipped."
104
147
  elsif i.is_armor
105
148
  self.armor = nil
106
- return "The #{i.name} has been demoted to unequipped."
149
+ return "The #{i.name.colorize(:yellow)} has been demoted to unequipped."
107
150
  end
108
151
  else
109
152
  return ERROR_ITEM_UNEQUIP_NONARMAMENT
@@ -128,7 +171,7 @@ module Gemwarrior
128
171
  # stats
129
172
  player.items_taken += 1
130
173
 
131
- return "Added #{item_name} to your increasing collection of bits of tid.".colorize(:green)
174
+ return "#{"Added".colorize(:green)} #{item_name.colorize(:yellow)} #{"to your increasing collection of bits of tid".colorize(:green)}."
132
175
  else
133
176
  return ERROR_ITEM_ADD_UNTAKEABLE.colorize(:red)
134
177
  end
@@ -138,29 +181,21 @@ module Gemwarrior
138
181
  ERROR_ITEM_ADD_INVALID.colorize(:red)
139
182
  end
140
183
 
184
+ def drop_item(item_name, cur_loc)
185
+ if contains_item?(item_name)
186
+ remove_item(item_name)
187
+ cur_loc.add_item(item_name)
188
+ "You dropped #{item_name.colorize(:yellow)}."
189
+ else
190
+ ERROR_ITEM_REMOVE_INVALID
191
+ end
192
+ end
193
+
141
194
  def remove_item(item_name)
142
195
  self.items.delete_at(self.items.map(&:name).index(item_name) || self.items.length)
143
196
  unless self.weapon.nil?
144
197
  self.weapon = nil if self.weapon.name.eql?(item_name)
145
198
  end
146
199
  end
147
-
148
- def drop_item(item_name)
149
- if contains_item?(item_name)
150
- print "Are you sure you want to permanently throw away #{item_name}? (y/n) "
151
- answer = gets.chomp.downcase
152
-
153
- case answer
154
- when 'y', 'yes'
155
- remove_item(item_name)
156
-
157
- return "The #{item_name} has been thrown on the ground, but far out of reach, and you're much too lazy to go get it now, so it's as good as gone."
158
- else
159
- return "You decide to keep #{item_name} for now."
160
- end
161
- else
162
- ERROR_ITEM_REMOVE_INVALID
163
- end
164
- end
165
200
  end
166
201
  end
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.11.5'
5
+ VERSION = '0.12.0'
6
6
  end
@@ -5,7 +5,6 @@ require_relative 'game_options'
5
5
  require_relative 'game_assets'
6
6
  require_relative 'inventory'
7
7
  require_relative 'entities/item'
8
- require_relative 'entities/items/herb'
9
8
  require_relative 'entities/location'
10
9
  require_relative 'entities/player'
11
10
 
@@ -218,7 +217,7 @@ module Gemwarrior
218
217
  z: floor.nil? ? self.player.cur_coords[:z] : floor.to_i
219
218
  }
220
219
  if self.player.cur_coords.eql?(cur_map_coords)
221
- print '|O|'
220
+ print "|#{'O'.colorize(:cyan)}|"
222
221
  elsif location_by_coords(cur_map_coords)
223
222
  print '|X|'
224
223
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os