natural_20 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +13 -0
  4. data/README.md +1 -0
  5. data/bin/nat20 +2 -1
  6. data/bin/nat20.cmd +0 -0
  7. data/char_classes/wizard.yml +89 -0
  8. data/characters/high_elf_mage.yml +27 -0
  9. data/fixtures/battle_sim_objects.yml +2 -2
  10. data/fixtures/high_elf_mage.yml +28 -0
  11. data/fixtures/large_map.yml +63 -0
  12. data/game.yml +2 -2
  13. data/items/equipment.yml +30 -0
  14. data/items/objects.yml +33 -29
  15. data/items/spells.yml +58 -0
  16. data/items/weapons.yml +78 -18
  17. data/lib/CHANGELOG.md +0 -0
  18. data/lib/natural_20.rb +9 -0
  19. data/lib/natural_20/actions/action.rb +2 -2
  20. data/lib/natural_20/actions/attack_action.rb +76 -67
  21. data/lib/natural_20/actions/concerns/action_damage.rb +3 -1
  22. data/lib/natural_20/actions/dash_action.rb +7 -10
  23. data/lib/natural_20/actions/disengage_action.rb +11 -12
  24. data/lib/natural_20/actions/dodge_action.rb +7 -8
  25. data/lib/natural_20/actions/escape_grapple_action.rb +16 -18
  26. data/lib/natural_20/actions/first_aid_action.rb +14 -16
  27. data/lib/natural_20/actions/grapple_action.rb +24 -28
  28. data/lib/natural_20/actions/ground_interact_action.rb +1 -3
  29. data/lib/natural_20/actions/help_action.rb +13 -16
  30. data/lib/natural_20/actions/hide_action.rb +7 -9
  31. data/lib/natural_20/actions/interact_action.rb +12 -14
  32. data/lib/natural_20/actions/look_action.rb +14 -15
  33. data/lib/natural_20/actions/move_action.rb +9 -9
  34. data/lib/natural_20/actions/multiattack_action.rb +8 -9
  35. data/lib/natural_20/actions/prone_action.rb +4 -6
  36. data/lib/natural_20/actions/short_rest_action.rb +7 -8
  37. data/lib/natural_20/actions/shove_action.rb +20 -24
  38. data/lib/natural_20/actions/spell_action.rb +89 -0
  39. data/lib/natural_20/actions/stand_action.rb +5 -7
  40. data/lib/natural_20/actions/use_item_action.rb +7 -9
  41. data/lib/natural_20/ai_controller/standard.rb +1 -1
  42. data/lib/natural_20/battle.rb +8 -3
  43. data/lib/natural_20/cli/action_ui.rb +180 -0
  44. data/lib/natural_20/cli/builder/fighter_builder.rb +1 -1
  45. data/lib/natural_20/cli/builder/rogue_builder.rb +10 -10
  46. data/lib/natural_20/cli/builder/wizard_builder.rb +77 -0
  47. data/lib/natural_20/cli/character_builder.rb +9 -4
  48. data/lib/natural_20/cli/commandline_ui.rb +55 -162
  49. data/lib/natural_20/cli/inventory_ui.rb +4 -0
  50. data/lib/natural_20/cli/map_renderer.rb +7 -1
  51. data/lib/natural_20/concerns/attack_helper.rb +53 -0
  52. data/lib/natural_20/concerns/entity.rb +170 -11
  53. data/lib/natural_20/concerns/fighter_actions/second_wind_action.rb +7 -9
  54. data/lib/natural_20/concerns/fighter_class.rb +2 -2
  55. data/lib/natural_20/concerns/spell_attack_helper.rb +33 -0
  56. data/lib/natural_20/concerns/wizard_class.rb +86 -0
  57. data/lib/natural_20/die_roll.rb +2 -2
  58. data/lib/natural_20/event_manager.rb +50 -44
  59. data/lib/natural_20/item_library/base_item.rb +1 -1
  60. data/lib/natural_20/npc.rb +4 -0
  61. data/lib/natural_20/player_character.rb +75 -12
  62. data/lib/natural_20/session.rb +14 -1
  63. data/lib/natural_20/spell_library/firebolt.rb +72 -0
  64. data/lib/natural_20/spell_library/mage_armor.rb +67 -0
  65. data/lib/natural_20/spell_library/mage_hand.rb +2 -0
  66. data/lib/natural_20/spell_library/magic_missile.rb +67 -0
  67. data/lib/natural_20/spell_library/shield.rb +69 -0
  68. data/lib/natural_20/spell_library/spell.rb +31 -0
  69. data/lib/natural_20/utils/weapons.rb +8 -6
  70. data/lib/natural_20/version.rb +1 -1
  71. data/locales/en.yml +44 -8
  72. data/maps/game_map.yml +12 -2
  73. metadata +22 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e33ce92d3b1d8ebf75e0262bb56ab3e990702897632c2ebdb476e814d8abfe4a
4
- data.tar.gz: c3aa5ca94f3d587466f4ec93fd44c05a58af2f009cd58cdf50f36b9e9be1bd75
3
+ metadata.gz: 5950f7a0ac3d6dabc24e5bc22102607e62928f3d1f540ad5e7e9d972cf645261
4
+ data.tar.gz: 400ce63c4fa8f6ab2cf6587739558bb10fd1c14237b4d7eb918c27825efb03f0
5
5
  SHA512:
6
- metadata.gz: 568d09d82b1bdfb16696f19082e673ce540f01ff9688ec8293898685497df8c14c4b8f29ccb42ec6b2d7c0e971645074f05a282dd76e347acf0e45b7744fb95f
7
- data.tar.gz: a2896d2bc69e40345675a7b4243b18b72562266ee39c32017ea420b00b68d996f12e0fbe410fc0fa10383dfdcc205a0be7c7d70f044605460281275f8b1b59dc
6
+ metadata.gz: 0c5e8ec2abbcce7e71d3bf07508e3c0300a5a8254adec90199b4e9d7f74e31d919d5f0b722582af527441ec52225ca1f2abd2094973421005641991f0fa9eec9
7
+ data.tar.gz: 51a26d11e57ea3db3acd565d069f8a804408da02c35ae6a857462298aef6aec114f47e9f3c3679e729020e485faa55a647e5457e7ff60b126ee41d431f617d48
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  /tmp/
9
9
  savegame.yml
10
10
  Gemfile.lock
11
+ *.gem
11
12
 
12
13
  # rspec failure tracking
13
14
  .rspec_status
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2021-02-12
9
+
10
+ ### Added
11
+
12
+ - Added support for the Wizard class
13
+ - Rudimentary support for spells
data/README.md CHANGED
@@ -22,6 +22,7 @@ Features:
22
22
  Supported Classes;
23
23
  - Fighter
24
24
  - Rogue
25
+ - Wizard
25
26
  - More to come
26
27
 
27
28
  ## Installation
data/bin/nat20 CHANGED
@@ -16,7 +16,7 @@ require 'irb/completion'
16
16
  Natural20::EventManager.standard_cli
17
17
 
18
18
  def t(token, options = {})
19
- I18n.t(token, options)
19
+ I18n.t(token, **options)
20
20
  end
21
21
 
22
22
  def training_dummy
@@ -78,6 +78,7 @@ end
78
78
 
79
79
  def continue_game
80
80
  battle = @session.load_save
81
+ Natural20::Session.set_session(battle.session)
81
82
  command_line = CommandlineUI.new(battle, battle.map)
82
83
  command_line.game_loop
83
84
  end
