Add new items

This commit is contained in:
2023-02-27 22:04:03 +01:00
parent c8f7c7c1e5
commit 3a8ad674bd
16 changed files with 520 additions and 9 deletions

View File

@@ -42,7 +42,9 @@ export class WarheroActorSheet extends ActorSheet {
cssClass: this.isEditable ? "editable" : "locked",
system: objectData,
limited: this.object.limited,
compentencyItems:this.actor.getCompetencyItems( ),
skills: this.actor.getNormalSkills( ),
raceSkills: this.actor.getRaceSkills( ),
classSkills: this.actor.getClassSkills( ),
languages: this.actor.getLanguages( ),
weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ),
@@ -65,6 +67,9 @@ export class WarheroActorSheet extends ActorSheet {
editScore: this.options.editScore,
isGM: game.user.isGM
}
// Dynamic patch
formData.system.secondary.counterspell.hasmax = false
// Race mngt
if ( race && race.name) {
formData.hpprogression = game.system.warhero.config.progressionList[race.system.hpprogresion]
}

View File

@@ -258,6 +258,11 @@ export class WarheroActor extends Actor {
WarheroUtility.sortArrayObjectsByName(comp)
return comp
}
getRaceSkills() {
let comp = this.items.filter(it => it.type == "skill" && it.system.raceskill)
WarheroUtility.sortArrayObjectsByName(comp)
return comp
}
getClassSkills() {
let comp = this.items.filter(it => it.type == "skill" && it.system.classskill)
WarheroUtility.sortArrayObjectsByName(comp)
@@ -312,7 +317,10 @@ export class WarheroActor extends Actor {
/* ------------------------------------------- */
getEquipments() {
return this.items.filter(item => item.type == 'shield' || item.type == 'armor' || item.type == "weapon" || item.type == "equipment");
return this.items.filter(item => item.type == 'shield' || item.type == 'armor' || item.type == "weapon" || item.type == "equipment" || item.type == "potion" || item.type == "poison"|| item.type == "trap" || item.type == "classitem");
}
getCompetencyItems() {
return duplicate(this.items.filter(item => item.type == "competency") || [])
}
/* ------------------------------------------- */
getEquipmentsOnly() {
@@ -655,6 +663,14 @@ export class WarheroActor extends Actor {
this.update({ 'system.attributes.mana': mana })
return true
}
/* -------------------------------------------- */
incrementUse(rollData) {
let stat = duplicate(this.system[rollData.mode][rollData.statKey])
stat.nbuse++
this.update( { [`system.${rollData.mode}.${rollData.statKey}`]: stat })
}
/* -------------------------------------------- */
getCommonRollData() {
let rollData = WarheroUtility.getBasicRollData()
@@ -672,11 +688,16 @@ export class WarheroActor extends Actor {
let stat = duplicate(this.system[rollType][rollKey])
let rollData = this.getCommonRollData()
rollData.mode = rollType
rollData.statKey = rollKey
rollData.stat = stat
if (stat && stat.stat)
{
rollData.statBonus = duplicate(this.system.statistics[stat.stat])
}
if ( stat.hasuse && stat.nbuse >= stat.maxuse) {
ui.notifications.warn(game.i18n.localize("WH.notif.toomanyuses"))
return
}
if (rollKey == "parrybonustotal") {
WarheroUtility.rollParry(rollData)
return

View File

@@ -45,6 +45,42 @@ export const WARHERO_CONFIG = {
"high": "High (+6HP/Lvl)",
"medium": "Medium (+4HP/Lvl)",
"low": "Low (+2 HP/Lvl)"
},
poisonApplication: {
touch: "WH.ui.Touch",
ingestion: "WH.ui.Ingestion",
weapon: "WH.ui.Weapon"
},
saveType: {
halfdmg: "WH.ui.halfdamage",
ignore: "WH.ui.ignoreeffect"
},
conditionType : {
generic: "WH.ui.generic",
bless: "WH.ui.bless",
spell: "WH.ui.spell",
disease: "WH.ui.disease",
poison: "WH.ui.poison",
curse: "WH.u,i.curse"
},
conditionDuration: {
permanent: "WH.ui.permanent",
temporary: "WH.ui.temporary"
},
conditionSpecialDuration : {
infinite: "WH.ui.infinite",
withineor: "WH.uiwithineor",
beginr: "WH.ui.beginr",
nextr: "WH.ui.nextr",
nextcombat: "WH.ui.nextcombat",
untilendcombat: "WH.ui.untilendcombat",
beginturn: "WH.ui.beginturn",
endturn: "WH.ui.endturn"
}
}

View File

@@ -618,6 +618,10 @@ export class WarheroUtility {
rollData.isCriticalFailure = true
}
if ( rollData.stat.hasuse ) {
actor.incrementUse(rollData)
}
let msg = await this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-warhero/templates/chat-generic-result.html`, rollData)
})