all repos — Legends-RPG @ 680235e09a98538dcc6f7165b3f8186889ed6ba5

A fantasy mini-RPG built with Python and Pygame.

Tweaked attack and defense balances, attack and defense strength based purely on equipment rather than level.
Justin Armstrong justinmeister@gmail.com
Tue, 03 Jun 2014 15:38:56 -0700
commit

680235e09a98538dcc6f7165b3f8186889ed6ba5

parent

3f30da44bb69bd438432750872fdd354c4f07ee3

M data/components/person.pydata/components/person.py

@@ -5,10 +5,10 @@ import pygame as pg

from .. import setup, observer from .. import constants as c - #Python 2/3 compatibility. if sys.version_info[0] == 2: range = xrange + class Person(pg.sprite.Sprite): """Base class for all world characters

@@ -599,12 +599,9 @@ """

Calculate hit strength based on attack stats. """ weapon = self.game_data['player inventory']['equipped weapon'] - if not weapon: - weapon_power = 0 - else: - weapon_power = self.game_data['player inventory'][weapon]['power'] - max_strength = weapon_power + (self.level * 5) - min_strength = max_strength // 4 + weapon_power = self.game_data['player inventory'][weapon]['power'] + max_strength = weapon_power + min_strength = max_strength - 7 return random.randint(min_strength, max_strength)
M data/menugui.pydata/menugui.py

@@ -190,8 +190,7 @@ """

Calculate the current attack power based on equipped weapons. """ weapon = self.inventory['equipped weapon'] - weapon_power = self.inventory[weapon]['power'] - return weapon_power + (self.player_stats['Level'] * 5) + return self.inventory[weapon]['power'] def get_defense_power(self): """

@@ -550,11 +549,13 @@ health = self.game_data['player stats']['health']

magic = self.game_data['player stats']['magic'] inventory = self.game_data['player inventory'] - if magic['current'] >= inventory['Cure']['magic points']: - magic['current'] -= inventory['Cure']['magic points'] - health['current'] += inventory['Cure']['power'] - if health['current'] > health['maximum']: - health['current'] = health['maximum'] + if health['current'] != health['maximum']: + if magic['current'] >= inventory['Cure']['magic points']: + self.notify(c.POWERUP) + magic['current'] -= inventory['Cure']['magic points'] + health['current'] += inventory['Cure']['power'] + if health['current'] > health['maximum']: + health['current'] = health['maximum'] def drink_potion(self, potion, stat, value): """
M data/shopgui.pydata/shopgui.py

@@ -330,7 +330,7 @@ if item_type in player_armor:

equipped_armor.append(item_type) if item_type in player_weapons: player_items['equipped weapon'] = item_type - if item_type in player_items: + if item_type in player_items and item_type not in magic_list: player_items[item_type]['quantity'] += quantity elif quantity > 0: player_items[item_type] = item_to_add
M data/states/battle.pydata/states/battle.py

@@ -80,9 +80,9 @@ def make_enemy_level_dict(self):

new_dict = {c.OVERWORLD: 1, c.DUNGEON: 2, c.DUNGEON2: 2, - c.DUNGEON3: 3, + c.DUNGEON3: 2, c.DUNGEON4: 2, - c.DUNGEON5: 5} + c.DUNGEON5: 4} return new_dict

@@ -100,7 +100,7 @@ """

experience_total = 0 for enemy in self.enemy_list: - experience_total += (random.randint(5,10)*enemy.level) + experience_total += (random.randint(5,10)) return experience_total

@@ -157,7 +157,10 @@ enemy.rect.topleft = pos_list[i]

enemy.image = pg.transform.scale2x(enemy.image) enemy.index = i enemy.level = self.make_enemy_level_dict()[self.previous] - enemy.health = enemy.level * 7 + if enemy.name == 'evilwizard': + enemy.health = 100 + else: + enemy.health = enemy.level * 4 enemy_list = [enemy for enemy in enemy_group]
M data/states/shop.pydata/states/shop.py

@@ -230,13 +230,13 @@

item2 = {'type': 'Long Sword', 'price': 150, 'quantity': 1, - 'power': 10, + 'power': 11, 'dialogue': longsword_dialogue} item1 = {'type': 'Rapier', 'price': 50, 'quantity': 1, - 'power': 5, + 'power': 9, 'dialogue': rapier_dialogue} return [item1, item2]

@@ -265,13 +265,13 @@

item = {'type': 'Chain Mail', 'price': 50, 'quantity': 1, - 'power': 1, + 'power': 2, 'dialogue': chainmail_dialogue} item2 = {'type': 'Wooden Shield', 'price': 75, 'quantity': 1, - 'power': 1, + 'power': 3, 'dialogue': shield_dialogue} return [item, item2]
M data/tools.pydata/tools.py

@@ -188,7 +188,7 @@ def create_game_data_dict():

"""Create a dictionary of persistant values the player carries between states""" - player_items = {'GOLD': dict([('quantity',200), + player_items = {'GOLD': dict([('quantity',100), ('value',0)]), 'Healing Potion': dict([('quantity',2), ('value',15)]),

@@ -196,7 +196,7 @@ 'Ether Potion': dict([('quantity',1),

('value', 15)]), 'Rapier': dict([('quantity', 1), ('value', 50), - ('power', 5)]), + ('power', 9)]), 'equipped weapon': 'Rapier', 'equipped armor': []}