data/bin/nat20.cmd CHANGED
File without changes
@@ -0,0 +1,89 @@
1
+ ---
2
+ hit_die: 1d6
3
+ weapon_proficiencies:
4
+ - dagger
5
+ - dart
6
+ - sling
7
+ - quarterstaff
8
+ - light_crossbow
9
+ saving_throw_proficiency:
10
+ - int
11
+ - wis
12
+ available_skills_choices: 2
13
+ available_skills:
14
+ - arcana
15
+ - history
16
+ - insight
17
+ - investigation
18
+ - medicine
19
+ - religion
20
+ spell_list:
21
+ cantrip:
22
+ - acid_splash
23
+ - blade_ward
24
+ - chill_touch
25
+ - dancing_lights
26
+ - firebolt
27
+ - friends
28
+ - light
29
+ - mage_hand
30
+ - mending
31
+ - message
32
+ - minor_illusion
33
+ - poison_spray
34
+ - prestidigitation
35
+ - ray_of_frost
36
+ - shocking_grasp
37
+ - true_strike
38
+ level_1:
39
+ - alarm
40
+ - burning_hands
41
+ - charm_person
42
+ - chromatic_orb
43
+ - color_spray
44
+ - comprehend_languages
45
+ - detect_magic
46
+ - disguise_self
47
+ - expeditious_retreat
48
+ - false_life
49
+ - feather_fall
50
+ - find_familiar
51
+ - fog_cloud
52
+ - grease
53
+ - identify
54
+ - illusory_script
55
+ - jump
56
+ - longstrider
57
+ - mage_armor
58
+ - magic_missile
59
+ - protect_from_evil_and_good
60
+ - ray_of_sickness
61
+ - shield
62
+ - silent_image
63
+ - sleep
64
+ - tasha_hideous_laughter
65
+ - tensers_floating_disk
66
+ - thunderwave
67
+ - unseen_servant
68
+ - witch_bolt
69
+ proficiency_bonuses:
70
+ - 2
71
+ - 2
72
+ - 2
73
+ - 2
74
+ - 3
75
+ - 3
76
+ - 3
77
+ - 3
78
+ - 4
79
+ - 4
80
+ - 4
81
+ - 4
82
+ - 5
83
+ - 5
84
+ - 5
85
+ - 5
86
+ - 6
87
+ - 6
88
+ - 6
89
+ - 6
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Crysania
3
+ race: elf
4
+ subrace: high_elf
5
+ classes:
6
+ wizard: 1
7
+ description: A high elf mage with a mysterious noble background
8
+ level: 1
9
+ hit_die: inherit
10
+ max_hp: 6
11
+ ability:
12
+ str: 10
13
+ dex: 15
14
+ con: 14
15
+ int: 18
16
+ wis: 12
17
+ cha: 8
18
+ spellbook:
19
+ - firebolt
20
+ - mage_armor
21
+ - magic_missile
22
+ prepared_spells:
23
+ - firebolt
24
+ - mage_armor
25
+ - magic_missile
26
+ equipped:
27
+ - dagger
@@ -5,7 +5,7 @@ map:
5
5
  - "########"
6
6
  - "..wwww.#"
7
7
  - "..wwww.#"
8
- - "#T#www.#"
8
+ - "#.#www.#"
9
9
  - "#=######"
10
10
  - "...wwww#"
11
11
  - "..pw.ppw"
@@ -14,7 +14,7 @@ map:
14
14
  - ........
15
15
  - ........
16
16
  - ..o.....
17
- - ........
17
+ - .T......
18
18
  - ........
19
19
  - ........
20
20
  - ........
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Crysania
3
+ race: elf
4
+ subrace: high_elf
5
+ classes:
6
+ wizard: 1
7
+ description: A high elf mage
8
+ level: 1
9
+ hit_die: inherit
10
+ max_hp: 6
11
+ ability:
12
+ str: 10
13
+ dex: 15
14
+ con: 14
15
+ int: 18
16
+ wis: 12
17
+ cha: 8
18
+ spellbook:
19
+ - firebolt
20
+ - shield
21
+ - mage_armor
22
+ - magic_missile
23
+ prepared_spells:
24
+ - firebolt
25
+ - mage_armor
26
+ - magic_missile
27
+ - shield
28
+ - magic_missile
@@ -0,0 +1,63 @@
1
+ ---
2
+ :name: goblin_ambush
3
+ :description: Map for goblin_ambush
4
+ :map:
5
+ :illumination: 1.0
6
+ :base:
7
+ - "...........TTTT....T....TTT..."
8
+ - "........TTTTTTTTT.....TTTT...."
9
+ - ".......TTTTTTTTTT....TTTT....."
10
+ - ".........TTTTTTT......TT......"
11
+ - "------------------------------"
12
+ - ".............................."
13
+ - ".............................."
14
+ - ".............................."
15
+ - "------------------------------"
16
+ - "............T................."
17
+ - "....T....TTTTTTT..T..TTTTTT..."
18
+ - "..........TTTTTT......TTTT...."
19
+ - "........TTTTTTT.....TTTTTTTT.."
20
+ - ".............................."
21
+ - ".............................."
22
+ - ".............................."
23
+ :meta:
24
+ - "..........................g..."
25
+ - ".............................."
26
+ - ".............................."
27
+ - "...........g.................."
28
+ - "?............................."
29
+ - ".1.2.........................."
30
+ - ".............................."
31
+ - ".3.4.........................."
32
+ - "?............................."
33
+ - ".............................."
34
+ - ".............................."
35
+ - ".............................."
36
+ - ".............................."
37
+ - "........g................g...."
38
+ - ".............................."
39
+ - ".............................."
40
+ :legend:
41
+ T:
42
+ :name: Woods
43
+ type: tree
44
+ :g:
45
+ :name: Stivnux
46
+ :type: npc
47
+ :sub_type: goblin
48
+ '-':
49
+ :name: Trail Marking
50
+ :type: ground
51
+ color: brown
52
+ '1':
53
+ :name: spawn_point_1
54
+ :type: spawn_point
55
+ '2':
56
+ :name: spawn_point_2
57
+ :type: spawn_point
58
+ '3':
59
+ :name: spawn_point_3
60
+ :type: spawn_point
61
+ '4':
62
+ :name: spawn_point_4
63
+ :type: spawn_point
data/game.yml CHANGED
@@ -13,8 +13,8 @@ title:
13
13
  - ░ ░ ░ ░ ░ ░
14
14
  -
15
15
  title_color: red
16
- description: A sample hardcore dungeon crawl with a party of 2 (DnD 5th Edition rules)
16
+ description: A sample hardcore dungeon crawl with a party of 3 (DnD 5th Edition rules)
17
17
  author: Joseph Emmanuel Dayo
18
- players: 2
18
+ players: 3
19
19
  starting_map: maps/game_map
20
20
  player_profiles: characters
data/items/equipment.yml CHANGED
@@ -24,11 +24,21 @@ chain_shirt:
24
24
  subtype: light
25
25
  type: armor
26
26
  weight: 13
27
+ component_pouch:
28
+ cost: 25
29
+ name: Component Pouch
30
+ type: other
31
+ weight: 2
27
32
  copper_piece:
28
33
  cost: 0.01
29
34
  name: Copper Piece (cp)
30
35
  type: currency
31
36
  weight: 0.02
37
+ crystal:
38
+ cost: 10
39
+ name: Crystal
40
+ type: arcane_focus
41
+ weight: 1
32
42
  electronum:
33
43
  cost: 0.5
34
44
  name: Electronum (ep)
@@ -53,6 +63,11 @@ leather:
53
63
  subtype: light
54
64
  type: armor
55
65
  weight: 10
66
+ orb:
67
+ cost: 20
68
+ name: Orb
69
+ type: arcane_focus
70
+ weight: 3
56
71
  padded:
57
72
  ac: 11
58
73
  cost: 5
@@ -67,6 +82,11 @@ platinum:
67
82
  name: platinum (pp)
68
83
  type: currency
69
84
  weight: 0.02
85
+ rod:
86
+ cost: 10
87
+ name: Rod
88
+ type: arcane_focus
89
+ weight: 2
70
90
  ruby_gem:
71
91
  cost: 5000
72
92
  name: Ruby Gemstone
