Merge pull request #11596 from RoenMidnight/t20-goty-menace-character-sheet
[Tormenta20 - Jogo do Ano]Fixing Menace Character Sheet Bugs
This commit is contained in:
@@ -1812,7 +1812,7 @@
|
||||
<button type="roll" name="roll_attack" value="&{template:t20-attack}{{character=@{character_name}}}{{attackname=@{nomeataque}}}{{attackroll=[[1d20cs>@{margemcriticoataque}+[[@{ataquepericia}]]+@{bonusataque}+@{ataquetemp}]]}} {{damageroll=[[@{danoataque}+@{modatributodano}+@{danoextraataque}+@{dadoextraataque}+@{danotemp}+@{rolltemp}]]}} {{criticaldamageroll=[[@{danocriticoataque}+@{modatributodano}+@{danoextraataque}+@{dadoextraataque}]]}}{{typeofdamage=@{ataquetipodedano}}}{{description=@{ataquedescricao}}}">
|
||||
<span class="distance infos" name="attr_distance_list"></span>
|
||||
</button>
|
||||
<span name="attr_distancefdescription" class="infos"></span>
|
||||
<span name="attr_distancedescription" class="infos"></span>
|
||||
<input name="attr_nomeataque" type="hidden" spellcheck="false" class="" value="" readonly="1">
|
||||
<input name="attr_bonusataque" type="hidden" spellcheck="false" class="" value="" readonly="1">
|
||||
<input name="attr_danoataque" type="hidden" spellcheck="false" class="" value="" readonly="1">
|
||||
@@ -3359,36 +3359,36 @@
|
||||
$20('.sheet-left-container').removeClass('sheet-hiddenelement');
|
||||
$20('.sheet-right-container').removeClass('sheet-hiddenelement');
|
||||
$20('.sheet-charnotes-container').removeClass('sheet-hiddenelement');
|
||||
|
||||
|
||||
$20('.sheet-menace-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-global-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-global-container-conditions').addClass('sheet-hiddenelement');
|
||||
|
||||
|
||||
$20('.sheet-pj').addClass('sheet-switch-selected');
|
||||
$20('.sheet-npj').removeClass('sheet-switch-selected');
|
||||
$20('.sheet-mod').removeClass('sheet-switch-selected');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (v.cstype == 1){
|
||||
$20('.sheet-left-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-right-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-charnotes-container').addClass('sheet-hiddenelement');
|
||||
|
||||
|
||||
$20('.sheet-menace-container').removeClass('sheet-hiddenelement');
|
||||
$20('.sheet-global-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-global-container-conditions').addClass('sheet-hiddenelement');
|
||||
|
||||
|
||||
$20('.sheet-pj').removeClass('sheet-switch-selected');
|
||||
$20('.sheet-npj').addClass('sheet-switch-selected');
|
||||
$20('.sheet-mod').removeClass('sheet-switch-selected');
|
||||
}
|
||||
|
||||
|
||||
if (v.cstype == 2){
|
||||
$20('.sheet-left-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-right-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-charnotes-container').addClass('sheet-hiddenelement');
|
||||
|
||||
|
||||
$20('.sheet-menace-container').addClass('sheet-hiddenelement');
|
||||
$20('.sheet-global-container').removeClass('sheet-hiddenelement');
|
||||
$20('.sheet-global-container-conditions').removeClass('sheet-hiddenelement');
|
||||
@@ -3397,7 +3397,7 @@
|
||||
$20('.sheet-npj').removeClass('sheet-switch-selected');
|
||||
$20('.sheet-mod').addClass('sheet-switch-selected');
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -3410,8 +3410,8 @@
|
||||
"condicaoreflexo", "resistemp",
|
||||
"condicaoperfisico", "condicaopermental", "condicaocego", "condicaomodataquedis"
|
||||
], function(v){
|
||||
|
||||
let setObj = {}
|
||||
|
||||
let setObj = {};
|
||||
setObj['menace_name'] = v.character_name;
|
||||
setObj['menace_hp'] = v.vida_max;
|
||||
let mana_total = parseInt(v.manatotal) ? parseInt(v.manatotal) : 0;
|
||||
@@ -3419,21 +3419,35 @@
|
||||
setObj['menace_mp'] = mana_total + mana_temp;
|
||||
setObj['menace_nd'] = convertToND(v.charnivel);
|
||||
|
||||
|
||||
|
||||
let metade_nivel = Math.floor(Number.parseFloat(v.charnivel)/2);
|
||||
|
||||
let atribute = parseInt(v.condicaopericia) + parseInt(v.periciatemp) + parseInt(v.rolltemp) + parseInt(v.condicaoiniciativa) + parseInt(metade_nivel) + parseInt(v[stripTag(v.iniciativaatributo2)]) + (parseInt(v.bonus_treino) * parseInt(v.iniciativa_treinada)) + parseInt(v.iniciativaoutros);
|
||||
setObj['menace_init'] = atribute > 0 ? "+" + atribute : atribute;
|
||||
atribute = parseInt(v.condicaopericia) + parseInt(v.periciatemp) + parseInt(v.rolltemp) + parseInt(v.condicaopercepcao) + parseInt(metade_nivel) + parseInt(v[stripTag(v.percepcaoatributo2)]) + (parseInt(v.bonus_treino) * parseInt(v.percepcao_treinada)) + parseInt(v.percepcaooutros);
|
||||
setObj['menace_percep'] = atribute > 0 ? "+" + atribute : atribute;
|
||||
|
||||
let splitAttr = stripTag(v.fortitudeatributo2).split("+");
|
||||
let splitAttr = stripTag(v.iniciativaatributo2).split("+");
|
||||
let attrSum = 0;
|
||||
|
||||
for(let i=0; i < splitAttr.length; i++){
|
||||
attrSum += parseInt(v[`${stripTag(splitAttr[i].trim())}`]);
|
||||
}
|
||||
|
||||
let atribute = parseInt(v.condicaopericia) + parseInt(v.periciatemp) + parseInt(v.rolltemp) + parseInt(v.condicaoiniciativa) + parseInt(metade_nivel) + parseInt(attrSum) + (parseInt(v.bonus_treino) * parseInt(v.iniciativa_treinada)) + parseInt(v.iniciativaoutros);
|
||||
setObj['menace_init'] = atribute > 0 ? "+" + atribute : atribute;
|
||||
|
||||
splitAttr = stripTag(v.percepcaoatributo2).split("+");
|
||||
attrSum = 0;
|
||||
|
||||
for(let i=0; i < splitAttr.length; i++){
|
||||
attrSum += parseInt(v[stripTag(splitAttr[i].trim())]);
|
||||
}
|
||||
|
||||
atribute = parseInt(v.condicaopericia) + parseInt(v.periciatemp) + parseInt(v.rolltemp) + parseInt(v.condicaopercepcao) + parseInt(metade_nivel) + parseInt(attrSum) + (parseInt(v.bonus_treino) * parseInt(v.percepcao_treinada)) + parseInt(v.percepcaooutros);
|
||||
setObj['menace_percep'] = atribute > 0 ? "+" + atribute : atribute;
|
||||
|
||||
splitAttr = stripTag(v.fortitudeatributo2).split("+");
|
||||
attrSum = 0;
|
||||
|
||||
for(let i=0; i < splitAttr.length; i++){
|
||||
attrSum += parseInt(v[stripTag(splitAttr[i].trim())]);
|
||||
}
|
||||
|
||||
atribute = parseInt(v.resistemp) + parseInt(v.condicaopericia) + parseInt(v.periciatemp) + parseInt(v.rolltemp) + parseInt(metade_nivel) + parseInt(attrSum) + (parseInt(v.bonus_treino) * parseInt(v.fortitude_treinada)) + parseInt(v.fortitudeoutros);
|
||||
setObj['menace_fortitude'] = atribute > 0 ? "+" + atribute : atribute;
|
||||
|
||||
@@ -3441,9 +3455,11 @@
|
||||
attrSum = 0;
|
||||
|
||||
for(let i=0; i < splitAttr.length; i++){
|
||||
attrSum += parseInt(v[stripTag(splitAttr[i].trim())]);
|
||||
attrSum += parseInt(v[stripTag(splitAttr[i].trim())]);
|
||||
|
||||
console.log(splitAttr[i] + stripTag(splitAttr[i]) + v[stripTag(splitAttr[i].trim())])
|
||||
}
|
||||
|
||||
|
||||
atribute = parseInt(v.resistemp) + parseInt(v.condicaopericia) + parseInt(v.periciatemp) + parseInt(v.rolltemp) + parseInt(metade_nivel) + parseInt(attrSum) + (parseInt(v.bonus_treino) * parseInt(v.reflexos_treinada)) + parseInt(v.reflexosoutros);
|
||||
setObj['menace_reflex'] = atribute > 0 ? "+" + atribute : atribute;
|
||||
|
||||
@@ -3451,18 +3467,20 @@
|
||||
attrSum = 0;
|
||||
|
||||
for(let i=0; i < splitAttr.length; i++){
|
||||
attrSum += parseInt(v[stripTag(splitAttr[i].trim())]);
|
||||
attrSum += parseInt(v[stripTag(splitAttr[i].trim())]);
|
||||
|
||||
console.log(splitAttr[i] + stripTag(splitAttr[i]) + v[stripTag(splitAttr[i].trim())])
|
||||
}
|
||||
|
||||
|
||||
atribute = parseInt(v.resistemp) + parseInt(v.condicaoreflexo) + parseInt(v.condicaopericia) + parseInt(v.periciatemp) + parseInt(v.rolltemp) + parseInt(metade_nivel) + parseInt(attrSum) + (parseInt(v.bonus_treino) * parseInt(v.vontade_treinada)) + parseInt(v.vontadeoutros);
|
||||
setObj['menace_will'] = atribute > 0 ? "+" + atribute : atribute;
|
||||
|
||||
|
||||
if (v.mana_max <= 0){
|
||||
$20('.sheet-menace-mana').addClass('sheet-hiddenelement');
|
||||
} else {
|
||||
$20('.sheet-menace-mana').removeClass('sheet-hiddenelement');
|
||||
}
|
||||
|
||||
|
||||
setAttrs(setObj);
|
||||
});
|
||||
|
||||
@@ -3477,22 +3495,21 @@
|
||||
"periciatemp", "rolltemp", "condicaopericia", "condicaomodataquecc", "condicaomodataque",
|
||||
"condicaoperfisico", "condicaopermental", "condicaocego", "condicaomodataquedis"
|
||||
], function(x){
|
||||
let setObj = {}
|
||||
|
||||
let splitAttr = stripTag(x[`${skill}atributo2`]).split(" + ");
|
||||
let setObj = {};
|
||||
let splitAttr = stripTag(x[`${skill}atributo2`]).split("+");
|
||||
let attrSum = 0;
|
||||
|
||||
for(let i=0; i < splitAttr.length; i++){
|
||||
attrSum += parseInt(x[stripTag(splitAttr[i])]);
|
||||
attrSum += parseInt(x[stripTag(splitAttr[i].trim())]);
|
||||
}
|
||||
|
||||
let metade_nivel = Math.floor(Number.parseFloat(x.charnivel)/2);
|
||||
let total_skill = parseInt(x.periciatemp) + parseInt(x.rolltemp) + parseInt(x.condicaopericia) +
|
||||
parseInt(metade_nivel) + attrSum +
|
||||
(parseInt(x.bonus_treino) * parseInt(x[`${skill}_treinada`])) + parseInt(x[`${skill}outros`]);
|
||||
|
||||
|
||||
setObj[`menace_${skill}total`] = total_skill > 0 ? "+" + total_skill : total_skill;
|
||||
|
||||
|
||||
setAttrs(setObj);
|
||||
|
||||
if(parseInt(x[`${skill}_treinada`]) == 1){
|
||||
@@ -3502,16 +3519,29 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
const sumAttr = (valAttr, list) => {
|
||||
let splitAttr = stripTag(v.iniciativaatributo2).split("+");
|
||||
let attrSum = 0;
|
||||
|
||||
for(let i=0; i < splitAttr.length; i++){
|
||||
attrSum += parseInt(v[`${stripTag(splitAttr[i].trim())}`]);
|
||||
}
|
||||
}
|
||||
|
||||
const calcAtaqueFim = (charnivel, atributo, bonus_treino, treino, outros) => {
|
||||
atributo = atributo ? atributo : 0;
|
||||
return Math.floor(Number.parseFloat(charnivel)/2) + parseInt(atributo) + (parseInt(bonus_treino)*parseInt(treino)) + parseInt(outros);
|
||||
}
|
||||
|
||||
|
||||
const stripTag = (tag) => { return tag.replace('@{','').replace('}','').replace('+@{condicaomodataquecc}+@{condicaomodataque}','').replace(' ',''); }
|
||||
|
||||
const stripTag = (tag) => {
|
||||
let clean_tag = tag.replace('@{','').replace('}','').replace('+@{condicaomodataquecc}+@{condicaomodataque}','')
|
||||
.replace('+@{condicaomodataquedis}+@{condicaomodataque}','').trim();
|
||||
return clean_tag;
|
||||
}
|
||||
|
||||
const createDice = () => {
|
||||
return '<button type="roll" name="roll_attack" class="buttonrollataque dado-simples" value="">T</button>'
|
||||
@@ -3628,8 +3658,10 @@
|
||||
|
||||
getSectionIDs('repeating_attacks', (idarray) => {
|
||||
getAttrs(
|
||||
[ 'charnivel', 'lutaatributo2', 'bonus_treino', 'luta_treinada', 'lutaoutros',
|
||||
[ 'charnivel', 'bonus_treino',
|
||||
'lutaatributo2', 'luta_treinada', 'lutaoutros',
|
||||
'pontariaatributo2', 'pontaria_treinada', 'pontariaoutros',
|
||||
'atuacaoatributo2', 'atuacao_treinada', 'atuacaooutros',
|
||||
'for_mod', 'des_mod', 'con_mod', 'int_mod', 'sab_mod', 'car_mod', 'character_name',
|
||||
"condicaomodataquecc", "condicaomodataquedis", "condicaomodataque",
|
||||
"rolltemp", "ataquetemp", "danotemp", "periciatemp"
|
||||
@@ -3652,10 +3684,11 @@
|
||||
|
||||
idarray.forEach(
|
||||
(id) => {
|
||||
let tagPericia = stripTag(values[`repeating_attacks_${id}_ataquepericia`]).replace('total','');
|
||||
let tagPericia = stripTag(values[`repeating_attacks_${id}_ataquepericia`]).replace('total','');
|
||||
let newrowattrs = {};
|
||||
let rowId = generateRowID();
|
||||
let ataqueaTributo = stripTag(values[`${tagPericia}atributo2`]).split(' ')[0];
|
||||
|
||||
|
||||
let ataque_fim = calcAtaqueFim(values['charnivel'], values[ataqueaTributo], values['bonus_treino'], values[`${tagPericia}_treinada`], values[`${tagPericia}outros`]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user