Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"Messages": {
"HandItemAdded": "Golpe desarmado adicionado as suas coisas.",
"Rolling": "Rolando {ability}",
"SelectWeaponLimitExceeded": "Você só pode usar 2 armas simultaneamente."
},
"Mutation": {
Expand Down Expand Up @@ -129,7 +130,8 @@
"SpecialActivities": "Atividades Especiais",
"Traits": "Traços",
"Type": "Tipo",
"Upgrades": "Aprimoramentos"
"Upgrades": "Aprimoramentos",
"Weight": "Carga"
},
"Statuses": {
"Blinded": { "long": "Cego", "abbr": "" },
Expand Down
4 changes: 3 additions & 1 deletion lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"Messages": {
"HandItemAdded": "Golpe desarmado adicionado as suas coisas.",
"Rolling": "Rolando {ability}",
"SelectWeaponLimitExceeded": "Você só pode usar 2 armas simultaneamente."
},
"Mutation": {
Expand Down Expand Up @@ -129,7 +130,8 @@
"SpecialActivities": "Atividades Especiais",
"Traits": "Traços",
"Type": "Tipo",
"Upgrades": "Aprimoramentos"
"Upgrades": "Aprimoramentos",
"Weight": "Carga"
},
"Statuses": {
"Blinded": { "long": "Cego", "abbr": "" },
Expand Down
1 change: 0 additions & 1 deletion module/data/actor-vehicle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default class Punkapocalypticvehicle extends PunkapocalypticActorBase {
//alert("fuel")
obj[ability].fields.fuelEfficiency = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 });
}
console.warn(obj);
return obj;
}, {}));

Expand Down
98 changes: 62 additions & 36 deletions module/documents/actor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,55 @@ export class PunkapocalypticActor extends Actor {
super.prepareData();
}

/**
* Prepare derived data for vehicles.
*/
async vehiclePrepareDerivedData() {
const actorData = this;
actorData.system.defense.current = actorData.system.defense.base + actorData.system.speed.current;
actorData.system.abilities.hands.value = 0;
if (actorData.system.speed.current > 0) {
actorData.system.abilities.muscles.value = 10 + actorData.system.speed.current;
actorData.system.abilities.feet.value = 10 + actorData.system.speed.current;
} else {
actorData.system.abilities.muscles.value = 0;
actorData.system.abilities.feet.value = 0;
}
const driver = actorData.system.occupants.find(i => i.driver);
if (driver) {
const actordriver = await fromUuid(driver.uuid);
if (actordriver) {
actorData.system.abilities.hands.value = actordriver.system.abilities.hands.value - 5;
}
}
}

/**
* Prepare derived data for characters.
*/
async characterPrepareDerivedData() {
const actorData = this;
// Calculate defense value
const defenseBase = actorData.system.defense.base;
const armorItems = actorData.items.filter(i => i.type === "armor" && i.system.equipped);

if (armorItems.length > 0) {
const armor = armorItems[0]; // Using first equipped armor
actorData.system.defense.current = armor.system.isBonus
? defenseBase + armor.system.defense
: armor.system.defense;
} else {
actorData.system.defense.current = defenseBase;
}
}

/**
* Prepare derived data for NPCs.
*/
async npcPrepareDerivedData() {
const actorData = this;
}

