forked from InfoProjekt/game
added a Drops class
This commit is contained in:
parent
690a00b718
commit
7199e7f72f
1 changed files with 50 additions and 5 deletions
55
classes.py
55
classes.py
|
|
@ -379,13 +379,14 @@ class Room(GameObjects):
|
|||
def update(self, objects):
|
||||
if objects is not None:
|
||||
self.objects = objects
|
||||
if not self.objects[1]:
|
||||
if self.type == 'boss':
|
||||
if self.type == 'boss' and not self.objects:
|
||||
print('yeahhh, you killed the boss')
|
||||
self.objects[0][0].level.level = 100
|
||||
if len(self.objects[1]) <= 3:
|
||||
self.locked = False
|
||||
for door in self.doors:
|
||||
door.update(False)
|
||||
#Tür Sound
|
||||
return
|
||||
|
||||
def draw(self, screen):
|
||||
|
|
@ -534,6 +535,49 @@ class Convo(Label):
|
|||
self.npc.talking = False
|
||||
objects[0][0].talking = False
|
||||
|
||||
class Drops():
|
||||
def __init__(self, type, level, objects) -> None:
|
||||
table = {
|
||||
'boss': {
|
||||
'xp': 150,
|
||||
'gold': 500,
|
||||
'artifacts': [
|
||||
100, #drop-chance
|
||||
20, #common
|
||||
30, #uncommon
|
||||
35, #rare
|
||||
14, #epic
|
||||
1 #legendary
|
||||
],
|
||||
'will': 5
|
||||
},
|
||||
'normal': {
|
||||
'xp': 5,
|
||||
'gold': 20,
|
||||
'artifacts': [
|
||||
10, #drop-chance
|
||||
65, #common
|
||||
25, #uncommon
|
||||
7.5, #rare
|
||||
2.25, #epic
|
||||
0.25 #legendary
|
||||
],
|
||||
'will': 0.1
|
||||
},
|
||||
'ad': {
|
||||
'xp': 0,
|
||||
'gold': 3,
|
||||
'artifacts': [
|
||||
1, #drop-chance
|
||||
90, #common
|
||||
9.9, #uncommon
|
||||
0.1, #rare
|
||||
0, #epic
|
||||
0 #legendary
|
||||
],
|
||||
'will': 0
|
||||
}
|
||||
}
|
||||
|
||||
class Fighter(Objects):
|
||||
def __init__(self, name, ms, sprite, x, y, health, damage, level, asp, atr) -> None:
|
||||
|
|
@ -553,7 +597,7 @@ class MainCharacter(Fighter):
|
|||
super().__init__(name, ms, sprite, x, y, health, damage, level, asp, atr)
|
||||
self.book = Book(0, 0, [], None, None)
|
||||
self.talking = False
|
||||
self.level = Level(1000, 38, 150, 40, level, f'will to live: {level}%', 'simple', 20)
|
||||
self.level = Level(1000, 38, 150, 40, level, f'will to live: {round(level, 1)}%', 'simple', 20)
|
||||
self.health = Hearts(health, sprite=['fullheart.png', 'fullheart.png', 'fullheart.png', 'fullheart.png', 'fullheart.png'], x=900, y=50, hurtCooldown=self.hurtCooldown)
|
||||
self.thinks = Thinks(self.x + 20, self.y - 50, 150, 100, 'brr I\'m freezing')
|
||||
self.freezing = True
|
||||
|
|
@ -564,6 +608,8 @@ class MainCharacter(Fighter):
|
|||
self.last_frame_update = pygame.time.get_ticks()
|
||||
self.rect = pygame.Rect(x, y, self.walk_frames[0].get_width(), self.walk_frames[0].get_height())
|
||||
self.is_attacking = False
|
||||
self.skill_xp = 0
|
||||
self.gold = 0
|
||||
|
||||
def load_frames(self, walk_sprite_sheet, attack_sprite_sheet):
|
||||
self.walk_frames = self.load_animation_frames(walk_sprite_sheet, frame_width=40, frame_height=66)
|
||||
|
|
@ -574,7 +620,7 @@ class MainCharacter(Fighter):
|
|||
animation_frames = []
|
||||
if frame_width == 40:
|
||||
frames_coordinates = [
|
||||
(frame_width, 0),
|
||||
(frame_width, 0),
|
||||
(frame_width*2, 0),
|
||||
(frame_width*3, 0),
|
||||
(frame_width*4, 0),
|
||||
|
|
@ -598,7 +644,6 @@ class MainCharacter(Fighter):
|
|||
animation_frames.append(frame)
|
||||
return animation_frames
|
||||
|
||||
|
||||
def draw(self, screen):
|
||||
if self.hidden:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue