Push
This commit is contained in:
parent
c2c335181b
commit
3874495bcf
@ -44,7 +44,7 @@ export class PegasusActorSheet extends ActorSheet {
|
|||||||
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
||||||
optionsLevel: PegasusUtility.getOptionsLevel(),
|
optionsLevel: PegasusUtility.getOptionsLevel(),
|
||||||
weapons: this.actor.checkAndPrepareWeapons( duplicate(this.actor.getWeapons()) ),
|
weapons: this.actor.checkAndPrepareWeapons( duplicate(this.actor.getWeapons()) ),
|
||||||
armors: duplicate(this.actor.getArmors()),
|
armors: this.actor.checkAndPrepareArmors( duplicate(this.actor.getArmors())),
|
||||||
shields: duplicate(this.actor.getShields()),
|
shields: duplicate(this.actor.getShields()),
|
||||||
equipments: duplicate(this.actor.getEquipments()),
|
equipments: duplicate(this.actor.getEquipments()),
|
||||||
perks: duplicate(this.actor.getPerks()),
|
perks: duplicate(this.actor.getPerks()),
|
||||||
@ -150,12 +150,22 @@ export class PegasusActorSheet extends ActorSheet {
|
|||||||
const specId = li.data("item-id");
|
const specId = li.data("item-id");
|
||||||
this.actor.rollSpec(specId);
|
this.actor.rollSpec(specId);
|
||||||
});
|
});
|
||||||
|
html.find('.power-roll').click((event) => {
|
||||||
|
const li = $(event.currentTarget).parents(".item");
|
||||||
|
const powerId = li.data("item-id");
|
||||||
|
this.actor.rollPower(powerId);
|
||||||
|
});
|
||||||
html.find('.weapon-roll').click((event) => {
|
html.find('.weapon-roll').click((event) => {
|
||||||
const li = $(event.currentTarget).parents(".item");
|
const li = $(event.currentTarget).parents(".item");
|
||||||
const weaponId = li.data("item-id");
|
const weaponId = li.data("item-id");
|
||||||
this.actor.rollWeapon(weaponId);
|
this.actor.rollWeapon(weaponId);
|
||||||
});
|
});
|
||||||
|
html.find('.armor-roll').click((event) => {
|
||||||
|
const li = $(event.currentTarget).parents(".item");
|
||||||
|
const armorId = li.data("item-id");
|
||||||
|
this.actor.rollArmor(armorId);
|
||||||
|
});
|
||||||
|
|
||||||
html.find('.weapon-damage-roll').click((event) => {
|
html.find('.weapon-damage-roll').click((event) => {
|
||||||
const li = $(event.currentTarget).parents(".item");
|
const li = $(event.currentTarget).parents(".item");
|
||||||
const weaponId = li.data("item-id");
|
const weaponId = li.data("item-id");
|
||||||
|
@ -111,7 +111,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getArmors() {
|
getArmors() {
|
||||||
let comp = this.data.items.filter(item => item.type == 'armor');
|
let comp = duplicate(this.data.items.filter(item => item.type == 'armor') || []);
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -127,12 +127,22 @@ export class PegasusActor extends Actor {
|
|||||||
let role = this.data.items.filter(item => item.type == 'role');
|
let role = this.data.items.filter(item => item.type == 'role');
|
||||||
return role[0] ?? [];
|
return role[0] ?? [];
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
checkAndPrepareArmor(armor) {
|
||||||
|
armor.data.resistanceDice = PegasusUtility.getDiceFromLevel(armor.data.resistance);
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
checkAndPrepareArmors(armors) {
|
||||||
|
for (let item of armors) {
|
||||||
|
this.checkAndPrepareArmor(item);
|
||||||
|
}
|
||||||
|
return armors;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
checkAndPrepareWeapon(weapon) {
|
checkAndPrepareWeapon(weapon) {
|
||||||
weapon.data.damageDice = PegasusUtility.getDiceFromLevel(weapon.data.damage);
|
weapon.data.damageDice = PegasusUtility.getDiceFromLevel(weapon.data.damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
checkAndPrepareWeapons(weapons) {
|
checkAndPrepareWeapons(weapons) {
|
||||||
for (let item of weapons) {
|
for (let item of weapons) {
|
||||||
@ -436,37 +446,6 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async rollMR() {
|
|
||||||
let mr = duplicate(this.data.data.mr);
|
|
||||||
if (mr) {
|
|
||||||
mr.dice = PegasusUtility.getDiceFromLevel(mr.value);
|
|
||||||
let rollData = {
|
|
||||||
rollId: randomID(16),
|
|
||||||
mode: "MR",
|
|
||||||
alias: this.name,
|
|
||||||
actorImg: this.img,
|
|
||||||
actorId: this.id,
|
|
||||||
img: this.img,
|
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
|
||||||
title: `${mr.label} `,
|
|
||||||
stat: mr,
|
|
||||||
activePerks: duplicate(this.getActivePerks()),
|
|
||||||
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
|
||||||
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("MR not found !");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCommonRollData() {
|
getCommonRollData() {
|
||||||
let rollData = {
|
let rollData = {
|
||||||
@ -530,6 +509,7 @@ export class PegasusActor extends Actor {
|
|||||||
let stat = this.getStat(statKey);
|
let stat = this.getStat(statKey);
|
||||||
if (stat) {
|
if (stat) {
|
||||||
let rollData = this.getCommonRollData()
|
let rollData = this.getCommonRollData()
|
||||||
|
rollData.specList = this.getRelevantSpec(armor.data.statistic)
|
||||||
rollData.mode = "stat"
|
rollData.mode = "stat"
|
||||||
rollData.title = `Stat ${stat.label}`;
|
rollData.title = `Stat ${stat.label}`;
|
||||||
rollData.stat = stat;
|
rollData.stat = stat;
|
||||||
@ -556,6 +536,24 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollMR() {
|
||||||
|
let mr = duplicate(this.data.data.mr);
|
||||||
|
if (mr) {
|
||||||
|
mr.dice = PegasusUtility.getDiceFromLevel(mr.value);
|
||||||
|
|
||||||
|
let rollData = this.getCommonRollData()
|
||||||
|
rollData.mode = "MR"
|
||||||
|
rollData.stat = mr
|
||||||
|
rollData.activePerks = duplicate(this.getActivePerks()),
|
||||||
|
rollData.specList = this.getRelevantSpec(armor.data.statistic),
|
||||||
|
|
||||||
|
this.startRoll(rollData);
|
||||||
|
} else {
|
||||||
|
ui.notifications.warn("MR not found !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async deleteAllItemsByType(itemType) {
|
async deleteAllItemsByType(itemType) {
|
||||||
let items = this.data.items.filter(item => item.type == itemType);
|
let items = this.data.items.filter(item => item.type == itemType);
|
||||||
@ -738,7 +736,7 @@ export class PegasusActor extends Actor {
|
|||||||
ui.notifications.warn("Technique not found !");
|
ui.notifications.warn("Technique not found !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
updateWithTarget(rollData) {
|
updateWithTarget(rollData) {
|
||||||
let objectDefender
|
let objectDefender
|
||||||
@ -755,9 +753,35 @@ export class PegasusActor extends Actor {
|
|||||||
//console.log("ROLLDATA DEFENDER !!!", rollData);
|
//console.log("ROLLDATA DEFENDER !!!", rollData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollArmor(armorId) {
|
||||||
|
let armor = this.data.items.get(armorId)
|
||||||
|
|
||||||
|
if (armor) {
|
||||||
|
let rollData = this.getCommonRollData()
|
||||||
|
|
||||||
|
armor = duplicate(armor);
|
||||||
|
this.checkAndPrepareArmor(armor);
|
||||||
|
|
||||||
|
rollData.mode = "armor"
|
||||||
|
rollData.img = armor.img
|
||||||
|
rollData.armor = armor
|
||||||
|
rollData.title = `Armor : ${armor.name}`
|
||||||
|
rollData.stat = this.getStat(armor.data.statistic)
|
||||||
|
rollData.specList = this.getRelevantSpec(armor.data.statistic)
|
||||||
|
rollData.activePerks = duplicate(this.getActivePerks())
|
||||||
|
rollData.isResistance = true;
|
||||||
|
rollData.otherDicesLevel = armor.data.resistance
|
||||||
|
|
||||||
|
//this.updateWithTarget(rollData);
|
||||||
|
this.startRoll(rollData);
|
||||||
|
} else {
|
||||||
|
ui.notifications.warn("Armor not found !", weaponId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollWeapon(weaponId, damage=false) {
|
async rollWeapon(weaponId, damage = false) {
|
||||||
let weapon = this.data.items.get(weaponId)
|
let weapon = this.data.items.get(weaponId)
|
||||||
|
|
||||||
if (weapon) {
|
if (weapon) {
|
||||||
@ -773,7 +797,7 @@ export class PegasusActor extends Actor {
|
|||||||
rollData.stat = this.getStat(weapon.data.statistic)
|
rollData.stat = this.getStat(weapon.data.statistic)
|
||||||
rollData.specList = this.getRelevantSpec(weapon.data.statistic)
|
rollData.specList = this.getRelevantSpec(weapon.data.statistic)
|
||||||
rollData.activePerks = duplicate(this.getActivePerks())
|
rollData.activePerks = duplicate(this.getActivePerks())
|
||||||
if (damage) {
|
if (damage) {
|
||||||
rollData.isDamage = true;
|
rollData.isDamage = true;
|
||||||
rollData.otherDicesLevel = weapon.data.damage
|
rollData.otherDicesLevel = weapon.data.damage
|
||||||
}
|
}
|
||||||
@ -785,4 +809,25 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollPower(powerId) {
|
||||||
|
let power = this.data.items.get(powerId)
|
||||||
|
|
||||||
|
if (power) {
|
||||||
|
let rollData = this.getCommonRollData()
|
||||||
|
power = duplicate(power);
|
||||||
|
|
||||||
|
rollData.mode = "power"
|
||||||
|
rollData.img = power.img
|
||||||
|
rollData.power = power
|
||||||
|
rollData.title = `Power : ${power.name}`
|
||||||
|
rollData.stat = this.getStat(power.data.statistic)
|
||||||
|
rollData.specList = this.getRelevantSpec(power.data.statistic)
|
||||||
|
rollData.activePerks = duplicate(this.getActivePerks())
|
||||||
|
this.startRoll(rollData);
|
||||||
|
} else {
|
||||||
|
ui.notifications.warn("Power not found !", powerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ export class PegasusRollDialog extends Dialog {
|
|||||||
} else if (rollData.mode == "spec") {
|
} else if (rollData.mode == "spec") {
|
||||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-spec.html', rollData);
|
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-spec.html', rollData);
|
||||||
options.height = 360;
|
options.height = 360;
|
||||||
} else if (rollData.mode == "weapon") {
|
} else if (rollData.mode == "weapon" || rollData.mode == "armor" || rollData.mode == "power") {
|
||||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-weapon.html', rollData);
|
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-weapon.html', rollData);
|
||||||
options.height = 320;
|
options.height = 320;
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,6 +163,6 @@
|
|||||||
"templateVersion": 57,
|
"templateVersion": 57,
|
||||||
"title": "Pegasus RPG",
|
"title": "Pegasus RPG",
|
||||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"background" : "./images/ui/pegasus_welcome_page.webp"
|
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
||||||
|
@ -259,8 +259,6 @@
|
|||||||
<li class="item stat flexrow list-item" data-item-id="{{weapon._id}}">
|
<li class="item stat flexrow list-item" data-item-id="{{weapon._id}}">
|
||||||
<img class="sheet-competence-img" src="{{weapon.img}}" />
|
<img class="sheet-competence-img" src="{{weapon.img}}" />
|
||||||
<span class="generic-label"><a class="weapon-roll">{{weapon.name}}</a></span>
|
<span class="generic-label"><a class="weapon-roll">{{weapon.name}}</a></span>
|
||||||
<span class="generic-label">{{weapon.data.typeText}}</span>
|
|
||||||
<span class="generic-label">Speed {{weapon.data.speed}}</span>
|
|
||||||
<span class="generic-label"><a class="weapon-damage-roll">Damage {{weapon.data.damageDice}}</a></span>
|
<span class="generic-label"><a class="weapon-damage-roll">Damage {{weapon.data.damageDice}}</a></span>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-equip" title="Equip">{{#if weapon.data.equipped}}<i
|
<a class="item-control item-equip" title="Equip">{{#if weapon.data.equipped}}<i
|
||||||
@ -279,7 +277,8 @@
|
|||||||
{{#each armors as |armor key|}}
|
{{#each armors as |armor key|}}
|
||||||
<li class="item stat flexrow list-item" data-item-id="{{armor._id}}">
|
<li class="item stat flexrow list-item" data-item-id="{{armor._id}}">
|
||||||
<img class="sheet-competence-img" src="{{armor.img}}" />
|
<img class="sheet-competence-img" src="{{armor.img}}" />
|
||||||
<span class="stat-label outfit-label">{{armor.name}}</span>
|
<span class="stat-label outfit-label"><a class="armor-roll">{{armor.name}}</a></span>
|
||||||
|
<span class="stat-label outfit-label">Res. {{armor.data.resistanceDice}}</span>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-equip" title="Worn">{{#if armor.data.equipped}}<i
|
<a class="item-control item-equip" title="Worn">{{#if armor.data.equipped}}<i
|
||||||
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||||
|
@ -21,19 +21,30 @@
|
|||||||
{{#if weapon}}
|
{{#if weapon}}
|
||||||
<li>Weapon : {{weapon.name}}</li>
|
<li>Weapon : {{weapon.name}}</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if power}}
|
||||||
|
<li>Power : {{power.name}}</li>
|
||||||
|
{{/if}}
|
||||||
{{#if isDamage}}
|
{{#if isDamage}}
|
||||||
<li>Weapon Damage Dice : {{weapon.data.damageDice}}</li>
|
<li>Weapon Damage Dice : {{weapon.data.damageDice}}</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if isResistance}}
|
||||||
|
<li>Armor Resistance Dice : {{armor.data.resistanceDice}}</li>
|
||||||
|
{{/if}}
|
||||||
{{#if stat}}
|
{{#if stat}}
|
||||||
<li>Statistic : {{stat.label}}</li>
|
<li>Statistic : {{stat.label}}</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if spec}}
|
{{#if spec}}
|
||||||
<li>Specialisation : {{spec.name}}</li>
|
<li>Specialisation : {{spec.name}}</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if isDamage}}
|
|
||||||
<li><strong>Damages : {{finalScore}}</strong>
|
{{#if isResistance}}
|
||||||
|
<li><strong>Defense Result : {{finalScore}}</strong>
|
||||||
{{else}}
|
{{else}}
|
||||||
<li><strong>Final Result : {{finalScore}}</strong>
|
{{#if isDamage}}
|
||||||
|
<li><strong>Damages : {{finalScore}}</strong>
|
||||||
|
{{else}}
|
||||||
|
<li><strong>Final Result : {{finalScore}}</strong>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if linkedRollId}}
|
{{#if linkedRollId}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user