natural_20 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +6 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +7 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +99 -0
  9. data/Rakefile +6 -0
  10. data/bin/compute_lights +19 -0
  11. data/bin/console +19 -0
  12. data/bin/nat20 +135 -0
  13. data/bin/nat20.cmd +3 -0
  14. data/bin/nat20author +104 -0
  15. data/bin/setup +8 -0
  16. data/char_classes/fighter.yml +45 -0
  17. data/char_classes/rogue.yml +54 -0
  18. data/characters/halfling_rogue.yml +46 -0
  19. data/characters/high_elf_fighter.yml +49 -0
  20. data/fixtures/battle_sim.yml +58 -0
  21. data/fixtures/battle_sim_2.yml +30 -0
  22. data/fixtures/battle_sim_3.yml +26 -0
  23. data/fixtures/battle_sim_4.yml +26 -0
  24. data/fixtures/battle_sim_objects.yml +101 -0
  25. data/fixtures/corridors.yml +24 -0
  26. data/fixtures/elf_rogue.yml +39 -0
  27. data/fixtures/halfling_rogue.yml +41 -0
  28. data/fixtures/high_elf_fighter.yml +49 -0
  29. data/fixtures/human_fighter.yml +48 -0
  30. data/fixtures/path_finding_test.yml +11 -0
  31. data/fixtures/path_finding_test_2.yml +15 -0
  32. data/fixtures/path_finding_test_3.yml +26 -0
  33. data/fixtures/thin_walls.yml +53 -0
  34. data/fixtures/traps.yml +25 -0
  35. data/game.yml +20 -0
  36. data/items/equipment.yml +101 -0
  37. data/items/objects.yml +73 -0
  38. data/items/weapons.yml +297 -0
  39. data/lib/natural_20.rb +68 -0
  40. data/lib/natural_20/actions/action.rb +40 -0
  41. data/lib/natural_20/actions/attack_action.rb +372 -0
  42. data/lib/natural_20/actions/concerns/action_damage.rb +14 -0
  43. data/lib/natural_20/actions/dash_action.rb +46 -0
  44. data/lib/natural_20/actions/disengage_action.rb +53 -0
  45. data/lib/natural_20/actions/dodge_action.rb +45 -0
  46. data/lib/natural_20/actions/escape_grapple_action.rb +97 -0
  47. data/lib/natural_20/actions/first_aid_action.rb +109 -0
  48. data/lib/natural_20/actions/grapple_action.rb +185 -0
  49. data/lib/natural_20/actions/ground_interact_action.rb +74 -0
  50. data/lib/natural_20/actions/help_action.rb +56 -0
  51. data/lib/natural_20/actions/hide_action.rb +53 -0
  52. data/lib/natural_20/actions/interact_action.rb +91 -0
  53. data/lib/natural_20/actions/inventory_action.rb +23 -0
  54. data/lib/natural_20/actions/look_action.rb +63 -0
  55. data/lib/natural_20/actions/move_action.rb +254 -0
  56. data/lib/natural_20/actions/multiattack_action.rb +41 -0
  57. data/lib/natural_20/actions/prone_action.rb +38 -0
  58. data/lib/natural_20/actions/short_rest_action.rb +53 -0
  59. data/lib/natural_20/actions/shove_action.rb +142 -0
  60. data/lib/natural_20/actions/stand_action.rb +47 -0
  61. data/lib/natural_20/actions/use_item_action.rb +57 -0
  62. data/lib/natural_20/ai_controller/path_compute.rb +140 -0
  63. data/lib/natural_20/ai_controller/standard.rb +288 -0
  64. data/lib/natural_20/battle.rb +544 -0
  65. data/lib/natural_20/battle_map.rb +843 -0
  66. data/lib/natural_20/cli/builder/fighter_builder.rb +104 -0
  67. data/lib/natural_20/cli/builder/rogue_builder.rb +62 -0
  68. data/lib/natural_20/cli/character_builder.rb +210 -0
  69. data/lib/natural_20/cli/commandline_ui.rb +612 -0
  70. data/lib/natural_20/cli/inventory_ui.rb +136 -0
  71. data/lib/natural_20/cli/map_renderer.rb +165 -0
  72. data/lib/natural_20/concerns/container.rb +32 -0
  73. data/lib/natural_20/concerns/entity.rb +1213 -0
  74. data/lib/natural_20/concerns/evaluator/entity_state_evaluator.rb +59 -0
  75. data/lib/natural_20/concerns/fighter_actions/second_wind_action.rb +51 -0
  76. data/lib/natural_20/concerns/fighter_class.rb +35 -0
  77. data/lib/natural_20/concerns/health_flavor.rb +27 -0
  78. data/lib/natural_20/concerns/lootable.rb +94 -0
  79. data/lib/natural_20/concerns/movement_helper.rb +195 -0
  80. data/lib/natural_20/concerns/multiattack.rb +54 -0
  81. data/lib/natural_20/concerns/navigation.rb +87 -0
  82. data/lib/natural_20/concerns/notable.rb +37 -0
  83. data/lib/natural_20/concerns/rogue_class.rb +26 -0
  84. data/lib/natural_20/controller.rb +11 -0
  85. data/lib/natural_20/die_roll.rb +331 -0
  86. data/lib/natural_20/event_manager.rb +288 -0
  87. data/lib/natural_20/item_library/base_item.rb +27 -0
  88. data/lib/natural_20/item_library/chest.rb +230 -0
  89. data/lib/natural_20/item_library/door_object.rb +189 -0
  90. data/lib/natural_20/item_library/ground.rb +124 -0
  91. data/lib/natural_20/item_library/healing_potion.rb +51 -0
  92. data/lib/natural_20/item_library/object.rb +153 -0
  93. data/lib/natural_20/item_library/pit_trap.rb +69 -0
  94. data/lib/natural_20/item_library/stone_wall.rb +18 -0
  95. data/lib/natural_20/npc.rb +173 -0
  96. data/lib/natural_20/player_character.rb +414 -0
  97. data/lib/natural_20/session.rb +168 -0
  98. data/lib/natural_20/utils/cover.rb +35 -0
  99. data/lib/natural_20/utils/ray_tracer.rb +90 -0
  100. data/lib/natural_20/utils/static_light_builder.rb +72 -0
  101. data/lib/natural_20/utils/weapons.rb +78 -0
  102. data/lib/natural_20/version.rb +4 -0
  103. data/locales/en.yml +304 -0
  104. data/maps/game_map.yml +168 -0
  105. data/natural_20.gemspec +46 -0
  106. data/npcs/goblin.yml +64 -0
  107. data/npcs/human_guard.yml +48 -0
  108. data/npcs/ogre.yml +61 -0
  109. data/npcs/owlbear.yml +55 -0
  110. data/npcs/wolf.yml +46 -0
  111. data/races/elf.yml +44 -0
  112. data/races/halfling.yml +22 -0
  113. data/races/human.yml +13 -0
  114. metadata +373 -0
