diff --git a/OperaRPG/operarpg.css b/OperaRPG/operarpg.css
index 683112d3f8..90a9d7b063 100644
--- a/OperaRPG/operarpg.css
+++ b/OperaRPG/operarpg.css
@@ -31,6 +31,10 @@
width: 4.2em;
}
+.sheet-bigger-number-input {
+ width: 6em !important;
+}
+
.sheet-main-container textarea {
box-sizing: border-box;
margin: 0px;
diff --git a/OperaRPG/operarpg.html b/OperaRPG/operarpg.html
index a0614e8871..9c12248afd 100644
--- a/OperaRPG/operarpg.html
+++ b/OperaRPG/operarpg.html
@@ -22,8 +22,8 @@
Max
Usado
-
-
+
@@ -33,9 +33,9 @@
Max
Usado
-
-
+
+
@@ -359,17 +359,17 @@
Membros
+ title="Cada dois níveis, atribuí a expressão “x(nível/2+1)” ao atributo Destreza. Adiciona seu (nível/2) ao número de ações físicas do personagem">Membros
Adicionais
Tamanho
+ title="Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Físico e gera nível-1 de penalidade à Esquiva.">Tamanho
Ampliado
Tamanho
+ title="Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Físico e gera nível-1 de bônus à Esquiva.">Tamanho
Reduzido
@@ -433,7 +433,7 @@
Ampliação
+ title="Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Destreza. Adiciona seu (nível-1) ao número de ações físicas do personagem.">Ampliação
de Destreza
@@ -445,7 +445,7 @@
Ampliação
+ title="Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Inteligência. Adiciona seu (nível-1) ao número de ações mentais do personagem.">Ampliação
de Inteligência
@@ -562,7 +562,7 @@
-
+
@@ -660,18 +660,18 @@
+ value="@{weaponlevel} + @{weaponblow} + (@{chardexterity} @{weaponeffect})" />
+ value="&{template:main} {{charname=@{character_name}}} {{action=@{weaponname} - @{blow}}} {{value=[[@{weaponblowtotal}]]}} {{dispute=[[ [[2d6cs>2cf<5]] + @{weaponblowtotal} ]] }} {{roll=$[[1]]}} {{damage=[[@{weapondamagetotal}]]}} {{bodyroll=[[2d6cs0cf0]]}}">
@@ -721,7 +721,7 @@
value="0" />
+ value="@{weaponlevel} + @{weaponblow} + (@{chardexterity} @{weaponeffect})" />
@@ -899,17 +899,11 @@
Destreza
-
-
- 0
- 1
- 2
- 3
- 4
-
-
-
+
+
+
+
@@ -927,25 +921,20 @@
value="&{template:main} {{charname=@{character_name}}} {{action=@{skill}}} {{value=[[@{skilltotal}]]}} {{dispute=[[ [[2d6cs>2cf<5]] + @{skilltotal}]]}} {{roll=$[[1]]}}">
- Físico
- Destreza
- Inteligência
- Vontade
- Mente
- Magia
- Percepção
- Sorte
-
-
- 1
- 2
- 3
- 4
+ Físico
+ Destreza
+ Inteligência
+ Vontade
+ Mente
+ Magia
+ Percepção
+ Sorte
+
-
+
@@ -1183,7 +1172,18 @@
/*Controlling contact weapons damage total*/
on('change:repeating_contactweapons:weapondamage change:physicaldamage', function(eventInfo) {
console.log('weapon damage total');
- setRollTotal(['repeating_contactweapons_weapondamage', 'physicaldamage'], 'repeating_contactweapons_weapondamagetotal');
+
+ /* recovering all weapons IDs */
+ getSectionIDs(`repeating_contactweapons`, idArray => {
+ idArray.forEach(id => {
+
+ setRollTotal([`repeating_contactweapons_${id}_weapondamage`, 'physicaldamage'], `repeating_contactweapons_${id}_weapondamagetotal`);
+
+ });
+
+ });
+
+
});
/* calculating physical damage */
@@ -1198,7 +1198,7 @@
factor = Math.floor(eval(parse));
total = Math.floor(factor/8);
-
+ console.log(`physical damage total: ${total}`);
setAttrs({
physicaldamage: total
});
@@ -1228,37 +1228,113 @@
repeatingSum("totalpenalty","protection", "protectionpenalty");
});
+ /* Declaring a Cost Object to be used on creation points calculation */
+ function Cost(negative, positive) {
+ this.negative = negative;
+ this.positive = positive;
+ }
+
+ /* calculates total Cost of a repeating section */
+ function calculateCost(section, field, total) {
+
+ getSectionIDs(section, idArray => {
+ const fields = idArray.map(id => `${section}_${id}_${field}`);
+
+ getAttrs(fields, function(values) {
+ console.log(`begin calc Cost for ${total} `);
+ let out = {};
+ out[total] = new Cost(0,0);
+
+ for (let key in values) {
+ let parsedValue = parseInt(values[key])||0;
+
+ if (parsedValue > 0) {
+ out[total].positive += parsedValue;
+ } else {
+ out[total].negative += parsedValue;
+ }
+
+ }
+
+ console.log(out);
+
+ setAttrs(out);
+ });
+
+ });
+ }
+
+ function getIntValue(value) {
+ return parseInt(value)||0;
+ }
+
+ /* calculating total creation points */
+ on('sheet:opened change:fightcost ' +
+ 'change:powers_total_cost ' +
+ 'change:skills_total_cost ' +
+ 'change:features_total_cost'
+ , function() {
+
+ getAttrs(['fightcost', 'powers_total_cost', 'skills_total_cost', 'features_total_cost'], values =>{
+ let totalNegative = 0;
+ let totalPositive = 0;
+ console.log('begin calc creation points');
+ for (let key in values) {
+ v = values[key];
+ console.log(v);
+ if (v.positive !== undefined) {
+ totalPositive += getIntValue(v.positive);
+ totalNegative += getIntValue(v.negative);
+ } else {
+ /*if it doesn't have the positive property, than it is the simple fightcost value */
+ totalPositive += getIntValue(v);
+ }
+ }
+
+ /* each negative point beyond -10 costs half rounded down.
+ * Ex: -15 has -5 past -10, so -15 will be (-10) + (-5/2) = -10 -2 = -12.
+ */
+ if (totalNegative < -10) {
+
+ totalNegative = -10 + Math.floor((totalNegative+10)/2);
+ }
+
+ /* the max negative cost is -20 */
+ if (totalNegative < -20) {
+ totalNegative = -20;
+ }
+
+ console.log(`total negative = ${totalNegative}`);
+ console.log(`total positive = ${totalPositive}`);
+
+ setAttrs({
+ used_creation_points: totalPositive+totalNegative
+ });
+ });
+ });
+
+
/* calculating total powers cost */
on('sheet:opened change:repeating_powers remove:repeating_powers', function() {
- repeatingSum("powers_total_cost","powers", "powercost");
+ calculateCost("repeating_powers", "powercost", "powers_total_cost");
});
/* calculating total skills cost */
on('sheet:opened change:repeating_skills remove:repeating_skills', function() {
- repeatingSum("skills_total_cost","skills", "skillcost");
+ calculateCost("repeating_skills", "skillcost", "skills_total_cost");
});
/* calculating total features cost */
on('sheet:opened change:repeating_features remove:repeating_features', function() {
- repeatingSum("features_total_cost","features", "featurecost");
+ calculateCost("repeating_features", "featurecost", "features_total_cost");
});
function getSkillCost(skillLevel) {
let skillCost = 0;
- switch (skillLevel) {
- case '1':
- skillCost = 1;
- break;
- case '2':
- skillCost = 3;
- break;
- case '3':
- skillCost = 6;
- break;
- case '4':
- skillCost = 10;
- break;
+ /* the skill cost value is equal to the sum of the level plus all levels before */
+ for(let i=1; i<=skillLevel; i++) {
+ skillCost += i;
}
return skillCost;
@@ -1276,6 +1352,66 @@
});
});
+ /*sets a skill total. If the total exceeds 14, sets the maximum 14 */
+ function setSkillTotal(attributeField, levelField, totalField) {
+
+ getAttrs([attributeField, levelField], function(values) {
+ let total = 0;
+ let target = {};
+
+ total += parseInt(values[attributeField])||0;
+ total += parseInt(values[levelField])||0;
+
+ console.log(total);
+
+ target[totalField] = total > 14? 14 : total;
+
+ setAttrs(target);
+ });
+ }
+
+ /* setting the Fight Skill Total */
+ on('change:chardexterity change:fightlevel', function(eventInfo) {
+ setSkillTotal('chardexterity', 'fightlevel', 'fighttotal');
+ });
+
+ /* Since the repeating_skills skillattribute has changed from @{attributeName} to
+ * simply attributeName, this parse is needed to make the skill total calc worker
+ * with old sheets */
+ function parseAttributeName(attrName) {
+ let ret = attrName.replace('@{','').replace('}','');
+
+ return ret;
+ }
+
+ /* setting skill total */
+ on('change:repeating_skills:skillattribute change:repeating_skills:skilllevel ' +
+ 'change:charphysique '+
+ 'change:chardexterity '+
+ 'change:charintelligence '+
+ 'change:charperception '+
+ 'change:charwill '+
+ 'change:charmind '+
+ 'change:charmagic '+
+ 'change:charluck '
+ , function(eventInfo) {
+
+ /* recovering all skills IDs */
+ getSectionIDs(`repeating_skills`, idArray => {
+ idArray.forEach(id => {
+
+ /*recovering skill attribute name */
+ getAttrs([`repeating_skills_${id}_skillattribute`], values => {
+ let attrName = parseAttributeName(values[`repeating_skills_${id}_skillattribute`]);
+
+ setSkillTotal(attrName, `repeating_skills_${id}_skilllevel` , `repeating_skills_${id}_skilltotal`)
+
+ });
+ });
+
+ });
+ });
+
const fightParameters = [
{
fightblow: 0,
@@ -1283,28 +1419,40 @@
fightdodgebonus: 0,
fightdamage: 'd2-1'
},
- {
- fightblow: 1,
- fightparry: 0,
- fightdodgebonus: 0,
- fightdamage: 'd2-1'
- },
{
fightblow: 1,
fightparry: 1,
fightdodgebonus: 1,
- fightdamage: '1'
+ fightdamage: 'd2-1'
},
{
fightblow: 2,
fightparry: 2,
- fightdodgebonus: 1,
+ fightdodgebonus: 2,
+ fightdamage: 'd2-1'
+ },
+ {
+ fightblow: 2,
+ fightparry: 2,
+ fightdodgebonus: 2,
fightdamage: '1'
},
{
fightblow: 3,
fightparry: 3,
- fightdodgebonus: 2,
+ fightdodgebonus: 3,
+ fightdamage: '1'
+ },
+ {
+ fightblow: 4,
+ fightparry: 4,
+ fightdodgebonus: 4,
+ fightdamage: '1'
+ },
+ {
+ fightblow: 4,
+ fightparry: 4,
+ fightdodgebonus: 4,
fightdamage: '1'
}
];
@@ -1316,7 +1464,9 @@
out = {};
let skillCost = getSkillCost(skillLevel);
- let fightParams = fightParameters[skillLevel];
+
+ /* fight levels beyond 6 give no more bonus, so we have to use the level 6 bonus */
+ let fightParams = skillLevel>6 ? fightParameters[6]:fightParameters[skillLevel];
out.fightcost = skillCost;
out = Object.assign(out, fightParams);
@@ -1575,6 +1725,11 @@
target: 'charphysicalfeatureeffect',
value: level => level,
operation: OperationEnum.MULT
+ },
+ {
+ target: 'dodgefeatureeffect',
+ value: level => (-1)*(level-1),
+ operation: OperationEnum.SUM
}
]
},
@@ -1588,6 +1743,11 @@
target: 'charphysicalfeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.MULT
+ },
+ {
+ target: 'dodgefeatureeffect',
+ value: level => (level-1),
+ operation: OperationEnum.SUM
}
]
}
diff --git a/OperaRPG/translation.json b/OperaRPG/translation.json
index c17923d3f3..30f8b7006c 100644
--- a/OperaRPG/translation.json
+++ b/OperaRPG/translation.json
@@ -39,7 +39,7 @@
"fast_reflexes-description": "Cada nível atribuí +1 de Esquiva",
"fast_reflexes": "Reflexos Rápidos",
"increased_senses-description": "Cada nível atribuí +1 de Percepção",
- "increased_senses": "Sentidos\n Ampliados",
+ "increased_senses": "Sentidos Ampliados",
"reduced_senses-description": "Cada nível atribuí -1 de Percepção",
"reduced_senses": "Sentidos Reduzidos",
"increased_mind-description": "Cada nível atribuí +1 de Mente",
@@ -52,28 +52,28 @@
"strong_will": "Vontade Forte",
"weak_will-description": "Cada nível atribuí -1 de Vontade",
"weak_will": "Vontade Fraca",
- "additional_limbs-description": "Cada dois níveis, atribuí a expressão “x(nível/2+1)” ao atributo Destreza. Adiciona seu (nível/2) ao número de ações físicas ao personagem",
- "additional_limbs": "Membros\n Adicionais",
- "increased_size-description": "Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Físico",
- "increased_size": "Tamanho\n Ampliado",
- "reduced_size-description": "Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Físico",
- "reduced_size": "Tamanho\n Reduzido",
+ "additional_limbs-description": "Cada dois níveis, atribuí a expressão “x(nível/2+1)” ao atributo Destreza. Adiciona seu (nível/2) ao número de ações físicas do personagem",
+ "additional_limbs": "Membros Adicionais",
+ "increased_size-description": "Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Físico e gera nível-1 de penalidade à Esquiva.",
+ "increased_size": "Tamanho Ampliado",
+ "reduced_size-description": "Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Físico e gera nível-1 de bônus à Esquiva.",
+ "reduced_size": "Tamanho Reduzido",
"feature": "Característica",
"level": "Nível",
"cost": "Custo",
"description": "Descrição",
"powers": "Poderes",
- "increased_dexterity-description": "Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Destreza. Adiciona seu (nível-1) ao número de ações físicas ao personagem.",
- "increased_dexterity": "Ampliação\n de Destreza",
+ "increased_dexterity-description": "Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Destreza. Adiciona seu (nível-1) ao número de ações físicas do personagem.",
+ "increased_dexterity": "Ampliação de Destreza",
"increased_physical-description": "Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Físico",
- "increased_physical": "Ampliação de\n Físico",
- "increased_intelligence-description": "Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Inteligência. Adiciona seu (nível-1) ao número de ações mentais ao personagem.",
- "increased_intelligence": "Ampliação\n de Inteligência",
+ "increased_physical": "Ampliação de Físico",
+ "increased_intelligence-description": "Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Inteligência. Adiciona seu (nível-1) ao número de ações mentais do personagem.",
+ "increased_intelligence": "Ampliação de Inteligência",
"reduced_dexterity-description": "Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Inteligência",
- "reduced_dexterity": "Redução de\n Destreza",
+ "reduced_dexterity": "Redução de Destreza",
"reduced_physical-description": "Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Físico",
- "reduced_physical": "Redução de\n Físico",
- "reduced_intelligence": "Redução de\n Inteligência",
+ "reduced_physical": "Redução de Físico",
+ "reduced_intelligence": "Redução de Inteligência",
"skills": "Habilidades",
"skill": "Habilidade",
"attribute": "Atributo",