/**
* @override
* Augment the actor source data with additional dynamic data that isn't
Expand All @@ -21,42 +70,18 @@ export class PunkapocalypticActor extends Actor {
*/
async prepareDerivedData() {
const actorData = this;
//if (actorData.type === 'npc')

if (actorData.type === 'vehicle') {
actorData.system.defense.current = actorData.system.defense.base + actorData.system.speed.current;
actorData.system.abilities.hands.value = 0;
if (actorData.system.speed.current > 0) {
actorData.system.abilities.muscles.value = 10 + actorData.system.speed.current;
actorData.system.abilities.feet.value = 10 + actorData.system.speed.current;
} else {
actorData.system.abilities.muscles.value = 0;
actorData.system.abilities.feet.value = 0;
}
const driver = actorData.system.occupants.find(i => i.driver);
if (driver) {
const actordriver = await fromUuid(driver.uuid);
if (actordriver) {
console.warn("DRIVER",actordriver)
actorData.system.abilities.hands.value = actordriver.system.abilities.hands.value - 5;
}
}
console.warn("BVehicle driver hands: ", actorData.system.abilities.hands);
} else if (actorData.type === 'character') {

// Calculate defense value
const defenseBase = actorData.system.defense.base;
const armorItems = actorData.items.filter(i => i.type === "armor" && i.system.equipped);

if (armorItems.length > 0) {
const armor = armorItems[0]; // Using first equipped armor
actorData.system.defense.current = armor.system.isBonus
? defenseBase + armor.system.defense
: armor.system.defense;
} else {
actorData.system.defense.current = defenseBase;
}
switch (actorData.type) {
case 'vehicle':
this.vehiclePrepareDerivedData();
break;
case 'character':
this.characterPrepareDerivedData();
break;
case 'npc':
this.npcPrepareDerivedData();
break;
}

for (const key in actorData.system.abilities) {
// Calculate the modifier using d20 rules.
actorData.system.abilities[key].mod = Math.floor((actorData.system.abilities[key].value - 10));
Expand Down Expand Up @@ -108,9 +133,10 @@ export class PunkapocalypticActor extends Actor {

// Get localized ability name and prepare flavor text
const label = game.i18n.localize(CONFIG.PUNKAPOCALYPTIC.abilities[id]);
const roll_message = game.i18n.localize("PUNKAPOCALYPTIC.Messages.Rolling", { ability: label });
const flavor = content || `
<img src="${CONFIG.PUNKAPOCALYPTIC.abilityImages[id]}" alt="Icon" class="message-icon">
<p style="font-family: 'Poison Hope', sans-serif; text-shadow: 2px 2px 5px gray;">Rolando ${label}</p>`;
<p style="font-family: 'Poison Hope', sans-serif; text-shadow: 2px 2px 5px gray;">${roll_message}</p>`;

// Roll the base ability check
const baseRoll = await new Roll(`1d20+@abilities.${id}.mod`, actor.getRollData()).evaluate({ async: false });
Expand Down
1 change: 0 additions & 1 deletion module/helpers/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ PUNKAPOCALYPTIC.progress_function = (actor) => {
const next_level = actor.system.missions + 1;
const options = [];
actor.update({ "system.missions": (next_level) })
console.warn("progress for actor",actor);
}

PUNKAPOCALYPTIC.speedNeedle = {
Expand Down
12 changes: 5 additions & 7 deletions module/helpers/luck-tracker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export class TokenEffectsTracker extends Application {

async getData() {
let currentLuck = game.settings.get("punkapocalyptic", "groupLuck");

console.warn("Get DATA")
let data = {};
if (game.user.isGM) {
data.luck = {
Expand All @@ -52,26 +50,26 @@ export class TokenEffectsTracker extends Application {
}

_prepareHelpDice(actor) {
console.warn("Get DATA")


}

_prepareHeldAction(actor) {
console.warn("Get DATA")

}

async _prepareTemporaryEffects(actor) {
console.warn("Get DATA")

}



_mergeStackableConditions(effects) {
console.warn("Get DATA")

}

async _statusObjects(statuses, effectName) {
console.warn("Get DATA")

}

activateListeners(html) {
Expand Down
3 changes: 0 additions & 3 deletions module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ export class PunkapocalypticActorSheet extends ActorSheet {
});
// Handle clicking the profile div to open FilePicker
html.on('click', '.profile-img', (ev) => {
console.log()
const fp = new FilePicker({
type: 'image',
current: ev.currentTarget.dataset.img.replace(/^url\(["']?/, '').replace(/["']?\)$/, ''),
Expand Down Expand Up @@ -487,7 +486,6 @@ export class PunkapocalypticActorSheet extends ActorSheet {
}

async _onDropItemCreate(itemData, event) {
console.warn("Item data", itemData);
if (super._onDropItemCreate) {
await super._onDropItemCreate(itemData, event);
}
Expand Down Expand Up @@ -557,7 +555,6 @@ export class PunkapocalypticActorSheet extends ActorSheet {
// Check if there's something to update
if (Object.keys(updatedResources).length > 0) {
await this.actor.update(updatedResources);
console.log("Updated actor resources:", updatedResources);
} else {
console.log("No resources to update.");
}
Expand Down
8 changes: 0 additions & 8 deletions module/sheets/item-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ export class PunkapocalypticItemSheet extends ItemSheet {
const row = event.currentTarget.closest('li');
const uuid = row.dataset.itemUuid;
const itemIds = this.item.system.itemIds || [];
console.warn("UID", uuid);
console.warn(itemIds);
const index = itemIds.indexOf(uuid);
if (index > -1) {
itemIds.splice(index, 1);
Expand Down Expand Up @@ -245,8 +243,6 @@ export class PunkapocalypticItemSheet extends ItemSheet {
const pathDiceNum = rootPath + ".diceNum";
const pathDiceBonus = rootPath + ".diceBonus";
const pathDiceSize = rootPath + ".diceSize";
console.warn("editItem", dataset, rootPath, pathDiceNum, pathDiceBonus, pathDiceSize);
console.warn("item", utils.getValueByPath(item, rootPath));
if (item.type == "weapon") {
try {
data = await foundry.applications.api.DialogV2.prompt({
Expand Down Expand Up @@ -293,8 +289,6 @@ export class PunkapocalypticItemSheet extends ItemSheet {
console.error("Error parsing drop data:", err);
return;
}

console.log("Dropped data:", data);
if (!['background','path'].includes(this.item.type)) {
return;
}
Expand All @@ -316,8 +310,6 @@ export class PunkapocalypticItemSheet extends ItemSheet {
return;
}

console.log(`Dropped item "${droppedItem.name}" with ID: ${droppedItem.id}`);

// Get the current list of item IDs and update
let itemIds = foundry.utils.duplicate(this.item.system.itemIds || []);

Expand Down
1 change: 0 additions & 1 deletion module/sheets/npc-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ export class PunkapocalypticNPCSheet extends ActorSheet {
const dataset = element.dataset;

// Handle item rolls.
console.warn(dataset)
if (dataset.rollType) {
if (dataset.rollType == 'select-ammo') {
const itemId = element.closest('.item').dataset.itemId;
Expand Down
16 changes: 1 addition & 15 deletions module/sheets/vehicle-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
context.actor.system.abilities[ability].tooltip = game.i18n.localize(`PUNKAPOCALYPTIC.Ability.${ability.capitalize()}.Tooltip`);
context.actor.system.abilities[ability].img = CONFIG.PUNKAPOCALYPTIC.abilityImages[ability];
}
console.warn(context.actor.system.otherStatistics);

for (const statistic in context.actor.system.otherStatistics) {
context.actor.system.otherStatistics[statistic] = context.actor.system.otherStatistics[statistic];
context.actor.system.otherStatistics[statistic].tooltip = game.i18n.localize(`PUNKAPOCALYPTIC.Vehicle.${statistic.capitalize()}.Tooltip`);
Expand Down Expand Up @@ -288,7 +288,6 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
}

// Iterate through items, allocating to containers
console.warn(context.items)
for (let i of context.items) {
i.img = i.img || Item.DEFAULT_ICON;
// Append to gear.
Expand Down Expand Up @@ -493,14 +492,12 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
*/
async _onItemCreate(event) {
event.preventDefault();
console.warn("ADASDSD")
const header = event.currentTarget;
// Get the type of item to create.
let type = header.dataset.type;
if (type == 'item') {
type = await this.chooseOption();
}
console.warn(type)

// Grab any data associated with this control.
const data = foundry.utils.duplicate(header.dataset);
Expand All @@ -514,7 +511,6 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
};
// Remove the type from the dataset since it's in the itemData.type prop.
delete itemData.system['type'];
console.warn(itemData)
// Finally, create the item!
return await Item.create(itemData, { parent: this.actor });
}
Expand Down Expand Up @@ -599,9 +595,6 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
}
const occupant = this.actor.system.occupants.find(o => o.uuid == dataset.itemId);
if (occupant) {
console.warn(occupant);

console.warn("NEW DRIVER");
occupant.driver = !occupant.driver;
await this.actor.update({ "system.occupants": this.actor.system.occupants });
await this.actor.update({ "system.driver": occupant.driver });
Expand All @@ -625,7 +618,6 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
if (user) {

if (game.user.isGM) {
console.warn("GRANTING PERMISSION")
await this.actor.update({
[`ownership.${user.id}`]: permissionLevel
});
Expand Down Expand Up @@ -653,7 +645,6 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
}
if (user) {
if (game.user.isGM) {
console.warn("GRANTING PERMISSION")
await this.actor.update({
[`ownership.${user.id}`]: permissionLevel
});
Expand Down Expand Up @@ -681,12 +672,10 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
console.error("Error parsing drop data:", err);
return;
}
console.warn(data)
if (data.type === "Item") {
const item = await fromUuid(data.uuid);
this._onDropItemCreate(item, event);
} else {
console.warn(this.actor.system.otherStatistics.occupants)
if (this.actor.system.otherStatistics.occupants.current == this.actor.system.otherStatistics.occupants.value) {
ui.notifications.warn("Veículo cheio");
return;
Expand Down Expand Up @@ -730,12 +719,9 @@ export class PunkapocalypticVehicleSheet extends ActorSheet {
}
}
}

console.log("Dropped data:", data);
}

async _onDropItemCreate(itemData, event) {
console.warn(itemData);
if (!CONFIG.PUNKAPOCALYPTIC.VehicleSupportedItems.includes(itemData.type)) {
ui.notifications.warn("Tipo de item não suportado por veículos");
return;
Expand Down
2 changes: 1 addition & 1 deletion templates/actor/parts/actor-background.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
data-type='background'
>
<i class='fas fa-plus'></i>
{{localize 'PUNKAPOCALYPTIC.NewItemMasc' type=(localize 'TYPES.Item.background') }}
{{!-- {{localize 'PUNKAPOCALYPTIC.NewItemMasc' type=(localize 'TYPES.Item.background') }} --}}
</a>
</div>
</li>
Expand Down
2 changes: 1 addition & 1 deletion templates/actor/parts/actor-benefits.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
data-type='benefit'
>
<i class='fas fa-plus'></i>
{{localize 'PUNKAPOCALYPTIC.NewItemMasc' type=(localize 'TYPES.Item.benefit') }}
{{!-- {{localize 'PUNKAPOCALYPTIC.NewItemMasc' type=(localize 'TYPES.Item.benefit') }} --}}
</a>
</div>
</li>
Expand Down
Loading