Skip to content

Commit

Permalink
Add conditional blocker code for AttackCreature as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
jyotiskaghosh committed Oct 19, 2024
1 parent 4da1e87 commit ed3b5f7
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion game/fx/creature.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,25 @@ func Creature(card *match.Card, ctx *match.Context) {
FindFilter(
opponent,
match.BATTLEZONE,
func(x *match.Card) bool { return x.HasCondition(cnd.Blocker) && !x.Tapped },
func(x *match.Card) bool {

canBlock := false

for _, condition := range x.Conditions() {
if condition.ID != cnd.Blocker {
continue
}

if f, ok := condition.Val.(BlockerCondition); ok {
// conditional Blocker
canBlock = canBlock || f(card)
} else {
canBlock = true
}
}

return canBlock && !x.Tapped
},
).Map(func(x *match.Card) {
event.Blockers = append(event.Blockers, x)
})
Expand Down

0 comments on commit ed3b5f7

Please sign in to comment.