@@ -0,0 +1,24 @@
1
+ name: Natural20::Battle Sim
2
+ description: Map for Natural20::Battle Sim
3
+ map:
4
+ illumination: 0.0
5
+ base:
6
+ - ......
7
+ - ......
8
+ - ......
9
+ - ......
10
+ - '######'
11
+ - ......
12
+ - '######'
13
+ meta:
14
+ - ......
15
+ - ......
16
+ - ......
17
+ - ......
18
+ - ......
19
+ - A.....
20
+ - ......
21
+ legend:
22
+ A:
23
+ name: spawn_point_1
24
+ type: spawn_point
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: GrumbleBelly
3
+ race: elf
4
+ subrace: high_elf
5
+ classes:
6
+ rogue: 1
7
+ level: 1
8
+ hit_die: inherit
9
+ max_hp: 67
10
+ ability:
11
+ str: 11
12
+ dex: 20
13
+ con: 16
14
+ int: 11
15
+ wis: 12
16
+ cha: 17
17
+ class_features:
18
+ - cunning_action
19
+ - sneak_attack
20
+ skills:
21
+ - acrobatics
22
+ - arcana
23
+ - athletics
24
+ - history
25
+ - perception
26
+ tools:
27
+ - thieves_tools
28
+ - carpenters_tools
29
+ weapon_proficiencies:
30
+ - simple
31
+ equipped:
32
+ - dagger
33
+ - torch
34
+ - studded_leather
35
+ inventory:
36
+ - type: arrows
37
+ qty: 20
38
+ - type: thieves_tools
39
+ qty: 1
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: RumbleBelly
3
+ race: halfling
4
+ subrace: lightfoot
5
+ classes:
6
+ rogue: 1
7
+ level: 1
8
+ hit_die: inherit
9
+ max_hp: 67
10
+ ability:
11
+ str: 11
12
+ dex: 20
13
+ con: 16
14
+ int: 11
15
+ wis: 12
16
+ cha: 17
17
+ class_features:
18
+ - cunning_action
19
+ skills:
20
+ - acrobatics
21
+ - arcana
22
+ - athletics
23
+ - history
24
+ - perception
25
+ expertise:
26
+ - stealth
27
+ - thieves_tools
28
+ tools:
29
+ - thieves_tools
30
+ - carpenters_tools
31
+ weapon_proficiencies:
32
+ - simple
33
+ equipped:
34
+ - dagger
35
+ - torch
36
+ - studded_leather
37
+ inventory:
38
+ - type: arrows
39
+ qty: 20
40
+ - type: thieves_tools
41
+ qty: 1
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: Gomerin
3
+ race: elf
4
+ subrace: high_elf
5
+ classes:
6
+ fighter: 1
7
+ level: 7
8
+ hit_die: inherit
9
+ max_hp: 67
10
+ ability:
11
+ str: 12
12
+ dex: 20
13
+ con: 16
14
+ int: 16
15
+ wis: 12
16
+ cha: 11
17
+ saving_throw_proficiencies:
18
+ - strength
19
+ - constitution
20
+ class_features:
21
+ - dueling
22
+ - second_wind
23
+ skills:
24
+ - acrobatics
25
+ - arcana
26
+ - athletics
27
+ - history
28
+ - perception
29
+ languages:
30
+ - abyssal
31
+ - celestial
32
+ - common
33
+ - elvish
34
+ - goblin
35
+ equipped:
36
+ - vicious_rapier
37
+ - longbow
38
+ - studded_leather
39
+ - shield
40
+ expertise:
41
+ - stealth
42
+ - thieves_tools
43
+ inventory:
44
+ - type: shield
45
+ qty: 1
46
+ - type: arrows
47
+ qty: 20
48
+ - type: healing_potion
49
+ qty: 1
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: Meringo
3
+ race: human
4
+ classes:
5
+ fighter: 1
6
+ level: 7
7
+ hit_die: inherit
8
+ max_hp: 67
9
+ ability:
10
+ str: 12
11
+ dex: 20
12
+ con: 16
13
+ int: 16
14
+ wis: 12
15
+ cha: 11
16
+ saving_throw_proficiencies:
17
+ - strength
18
+ - constitution
19
+ class_features:
20
+ - dueling
21
+ - second_wind
22
+ skills:
23
+ - acrobatics
24
+ - arcana
25
+ - athletics
26
+ - history
27
+ - perception
28
+ languages:
29
+ - abyssal
30
+ - celestial
31
+ - common
32
+ - elvish
33
+ - goblin
34
+ equipped:
35
+ - vicious_rapier
36
+ - longbow
37
+ - studded_leather
38
+ - shield
39
+ expertise:
40
+ - stealth
41
+ - thieves_tools
42
+ inventory:
43
+ - type: shield
44
+ qty: 1
45
+ - type: arrows
46
+ qty: 20
47
+ - type: healing_potion
48
+ qty: 1
@@ -0,0 +1,11 @@
1
+ name: Natural20::Battle Sim
2
+ description: Map for Natural20::Battle Sim
3
+ map:
4
+ base:
5
+ - ........
6
+ - ....#...
7
+ - ...##...
8
+ - ....#...
9
+ - ........
10
+ - .######.
11
+ - ........
@@ -0,0 +1,15 @@
1
+ name: Natural20::Battle Sim
2
+ description: Map for Natural20::Battle Sim
3
+ map:
4
+ base:
5
+ - ........
6
+ - ........
7
+ - ........
8
+ - ..www...
9
+ - ..www...
10
+ - ........
11
+ - ........
12
+ legend:
13
+ w:
14
+ name: Pool of water
15
+ type: water
@@ -0,0 +1,26 @@
1
+ name: Ogre Den
2
+ description: Map for Natural20::Battle Sim
3
+ map:
4
+ base:
5
+ - '#######'
6
+ - '......#'
7
+ - '....#.#'
8
+ - '#####.#'
9
+ - '....#.#'
10
+ - '......#'
11
+ - '.......'
12
+ meta:
13
+ - .......
14
+ - A......
15
+ - .......
16
+ - .......
17
+ - .......
18
+ - B......
19
+ - .......
20
+ legend:
21
+ A:
22
+ name: spawn_point_1
23
+ type: spawn_point
24
+ B:
25
+ name: spawn_point_2
26
+ type: spawn_point
@@ -0,0 +1,53 @@
1
+ name: Natural20::Battle Sim
2
+ description: Map for thin walls
3
+ map:
4
+ illumination: 0.0
5
+ base:
6
+ - ......
7
+ - ......
8
+ - ......
9
+ - ......
10
+ - ......
11
+ - ......
12
+ light:
13
+ - ......
14
+ - ..A...
15
+ - ......
16
+ - ......
17
+ - ......
18
+ - ..A...
19
+ meta:
20
+ - g....C
21
+ - ......
22
+ - ......
23
+ - ..A..D
24
+ - ......
25
+ - .B...$
26
+ lights:
27
+ A:
28
+ bright: 10
29
+ dim: 5
30
+ legend:
31
+ A:
32
+ name: spawn_point_1
33
+ type: spawn_point
34
+ B:
35
+ name: spawn_point_2
36
+ type: spawn_point
37
+ C:
38
+ name: spawn_point_3
39
+ type: spawn_point
40
+ D:
41
+ name: spawn_point_4
42
+ type: spawn_point
43
+
44
+ $:
45
+ name: Guard
46
+ type: npc
47
+ sub_type: human_guard
48
+ g:
49
+ name: Krizzit
50
+ type: npc
51
+ sub_type: goblin
52
+ overrides:
53
+ hp: 40
@@ -0,0 +1,25 @@
1
+ name: Natural20::Battle Sim
2
+ description: Map for Natural20::Battle Sim
3
+ map:
4
+ base:
5
+ - ......
6
+ - ......
7
+ - ......
8
+ - .T....
9
+ - ......
10
+ - ......
11
+ meta:
12
+ - ......
13
+ - ......
14
+ - ......
15
+ - A.....
16
+ - ......
17
+ - ......
18
+ legend:
19
+ A:
20
+ name: spawn_point_1
21
+ type: spawn_point
22
+ T:
23
+ name: pit_trap
24
+ type: pit_trap
25
+ perception_dc: 20
data/game.yml ADDED
@@ -0,0 +1,20 @@
1
+ name: Rise of the Ruby Collective
2
+ title:
3
+ -
4
+ - ██▀███ ██▓ ██████ ▓█████ ▒█████ █████▒ ▄▄▄█████▓ ██░ ██ ▓█████ ██▀███ █ ██ ▄▄▄▄ ▓██ ██▓ ▄████▄ ▒█████ ██▓ ██▓ ▓█████ ▄████▄ ▄▄▄█████▓ ██▓ ██▒ █▓▓█████
5
+ - ▓██ ▒ ██▒▓██▒▒██ ▒ ▓█ ▀ ▒██▒ ██▒▓██ ▒ ▓ ██▒ ▓▒▓██░ ██▒▓█ ▀ ▓██ ▒ ██▒ ██ ▓██▒▓█████▄ ▒██ ██▒ ▒██▀ ▀█ ▒██▒ ██▒▓██▒ ▓██▒ ▓█ ▀ ▒██▀ ▀█ ▓ ██▒ ▓▒▓██▒▓██░ █▒▓█ ▀
6
+ - ▓██ ░▄█ ▒▒██▒░ ▓██▄ ▒███ ▒██░ ██▒▒████ ░ ▒ ▓██░ ▒░▒██▀▀██░▒███ ▓██ ░▄█ ▒▓██ ▒██░▒██▒ ▄██ ▒██ ██░ ▒▓█ ▄ ▒██░ ██▒▒██░ ▒██░ ▒███ ▒▓█ ▄ ▒ ▓██░ ▒░▒██▒ ▓██ █▒░▒███
7
+ - ▒██▀▀█▄ ░██░ ▒ ██▒▒▓█ ▄ ▒██ ██░░▓█▒ ░ ░ ▓██▓ ░ ░▓█ ░██ ▒▓█ ▄ ▒██▀▀█▄ ▓▓█ ░██░▒██░█▀ ░ ▐██▓░ ▒▓▓▄ ▄██▒▒██ ██░▒██░ ▒██░ ▒▓█ ▄ ▒▓▓▄ ▄██▒░ ▓██▓ ░ ░██░ ▒██ █░░▒▓█ ▄
8
+ - ░██▓ ▒██▒░██░▒██████▒▒░▒████▒ ░ ████▓▒░░▒█░ ▒██▒ ░ ░▓█▒░██▓░▒████▒ ░██▓ ▒██▒▒▒█████▓ ░▓█ ▀█▓ ░ ██▒▓░ ▒ ▓███▀ ░░ ████▓▒░░██████▒░██████▒░▒████▒▒ ▓███▀ ░ ▒██▒ ░ ░██░ ▒▀█░ ░▒████▒
9
+ - ░ ▒▓ ░▒▓░░▓ ▒ ▒▓▒ ▒ ░░░ ▒░ ░ ░ ▒░▒░▒░ ▒ ░ ▒ ░░ ▒ ░░▒░▒░░ ▒░ ░ ░ ▒▓ ░▒▓░░▒▓▒ ▒ ▒ ░▒▓███▀▒ ██▒▒▒ ░ ░▒ ▒ ░░ ▒░▒░▒░ ░ ▒░▓ ░░ ▒░▓ ░░░ ▒░ ░░ ░▒ ▒ ░ ▒ ░░ ░▓ ░ ▐░ ░░ ▒░ ░
10
+ - ░▒ ░ ▒░ ▒ ░░ ░▒ ░ ░ ░ ░ ░ ░ ▒ ▒░ ░ ░ ▒ ░▒░ ░ ░ ░ ░ ░▒ ░ ▒░░░▒░ ░ ░ ▒░▒ ░ ▓██ ░▒░ ░ ▒ ░ ▒ ▒░ ░ ░ ▒ ░░ ░ ▒ ░ ░ ░ ░ ░ ▒ ░ ▒ ░ ░ ░░ ░ ░ ░
11
+ - ░░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░░ ░ ░ ░░ ░ ░░░ ░ ░ ░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░░ ░
12
+ - ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░
13
+ - ░ ░ ░ ░ ░ ░
14
+ -
15
+ title_color: red
16
+ description: A sample hardcore dungeon crawl with a party of 2 (DnD 5th Edition rules)
17
+ author: Joseph Emmanuel Dayo
18
+ players: 2
19
+ starting_map: maps/game_map
20
+ player_profiles: characters
@@ -0,0 +1,101 @@
1
+ ---
2
+ arrows:
3
+ cost: 0.05
4
+ name: Arrows
5
+ type: ammunition
6
+ weight: 0.05
7
+ bolts:
8
+ cost: 0.05
9
+ name: Crossbow Bolts
10
+ type: ammunition
11
+ weight: 0.05
12
+ chain_mail:
13
+ ac: 16
14
+ cost: 75
15
+ name: Chain Mail
16
+ subtype: heavy
17
+ type: armor
18
+ weight: 55
19
+ chain_shirt:
20
+ ac: 13
21
+ cost: 50
22
+ mod_cap: 2
23
+ name: Chain Shirt
24
+ subtype: light
25
+ type: armor
26
+ weight: 13
27
+ copper_piece:
28
+ cost: 0.01
29
+ name: Copper Piece (cp)
30
+ type: currency
31
+ weight: 0.02
32
+ electronum:
33
+ cost: 0.5
34
+ name: Electronum (ep)
35
+ type: currency
36
+ weight: 0.02
37
+ gold_piece:
38
+ cost: 1
39
+ name: Gold Piece (gp)
40
+ type: currency
41
+ weight: 0.02
42
+ healing_potion:
43
+ consumable: true
44
+ hp_regained: 2d4+2
45
+ item_class: ItemLibrary::HealingPotion
46
+ name: Potion of Healing
47
+ type: potion
48
+ usable: true
49
+ leather:
50
+ ac: 11
51
+ cost: 10
52
+ name: Leather
53
+ subtype: light
54
+ type: armor
55
+ weight: 10
56
+ padded:
57
+ ac: 11
58
+ cost: 5
59
+ disadvantage:
60
+ - stealth
61
+ name: Padded Armor
62
+ subtype: light
63
+ type: armor
64
+ weight: 8
65
+ platinum:
66
+ cost: 10
67
+ name: platinum (pp)
68
+ type: currency
69
+ weight: 0.02
70
+ ruby_gem:
71
+ cost: 5000
72
+ name: Ruby Gemstone
73
+ type: gemstone
74
+ weight: 1
75
+ shield:
76
+ bonus_ac: 2
77
+ name: Shield
78
+ type: shield
79
+ weight: 6
80
+ silver_piece:
81
+ cost: 0.1
82
+ name: Silver Piece (sp)
83
+ type: currency
84
+ weight: 0.02
85
+ studded_leather:
86
+ ac: 12
87
+ cost: 45
88
+ name: Studded Leather
89
+ subtype: light
90
+ type: armor
91
+ weight: 13
92
+ thieves_tools:
93
+ cost: 25
94
+ name: Thieves Tools
95
+ type: tool
96
+ weight: 1
97
+ wooden_door_key:
98
+ cost: 0.05
99
+ name: Wooden Door Key
100
+ type: tool
101
+ weight: 0.05