Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ayara (Resolves #51) #77

Merged
merged 42 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8b52dd1
Run script to clear preset game
nskins Dec 29, 2016
951c518
Construct the basic shape of the first city
nskins Dec 29, 2016
7781772
Create the player's house
nskins Dec 29, 2016
e78cdaa
Add a simple NPC and item
nskins Dec 29, 2016
ec54974
Add some fruits and veggies
nskins Dec 30, 2016
5532299
Add the farmer's market
nskins Dec 30, 2016
9068a3c
Change main tile to grass and mark city square w/ stone
nskins Dec 30, 2016
6a219d1
Add Tim's house & wife who steals bucket
nskins Dec 30, 2016
756f832
Merge branch 'master' into ayara
nskins Dec 30, 2016
db8630e
Add mayor's house
nskins Dec 30, 2016
25a6967
Add well in the middle of the city
nskins Dec 30, 2016
4fe05ae
Add dehydrated NPC and basketball item
nskins Dec 31, 2016
c0c6e7d
Add eastward and westward paths
nskins Dec 31, 2016
fd4874c
Add more graphics on map and organize tiles
nskins Dec 31, 2016
a561ec1
Add fishing shop and supplies
nskins Jan 1, 2017
ca0f65c
Add simple fishing events
nskins Jan 1, 2017
5ee2f26
Add cooking items (no recipes yet)
nskins Jan 1, 2017
6978546
Add some NPCs around the fishing pond
nskins Jan 2, 2017
1a0e004
Replace watermelon with onion for incoming recipe
nskins Jan 2, 2017
db103b2
Fix merge conflict for sentinel value update
nskins Jan 2, 2017
4811a32
Update Ayara for better sentinel value
nskins Jan 2, 2017
6b62534
Add recipe book & associated ingredients
nskins Jan 3, 2017
e0d8890
Rewrite stove event for cooking recipes
nskins Jan 4, 2017
597db8c
Fix bug in fishing
nskins Jan 4, 2017
28cb82e
Add dojo event and new armor
nskins Jan 4, 2017
5db932a
Add NPC who wants food
nskins Jan 4, 2017
bcbd57e
Merge branch 'master' into ayara
nskins Jan 7, 2017
3aed276
Fix typos & misc.
nskins Jan 8, 2017
3e26c76
Implement simple basketball game
nskins Jan 8, 2017
c2465be
Reward player with some gold for successful shot
nskins Jan 8, 2017
11a3b3e
Add NPC who plays basketball with player
nskins Jan 8, 2017
45ec4c4
Add Ichiro's house & sign at city exit
nskins Jan 9, 2017
1772c72
Add helpful introduction
nskins Jan 11, 2017
69ad45e
Rewrite README and misc. cleanup
nskins Jan 12, 2017
192f778
Rewrite script to clear preset game
nskins Jan 12, 2017
3c0087a
Merge branch 'master' into ayara
nskins Jan 14, 2017
bc2419b
Make movement better
nskins Jan 14, 2017
9e1b8e8
Add NPC who talks about food
nskins Jan 15, 2017
62ea489
Prevent system('clear') during test suite
nskins Jan 16, 2017
6d09393
Separate ayara from lib folder
nskins Jan 16, 2017
1eb70c5
Only show output for lost gold when gold > 0
nskins Jan 16, 2017
20a4597
Update README documentation section
nskins Jan 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
# Goby [![Build Status](https://travis-ci.org/nskins/goby.png)](https://travis-ci.org/nskins/goby)

Goby is a Ruby framework for developing [text](https://en.wikipedia.org/wiki/Text-based_game)-[RPGs](https://en.wikipedia.org/wiki/Role-playing_game). Popular examples of such games are [Zork](https://en.wikipedia.org/wiki/Zork) and [Colossal Cave Adventure](https://en.wikipedia.org/wiki/Colossal_Cave_Adventure). Our purpose is to provide the engine and underlying logic so the user can focus on the fun part: content creation!
Goby is a Ruby framework for the swift and easy development of [text](https://en.wikipedia.org/wiki/Text-based_game)-[RPGs](https://en.wikipedia.org/wiki/Role-playing_game). Have you ever wanted to write your own text-RPG? Due to recent technological advancements and quality of life improvements, it's now easier than 3.1415. Our primary goal in the development of the Goby framework is to provide a high degree of functionality (utilizing object-oriented design) so that end-users need focus only on content creation! WOOHOO!

## Preset Data
## Ayara

Play our (short) example game:
Welcome to the town of Ayara. By default, this preset game has been included in the framework for the following reasons: (1.) to provide example code for end-users who wish to create their own game, (2.) to present the many features and possibilities of the framework, and, lastly, (3.) to show that games built using the Goby framework are quite fun.

```ruby lib/main.rb```
In order to begin your adventure, run the following command:

Remove the example game (which leaves only the framework):
```ruby ayara/main.rb```

```bash scripts/clear_preset.sh```
It is recommended to change your Terminal's text size to about 18 or 20 (Edit -> Preferences).

## Documentation

We use [YARD](https://github.com/lsegal/yard) for documentation. In order to see the doc files, first ensure that YARD is installed:

```gem install yard```

Then run the following command in our project's root directory:
## Contributing

```yardoc ```
Contributors of all skill levels are welcome. We do our best to identify issues that are suitable for open-source newcomers and veterans alike. Please see the [Issues](https://github.com/nskins/goby/issues) tab or tackle a completely unknown problem or feature! Also, please feel free to reach out to the owner ([nskins@umich.edu](mailto:nskins@umich.edu)) for any questions, comments, etc.

The doc files will then be available as HTML files in the doc/ directory.
Run the test suite before sending a pull request!:

## Contributing
```rspec ```

First, ensure that all tests are passing:
## Documentation

```rspec ```
We use [YARD](https://github.com/lsegal/yard) for documentation. In order to generate the documentation (which will be stored in the doc/ directory), run the following command in the project's root directory:

If so, then submit a pull request. Thanks!
```yardoc ```
7 changes: 7 additions & 0 deletions ayara/Battle/BattleCommand/Attack/flying_kick.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require_relative '../../../../lib/Battle/BattleCommand/Attack/attack.rb'

class FlyingKick < Attack
def initialize
super(name: "Flying Kick", strength: 6, success_rate: 60)
end
end
7 changes: 7 additions & 0 deletions ayara/Battle/BattleCommand/Attack/punch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require_relative '../../../../lib/Battle/BattleCommand/Attack/attack.rb'

class Punch < Attack
def initialize
super(name: "Punch", strength: 3, success_rate: 99)
end
end
24 changes: 24 additions & 0 deletions ayara/Entity/Monster/sensei.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require_relative '../../../lib/Entity/Monster/monster.rb'
require_relative '../../Battle/BattleCommand/Attack/flying_kick.rb'
require_relative '../../Battle/BattleCommand/Attack/punch.rb'
require_relative '../../Item/Equippable/Legs/karate_bottom.rb'
require_relative '../../Item/Equippable/Torso/karate_top.rb'

class Sensei < Monster
def initialize
super(name: "Sensei", max_hp: 20, attack: 5, agility: 2,
battle_commands: [FlyingKick.new, Punch.new],
message: "\"Show me your abilities.\"",
treasures: [Couple.new(KarateBottom.new, 1),
Couple.new(KarateTop.new, 1)])
end

def choose_attack
random = Random.rand(5)
if (random == 0)
return @battle_commands[0] # Flying Kick
else
return @battle_commands[1] # Punch
end
end
end
215 changes: 215 additions & 0 deletions ayara/Event/NPC/ayara.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
require_relative '../../../lib/Event/NPC/npc.rb'
require_relative '../../Item/basketball.rb'
require_relative '../../Item/bucket.rb'

class Andre < NPC
def initialize
super(name: "Andre")
end

def run(player)
if player.has_item(Basketball.new).nil?
type("#{@name}: Huh? Come back when you have\n")
type("a Basketball, dear child.\n\n")
return
end

type("#{@name}: Each player takes five shots -\n")
type("whoever makes more wins. Would you like\n")
type("to make a wager (y/n)?: ")
input = gets.chomp
print "\n"
return if input != 'y'

puts "Current gold in pouch: #{player.gold}."
type("#{@name}: How much will you wager?: ")
input = gets.chomp
amount = input.to_i
print "\n"

if (amount < 1)
type("#{@name}: You need to choose a positive amount!\n\n")
return
elsif (amount > player.gold)
type("#{@name}: You can't wager more than you have!\n\n")
return
end

type("#{@name}: Good. Let's go!\n\n")

# Player shoots.
shots_made = 0
5.times do
success = shoot
shots_made += 1 if success
print "\n"
end

# Choose a random number of shots that Andre made.
random = Random.rand(6)

puts "Andre's score: #{random}."
print "Your score: #{shots_made}.\n\n"

# Final output and movement of gold.
if (random < shots_made)
print "You win #{amount} gold!\n\n"
player.gold += amount
elsif (random > shots_made)
print "You lose #{amount} gold...\n\n"
player.gold -= amount
else
print "It's a tie!\n\n"
end

end

include(BBall)
end

class Antonio < NPC
def initialize
super(name: "Antonio")
end

def run(player)
type("#{@name}: Yes, I've been fishing for many\n")
type("years. Stand aside. You're ruining the\n")
type("balance of my inner life force.\n\n")
end
end

class Bella < NPC
def initialize
super(name: "Bella")
end

def run(player)
if player.has_item(BucketOfWater.new).nil?
type("#{@name}: Oooh.. hello? Please... bring me\n")
type("water... I'm dehydrated... ooooohhhhhh.....\n\n")
else
type("#{@name}: Oooh.. you have water... ??\n")
type("May I please have it... (y/n)?: ")
input = gets.chomp
print "\n"

if (input == 'y')
type("#{@name}: Quickly, hand it to me....\n\n")
sleep(2)
type("*glurp glurp glurp*\n\n")
sleep(2)
type("#{@name}: Oh, thank you so much. I feel\n")
type("much better. I'm done with exercise\n")
type("for now. You can have my basketball.\n\n")
type("Obtained Basketball!\n\n")

# Modify items in the player's inventory.
player.remove_item(BucketOfWater.new)
player.add_item(Bucket.new)
player.add_item(Basketball.new)

# Remove the event from the map.
@visible = false
y = player.location.first
x = player.location.second
player.map.tiles[y][x].description = "You are standing on some grass."
else
type("#{@name}: Oooh..\n")
type("*She rolls over in extreme pain*\n\n")
end
end
end
end

class Helen < NPC
def initialize
super(name: "Helen")
end

def run(player)
type("#{@name}: Each type of fish prefers a particular\n")
type("type of bait. If one bait doesn't seem to work,\n")
type("then try another. You could also just be unlucky...\n\n")
end
end

class John < NPC
def initialize
super(name: "John")
@pairs = [Couple.new(BoiledEgg.new, 8),
Couple.new(Bluegill.new, 6),
Couple.new(ScrambledEggs.new, 50)]
@current_index = nil
end

def run(player)
case @mode
when 0
# Choose a random pair.
@current_index = Random.rand(@pairs.size)

type("#{@name}: Hello. Could you please bring me\n")
type("#{@pairs[@current_index].first.name}? I am very hungry.\n")
type("Don't worry.. I will pay you for your services.\n\n")
@mode = 1
when 1
if (player.has_item(@pairs[@current_index].first))
type("#{@name}: Ah, yes! #{@pairs[@current_index].first.name}!\n")
type("May I have it (y/n)?: ")
input = gets.chomp
print "\n"

if (input == 'y')
type("#{@name}: Thank you! Thank you! Here, have this.\n\n")
print "Obtained #{@pairs[@current_index].second} gold!\n\n"
player.gold += @pairs[@current_index].second
player.remove_item(@pairs[@current_index].first)
@mode = 0
else
type("#{@name}: How rude!\n\n")
end
else
type("#{@name}: I'd like #{@pairs[@current_index].first.name}, please!\n\n")
end
end
end

# Array<Couple(Food, Integer)>
# Type of Food the NPC wants and the reward given.
attr_accessor :pairs
# Integer
# The index of pairs that the NPC currently wants.
attr_accessor :current_index
end

class Paula < NPC
def initialize
super(name: "Paula")
end

def run(player)
type("#{@name}: When you're low on health, eat food!\n")
type("It'll make you feel much better, I think.\n\n")
end
end

class Tim < NPC
def initialize
super(name: "Tim")
end

def run(player)
if player.has_item(Bucket.new).nil?
type("#{@name}: Ah, hello #{player.name}! It seems a bit\n")
type("chilly out today, huh? I found this\n")
type("strange device, but I don't need it.\n")
type("Maybe you could use it?\n\n")
type("Obtained Bucket!\n\n")
player.add_item(Bucket.new)
else
type("#{@name}: Did you find out how to use that\n")
type("strange device? It seems intriguing...\n\n")
end
end
end
35 changes: 35 additions & 0 deletions ayara/Event/Shop/ayara.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require_relative '../../../lib/Event/Shop/shop.rb'
require_relative '../../Item/bait.rb'
require_relative '../../Item/fishing_pole.rb'
require_relative '../../Item/Food/egg.rb'
require_relative '../../Item/Food/fish.rb'
require_relative '../../Item/Food/fruits.rb'
require_relative '../../Item/Food/veggies.rb'

class FarmersMarket1 < Shop
def initialize
super(name: "the farmer's market",
items: [Egg.new, Celery.new, Apple.new])
end
end

class FarmersMarket2 < Shop
def initialize
super(name: "the farmer's market",
items: [Grape.new, Onion.new, Potato.new])
end
end

class FarmersMarket3 < Shop
def initialize
super(name: "the farmer's market",
items: [Tomato.new, Strawberry.new, Pepper.new])
end
end

class FishingShop < Shop
def initialize
super(name: "the fishing shop",
items: [Snail.new, RawBluegill.new, FishingPole.new])
end
end
Loading