The player's stats now get better when levelling up. The strength level and frequency of appearance of entities have been changed to offer bettter game experience.

This commit is contained in:
eichhornchen
2021-01-10 16:31:46 +01:00
parent 841c7b9f90
commit dfb591d410
3 changed files with 20 additions and 8 deletions

View File

@ -76,8 +76,8 @@ class Tiger(Monster):
"""
A tiger monster.
"""
def __init__(self, name: str = "tiger", strength: int = 2,
maxhealth: int = 20, *args, **kwargs) -> None:
def __init__(self, name: str = "tiger", strength: int = 5,
maxhealth: int = 30, *args, **kwargs) -> None:
super().__init__(name=name, strength=strength,
maxhealth=maxhealth, *args, **kwargs)
@ -97,7 +97,7 @@ class Rabbit(Monster):
A rabbit monster.
"""
def __init__(self, name: str = "rabbit", strength: int = 1,
maxhealth: int = 15, critical: int = 30,
maxhealth: int = 20, critical: int = 30,
*args, **kwargs) -> None:
super().__init__(name=name, strength=strength,
maxhealth=maxhealth, critical=critical,

View File

@ -3,6 +3,7 @@
from random import randint
from typing import Dict, Optional, Tuple
from math import log
from .items import Item
from ..interfaces import FightingEntity, InventoryHolder
@ -69,9 +70,19 @@ class Player(InventoryHolder, FightingEntity):
self.level += 1
self.current_xp -= self.max_xp
self.max_xp = self.level * 10
self.maxhealth += int(2*log(self.level)/log(2))
self.health = self.maxhealth
self.strength = self.strength + 1
# TODO Remove it, that's only fun
if self.level % 3 == 0 :
self.dexterity += 1
self.constitution += 1
if self.level % 4 == 0 :
self.intelligence += 1
if self.level % 6 == 0 :
self.charisma += 1
if self.level % 10 == 0 and self.critical < 95:
self.critical += (100-self.charisma)//30
# TODO Remove it, that's only for fun
self.map.spawn_random_entities(randint(3 * self.level,
10 * self.level))