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:
parent
841c7b9f90
commit
dfb591d410
|
@ -76,8 +76,8 @@ class Tiger(Monster):
|
||||||
"""
|
"""
|
||||||
A tiger monster.
|
A tiger monster.
|
||||||
"""
|
"""
|
||||||
def __init__(self, name: str = "tiger", strength: int = 2,
|
def __init__(self, name: str = "tiger", strength: int = 5,
|
||||||
maxhealth: int = 20, *args, **kwargs) -> None:
|
maxhealth: int = 30, *args, **kwargs) -> None:
|
||||||
super().__init__(name=name, strength=strength,
|
super().__init__(name=name, strength=strength,
|
||||||
maxhealth=maxhealth, *args, **kwargs)
|
maxhealth=maxhealth, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class Rabbit(Monster):
|
||||||
A rabbit monster.
|
A rabbit monster.
|
||||||
"""
|
"""
|
||||||
def __init__(self, name: str = "rabbit", strength: int = 1,
|
def __init__(self, name: str = "rabbit", strength: int = 1,
|
||||||
maxhealth: int = 15, critical: int = 30,
|
maxhealth: int = 20, critical: int = 30,
|
||||||
*args, **kwargs) -> None:
|
*args, **kwargs) -> None:
|
||||||
super().__init__(name=name, strength=strength,
|
super().__init__(name=name, strength=strength,
|
||||||
maxhealth=maxhealth, critical=critical,
|
maxhealth=maxhealth, critical=critical,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
from random import randint
|
from random import randint
|
||||||
from typing import Dict, Optional, Tuple
|
from typing import Dict, Optional, Tuple
|
||||||
|
from math import log
|
||||||
|
|
||||||
from .items import Item
|
from .items import Item
|
||||||
from ..interfaces import FightingEntity, InventoryHolder
|
from ..interfaces import FightingEntity, InventoryHolder
|
||||||
|
@ -69,9 +70,19 @@ class Player(InventoryHolder, FightingEntity):
|
||||||
self.level += 1
|
self.level += 1
|
||||||
self.current_xp -= self.max_xp
|
self.current_xp -= self.max_xp
|
||||||
self.max_xp = self.level * 10
|
self.max_xp = self.level * 10
|
||||||
|
self.maxhealth += int(2*log(self.level)/log(2))
|
||||||
self.health = self.maxhealth
|
self.health = self.maxhealth
|
||||||
self.strength = self.strength + 1
|
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,
|
self.map.spawn_random_entities(randint(3 * self.level,
|
||||||
10 * self.level))
|
10 * self.level))
|
||||||
|
|
||||||
|
|
|
@ -628,8 +628,9 @@ class Entity:
|
||||||
Rabbit, TeddyBear, GiantSeaEagle
|
Rabbit, TeddyBear, GiantSeaEagle
|
||||||
from squirrelbattle.entities.friendly import Merchant, Sunflower, \
|
from squirrelbattle.entities.friendly import Merchant, Sunflower, \
|
||||||
Trumpet, Chest
|
Trumpet, Chest
|
||||||
return [BodySnatchPotion, Bomb, Heart, Hedgehog, Rabbit, TeddyBear,
|
return [BodySnatchPotion, Bomb, Chest, GiantSeaEagle, Heart,
|
||||||
Sunflower, Tiger, Merchant, GiantSeaEagle, Trumpet, Chest]
|
Hedgehog, Merchant, Rabbit, Sunflower, TeddyBear, Tiger,
|
||||||
|
Trumpet]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_weights() -> list:
|
def get_weights() -> list:
|
||||||
|
@ -637,7 +638,7 @@ class Entity:
|
||||||
Returns a weigth list associated to the above function, to
|
Returns a weigth list associated to the above function, to
|
||||||
be used to spawn random entities with a certain probability.
|
be used to spawn random entities with a certain probability.
|
||||||
"""
|
"""
|
||||||
return [3, 5, 6, 5, 5, 5, 5, 4, 3, 1, 2, 4]
|
return [30, 80, 50, 1, 100, 100, 60, 70, 70, 20, 40, 40]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_all_entity_classes_in_a_dict() -> dict:
|
def get_all_entity_classes_in_a_dict() -> dict:
|
||||||
|
@ -765,7 +766,7 @@ class FightingEntity(Entity):
|
||||||
The entity takes damage from the attacker
|
The entity takes damage from the attacker
|
||||||
based on their respective stats.
|
based on their respective stats.
|
||||||
"""
|
"""
|
||||||
damage = max(0, amount - self.constitution)
|
damage = max(1, amount - self.constitution)
|
||||||
self.health -= damage
|
self.health -= damage
|
||||||
if self.health <= 0:
|
if self.health <= 0:
|
||||||
self.die()
|
self.die()
|
||||||
|
|
Loading…
Reference in New Issue