Skip to content

Commit

Permalink
ship, format changes, prereque field on charms
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliharu committed Jun 12, 2022
1 parent 7c7f327 commit 08e1e97
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 35 deletions.
8 changes: 8 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@
"Ex3.Abyssal": "Abyssal",
"Ex3.Alchemical": "Alchemical",
"Ex3.Dragonblooded": "Dragonblooded",
"Ex3.DreamSouled": "Dream-Souled",
"Ex3.Exigent": "Exigent",
"Ex3.Getimian": "Getimian",
"Ex3.Hearteater": "Hearteater",
"Ex3.Infernal": "Infernal",
"Ex3.Liminal": "Liminal",
"Ex3.Lunar": "Lunar",
"Ex3.Sidereal": "Sidereal",
"Ex3.Solar": "Solar",
"Ex3.Umbral": "Umbral",
"Ex3.Other": "Other",

"Ex3.Attribute": "Attribute",
Expand Down Expand Up @@ -314,7 +317,12 @@
"Ex3.White": "White",

"Ex3.Keywords": "Keywords",
"Ex3.Prerequisites": "Prerequisites",
"Ex3.Warstrider": "Warstrider",
"Ex3.Ship": "Ship",
"Ex3.Hull": "Hull",
"Ex3.Cargo": "Cargo",
"Ex3.Maneuverability": "Maneuverability",

"Ex3.Speed": "Speed",

Expand Down
62 changes: 53 additions & 9 deletions module/actor/actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ export class ExaltedThirdActorSheet extends ActorSheet {
});

html.find('#calculate-warstrider-health').mousedown(ev => {
this.calculateHealth(true);
this.calculateHealth('warstrider');
});

html.find('#calculate-ship-health').mousedown(ev => {
this.calculateHealth('ship');
});

html.find('#color-picker').mousedown(ev => {
Expand All @@ -362,7 +366,11 @@ export class ExaltedThirdActorSheet extends ActorSheet {
});

html.find('#recoverySceneWarstrider').mousedown(ev => {
this.recoverHealth(true);
this.recoverHealth('warstrider');
});

html.find('#recoverySceneShip').mousedown(ev => {
this.recoverHealth('ship');
});

html.find('#rollDice').mousedown(ev => {
Expand Down Expand Up @@ -628,7 +636,7 @@ export class ExaltedThirdActorSheet extends ActorSheet {
this.actor.update(actorData);
}

async calculateHealth(warstrider=false) {
async calculateHealth(healthType='person') {
let confirmed = false;
const actorData = duplicate(this.actor);
const data = actorData.data;
Expand Down Expand Up @@ -673,10 +681,33 @@ export class ExaltedThirdActorSheet extends ActorSheet {


var template = "systems/exaltedthird/templates/dialogues/calculate-health.html";
if(data.battlegroup && !warstrider) {
if(data.battlegroup && healthType === 'person') {
template = "systems/exaltedthird/templates/dialogues/calculate-battlegroup-health.html";
}
const html = await renderTemplate(template, { 'oxBodyText': oxBodyText, 'zero': warstrider ? data.warstrider.health.levels.zero.value : data.health.levels.zero.value, 'one': warstrider ? data.warstrider.health.levels.one.value : data.health.levels.one.value, 'two': warstrider ? data.warstrider.health.levels.two.value : data.health.levels.two.value, 'four': warstrider ? data.warstrider.health.levels.four.value : data.health.levels.four.value});

var templateData = {
'oxBodyText': oxBodyText,
}
if(healthType === 'warstrider') {
templateData.zero = data.warstrider.health.levels.zero.value;
templateData.one = data.warstrider.health.levels.one.value;
templateData.two = data.warstrider.health.levels.two.value;
templateData.four = data.warstrider.health.levels.four.value;
}
else if(healthType === 'ship') {
templateData.zero = data.ship.health.levels.zero.value;
templateData.one = data.ship.health.levels.one.value;
templateData.two = data.ship.health.levels.two.value;
templateData.four = data.ship.health.levels.four.value;
}
else {
templateData.zero = data.health.levels.zero.value;
templateData.one = data.health.levels.one.value;
templateData.two = data.health.levels.two.value;
templateData.four = data.health.levels.four.value;
}

const html = await renderTemplate(template, templateData);

new Dialog({
title: `Calculate Health`,
Expand All @@ -691,7 +722,7 @@ export class ExaltedThirdActorSheet extends ActorSheet {
let one = parseInt(html.find('#one').val()) || 0;
let two = parseInt(html.find('#two').val()) || 0;
let four = parseInt(html.find('#four').val()) || 0;
if(warstrider) {
if(healthType === 'warstrider') {
data.warstrider.health.bashing = 0;
data.warstrider.health.lethal = 0;
data.warstrider.health.aggravated = 0;
Expand All @@ -700,6 +731,15 @@ export class ExaltedThirdActorSheet extends ActorSheet {
data.warstrider.health.levels.two.value = two;
data.warstrider.health.levels.four.value = four;
}
else if(healthType === 'ship') {
data.ship.health.bashing = 0;
data.ship.health.lethal = 0;
data.ship.health.aggravated = 0;
data.ship.health.levels.zero.value = zero;
data.ship.health.levels.one.value = one;
data.ship.health.levels.two.value = two;
data.ship.health.levels.four.value = four;
}
else {
data.health.bashing = 0;
data.health.lethal = 0;
Expand All @@ -715,20 +755,24 @@ export class ExaltedThirdActorSheet extends ActorSheet {
}).render(true);
}

async recoverHealth(warstrider=false) {
async recoverHealth(healthType = 'person') {
const actorData = duplicate(this.actor);
const data = actorData.data;
if(warstrider) {
if(healthType === 'warstrider') {
data.warstrider.health.bashing = 0;
data.warstrider.health.lethal = 0;
data.warstrider.health.aggravated = 0;
}
else if (healthType === 'ship') {
data.ship.health.bashing = 0;
data.ship.health.lethal = 0;
data.ship.health.aggravated = 0;
}
else {
data.health.bashing = 0;
data.health.lethal = 0;
data.health.aggravated = 0;
}

this.actor.update(actorData);
}

Expand Down
28 changes: 24 additions & 4 deletions module/actor/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ export class ExaltedThirdActor extends Actor {
let totalHealth = 0;
let currentPenalty = 0;
let totalWarstriderHealth = 0;
let totalShipHealth = 0;
let currentWarstriderPenalty = 0;
let currentShipPenalty = 0;

if (data.battlegroup) {
totalHealth = data.health.levels.zero.value + data.size.value;
data.health.total = totalHealth;
Expand All @@ -158,8 +161,8 @@ export class ExaltedThirdActor extends Actor {
if ((data.health.bashing + data.health.lethal + data.health.aggravated) > data.health.total) {
data.health.aggravated = data.health.total - data.health.lethal;
if (data.health.aggravated <= 0) {
data.health.aggravated = 0
data.health.lethal = data.health.total
data.health.aggravated = 0;
data.health.lethal = data.health.total;
}
}
data.health.penalty = currentPenalty;
Expand All @@ -176,12 +179,29 @@ export class ExaltedThirdActor extends Actor {
if ((data.warstrider.health.bashing + data.warstrider.health.lethal + data.warstrider.health.aggravated) > data.warstrider.health.total) {
data.warstrider.health.aggravated = data.warstrider.health.total - data.warstrider.health.lethal;
if (data.warstrider.health.aggravated <= 0) {
data.warstrider.health.aggravated = 0
data.warstrider.health.lethal = data.health.total
data.warstrider.health.aggravated = 0;
data.warstrider.health.lethal = data.health.total;
}
}
data.warstrider.health.penalty = currentWarstriderPenalty;


for (let [key, health_level] of Object.entries(data.ship.health.levels)) {
if ((data.ship.health.bashing + data.ship.health.lethal + data.ship.health.aggravated) > totalShipHealth) {
currentShipPenalty = health_level.penalty;
}
totalShipHealth += health_level.value;
}
data.ship.health.total = totalShipHealth;
if ((data.ship.health.bashing + data.ship.health.lethal + data.ship.health.aggravated) > data.ship.health.total) {
data.ship.health.aggravated = data.ship.health.total - data.ship.health.lethal;
if (data.ship.health.aggravated <= 0) {
data.ship.health.aggravated = 0;
data.ship.health.lethal = data.health.total;
}
}
data.ship.health.penalty = currentShipPenalty;

if (actorData.type !== "npc") {
data.experience.standard.spent = data.experience.standard.total - data.experience.standard.value;
data.experience.exalt.spent = data.experience.exalt.total - data.experience.exalt.value;
Expand Down
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/Aliharu/Foundry-Ex3",
"license": "LICENSE.txt",
"flags": {},
"version": "0.8.9",
"version": "0.8.10",
"minimumCoreVersion": "0.8.7",
"compatibleCoreVersion": "9",
"scripts": [],
Expand All @@ -29,7 +29,7 @@
"dependencies": [],
"socket": false,
"manifest": "https://github.com/Aliharu/Foundry-Ex3/master/system.json",
"download": "https://github.com/Aliharu/Foundry-Ex3/releases/download/v0.8.9/release0.8.9.zip",
"download": "https://github.com/Aliharu/Foundry-Ex3/releases/download/v0.8.10/release0.8.10.zip",
"protected": false,
"gridDistance": 5,
"gridUnits": "ft",
Expand Down
38 changes: 38 additions & 0 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,43 @@
"tell": "",
"aura": "none"
},
"ship": {
"name": "",
"health": {
"levels": {
"zero": {
"value": 0,
"penalty": 0
},
"one": {
"value": 1,
"penalty": 1
},
"two": {
"value": 1,
"penalty": 2
},
"four": {
"value": 1,
"penalty": 4
},
"inc": {
"value": 1,
"penalty": "inc"
}
},
"bashing": 0,
"lethal": 0,
"aggravated": 0
},
"speed": {
"value": 0
},
"maneuverability": {
"value": 0
},
"cargo": ""
},
"warstrider": {
"active": false,
"equipped": false,
Expand Down Expand Up @@ -533,6 +570,7 @@
"templates": [
"base"
],
"prerequisites": "",
"type": "supplemental",
"duration": "instant",
"keywords": "",
Expand Down
20 changes: 0 additions & 20 deletions templates/actor/active-effects.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
<div class="resource-label list-section-header d-flex flex-between">
<div>
{{localize "Ex3.SavedRolls"}}
</div>
</div>

<ol class="items-list">
{{#each data.data.savedRolls as |item id|}}
<li class="item flexrow" data-item-id="{{id}}">
<h4 class="item-name">{{item.name}}</h4>
<div class="resource-table-value resource-value-static">
{{item.rollType}}
</div>
<div class="item-controls">
<a class="item-control saved-roll" title="Roll"><i class="fas fa-dice"></i></a>
<a class="item-control delete-saved-roll" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
<div class="resource-label list-section-header d-flex flex-between">
<div>
{{localize "Ex3.ActiveEffects"}}
Expand Down
22 changes: 22 additions & 0 deletions templates/actor/actor-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ <h1 class="charname"> <select name="data.details.exalt" data-type="String">
<option value="abyssal">{{localize "Ex3.Abyssal"}}</option>
<option value="alchemical">{{localize "Ex3.Alchemical"}}</option>
<option value="dragonblooded">{{localize "Ex3.Dragonblooded"}}</option>
<option value="dreamsouled">{{localize "Ex3.DreamSouled"}}</option>
<option value="exigent">{{localize "Ex3.Exigent"}}</option>
<option value="getimian">{{localize "Ex3.Getimian"}}</option>
<option value="hearteater">{{localize "Ex3.Hearteater"}}</option>
<option value="infernal">{{localize "Ex3.Infernal"}}</option>
<option value="liminal">{{localize "Ex3.Liminal"}}</option>
<option value="lunar">{{localize "Ex3.Lunar"}}</option>
<option value="sidereal">{{localize "Ex3.Sidereal"}}</option>
<option value="solar">{{localize "Ex3.Solar"}}</option>
<option value="umbral">{{localize "Ex3.Umbral"}}</option>
<option value="other">{{localize "Ex3.Other"}}</option>
{{/select}}
</select></h1>
Expand Down Expand Up @@ -288,6 +291,25 @@ <h1 class="charname"><input name="data.details.caste" type="text" value="{{data.
</div>

<div class="tab effects" data-group="primary" data-tab="effects">
<div class="resource-label list-section-header d-flex flex-between">
<div>
{{localize "Ex3.SavedRolls"}}
</div>
</div>
<ol class="items-list">
{{#each data.data.savedRolls as |item id|}}
<li class="item flexrow" data-item-id="{{id}}">
<h4 class="item-name">{{item.name}}</h4>
<div class="resource-table-value resource-value-static">
{{item.rollType}}
</div>
<div class="item-controls">
<a class="item-control saved-roll" title="Roll"><i class="fas fa-dice"></i></a>
<a class="item-control delete-saved-roll" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
{{> systems/exaltedthird/templates/actor/active-effects.html}}
</div>

Expand Down
43 changes: 43 additions & 0 deletions templates/actor/equipment-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,47 @@ <h4 class="item-name">{{item.name}}</h4>
<input type="number" name="data.warstrider.speed.value" value="{{data.data.warstrider.speed.value}}" data-dtype="Number" />
</div>
</div>
</div>
<div>
<label class="resource-label">{{localize "Ex3.Ship"}}</label>
<div class="resource flex-group-center d-flex">
<div style="margin-right:20px;">
<div class="flexrow">
<label for="data.ship.health" class="resource-label"><i class="fas fa-calculator cursor-pointer"
id="calculate-ship-health" style="margin-right:3px;" title="Calculate Health"></i>{{localize
"Ex3.Hull"}}<i id="recoverySceneShip" title="Heal Damage" class="fas fa-plus-square cursor-pointer"
style="margin-left:3px;"></i></label>
</div>
<div class="resource-content flexrow flex-center flex-between">
<div class="resource-counter" data-states="/:bashing,x:lethal,*:aggravated"
data-max="{{data.data.ship.health.total}}" data-bashing="{{data.data.ship.health.bashing}}"
data-lethal="{{data.data.ship.health.lethal}}" data-aggravated="{{data.data.ship.health.aggravated}}"
data-name="data.ship.health">
{{#numLoop data.data.ship.health.total}}
<span class="resource-counter-step" data-index="{{this}}" data-state=""></span>
{{/numLoop}}
</div>
</div>
</div>
<div>
<div class="flex-center">
<div class="resource-label">{{localize "Ex3.WoundPenalty"}}</div>
<div>-{{data.data.ship.health.penalty}}</div>
</div>
</div>
</div>
<div class="grid grid-2col flex-group-center">
<div>
<label class="resource-label">{{localize "Ex3.Speed"}}</label>
<input type="number" name="data.ship.speed.value" value="{{data.data.ship.speed.value}}" data-dtype="Number" />
</div>
<div>
<label class="resource-label">{{localize "Ex3.Maneuverability"}}</label>
<input type="number" name="data.ship.maneuverability.value" value="{{data.data.ship.maneuverability.value}}" data-dtype="Number" />
</div>
</div>
<div>
<label class="resource-label">{{localize "Ex3.Cargo"}}</label>
<textarea type="text" name="data.ship.cargo" rows="2">{{data.data.ship.cargo}}</textarea>
</div>
</div>
Loading

0 comments on commit 08e1e97

Please sign in to comment.