diff --git a/game.py b/game.py index 3f9001f..6bd3edd 100644 --- a/game.py +++ b/game.py @@ -1,8 +1,10 @@ -#import random -from player import * -from wands import * +import random +from player import Player +from wands import wands from spells import SPELL_TYPE_COMMON, SPELL_TYPE_POWERFUL, _INVALID_SPELL from spells import random_combat_spell, print_spells, find_spell_by_name +from spells import spells +from game_config import MAX_PLAYER_HEALTH ## ## Definitions diff --git a/game_config.py b/game_config.py new file mode 100644 index 0000000..e04bf08 --- /dev/null +++ b/game_config.py @@ -0,0 +1,16 @@ +## +## Player config +## +MAX_PLAYER_HEALTH = 1000 # Maximum health +MAX_STUNNED_ROUNDS = 10 # Max amount of rounds a player can be stunned + +## +## Spells config +## +CHANCE_HEAL_PARTLY = 25 # Percentage chance a player is healed with 5% of max health when using a defensive spell +CHANCE_HEAL_FULLY = 5 # Percentage chance a player is fully healed when using a defensive spell + +## +## Misc +## +DEBUG_MODE = False # Enable or disable debug mode. Sets all spell chances to 100% when enabled \ No newline at end of file diff --git a/player.py b/player.py index a0a43e1..db91502 100644 --- a/player.py +++ b/player.py @@ -2,9 +2,7 @@ import random from wands import Wand from spells import SPELL_TYPE_NONE, SPELL_TYPE_USELESS, SPELL_TYPE_DEFENSE, SPELL_TYPE_UNFORGIVABLE#, SPELL_TYPE_COMMON, SPELL_TYPE_POWERFUL from spells import Spell, spells, _INVALID_SPELL - -MAX_PLAYER_HEALTH = 1000 -MAX_STUNNED_ROUNDS = 10 +from game_config import MAX_PLAYER_HEALTH, MAX_STUNNED_ROUNDS class Player: def __init__(self, name: str, wand: Wand): diff --git a/spells.py b/spells.py index 8660d01..5422e95 100644 --- a/spells.py +++ b/spells.py @@ -1,4 +1,5 @@ import random +from game_config import CHANCE_HEAL_PARTLY, CHANCE_HEAL_FULLY, DEBUG_MODE SPELL_TYPE_NONE = -1 SPELL_TYPE_USELESS = 0 @@ -7,9 +8,7 @@ SPELL_TYPE_COMMON = 2 SPELL_TYPE_POWERFUL = 3 SPELL_TYPE_UNFORGIVABLE = 4 -# If SPELL_TYPE_DEFENSE is casted, always these chances to heal partly (restore 5% of max hp) or completely -CHANCE_HEAL_PARTLY = 25 -CHANCE_HEAL_FULLY = 5 + #Maximum Levenshtein distance. Eg if a user casts 'Pritrgo' instead of 'Protego', distance would be 2 and Protego would still be cast if MAX_LEVENSHTEIN_DISTANCE is at least 2 #Set to 0 to disable @@ -94,6 +93,11 @@ spells = { _INVALID_SPELL: Spell(0, 0, 0, "(internal) invalid spell", SPELL_TYPE_NONE) } +# Set succes rates to 100% if debug mode is enabled +if DEBUG_MODE: + for i in spells.items(): + i[1].succes_rate = 100 + ## ## Standalone spell functions ## @@ -145,4 +149,4 @@ def print_spells(): .strip('(') .strip(')') .replace(',', ':', 1) - ) \ No newline at end of file + ) \ No newline at end of file