mirror of
https://github.com/BigJk/end_of_eden.git
synced 2026-02-06 10:48:09 +00:00
Support un-castable cards.
This commit is contained in:
parent
c7616099db
commit
526fe76a45
@ -1307,8 +1307,12 @@ func (s *Session) PlayerCastHand(i int, target string) error {
|
||||
|
||||
cardId := s.currentFight.Hand[i]
|
||||
|
||||
// Only cast a card if points are available and subtract them.
|
||||
// Only cast a card if castable and points are available and subtract them.
|
||||
if card, _ := s.GetCard(cardId); card != nil {
|
||||
if !card.Callbacks[CallbackOnCast].Present() {
|
||||
return errors.New("card is not castable")
|
||||
}
|
||||
|
||||
if s.currentFight.CurrentPoints < card.PointCost {
|
||||
return errors.New("not enough points")
|
||||
}
|
||||
|
||||
@ -14,3 +14,7 @@ func (cb OwnedCallback) Call(args ...any) (any, error) {
|
||||
|
||||
return cb(args...)
|
||||
}
|
||||
|
||||
func (cb OwnedCallback) Present() bool {
|
||||
return cb != nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user