Skip to content

Commit

Permalink
Make Horrid Worm's discard effect happen before shields are broken
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikbjornr authored Aug 21, 2020
1 parent 4e105f2 commit 1bfb574
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions game/cards/dm02/parasite_worm.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,16 @@ func HorridWorm(c *match.Card) {

c.Use(fx.Creature, fx.When(fx.Attacking, func(card *match.Card, ctx *match.Context) {

ctx.ScheduleAfter(func() {
hand := fx.Find(ctx.Match.Opponent(card.Player), match.HAND)

hand := fx.Find(ctx.Match.Opponent(card.Player), match.HAND)
if len(hand) < 1 {
return
}

if len(hand) < 1 {
return
}

discardedCard, err := ctx.Match.Opponent(card.Player).MoveCard(hand[rand.Intn(len(hand))].ID, match.HAND, match.GRAVEYARD)
if err == nil {
ctx.Match.Chat("Server", fmt.Sprintf("%s was discarded from %s's hand by Horrid Worm", discardedCard.Name, discardedCard.Player.Username()))
}
})
discardedCard, err := ctx.Match.Opponent(card.Player).MoveCard(hand[rand.Intn(len(hand))].ID, match.HAND, match.GRAVEYARD)
if err == nil {
ctx.Match.Chat("Server", fmt.Sprintf("%s was discarded from %s's hand by Horrid Worm", discardedCard.Name, discardedCard.Player.Username()))
}

}))

Expand Down

0 comments on commit 1bfb574

Please sign in to comment.