Skip to content

Commit

Permalink
Merge pull request #135 from AnimaBeyondDevelop/feature/extra_damage
Browse files Browse the repository at this point in the history
Closes #134: Fixes bug where enormous and giant weapons increas the s…
  • Loading branch information
JordiAlonsoLlovet authored May 28, 2022
2 parents 39c551a + 5b6b3d3 commit e1d3ad6
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"anima.ui.combat.baseValues.attack.title": "Attack",
"anima.ui.combat.baseValues.block.title": "Block",
"anima.ui.combat.baseValues.dodge.title": "Dodge",
"anima.ui.combat.baseValues.extraDamage.title": "Extra damage",
"anima.ui.combat.baseValues.title": "Base Values",
"anima.ui.combat.baseValues.wearArmor.title": "Wear armor",
"anima.ui.combat.combatSpecialSkill.title": "Special Skills",
Expand Down
1 change: 1 addition & 0 deletions src/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"anima.ui.combat.baseValues.attack.title": "Ataque",
"anima.ui.combat.baseValues.block.title": "Parada",
"anima.ui.combat.baseValues.dodge.title": "Esquiva",
"anima.ui.combat.baseValues.extraDamage.title": "Daño extra",
"anima.ui.combat.baseValues.title": "Valores base",
"anima.ui.combat.baseValues.wearArmor.title": "Llevar armadura",
"anima.ui.combat.combatSpecialSkill.title": "Habilidades especiales",
Expand Down
1 change: 1 addition & 0 deletions src/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"anima.ui.combat.baseValues.attack.title": "Attaque",
"anima.ui.combat.baseValues.block.title": "Parade",
"anima.ui.combat.baseValues.dodge.title": "Esquive",
"anima.ui.combat.baseValues.extraDamage.title": "Dommages accrus",
"anima.ui.combat.baseValues.title": "Valeurs de Base",
"anima.ui.combat.baseValues.wearArmor.title": "Port d'Armure",
"anima.ui.combat.combatSpecialSkill.title": "Compétences Spécial Skills",
Expand Down
3 changes: 3 additions & 0 deletions src/module/actor/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export const INITIAL_ACTOR_DATA: ABFActorDataSourceData = {
naturalPenalty: {
byArmors: { value: 0 },
byWearArmorRequirement: { value: 0 }
},
extraDamage : {
value: 0
}
},
destinyPoints: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const addSizeModifier = (weapon: WeaponDataSource, damage: number) => {
export const calculateWeaponDamage = (weapon: WeaponDataSource, data: ABFActorDataSourceData) => {
const getDamage = () => {
const weaponStrengthModifier = calculateWeaponStrengthModifier(weapon, data);
const extraDamage = data.general.modifiers.extraDamage.value

if (weapon.data.isRanged.value && weapon.data.shotType.value === WeaponShotType.SHOT) {
const { ammo } = weapon.data;
Expand All @@ -34,15 +35,13 @@ export const calculateWeaponDamage = (weapon: WeaponDataSource, data: ABFActorDa

ammoDamage += ammo.data.quality.value * 2;

return ammoDamage + weaponStrengthModifier;
return ammoDamage + weaponStrengthModifier + extraDamage;
}

return 0;
}

const baseDamage = weapon.data.damage.base.value + weaponStrengthModifier;

return addSizeModifier(weapon, baseDamage) + weapon.data.quality.value * 2;
return addSizeModifier(weapon, weapon.data.damage.base.value) + weaponStrengthModifier + extraDamage + weapon.data.quality.value * 2;
};

return Math.max(getDamage(), 0);
Expand Down
3 changes: 3 additions & 0 deletions src/module/types/Actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export type ABFActorDataSourceData = {
value: number;
};
};
extraDamage: {
value: number;
}
};
destinyPoints: {
base: {
Expand Down
3 changes: 2 additions & 1 deletion src/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"modifiers": {
"physicalActions": { "value": 0 },
"allActions": { "base": { "value": 0 }, "final": { "value": 0 } },
"naturalPenalty": { "byArmors": { "value": 0 }, "byWearArmorRequirement": { "value": 0 } }
"naturalPenalty": { "byArmors": { "value": 0 }, "byWearArmorRequirement": { "value": 0 } },
"extraDamage": { "value": 0 }
},
"destinyPoints": { "base": { "value": 0 }, "final": { "value": 0 } },
"presence": { "value": 0 },
Expand Down
7 changes: 7 additions & 0 deletions src/templates/actor/parts/combat/parts/base-values.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,12 @@
inputName="data.combat.wearArmor.value"
inputValue=data.data.combat.wearArmor.value
}}
{{>
"systems/animabf/templates/common/ui/horizontal-titled-input.hbs"
class="wear-armor"
title=(localize "anima.ui.combat.baseValues.extraDamage.title")
inputName="data.general.modifiers.extraDamage.value"
inputValue=data.data.general.modifiers.extraDamage.value
}}
{{/"systems/animabf/templates/common/ui/group-body.hbs"}}
{{/"systems/animabf/templates/common/ui/group.hbs"}}

0 comments on commit e1d3ad6

Please sign in to comment.