Simple console game written in Python.
Based the on Harry Potter franchise.
You can run the game via pipenv. If you don't, make sure package levenshtein is installed.
Run entry.py
to run the game
Simple console game written in Python.
Based the on Harry Potter franchise.
You can run the game via pipenv. If you don't, make sure package levenshtein is installed.
Run entry.py
to run the game
Ensure (even though nobody will ever actually use this) stuff is documented
Make the entry file more of an entry file.
Makes the code better readable and should make handling exceptions easier.
When a player gets stunned (/silenced), they are immidiately un-stunned the next move (if they were stunned for 1 move).
This happens because round_end()
decreases player.stunned_rounds
by one, which happens after .stunned_rounds
is set without any checks.
Easiest fix would be to increase stunned_rounds by one
Guess I've had enough for today.
stunned_rounts
=> stunned_rounds
...
Currently, the game checks if a player's health is 0 at the end of each round (note: not in end_round()
)
However, this round can end earlier (in the code) if only one of the two players was succesful in casting a spell (# > Determine instant winner or skip to next round
). So actually the title is a bit inaccurate
In player.cast_spell()
, lines 137-152
.stuned_moves
is used instead of .stunned_rounds
If a stunned player is the fastest_caster, it somehow sometimes still allows the stunned player to perform their spell.
player.py:68-70
(cast_spell()
)
if self.stunned_rounds > 0 and self.active_spell != spell_finite_incantatem:
print("<!> {name} tries to cast a spell but fails because they are stunned!".format(name=self.name))
return
Kwarde casted 'Sectumsempra' with succes
Traxyy tried to cast 'Protego' but mispronounced it. Cast FAILED!
- Kwarde casts sectumsempra on Traxyy. FAILURE! Traxyy blocks the attack!
<!> Round 3 ended! Current stats:
- Kwarde: Health: 1000 | Queued effects: None | Round being stunned: 0
- Traxyy: Health: 1000 | Queued effects: None | Rounds being stunned: 1
== Round 3 ==
Kwarde, it's your turn to enter a spell: Stupefy
Traxyy, how will you obliviate your opponent? Silencio
Kwarde casted 'Stupefy' with succes
Traxyy casted 'Silencio' with succes
- Kwarde's spell speed is 95. Traxyy's spell speed is 35. Kwarde is the fastest caster this round!
- Kwarde casts stupefy on Traxyy causing 75 damage!
<!> Traxyy tries to cast a spell but fails because they are stunned!
<!> Round 4 ended! Current stats:
Player.cast_spell_result()
should not call a succes message if the player is stunned because that's confusingProtego
but failed, yet the attack was succesfully blocked: Player.cast_spell_result()
should set .active_spell
to spell_none
to prevent Player.cast_spell()
thinking the spell was still cast.Player.cast_spell()
did nothing for Traxyy. Expected <!> Traxyy tries to cast a spell but fails because they are stunned!
. Need to figure out whyEDIT:
Confirmed (missing contect, so clarifying: 'Kwarde' was not stunned at the time)
Kwarde tried to cast 'Protego' but mispronounced it. Cast FAILED!
Traxyy casted 'Rictusempra' with succes
- Traxyy casts rictusempra on Kwarde. FAILURE! Kwarde blocks the attack!
Instead of all seperate spell_x
and wand_x
objects, use dictionaries.
This makes more sense (why didn't I think of it earlier? [thnx tgrtim :)]), especially in the sense if importing them (and not having both the objects ánd a list holding those objects)
When using help SPELL_NAME
, a list is returned containing both the actual info, and 0
(levenshtein distance, which is always 0 in this scenario).
Should print spell[0]
in https://github.com/KW46/Python-ConsoleGame-WizardsDuel/blob/development/game.py#L49
Add return types to functions, like so: def add(x: int, y: int) -> int:
They can be added to variables too: my_integer: int = 1
It doesn't actually enforce types but useful nonetheless
intro_welcome_message()
currently states:
3- SPEED: If both players succesfully cast a spell, the spell with the greatest speed will succeed and the other one will not
This is not true; initially it was but now the fastest spell is just executed first.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.