Skip to content

Commit

Permalink
Stats can be overridden, armor and attack mean something now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Katie Cunningham committed Apr 22, 2012
1 parent 4c8de82 commit 801254b
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 30 deletions.
11 changes: 10 additions & 1 deletion admin.py
Expand Up @@ -24,7 +24,15 @@ def new_treasure(self):
type = TREASURE_TYPES[int(choice)-1]
title = raw_input("Give it a title: ")
desc = raw_input("Give it a description: ")
tr = Treasure(title=title, description=desc, type=type)
attack = 0
armor = 0
if type == 'weapon':
attack = raw_input("How much damage will it add? [1-999]: ")
attack = int(attack)
else:
armor = raw_input("How much armor will it add? [1-999]: ")
armor = int(armor)
tr = Treasure(title=title, description=desc, type=type, armor=armor, attack=attack)
self.treasures.append(tr)

def list_treasures(self):
Expand All @@ -41,6 +49,7 @@ def main(self):
print "1. Make a new treasure"
print "2. List current treasures"
print "3. Delete a treasure"
print "4. Edit a treasure"
print "0. Quit"
c = raw_input("Make a choice [1-2, 0]: ")
if c[0] == "1": self.new_treasure()
Expand Down
6 changes: 5 additions & 1 deletion roguey/classes/gamescreen.py
Expand Up @@ -38,7 +38,11 @@ def draw_stats(self, player_stats, color=WHITE):
self.screen.blit(self.stats_screen, (1008, 30))
line = 30
for stat in STATS:
self.stats_screen = self.small_font.render("%s: %s" % (stat, str(player_stats.stats[stat])), True, color, BLACK)
if hasattr(player_stats, stat):
s = str(getattr(player_stats, stat))
else:
s = str(player_stats.stats[stat])
self.stats_screen = self.small_font.render("%s: %s" % (stat, s), True, color, BLACK)
self.screen.blit(self.stats_screen, (1008, line+15))
line += 15
self.stats_screen = self.small_font.render("Armor: %s" % player_stats.get_armor(), True, color, BLACK)
Expand Down
8 changes: 5 additions & 3 deletions roguey/classes/items.py
Expand Up @@ -11,7 +11,9 @@ def __init__(self, title="Nada", description="", type="trash", armor=0, buff=0,
self.title = title
self.description = description
self.type = type
self.armor = armor
self.buff = buff
self.attack = attack
self.stats = {
'armor': armor,
'buff': {},
'attack': attack
}

17 changes: 14 additions & 3 deletions roguey/classes/monsters.py
Expand Up @@ -26,10 +26,21 @@ def __init__(self):
self.title = "Derpy Slime"
self.level = 1
self.stats ={
'attack': 10,
'attack': 5,
'defense': 1,
'strength': 1,
}
self.current_hp = 5
self.current_hp = 3
self.max_hp = 3

class RatBird(Monster):
def __init__(self):
self.title = "Ratbird"
self.level = 2
self.stats = {
'attack': 7,
'defense': 2,
'strength': 2,
}
self.max_hp = 5

self.current_hp = self.max_hp
10 changes: 4 additions & 6 deletions roguey/classes/player.py
Expand Up @@ -53,10 +53,8 @@ def defense(self):
def get_armor(self):
armor = 0
for slot in self.equipped.keys():
try:
armor += self.equipped[slot].armor
except:
pass
if self.equipped[slot]:
armor += self.equipped[slot].stats['armor']
return armor

def receive_damage(self, damage):
Expand All @@ -68,8 +66,8 @@ def attempt_block(self, attack):
@property
def attack(self):
atk = 0
if self.equipped['hands']:
atk += self.equipped['hands'].attack
if self.equipped['weapon']:
atk += self.equipped['weapon'].stats['attack']
return self.stats['attack'] + atk

def equip_item(self, item):
Expand Down
75 changes: 59 additions & 16 deletions roguey/resources/items.pk
Expand Up @@ -11,31 +11,74 @@ p3
Ntp4
Rp5
(dp6
S'type'
S'stats'
p7
S'hat'
p8
sS'description'
(dp8
S'armor'
p9
S'It looks silly.'
I1
sS'attack'
p10
sS'title'
I0
sS'buff'
p11
(dp12
ssS'type'
p13
S'hat'
p14
sS'description'
p15
S'You look silly.'
p16
sS'title'
p17
S'beanie'
p12
p18
sbag1
(g2
g3
Ntp13
Rp14
(dp15
Ntp19
Rp20
(dp21
g7
S'shirt'
p16
sg9
S'Are you brave enough to wear it?'
p17
(dp22
g9
I1
sg10
I0
sg11
(dp23
ssg13
S'shirt'
p24
sg15
S'Your arms are cold now. No, this does not give you ice powers.'
p25
sg17
S'tank top'
p18
p26
sbag1
(g2
g3
Ntp27
Rp28
(dp29
g7
(dp30
g9
I0
sg10
I1
sg11
(dp31
ssg13
S'weapon'
p32
sg15
S'Cheap knock-off. Probably from Ikea.'
p33
sg17
S'sqord'
p34
sba.

0 comments on commit 801254b

Please sign in to comment.