@@ -82,6 +102,11 @@ silver_piece:
82
102
  name: Silver Piece (sp)
83
103
  type: currency
84
104
  weight: 0.02
105
+ staff:
106
+ cost: 5
107
+ name: Staff
108
+ type: arcane_focus
109
+ weight: 4
85
110
  studded_leather:
86
111
  ac: 12
87
112
  cost: 45
@@ -94,6 +119,11 @@ thieves_tools:
94
119
  name: Thieves Tools
95
120
  type: tool
96
121
  weight: 1
122
+ wand:
123
+ cost: 10
124
+ name: Wand
125
+ type: arcane_focus
126
+ weight: 1
97
127
  wooden_door_key:
98
128
  cost: 0.05
99
129
  name: Wooden Door Key
data/items/objects.yml CHANGED
@@ -20,24 +20,40 @@ bottomless_pit:
20
20
  brazier:
21
21
  color: yellow
22
22
  default_ac: 17
23
- max_hp: 27
24
- passable: true
25
- placeable: false
26
23
  light:
27
24
  bright: 20
28
25
  dim: 10
26
+ max_hp: 27
27
+ passable: true
28
+ placeable: false
29
29
  token:
30
30
  - Ý
31
+ briar:
32
+ allow_hide: true
33
+ color: green
34
+ cover: half
35
+ default_ac: 10
36
+ hp_die: 1d4
37
+ max_hp: 4
38
+ movement_cost: 2
39
+ passable: true
40
+ placeable: true
41
+ token:
42
+ - ▓
31
43
  chest:
32
44
  color: yellow
33
- item_class: 'ItemLibrary::Chest'
45
+ item_class: ItemLibrary::Chest
34
46
  name: Treasure Chest
35
47
  passable: true
36
48
  placeable: false
49
+ ground:
50
+ passable: true
51
+ placeable: true
52
+ token: inherit
37
53
  pit_trap:
38
54
  damage_die: 1d10
39
55
  damage_type: piercing
40
- item_class: 'ItemLibrary::PitTrap'
56
+ item_class: ItemLibrary::PitTrap
41
57
  name: Pit Trap
42
58
  notes:
43
59
  - highlight: true
@@ -46,7 +62,7 @@ pit_trap:
46
62
  stone_wall:
47
63
  color: light_magenta
48
64
  default_ac: 17
49
- item_class: 'ItemLibrary::StoneWall'
65
+ item_class: ItemLibrary::StoneWall
50
66
  max_hp: 27
51
67
  name: Stone Wall
52
68
  opaque: true
@@ -54,42 +70,30 @@ stone_wall:
54
70
  token:
55
71
  - null
56
72
  wall: true
57
- water:
58
- color: blue
59
- movement_cost: 2
60
- name: Water
61
- passable: true
62
- token:
63
- - ^
64
- briar:
65
- color: green
66
- passable: true
67
- placeable: true
68
- movement_cost: 2
69
- cover: half
70
- default_ac: 10
71
- hp_die: 1d4
72
- max_hp: 4
73
- allow_hide: true
74
- token:
75
- - ▓
76
73
  tree:
74
+ allow_hide: true
77
75
  color: green
78
- passable: true
79
- placeable: true
80
76
  cover: half
81
77
  default_ac: 10
82
78
  hp_die: 1d8
83
79
  max_hp: 8
84
- allow_hide: true
80
+ passable: true
81
+ placeable: true
85
82
  token:
86
83
  - '*'
84
+ water:
85
+ color: blue
86
+ movement_cost: 2
87
+ name: Water
88
+ passable: true
89
+ token:
90
+ - ^
87
91
  wooden_door:
88
92
  color: magenta
89
93
  default_ac: 15
90
94
  hp_die: 4d8
91
95
  interactable: true
92
- item_class: 'ItemLibrary::DoorObject'
96
+ item_class: ItemLibrary::DoorObject
93
97
  max_hp: 18
94
98
  name: Wooden Door
95
99
  token: