Cleanup and add readme for Star Wars 30th Anniversary Edition

This commit is contained in:
Claes
2018-04-10 17:41:39 +02:00
parent b7adab935f
commit 79bff2c001
3 changed files with 195 additions and 116 deletions
@@ -0,0 +1,24 @@
# Star Wars 30th Anniversary Edition
A character sheet for the 1st edition of the D6 Star Wars Role Playing Game.
## Dice Codes
Dice codes must be written as xD or xD+y. For example, 2D and 2D+2 are valid.
Damage codes for weapons can use str (Strength) and ctrl (Control for lightsabers), e.g. str+2D.
Important! For a dice code to update you need to tab away from the field before you press a roll button.
This is due to that the roll buttons use hidden input fields where D is replaced
with d6.
## Armor Codes
Armor code must be either a value with a plus sign, for example +1; or a normal dice code like 1D.
## Wound Status
The dropdown has the following values:
- H = Healthy
- S = Stunned
- W = Wounded
- I = Incapacitated
- M = Mortally Wounded
W, I and M will reduce all dice codes with 1D. H and S will revert back to normal dice codes.
@@ -178,6 +178,7 @@ label {
.sheet-skills-section input {
padding: 0 2px;
text-align: center;
height: 22px;
}
.sheet-content button[type="roll"] {
@@ -201,7 +202,7 @@ label {
.sheet-skills-section table tr, th, td {
padding: 1px !important;
text-align: left;
vertical-align: middle;
vertical-align: bottom;
width: auto;
}
@@ -317,13 +318,39 @@ label {
}
.sheet-circle-section input[type="text"] {
width: 46px;
height: 46px;
border-radius: 46px;
background: transparent;
text-align: center;
vertical-align: middle;
font-size: 16px;
}
.sheet-circle-section select {
width: 39px;
height: 40px;
border-radius: 40px;
background: transparent;
outline: none;
border: none;
text-align: center;
vertical-align: middle;
font-size: 16px;
margin: 0;
margin-left: 3px;
margin-top: 2px;
}
.sheet-circle-section div.sheet-circle {
margin: auto;
line-height: 41px;
border-radius: 50px;
width: 50px !important;
height: 50px;
border: 2px solid #000 !important;
text-align: center;
font-size: 16px;
margin-bottom: 4px;
vertical-align: middle;
}
.sheet-rolltemplate-general .sheet-roll-line {
@@ -16,19 +16,21 @@
Damage codes for weapons can use str (Strength) and ctrl (Control for lightsabers),
for example str+2D.<br />
<br />
<strong>Important!</strong> For a dice code to update you need to tab away from the field before you press a roll button.<br />
<br />
<strong>Armor Codes</strong><br />
Armor code must be either a value with a plus sign, for example +1; or a normal dice code, example 1D.<br />
<br />
<strong>Wound Status</strong><br />
Write one or two letters:<br />
The dropdown has the following values:<br />
<ul>
<li>H = Healthy</li>
<li>S = Stunned</li>
<li>W = Wounded</li>
<li>I = Incapacitated</li>
<li>MW = Mortally Wounded</li>
<li>M = Mortally Wounded</li>
</ul>
W will reduce all dice codes with 1D and all other will revert back to normal dice codes.
W, I and M will reduce all dice codes with 1D. H and S will revert back to normal dice codes.
</div>
<!-- BIO -->
@@ -398,10 +400,32 @@
<div class="sheet-circle-section">
<table>
<tr>
<td><input type="text" tabindex="69" name="attr_force_points" value="1" /></td>
<td><input type="text" tabindex="70" name="attr_dark_side_points" value="0" /></td>
<td><input type="text" tabindex="71" name="attr_wound_status" value="H" title="(H)ealthy, (S)tunned, (W)ounded, (I)ncapacitated, (MW) Mortally Wounded" /></td>
<td><input type="text" tabindex="72" name="attr_skill_points" value="0" /></td>
<td>
<div class="sheet-circle">
<input type="text" tabindex="69" name="attr_force_points" value="1" />
</div>
</td>
<td>
<div class="sheet-circle">
<input type="text" tabindex="70" name="attr_dark_side_points" value="0" />
</div>
</td>
<td>
<div class="sheet-circle">
<select name="attr_wound_status" title="(H)ealthy, (S)tunned, (W)ounded, (I)ncapacitated, (M)ortally Wounded">
<option value="H" title="Healthy" selected>H</option>
<option value="S" title="Stunned">S</option>
<option value="W" title="Wounded">W</option>
<option value="I" title="Incapacitated">I</option>
<option value="M" title="Mortally Wounded">M</option>
</select>
</div>
</td>
<td>
<div class="sheet-circle">
<input type="text" tabindex="72" name="attr_skill_points" value="0" />
</div>
</td>
</tr>
<tr>
<td>Force<br />Points</td>
@@ -575,80 +599,80 @@
<script type="text/worker">
// Dexterity
var dexSkills = [
"blaster", "brawling_parry", "dodge", "grenade",
"heavy_weapons", "melee_parry", "melee"
'blaster', 'brawling_parry', 'dodge', 'grenade',
'heavy_weapons', 'melee_parry', 'melee'
];
on("change:dexterity", function() {
updateDiceRef("dexterity", true);
updateDefaultSkillCodes("dexterity", dexSkills);
on('change:dexterity', function() {
updateDiceRef('dexterity', true);
updateDefaultSkillCodes('dexterity', dexSkills);
});
dexSkills.forEach(function(skill) {
on("change:" + skill, function() {
on('change:' + skill, function() {
updateDiceRef(skill, true);
});
});
// Knowledge
var knoSkills = [
"alien_races", "bureaucracy", "cultures", "languages",
"planetary_systems", "streetwise", "survival", "technology"
'alien_races', 'bureaucracy', 'cultures', 'languages',
'planetary_systems', 'streetwise', 'survival', 'technology'
];
on("change:knowledge", function() {
updateDiceRef("knowledge", false);
updateDefaultSkillCodes("knowledge", knoSkills);
on('change:knowledge', function() {
updateDiceRef('knowledge', false);
updateDefaultSkillCodes('knowledge', knoSkills);
});
knoSkills.forEach(function(skill) {
on("change:" + skill, function() {
on('change:' + skill, function() {
updateDiceRef(skill, false);
});
});
// Mechanical
var mecSkills = [
"astrogation", "beast_riding", "repulsorlift_op",
"starship_gunnery", "starship_piloting", "starship_shields"
'astrogation', 'beast_riding', 'repulsorlift_op',
'starship_gunnery', 'starship_piloting', 'starship_shields'
];
on("change:mechanical", function() {
updateDiceRef("mechanical", false);
updateDefaultSkillCodes("mechanical", mecSkills);
on('change:mechanical', function() {
updateDiceRef('mechanical', false);
updateDefaultSkillCodes('mechanical', mecSkills);
});
mecSkills.forEach(function(skill) {
on("change:" + skill, function() {
on('change:' + skill, function() {
updateDiceRef(skill, false);
});
});
// Perception
var perSkills = [
"bargain", "command", "con", "gambling", "hidesneak", "search"
'bargain', 'command', 'con', 'gambling', 'hidesneak', 'search'
];
on("change:perception", function() {
updateDiceRef("perception", false);
updateDefaultSkillCodes("perception", perSkills);
on('change:perception', function() {
updateDiceRef('perception', false);
updateDefaultSkillCodes('perception', perSkills);
});
perSkills.forEach(function(skill) {
on("change:" + skill, function() {
on('change:' + skill, function() {
updateDiceRef(skill, false);
});
});
// Strength
var strSkills = [
"brawling", "climbingjumping", "lifting", "stamina", "swimming"
'brawling', 'climbingjumping', 'lifting', 'stamina', 'swimming'
];
on("change:strength", function() {
updateDiceRef("strength", false);
updateDefaultSkillCodes("strength", strSkills);
updateStrengthArmorRef("strength");
on('change:strength', function() {
updateDiceRef('strength', false);
updateDefaultSkillCodes('strength', strSkills);
updateStrengthArmorRef('strength');
weaponDamageCodes.forEach(function(weaponDamageCode) {
updateDiceRefForWeapon(weaponDamageCode);
@@ -656,36 +680,36 @@
});
strSkills.forEach(function(skill) {
on("change:" + skill, function() {
on('change:' + skill, function() {
updateDiceRef(skill, false);
});
});
// Technical
var tecSkills = [
"comp_progrepair", "demolition", "droid_progrepair", "medicine",
"repulsorlift_repair", "security", "starship_repair"
'comp_progrepair', 'demolition', 'droid_progrepair', 'medicine',
'repulsorlift_repair', 'security', 'starship_repair'
];
on("change:technical", function() {
updateDiceRef("technical", false);
updateDefaultSkillCodes("technical", tecSkills);
on('change:technical', function() {
updateDiceRef('technical', false);
updateDefaultSkillCodes('technical', tecSkills);
});
tecSkills.forEach(function(skill) {
on("change:" + skill, function() {
on('change:' + skill, function() {
updateDiceRef(skill, false);
});
});
// Force skills
var forceSkills = ["control", "sense", "alter"];
var forceSkills = ['control', 'sense', 'alter'];
forceSkills.forEach(function(skill) {
on("change:" + skill, function() {
on('change:' + skill, function() {
updateDiceRef(skill, false);
if (skill == "control") {
if (skill == 'control') {
weaponDamageCodes.forEach(function(weaponDamageCode) {
updateDiceRefForWeapon(weaponDamageCode);
});
@@ -695,35 +719,35 @@
// Weapon damage codes
var weaponDamageCodes = [
"weapon_1_damage_code", "weapon_2_damage_code", "weapon_3_damage_code"
'weapon_1_damage_code', 'weapon_2_damage_code', 'weapon_3_damage_code'
];
weaponDamageCodes.forEach(function(weaponDamageCode) {
on("change:" + weaponDamageCode, function() {
on('change:' + weaponDamageCode, function() {
updateDiceRefForWeapon(weaponDamageCode);
});
});
// Blank skills
var blankSkills = [
"dexterity_blank", "knowledge_blank", "mechanical_blank",
"perception_blank", "strength_blank", "technical_blank"
'dexterity_blank', 'knowledge_blank', 'mechanical_blank',
'perception_blank', 'strength_blank', 'technical_blank'
];
blankSkills.forEach(function(skill) {
on("change:" + skill, function() {
updateDiceRef(skill, skill.indexOf("dexterity") > -1);
on('change:' + skill, function() {
updateDiceRef(skill, skill.indexOf('dexterity') > -1);
});
});
// Armor
on("change:armor_code", function() {
updateStrengthArmorRef("armor_code");
on('change:armor_code', function() {
updateStrengthArmorRef('armor_code');
updateDexForArmor();
});
// Wound status
on("change:wound_status", function() {
on('change:wound_status', function() {
updateDiceRefsForWoundStatus();
weaponDamageCodes.forEach(function(weaponDamageCode) {
updateDiceRefForWeapon(weaponDamageCode);
@@ -739,7 +763,7 @@
var update = {};
update[skillName] = attributeValues[attribute];
setAttrs(update);
console.log("---> Setting " + skillName + " to " + attributeValues[attribute]);
console.log('---> Setting ' + skillName + ' to ' + attributeValues[attribute]);
}
});
});
@@ -748,48 +772,48 @@
/* Update dice ref */
var updateDiceRef = function(attrName, applyArmorPenalty) {
getAttrs([attrName, "armor_code", "wound_status"], function(values) {
getAttrs([attrName, 'armor_code', 'wound_status'], function(values) {
var update = {};
var diceRefName = attrName + "_dice_ref";
var diceRefName = attrName + '_dice_ref';
var diceRef;
var woundMod = getWoundMod(values["wound_status"]);
var woundMod = getWoundMod(values['wound_status']);
var attrPips = getPips(values[attrName]);
var modifiedAttrPips = getModifiedPips(attrPips, woundMod);
if (applyArmorPenalty) {
var armorPips = getPips(values["armor_code"]);
var armorPips = getPips(values['armor_code']);
modifiedAttrPips = getModifiedPips(modifiedAttrPips, armorPips);
}
update[diceRefName] = calculateDiceRef(modifiedAttrPips);
setAttrs(update);
console.log("--> Setting " + diceRefName + " to " + update[diceRefName]);
console.log('--> Setting ' + diceRefName + ' to ' + update[diceRefName]);
});
};
/* Update dice ref for damage code */
var updateDiceRefForWeapon = function(attrName) {
getAttrs([attrName, "strength", "control", "wound_status"], function(values) {
getAttrs([attrName, 'strength', 'control', 'wound_status'], function(values) {
var update = {};
var diceRefName = attrName + "_dice_ref";
var diceRefName = attrName + '_dice_ref';
var diceRef;
var attrPips = 0;
if (values[attrName].toLowerCase().indexOf("str+") > -1) {
var strPips = getPips(values["strength"]);
var woundMod = getWoundMod(values["wound_status"]);
if (values[attrName].toLowerCase().indexOf('str+') > -1) {
var strPips = getPips(values['strength']);
var woundMod = getWoundMod(values['wound_status']);
var modifiedStrPips = getModifiedPips(strPips, woundMod);
var weaponDamagePips = getPips(values[attrName].split("str+")[1]);
var weaponDamagePips = getPips(values[attrName].split('str+')[1]);
attrPips = weaponDamagePips + modifiedStrPips;
} else if (values[attrName].toLowerCase().indexOf("ctrl+") > -1) {
var controlPips = getPips(values["control"]);
var woundMod = getWoundMod(values["wound_status"]);
} else if (values[attrName].toLowerCase().indexOf('ctrl+') > -1) {
var controlPips = getPips(values['control']);
var woundMod = getWoundMod(values['wound_status']);
var modifiedControlPips = getModifiedPips(controlPips, woundMod);
var weaponDamagePips = getPips(values[attrName].split("ctrl+")[1]);
var weaponDamagePips = getPips(values[attrName].split('ctrl+')[1]);
attrPips = weaponDamagePips + modifiedControlPips;
} else {
@@ -798,20 +822,20 @@
update[diceRefName] = calculateDiceRef(attrPips);
setAttrs(update);
console.log("--> Setting " + diceRefName + " to " + update[diceRefName]);
console.log('--> Setting ' + diceRefName + ' to ' + update[diceRefName]);
});
};
/* Gets pips from dice code. xD+y = x*3+y */
var getPips = function(diceCode) {
if (diceCode == undefined || diceCode == "") {
if (diceCode == undefined || diceCode == '') {
return 0;
} else if (diceCode.indexOf("D") > -1) {
return eval(diceCode.replace("D", "*3"));
} else if (diceCode.indexOf("d") > -1) {
return eval(diceCode.replace("d", "*3"));
} else if (diceCode.indexOf("+") > -1 && diceCode.length == 2) {
return eval(diceCode.replace("+", ""));
} else if (diceCode.indexOf('D') > -1) {
return eval(diceCode.replace('D', '*3'));
} else if (diceCode.indexOf('d') > -1) {
return eval(diceCode.replace('d', '*3'));
} else if (diceCode.indexOf('+') > -1 && diceCode.length == 2) {
return eval(diceCode.replace('+', ''));
} else {
return 0;
}
@@ -819,9 +843,9 @@
/* Calculates dice ref from pips */
var calculateDiceRef = function(pips) {
var diceCode = Math.floor(pips/3) + "d6";
var diceCode = Math.floor(pips/3) + 'd6';
var mod = pips % 3;
var diceRef = diceCode + (mod > 0 ? "+" + mod : "");
var diceRef = diceCode + (mod > 0 ? '+' + mod : '');
return diceRef;
};
@@ -832,28 +856,28 @@
};
var updateDexForArmor = function() {
var neededAttrs = ["armor_code", "dexterity", "dexterity_blank", "wound_status"].concat(dexSkills);
var neededAttrs = ['armor_code', 'dexterity', 'dexterity_blank', 'wound_status'].concat(dexSkills);
getAttrs(neededAttrs, function(values) {
var armorPips = getPips(values["armor_code"]);
var woundMod = getWoundMod(values["wound_status"]);
var armorPips = getPips(values['armor_code']);
var woundMod = getWoundMod(values['wound_status']);
var update = {};
// Update dexterity
var dexPips = getPips(values["dexterity"]);
var dexPips = getPips(values['dexterity']);
var dexModifiedPips = getModifiedPips(dexPips, armorPips);
dexModifiedPips = getModifiedPips(dexModifiedPips, woundMod);
update["dexterity_dice_ref"] = calculateDiceRef(dexModifiedPips);
console.log("--> Armor reduces dexterity_dice_ref to " + update["dexterity_dice_ref"]);
update['dexterity_dice_ref'] = calculateDiceRef(dexModifiedPips);
console.log('--> Armor changes dexterity_dice_ref to ' + update['dexterity_dice_ref']);
// Update blank dexterity skill
var blankSkillPips = getPips(values["dexterity_blank"]);
var blankSkillPips = getPips(values['dexterity_blank']);
var blankSkillModifiedPips = getModifiedPips(blankSkillPips, armorPips);
blankSkillModifiedPips = getModifiedPips(blankSkillModifiedPips, woundMod);
update["dexterity_blank_dice_ref"] = calculateDiceRef(blankSkillModifiedPips);
console.log("--> Armor reduces dexterity_blank_dice_ref to " + update["dexterity_blank_dice_ref"]);
update['dexterity_blank_dice_ref'] = calculateDiceRef(blankSkillModifiedPips);
console.log('--> Armor changes dexterity_blank_dice_ref to ' + update['dexterity_blank_dice_ref']);
// Update dexterity skills
dexSkills.forEach(function(skillName) {
@@ -861,9 +885,9 @@
var skillModifiedPips = getModifiedPips(skillPips, armorPips);
skillModifiedPips = getModifiedPips(skillModifiedPips, woundMod);
var skillDiceRefName = skillName + "_dice_ref";
var skillDiceRefName = skillName + '_dice_ref';
update[skillDiceRefName] = calculateDiceRef(skillModifiedPips);
console.log("--> Armor reduces " + skillDiceRefName + " to " + update[skillDiceRefName]);
console.log('--> Armor changes ' + skillDiceRefName + ' to ' + update[skillDiceRefName]);
});
setAttrs(update);
@@ -871,51 +895,51 @@
};
var updateStrengthArmorRef = function(attrName) {
if (attrName == "strength" || attrName == "armor_code") {
getAttrs(["strength", "armor_code", "wound_status"], function(values) {
if (attrName == 'strength' || attrName == 'armor_code') {
getAttrs(['strength', 'armor_code', 'wound_status'], function(values) {
var update = {};
var armorPips = getPips(values["armor_code"]);
var woundMod = getWoundMod(values["wound_status"]);
var armorPips = getPips(values['armor_code']);
var woundMod = getWoundMod(values['wound_status']);
var strengthPips = getPips(values["strength"]);
var strengthPips = getPips(values['strength']);
var modifiedStrengthPips = getModifiedPips(strengthPips, woundMod);
var strengthArmorDiceRef = calculateDiceRef(modifiedStrengthPips + armorPips);
update["strengtharmor_dice_ref"] = strengthArmorDiceRef;
update['strengtharmor_dice_ref'] = strengthArmorDiceRef;
setAttrs(update);
console.log("--> Updating strenghtarmor_dice_ref to " + update["strengtharmor_dice_ref"]);
console.log('--> Updating strenghtarmor_dice_ref to ' + update['strengtharmor_dice_ref']);
});
}
};
var updateDiceRefsForWoundStatus = function() {
var allAttributes = [
"dexterity", "knowledge", "mechanical",
"perception", "strength", "technical"
'dexterity', 'knowledge', 'mechanical',
'perception', 'strength', 'technical'
];
var allSkills = dexSkills.concat(knoSkills).concat(mecSkills)
.concat(perSkills).concat(strSkills).concat(tecSkills)
.concat(blankSkills).concat(forceSkills);
var neededAttrs = ["wound_status", "armor_code"].concat(allAttributes)
var neededAttrs = ['wound_status', 'armor_code'].concat(allAttributes)
.concat(allSkills);
getAttrs(neededAttrs, function(values) {
console.log("--> Starting to update for wound status");
console.log('--> Starting to update for wound status');
var update = {};
var woundMod = getWoundMod(values["wound_status"]);
var armorPips = getPips(values["armor_code"]);
var woundMod = getWoundMod(values['wound_status']);
var armorPips = getPips(values['armor_code']);
allAttributes.forEach(function(attributeName) {
update[attributeName + "_dice_ref"] = getModifiedDiceRef(attributeName, values[attributeName], woundMod, armorPips);
console.log("--> Wounded status changes " + attributeName + "_dice_ref to " + update[attributeName + "_dice_ref"]);
update[attributeName + '_dice_ref'] = getModifiedDiceRef(attributeName, values[attributeName], woundMod, armorPips);
console.log('--> Wounded status changes ' + attributeName + '_dice_ref to ' + update[attributeName + '_dice_ref']);
});
allSkills.forEach(function(skillName) {
update[skillName + "_dice_ref"] = getModifiedDiceRef(skillName, values[skillName], woundMod, armorPips);
console.log("--> Wounded status changes " + skillName + "_dice_ref to " + update[skillName + "_dice_ref"]);
update[skillName + '_dice_ref'] = getModifiedDiceRef(skillName, values[skillName], woundMod, armorPips);
console.log('--> Wounded status changes ' + skillName + '_dice_ref to ' + update[skillName + '_dice_ref']);
});
setAttrs(update);
@@ -926,7 +950,7 @@
var pips = getPips(attrValue);
var modifiedPips = getModifiedPips(pips, mod);
if (attrName.indexOf("dexterity") > -1 || dexSkills.includes(attrName)) {
if (attrName.indexOf('dexterity') > -1 || dexSkills.includes(attrName)) {
modifiedPips = getModifiedPips(modifiedPips, armorPips);
}
@@ -935,10 +959,14 @@
};
var getWoundMod = function(woundStatus) {
if (woundStatus == "W") {
return 3;
} else {
return 0;
switch (woundStatus) {
case 'H':
case 'S':
return 0;
case 'W':
case 'I':
case 'M':
return 3;
}
};
</script>