Skip to content

Commit

Permalink
Merge branch 'main' into extend-multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
mericozkayagan authored Dec 14, 2024
2 parents 0623a70 + d5d7922 commit 1d87abc
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 8 deletions.
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,55 @@ terminal_quest/
## Best Practices

### Code Organization
- Modular design
- Modular design with clear separation of concerns
- Configuration centralized in settings.py
- Type hints throughout the codebase
- Comprehensive documentation and comments

### CI/CD
- Automated testing on pull requests
- Dependency updates via Dependabot
- Code quality checks:
- Type checking with mypy
- Linting with flake8
- Formatting with black
- Security scanning with bandit
- Automated test coverage reporting

### Error Handling
- Graceful fallback system for AI failures
- Input validation for all user interactions
- Proper exception handling for file and API operations

### Game Balance
- Configurable game constants in settings.py
- Balanced stat ranges for characters and items
- Progressive difficulty scaling
- Fair item drop rates and shop prices

### Performance
- Efficient status effect processing
- Minimal API calls with caching
- Optimized combat calculations

## Contributing

1. Fork the repository
2. Create a feature branch
3. Follow the established code style:
- Use type hints
- Follow PEP 8
- Add docstrings for functions and classes
- Update tests if applicable
4. Submit a pull request

## Future Enhancements
- Quest system
- More character classes
- Additional status effects
- Enhanced AI integration
- Saving/loading system
- Multiplayer support

## License
This project is licensed under the MIT License - see the LICENSE file for details.
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def main():

base_view.clear_screen()

base_view.clear_screen()

# Main game loop
while player.health > 0:
BaseView.clear_screen()
Expand Down
4 changes: 1 addition & 3 deletions src/models/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Dict, List, Optional, Any

from .skills import Skill

from ..display.common.message_view import MessageView
from .base_types import GameEntity, EffectTrigger
from .effects.base import BaseEffect
Expand Down Expand Up @@ -196,7 +195,7 @@ def __init__(self, name: str, char_class: CharacterClass):

# Session management attributes
self.session_id = None

def equip_item(self, item: "Equipment") -> bool:
"""
Equip an item to the appropriate slot
Expand Down Expand Up @@ -349,7 +348,6 @@ def deserialize(cls, data: Dict[str, Any]) -> "Player":
player.session_id = data["session_id"]
return player


class Enemy(Character):
def __init__(
self,
Expand Down
3 changes: 0 additions & 3 deletions src/services/combat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
from src.services.shop import Shop
from src.services.boss import BossService


class CombatResult(Enum):
VICTORY = auto()
DEFEAT = auto()
RETREAT = auto()


def calculate_damage(
attacker: "Character", defender: "Character", base_damage: int
) -> int:
Expand Down Expand Up @@ -289,7 +287,6 @@ def combat(

return not enemy_queue # True for victory, False for defeat


def handle_level_up(player: Player):
"""Handle level up logic and display"""
player.level += 1
Expand Down
1 change: 0 additions & 1 deletion src/services/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import psycopg2
from src.config.settings import DATABASE_SETTINGS


class ShopType(Enum):
GENERAL = "general"
BLACKSMITH = "blacksmith" # Weapons and armor
Expand Down

0 comments on commit 1d87abc

Please sign in to comment.