github.com/loomnetwork/gamechain@v0.0.0-20200406110549-36c47eb97a92/battleground/ability_devour_zombie_and_combine_stats.go (about) 1 package battleground 2 3 import ( 4 "github.com/loomnetwork/gamechain/types/zb/zb_data" 5 "github.com/loomnetwork/gamechain/types/zb/zb_enums" 6 ) 7 8 // devourZombieAndCombineStats ability 9 // description: 10 // TODO 11 type devourZombieAndCombineStats struct { 12 *CardInstance 13 cardAbility *zb_data.CardAbilityDevourZombieAndCombineStats 14 targets []*CardInstance 15 } 16 17 var _ Ability = &devourZombieAndCombineStats{} 18 19 func NewDevourZombieAndCombineStats(card *CardInstance, cardAbility *zb_data.CardAbilityDevourZombieAndCombineStats, targets []*CardInstance) *devourZombieAndCombineStats { 20 return &devourZombieAndCombineStats{ 21 CardInstance: card, 22 cardAbility: cardAbility, 23 targets: targets, 24 } 25 } 26 27 func (c *devourZombieAndCombineStats) Apply(gameplay *Gameplay) error { 28 for _, target := range c.targets { 29 c.Instance.Defense += target.Instance.Defense 30 c.Instance.Damage += target.Instance.Damage 31 if err := target.MoveZone(zb_enums.Zone_PLAY, zb_enums.Zone_GRAVEYARD); err != nil { 32 return err 33 } 34 } 35 36 // TODO: Implement outcome for frontend 37 38 return nil 39 }