Compare commits
4 Commits
fvtt-avd12
...
fvtt-avd12
Author | SHA1 | Date | |
---|---|---|---|
2566fac378 | |||
06b605176e | |||
f73af29949 | |||
e0026adfcd |
@ -62,6 +62,9 @@ export class Avd12Actor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rebuildSkills() {
|
||||
let armorPenalties = Avd12Utility.getArmorPenalty( this.items.find( item => item.type == "armor") )
|
||||
let shieldPenalties = Avd12Utility.getArmorPenalty( this.items.find( item => item.type == "shield") )
|
||||
|
||||
for (let attrKey in this.system.attributes) {
|
||||
let attr = this.system.attributes[attrKey]
|
||||
for (let skillKey in attr.skills) {
|
||||
@ -72,10 +75,38 @@ export class Avd12Actor extends Actor {
|
||||
for (let trait of availableTraits) {
|
||||
skill.modifier += Number(trait.system.bonusvalue)
|
||||
}
|
||||
// Apply armor penalties
|
||||
if ( armorPenalties[skillKey]) {
|
||||
console.log("Found armor penalties : ", armorPenalties, skillKey)
|
||||
skill.modifier += Number(armorPenalties[skillKey])
|
||||
}
|
||||
// Apply shield penalties
|
||||
if ( shieldPenalties[skillKey]) {
|
||||
console.log("Found shield penalties : ", shieldPenalties, skillKey)
|
||||
skill.modifier += Number(shieldPenalties[skillKey])
|
||||
}
|
||||
// Process additionnal bonuses
|
||||
for(let item of this.items) {
|
||||
if (item.system.bonus && item.system.bonus[skillKey]) {
|
||||
skill.modifier += Number(item.system.bonus[skillKey].value)
|
||||
}
|
||||
}
|
||||
skill.finalvalue = skill.modifier + attr.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rebuildMitigations() {
|
||||
for (let mitiKey in this.system.mitigation) {
|
||||
let mitigation = this.system.mitigation[mitiKey]
|
||||
for(let item of this.items) {
|
||||
if (item.system.mitigation && item.system.mitigation[mitiKey]) {
|
||||
mitigation.value += Number(item.system.mitigation[mitiKey].value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareDerivedData() {
|
||||
@ -86,6 +117,7 @@ export class Avd12Actor extends Actor {
|
||||
this.computeHitPoints()
|
||||
|
||||
this.rebuildSkills()
|
||||
this.rebuildMitigations()
|
||||
}
|
||||
|
||||
super.prepareDerivedData();
|
||||
@ -373,14 +405,24 @@ export class Avd12Actor extends Actor {
|
||||
let focusBonus = this.items.filter( it => it.system.focuspointsbonus > 0).reduce((sum, item2) => sum = item2.system.focuspointsbonus, 0)
|
||||
let focusregenbonus = this.items.filter( it => it.system.focusregenbonus > 0).reduce((sum, item2) => sum = item2.system.focusregenbonus, 0)
|
||||
let burnchancebonus = this.items.filter( it => it.system.burnchancebonus > 0).reduce((sum, item2) => sum = item2.system.burnchancebonus, 0)
|
||||
console.log("FINAL BONUS", focusBonus, focusregenbonus, burnchancebonus)
|
||||
|
||||
let focusPoints = focusData.focusPoints + focusBonus
|
||||
let focusRegen = focusData.focusRegen + focusregenbonus
|
||||
//console.log("Update focus", focusPoints, focusRegen)
|
||||
if ( focusPoints != this.system.focus.focuspoints || focusRegen != this.system.focus.focusregen) {
|
||||
let focusData = duplicate(this.system.focus)
|
||||
focusData.focuspoints = focusPoints
|
||||
focusData.focusregen = focusRegen
|
||||
this.update( {'system.focus': focusData})
|
||||
}
|
||||
//console.log("FINAL BONUS", focusBonus, focusregenbonus, burnchancebonus)
|
||||
return {
|
||||
focusPoints : focusData.focusPoints + focusBonus,
|
||||
focusPoints : focusPoints,
|
||||
burnChance: focusData.burnChance + burnchancebonus,
|
||||
focusRegen: focusData.focusRegen + focusregenbonus,
|
||||
focusRegen: focusRegen,
|
||||
spellAttackBonus: focusData.spellAttackBonus,
|
||||
spellDamageBonus: focusData.spellDamageBonus,
|
||||
currentFocusPoints: this.system.focus.currentFocusPoints
|
||||
currentFocusPoints: this.system.focus.currentfocuspoints
|
||||
}
|
||||
}
|
||||
return {
|
||||
@ -581,26 +623,42 @@ export class Avd12Actor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollSpell(spellId) {
|
||||
async rollSpell(spellId) {
|
||||
let spell = this.items.get(spellId)
|
||||
if (spell) {
|
||||
spell = duplicate(spell)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "spell"
|
||||
rollData.spell = spell
|
||||
rollData.spellAttack = this.system.bonus.spell.attack
|
||||
rollData.spellDamage = this.system.bonus.spell.damage
|
||||
rollData.spellCost = Avd12Utility.getSpellCost(spell)
|
||||
rollData.title = "Roll Spell " + spell.name
|
||||
rollData.img = spell.img
|
||||
if (spell.system.spelltype != "utility") {
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "spell"
|
||||
rollData.spell = spell
|
||||
rollData.spellAttack = this.system.bonus.spell.attack
|
||||
rollData.spellDamage = this.system.bonus.spell.damage
|
||||
rollData.spellCost = Avd12Utility.getSpellCost(spell)
|
||||
rollData.title = "Roll Spell " + spell.name
|
||||
rollData.img = spell.img
|
||||
this.startRoll(rollData)
|
||||
} else {
|
||||
this.spentFocusPoints( spell )
|
||||
let msg = await Avd12Utility.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-avd12/templates/chat/chat-utility-spell.hbs`, rollData)
|
||||
})
|
||||
msg.setFlag("world", "rolldata", rollData)
|
||||
}
|
||||
} else {
|
||||
ui.notifications.warn("Unable to find the relevant spell.")
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
spentFocusPoints( spell) {
|
||||
let spellCost = Avd12Utility.getSpellCost(spell)
|
||||
let focusData = duplicate(this.system.focus)
|
||||
focusData.currentfocuspoints -= spellCost
|
||||
focusData.currentfocuspoints = Math.max(focusData.currentfocuspoints, 0)
|
||||
console.log("New fovcus", this.system, focusData)
|
||||
this.update({'system.focus': focusData})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollWeapon(weaponId) {
|
||||
let weapon = this.items.get(weaponId)
|
||||
|
@ -11,7 +11,11 @@ const __focusRegenBond = { "bondnone": 6, "bondeasy": 8, "bondcommon": 12, "bond
|
||||
const __bonusSpellDamageBond = { "bondnone": 0, "bondeasy": 1, "bondcommon": 1, "bonduncommon": 1, "bondrare": 2, "bondlegendary": 2, "bondmythic": 3, "bonddivine": 4 }
|
||||
const __bonusSpellAttackBond = { "bondnone": 0, "bondeasy": 0, "bondcommon": 1, "bonduncommon": 1, "bondrare": 2, "bondlegendary": 2, "bondmythic": 3, "bonddivine": 4 }
|
||||
const __spellCost = { "beginner": 1, "novice": 2, "expert": 4, "master": 6, "grandmaster": 8 }
|
||||
const __armorPenalties = {"light": { block: -2, dodge: -1}, "medium": { dodge: -3, block: -2, castingtime: 1, stealth: -2, speed: -1,
|
||||
"heavy": { dodge: -4, block: -3, stealth: -3, castingtime: 2, speed: -3 }, "ultraheavy": { dodge: -5, block: -4, stealth: -5, castingtime: 2, speed: -3 },
|
||||
"lightshield": {dodge: -1, block: +1}, "heavyshield": {dodge: -2, block: 2, speed: -1, stealth: -1} }
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class Avd12Utility {
|
||||
@ -439,6 +443,15 @@ export class Avd12Utility {
|
||||
static getSpellCost(spell) {
|
||||
return __spellCost[spell.system.level]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getArmorPenalty( item ) {
|
||||
if (item && (item.type == "shield" || item.type == "armor")) {
|
||||
return __armorPenalties[item.system.category]
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
|
||||
let chatData = {
|
||||
@ -541,6 +554,10 @@ export class Avd12Utility {
|
||||
}
|
||||
}
|
||||
|
||||
if (rollData.spell) {
|
||||
actor.spentFocusPoints(rollData.spell)
|
||||
}
|
||||
|
||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-avd12/templates/chat/chat-generic-result.hbs`, rollData)
|
||||
})
|
||||
|
@ -222,13 +222,14 @@ table {border: 1px solid #7a7971;}
|
||||
-webkit-box-flex: 0;
|
||||
-ms-flex: 0 0 128px;
|
||||
flex: 0 0 128px;
|
||||
width: 196px;
|
||||
width: 128px;
|
||||
height: auto;
|
||||
max-height:260px;
|
||||
max-height:160px;
|
||||
margin-top: 0px;
|
||||
margin-right: 10px;
|
||||
object-fit: cover;
|
||||
object-position: 50% 0;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.button-img {
|
||||
@ -1293,6 +1294,11 @@ ul, li {
|
||||
max-width: 6rem;
|
||||
min-width: 6rem;
|
||||
}
|
||||
.item-field-skill {
|
||||
flex-grow:1;
|
||||
max-width: 6.8rem;
|
||||
min-width: 6.8rem;
|
||||
}
|
||||
.item-field-label-long {
|
||||
margin-top: 4px;
|
||||
flex-grow:1;
|
||||
|
@ -55,7 +55,7 @@
|
||||
],
|
||||
"title": "AnyVenture D12 RPG",
|
||||
"url": "https://www.uberwald.me/gitea/public/fvtt-avd12",
|
||||
"version": "10.0.15",
|
||||
"download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.15.zip",
|
||||
"version": "10.0.17",
|
||||
"download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.17.zip",
|
||||
"background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp"
|
||||
}
|
@ -191,7 +191,7 @@
|
||||
"focus": {
|
||||
"focuspoints": 0,
|
||||
"focusregen": 0,
|
||||
"currentFocusPoints": 0
|
||||
"currentfocuspoints": 0
|
||||
},
|
||||
"lifeline": {
|
||||
"value": 0,
|
||||
@ -438,6 +438,8 @@
|
||||
"school": "",
|
||||
"damage": "",
|
||||
"damagetype": "",
|
||||
"damagesecondary": "",
|
||||
"damagesecondarytype": "",
|
||||
"range": 0,
|
||||
"components": "",
|
||||
"reaction": false,
|
||||
@ -455,6 +457,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"shield": {
|
||||
"category": "",
|
||||
"templates": [
|
||||
"commonitem"
|
||||
],
|
||||
|
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
{{#each attr.skills as |skill skillKey|}}
|
||||
<div class="flexrow">
|
||||
<span class="item-field-label-medium skill-label"><a class="roll-skill" data-attr-key="{{attrKey}}" data-skill-key="{{skillKey}}">{{upperFirst skillKey}} {{skill.finalvalue}}<i class="fa-solid fa-dice-d12"></i></a></span>
|
||||
<span class="item-field-skill skill-label"><a class="roll-skill" data-attr-key="{{attrKey}}" data-skill-key="{{skillKey}}"><i class="fa-solid fa-dice-d12"></i> {{upperFirst skillKey}} {{skill.finalvalue}}</a></span>
|
||||
<input type="checkbox" class="skill-good-checkbox" name="system.attributes.{{attrKey}}.skills.{{skillKey}}.good" {{checked skill.good}} />
|
||||
</div>
|
||||
{{/each}}
|
||||
@ -64,25 +64,11 @@
|
||||
|
||||
<span class="item-name-label-header-short">Health</span>
|
||||
<input type="text" class="item-field-label-short" name="system.health.value" value="{{system.health.value}}" data-dtype="Number"/> /
|
||||
<input type="text" class="item-field-label-short" name="system.health.max" value="{{system.health.max}}" data-dtype="Number"/>
|
||||
<input type="text" class="item-field-label-short" name="system.health.max" value="{{system.health.max}}" data-dtype="Number" disabled/>
|
||||
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="item flexrow list-item">
|
||||
<span class="item-name-label-header-short">Focus Regen</span>
|
||||
<input type="text" class="item-field-label-short" value="{{focusData.focusRegen}}" data-dtype="Number" disabled/>
|
||||
|
||||
|
||||
<span class="item-name-label-header-short"> </span>
|
||||
|
||||
<span class="item-name-label-header-short">Focus Points</span>
|
||||
<input type="text" class="item-field-label-short" value="{{focusData.currentFocusPoints}}" data-dtype="Number" disabled/> /
|
||||
<input type="text" class="item-field-label-short" value="{{focusData.focusPoints}}" data-dtype="Number" disabled/>
|
||||
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="grid-2col">
|
||||
@ -156,6 +142,22 @@
|
||||
|
||||
<div class="flexcol">
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item">
|
||||
<span class="item-name-label-header-short">Focus Regen</span>
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focusregen}}" data-dtype="Number" disabled/>
|
||||
|
||||
|
||||
<span class="item-name-label-header-short"> </span>
|
||||
|
||||
<span class="item-name-label-header-short">Focus Points</span>
|
||||
<input type="text" class="item-field-label-short" name="system.focus.currentfocuspoints" value="{{system.focus.currentfocuspoints}}" data-dtype="Number"/> /
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focuspoints}}" data-dtype="Number" disabled/>
|
||||
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
@ -174,7 +176,7 @@
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{spell.img}}" /></a>
|
||||
<span class="item-name-label">
|
||||
<a class="roll-spell">{{spell.name}} <i class="fa-solid fa-dice-d12"></i></a>
|
||||
<a class="roll-spell"><i class="fa-solid fa-dice-d12"> </i>{{spell.name}}</a>
|
||||
</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.spelltype}}</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.level}}</span>
|
||||
|
@ -23,6 +23,13 @@
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if spell}}
|
||||
<li>Spell : {{spell.name}} ({{spell.system.level}})
|
||||
</li>
|
||||
<li>Focus Points Spent : {{spellCost}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
<li>Dice Formula {{diceFormula}} </li>
|
||||
<li>Result {{roll.total}} </li>
|
||||
|
||||
|
28
templates/chat/chat-utility-spell.hbs
Normal file
28
templates/chat/chat-utility-spell.hbs
Normal file
@ -0,0 +1,28 @@
|
||||
<div class="chat-message-header">
|
||||
{{#if actorImg}}
|
||||
<img class="actor-icon" src="{{actorImg}}" alt="{{alias}}" />
|
||||
{{/if}}
|
||||
<h4 class=chat-actor-name>{{alias}}</h4>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{{#if img}}
|
||||
<div >
|
||||
<img class="chat-icon" src="{{img}}" alt="{{name}}" />
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="flexcol">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li>Utility Spell {{spell.name}} has been casted !
|
||||
</li>
|
||||
<li>Focus Points Spent : {{spellCost}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
@ -47,6 +47,9 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{#if spell}}
|
||||
|
||||
{{else}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Target check : </span>
|
||||
<select id="targetCheck" name="targetCheck">
|
||||
@ -60,6 +63,7 @@
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -21,6 +21,15 @@
|
||||
|
||||
{{> systems/fvtt-avd12/templates/items/partial-common-item-fields.hbs}}
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Shield type</label>
|
||||
<select class="item-field-label-long" type="text" name="system.category" value="{{system.category}}" data-dtype="String">
|
||||
{{#select system.category}}
|
||||
{{> systems/fvtt-avd12/templates/items/partial-options-shield-types.hbs}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Equipped</label>
|
||||
<input type="checkbox" class="item-field-label-short" name="system.equipped" {{checked system.equipped}} />
|
||||
|
@ -69,6 +69,20 @@
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Secondary Damage</label>
|
||||
<input type="text" class="item-field-label-short" name="system.damagesecondary" value="{{system.damagesecondary}}" data-dtype="String"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Secondary Damage Type</label>
|
||||
<select class="item-field-label-long" type="text" name="system.damagesecondarytype" value="{{system.damagesecondarytype}}" data-dtype="String">
|
||||
{{#select system.damagetype}}
|
||||
{{> systems/fvtt-avd12/templates/items/partial-options-damage-types.hbs}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Range</label>
|
||||
<input type="text" class="item-field-label-short" name="system.range" value="{{system.range}}" data-dtype="Number"/>
|
||||
|
@ -90,8 +90,8 @@
|
||||
<label class="item-field-label-long">{{upperFirst key}}</label>
|
||||
<div class="flexrow">
|
||||
<label class="item-field-label-short">Type</label>
|
||||
<select class="item-field-label-long" type="text" name="system.damages.{{key}}.damagetype" value="{{system.damagetype}}" data-dtype="String">
|
||||
{{#select system.damagetype}}
|
||||
<select class="item-field-label-long" type="text" name="system.damages.{{key}}.damagetype" value="{{damage.damagetype}}" data-dtype="String">
|
||||
{{#select damage.damagetype}}
|
||||
{{> systems/fvtt-avd12/templates/items/partial-options-damage-types.hbs}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
2
templates/items/partial-options-shield-types.hbs
Normal file
2
templates/items/partial-options-shield-types.hbs
Normal file
@ -0,0 +1,2 @@
|
||||
<option value="lightshield">Light Shield</option>
|
||||
<option value="heavyshield">Heavy Shield</option>
|
Reference in New Issue
Block a user