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

Instant-cast cards #21

Closed
cheesefrycook opened this issue Dec 15, 2023 · 15 comments · Fixed by #39
Closed

Instant-cast cards #21

cheesefrycook opened this issue Dec 15, 2023 · 15 comments · Fixed by #39
Assignees
Labels
confirmed Has been approved to make code based on this new feature Ask for a new feature

Comments

@cheesefrycook
Copy link
Collaborator

Feature Description

Cards should have the ability to instantly play their effects, instead of always having to select a target. To better facilitate this, we can change card input from click-only to drag-and-drop.

Motivation

Currently, all cards require you to select a target. If it's a healing card, you have to click the player. If it's an attack card, you have to click an enemy. However, this doesn't make much sense for cards where there isn't a specific target. Some examples:

  • a "draw cards" card - currently you have to select the player to play this card
  • cards that damage the entire enemy party - currently you have to select a specific enemy

Because of this, it makes sense to allow those cards to be cast instantly without needing to select a specific target.

A drag-and-drop system makes more sense if we implement instant-cast cards. If we implement instant cast cards with the current input system, then the player could easily click a card in their hand on accident and play it by mistake. It's a lot more difficult to make a mistake with a drag-and-drop system. A drag-and-drop system also feels more intuitive, in my opinion.

Acceptance Criteria

  • Certain cards can be instantly played
  • Cards can be dropped into the play area to play them
  • Right click cancels dragging and returns the card to the player's hand

Proposed Solution

To play a card, you first have to grab it and drop it into the "play area", which is the portion of the screen outside of your hand. Upon doing so, one of two things happens:

  • The card instantly applies its effects to the relevant targets.
  • The card moves to a central location and the player must now select a target. Upon selecting a target, the card's effects are applied.

This will require modification of the CardContainer. When a card is clicked, instead of becoming the queued_card it becomes the dragging_card. If the dragging_card is a certain distance away from its starting position on the y-axis, it can be played by clicking again. A new state will be added to CardMovementComponent (see #12) called FOLLOWING_MOUSE.

CardEffects will contain a new CastType enum:

  • CastType
    • SINGLE_TARGET - affects a single target. If a card with this effect is played by a player, they have to select an enemy to cast the card on.
    • ALL_TARGETS - affects all targets. If the card only contains this CastType, then the card is instantly cast. The player will not have to select a target.

Implementation Steps (Optional)

  • Implement new CastType enum
  • Allow cards to be cast instantly instead of having to select a target
  • Implement drag-and-drop style input

Additional Context

Depends on #14 and #12

@cheesefrycook cheesefrycook added the new feature Ask for a new feature label Dec 15, 2023
@Turtyo
Copy link
Collaborator

Turtyo commented Dec 16, 2023

Will also need to change the queue/unqueue cards to take this new step in account. Apart from that, everything is clear for me ! i'm not really sure it's dependent on #14 though.

@Turtyo Turtyo added the confirmed Has been approved to make code based on this label Dec 16, 2023
@cheesefrycook
Copy link
Collaborator Author

Well my thought is that CardEffect will contain the CastType, and plays its effect according to that. But I guess this could be implemented with the current system as well, CastType would just be on the CardBase instead

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 17, 2023

the effect is just that, an effect. It does not say how it can be applied. For example, you could have poison on one target or poison all targets. it would make more sense to keep that on the CardBase because that will be card specific and not effect specific

@cheesefrycook
Copy link
Collaborator Author

Hm that's true. How should we handle a card like "Heal 1 health, deal 3 damage to all enemies"? That's both a single-target friendly effect, as well as a multi-target enemy effect. I guess we will have to have some structure on the CardBase than handles that.

class CardTargetData
   var cast_type: CastType
   var effect: CardEffect

Instead of having an array of CardEffect on CardBase we have the above CardTargetData

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 17, 2023

yes that's exactly what i was thinking, when you build a card you would specify three things:

  • the effect
  • who it applies to
  • the value of the effect

And if you have multiple effects, then you just do that multiple times. So for your card example it would look like this (random format, just to visualize):

Card Vampire:
Effect: heal
Application: self (though I'm guessing by default heal will be to self)
Value: 1

Effect: damage
Application: all enemies
Value: 3

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 17, 2023

I think I will still implement #14 as it was described ? as this will come later

@cheesefrycook
Copy link
Collaborator Author

Yeah that sounds good, we can implement this structure along with this PR I suppose

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 17, 2023

When you mean "this structure" you mean the one discussed in this issue, and by "this PR" you mean the PR that will come with this issue ?
Just to make sure we aren't talking about issue 14

@cheesefrycook
Copy link
Collaborator Author

Yep that's what I meant

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 18, 2023

In the end, I will implement this part now because it makes more sense, along #14

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 21, 2023

Should the application type discussed here #27 (comment) be implemented along this issue, or should it go with another issue ?

@cheesefrycook
Copy link
Collaborator Author

I think we can implement it here.

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 21, 2023

Alright so just a recap here to be sure we agree on what's to do.

We have 3 types of cast: TARGET_ENEMY, SELF and ALL_ENEMIES
I didn't include target team since we have only 1 player in the team. Should we do it like if we had more than 1 player in case we decide to add allies later on ?

To know if a card can be instant cast or not, we check all the types of cast of the effects on the card. Let's say we have a damage effect with target, a poison all and a heal self. Since there is a TARGET in the effects, the card can't be instant cast. Actually, the card is instant-cast unless it has at least one effect with a target cast.

Later on, I will make a custom targeting class, which will give options for the enemies we put in the list of targets. But for now, the way we do it is:

  • SELF : list of targets is the player
  • ALL_ENEMIES : list of targets is the entire enemy team
  • TARGET_ENEMY : list of targets is a simple element, the targeted enemy (this will later change to use custom targeting, ie if you want to strike the targeted enemy and the two on his sides)

@cheesefrycook
Copy link
Collaborator Author

That sounds good! I think we could go ahead and add an ALL_FRIENDLY type too because it wouldn’t be too much extra work. That would allow us to have enemy attacks like “buff entire party”

@Turtyo
Copy link
Collaborator

Turtyo commented Dec 22, 2023

Indeed from the point of view of enemies, they could target their party this way. But I was thinking it would be better to not change the tag depending from the point of view. Even from the point of view of the enemies, their parties members are tagged as enemies. That would prevent errors like being confused on whose turn it is.

But we can have ALL_FRIENDLY in case we add companions later.

@JonaLam JonaLam self-assigned this Dec 25, 2023
@JonaLam JonaLam mentioned this issue Jan 1, 2024
@Turtyo Turtyo linked a pull request Jan 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed Has been approved to make code based on this new feature Ask for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants