natural_20 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,45 @@
1
+ ---
2
+ hit_die: 1d10
3
+ weapon_proficiencies:
4
+ - light_armor
5
+ - medium_armor
6
+ - heavy_armor
7
+ - shields
8
+ - simple
9
+ - martial
10
+ saving_throw_proficiency:
11
+ - str
12
+ - con
13
+ available_skills_choices: 2
14
+ available_skills:
15
+ - acrobatics
16
+ - animal_handling
17
+ - athletics
18
+ - history
19
+ - insight
20
+ - intimidation
21
+ - perception
22
+ - survival
23
+ class_features:
24
+ - second_wind
25
+ proficiency_bonuses:
26
+ - 2
27
+ - 2
28
+ - 2
29
+ - 2
30
+ - 3
31
+ - 3
32
+ - 3
33
+ - 3
34
+ - 4
35
+ - 4
36
+ - 4
37
+ - 4
38
+ - 5
39
+ - 5
40
+ - 5
41
+ - 5
42
+ - 6
43
+ - 6
44
+ - 6
45
+ - 6
@@ -0,0 +1,54 @@
1
+ ---
2
+ available_skills_choices: 4
3
+ available_skills:
4
+ - acrobatics
5
+ - athletics
6
+ - deception
7
+ - insight
8
+ - intimidation
9
+ - investigation
10
+ - perception
11
+ - performance
12
+ - persuasion
13
+ - sleight_of_hand
14
+ - stealth
15
+ class_features:
16
+ - sneak_attack
17
+ hit_die: 1d8
18
+ languages:
19
+ - thieves_cant
20
+ proficiency_bonuses:
21
+ - 2
22
+ - 2
23
+ - 2
24
+ - 2
25
+ - 3
26
+ - 3
27
+ - 3
28
+ - 3
29
+ - 4
30
+ - 4
31
+ - 4
32
+ - 4
33
+ - 5
34
+ - 5
35
+ - 5
36
+ - 5
37
+ - 6
38
+ - 6
39
+ - 6
40
+ - 6
41
+ progression:
42
+ level_2:
43
+ class_features:
44
+ - cunning_action
45
+ saving_throw_proficiency:
46
+ - dex
47
+ - int
48
+ weapon_proficiencies:
49
+ - light_armor
50
+ - longsword
51
+ - simple
52
+ - hand_crossbow
53
+ - rapier
54
+ - shortsword
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: RumbleBelly
3
+ race: halfling
4
+ subrace: lightfoot
5
+ classes:
6
+ rogue: 1
7
+ description: A halfling rogue with a dark past
8
+ level: 1
9
+ hit_die: inherit
10
+ max_hp: 8
11
+ ability:
12
+ str: 11
13
+ dex: 20
14
+ con: 16
15
+ int: 11
16
+ wis: 12
17
+ cha: 17
18
+ skills:
19
+ - acrobatics
20
+ - arcana
21
+ - athletics
22
+ - history
23
+ - perception
24
+ token:
25
+ - R
26
+ tools:
27
+ - thieves_tools
28
+ - carpenters_tools
29
+ weapon_proficiencies:
30
+ - martial
31
+ - simple
32
+ equipped:
33
+ - dagger
34
+ - torch
35
+ - leather
36
+ inventory:
37
+ - type: shortbow
38
+ qty: 1
39
+ - type: dagger
40
+ qty: 1
41
+ - type: arrows
42
+ qty: 20
43
+ - type: thieves_tools
44
+ qty: 1
45
+ - type: healing_potion
46
+ qty: 1
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: Gomerin
3
+ race: elf
4
+ subrace: high_elf
5
+ classes:
6
+ fighter: 1
7
+ description: A high elf fighter seeking for glory
8
+ level: 1
9
+ hit_die: inherit
10
+ max_hp: 10
11
+ ability:
12
+ str: 12
13
+ dex: 20
14
+ con: 16
15
+ int: 16
16
+ wis: 12
17
+ cha: 11
18
+ saving_throw_proficiencies:
19
+ - strength
20
+ - constitution
21
+ attributes:
22
+ - dueling
23
+ skills:
24
+ - acrobatics
25
+ - arcana
26
+ - athletics
27
+ - history
28
+ - perception
29
+ weapon_proficiencies:
30
+ - martial
31
+ - simple
32
+ languages:
33
+ - abyssal
34
+ - celestial
35
+ - goblin
36
+ token:
37
+ - G
38
+ equipped:
39
+ - rapier
40
+ - longbow
41
+ - leather
42
+ - shield
43
+ inventory:
44
+ - type: spear
45
+ qty: 1
46
+ - type: arrows
47
+ qty: 20
48
+ - type: healing_potion
49
+ qty: 1
@@ -0,0 +1,58 @@
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
+ - .##oo.
11
+ - ......
12
+ - ......
13
+ light:
14
+ - ......
15
+ - ..A...
16
+ - ......
17
+ - ......
18
+ - ......
19
+ - ..A...
20
+ - ......
21
+ meta:
22
+ - g....C
23
+ - ......
24
+ - ......
25
+ - ..A..D
26
+ - ......
27
+ - .B...$
28
+ - ......
29
+ lights:
30
+ A:
31
+ bright: 10
32
+ dim: 5
33
+ legend:
34
+ A:
35
+ name: spawn_point_1
36
+ type: spawn_point
37
+ B:
38
+ name: spawn_point_2
39
+ type: spawn_point
40
+ C:
41
+ name: spawn_point_3
42
+ type: spawn_point
43
+ D:
44
+ name: spawn_point_4
45
+ type: spawn_point
46
+ o:
47
+ name: barrel
48
+ type: barrel
49
+ $:
50
+ name: Guard
51
+ type: npc
52
+ sub_type: human_guard
53
+ g:
54
+ name: Krizzit
55
+ type: npc
56
+ sub_type: goblin
57
+ overrides:
58
+ hp: 40
@@ -0,0 +1,30 @@
1
+ name: Natural20::Battle Sim
2
+ description: Map for Natural20::Battle Sim
3
+ map:
4
+ base:
5
+ - ......
6
+ - ......
7
+ - ......
8
+ - ......
9
+ - ......
10
+ - ......
11
+ meta:
12
+ - ....C.
13
+ - ......
14
+ - ......
15
+ - ..AD..
16
+ - ......
17
+ - .B....
18
+ legend:
19
+ A:
20
+ name: spawn_point_1
21
+ type: spawn_point
22
+ B:
23
+ name: spawn_point_2
24
+ type: spawn_point
25
+ C:
26
+ name: spawn_point_3
27
+ type: spawn_point
28
+ D:
29
+ name: spawn_point_4
30
+ type: spawn_point
@@ -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,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,101 @@
1
+ name: Warehouse
2
+ description: Warehouse
3
+ map:
4
+ base:
5
+ - "########"
6
+ - "..wwww.#"
7
+ - "..wwww.#"
8
+ - "#T#www.#"
9
+ - "#=######"
10
+ - "...wwww#"
11
+ - "..pw.ppw"
12
+ - "########"
13
+ base_1:
14
+ - ........
15
+ - ........
16
+ - ..o.....
17
+ - ........
18
+ - ........
19
+ - ........
20
+ - ........
21
+ - ........
22
+ meta:
23
+ - ........
24
+ - A....C..
25
+ - ........
26
+ - ........
27
+ - ........
28
+ - Bg...e#.
29
+ - ........
30
+ - ........
31
+ notes:
32
+ - type: point
33
+ positions:
34
+ - [3, 5]
35
+ - [4, 5]
36
+ - [5, 5]
37
+ notes:
38
+ - note: A pool of stinky water
39
+ - type: rectangle
40
+ positions:
41
+ - [0, 5, 6, 5]
42
+ notes:
43
+ - note: A vile stench fills this room
44
+ legend:
45
+ =:
46
+ name: front_door
47
+ type: wooden_door
48
+ state: closed
49
+ T:
50
+ name: pit_trap
51
+ type: pit_trap
52
+ perception_dc: 20
53
+ p:
54
+ name: pit
55
+ type: bottomless_pit
56
+ w:
57
+ name: Pool of water
58
+ type: water
59
+ o:
60
+ name: barrel
61
+ type: barrel
62
+ A:
63
+ name: spawn_point_1
64
+ type: spawn_point
65
+ B:
66
+ name: spawn_point_2
67
+ type: spawn_point
68
+ C:
69
+ name: spawn_point_3
70
+ type: spawn_point
71
+ e:
72
+ name: Frenabs
73
+ type: npc
74
+ sub_type: goblin
75
+ overrides:
76
+ battle_defaults:
77
+ statuses:
78
+ - hiding
79
+ stealth: 1d20+6
80
+ g:
81
+ name: dead_goblin
82
+ type: npc
83
+ sub_type: goblin
84
+ overrides:
85
+ hp: 0
86
+ notes:
87
+ - note: Dead Goblin!
88
+ highlight: true
89
+ perception_dc: 10
90
+ - if: inventory:wooden_door_key
91
+ note: In his hand is a wooden door key.
92
+ perception_dc: 10
93
+ - note: Remnants of a dead goblin, corpse is still fresh
94
+ - note: Stay away this goblin is a traitor
95
+ language: goblin
96
+ statuses:
97
+ - dead
98
+ inventory:
99
+ - type: wooden_door_key
100
+ label: Key to a wooden door
101
+ qty: 1