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

Fix/targets #108

Merged
merged 9 commits into from
Aug 20, 2020
Merged

Fix/targets #108

merged 9 commits into from
Aug 20, 2020

Conversation

oskarrough
Copy link
Owner

@oskarrough oskarrough commented Aug 20, 2020

All cards have a target property that specifies which targets the card can be played at. Allowed ones are currently player, enemy and all enemies.

Before this PR, it wasn't really enforced e.g. a "Strike" card with target: enemy could also be played on yourself, the player.

This PR changes that and makes sure the card.target is respected.

If we later want to allow attacking yourself, we can now do that in a cleaner way by creating a new target player and enemies or something like that. But that's for later, at least now it's "clean".

Closes #104 , fixes #106.

@oskarrough oskarrough added the bug Something isn't working label Aug 20, 2020
@oskarrough oskarrough self-assigned this Aug 20, 2020
@oskarrough
Copy link
Owner Author

@SamuelRott thoughts? This overlaps a bit with your new conditions logic maybe?

@@ -54,7 +54,7 @@ export const cards = [
energy: 1,
damage: 5,
block: 5,
target: 'self and enemy',
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wasn't even implemented

public/game/utils.js Outdated Show resolved Hide resolved
public/ui/dragdrop.js Outdated Show resolved Hide resolved
}

onAdd(cardElement.dataset.id, target, cardElement)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename onAdd to afterRelease?

@SamuelRott
Copy link
Collaborator

Hello,

I dont think this overlap the conditions logic. They both concern different part of the game and rely on different logic.

For the long run I would say that card.target is not going to be enough. We are going to need card.allowedTarget = [].
Where card.target is defined only if the card has a specific target and card.allowedTarget is a list of the possible target of this card (we currently don't need this).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using Bash card on player throw an error You are not able to defend an enemy
2 participants