diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c545850 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/files \ No newline at end of file diff --git a/.gitignore/.gitignore b/.gitignore/.gitignore deleted file mode 100644 index 8d1c8b6..0000000 --- a/.gitignore/.gitignore +++ /dev/null @@ -1 +0,0 @@ - diff --git a/bin/Model.js b/bin/Model.js index af86409..f26403e 100644 --- a/bin/Model.js +++ b/bin/Model.js @@ -22,10 +22,10 @@ module.exports = class Model { this.rules.push(ruleName); } - addWeaponData (weaponData, selection) { + addWeaponData (weaponData, selection, numberOfModelsInUnit) { let newMatch = weaponData.$.name.match(weaponNameWithoutNumberRegex).groups, selectionNumber = selection.$.name.match(weaponNameWithoutNumberRegex).groups.number, - newNumber = newMatch.number ? parseInt(newMatch.number, 10) : selectionNumber ? parseInt(selectionNumber, 10) : 1; + newNumber = parseInt(selection.$.number, 10) / numberOfModelsInUnit; for (const weapon of this.weapons) { if (weapon.name === newMatch.weaponName) { @@ -37,7 +37,7 @@ module.exports = class Model { this.weapons.push({ name: newMatch.weaponName, number: newNumber }); } - handleSelectionDataRecursive (selectionData) { + handleSelectionDataRecursive (selectionData, numberOfModelsInUnit) { for (const selection of selectionData[0].selection) { if (selection.profiles && selection.profiles[0] !== "") for (const profile of selection.profiles[0].profile) @@ -55,7 +55,7 @@ module.exports = class Model { if (0 < ignore) continue; - this.addWeaponData(profile, selection); + this.addWeaponData(profile, selection, numberOfModelsInUnit); break; case "abilities": this.addAbilityData(profile); @@ -63,7 +63,7 @@ module.exports = class Model { } if (selection.selections && selection.selections[0] !== "") - this.handleSelectionDataRecursive(selection.selections); + this.handleSelectionDataRecursive(selection.selections, numberOfModelsInUnit); } } @@ -101,4 +101,4 @@ module.exports = class Model { return true; } -} \ No newline at end of file +} diff --git a/bin/ModelCollection.js b/bin/ModelCollection.js index 490f75e..9187493 100644 --- a/bin/ModelCollection.js +++ b/bin/ModelCollection.js @@ -50,7 +50,7 @@ module.exports = class ModelCollection { //console.log("selections: " + selectionData); if (selectionData && selectionData[0] !== "" && selectionData[0].selection) - newModel.handleSelectionDataRecursive(selectionData); + newModel.handleSelectionDataRecursive(selectionData, newModel.number); this.add(newModel); } @@ -137,4 +137,4 @@ module.exports = class ModelCollection { delete this.models[name]; } } -} \ No newline at end of file +} diff --git a/lua_modules/MatchedPlay.lua b/lua_modules/MatchedPlay.lua index 6c9b63f..4fbf26d 100644 --- a/lua_modules/MatchedPlay.lua +++ b/lua_modules/MatchedPlay.lua @@ -371,7 +371,7 @@ function hideCard(player, card) if element.attributes ~= nil and element.attributes.id ~= nil and (element.attributes.id:find("^ymc%-")) ~= nil and -- if we find a card - element.attributes.active = true then + element.attributes.active == true then return -- we found a card that is still visible, so we dont want to reset the UI end