lotrd 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/lotrd.rb +3 -3
- data/lib/lotrd/controller/bankController.rb +4 -4
- data/lib/lotrd/controller/check.rb +1 -1
- data/lib/lotrd/controller/combatController.rb +17 -13
- data/lib/lotrd/controller/leaderboardController.rb +2 -2
- data/lib/lotrd/controller/playergen.rb +1 -1
- data/lib/lotrd/controller/storeBuy.rb +4 -4
- data/lib/lotrd/model/job.rb +8 -2
- data/lib/lotrd/model/player.rb +2 -1
- data/lib/lotrd/model/race.rb +13 -1
- data/lib/lotrd/version.rb +1 -1
- data/lib/lotrd/view/bank.rb +2 -2
- data/lib/lotrd/view/datacheck.rb +1 -1
- data/lib/lotrd/view/leaderboard.rb +1 -1
- data/lib/lotrd/view/store.rb +1 -1
- data/lib/lotrd/view/town.rb +2 -2
- data/lotrd-0.1.8.gem +0 -0
- metadata +2 -2
- data/lib/lotrd/model/playerdata.yml +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 418b83413abbe69853f7578db5cb89c63c9c23f718a80426ac1108a3663826f3
|
4
|
+
data.tar.gz: 0e7854148471c3652d587e167f09d069b860d7c1055343e8cb0eef244a9c5626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79ebb37c78ac1346bd735fa139945b77ac39cbdad7ee507c786de05f6cd040fa557b6360eb070152ffbe1b88e23ccf40f9ee42f4023abece30da0afb9fe31206
|
7
|
+
data.tar.gz: f2a04b6eefb12f5dd44bf9e114d716945f6d5f0c84d90bea6e54e3ceb9a5068f22a0b4157fba593970568989d7ec093cc2e0a7ab9e0e3c6cd86a9b36fb5b6ee8
|
data/Gemfile.lock
CHANGED
data/lib/lotrd.rb
CHANGED
@@ -10,10 +10,10 @@ module Lotrd
|
|
10
10
|
def self.start
|
11
11
|
system 'clear'
|
12
12
|
titleStyle = Artii::Base.new :font => 'slant'
|
13
|
-
puts titleStyle.asciify(' Legend')
|
14
|
-
puts titleStyle.asciify(' Of The')
|
13
|
+
puts titleStyle.asciify(' Legend').colorize(:white)
|
14
|
+
puts titleStyle.asciify(' Of The').colorize(:white)
|
15
15
|
puts titleStyle.asciify(' Ruby').colorize(:red)
|
16
|
-
puts titleStyle.asciify(' Dragon')
|
16
|
+
puts titleStyle.asciify(' Dragon').colorize(:white)
|
17
17
|
puts "\n"*2 + "A CLI remake of the text-based adventure game, #{"'Legend of the Green Dragon' (LotGD)".colorize(:green)}."
|
18
18
|
sleep(5)
|
19
19
|
::Check.playerData
|
@@ -6,7 +6,7 @@ module BankController
|
|
6
6
|
|
7
7
|
|
8
8
|
def withdraw(wdw)
|
9
|
-
player = YAML.load(File.read("
|
9
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
10
10
|
gold = player.gold
|
11
11
|
balance = player.balance
|
12
12
|
if wdw > balance
|
@@ -19,12 +19,12 @@ module BankController
|
|
19
19
|
end
|
20
20
|
player.gold = gold
|
21
21
|
player.balance = balance
|
22
|
-
File.open('
|
22
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", player.to_yaml)}
|
23
23
|
::Bank.withdrawConfirm(wdw, player.gold, player.balance)
|
24
24
|
end
|
25
25
|
|
26
26
|
def deposit(dep)
|
27
|
-
player = YAML.load(File.read("
|
27
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
28
28
|
gold = player.gold
|
29
29
|
balance = player.balance
|
30
30
|
if dep > gold
|
@@ -37,7 +37,7 @@ module BankController
|
|
37
37
|
end
|
38
38
|
player.gold = gold
|
39
39
|
player.balance = balance
|
40
|
-
File.open('
|
40
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", player.to_yaml)}
|
41
41
|
::Bank.depositConfirm(dep, player.gold, player.balance)
|
42
42
|
end
|
43
43
|
module_function :withdraw,
|
@@ -12,8 +12,10 @@ module CombatSim
|
|
12
12
|
mob1.jobGen
|
13
13
|
mob1.nameGen
|
14
14
|
#Load player stats
|
15
|
-
player = YAML.load(File.read("
|
15
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
16
16
|
@currentPlayerHP = player.hp
|
17
|
+
@currentPlayerDef = player.def
|
18
|
+
@currentPlayerRes = player.res
|
17
19
|
@currentPlayerStr = player.str
|
18
20
|
@currentPlayerAgi = player.agi
|
19
21
|
@currentPlayerInt = player.int
|
@@ -22,6 +24,8 @@ module CombatSim
|
|
22
24
|
#Load mob stats
|
23
25
|
@mobName = mob1.name
|
24
26
|
@currentMobHP = mob1.hp
|
27
|
+
@currentMobDef = mob1.def
|
28
|
+
@currentMobRes = mob1.res
|
25
29
|
@currentMobStr = mob1.str
|
26
30
|
@currentMobAgi = mob1.agi
|
27
31
|
@currentMobInt = mob1.int
|
@@ -43,18 +47,18 @@ module CombatSim
|
|
43
47
|
|
44
48
|
def mobHit
|
45
49
|
@turn = 'mob'
|
46
|
-
@currentMobDex - @currentPlayerAgi + rand(1..
|
50
|
+
@currentMobDex - @currentPlayerAgi + rand(1..10) > 0 ? ::CombatSim.mobDmg : ::CombatView.mobMiss
|
47
51
|
end
|
48
52
|
|
49
53
|
def mobDmg
|
50
54
|
@mobAction = rand(1..3)
|
51
55
|
case @mobAction
|
52
56
|
when 1
|
53
|
-
(@currentMobStr - @
|
57
|
+
(@currentMobStr - @currentPlayerDef) > 0 ? dmg = (@currentMobStr - @currentPlayerDef) : dmg = 0
|
54
58
|
when 2
|
55
|
-
(@currentMobInt - @
|
59
|
+
(@currentMobInt - @currentPlayerRes) > 0 ? dmg = (@currentMobInt - @currentPlayerRes): dmg = 0
|
56
60
|
when 3
|
57
|
-
(@currentMobDex - @
|
61
|
+
(@currentMobDex - @currentPlayerDef) > 0 ? dmg = (@currentMobDex - @currentPlayerDef) : dmg = 0
|
58
62
|
end
|
59
63
|
::CombatSim.mobCrit(dmg)
|
60
64
|
end
|
@@ -70,18 +74,18 @@ module CombatSim
|
|
70
74
|
|
71
75
|
def playerHit(action)
|
72
76
|
@turn = 'player'
|
73
|
-
@currentPlayerDex - @currentMobAgi + rand(1..
|
77
|
+
@currentPlayerDex - @currentMobAgi + rand(1..10) > 0 ? ::CombatSim.playerDmg(action) : ::CombatView.playerMiss
|
74
78
|
end
|
75
79
|
|
76
80
|
def playerDmg(action)
|
77
81
|
@playerAction = action
|
78
82
|
case @playerAction
|
79
83
|
when 1
|
80
|
-
(@currentPlayerStr - @
|
84
|
+
(@currentPlayerStr - @currentMobDef) > 0 ? dmg = (@currentPlayerStr - @currentMobDef) : dmg = 0
|
81
85
|
when 2
|
82
|
-
(@currentPlayerInt - @
|
86
|
+
(@currentPlayerInt - @currentMobRes) > 0 ? dmg = (@currentPlayerInt - @currentMobRes): dmg = 0
|
83
87
|
when 3
|
84
|
-
(@currentPlayerDex - @
|
88
|
+
(@currentPlayerDex - @currentMobDef) > 0 ? dmg = (@currentPlayerDex - @currentMobRes) : dmg = 0
|
85
89
|
end
|
86
90
|
::CombatSim.playerCrit(dmg)
|
87
91
|
end
|
@@ -119,19 +123,19 @@ module CombatSim
|
|
119
123
|
end
|
120
124
|
|
121
125
|
def reward
|
122
|
-
player = YAML.load(File.read("
|
126
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
123
127
|
drop = rand(20..200)
|
124
128
|
player.gold += drop
|
125
|
-
File.open('
|
129
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", player.to_yaml)}
|
126
130
|
::CombatView.victory(drop)
|
127
131
|
end
|
128
132
|
|
129
133
|
def loss
|
130
|
-
player = YAML.load(File.read("
|
134
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
131
135
|
player.gold = 0
|
132
136
|
player.armour = nil
|
133
137
|
player.weapon = nil
|
134
|
-
File.open('
|
138
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", player.to_yaml)}
|
135
139
|
::CombatView.defeat
|
136
140
|
end
|
137
141
|
|
@@ -8,13 +8,13 @@ require_relative '../view/leaderboard.rb'
|
|
8
8
|
module LeaderboardController
|
9
9
|
def menu(input)
|
10
10
|
narcissist = input
|
11
|
-
player = YAML.load(File.read("
|
11
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
12
12
|
achievement = player.achievements
|
13
13
|
|
14
14
|
if (narcissist > 3 && achievement.include?('Narcissist') == false)
|
15
15
|
achievement << 'Narcissist'
|
16
16
|
player.achievements = achievement
|
17
|
-
File.open('
|
17
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", player.to_yaml)}
|
18
18
|
Leaderboard::start
|
19
19
|
else
|
20
20
|
narcissist += 1
|
@@ -54,7 +54,7 @@ module PlayerGen
|
|
54
54
|
system 'clear'
|
55
55
|
::NewPlayer.jobOptions
|
56
56
|
end
|
57
|
-
File.open('
|
57
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", @player.to_yaml)}
|
58
58
|
end
|
59
59
|
module_function :race,
|
60
60
|
:job,
|
@@ -6,7 +6,7 @@ module Buy
|
|
6
6
|
def weapon(item)
|
7
7
|
system 'clear'
|
8
8
|
puts "Hephy's Forge -> Weapons Menu -> Weapon Purchase" + "\n" + "=" * 40 + "\n"*2
|
9
|
-
player = YAML.load(File.read("
|
9
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
10
10
|
weap_stats = YAML.load(File.read("lib/lotrd/model/weap_stats.yml"))
|
11
11
|
gold = player.gold
|
12
12
|
weapon = player.weapon
|
@@ -45,7 +45,7 @@ module Buy
|
|
45
45
|
player.dex = dex
|
46
46
|
player.int = int
|
47
47
|
player.lck = lck
|
48
|
-
File.open('
|
48
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", player.to_yaml)}
|
49
49
|
sleep(3)
|
50
50
|
::Store.menu
|
51
51
|
end
|
@@ -53,7 +53,7 @@ module Buy
|
|
53
53
|
def armour(item)
|
54
54
|
system 'clear'
|
55
55
|
puts "Hephy's Forge -> Armours Menu -> Armour Purchase" + "\n" + "=" * 40 + "\n"*2
|
56
|
-
player = YAML.load(File.read("
|
56
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
57
57
|
arm_stats = YAML.load(File.read("lib/lotrd/model/arm_stats.yml"))
|
58
58
|
gold = player.gold
|
59
59
|
armour = player.armour
|
@@ -95,7 +95,7 @@ module Buy
|
|
95
95
|
player.dex = dex
|
96
96
|
player.int = int
|
97
97
|
player.lck = lck
|
98
|
-
File.open('
|
98
|
+
File.open(ENV['HOME'] + "/." + "playerdata.yml", 'w') {|file| File.write(ENV['HOME'] + "/." + "playerdata.yml", player.to_yaml)}
|
99
99
|
sleep(3)
|
100
100
|
::Store.menu
|
101
101
|
end
|
data/lib/lotrd/model/job.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../model/race'
|
2
2
|
|
3
3
|
class Job < Race
|
4
|
-
attr_accessor :hp, :str, :agi, :dex, :int, :lck
|
4
|
+
attr_accessor :hp, :def, :res, :str, :agi, :dex, :int, :lck
|
5
5
|
def initialize
|
6
6
|
end
|
7
7
|
|
@@ -27,21 +27,27 @@ class Job < Race
|
|
27
27
|
|
28
28
|
def mage
|
29
29
|
@int += 15
|
30
|
-
@
|
30
|
+
@agi += 15
|
31
|
+
@res += 20
|
31
32
|
end
|
32
33
|
|
33
34
|
def knight
|
34
35
|
@hp += 15
|
35
36
|
@str += 15
|
37
|
+
@def += 20
|
36
38
|
end
|
37
39
|
|
38
40
|
def rogue
|
39
41
|
@agi += 15
|
40
42
|
@str += 15
|
43
|
+
@def += 10
|
44
|
+
@res += 10
|
41
45
|
end
|
42
46
|
|
43
47
|
def ranger
|
44
48
|
@dex += 15
|
45
49
|
@lck += 15
|
50
|
+
@def += 15
|
51
|
+
@res += 5
|
46
52
|
end
|
47
53
|
end
|
data/lib/lotrd/model/player.rb
CHANGED
@@ -2,7 +2,7 @@ require_relative '../model/job'
|
|
2
2
|
|
3
3
|
class Player < Job
|
4
4
|
attr_reader :name
|
5
|
-
attr_accessor :gold, :balance, :weapon, :armour, :achievements, :hp, :str, :dex, :int, :lck, :agi
|
5
|
+
attr_accessor :gold, :balance, :weapon, :armour, :achievements, :hp, :def, :res, :str, :dex, :int, :lck, :agi
|
6
6
|
|
7
7
|
def initialize(name)
|
8
8
|
@name = name
|
@@ -11,6 +11,7 @@ class Player < Job
|
|
11
11
|
@weapon = nil
|
12
12
|
@armour = nil
|
13
13
|
@achievements = []
|
14
|
+
@status = []
|
14
15
|
end
|
15
16
|
|
16
17
|
def elf
|
data/lib/lotrd/model/race.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
class Race
|
2
|
-
attr_accessor :hp, :str, :agi, :int, :dex, :lck
|
2
|
+
attr_accessor :hp, :def, :res, :str, :agi, :int, :dex, :lck
|
3
3
|
def initialize
|
4
4
|
@hp = 0
|
5
|
+
@def = 0
|
6
|
+
@res = 0
|
5
7
|
@str = 0
|
6
8
|
@agi = 0
|
7
9
|
@int = 0
|
@@ -11,6 +13,8 @@ class Race
|
|
11
13
|
|
12
14
|
def elf
|
13
15
|
@hp = 20
|
16
|
+
@def = 10
|
17
|
+
@res = 20
|
14
18
|
@str = 10
|
15
19
|
@agi = 30
|
16
20
|
@int = 10
|
@@ -20,6 +24,8 @@ class Race
|
|
20
24
|
|
21
25
|
def human
|
22
26
|
@hp = 20
|
27
|
+
@def = 15
|
28
|
+
@res = 15
|
23
29
|
@str = 20
|
24
30
|
@agi = 10
|
25
31
|
@int = 20
|
@@ -29,6 +35,8 @@ class Race
|
|
29
35
|
|
30
36
|
def dwarf
|
31
37
|
@hp = 30
|
38
|
+
@def = 20
|
39
|
+
@res = 10
|
32
40
|
@str = 25
|
33
41
|
@agi = 15
|
34
42
|
@int = 10
|
@@ -38,6 +46,8 @@ class Race
|
|
38
46
|
|
39
47
|
def god
|
40
48
|
@hp = 99999
|
49
|
+
@def = 999
|
50
|
+
@res = 999
|
41
51
|
@str = 999
|
42
52
|
@agi = 999
|
43
53
|
@int = 999
|
@@ -48,6 +58,8 @@ class Race
|
|
48
58
|
|
49
59
|
def beast
|
50
60
|
@hp = 66666
|
61
|
+
@def = 666
|
62
|
+
@res = 666
|
51
63
|
@str = 666
|
52
64
|
@agi = 666
|
53
65
|
@int = 666
|
data/lib/lotrd/version.rb
CHANGED
data/lib/lotrd/view/bank.rb
CHANGED
@@ -8,7 +8,7 @@ module Bank
|
|
8
8
|
def start
|
9
9
|
system 'clear'
|
10
10
|
puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
|
11
|
-
@player = YAML.load(File.read("
|
11
|
+
@player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
12
12
|
puts "#{@player.name.colorize(:yellow)}, welcome to Hazelwood bank!"
|
13
13
|
sleep(3)
|
14
14
|
menu
|
@@ -28,7 +28,7 @@ module Bank
|
|
28
28
|
|
29
29
|
def balance
|
30
30
|
system 'clear'
|
31
|
-
player = YAML.load(File.read("
|
31
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
32
32
|
gold = player.gold
|
33
33
|
balance = player.balance
|
34
34
|
puts "Hazelwood Bank => Balance" + "\n" + "=" * 40 + "\n"*2
|
data/lib/lotrd/view/datacheck.rb
CHANGED
@@ -21,7 +21,7 @@ module DataCheck
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def present
|
24
|
-
player = YAML.load(File.read("
|
24
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
25
25
|
titleStyle = Artii::Base.new :font => 'slant'
|
26
26
|
system 'clear'
|
27
27
|
puts "Player data located. Welcome back," +"\n"*4 + "#{(titleStyle.asciify(player.name)).colorize(:yellow)}"
|
@@ -20,7 +20,7 @@ module Leaderboard
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def loadIn
|
23
|
-
@player = YAML.load(File.read("
|
23
|
+
@player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
24
24
|
@name = @player.name
|
25
25
|
@gold = @player.gold
|
26
26
|
@balance = @player.balance
|
data/lib/lotrd/view/store.rb
CHANGED
@@ -57,7 +57,7 @@ module Store
|
|
57
57
|
|
58
58
|
def leave
|
59
59
|
system 'clear'
|
60
|
-
player = YAML.load(File.read("
|
60
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
61
61
|
puts "Hephy's Forge" + "\n" + "=" * 40 + "\n"*2
|
62
62
|
puts "Stay alive out there, #{player.name.colorize(:yellow)}!"
|
63
63
|
sleep(3)
|
data/lib/lotrd/view/town.rb
CHANGED
@@ -12,7 +12,7 @@ require_relative '../model/events'
|
|
12
12
|
module Town
|
13
13
|
def menu
|
14
14
|
system 'clear'
|
15
|
-
player = YAML.load(File.read("
|
15
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
16
16
|
puts "Welcome to #{'Hazelwood'.colorize(:magenta)}, #{player.name.colorize(:yellow)}!" + "\n" + "=" * 40 + "\n"*2
|
17
17
|
puts ::Events.town + "\n"*2
|
18
18
|
prompt = TTY::Prompt.new
|
@@ -27,7 +27,7 @@ module Town
|
|
27
27
|
|
28
28
|
def quit
|
29
29
|
system 'clear'
|
30
|
-
player = YAML.load(File.read("
|
30
|
+
player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
|
31
31
|
system 'clear'
|
32
32
|
titleStyle = Artii::Base.new :font => 'slant'
|
33
33
|
puts "Thanks for playing! See you next time," +"\n"*4 + "#{(titleStyle.asciify(player.name)).colorize(:yellow)}"
|
data/lotrd-0.1.8.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lotrd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jackson N
|
@@ -139,7 +139,6 @@ files:
|
|
139
139
|
- lib/lotrd/model/job.rb
|
140
140
|
- lib/lotrd/model/mob.rb
|
141
141
|
- lib/lotrd/model/player.rb
|
142
|
-
- lib/lotrd/model/playerdata.yml
|
143
142
|
- lib/lotrd/model/race.rb
|
144
143
|
- lib/lotrd/model/weap_stats.yml
|
145
144
|
- lib/lotrd/version.rb
|
@@ -153,6 +152,7 @@ files:
|
|
153
152
|
- lib/lotrd/view/town.rb
|
154
153
|
- lotrd-0.1.6.gem
|
155
154
|
- lotrd-0.1.7.gem
|
155
|
+
- lotrd-0.1.8.gem
|
156
156
|
- lotrd.gemspec
|
157
157
|
- vendor/cache/artii-2.1.2.gem
|
158
158
|
- vendor/cache/colorize-0.8.1.gem
|
File without changes
|