From 886f24e208e298bf0eae2ec188954d9528733878 Mon Sep 17 00:00:00 2001 From: Gerbek <69389388+Gerbek@users.noreply.github.com> Date: Mon, 10 Aug 2020 11:43:06 +0200 Subject: [PATCH 1/7] Update es.json I added some strings from the English version which had not yet been translated. --- lang/es.json | 127 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 4 deletions(-) diff --git a/lang/es.json b/lang/es.json index f98a9f61..b25ceb6d 100644 --- a/lang/es.json +++ b/lang/es.json @@ -18,14 +18,12 @@ "CHARAC.EDU": "EDU", "CHARAC.Education": "Educación", - - "CoC7.Name": "Nombre", "CoC7.Occupation": "Ocupación", "CoC7.Age": "Edad", "CoC7.Sex": "Género", "CoC7.Residence": "Residencia", -"CoC7.Birthplace": "Nacimiento", +"CoC7.Birthplace": "Lugar de Nacimiento", "CoC7.HitPoints": "Puntos de vida", "CoC7.HP": "PV", "CoC7.MagicPoints": "Puntos de magia", @@ -44,4 +42,125 @@ "CoC7.Background": "Trasfondo", "CoC7.Notes": "Notas" -} \ No newline at end of file +"CoC7.RegularSuccess": "Éxito normal", +"CoC7.HardSuccess": "Éxito difícil", +"CoC7.ExtremeSuccess": "Éxito extremo", +"CoC7.CriticalSuccess": "Éxito crítico", +"CoC7.Fumble": "Pifia", +"CoC7.Failure": "Fallo", +"CoC7.Malfunction": "{itemName} sufre una avería", + +"CoC7.Dice": "Dados", +"CoC7.DiceModifierBonus": "bonificación", +"CoC7.DiceModifierPenalty": "penalización", +"CoC7.BonusDice": "Dados de Bonificación", +"CoC7.UnitsDie" : "1 dado de unidades", +"CoC7.TensDie": "dado de decenas", +"CoC7.TensDice": "dados de decenas", +"CoC7.SuccessRequired": "se requiere un éxito {successRequired}.", +"CoC7.Roll": "Tirar dados", +"CoC7.Pushing": "Forzando : ", +"CoC7.PushSkill": "Forzar tirada", +"CoC7.PushedRoll": "(tirada forzada)", +"CoC7.SpendLuck": "Gasta {luckNeededValue} puntos de Suerte para superar la tirada", +"CoC7.LuckSpent": "{luckAmount} puntos de Suerte gastados para superar la tirada", +"CoC7.LuckError": "{actorName} no tiene suficiente Suerte para superar la tirada", + +"CoC7.BonusSelectionWindow": "Ventana de selección de bonificación", +"CoC7.RegularDifficulty": "normal", +"CoC7.HardDifficulty": "difícil", +"CoC7.ExtremeDifficulty": "extremo", +"CoC7.CriticalDifficulty": "crítico", +"CoC7.RollDifficulty": "Dificultad de la Tirada", +"CoC7.RollDifficultyRegular": "Normal", +"CoC7.RollDifficultyHard": "Difícil", +"CoC7.RollDifficultyExtreme": "Extremo", +"CoC7.RollDifficultyCritical": "Crítico", +"CoC7.RollResult.LuckSpendText": "{luckAmount} puntos de Suerte gastados, {successLevel} superado", +"CoC7.RollDice": "Tirar dados !", + +"CoC7.CheckResult": "tirada de {name} {value}%) - dificultad {difficulty}", +"CoC7.ItemCheckResult": "{item} - tirada de {skill} ({value}%) - dificultad {difficulty}", +"CoC7.CheckRawValue": "({rawvalue}%) - dificultad {difficulty}", + +"CoC7.BonusDamageRoll": "Tirada de Bonificación de Daño", +"CoC7.Type": "Tipo", +"CoC7.FightBack": "Contraatacar", +"CoC7.Dodge": "Esquivar", +"CoC7.Maneuver": "Maniobra", +"CoC7.OutNumbered": "Superado", +"CoC7.combatCard.surpised": "Sorprendido", +"CoC7.combatCard.autoSuccess": "Éxito Automático", +"CoC7.Advantage": "Ventaja", +"CoC7.Disadvantage": "Desventaja", + +"CoC7.combatCard.dive4cover": "Ponerse a Cubierto", + +"CoC7.DropZone": "DropZone", + +"CoC7.SkillValue": "Valor", +"CoC7.SkillBase": "Base", + +"CoC7.ItemQuantity": "Cantidad", +"CoC7.ItemWeight": "Peso", +"CoC7.ItemDetails": "Detalles", +"CoC7.ItemDescription": "Descripción", +"CoC7.WeaponRange": "Alcance :", +"CoC7.WeaponDamage": "Daño :", +"CoC7.WeaponRadius": "Radio", +"CoC7.WeaponMalfunction": "Avería :", +"CoC7.WeaponUsesPerRound": "Usos/Turno :", +"CoC7.WeaponMax": "Máx :", +"CoC7.WeaponBulletsInMag": "Cargador :", +"CoC7.WeaponSpecial": "Especial :", +"CoC7.ItemPrice": "Precio :", +"CoC7.Armor": "Armadura", + +"CoC7.EraNvct": "Invictus", +"CoC7.EraDrka": "Edad Oscura", +"CoC7.EraDdts": "El Viejo Oeste", +"CoC7.EraGlit": "Luz de Gas", +"CoC7.Era1920": "Años 20", +"CoC7.EraPulp": "Pulp Cthulhu", +"CoC7.EraMdrn": "Época Actual", + +"CoC7.SkillNoXpGain": "Sin ganancia de EXP", +"CoC7.SkillSpecial": "Especialización", +"CoC7.SkillRarity": "Infrecuente", +"CoC7.SkillPush": "Forzada", +"CoC7.SkillCombat": "Combate", +"CoC7.SkillFighting": "Combatir", +"CoC7.SkillFirearm": "Armas de fuego", + +"CoC7.WeaponRngd": "Alcance", +"CoC7.WeaponTouch": "Toque", +"CoC7.WeaponImpl": "Empalar", +"CoC7.WeaponRare": "Rara", +"CoC7.WeaponAhdb": "+½ BD", +"CoC7.WeaponAddb": "+BD", +"CoC7.WeaponSlnt": "Silenciosa", +"CoC7.WeaponXplv": "Área de Efecto", +"CoC7.WeaponBrst": "Ráfaga", +"CoC7.WeaponAuto": "Fuego automático", +"CoC7.WeaponSpcl": "Especial", +"CoC7.WeaponMont": "Montada", +"CoC7.WeaponDbrl": "Dos cañones", +"CoC7.WeaponBlst": "Explosiva", +"CoC7.WeaponStun": "Aturdimiento", + +"CoC7.ErrorItem": "No se pudo localizar el ítem", +"CoC7.ErrorActor": "No se pudo localizar al actor", +"CoC7.ErrorInvalidFormula": "{value} no es una fórmula válida", +"CoC7.ErrorInvalid": "inválido", + +"CoC7.newBioSectionName": "Nueva Sección", + +"CoC7.dodgeSkillName": "Esquivar", +"CoC7.creditRatingSkillName": "Crédito", +"CoC7.fightingSpecializationName": "Combatir", +"CoC7.firearmSpecializationName": "Armas de fuego", + +"CoC7.newSkillName": "nueva habilidad", +"CoC7.newItemName": "nuevo ítem", +"CoC7.newWeaponName": "nueva arma" +} From 84d894b2170f1486adb348900d290657bddbfa20 Mon Sep 17 00:00:00 2001 From: Gerbek <69389388+Gerbek@users.noreply.github.com> Date: Tue, 11 Aug 2020 13:47:45 +0200 Subject: [PATCH 2/7] Update es.json Added a missing comma after line 43 --- lang/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/es.json b/lang/es.json index b25ceb6d..0700fc4a 100644 --- a/lang/es.json +++ b/lang/es.json @@ -40,7 +40,7 @@ "CoC7.Combat": "Combate", "CoC7.Possessions": "Posesiones", "CoC7.Background": "Trasfondo", -"CoC7.Notes": "Notas" +"CoC7.Notes": "Notas", "CoC7.RegularSuccess": "Éxito normal", "CoC7.HardSuccess": "Éxito difícil", From d4b234a29194077d35e27de4492d7c111e1170d9 Mon Sep 17 00:00:00 2001 From: HavelockV Date: Thu, 13 Aug 2020 12:26:52 +0200 Subject: [PATCH 3/7] fixing luck and san check --- module/check.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/check.js b/module/check.js index 90e2b1eb..61a67daa 100644 --- a/module/check.js +++ b/module/check.js @@ -321,7 +321,7 @@ export class CoC7Check { this.increaseSuccess = []; // Can't spend luck on pushed rolls. - if( !this.pushing){ + if( !this.pushing && 'lck' != this.attribute && 'san' != this.attribute){ if(this.difficulty <= CoC7Check.difficultyLevel.regular && this.dice.total > this.hardThreshold){ let nextLevel = {}; From 184d1e1c5271faa7f567ffb18fa3352f81574820 Mon Sep 17 00:00:00 2001 From: HavelockV Date: Thu, 13 Aug 2020 22:11:25 +0200 Subject: [PATCH 4/7] Addition of shotguns --- lang/en.json | 6 ++- module/actors/actor.js | 25 +++++++---- module/actors/sheets/base.js | 10 +++-- module/chat/rangecombat.js | 52 +++++++++++++++------- module/config.js | 12 ++--- module/items/item.js | 43 ++++++++++++++++++ module/items/sheets/weapon-sheet.js | 24 ++++++++-- styles/coc7.css | 1 + templates/actors/parts/actor-weapons.html | 8 ++-- templates/actors/parts/npc-combat.html | 4 +- templates/chat/combat/range-initiator.html | 48 +++++++++++++------- templates/items/weapon-sheet.html | 27 ++++++----- 12 files changed, 184 insertions(+), 76 deletions(-) diff --git a/lang/en.json b/lang/en.json index dbfe56ed..ec3a8f78 100644 --- a/lang/en.json +++ b/lang/en.json @@ -103,6 +103,7 @@ "CoC7.rangeCombatCard.BaseRange" : "Base range", "CoC7.rangeCombatCard.LongRange" : "Long range", "CoC7.rangeCombatCard.ExtremeRange" : "Xtrm range", +"CoC7.rangeCombatCard.OutOfRange": "Out of range", "CoC7.rangeCombatCard.Cover" : "Under cover", "CoC7.rangeCombatCard.PointBlankRange" : "Point blank range", "CoC7.rangeCombatCard.BigTarget": "Big target", @@ -156,7 +157,7 @@ "CoC7.WeaponAhdb": "+Half DB", "CoC7.WeaponAddb": "+DB", "CoC7.WeaponSlnt": "Silent", -"CoC7.WeaponXplv": "Shotgun", +"CoC7.WeaponXplv": "Explosives", "CoC7.WeaponBrst": "Burst", "CoC7.WeaponAuto": "Full-auto", "CoC7.WeaponSpcl": "Special", @@ -164,7 +165,10 @@ "CoC7.WeaponDbrl": "Dual barrel", "CoC7.WeaponBlst": "Blast", "CoC7.WeaponStun": "Stun", +"CoC7.Weapon.Property.Melee": "Melee", +"CoC7.Weapon.Property.Thrown": "Thrown", "CoC7.Weapon.Property.Burn": "Burn", +"CoC7.Weapon.Property.Shotgun": "Shotgun", "CoC7.ErrorItem": "Couldn't locate item", "CoC7.ErrorActor": "Couldn't locate actor", diff --git a/module/actors/actor.js b/module/actors/actor.js index a3d9200b..1dec34e3 100644 --- a/module/actors/actor.js +++ b/module/actors/actor.js @@ -50,13 +50,6 @@ export class CoCActor extends Actor { { return super.create(data, options); } - // data.data= { 'biography' : { - // 'ideology': { - // 'value': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - // } - // }}; - - return super.create(data, options); } @@ -538,12 +531,28 @@ export class CoCActor extends Actor { } return this.id; } - get actorKey(){ return this.tokenKey; } + static getActorFromKey(key) { + + // Case 1 - a synthetic actor from a Token + if (key.includes('.')) { + const [sceneId, tokenId] = key.split('.'); + const scene = game.scenes.get(sceneId); + if (!scene) return null; + const tokenData = scene.getEmbeddedEntity('Token', tokenId); + if (!tokenData) return null; + const token = new Token(tokenData); + return token.actor; + } + + // Case 2 - use Actor ID directory + return game.actors.get(key) || null; + } + /** * Use the formula if available to roll some characteritics. */ diff --git a/module/actors/sheets/base.js b/module/actors/sheets/base.js index 2a95a0d0..645792b5 100644 --- a/module/actors/sheets/base.js +++ b/module/actors/sheets/base.js @@ -142,13 +142,15 @@ export class CoC7ActorSheet extends ActorSheet { } weapon.data._properties = []; - for( let [key, value] of Object.entries(weapon.data.properties)){ + for( let [key, value] of Object.entries(COC7['weaponProperties'])) + { let property = {}; property.id = key; - property.value = value; - property.name = COC7.weaponProperties[key]; - weapon.data._properties.push( property); + property.name = value; + property.value = true == weapon.data.properties[key]; + weapon.data._properties.push(property); } + data.weapons[weapon._id] = weapon; if( weapon.data.properties.rngd) data.rangeWpn.push( weapon); else data.meleeWpn.push(weapon); diff --git a/module/chat/rangecombat.js b/module/chat/rangecombat.js index 8aab8456..5a1fd8d4 100644 --- a/module/chat/rangecombat.js +++ b/module/chat/rangecombat.js @@ -64,12 +64,19 @@ export class CoC7RangeInitiator{ t.baseRange = false; t.longRange = false; t.extremeRange = false; - t.impossible = false; - if( distInYd <= this.weapon.baseRange) t.baseRange = true; - if( distInYd > this.weapon.baseRange && distInYd <= (this.weapon.baseRange*2)) t.longRange = true; - if( distInYd > (this.weapon.baseRange*2) && distInYd <= (this.weapon.baseRange*4)) t.extremeRange = true; - if( distInYd > (this.weapon.baseRange*4)) t.impossible = true; - if( !(t.baseRange || t.longRange || t.extremeRange || t.impossible)) t.baseRange = true; + t.outOfRange = false; + if( this.weapon.data.data.properties.shotgun){ + if( distInYd <= this.weapon.baseRange ) t.baseRange = true; + if( distInYd > this.weapon.baseRange && distInYd <= this.weapon.longRange) t.longRange = true; + if( distInYd > this.weapon.longRange && distInYd <= this.weapon.extremeRange) t.extremeRange = true; + if( distInYd > this.weapon.extremeRange ) t.outOfRange = true; + } else { + if( distInYd <= this.weapon.baseRange) t.baseRange = true; + if( distInYd > this.weapon.baseRange && distInYd <= (this.weapon.baseRange*2)) t.longRange = true; + if( distInYd > (this.weapon.baseRange*2) && distInYd <= (this.weapon.baseRange*4)) t.extremeRange = true; + if( distInYd > (this.weapon.baseRange*4)) t.outOfRange = true; + } + if( !(t.baseRange || t.longRange || t.extremeRange || t.outOfRange)) t.baseRange = true; } } } @@ -182,6 +189,11 @@ export class CoC7RangeInitiator{ shotDifficulty( t = null){ const target = t? t: this.activeTarget; + let damage = this.weapon.data.data.range.normal.damage; + if( this.weapon.data.data.properties.shotgun){ + if( t.longRange) damage = this.weapon.data.data.range.long.damage; + if( t.extremeRange) damage = this.weapon.data.data.range.extreme.damage; + } let modifier = target.modifier; let difficulty = target.difficulty; let difficultyName = ''; @@ -208,6 +220,7 @@ export class CoC7RangeInitiator{ level: difficulty, name: difficultyName, modifier: modifier, + damage: damage, impossible: difficulty === CoC7Check.difficultyLevel.impossible }; @@ -227,6 +240,7 @@ export class CoC7RangeInitiator{ actorName: this.activeTarget.name, difficultyLevel: this.activeTarget.shotDifficulty.level, modifier: this.activeTarget.shotDifficulty.modifier, + damage: this.activeTarget.shotDifficulty.damage, bulletsShot: 1, transitBullets: 0, transit: false @@ -334,6 +348,7 @@ export class CoC7RangeInitiator{ actorName: this.activeTarget.name, difficultyLevel: this.activeTarget.shotDifficulty.level, modifier: this.activeTarget.shotDifficulty.modifier, + damage: this.activeTarget.shotDifficulty.damage, bulletsShot: 1, transitBullets: 0, transit: false @@ -476,11 +491,6 @@ export class CoC7RangeInitiator{ rollDamage(){ this.damage = []; - const normalDamageRoll = this.weapon.data.data.range.normal.damage; - const normalDamageDie = CoC7Damage.getMainDie( normalDamageRoll); - const maxDamage = Roll.maximize( normalDamageRoll).total; - const criticalDamageRoll = this.weapon.impale ? `${normalDamageRoll} + ${maxDamage}` : `${maxDamage}`; - const criticalDamageDie = CoC7Damage.getMainDie( criticalDamageRoll); const hits=this.successfulHits; let volleySize = 1; @@ -491,6 +501,13 @@ export class CoC7RangeInitiator{ if( this.burst) volleySize = parseInt(this.weapon.data.data.usesPerRound.burst); hits.forEach( h => { const damageRolls = []; + + const damageFormula = h.shot.damage; + const damageDie = CoC7Damage.getMainDie( damageFormula); + const maxDamage = Roll.maximize( damageFormula).total; + const criticalDamageFormula = this.weapon.impale ? `${damageFormula} + ${maxDamage}` : `${maxDamage}`; + const criticalDamageDie = CoC7Damage.getMainDie( criticalDamageFormula); + let impalingShots = 0; let successfulShots = 0; if( this.fullAuto || this.burst) successfulShots = Math.floor(volleySize/2); @@ -506,21 +523,21 @@ export class CoC7RangeInitiator{ let total = 0; for (let index = 0; index < successfulShots; index++) { - const roll = new Roll(normalDamageRoll); + const roll = new Roll(damageFormula); roll.roll(); damageRolls.push( { - formula: normalDamageRoll, + formula: damageFormula, total: roll.total, - die: normalDamageDie, + die: damageDie, critical: false }); total += roll.total; } for (let index = 0; index < impalingShots; index++) { - const roll = new Roll(criticalDamageRoll); + const roll = new Roll(criticalDamageFormula); roll.roll(); damageRolls.push( { - formula: criticalDamageRoll, + formula: criticalDamageFormula, total: roll.total, die: criticalDamageDie, critical: true @@ -646,7 +663,7 @@ export class CoC7RangeTarget{ if( this.baseRange) return CoC7Check.difficultyLevel.regular; if( this.longRange) return CoC7Check.difficultyLevel.hard; if( this.extremeRange) return CoC7Check.difficultyLevel.extreme; - return null; + return CoC7Check.difficultyLevel.impossible; } get modifier(){ @@ -688,6 +705,7 @@ export class CoC7RangeTarget{ this.baseRange = false; this.longRange = false; this.extremeRange = false; + this.outOfRange = false; this[flag] = true; } else if('size' === flag) { if( this.small) {this.small = false; this.big=true;} diff --git a/module/config.js b/module/config.js index 3c25687e..61ecd2de 100644 --- a/module/config.js +++ b/module/config.js @@ -43,20 +43,22 @@ COC7.skillProperties = { }; COC7.weaponProperties = { + melee: 'CoC7.Weapon.Property.Melee', rngd: 'CoC7.WeaponRngd', + thrown: 'CoC7.Weapon.Property.Thrown', + shotgun: 'CoC7.Weapon.Property.Shotgun', + dbrl: 'CoC7.WeaponDbrl', impl: 'CoC7.WeaponImpl', - rare: 'CoC7.WeaponRare', + brst: 'CoC7.WeaponBrst', + auto: 'CoC7.WeaponAuto', ahdb: 'CoC7.WeaponAhdb', addb: 'CoC7.WeaponAddb', slnt: 'CoC7.WeaponSlnt', - xplv: 'CoC7.WeaponXplv', - brst: 'CoC7.WeaponBrst', - auto: 'CoC7.WeaponAuto', spcl: 'CoC7.WeaponSpcl', mont: 'CoC7.WeaponMont', - dbrl: 'CoC7.WeaponDbrl', blst: 'CoC7.WeaponBlst', stun: 'CoC7.WeaponStun', + rare: 'CoC7.WeaponRare', burn: 'CoC7.Weapon.Property.Burn' }; diff --git a/module/items/item.js b/module/items/item.js index 3af3290e..ecd31614 100644 --- a/module/items/item.js +++ b/module/items/item.js @@ -51,6 +51,41 @@ export class CoC7Item extends Item { let checkedProps = {}; let fighting; let firearms; + if( 'weapon' === this.type && !override ){ + if( 'shotgun' === propertyId){ + if( !this.data.data.properties.shotgun){ + checkedProps = { + 'data.properties.rngd': true, + 'data.properties.melee': false, + 'data.properties.shotgun': true + }; + } else { + checkedProps = { + 'data.properties.shotgun': false + }; + } + } + + if( 'melee' === propertyId || 'rngd' === propertyId){ + let meleeWeapon; + if( 'melee' === propertyId && !this.data.data.properties.melee) meleeWeapon = true; + if( 'melee' === propertyId && this.data.data.properties.melee) meleeWeapon = false; + if( 'rngd' === propertyId && !this.data.data.properties.rngd) meleeWeapon = false; + if( 'rngd' === propertyId && this.data.data.properties.rngd) meleeWeapon = true; + if( meleeWeapon) { + checkedProps = { + 'data.properties.melee': true, + 'data.properties.rngd': false + }; + } else { + checkedProps = { + 'data.properties.melee': false, + 'data.properties.rngd': true + }; + } + } + } + if( 'skill' == this.type && !override){ let modif = false; if( 'combat' == propertyId) { @@ -263,6 +298,14 @@ export class CoC7Item extends Item { return parseInt( this.data.data.range.normal.value); } + get longRange(){ + return parseInt( this.data.data.range.long.value); + } + + get extremeRange(){ + return parseInt( this.data.data.range.extreme.value); + } + /** TODO : rien a faire ici !! * Get the Actor which is the author of a chat card * @param {HTMLElement} card The chat card being used diff --git a/module/items/sheets/weapon-sheet.js b/module/items/sheets/weapon-sheet.js index c53270ba..f1232c22 100644 --- a/module/items/sheets/weapon-sheet.js +++ b/module/items/sheets/weapon-sheet.js @@ -1,4 +1,5 @@ import { COC7 } from '../../config.js'; +import { CoCActor } from '../../actors/actor.js'; /** * Extend the basic ItemSheet with some very simple modifications @@ -34,6 +35,7 @@ export class CoC7WeaponSheet extends ItemSheet { data.dtypes = ['String', 'Number', 'Boolean']; data.hasOwner = this.item.actor != null; + if( data.hasOwner) data.actorKey = this.item.actor.actorKey; data.combatSkill = []; if( data.hasOwner) { @@ -106,11 +108,8 @@ export class CoC7WeaponSheet extends ItemSheet { // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; - - // Add or Remove Attribute - // html.find(".attributes").on("click", ".attribute-control", this._onClickAttributeControl.bind(this)); - html.find('.toggle-switch').click(this._onClickToggle.bind(this)); + html.find('.weapon-property').click(this._onPropertyClick.bind(this)); } /** @@ -130,4 +129,21 @@ export class CoC7WeaponSheet extends ItemSheet { await this._onSubmit(event); } + async _onPropertyClick(event){ + event.preventDefault(); + const property = event.currentTarget.closest('.weapon-property').dataset.property; + const weaponId = event.currentTarget.closest('.weapon').dataset.itemId; + const actorKey = event.currentTarget.closest('.weapon').dataset.actorKey; + let weapon = null; + if( actorKey){ + const actor = CoCActor.getActorFromKey(actorKey); + weapon = actor.getOwnedItem( weaponId); + } else{ + weapon = game.items.get(weaponId); + } + await weapon.toggleProperty( property); + + return; + } + } diff --git a/styles/coc7.css b/styles/coc7.css index efaf7694..4c01fcf2 100644 --- a/styles/coc7.css +++ b/styles/coc7.css @@ -334,6 +334,7 @@ } .coc7 .toggle-switch, +.coc7 .weapon-property, .coc7 .radio-switch, .coc7 .panel-switch { display: inline-block; diff --git a/templates/actors/parts/actor-weapons.html b/templates/actors/parts/actor-weapons.html index 00fb7a75..2f70ffb3 100644 --- a/templates/actors/parts/actor-weapons.html +++ b/templates/actors/parts/actor-weapons.html @@ -36,7 +36,7 @@
{{#if weapon.data.properties.rngd}} - {{#if weapon.data.properties.xplv}} + {{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
{{range.damage}} @@ -88,7 +88,7 @@
- {{#if weapon.data.properties.xplv}} + {{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
{{#if weapon.data.properties.rngd}} - {{#if weapon.data.properties.xplv}} + {{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
{{range.damage}} @@ -208,7 +208,7 @@
- {{#if weapon.data.properties.xplv}} + {{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
{{#if weapon.data.properties.rngd}} - {{#if weapon.data.properties.xplv}} + {{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
{{range.damage}} @@ -79,7 +79,7 @@
- {{#if weapon.data.properties.xplv}} + {{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
data-base-range="{{trgt.baseRange}}" data-long-range="{{trgt.longRange}}" data-extreme-range="{{trgt.extremeRange}}" + data-out-of-range="{{trgt.outOfRange}}" data-cover="{{trgt.cover}}" data-surprised="{{trgt.surprised}}" data-point-blank-range="{{trgt.pointBlankRange}}" @@ -144,9 +145,12 @@

{{localize 'CoC7.rangeCombatCard.LongRange'}} - {{localize 'CoC7.rangeCombatCard.ExtremeRange'}} + {{localize 'CoC7.rangeCombatCard.OutOfRange'}} {{localize 'CoC7.rangeCombatCard.Cover'}} @@ -241,6 +245,9 @@

{{localize 'CoC7.rangeCombatCard.ExtremeRange'}} + {{localize 'CoC7.rangeCombatCard.OutOfRange'}} {{localize 'CoC7.rangeCombatCard.Cover'}} @@ -266,27 +273,33 @@

{{#unless ../rolled}}
- {{#if trgt.shotDifficulty.impossible}} + {{#if trgt.outOfRange}} {{else}} - {{#if ../multiTarget}} - + {{#if trgt.shotDifficulty.impossible}} + {{else}} - {{#if ../autoFire}} - + {{#if ../multiTarget}} + {{else}} - + {{#if ../autoFire}} + + {{else}} + + {{/if}} {{/if}} {{/if}} {{/if}} @@ -306,6 +319,7 @@

data-actor-key="{{shot.actorKey}}" data-actor-name="{{shot.actorName}}" data-difficulty-level="{{shot.difficultyLevel}}" + data-damage="{{shot.damage}}" data-modifier="{{shot.modifier}}" data-bullets-shot="{{shot.bulletsShot}}" data-transit-bullets="{{shot.transitBullets}}" diff --git a/templates/items/weapon-sheet.html b/templates/items/weapon-sheet.html index af0a5db6..29060ee1 100644 --- a/templates/items/weapon-sheet.html +++ b/templates/items/weapon-sheet.html @@ -1,4 +1,7 @@ -
+
@@ -38,7 +41,7 @@
- {{#if data.properties.xplv}} + {{#if data.properties.shotgun}} {{/if}} @@ -46,7 +49,7 @@
- {{#if data.properties.xplv}} + {{#if data.properties.shotgun}} {{/if}} @@ -60,13 +63,9 @@
{{#each _properties as |property key|}} - {{localize property.name}} -
- -
+ {{localize property.name}} {{/each}}
-
@@ -94,30 +93,30 @@
- +
- +
- +
- +
{{#if data.properties.brst}}
- +
{{/if}} {{#if data.properties.blst}}
- +
{{/if}}
From 9a0471609368efb6e606d81e879056643dda59e1 Mon Sep 17 00:00:00 2001 From: HavelockV Date: Fri, 14 Aug 2020 12:21:27 +0200 Subject: [PATCH 5/7] Melee combat refarctoring --- module/chat.js | 2 +- module/chat/meleecombat.js | 25 +++++++++++++--- module/config.js | 1 + styles/coc7.css | 6 ++++ templates/actors/parts/actor-weapons.html | 12 ++++---- templates/actors/parts/npc-combat.html | 6 ++-- templates/chat/chat-message.html | 33 ++++++++++++++++++++++ templates/chat/combat/damage-result.html | 16 ++++------- templates/chat/combat/melee-initiator.html | 21 ++++++++++++++ templates/chat/combat/melee-target.html | 22 +++++++++++++-- 10 files changed, 116 insertions(+), 28 deletions(-) create mode 100644 templates/chat/chat-message.html diff --git a/module/chat.js b/module/chat.js index 9aee4769..82281adb 100644 --- a/module/chat.js +++ b/module/chat.js @@ -83,7 +83,7 @@ export class CoC7Chat{ } - static async renderMessageHook(message, html) { + static async renderMessageHook(message, html, data) { //Handle showing dropdown selection html.find('.dropbtn').click(event => event.currentTarget.closest('.dropdown').querySelector('.dropdown-content').classList.toggle('show')); diff --git a/module/chat/meleecombat.js b/module/chat/meleecombat.js index ede4e2ac..0598d8de 100644 --- a/module/chat/meleecombat.js +++ b/module/chat/meleecombat.js @@ -42,6 +42,11 @@ export class CoC7MeleeInitiator{ return this.actor.getWeaponSkills( this.itemId); } + get targetImg(){ + if( this.target.actor.isToken) return this.target.data.img; + return this.target.actor.img; + } + template = 'systems/CoC7/templates/chat/combat/melee-initiator.html'; async createChatCard(){ @@ -52,11 +57,17 @@ export class CoC7MeleeInitiator{ const user = this.actor.user ? this.actor.user : game.user; - const chatMessage = await ChatMessage.create({ + const data = { user: user._id, speaker, content: html - }); + }; + + data.flags = { + img: this.actor.isToken ? this.actor.token.data.img: this.actor.img + }; + + const chatMessage = await ChatMessage.create(data); return chatMessage; } @@ -323,11 +334,17 @@ export class CoC7MeleeTarget{ const user = this.actor.user ? this.actor.user : game.user; - const message = await ChatMessage.create({ + const data = { user: user._id, speaker, content: html - }); + }; + + data.flags = { + img: this.actor.isToken ? this.actor.token.data.img: this.actor.img + }; + + const message = await ChatMessage.create(data); this.messageId = message.id; return message; diff --git a/module/config.js b/module/config.js index 61ecd2de..b6be12d1 100644 --- a/module/config.js +++ b/module/config.js @@ -1,6 +1,7 @@ // Namespace COC7 Configuration Values export const COC7 = {}; +CONFIG.ChatMessage.template = 'systems/CoC7/templates/chat/chat-message.html'; /** * The set of Eras used within the system diff --git a/styles/coc7.css b/styles/coc7.css index 4c01fcf2..2ae2591d 100644 --- a/styles/coc7.css +++ b/styles/coc7.css @@ -440,6 +440,8 @@ .coc7.sheet .skills-list .item img { flex: 0 0 24px; margin-right: 5px; + object-fit: contain; + border: none; } .coc7.sheet .skills-list .skill-name { margin: 0; @@ -665,6 +667,8 @@ height: 100px; max-width: 100px; margin: 6px; + object-fit: contain; + border: none; } .coc7.sheet.actor.character { @@ -829,6 +833,8 @@ .coc7.chat-card .card-header img { flex: 0 0 36px; margin-right: 5px; + object-fit: contain; + border: none; } .coc7.chat-card .card-header h3 { diff --git a/templates/actors/parts/actor-weapons.html b/templates/actors/parts/actor-weapons.html index 2f70ffb3..1a2b3f7c 100644 --- a/templates/actors/parts/actor-weapons.html +++ b/templates/actors/parts/actor-weapons.html @@ -87,12 +87,12 @@
-
+
{{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
@@ -101,7 +101,7 @@ {{else}}
@@ -207,12 +207,12 @@
-
+
{{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
@@ -221,7 +221,7 @@ {{else}}
diff --git a/templates/actors/parts/npc-combat.html b/templates/actors/parts/npc-combat.html index b63f1bf9..705d0ca7 100644 --- a/templates/actors/parts/npc-combat.html +++ b/templates/actors/parts/npc-combat.html @@ -78,12 +78,12 @@
-
+
{{#if weapon.data.properties.shotgun}} {{#each weapon.data.range as |range key|}}
@@ -92,7 +92,7 @@ {{else}}
diff --git a/templates/chat/chat-message.html b/templates/chat/chat-message.html new file mode 100644 index 00000000..4f75f13d --- /dev/null +++ b/templates/chat/chat-message.html @@ -0,0 +1,33 @@ +
  • +
    + {{#if message.flags.img}} + +

    {{alias}}

    + + {{else}} +

    {{alias}}

    + + {{/if}} + + {{#if isWhisper}} + {{localize 'CHAT.To'}}: {{whisperTo}} + {{/if}} + + {{#if message.flavor}} + {{{message.flavor}}} + {{/if}} +
    +
    + {{{message.content}}} +
    +
  • diff --git a/templates/chat/combat/damage-result.html b/templates/chat/combat/damage-result.html index 15df9ca9..e193314c 100644 --- a/templates/chat/combat/damage-result.html +++ b/templates/chat/combat/damage-result.html @@ -10,23 +10,17 @@

    {{weapon.name}}

    +
    {{{weapon.data.data.description.value}}}
    -
    - Critical - Impale +
    + {{#if critical}}Critical + {{#if weapon.impale}}Impale{{/if}} + {{/if}}
    diff --git a/templates/chat/combat/melee-initiator.html b/templates/chat/combat/melee-initiator.html index 2ff62a26..4e55475c 100644 --- a/templates/chat/combat/melee-initiator.html +++ b/templates/chat/combat/melee-initiator.html @@ -17,12 +17,28 @@

    {{item.name}}

    +
    {{{item.data.data.description.value}}} + {{#if rolled}} +
    + {{#if advantage}}{{localize 'CoC7.Advantage'}}{{/if}} + {{#if disadvantage}}{{localize 'CoC7.Disadvantage'}}{{/if}} +
    +
    + {{target.name}} : + {{#if outnumbered}}{{localize 'CoC7.OutNumbered'}}{{/if}} + {{#if surprised}}{{localize 'CoC7.combatCard.surpised'}}{{/if}} + {{#if autoSuccess}}{{localize 'CoC7.combatCard.autoSuccess'}}{{/if}} +
    + {{/if}}
    + + + {{#unless rolled}}
    data-flag="disadvantage" data-selected={{disadvantage}}>{{localize 'CoC7.Disadvantage'}}
    + {{/unless}} + {{#unless rolled}} +
    {{#if target}} {{/if}}
    +
    data-flag="auto-success" data-selected={{autoSuccess}}>{{localize 'CoC7.combatCard.autoSuccess'}}
    + {{/unless}} {{#if rolled}}
    - {{#if dodging}} +

    {{actor.dodgeSkill.name}}

    +
    {{else}} {{#if fightingBack}} +

    {{weapon.name}}

    +
    {{else}} {{#if maneuvering}} +

    {{skill.name}}

    - {{else}} -

    {{actor.name}}

    +
    {{/if}} {{/if}} {{/if}} @@ -44,8 +47,18 @@

    {{#if maneuvering}} {{{skill.data.data.description.value}}} {{/if}} + {{#if rolled}} +
    + {{#if dodging}}{{localize 'CoC7.Dodge'}}{{/if}} + {{#if fightingBack}}{{localize 'CoC7.FightBack'}}{{/if}} + {{#if maneuvering}}{{localize 'CoC7.Maneuver'}}{{/if}} + {{#if advantage}}{{localize 'CoC7.Advantage'}}{{/if}} + {{#if disadvantage}}{{localize 'CoC7.Disadvantage'}}{{/if}} +
    + {{/if}}

    + {{#unless rolled}}
    data-flag="disadvantage" data-selected={{disadvantage}}>{{localize 'CoC7.Disadvantage'}}
    + {{/unless}} + {{#unless rolled}}
    + {{/unless}} {{#if rolled}}
    Date: Fri, 14 Aug 2020 12:42:59 +0200 Subject: [PATCH 6/7] 0.2.4 --- README.md | 9 +++++++++ system.json | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ebbb70b5..15b21848 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,15 @@ Compendium 'Weapons' contains a single test weapon. ## What is working +version 0.2.4 : + +* Range combat supports shotguns. +* Bug correction (spending luck on luck and SAN rolls no more possible). +* Slight range combat refactoring. + * Additions of icons to the cards. + * Bonus, penalties, target response have been moved to the card tooltip once the card is resolved. +* Spanish translation updated thanks to Gerbek. + version 0.2.3 : * Hotfix. diff --git a/system.json b/system.json index 41fe568a..a3dd646d 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "CoC7", "title": "The Call of Cthulhu 7th edition", "description": "The Call of Cthulhu 7th edition simple game system", - "version": "0.2.3", + "version": "0.2.4", "author": "HavelockV", "minimumCoreVersion": "0.5.2", "compatibleCoreVersion": "0.6.5", @@ -69,6 +69,6 @@ "secondaryTokenAttribute": "power", "url": "https://github.com/HavlockV/CoC7-FoundryVTT/", "manifest": "https://github.com/HavlockV/CoC7-FoundryVTT/raw/master/system.json", - "download": "https://github.com/HavlockV/CoC7-FoundryVTT/archive/0.2.3.zip" + "download": "https://github.com/HavlockV/CoC7-FoundryVTT/archive/0.2.4.zip" } \ No newline at end of file From 384ed17c2afac115318844e389ecd0211cb2ef57 Mon Sep 17 00:00:00 2001 From: HavelockV Date: Fri, 14 Aug 2020 12:44:11 +0200 Subject: [PATCH 7/7] 0.2.4 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15b21848..a857f2b1 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ version 0.2.4 : * Range combat supports shotguns. * Bug correction (spending luck on luck and SAN rolls no more possible). -* Slight range combat refactoring. +* Slight range combat refactoring (more to come at a later stage. Aim is to reduce size and number of cards). * Additions of icons to the cards. * Bonus, penalties, target response have been moved to the card tooltip once the card is resolved. * Spanish translation updated thanks to Gerbek.