Skip to content

Commit

Permalink
Merge pull request #110 from Detailing-the-Realm/develop
Browse files Browse the repository at this point in the history
10 Compatibility update
  • Loading branch information
mattraykowski authored Sep 20, 2022
2 parents 31dc0fc + b682785 commit 89502cd
Show file tree
Hide file tree
Showing 50 changed files with 1,205 additions and 1,339 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 14.17.3
670 changes: 335 additions & 335 deletions lang/it.json

Large diffs are not rendered by default.

91 changes: 45 additions & 46 deletions module/actor/actor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
* Extend the base Actor entity by definin`g` a custom roll data structure which is ideal for the Simple system.
* @extends {Actor}
*/
export class SvnSea2EActor extends Actor {
Expand All @@ -9,18 +9,17 @@ export class SvnSea2EActor extends Actor {
prepareData() {
super.prepareData();

const actorData = this.data;
const data = actorData.data;
const actorData = this.system;

// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
if (actorData.type === 'playercharacter')
this._preparePlayerCharacterData(data);
if (actorData.type === 'hero') this._prepareHeroData(data);
if (actorData.type === 'villain' || actorData.type === 'monster')
this._prepareVillainData(data);
if (actorData.type === 'brute') this._prepareBruteData(data);
if (actorData.type === 'ship') this._prepareShipData(data);
if (this.type === 'playercharacter')
this._preparePlayerCharacterData(actorData);
if (this.type === 'hero') this._prepareHeroData(actorData);
if (this.type === 'villain' || this.type === 'monster')
this._prepareVillainData(actorData);
if (this.type === 'brute') this._prepareBruteData(actorData);
if (this.type === 'ship') this._prepareShipData(actorData);
}

/**
Expand All @@ -38,56 +37,56 @@ export class SvnSea2EActor extends Actor {
/**
* Prepare Character type specific data
*/
_preparePlayerCharacterData(data) {
this._prepareWounds(data);
this._prepareTraits(data);
this._prepareSkills(data);
_preparePlayerCharacterData(actorData) {
this._prepareWounds(actorData);
this._prepareTraits(actorData);
this._prepareSkills(actorData);
}

/**
* Prepare Hero type specific data
*/
_prepareHeroData(data) {
this._prepareWounds(data);
this._prepareTraits(data);
this._prepareSkills(data);
_prepareHeroData(actorData) {
this._prepareWounds(actorData);
this._prepareTraits(actorData);
this._prepareSkills(actorData);
}

/**
* Prepare Villain type specific data
*/
_prepareVillainData(data) {
this._prepareTraits(data);
data.villainy =
parseInt(data.traits.strength.value) +
parseInt(data.traits.influence.value);
data.wounds.max = parseInt(data.traits.strength.value) * 5;
data.wounds.value = this._validateMinMaxData(
data.wounds.value,
data.wounds.min,
data.wounds.max,
_prepareVillainData(actorData) {
this._prepareTraits(actorData);
actorData.villainy =
parseInt(actorData.traits.strength.value) +
parseInt(actorData.traits.influence.value);
actorData.wounds.max = parseInt(actorData.traits.strength.value) * 5;
actorData.wounds.value = this._validateMinMaxData(
actorData.wounds.value,
actorData.wounds.min,
actorData.wounds.max,
);
}

/**
* Prepare Brute type specific data
*/
_prepareBruteData(data) {
data.traits.strength.value = this._validateMinMaxData(
data.traits.strength.value,
data.traits.strength.min,
data.traits.strength.max,
_prepareBruteData(actorData) {
actorData.traits.strength.value = this._validateMinMaxData(
actorData.traits.strength.value,
actorData.traits.strength.min,
actorData.traits.strength.max,
);
data.wounds.max = data.traits.strength.value;
if (parseInt(data.wounds.max) < parseInt(data.wounds.value)) {
data.wounds.value = data.wounds.max;
actorData.wounds.max = actorData.traits.strength.value;
if (parseInt(actorData.wounds.max) < parseInt(actorData.wounds.value)) {
actorData.wounds.value = actorData.wounds.max;
}
}

/**
* Prepare Ship type specific data
*/
_prepareShipData(data) {}
_prepareShipData(actorData) {}

/**
* Remove a member from the crew
Expand All @@ -109,29 +108,29 @@ export class SvnSea2EActor extends Actor {
/**
*
*/
_prepareTraits(data) {
for (const trait of Object.values(data.traits)) {
_prepareTraits(actorData) {
for (const trait of Object.values(actorData.traits)) {
trait.value = this._validateMinMaxData(trait.value, trait.min, trait.max);
}
}

/**
*
*/
_prepareSkills(data) {
for (const skill of Object.values(data.skills)) {
_prepareSkills(actorData) {
for (const skill of Object.values(actorData.skills)) {
skill.value = this._validateMinMaxData(skill.value, skill.min, skill.max);
}
}

/**
* Establish the wound values based on the min and max for the actor type
*/
_prepareWounds(data) {
data.wounds.value = this._validateMinMaxData(
data.wounds.value,
data.wounds.min,
data.wounds.max,
_prepareWounds(actorData) {
actorData.wounds.value = this._validateMinMaxData(
actorData.wounds.value,
actorData.wounds.min,
actorData.wounds.max,
);
}
}
Loading

0 comments on commit 89502cd

Please sign in to comment.