Beispiel #1
0
func plane(client RESTClient, armory ordnance.Armory, weaponNames ...string) as.Plane {
	var fullName string
	for _, name := range weaponNames {
		fullName += "_" + name
	}
	plane := as.NewPlane(fullName, client)
	arsenal := armory.GetArsenal(weaponNames...)
	plane.Arm(arsenal)
	return plane
}
Beispiel #2
0
// AddClones creates the specified number of Planes, each armed with the
// payload described, which can be one or more weapons.
func (s *Squadron) AddClones(clones int, client sleepwalker.RESTClient, armory ordnance.Armory, weaponNames ...string) {
	for i := 1; i <= clones; i++ {
		var arsenal ordnance.Arsenal
		name := fmt.Sprintf("clone_%d_of_%d", i, clones)
		for _, weapon := range weaponNames {
			name = fmt.Sprintf("%s_%s", name, weapon)
			arsenal = append(arsenal, armory.GetWeapon(weapon))
		}
		plane := NewPlane(name, client)
		plane.Arm(arsenal)
		s.Add(plane)
	}
}
Beispiel #3
0
// AddChaos creates the specified number of Planes that each have their own
// random selection of n weapons, quantified by their "deadliness."
func (s *Squadron) AddChaos(clones int, deadliness int, client sleepwalker.RESTClient, armory ordnance.Armory) {
	desc := "AddChaos"
	for i := 1; i <= clones; i++ {
		name := fmt.Sprintf("chaos_%d_of_%d", i, clones)
		plane := NewPlane(name, client)

		weaponNames := armory.GetRandomWeaponNames(deadliness)
		var arsenal ordnance.Arsenal
		for _, weaponName := range weaponNames {
			log.WithFields(map[string]interface{}{
				"plane":  name,
				"weapon": weaponName,
				"msg":    "adding weapon",
			}).Debug(desc)
			arsenal = append(arsenal, armory.GetWeapon(weaponName))
		}
		plane.Arm(arsenal)
		s.Add(plane)
	}
}