Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part 6: Clarification on Player AI #42

Open
00willo opened this issue Dec 29, 2020 · 1 comment
Open

Part 6: Clarification on Player AI #42

00willo opened this issue Dec 29, 2020 · 1 comment

Comments

@00willo
Copy link

00willo commented Dec 29, 2020

In the tutorial text, you say:

We’ve changed each entity to make use of the Actor class, and used the HostileEnemy AI class for the Orc and the Troll types, while using the BaseAI for our player.

However, the diff and the code currently in the repo has:

player = Actor(
    char="@", color=WHITE, name="Player", ai_cls=HostileEnemy, fighter=Fighter(hp=30, defence=2, power=5)
)

Just confirming, that the ai_cls for the player actor should indeed be set to BaseAI.

But, I was wonder if the ai_cls component should in fact be Optional, as my first though was I'm the AI, and so the AI component should be set to None for the player actor. Though this would also require changing the implementation of the is_alive property on the Actor class.

@00willo 00willo changed the title Part 6: Player AI Part 6: Clarification on Player AI Dec 29, 2020
@HexDecimal
Copy link
Collaborator

Sorry for a slow response.

Because the time system is player-centric it doesn't matter what the player AI is set to. The players AI is ignored on the enemy turn and is ignored again on the players turn.

is_alive could be changed to look for some other indicator of alive-ness or be set directly. The best options would involve switching to a non-player-centric time system, but that could require a rewrite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants