Skip to content

Commit

Permalink
Fixes #13 - A Supreme can have "Other roles" (Stygian (Queen) is also…
Browse files Browse the repository at this point in the history
… a Powerhouse, for example)

Its other roles fill the slots (only one leader, only one powerhouse) and special leader effect (Honorary Member / Faction Card) can be granted to a Supreme who has "Leader" has an other role.
  • Loading branch information
Gulix committed Aug 7, 2015
1 parent 327c973 commit 3b881f5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 15 additions & 7 deletions builder/builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ <h4 class="modal-title" id="modal-enter-code-label">Enter a Team unique code</h4
if (window.selected_supremes_list[i].id == id)
{
// If this is a Leader, all the Honorary Members are also removed
var isLeader = window.selected_supremes_list[i].role_key == 'leader';
var isLeader = window.selected_supremes_list[i].role_key == 'leader'
|| isInTable(window.selected_supremes_list[i].other_roles, 'leader');
window.selected_supremes_list.splice(i, 1);
break;
}
Expand Down Expand Up @@ -791,7 +792,8 @@ <h4 class="modal-title" id="modal-enter-code-label">Enter a Team unique code</h4
{
for (var iSup = 0; iSup < window.selected_supremes_list.length; iSup++)
{
if (window.selected_supremes_list[iSup].role_key == "leader")
if (window.selected_supremes_list[iSup].role_key == "leader"
|| isInTable(window.selected_supremes_list[iSup].other_roles, 'leader'))
return window.selected_supremes_list[iSup].factions;
}

Expand Down Expand Up @@ -873,7 +875,8 @@ <h4 class="modal-title" id="modal-enter-code-label">Enter a Team unique code</h4
var active = $('#honorary-member').hasClass('honorary-member-active');
for (var iSel = 0; iSel < window.selected_supremes_list.length; iSel++)
{
if (window.selected_supremes_list[iSel].role_key == "leader")
if ((window.selected_supremes_list[iSel].role_key == "leader")
|| isInTable(window.selected_supremes_list[iSel].other_roles, 'leader'))
displayed = true;
if (window.selected_supremes_list[iSel].is_honorary_member)
disabled = true;
Expand Down Expand Up @@ -1058,9 +1061,11 @@ <h4 class="modal-title" id="modal-enter-code-label">Enter a Team unique code</h4
var shownSupremesId = []; // Special shown Supremes
for (var iSel=0; iSel < window.selected_supremes_list.length; iSel++)
{
if (window.selected_supremes_list[iSel].role_key == "leader")
if ((window.selected_supremes_list[iSel].role_key == "leader")
|| isInTable(window.selected_supremes_list[iSel].other_roles, 'leader'))
excludeLeader = true;
if (window.selected_supremes_list[iSel].role_key == "powerhouse")
if ((window.selected_supremes_list[iSel].role_key == "powerhouse")
|| isInTable(window.selected_supremes_list[iSel].other_roles, 'powerhouse'))
excludePowerhouse = true;

// Excluded supremes
Expand Down Expand Up @@ -1108,8 +1113,8 @@ <h4 class="modal-title" id="modal-enter-code-label">Enter a Team unique code</h4
|| (isVillainsOnly && !window.supremes_list[i].is_villain)
|| isSelected
// Only one Leader / Powerhouse
|| (excludeLeader && (window.supremes_list[i].role_key == "leader"))
|| (excludePowerhouse && (window.supremes_list[i].role_key == "powerhouse"))
|| (excludeLeader && ((window.supremes_list[i].role_key == "leader") || isInTable(window.supremes_list[i].other_roles, 'leader')))
|| (excludePowerhouse && ((window.supremes_list[i].role_key == "powerhouse") || isInTable(window.supremes_list[i].other_roles, 'powerhouse')))
// Excluded supremes
|| (isInTable(excludedSupremesId, window.supremes_list[i].id))
// Excluded factions
Expand Down Expand Up @@ -1177,6 +1182,9 @@ <h4 class="modal-title" id="modal-enter-code-label">Enter a Team unique code</h4
/************************/
function isInTable(tableData, searchedData)
{
if ((tableData === undefined) || (tableData === null))
return false;

for(var i=0; i<tableData.length; i++)
{
if (tableData[i] == searchedData)
Expand Down
2 changes: 2 additions & 0 deletions builder/json/supremes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,7 @@
"name": "Stygian (True)",
"level": 3,
"role_key": "powerhouse",
"other_roles": [ "leader" ],
"ap_granted": 3,
"minions_granted": 0,
"factions": [ "forgotten" ],
Expand Down Expand Up @@ -4036,6 +4037,7 @@
"name": "Stygian (Queen)",
"level": 3,
"role_key": "leader",
"other_roles": [ "powerhouse" ],
"ap_granted": 3,
"minions_granted": 0,
"factions": [ "forgotten" ],
Expand Down

0 comments on commit 3b881f5

Please sign in to comment.