package game import ( "log" "strings" "testing" "muhq.space/muhqs-game/go/utils" ) func TestPioneerFullAction(t *testing.T) { mapDef := `map: |1- HST H H FW symbols: T: tower H: house F: farm S: street W: deep water ` s := NewLocalState() m, _ := readMap(strings.NewReader(mapDef)) s.SetMap(m) player := s.AddNewPlayer("p", NewDeck()) p := s.addNewUnit(NewCard("base/pioneer"), Position{1, 1}, player) sword := s.addNewEquipment(NewCard("base/sword"), Position{0, 1}, player) palisade := s.addNewArtifact(NewCard("base/palisade"), Position{0, 0}, player) a := p.FullActions[0] opts := a.Target().Options() if len(opts) != 11 { log.Printf("%q\n", opts) t.Fatal("expexted 11 targets to neutralize") } if !utils.InterfaceSliceContains(opts, sword) { t.Fatal("sword is missing") } if !utils.InterfaceSliceContains(opts, palisade) { t.Fatal("palisade is missing") } a.Target().AddSelection(m.TileAt(Position{0, 1})) s.ResolveAction(a) if m.TileAt(Position{0, 1}).Type != TileTypes.Neutral { t.Fatal("tile not neutralized") } a = p.FullActions[0] if len(a.Target().Selection()) != 0 { t.Fatal("full action still has target selection") } a.Target().AddSelection(palisade) s.ResolveAction(a) if m.TileAt(Position{0, 0}).Permanent != nil { t.Fatal("palisade not destroyed") } }