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

Add currency #88

Open
wants to merge 2 commits into
base: v2.0
Choose a base branch
from
Open

Add currency #88

wants to merge 2 commits into from

Conversation

SwagataJ
Copy link

Proposed changes

Added in game currency to the game. #84

Types of changes

Added a currency system and made some changes to support it. Also refactored some of the code to make it compatible with PEP-8.

Copy link
Member

@emilkovacev emilkovacev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! I made a few requests for for changes before you merge, if you have any questions feel free to follow up. I like where some of this is going, a few small tweaks will get it where it needs to be!

Additionally, please try to minimize changes outside of what you detail in the PR. Making multiple smaller PRs allows us to more easily approve each one :)

crpg.py Show resolved Hide resolved
@@ -81,19 +83,21 @@ def generate(filename):
node_mapping: dict[str, Node] = {}
n_types = {
"starting": Location,
"node": Node,
"node": Action,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A node should be of type Node, if you want to add an option for action, you could add it as a separate key: value pair in the map

Comment on lines +30 to +31
def add_twoway_connection(self, node_a: Node, node_b: Node, connection_type_a: Connection = Connection,
connection_type_b: Connection = Connection):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing is a little off here

Comment on lines +11 to +14
self.name = start()
self.current: Node = starting_location
self.player = player
self.name: str = None
self.name: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes belong in another PR

Comment on lines +77 to +84
def __init__(self, title: str, desc: str, coins: str, player: Player):
self.player = player
super().__init__(title, desc)
super().__init__(title, desc, coins)

def on_select(self):
print(self.player.summary())
self.player.coins_earned += self.coins
super(Action, self).on_select()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how you added currency onto the Action class!

builtin.py Show resolved Hide resolved
crpg.py Show resolved Hide resolved
@@ -1,6 +1,10 @@
import random
from pyfiglet import Figlet
fonts = ["6x9", "banner", "big", "block", "bubble", "chartr", "chartri", "cour", "digital", "helv", "ivrit", "lean", "mini", "mnemonic", "sbook", "script", "shadow", "slant", "small", "smscript", "smshadow", "smslant", "standard", "term", "times", "xchartr"]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes belong in another PR

Comment on lines +109 to +111
if n_type == "node":
args.append(game.player)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nodes should not affect the player. Actions, however, are built explicitly to do just that!

Comment on lines +10 to +13
self.coins_earned = 0

def summary(self):
return f'hp: {self.hp} xp: {self.xp}'
return f'hp: {self.hp} xp: {self.xp} coins: {self.coins_earned}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants