Coder Social home page Coder Social logo

python-consolegame-wizardsduel's Introduction

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

python-consolegame-wizardsduel's People

Contributors

kw46 avatar

Watchers

 avatar

python-consolegame-wizardsduel's Issues

Stunned rounds incorrect value (off by one)

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

FIX #2

Guess I've had enough for today.
stunned_rounts => stunned_rounds...

Game doesn't end as long as someone is stunned

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

Stunned player can sometimes still perform spells / EDIT: protego succeeds even if failed

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 confusing
  • In round 3, Traxyy tried to cast Protego 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.
  • ^This would thus also happen if player is not stunned
  • In round 3, it appears as if Player.cast_spell() did nothing for Traxyy. Expected <!> Traxyy tries to cast a spell but fails because they are stunned!. Need to figure out why

EDIT:
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!

Improvement: Use dictionaries

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)

Wrong intro message (spell speed description)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.