Various spell stuff enhancements
This commit is contained in:
parent
28e8edc867
commit
e0026adfcd
@ -373,14 +373,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 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 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)
|
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 {
|
return {
|
||||||
focusPoints : focusData.focusPoints + focusBonus,
|
focusPoints : focusPoints,
|
||||||
burnChance: focusData.burnChance + burnchancebonus,
|
burnChance: focusData.burnChance + burnchancebonus,
|
||||||
focusRegen: focusData.focusRegen + focusregenbonus,
|
focusRegen: focusRegen,
|
||||||
spellAttackBonus: focusData.spellAttackBonus,
|
spellAttackBonus: focusData.spellAttackBonus,
|
||||||
spellDamageBonus: focusData.spellDamageBonus,
|
spellDamageBonus: focusData.spellDamageBonus,
|
||||||
currentFocusPoints: this.system.focus.currentFocusPoints
|
currentFocusPoints: this.system.focus.currentfocuspoints
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@ -581,26 +591,42 @@ export class Avd12Actor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
rollSpell(spellId) {
|
async rollSpell(spellId) {
|
||||||
let spell = this.items.get(spellId)
|
let spell = this.items.get(spellId)
|
||||||
if (spell) {
|
if (spell) {
|
||||||
spell = duplicate(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") {
|
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)
|
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 {
|
} else {
|
||||||
ui.notifications.warn("Unable to find the relevant spell.")
|
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) {
|
rollWeapon(weaponId) {
|
||||||
let weapon = this.items.get(weaponId)
|
let weapon = this.items.get(weaponId)
|
||||||
|
@ -541,6 +541,10 @@ export class Avd12Utility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rollData.spell) {
|
||||||
|
actor.spentFocusPoints(rollData.spell)
|
||||||
|
}
|
||||||
|
|
||||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||||
content: await renderTemplate(`systems/fvtt-avd12/templates/chat/chat-generic-result.hbs`, rollData)
|
content: await renderTemplate(`systems/fvtt-avd12/templates/chat/chat-generic-result.hbs`, rollData)
|
||||||
})
|
})
|
||||||
|
@ -191,7 +191,7 @@
|
|||||||
"focus": {
|
"focus": {
|
||||||
"focuspoints": 0,
|
"focuspoints": 0,
|
||||||
"focusregen": 0,
|
"focusregen": 0,
|
||||||
"currentFocusPoints": 0
|
"currentfocuspoints": 0
|
||||||
},
|
},
|
||||||
"lifeline": {
|
"lifeline": {
|
||||||
"value": 0,
|
"value": 0,
|
||||||
@ -438,6 +438,8 @@
|
|||||||
"school": "",
|
"school": "",
|
||||||
"damage": "",
|
"damage": "",
|
||||||
"damagetype": "",
|
"damagetype": "",
|
||||||
|
"damagesecondary": "",
|
||||||
|
"damagesecondarytype": "",
|
||||||
"range": 0,
|
"range": 0,
|
||||||
"components": "",
|
"components": "",
|
||||||
"reaction": false,
|
"reaction": false,
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
<span class="item-name-label-header-short">Health</span>
|
<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.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>
|
<span class="item-name-label-header-medium"> </span>
|
||||||
|
|
||||||
@ -72,14 +72,14 @@
|
|||||||
|
|
||||||
<li class="item flexrow list-item">
|
<li class="item flexrow list-item">
|
||||||
<span class="item-name-label-header-short">Focus Regen</span>
|
<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/>
|
<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"> </span>
|
||||||
|
|
||||||
<span class="item-name-label-header-short">Focus Points</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" name="system.focus.currentfocuspoints" value="{{system.focus.currentfocuspoints}}" data-dtype="Number"/> /
|
||||||
<input type="text" class="item-field-label-short" value="{{focusData.focusPoints}}" data-dtype="Number" disabled/>
|
<input type="text" class="item-field-label-short" value="{{system.focus.focuspoints}}" data-dtype="Number" disabled/>
|
||||||
|
|
||||||
<span class="item-name-label-header-medium"> </span>
|
<span class="item-name-label-header-medium"> </span>
|
||||||
</li>
|
</li>
|
||||||
|
@ -23,6 +23,13 @@
|
|||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if spell}}
|
||||||
|
<li>Spell : {{spell.name}} ({{spell.system.level}})
|
||||||
|
</li>
|
||||||
|
<li>Focus Points Spent : {{spellCost}}
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<li>Dice Formula {{diceFormula}} </li>
|
<li>Dice Formula {{diceFormula}} </li>
|
||||||
<li>Result {{roll.total}} </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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if spell}}
|
||||||
|
|
||||||
|
{{else}}
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Target check : </span>
|
<span class="roll-dialog-label">Target check : </span>
|
||||||
<select id="targetCheck" name="targetCheck">
|
<select id="targetCheck" name="targetCheck">
|
||||||
@ -60,6 +63,7 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -69,6 +69,20 @@
|
|||||||
</select>
|
</select>
|
||||||
</li>
|
</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">
|
<li class="flexrow">
|
||||||
<label class="item-field-label-long">Range</label>
|
<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"/>
|
<input type="text" class="item-field-label-short" name="system.range" value="{{system.range}}" data-dtype="Number"/>
|
||||||
|
Reference in New Issue
Block a user