Initial import
This commit is contained in:
@ -126,13 +126,16 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getWeapons() {
|
||||
let comp = this.data.items.filter( item => item.type == 'weapon' );
|
||||
let comp = duplicate(this.data.items.filter( item => item.type == 'weapon' ) || []);
|
||||
return comp;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSpecs() {
|
||||
let comp = this.data.items.filter( item => item.type == 'specialisation');
|
||||
let comp = duplicate(this.data.items.filter( item => item.type == 'specialisation') || []);
|
||||
for (let c of comp) {
|
||||
c.data.dice = PegasusUtility.getDiceFromLevel(c.data.level);
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
@ -350,44 +353,89 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
syncRoll( rollData ) {
|
||||
let linkedRollId = WotGUtility.getDefenseState(this.id);
|
||||
let linkedRollId = PegasusUtility.getDefenseState(this.id);
|
||||
if ( linkedRollId) {
|
||||
rollData.linkedRollId = linkedRollId;
|
||||
}
|
||||
rollData.rollId = randomID(16);
|
||||
this.lastRollId = rollData.rollId;
|
||||
WotGUtility.saveRollData( rollData );
|
||||
PegasusUtility.saveRollData( rollData );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollSkill( skillId ) {
|
||||
let skill = this.data.items.find( item => item.type == 'skill' && item.id == skillId);
|
||||
if (skill) {
|
||||
getStat( statKey) {
|
||||
let stat = duplicate(this.data.data.statistics[statKey]);
|
||||
stat.dice = PegasusUtility.getDiceFromLevel(stat.value);
|
||||
return stat;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getOneSpec( specId) {
|
||||
let spec = this.data.items.find( item => item.type == 'specialisation' && item.id == specId);
|
||||
if (spec) {
|
||||
spec = duplicate(spec);
|
||||
spec.data.dice = PegasusUtility.getDiceFromLevel(spec.data.level);
|
||||
}
|
||||
return spec;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollStat(statKey) {
|
||||
let stat = this.getStat(statKey) ;
|
||||
if (stat) {
|
||||
let rollData = {
|
||||
mode: "skill",
|
||||
rollId:randomID(16),
|
||||
mode: "stat",
|
||||
alias: this.name,
|
||||
actorImg: this.img,
|
||||
actorId: this.id,
|
||||
img: skill.img,
|
||||
img: this.img,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
armorModifier: this.getArmorModifier(),
|
||||
title: `Skill ${skill.name} `,
|
||||
skill: duplicate(skill),
|
||||
skillAttr: this.getAttribute( skill.data.data.attribute ),
|
||||
optionsNegative: WotGUtility.getNegativeModifiers(),
|
||||
optionsPositive: WotGUtility.getPositiveModifiers(),
|
||||
negativeModifier: 0,
|
||||
positiveModifier: 0,
|
||||
specialtiesBonus: 0,
|
||||
title: `Stat ${stat.label} `,
|
||||
stat: stat,
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
||||
bonusDicesLevel: 0,
|
||||
hindranceDicesLevel: 0,
|
||||
otherDicesLevel: 0,
|
||||
}
|
||||
|
||||
this.syncRoll( rollData);
|
||||
|
||||
let rollDialog = await WotGRollDialog.create( this, rollData);
|
||||
let rollDialog = await PegasusRollDialog.create( this, rollData);
|
||||
console.log(rollDialog);
|
||||
rollDialog.render( true );
|
||||
} else {
|
||||
ui.notifications.warn("Skill not found !");
|
||||
ui.notifications.warn("Statistic not found !");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollSpec( specId ) {
|
||||
let spec = this.getOneSpec( specId)
|
||||
if (spec) {
|
||||
let rollData = {
|
||||
mode: "spec",
|
||||
alias: this.name,
|
||||
actorImg: this.img,
|
||||
actorId: this.id,
|
||||
img: spec.img,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
title: `Specialisation Roll : ${spec.name} `,
|
||||
spec : spec ,
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
||||
stat: this.getStat( spec.data.statistic ),
|
||||
bonusDicesLevel: 0,
|
||||
hindranceDicesLevel: 0,
|
||||
otherDicesLevel: 0,
|
||||
}
|
||||
|
||||
this.syncRoll( rollData);
|
||||
|
||||
let rollDialog = await PegasusRollDialog.create( this, rollData);
|
||||
console.log(rollDialog);
|
||||
rollDialog.render( true );
|
||||
} else {
|
||||
ui.notifications.warn("Specialisation not found !");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user