Compare commits
1 Commits
5d8da860c4
...
b16c5b6f85
Author | SHA1 | Date | |
---|---|---|---|
b16c5b6f85 |
@@ -31,7 +31,7 @@ export class ActorToken {
|
|||||||
|
|
||||||
constructor(token) {
|
constructor(token) {
|
||||||
this.name = token.name ?? token.actor.name
|
this.name = token.name ?? token.actor.name
|
||||||
this.img = token.texture.src ?? token.actor.img
|
this.img = token.actor.isToken && token.texture.src ? token.texture.src : token.actor.img
|
||||||
this.actor = token.actor
|
this.actor = token.actor
|
||||||
this.id = token.actor?.id
|
this.id = token.actor?.id
|
||||||
this.token = token
|
this.token = token
|
||||||
|
@@ -170,49 +170,33 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/** Retourne une liste triée d'actions d'armes avec le split arme1 main / arme 2 main / lancer */
|
/** Retourne une liste triée d'actions d'armes avec le split arme1 main / arme 2 main / lancer */
|
||||||
listActionsAttaque() {
|
listActionsAttaque() {
|
||||||
let actions = [
|
const actions = []
|
||||||
this.$prepareAttaqueArme(RdDItemArme.empoignade(this)),
|
const uniques = []
|
||||||
this.$prepareAttaqueArme(RdDItemArme.corpsACorps(this)),
|
|
||||||
]
|
|
||||||
|
|
||||||
const armes = this.itemTypes[ITEM_TYPES.arme]
|
const addAttaque = (arme, main) => {
|
||||||
.filter(it => RdDItemArme.isAttaque(it))
|
const dommages = arme.system.dommages.toString()
|
||||||
.sort(Misc.ascending(it => it.name));
|
const tableauDommages = dommages.includes("/") ? dommages.split("/") : [dommages, dommages]
|
||||||
|
const dommagesArme = parseInt(main == '(2 mains)' ? tableauDommages[1] : tableauDommages[0])
|
||||||
|
const magieEfficacite = arme.system.magique ? arme.system.ecaille_efficacite : 0;
|
||||||
|
|
||||||
for (const arme of armes) {
|
|
||||||
if (arme.system.unemain && arme.system.competence) {
|
|
||||||
actions.push(this.$prepareAttaqueArme(arme, '(1 main)'))
|
|
||||||
}
|
|
||||||
if (arme.system.deuxmains && arme.system.competence) {
|
|
||||||
actions.push(this.$prepareAttaqueArme(arme, '(2 mains)'))
|
|
||||||
}
|
|
||||||
if (arme.system.lancer) {
|
|
||||||
actions.push(this.$prepareAttaqueArme(arme, '(lancer)'))
|
|
||||||
}
|
|
||||||
if (arme.system.tir) {
|
|
||||||
actions.push(this.$prepareAttaqueArme(arme, '(tir)'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return actions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
$prepareAttaqueArme(arme, main) {
|
|
||||||
const comp = this.getCompetence(RdDActor.$getCompetenceAction(arme, main))
|
const comp = this.getCompetence(RdDActor.$getCompetenceAction(arme, main))
|
||||||
|
const unique = [comp.id, arme.name, dommagesArme, magieEfficacite].join('|');
|
||||||
|
if (uniques.includes(unique)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uniques.push(unique);
|
||||||
|
|
||||||
const caracCode = RdDActor.$getCaracAction(comp, main)
|
const caracCode = RdDActor.$getCaracAction(comp, main)
|
||||||
const caracValue = this.system.carac[caracCode].value
|
const caracValue = this.system.carac[caracCode].value
|
||||||
const dommages = arme.system.dommages.toString()
|
|
||||||
|
|
||||||
// TODO: déplacer sur RdDItemArme
|
// TODO: déplacer sur RdDItemArme
|
||||||
if (arme.system.unemain && arme.system.deuxmains && !dommages.includes("/")) {
|
if (arme.system.unemain && arme.system.deuxmains && !dommages.includes("/")) {
|
||||||
ui.notifications.info(`Les dommages de l'arme à 1/2 mains ${arme.name} ne sont pas corrects (ie sous la forme X/Y)`)
|
ui.notifications.info(`Les dommages de l'arme à 1/2 mains ${arme.name} ne sont pas corrects (ie sous la forme X/Y)`)
|
||||||
}
|
}
|
||||||
const tableauDommages = dommages.includes("/") ? dommages.split("/") : [dommages, dommages]
|
|
||||||
const dommagesArme = parseInt(main == '(2 mains)' ? tableauDommages[1] : tableauDommages[0])
|
|
||||||
const niveau = comp?.system.niveau ?? (['(lancer)', '(tir)'].includes(main) ? -8 : -6)
|
const niveau = comp?.system.niveau ?? (['(lancer)', '(tir)'].includes(main) ? -8 : -6)
|
||||||
const ajustement = (arme.parent?.getEtatGeneral() ?? 0) + (arme.system.magique) ? arme.system.ecaille_efficacite : 0
|
const ajustement = (arme.parent?.getEtatGeneral() ?? 0) + magieEfficacite
|
||||||
|
|
||||||
return {
|
actions.push({
|
||||||
name: arme.name + (main ? ' ' + main : ''),
|
name: arme.name + (main ? ' ' + main : ''),
|
||||||
action: 'attaque',
|
action: 'attaque',
|
||||||
initOnly: false,
|
initOnly: false,
|
||||||
@@ -223,7 +207,22 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
equipe: arme.system.equipe,
|
equipe: arme.system.equipe,
|
||||||
dommagesArme: dommagesArme,
|
dommagesArme: dommagesArme,
|
||||||
initiative: RdDInitiative.calculInitiative(niveau, caracValue, ajustement)
|
initiative: RdDInitiative.calculInitiative(niveau, caracValue, ajustement)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addAttaque(RdDItemArme.empoignade(this))
|
||||||
|
addAttaque(RdDItemArme.corpsACorps(this))
|
||||||
|
|
||||||
|
this.itemTypes[ITEM_TYPES.arme]
|
||||||
|
.filter(it => RdDItemArme.isAttaque(it))
|
||||||
|
.sort(Misc.ascending(it => it.name))
|
||||||
|
.forEach(arme => {
|
||||||
|
if (arme.system.unemain && arme.system.competence) { addAttaque(arme, '(1 main)') }
|
||||||
|
if (arme.system.deuxmains && arme.system.competence) { addAttaque(arme, '(2 mains)') }
|
||||||
|
if (arme.system.lancer) { addAttaque(arme, '(lancer)') }
|
||||||
|
if (arme.system.tir) { addAttaque(arme, '(tir)') }
|
||||||
|
})
|
||||||
|
return actions
|
||||||
}
|
}
|
||||||
|
|
||||||
static $getCaracAction(comp, main) {
|
static $getCaracAction(comp, main) {
|
||||||
@@ -3249,3 +3248,4 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ export class RollPartAttaque extends RollPartSelect {
|
|||||||
prepareContext(rollData) {
|
prepareContext(rollData) {
|
||||||
const current = this.getCurrent(rollData)
|
const current = this.getCurrent(rollData)
|
||||||
const effetsSurprise = rollData.opponent?.actor?.getEffects(it => StatusEffects.niveauSurprise(it, true) > 0) ?? []
|
const effetsSurprise = rollData.opponent?.actor?.getEffects(it => StatusEffects.niveauSurprise(it, true) > 0) ?? []
|
||||||
current.defenseur = effetsSurprise
|
current.defenseur = effetsSurprise.length > 0
|
||||||
? {
|
? {
|
||||||
surprise: RdDBonus.find(rollData.opponent?.actor?.getSurprise(true)),
|
surprise: RdDBonus.find(rollData.opponent?.actor?.getSurprise(true)),
|
||||||
effects: effetsSurprise
|
effects: effetsSurprise
|
||||||
@@ -78,7 +78,7 @@ export class RollPartAttaque extends RollPartSelect {
|
|||||||
penetration: current.arme.penetration(),
|
penetration: current.arme.penetration(),
|
||||||
dmgTactique: current.tactique?.dmg ?? 0,
|
dmgTactique: current.tactique?.dmg ?? 0,
|
||||||
dmgParticuliere: 0, // TODO RdDBonus._dmgParticuliere(rollData),
|
dmgParticuliere: 0, // TODO RdDBonus._dmgParticuliere(rollData),
|
||||||
dmgSurprise: current.defenseur?.surprise.dmg,
|
dmgSurprise: current.defenseur?.surprise.dmg ?? 0,
|
||||||
mortalite: RdDBonus.mortalite(current.dmg?.mortalite, current.arme.system.mortalite, defender?.isEntite()),
|
mortalite: RdDBonus.mortalite(current.dmg?.mortalite, current.arme.system.mortalite, defender?.isEntite()),
|
||||||
dmgActor: RdDBonus.bonusDmg(actor, current.action.carac.key, dmgArme)
|
dmgActor: RdDBonus.bonusDmg(actor, current.action.carac.key, dmgArme)
|
||||||
}
|
}
|
||||||
|
@@ -2,13 +2,13 @@
|
|||||||
<span {{#if ajustements}}class="tooltip-overflow tooltip-dotted" {{/if}}>
|
<span {{#if ajustements}}class="tooltip-overflow tooltip-dotted" {{/if}}>
|
||||||
<span>
|
<span>
|
||||||
<span>{{rolled.caracValue}} à {{plusMoins rolled.finalLevel}}</span>
|
<span>{{rolled.caracValue}} à {{plusMoins rolled.finalLevel}}</span>
|
||||||
{{#if ajustements}}
|
{{log rolled}}
|
||||||
{{/if}}
|
{{#if (and rolled.factorHtml (gt rolled.factorHtml 1))}}
|
||||||
{{log this}}
|
|
||||||
{{#if rolled.factorHtml}}<span class="rdd-diviseur">×{{{rolled.factorHtml}}}</span>{{/if}}
|
|
||||||
<span>= {{rolled.score}}%</span>
|
|
||||||
{{#if rolled.factorHtml}}
|
|
||||||
<span class="rdd-diviseur">×{{{rolled.factorHtml}}}</span>
|
<span class="rdd-diviseur">×{{{rolled.factorHtml}}}</span>
|
||||||
|
<span>= {{rolled.score}}%</span>
|
||||||
|
<span class="rdd-diviseur">×{{{rolled.factorHtml}}}</span>
|
||||||
|
{{else}}
|
||||||
|
<span>= {{rolled.score}}%</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
<div class="tooltiptext ttt-ajustements">
|
<div class="tooltiptext ttt-ajustements">
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
{{log 'roll-part-attaque.current' current}}
|
{{!-- {{log 'roll-part-attaque.current' current}}
|
||||||
{{log 'roll-part-attaque.refs' refs}}
|
{{log 'roll-part-attaque.refs' refs}} --}}
|
||||||
<subline>
|
<subline>
|
||||||
<select name="select-attaque" {{#if rollData.mode.retry}}disabled{{/if}}>
|
<select name="select-attaque" {{#if rollData.mode.retry}}disabled{{/if}}>
|
||||||
{{selectOptions refs.attaques selected=current.key valueAttr="key" labelAttr="label"}}
|
{{selectOptions refs.attaques selected=current.key valueAttr="key" labelAttr="label"}}
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
<input name="{{code}}" type="checkbox" {{#if current.checked}}checked{{/if}}/>
|
<input name="{{code}}" type="checkbox" {{#if current.checked}}checked{{/if}}/>
|
||||||
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
||||||
<label for="{{code}}">{{current.label}} : {{plusMoins current.value}}</label>
|
<label for="{{code}}">{{either current.label refs.label}} : {{plusMoins current.value}}</label>
|
||||||
|
Reference in New Issue
Block a user