(result, defendThangsGoal)
| 703 | } |
| 704 | |
| 705 | function generateDefendThangs (result, defendThangsGoal) { |
| 706 | let lastThangCount = result.thangs.length |
| 707 | let addedThangCount = 0 |
| 708 | for (let i = 0; i <= Math.floor(Math.random() * 8);) { |
| 709 | const defendThang = { |
| 710 | id: getRandomThang(['Chicken Junior']), |
| 711 | pos: getRandomPosition(result), |
| 712 | margin: 0 |
| 713 | } |
| 714 | if (addThang(result, defendThang)) { |
| 715 | if (result.thangs.length === lastThangCount) { break } |
| 716 | lastThangCount = result.thangs.length |
| 717 | if (i === 0) { |
| 718 | defendThangsGoal.saveThangs = [] |
| 719 | } |
| 720 | const newID = defendThang.id + (addedThangCount ? ' ' + addedThangCount : '') |
| 721 | defendThangsGoal.saveThangs.push(newID) |
| 722 | ++addedThangCount |
| 723 | ++i |
| 724 | } |
| 725 | if (!defendThangsGoal.saveThangs.length) { |
| 726 | console.log("Couldn't find space for a chicken; removing defendThangsGoal") |
| 727 | result.goals = _.without(result.goals, defendThangsGoal) |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | const buildFunctions = {} |
| 733 |
no test coverage detected