Skip to content

Commit

Permalink
updating images and fixing bonusDamage
Browse files Browse the repository at this point in the history
Updated image urls now using the ones in roll20 master branch since they are now uploaded.
Updated character sheet preview image as requested by the game designer.
Made some adjustments to the avatar image positioning and gradient darkening effect.
  • Loading branch information
machado-cesar authored Dec 13, 2024
1 parent 43aa02f commit 7cbbd9a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 31 deletions.
33 changes: 24 additions & 9 deletions d20age/d20age.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fieldset {
flex-direction: column;
}
span {
background-image: url("https://raw.githubusercontent.com/machado-cesar/roll20-character-sheets/feature_d20age/d20age/images/pencil-scribble-banner-3.png");
background-image: url("https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/d20age/images/pencil-scribble-banner-3.png");
background-size: auto 38px;
background-position: center;
color: white;
Expand Down Expand Up @@ -330,15 +330,30 @@ input[type="checkbox"] {
width: 231px !important;
padding: 15px;
border-radius: 4px;
background: linear-gradient(
145deg,
#fff,
#eee
);
background-color: #fff;
box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3),
1px 1px 2px rgba(255, 255, 255, 0.5) inset;
transform: rotate(-0.5deg);
}

.art-container::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(
135deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.04) 60%,
rgba(0, 0, 0, 0.08) 100%
);
pointer-events: none;
z-index: 1;
border-radius: 4px;
}

