Skip to content

Commit

Permalink
fixed sub oracle oracles
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleHeihin committed Oct 25, 2023
1 parent 95ff460 commit e1e3b9e
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 288 deletions.
380 changes: 190 additions & 190 deletions Ironsworn-Starforged/Ironsworn-starforged.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,14 @@
mixin oracleListGroupItem(id, buttonLabel)
+oracleRollBtn(id, buttonLabel)

mixin oracleSubtablesListGroupItem(id, buttonLabel, tables)
mixin oracleSubOraclesListGroupItem(id, buttonLabel, oracles)
-
let counter = 0;Label
let options = [];
tables.forEach((oracle) => {
if (oracle.Tables) {
oracle.Tables.forEach(subtable => {
let tableLabel = subtable['Display name']||subtable['Name'];
options.push(`${tableLabel},${counter}`);
counter++;
})
}
else {
let tableLabel = oracle['Display name']||oracle['Name'];
options.push(`${tableLabel},${counter}`);
counter++;
}
oracles.forEach((oracle) => {
let tableLabel = oracle['Name'];
options.push(`${tableLabel},${counter}`);
counter++;
})
- const rollQuery = `{{tableChoice=[[(?{Choose Table|${options.join('|')}})]]}}`
+oracleRollBtn(id, buttonLabel, rollQuery)
Expand Down Expand Up @@ -55,8 +46,8 @@ mixin oracleRollBtn(id, buttonLabel, rollQuery="")
.btn-content.oracle-name=buttonLabel.replace(/ - /i, ": ")

mixin oracleMultiBtn(oracle, btnText, indexOffset=0)
- const labelText = oracle['Display name']||oracle['Name']
- const options = oracle.Tables.map((table, index) => { return `${table['Display name']||table['Name']},${index+indexOffset}` })
- const labelText = oracle['Name']
- const options = oracle.Tables.map((table, index) => { return `${table['Name']},${index+indexOffset}` })
- const rollQuery = `{{tableChoice=[[(?{Choose Table|${options.join('|')}})]]}} {{header=${labelText}}}`
- const id = oracle.id
label.roll-label.embedded-btn=btnText||labelText
Expand All @@ -68,7 +59,7 @@ mixin oracleMultiBtn(oracle, btnText, indexOffset=0)
)

mixin oracleSingleButton(oracle, btnText)
- const labelText=oracle['Display name']||oracle.Name
- const labelText=oracle.Name
- const id = oracle.id
label.roll-label.surface-2.embedded-btn=btnText||labelText
button.hide-element(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,48 +74,10 @@ mixin oracleTableRow(table, row, index)
function rangeString(initChance, finalChance) {
return (initChance === finalChance) ? finalChance : `${initChance}-${finalChance}`;
};
//- function resultString(row) {
//- let detailsKeys = ["Assets", "Details"];
//- let detailsStrings = [];
//- detailsKeys.forEach(key => {
//- if (row[key]) {
//- if (key === "Assets") {
//- row[key] = row[key].map(item => item.toUpperCase());
//- }
//- detailsStrings.push(row[key])
//- };
//- });
//- let detailString;
//- if (detailsStrings.length > 0) {
//- detailsStrings = detailsStrings.flat(2);
//- detailString = `(${detailsStrings.join(", ")})`;
//- };
//- const result = `${row.Description}${detailString ? " " + detailString : ""}`;
//- return result;
//- }
let ranges = [];
//- if (Array.isArray(row.Chance)) {
//- row.Chance.forEach((chance, chanceIndex) => {
//- if (chance === 0) {
//- ranges.push(`—`)
//- }
//- else {
//- //- const initChance = (index === 0) ? chance - (chance - 1) : table[index - 1].Chance[chanceIndex] + 1;
//- //- const finalChance = chance;
//- const initChance = (index === 0) ? chance - (chance - 1) : table[index - 1].Chance[chanceIndex] + 1;
//- const finalChance = chance;
//- ranges.push(rangeString(initChance, finalChance));
//- }
//- })
//- }
//- else {
//- const initChance = (index === 0) ? row.Chance - (row.Chance - 1) : table[index - 1].Chance + 1;
//- const finalChance = row.Chance;
const initChance = row.Floor;
const finalChance = row.Ceiling;
ranges.push(rangeString(initChance, finalChance));
//- }
tr.oracle-row
each range in ranges
td.oracle-roll!=range
Expand Down
24 changes: 12 additions & 12 deletions Ironsworn-Starforged/src/app/components/oracles/oracle-preview.pug
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ mixin oraclePreviewToggle(type, name, id)

mixin oracleRollGroup(group)
.oracle-box.surface
.oracle-title=group['Display name']||group.Name
.oracle-title=group.Name
each oracle in group.Oracles
- const header = `${group['Display name']||group.Name} - ${oracle.Name}`
- const header = `${group.Name} - ${oracle.Name}`
.oracle
if (oracle.Tables)
- let buttonLabel = oracle['Display name']||oracle.Name
+oracleSubtablesListGroupItem(oracle.$id, buttonLabel, oracle.Tables)
if (oracle.Oracles)
- let buttonLabel = oracle.Name
+oracleSubOraclesListGroupItem(oracle.$id, buttonLabel, oracle.Oracles)
else
+oracleRollBtn(oracle.$id, oracle['Display name']||oracle.Name)
if group.Subcategories
each subCategory in group.Subcategories
- const buttonLabel = subCategory['Display name']||subCategory.Name
.oracle.oracle-subcategory
+oracleSubtablesListGroupItem(subCategory.id, buttonLabel, subCategory.Oracles)
+oracleRollBtn(oracle.$id, oracle.Name)
//- if group.Subcategories
//- each subCategory in group.Subcategories
//- - const buttonLabel = subCategory['Display name']||subCategory.Name
//- .oracle.oracle-subcategory
//- +oracleSubOraclesListGroupItem(subCategory.id, buttonLabel, subCategory.Oracles)
mixin oraclePreview(oracle, groupName)
input(class=`${oracle.$id} hide-element` type='radio' name=`attr_oracle_preview` value=oracle.$id)
div(class=`${oracle.$id} showhide oracle-table-preview surface` id=oracle.$id)
- let nameString = oracle['Display name'] && oracle['Display name'].match(/ - /i) ? oracle['Display name'].replace(/ - /i, ": ") : `${groupName}: ${oracle['Display name']||oracle.Name}`
- let nameString = oracle['Display name'] && oracle['Display name'].match(/ - /i) ? oracle['Display name'].replace(/ - /i, ": ") : `${groupName}: ${oracle.Name}`
.oracle-title=nameString
if oracle.Table
+oracleTable(oracle)
Expand Down
24 changes: 12 additions & 12 deletions Ironsworn-Starforged/src/app/translations/translation-oracles.json
Original file line number Diff line number Diff line change
Expand Up @@ -1957,24 +1957,24 @@
"Starforged/Oracles/Moves/Take_Decisive_Action/77-88": "Others won’t forget: You are marked for vengeance",
"Starforged/Oracles/Moves/Take_Decisive_Action/89-100": "It gets complicated: The true nature of a foe or objective is revealed",
"Starforged/Oracles/Moves/Endure_Harm-name": "Endure Harm",
"Starforged/Oracles/Moves/Endure_Harm/1-10": "You suffer mortal harm. [Face Death](Starforged/Moves/Threshold/Face_Death).",
"Starforged/Oracles/Moves/Endure_Harm/11-20": "You are dying. Within an hour or two, you must [Heal](Starforged/Moves/Recover/Heal) and raise your health above 0, or [Face Death](Starforged/Moves/Threshold/Face_Death).",
"Starforged/Oracles/Moves/Endure_Harm/21-35": "You are unconscious and out of action. If left alone, you come back to your senses in an hour or two. If you are vulnerable to ongoing harm, [Face Death](Starforged/Moves/Threshold/Face_Death).",
"Starforged/Oracles/Moves/Endure_Harm/1-10": "You suffer mortal harm. <u>Face Death</u>.",
"Starforged/Oracles/Moves/Endure_Harm/11-20": "You are dying. Within an hour or two, you must <u>Heal</u> and raise your health above 0, or <u>Face Death</u>.",
"Starforged/Oracles/Moves/Endure_Harm/21-35": "You are unconscious and out of action. If left alone, you come back to your senses in an hour or two. If you are vulnerable to ongoing harm, <u>Face Death</u>.",
"Starforged/Oracles/Moves/Endure_Harm/36-50": "You are reeling and fighting to stay conscious. If you engage in any vigorous activity before taking a breather for a few minutes, roll on this table again (before resolving the other move).",
"Starforged/Oracles/Moves/Endure_Harm/51-100": "You are still standing.",
"Starforged/Oracles/Moves/Endure_Stress-name": "Endure Stress",
"Starforged/Oracles/Moves/Endure_Stress/1-10": "You are overwhelmed. [Face Desolation](Starforged/Moves/Threshold/Face_Desolation).",
"Starforged/Oracles/Moves/Endure_Stress/11-25": "You give up. [Forsake Your Vow](Starforged/Moves/Quest/Forsake_Your_Vow).",
"Starforged/Oracles/Moves/Endure_Stress/1-10": "You are overwhelmed. <u>Face Desolation</u>.",
"Starforged/Oracles/Moves/Endure_Stress/11-25": "You give up. <u>Forsake Your Vow</u>.",
"Starforged/Oracles/Moves/Endure_Stress/26-50": "You give in to fear or compulsion, and act against your better instincts.",
"Starforged/Oracles/Moves/Endure_Stress/51-100": "You persevere.",
"Starforged/Oracles/Moves/Withstand_Damage-name": "Withstand Damage",
"Starforged/Oracles/Moves/Withstand_Damage/1-10": "Immediate catastrophic destruction. All aboard must [Endure Harm](Starforged/Moves/Suffer/Endure_Harm) or [Face Death](Starforged/Moves/Threshold/Face_Death), as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/11-25": "Destruction is imminent and unavoidable. If you do not have the means or intention to get clear, [Endure Harm](Starforged/Moves/Suffer/Endure_Harm) or [Face Death](Starforged/Moves/Threshold/Face_Death) as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/26-40": "Destruction is imminent, but can be averted if you [Repair](Starforged/Moves/Recover/Repair) your vehicle and raise its integrity above 0. If you fail, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/41-55": "You cannot [Repair](Starforged/Moves/Recover/Repair) this vehicle until you [Resupply](Starforged/Moves/Recover/Resupply) and obtain a crucial replacement part. If you roll this result again prior to that, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/56-70": "The vehicle is crippled or out of your control. To get it back in action, you must [Repair](Starforged/Moves/Recover/Repair) and raise its integrity above 0.",
"Starforged/Oracles/Moves/Withstand_Damage/71-85": "It's a rough ride. All aboard must make the [Endure Harm](Starforged/Moves/Suffer/Endure_Harm), [Endure Stress](Starforged/Moves/Suffer/Endure_Stress), or [Companion Takes a Hit](Starforged/Moves/Suffer/Companion_Takes_a_Hit) move, suffering a serious (-2) cost.",
"Starforged/Oracles/Moves/Withstand_Damage/86-95": "You’ve lost fuel, energy, or cargo. [Sacrifice Resources](Starforged/Moves/Suffer/Sacrifice_Resources) (-2).",
"Starforged/Oracles/Moves/Withstand_Damage/1-10": "Immediate catastrophic destruction. All aboard must <u>Endure Harm</u> or <u>Face Death</u>, as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/11-25": "Destruction is imminent and unavoidable. If you do not have the means or intention to get clear, <u>Endure Harm</u> or <u>Face Death</u> as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/26-40": "Destruction is imminent, but can be averted if you <u>Repair</u> your vehicle and raise its integrity above 0. If you fail, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/41-55": "You cannot <u>Repair</u> this vehicle until you <u>Resupply</u> and obtain a crucial replacement part. If you roll this result again prior to that, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/56-70": "The vehicle is crippled or out of your control. To get it back in action, you must <u>Repair</u> and raise its integrity above 0.",
"Starforged/Oracles/Moves/Withstand_Damage/71-85": "It's a rough ride. All aboard must make the <u>Endure Harm</u>, <u>Endure Stress</u>, or <u>Companion Takes a Hit</u> move, suffering a serious (-2) cost.",
"Starforged/Oracles/Moves/Withstand_Damage/86-95": "You’ve lost fuel, energy, or cargo. <u>Sacrifice Resources</u> (-2).",
"Starforged/Oracles/Moves/Withstand_Damage/96-100": "Against all odds, the vehicle holds together.",
"Starforged/Oracles/Moves/Ask_the_Oracle-name": "Ask the Oracle",
"Starforged/Oracles/Moves/Ask_the_Oracle/Almost_Certain/1-90": "Yes",
Expand Down
8 changes: 2 additions & 6 deletions Ironsworn-Starforged/src/buildTranslations.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,17 @@ function buildOracleTranslations () {
subOracle.Table.forEach((row) => {
if(row.Result.includes('⏵') && row.Summary) {
oracleTranslations[row.$id] = row.Summary
} else if (row.Result.includes('⏵')) {
oracleTranslations[row.$id] = convertToHtml(row.Result, false)
} else {
oracleTranslations[row.$id] = row.Result
oracleTranslations[row.$id] = convertToHtml(row.Result, false)
}
})
})
} else if (oracle.Table) {
oracle.Table.forEach((row) => {
if(row.Result.includes('⏵') && row.Summary) {
oracleTranslations[row.$id] = row.Summary
} else if (row.Result.includes('⏵')) {
oracleTranslations[row.$id] = convertToHtml(row.Result, false)
} else {
oracleTranslations[row.$id] = row.Result
oracleTranslations[row.$id] = convertToHtml(row.Result, false)
}
})
} else {
Expand Down
1 change: 0 additions & 1 deletion Ironsworn-Starforged/src/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ gulp.task('dataforge', async function() {
}

const rawData = {
// oracles: apiData.oracles.data,
oracles: starforged['Oracle Categories'],
assets: starforged['Asset Types'],
moves: apiData.moves.data,
Expand Down
24 changes: 12 additions & 12 deletions Ironsworn-Starforged/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2636,24 +2636,24 @@
"Starforged/Oracles/Moves/Take_Decisive_Action/77-88": "Others won’t forget: You are marked for vengeance",
"Starforged/Oracles/Moves/Take_Decisive_Action/89-100": "It gets complicated: The true nature of a foe or objective is revealed",
"Starforged/Oracles/Moves/Endure_Harm-name": "Endure Harm",
"Starforged/Oracles/Moves/Endure_Harm/1-10": "You suffer mortal harm. [Face Death](Starforged/Moves/Threshold/Face_Death).",
"Starforged/Oracles/Moves/Endure_Harm/11-20": "You are dying. Within an hour or two, you must [Heal](Starforged/Moves/Recover/Heal) and raise your health above 0, or [Face Death](Starforged/Moves/Threshold/Face_Death).",
"Starforged/Oracles/Moves/Endure_Harm/21-35": "You are unconscious and out of action. If left alone, you come back to your senses in an hour or two. If you are vulnerable to ongoing harm, [Face Death](Starforged/Moves/Threshold/Face_Death).",
"Starforged/Oracles/Moves/Endure_Harm/1-10": "You suffer mortal harm. <u>Face Death</u>.",
"Starforged/Oracles/Moves/Endure_Harm/11-20": "You are dying. Within an hour or two, you must <u>Heal</u> and raise your health above 0, or <u>Face Death</u>.",
"Starforged/Oracles/Moves/Endure_Harm/21-35": "You are unconscious and out of action. If left alone, you come back to your senses in an hour or two. If you are vulnerable to ongoing harm, <u>Face Death</u>.",
"Starforged/Oracles/Moves/Endure_Harm/36-50": "You are reeling and fighting to stay conscious. If you engage in any vigorous activity before taking a breather for a few minutes, roll on this table again (before resolving the other move).",
"Starforged/Oracles/Moves/Endure_Harm/51-100": "You are still standing.",
"Starforged/Oracles/Moves/Endure_Stress-name": "Endure Stress",
"Starforged/Oracles/Moves/Endure_Stress/1-10": "You are overwhelmed. [Face Desolation](Starforged/Moves/Threshold/Face_Desolation).",
"Starforged/Oracles/Moves/Endure_Stress/11-25": "You give up. [Forsake Your Vow](Starforged/Moves/Quest/Forsake_Your_Vow).",
"Starforged/Oracles/Moves/Endure_Stress/1-10": "You are overwhelmed. <u>Face Desolation</u>.",
"Starforged/Oracles/Moves/Endure_Stress/11-25": "You give up. <u>Forsake Your Vow</u>.",
"Starforged/Oracles/Moves/Endure_Stress/26-50": "You give in to fear or compulsion, and act against your better instincts.",
"Starforged/Oracles/Moves/Endure_Stress/51-100": "You persevere.",
"Starforged/Oracles/Moves/Withstand_Damage-name": "Withstand Damage",
"Starforged/Oracles/Moves/Withstand_Damage/1-10": "Immediate catastrophic destruction. All aboard must [Endure Harm](Starforged/Moves/Suffer/Endure_Harm) or [Face Death](Starforged/Moves/Threshold/Face_Death), as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/11-25": "Destruction is imminent and unavoidable. If you do not have the means or intention to get clear, [Endure Harm](Starforged/Moves/Suffer/Endure_Harm) or [Face Death](Starforged/Moves/Threshold/Face_Death) as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/26-40": "Destruction is imminent, but can be averted if you [Repair](Starforged/Moves/Recover/Repair) your vehicle and raise its integrity above 0. If you fail, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/41-55": "You cannot [Repair](Starforged/Moves/Recover/Repair) this vehicle until you [Resupply](Starforged/Moves/Recover/Resupply) and obtain a crucial replacement part. If you roll this result again prior to that, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/56-70": "The vehicle is crippled or out of your control. To get it back in action, you must [Repair](Starforged/Moves/Recover/Repair) and raise its integrity above 0.",
"Starforged/Oracles/Moves/Withstand_Damage/71-85": "It's a rough ride. All aboard must make the [Endure Harm](Starforged/Moves/Suffer/Endure_Harm), [Endure Stress](Starforged/Moves/Suffer/Endure_Stress), or [Companion Takes a Hit](Starforged/Moves/Suffer/Companion_Takes_a_Hit) move, suffering a serious (-2) cost.",
"Starforged/Oracles/Moves/Withstand_Damage/86-95": "You’ve lost fuel, energy, or cargo. [Sacrifice Resources](Starforged/Moves/Suffer/Sacrifice_Resources) (-2).",
"Starforged/Oracles/Moves/Withstand_Damage/1-10": "Immediate catastrophic destruction. All aboard must <u>Endure Harm</u> or <u>Face Death</u>, as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/11-25": "Destruction is imminent and unavoidable. If you do not have the means or intention to get clear, <u>Endure Harm</u> or <u>Face Death</u> as appropriate.",
"Starforged/Oracles/Moves/Withstand_Damage/26-40": "Destruction is imminent, but can be averted if you <u>Repair</u> your vehicle and raise its integrity above 0. If you fail, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/41-55": "You cannot <u>Repair</u> this vehicle until you <u>Resupply</u> and obtain a crucial replacement part. If you roll this result again prior to that, see 11-25.",
"Starforged/Oracles/Moves/Withstand_Damage/56-70": "The vehicle is crippled or out of your control. To get it back in action, you must <u>Repair</u> and raise its integrity above 0.",
"Starforged/Oracles/Moves/Withstand_Damage/71-85": "It's a rough ride. All aboard must make the <u>Endure Harm</u>, <u>Endure Stress</u>, or <u>Companion Takes a Hit</u> move, suffering a serious (-2) cost.",
"Starforged/Oracles/Moves/Withstand_Damage/86-95": "You’ve lost fuel, energy, or cargo. <u>Sacrifice Resources</u> (-2).",
"Starforged/Oracles/Moves/Withstand_Damage/96-100": "Against all odds, the vehicle holds together.",
"Starforged/Oracles/Moves/Ask_the_Oracle-name": "Ask the Oracle",
"Starforged/Oracles/Moves/Ask_the_Oracle/Almost_Certain/1-90": "Yes",
Expand Down

0 comments on commit e1e3b9e

Please sign in to comment.