Skip to content

Commit

Permalink
Character importer improvements, maiden charms
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliharu committed Mar 12, 2024
1 parent ce821f0 commit d7e340f
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 9 deletions.
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@
"Ex3.TurnOrderInitiative": "Turn Order Initiative",

"Ex3.SiderealMartialArt": "Sidereal Martial Art",
"Ex3.SiderealMartialArts": "Sidereal Martial Arts",
"Ex3.MartialArtsMastery": "Martial Arts Mastery",
"Ex3.Mastery": "Mastery",
"Ex3.SMAEnlightenment": "SMA Enlightenment",
Expand Down
39 changes: 33 additions & 6 deletions module/actor/actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ export class ExaltedThirdActorSheet extends ActorSheet {
attr.name = CONFIG.exaltedthird.attributes[key];
sheetData.system.charcreation.spent.attributes[attr.type] += (attr.value - 1);
attr.nextDotCost = 0;
if(attr.value < 5) {
if(game.settings.get("exaltedthird", "unifiedCharacterAdvancement")) {
if (attr.value < 5) {
if (game.settings.get("exaltedthird", "unifiedCharacterAdvancement")) {
attr.nextDotCost = attr.favored ? 8 : 10;
} else {
attr.nextDotCost = attr.value * (attr.favored ? 3 : 4);
if(sheetData.system.details.caste === 'casteless') {
if (sheetData.system.details.caste === 'casteless') {
attr.nextDotCost--;
}
}
Expand All @@ -274,11 +274,11 @@ export class ExaltedThirdActorSheet extends ActorSheet {
for (let [key, ability] of Object.entries(sheetData.system.abilities)) {
ability.name = CONFIG.exaltedthird.abilities[key];

if(ability.value < 5) {
if(game.settings.get("exaltedthird", "unifiedCharacterAdvancement")) {
if (ability.value < 5) {
if (game.settings.get("exaltedthird", "unifiedCharacterAdvancement")) {
ability.nextDotCost = ability.favored ? 4 : 5;
} else {
if(ability.value === 0) {
if (ability.value === 0) {
ability.nextDotCost = 3;
}
else {
Expand Down Expand Up @@ -352,6 +352,9 @@ export class ExaltedThirdActorSheet extends ActorSheet {
} else if (actorData.system.abilities[charm.system.ability] && actorData.system.abilities[charm.system.ability].favored) {
favoredCharms++;
}
else if(CONFIG.exaltedthird.maidens.includes(charm.system.ability) && charm.system.ability === actorData.system.details.caste) {
favoredCharms++;
}
else {
nonFavoredCharms++;
}
Expand Down Expand Up @@ -1008,6 +1011,9 @@ export class ExaltedThirdActorSheet extends ActorSheet {
if (this.actor.system.abilities[charm.system.ability]) {
return charm.system.requirement <= this.actor.system.abilities[charm.system.ability].value;
}
if (CONFIG.exaltedthird.maidens.includes(charm.system.ability)) {
return charm.system.requirement <= this._getHighestMaidenAbility(charm.system.ability);
}
return true;
});
archetypeCharms = archetypeCharms.filter(charm => charm.system.archetype.ability).filter(charm => {
Expand All @@ -1020,6 +1026,9 @@ export class ExaltedThirdActorSheet extends ActorSheet {
if (this.actor.system.abilities[charm.system.archetype.ability]) {
return charm.system.requirement <= this.actor.system.abilities[charm.system.archetype.ability].value;
}
if (CONFIG.exaltedthird.maidens.includes(charm.system.archetype.ability)) {
return charm.system.requirement <= this._getHighestMaidenAbility(charm.system.archetype.ability);
}
return true;
});
items = items.concat(nonAbilityCharms);
Expand Down Expand Up @@ -1050,6 +1059,9 @@ export class ExaltedThirdActorSheet extends ActorSheet {
if (itemType === 'charm') {
items = items.filter(charm => {
if (charm.system.numberprerequisites.number > 0) {
if (CONFIG.exaltedthird.maidens.includes(charm.system.ability)) {
return charm.system.numberprerequisites.number <= this._getMaidenCharmsNumber(charm.system.numberprerequisites.ability);
}
if (this.actor.items.filter(numberCharm => numberCharm.type === 'charm' && numberCharm.system.ability === charm.system.numberprerequisites.ability).length < charm.system.numberprerequisites.number) {
return false;
}
Expand Down Expand Up @@ -2245,6 +2257,21 @@ export class ExaltedThirdActorSheet extends ActorSheet {
this._assignToActorField(fields, newValue)
}

_getHighestMaidenAbility(maiden) {
const abilityList = CONFIG.exaltedthird.maidenabilities[maiden];
let highestValue = 0;
for (const ability of abilityList) {
if ((this.actor.system.abilities[ability]?.value || 0) > highestValue) {
highestValue = (this.actor.system.abilities[ability]?.value || 0);
}
}
return highestValue;
}

_getMaidenCharmsNumber(maiden) {
const abilityList = CONFIG.exaltedthird.maidenabilities[maiden];
return (this.actor.items.filter(numberCharm => numberCharm.type === 'charm' && abilityList.includes(numberCharm.system.ability)).length || 0)
}

_onDotCounterChange(event) {
event.preventDefault()
Expand Down
30 changes: 29 additions & 1 deletion module/apps/character-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ export default class CharacterBuilder extends FormApplication {
items = game.items.filter(charm => charm.type === 'charm');
}
if (type === 'martialArts') {
items = game.items.filter(item => item.type === 'customability' && item.system.abilitytype === 'martialart');
items = game.items.filter(item => item.type === 'customability' && item.system.abilitytype === 'martialart' && (!item.system.siderealmartialart || this.object.character.essence >= 3));
}
if (itemType === 'charm' || itemType === 'evocation' || itemType === 'martialArtCharm' || itemType === 'otherCharm') {
items = items.filter(charm => charm.system.essence <= this.object.character.essence || charm.system.ability === this.object.character.supernal);
Expand All @@ -976,6 +976,9 @@ export default class CharacterBuilder extends FormApplication {
if (this.object.character.abilities[charm.system.ability]) {
return charm.system.requirement <= this.object.character.abilities[charm.system.ability].value;
}
if (CONFIG.exaltedthird.maidens.includes(charm.system.ability)) {
return charm.system.requirement <= this._getHighestMaidenAbility(charm.system.ability);
}
return true;
});
archetypeCharms = archetypeCharms.filter(charm => charm.system.archetype.ability).filter(charm => {
Expand All @@ -988,6 +991,9 @@ export default class CharacterBuilder extends FormApplication {
if (this.object.character.abilities[charm.system.archetype.ability]) {
return charm.system.requirement <= this.object.character.abilities[charm.system.archetype.ability].value;
}
if (CONFIG.exaltedthird.maidens.includes(charm.system.archetype.ability)) {
return charm.system.requirement <= this._getHighestMaidenAbility(charm.system.archetype.ability);
}
return true;
});
}
Expand Down Expand Up @@ -1076,6 +1082,9 @@ export default class CharacterBuilder extends FormApplication {
if (itemType === 'charm') {
items = items.filter(charm => {
if (charm.system.numberprerequisites.number > 0) {
if (CONFIG.exaltedthird.maidens.includes(charm.system.ability)) {
return charm.system.numberprerequisites.number <= this._getMaidenCharmsNumber(charm.system.numberprerequisites.ability);
}
if ((Object.values(this.object.character.charms)?.filter(numberCharm => numberCharm.system.ability === charm.system.numberprerequisites.ability).length || 0) < charm.system.numberprerequisites.number) {
return false;
}
Expand All @@ -1096,6 +1105,22 @@ export default class CharacterBuilder extends FormApplication {
return items;
}

_getHighestMaidenAbility(maiden) {
const abilityList = CONFIG.exaltedthird.maidenabilities[maiden];
let highestValue = 0;
for (const ability of abilityList) {
if ((this.object.character.abilities[ability]?.value || 0) > highestValue) {
highestValue = (this.object.character.abilities[ability]?.value || 0);
}
}
return highestValue;
}

_getMaidenCharmsNumber(maiden) {
const abilityList = CONFIG.exaltedthird.maidenabilities[maiden];
return (Object.values(this.object.character.charms)?.filter(numberCharm => abilityList.includes(numberCharm.system.ability)).length || 0)
}

async _onDropItem(event) {
let data;

Expand Down Expand Up @@ -1520,6 +1545,9 @@ export default class CharacterBuilder extends FormApplication {
} else if (this.object.character.abilities[charm.system.ability] && this.object.character.abilities[charm.system.ability].favored) {
favoredCharms += charm.itemCount;
}
else if(CONFIG.exaltedthird.maidens.includes(charm.system.ability) && charm.system.ability === this.object.character.caste) {
favoredCharms += charm.itemCount
}
else {
nonFavoredCharms += charm.itemCount;
}
Expand Down
26 changes: 26 additions & 0 deletions module/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,24 @@ exaltedthird.casteabilitiesmap = {
],
};

exaltedthird.maidenabilities = {
'journeys': [
'resistance', 'ride', 'sail', 'survival', 'thrown', 'journeys'
],
'serenity': [
'craft', 'dodge', 'linguistics', 'performance', 'socialize', 'serenity'
],
'battles': [
'archery', 'brawl', 'melee', 'presence', 'war', 'battles'
],
'secrets': [
'investigation', 'larceny', 'lore', 'occult', 'stealth', 'secrets'
],
'endings': [
'athletics', 'awareness', 'bureaucracy', 'integrity', 'medicine', 'endings'
],
}

exaltedthird.statusEffects = [
{
icon: 'icons/svg/falling.svg',
Expand Down Expand Up @@ -1099,3 +1117,11 @@ exaltedthird.artifactArmorStats = {
penalty: 2,
},
};

exaltedthird.maidens = [
"journeys",
"serenity",
"battles",
"secrets",
"endings"
];
7 changes: 7 additions & 0 deletions module/exaltedthird.js
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,13 @@ Hooks.once("ready", async function () {
await game.settings.set("exaltedthird", "systemMigrationVersion", game.system.version);
}

// for(const item of game.items.filter(item => item.type === 'charm' && item.folder?.name && item.system.charmtype === 'martialarts')) {
// const martialArt = game.items.filter(ma => ma.type === 'customability' && ma.name === item.folder?.name)[0];
// if(martialArt) {
// item.update({[`system.parentitemid`]: martialArt.id});
// }
// }

// for(const item of game.items.filter(item => item.type === 'ritual' || (item.type === 'merit' && item.system.merittype === 'sorcery'))) {
// if(item.folder?.name && !item.system.archetypename) {
// await item.update({ [`system.archetypename`]: item.folder.name });
Expand Down
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Unofficial Exalted third edition system module for FoundryVTT! Portions of the materials are the copyrights and trademarks of Paradox Interactive AB, and are used with permission. All rights reserved. For more information please visit worldofdarkness.com.",
"url": "https://github.com/Aliharu/Foundry-Ex3",
"license": "LICENSE.txt",
"version": "2.7.1",
"version": "2.7.2",
"compatibility": {
"minimum": "11",
"verified": "11",
Expand Down Expand Up @@ -49,7 +49,7 @@
],
"relationships": [],
"manifest": "https://github.com/Aliharu/Foundry-Ex3/master/system.json",
"download": "https://github.com/Aliharu/Foundry-Ex3/releases/download/v2.7.1/release2.7.1.zip",
"download": "https://github.com/Aliharu/Foundry-Ex3/releases/download/v2.7.2/release2.7.2.zip",
"bugs": "https://github.com/Aliharu/Foundry-Ex3/issues",
"gridDistance": 5,
"gridUnits": "ft",
Expand Down
5 changes: 5 additions & 0 deletions templates/dialogues/import-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ <h4 class="item-name">{{item.name}}</h4>
class="fas fa-plus"></i></a>
</li>
<li class="item-description">
{{#if item.system.points}}
<div>
<b>{{localize "Ex3.Cost"}}</b>: {{item.system.points}}
</div>
{{/if}}
{{#if item.system.traits.weapontags.value}}
<div class="mt-1">
{{#each item.system.traits.weapontags.selected as |v k|}}
Expand Down

0 comments on commit d7e340f

Please sign in to comment.