.tape {
width: 198px !important;
height: 30px;
Expand Down Expand Up @@ -377,7 +392,7 @@ input[type="checkbox"] {
.art {
border-radius: 8px;
background-image: url(@{character_name|avatar});
background-position: center;
background-position: flex-start;
background-size: cover;
background-repeat: no-repeat;
}
Expand Down Expand Up @@ -776,7 +791,7 @@ input[type="checkbox"] {
}
.retainers-header input,
.retainers-header select {
background-image: url("https://raw.githubusercontent.com/machado-cesar/roll20-character-sheets/feature_d20age/d20age/images/pencil-scribble-banner-3.png");
background-image: url("https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/d20age/images/pencil-scribble-banner-3.png");
background-size: auto 38px;
background-position: center;
color: white !important;
Expand Down Expand Up @@ -813,7 +828,7 @@ input[type="checkbox"] {
}
.retainers-hd-moral-and-thac0 button {
background-color: unset !important;
background-image: url("https://raw.githubusercontent.com/machado-cesar/roll20-character-sheets/feature_d20age/d20age/images/pencil-scribble-banner-3.png") !important;
background-image: url("https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/d20age/images/pencil-scribble-banner-3.png") !important;
background-size: auto 38px;
background-position: center;
color: white !important;
Expand Down
45 changes: 23 additions & 22 deletions d20age/d20age.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<input type="hidden" name="attr_sheetTab" value="character" />
<input type="hidden" name="attr_weaponEncumbrance" value="0" />
<input type="hidden" name="attr_attackBonus" value="0" />
<input type="hidden" name="attr_damageBonus" value="0" />
<input type="hidden" name="attr_descendingArmorClass" value="" />

<!-- SHEET SELECTOR -->
Expand All @@ -18,7 +17,7 @@
<div class="sheet-character">
<div class="logo-and-header">
<img
src="https://raw.githubusercontent.com/machado-cesar/roll20-character-sheets/feature_d20age/d20age/images/d20agelogo.png"
src="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/d20age/images/d20agelogo.png"
alt="logo d20age"
/>
<!-- Header -->
Expand Down Expand Up @@ -418,11 +417,12 @@ <h3>Armas</h3>
<div class="weapon-grid">
<div id="weapon-roll">
<span>.</span>
<input type="hidden" name="attr_bonusDamage" value="0" />
<button
type="roll"
name="dacAttackRoll"
class="attack-roll attack-roll-dac"
value="&{template:simple} {{descendingArmorClass=@{descendingArmorClass}}} {{roll=@{character_name} ataca com @{weaponName}}} {{ataque=[[1d20+@{dexMod}+@{weaponAttackBonus}+@{attackBonus}]]}} {{dano=[[@{weaponDamageDie}+@{weaponDamageBonus}+@{damageBonus}]]}} {{descrição=@{weaponDescription}}} {{attackMatrix9=@{attackMatrix9}}} {{attackMatrix8=@{attackMatrix8}}} {{attackMatrix7=@{attackMatrix7}}} {{attackMatrix6=@{attackMatrix6}}} {{attackMatrix5=@{attackMatrix5}}} {{attackMatrix4=@{attackMatrix4}}} {{attackMatrix3=@{attackMatrix3}}} {{attackMatrix2=@{attackMatrix2}}} {{attackMatrix1=@{attackMatrix1}}} {{attackMatrix0=@{attackMatrix0}}}"
value="&{template:simple} {{descendingArmorClass=@{descendingArmorClass}}} {{roll=@{character_name} ataca com @{weaponName}}} {{ataque=[[1d20+@{dexMod}+@{weaponAttackBonus}+@{attackBonus}]]}} {{dano=[[@{weaponDamageDie}+@{weaponDamageBonus}+@{bonusDamage}]]}} {{descrição=@{weaponDescription}}} {{attackMatrix9=@{attackMatrix9}}} {{attackMatrix8=@{attackMatrix8}}} {{attackMatrix7=@{attackMatrix7}}} {{attackMatrix6=@{attackMatrix6}}} {{attackMatrix5=@{attackMatrix5}}} {{attackMatrix4=@{attackMatrix4}}} {{attackMatrix3=@{attackMatrix3}}} {{attackMatrix2=@{attackMatrix2}}} {{attackMatrix1=@{attackMatrix1}}} {{attackMatrix0=@{attackMatrix0}}}"
></button>
</div>
<div id="weapon-name">
Expand Down Expand Up @@ -1224,7 +1224,6 @@ <h2>Itens Guardados</h2>
[]
);
getAttrs(attrArray, (v) => {
console.log("===== values of v: " + JSON.stringify(v) + " =====");
// getValue: if not a number, returns 1 if it is 'on' (checkbox), otherwise returns 0..
const getValue = (section, id, field) =>
parseFloat(v[`repeating_${section}_${id}_${field}`]) ||
Expand Down Expand Up @@ -1340,22 +1339,26 @@ <h2>Itens Guardados</h2>
});
});

on("sheet:opened change:attackType change:strMod", function () {
getAttrs(["attackType", "strMod"], function (values) {
const attackType = values.attackType;
const strMod = parseInt(values.strMod) || 0;
let bonusDamage = 0; // Valor padrão
// Define bonusDamage com base no valor de attackType
if (attackType === "melee") {
bonusDamage = strMod;
} else if (attackType === "ranged") {
bonusDamage = 0;
}
// Atualiza o atributo bonusDamage
setAttrs({
bonusDamage: bonusDamage
});
});
on("sheet:opened change:repeating_weapons:attackType change:strMod", function () {
getSectionIDs("repeating_weapons", function (idArray) {
idArray.forEach(function (id) {
const attributes = [`repeating_weapons_${id}_attackType`, "strMod"];
getAttrs(attributes, function (values) {
const attackType = values[`repeating_weapons_${id}_attackType`] || "";
const strMod = parseInt(values.strMod) || 0; // Global strMod
let bonusDamage = 0;
if (attackType.toLowerCase() === "melee") {
bonusDamage = strMod;
} else if (attackType.toLowerCase() === "ranged") {
bonusDamage = 0;
}
console.log(`Repeating weapon update - ID: ${id}, attackType: ${attackType}, bonusDamage: ${bonusDamage}`);
setAttrs({
[`repeating_weapons_${id}_bonusDamage`]: bonusDamage
});
});
});
});
});

// Atualizar weaponEncumbrance com a soma de todos os weaponWeight em repeating_weapons
Expand Down Expand Up @@ -1479,8 +1482,6 @@ <h2>Itens Guardados</h2>
ids.forEach((id) => {
const armorValue = parseInt(itemValues[`repeating_armor_${id}_armorValue`]) || 0;
const armorWorn = itemValues[`repeating_armor_${id}_armorWorn`] === "on";
console.log(itemValues[`repeating_armor_${id}_armorWorn`])
console.log(`Item ID: ${id}, armorValue: ${armorValue}, armorWorn: ${armorWorn}`);
if (armorWorn) {
totalArmorValue += armorValue;
}
Expand Down
Binary file modified d20age/d20age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7cbbd9a

Please sign in to comment.