kristov condensed versions
This commit is contained in:
+25
-44
@@ -118,39 +118,11 @@ export class VermineActor extends Actor {
|
||||
}
|
||||
|
||||
_setCharacterSelfControl() {
|
||||
let self_control = 0;
|
||||
|
||||
for(let i in this.system.abilities){
|
||||
if (this.system.abilities[i].category == 'mental' || this.system.abilities[i].category == 'social'){
|
||||
self_control += this.system.abilities[i].value;
|
||||
}
|
||||
}
|
||||
/// gestion de l'age
|
||||
if (this.system.identity.ageType == 1){
|
||||
self_control--;
|
||||
}
|
||||
|
||||
this.system.attributes.self_control.max = self_control;
|
||||
this.system.attributes.self_control.max = 0 + Object.values(this.system.abilities).filter(i => i.category === "mental" || i.category === "social").map((i) => i.value).reduce((acc, curr) => acc + curr, 0) + this.modFromAgeSelfControl;
|
||||
}
|
||||
|
||||
_setCharacterEffort() {
|
||||
let effort = 0;
|
||||
|
||||
// calcul de l'effort
|
||||
for(let i in this.system.abilities){
|
||||
if (this.system.abilities[i].category == 'physical' || this.system.abilities[i].category == 'manual'){
|
||||
effort += this.system.abilities[i].value;
|
||||
}
|
||||
}
|
||||
|
||||
/// gestion de l'age
|
||||
if (this.system.identity.ageType == 1){
|
||||
effort--;
|
||||
} else if (this.system.identity.ageType == 3){
|
||||
effort -= 2;
|
||||
}
|
||||
|
||||
this.system.attributes.effort.max = effort;
|
||||
this.system.attributes.effort.max = 0 + Object.values(this.system.abilities).filter(i => i.category === "physical" || i.category === "manual").map((i) => i.value).reduce((acc, curr) => acc + curr, 0) + this.modFromAgeEffort;
|
||||
}
|
||||
|
||||
_setCharacterThresholds() {
|
||||
@@ -160,22 +132,11 @@ export class VermineActor extends Actor {
|
||||
this.system.majorWound.threshold = health + 3;
|
||||
this.system.deadlyWound.threshold = (health + 7 < 11) ? health + 7 : 10;
|
||||
|
||||
let lightWounds = 4;
|
||||
let heavyWounds = 3;
|
||||
let deadlyWounds = 2;
|
||||
|
||||
if (this.system.identity.ageType == 3){
|
||||
lightWounds--;
|
||||
heavyWounds--;
|
||||
deadlyWounds--;
|
||||
} else if (this.system.identity.ageType == 1){
|
||||
deadlyWounds--;
|
||||
this.system.minorWound.max = 4 + this.modFromAgeWounds.l;
|
||||
this.system.majorWound.max = 3 + this.modFromAgeWounds.h;
|
||||
this.system.deadlyWound.max = 2 + this.modFromAgeWounds.d;
|
||||
}
|
||||
|
||||
this.system.minorWound.max = lightWounds;
|
||||
this.system.majorWound.max = heavyWounds;
|
||||
this.system.deadlyWound.max = deadlyWounds;
|
||||
}
|
||||
|
||||
_setAgeType(){
|
||||
Object.keys(CONFIG.VERMINE.AgeTypes).forEach((type) => {
|
||||
@@ -185,4 +146,24 @@ export class VermineActor extends Actor {
|
||||
});
|
||||
}
|
||||
|
||||
get ageType() {
|
||||
return this.system.identity.ageType;
|
||||
}
|
||||
|
||||
get modFromAgeSelfControl() {
|
||||
return this.ageType == 1 ? -1 : 0;
|
||||
}
|
||||
|
||||
get modFromAgeEffort() {
|
||||
if (this.ageType == 1) return -1;
|
||||
if (this.ageType == 3) return -2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
get modFromAgeWounds() {
|
||||
if (this.ageType == 1) return {l : 0, h : 0, d: -1};
|
||||
if (this.ageType == 3) return {l : -1, h : -1, d: -1};
|
||||
return {l : 0, h : 0, d: 0};
|
||||
}
|
||||
|
||||
}
|
||||
+20
-149
@@ -121,74 +121,17 @@ export class VermineActorSheet extends ActorSheet {
|
||||
* @return {undefined}
|
||||
*/
|
||||
_prepareCharacterItems(context) {
|
||||
// Initialize containers.
|
||||
const gear = [];
|
||||
const traits = [];
|
||||
const defenses = [];
|
||||
const specialties = [];
|
||||
const abilities = [];
|
||||
const weapons = [];
|
||||
const evolutions = [];
|
||||
const traumas = [];
|
||||
const backgrounds = [];
|
||||
const rumors = [];
|
||||
|
||||
// Iterate through items, allocating to containers
|
||||
for (let i of context.items) {
|
||||
i.img = i.img || DEFAULT_TOKEN;
|
||||
// Append to gear.
|
||||
if (i.type === 'item') {
|
||||
gear.push(i);
|
||||
context.gear = this.actor.itemTypes['item'];
|
||||
context.weapons = this.actor.itemTypes['weapon'];
|
||||
context.defenses = this.actor.itemTypes['defense'];
|
||||
context.traits = this.actor.itemTypes['trait'];
|
||||
context.specialties = this.actor.itemTypes['specialty'];
|
||||
context.abilities = this.actor.itemTypes['ability'];
|
||||
context.evolutions = this.actor.itemTypes['evolution'];
|
||||
context.traumas = this.actor.itemTypes['trauma'];
|
||||
context.backgrounds = this.actor.itemTypes['background'];
|
||||
context.rumors = this.actor.itemTypes['rumor'];
|
||||
}
|
||||
else if (i.type === 'trait') {
|
||||
traits.push(i);
|
||||
}
|
||||
else if (i.type === 'defense') {
|
||||
defenses.push(i);
|
||||
}
|
||||
else if (i.type === 'weapon') {
|
||||
weapons.push(i);
|
||||
}
|
||||
else if (i.type === 'specialty') {
|
||||
specialties.push(i);
|
||||
}
|
||||
else if (i.type === 'ability') {
|
||||
abilities.push(i);
|
||||
}
|
||||
else if (i.type === 'evolution') {
|
||||
evolutions.push(i);
|
||||
}
|
||||
else if (i.type === 'trauma') {
|
||||
traumas.push(i);
|
||||
}
|
||||
else if (i.type === 'background') {
|
||||
backgrounds.push(i);
|
||||
}
|
||||
else if (i.type === 'rumor') {
|
||||
rumors.push(i);
|
||||
}
|
||||
/* // Append to cephalie.
|
||||
else if (i.type === 'spell') {
|
||||
if (i.system.spellLevel != undefined) {
|
||||
cephalie[i.system.spellLevel].push(i);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// Assign and return
|
||||
context.gear = gear;
|
||||
context.weapons = weapons;
|
||||
context.defenses = defenses;
|
||||
context.traits = traits;
|
||||
context.specialties = specialties;
|
||||
context.abilities = abilities;
|
||||
context.evolutions = evolutions;
|
||||
context.traumas = traumas;
|
||||
context.backgrounds = backgrounds;
|
||||
context.rumors = rumors;
|
||||
// console.log("context", context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Organize and classify Items for Npc sheets.
|
||||
@@ -198,27 +141,8 @@ export class VermineActorSheet extends ActorSheet {
|
||||
* @return {undefined}
|
||||
*/
|
||||
_prepareNpcItems(context) {
|
||||
// Initialize containers.
|
||||
const gear = [];
|
||||
const traits = [];
|
||||
|
||||
|
||||
// Iterate through items, allocating to containers
|
||||
for (let i of context.items) {
|
||||
i.img = i.img || DEFAULT_TOKEN;
|
||||
// Append to gear.
|
||||
if (i.type === 'item') {
|
||||
gear.push(i);
|
||||
}
|
||||
else if (i.type === 'trait') {
|
||||
traits.push(i);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Assign and return
|
||||
context.gear = gear;
|
||||
context.gear = this.actor.itemTypes['item'];
|
||||
context.traits = this.actor.itemTypes['trait'];
|
||||
|
||||
}
|
||||
|
||||
@@ -231,50 +155,15 @@ export class VermineActorSheet extends ActorSheet {
|
||||
* @return {undefined}
|
||||
*/
|
||||
_prepareGroupItems(context) {
|
||||
// Initialize containers.
|
||||
const gear = [];
|
||||
const defenses = [];
|
||||
const abilities = [];
|
||||
const totem_abilities = [];
|
||||
const weapons = [];
|
||||
const vehicles = [];
|
||||
context.gear = this.actor.itemTypes['item'];
|
||||
context.weapons = this.actor.itemTypes['weapon'];
|
||||
context.defenses = this.actor.itemTypes['defense'];
|
||||
context.vehicles = this.actor.itemTypes['vehicle'];
|
||||
|
||||
// Iterate through items, allocating to containers
|
||||
for (let i of context.items) {
|
||||
i.img = i.img || DEFAULT_TOKEN;
|
||||
// Append to gear.
|
||||
if (i.type === 'item') {
|
||||
gear.push(i);
|
||||
}
|
||||
else if (i.type === 'defense') {
|
||||
defenses.push(i);
|
||||
}
|
||||
else if (i.type === 'weapon') {
|
||||
weapons.push(i);
|
||||
}
|
||||
else if (i.type === 'ability') {
|
||||
if (i.system.type == 'totem'){
|
||||
totem_abilities.push(i);
|
||||
} else {
|
||||
abilities.push(i);
|
||||
}
|
||||
context.totem_abilities = this.actor.itemTypes['ability'].filter(i=>i.type !== 'totem');
|
||||
context.abilities = this.actor.itemTypes['ability'].filter(i=>i.type === 'totem');
|
||||
|
||||
}
|
||||
else if (i.type === 'vehicle') {
|
||||
vehicles.push(i);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Assign and return
|
||||
context.gear = gear;
|
||||
context.weapons = weapons;
|
||||
context.defenses = defenses;
|
||||
context.abilities = abilities;
|
||||
context.totem_abilities = totem_abilities;
|
||||
context.vehicles = vehicles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Organize and classify Items for Creature sheets.
|
||||
@@ -284,29 +173,11 @@ export class VermineActorSheet extends ActorSheet {
|
||||
* @return {undefined}
|
||||
*/
|
||||
_prepareCreatureItems(context) {
|
||||
// Initialize containers.
|
||||
const gear = [];
|
||||
const traits = [];
|
||||
|
||||
|
||||
// Iterate through items, allocating to containers
|
||||
for (let i of context.items) {
|
||||
i.img = i.img || DEFAULT_TOKEN;
|
||||
// Append to gear.
|
||||
if (i.type === 'item') {
|
||||
gear.push(i);
|
||||
}
|
||||
else if (i.type === 'trait') {
|
||||
traits.push(i);
|
||||
context.gear = this.actor.itemTypes['item'];
|
||||
context.traits = this.actor.itemTypes['trait'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Assign and return
|
||||
context.gear = gear;
|
||||
|
||||
}
|
||||
async _onItemCreate(event) {
|
||||
event.preventDefault();
|
||||
const header = event.currentTarget;
|
||||
|
||||
Reference in New Issue
Block a user