Skip to content

Commit

Permalink
Merge pull request #207 from HavlockV/develop
Browse files Browse the repository at this point in the history
0.4.0
  • Loading branch information
HavlockV authored Oct 22, 2020
2 parents 2dd6900 + 634a67c commit ea2fc59
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 33 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Compendium 'Weapons' contains a single test weapon.

## What is working

vesion 0.4.0 :

* Ready for 0.7.5
* The latest version of 'Dice So Nice!' will not work with skills check. You have to keep an older version to see the dice.

version 0.3.9 :

* Bug correction:
Expand Down
6 changes: 6 additions & 0 deletions coc7g.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
}
.flexrow > * {
flex: 1;
Expand Down Expand Up @@ -346,6 +347,7 @@
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
justify-content: flex-end;
}
.coc7.sheet.book .sheet-body .spell-list .item-controls > *,
Expand Down Expand Up @@ -483,6 +485,7 @@
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
}
.coc7 .form-group .form-fields > * {
flex: 1;
Expand Down Expand Up @@ -875,6 +878,7 @@
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
justify-content: flex-end;
}
.coc7.sheet.skill .sheet-body .spell-list .item-controls > *,
Expand Down Expand Up @@ -1034,6 +1038,7 @@
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
justify-content: flex-end;
height: 16px;
}
Expand Down Expand Up @@ -1226,6 +1231,7 @@
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
justify-content: flex-end;
}
.coc7.sheet.occupation .item-list .item-controls > * {
Expand Down
1 change: 1 addition & 0 deletions less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;

> * {
flex: 1;
Expand Down
48 changes: 26 additions & 22 deletions module/actors/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,25 +374,6 @@ export class CoCActor extends Actor {

return await super.createEmbeddedEntity(embeddedName, data, options);
case 'weapon':{
const mainSkill = data?.data?.skill?.main?.name;
if( mainSkill){
let skill = this.getSkillsByName( mainSkill)[0];
if( !skill){
const name = mainSkill.match(/\(([^)]+)\)/)? mainSkill.match(/\(([^)]+)\)/)[1]: mainSkill;
skill = await this.createWeaponSkill( name, data.data.properties?.rngd ? true: false);
}
if( skill) data.data.skill.main.id = skill._id;
} //TODO : Else : selectionner le skill dans la liste ou en créer un nouveau
const secondSkill = data?.data?.skill?.alternativ?.name;
if( secondSkill){
let skill = this.getSkillsByName( secondSkill)[0];
if( !skill){
const name = mainSkill.match(/\(([^)]+)\)/)? mainSkill.match(/\(([^)]+)\)/)[1]: mainSkill;
skill = await this.createWeaponSkill( name, data.data.properties?.rngd ? true: false);
}
if( skill) data.data.skill.alternativ.id = skill._id;
} //TODO : Else : selectionner le skill dans la liste ou en créer un nouveau

return await super.createEmbeddedEntity(embeddedName, data, options);
}
case 'setup':{
Expand Down Expand Up @@ -1039,7 +1020,7 @@ export class CoCActor extends Actor {
item = game.items.get(skillData.id);
}

if( !item) ui.notifications.warn(`No skill ${skillData.name? skillData.name : skillData} found for actor ${this.name}`);
if( !item) return ui.notifications.warn(`No skill ${skillData.name? skillData.name : skillData} found for actor ${this.name}`);

let create = false;
await Dialog.confirm({
Expand Down Expand Up @@ -1099,7 +1080,7 @@ export class CoCActor extends Actor {
item = game.items.get(weaponData.id);
}

if( !item) return ui.notifications.warning( game.i18n.localize( 'CoC7.WarnMacroNoItemFound'));
if( !item) return ui.notifications.warn( game.i18n.localize( 'CoC7.WarnMacroNoItemFound'));

let create = false;
await Dialog.confirm({
Expand All @@ -1108,7 +1089,30 @@ export class CoCActor extends Actor {
yes: () => create = true
});

if(true == create){ await this.createOwnedItem( duplicate(item.data));}
if(true == create){

const mainSkill = item.data?.data?.skill?.main?.name;
if( mainSkill){
let skill = this.getSkillsByName( mainSkill)[0];
if( !skill){
const name = mainSkill.match(/\(([^)]+)\)/)? mainSkill.match(/\(([^)]+)\)/)[1]: mainSkill;
skill = await this.createWeaponSkill( name, item.data.data.properties?.rngd ? true: false);
}
if( skill) item.data.data.skill.main.id = skill._id;
} //TODO : Else : selectionner le skill dans la liste ou en créer un nouveau.

const secondSkill = item.data?.data?.skill?.alternativ?.name;
if( secondSkill){
let skill = this.getSkillsByName( secondSkill)[0];
if( !skill){
const name = mainSkill.match(/\(([^)]+)\)/)? mainSkill.match(/\(([^)]+)\)/)[1]: mainSkill;
skill = await this.createWeaponSkill( name, item.data.data.properties?.rngd ? true: false);
}
if( skill) item.data.data.skill.alternativ.id = skill._id;
} //TODO : Else : selectionner le skill dans la liste ou en créer un nouveau.

await this.createEmbeddedEntity('OwnedItem', duplicate(item.data));
}
else return;
weapons = this.getItemsFromName( item.name);
if( !weapons) return;
Expand Down
4 changes: 2 additions & 2 deletions module/chat/combat/melee-initiator.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export class CoC7MeleeInitiator extends ChatCardActor{
const html = await renderTemplate(this.template, this);

const speakerData = {};
if( this.token) speakerData.token = this.token;
else speakerData.actor = this.actor;
if( this.token) speakerData.token = this;
else speakerData.actor = this;
const speaker = ChatMessage.getSpeaker(speakerData);

const user = this.actor.user ? this.actor.user : game.user;
Expand Down
15 changes: 12 additions & 3 deletions module/chat/damagecards.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,27 @@ export class CoC7DamageRoll extends ChatCardActor{

const is7 = Object.prototype.hasOwnProperty.call(Roll, 'cleanTerms');

// 0.7.5 this.maxDamage.result -> this.maxDamage
this.maxDamage = is7? Roll.maximize( this.rollString)._total: Roll.maximize( this.rollString);
this.roll = null;
if( this.critical){
if( this.weapon.impale) {
this.rollString = this.rollString + '+' + this.maxDamage.total;
if( is7) this.rollString = this.rollString + '+' + this.maxDamage;
else this.rollString = this.rollString + '+' + this.maxDamage.result;
this.roll = new Roll( this.rollString);
this.roll.roll();
this.result = Math.floor( this.roll.total);
}
else{
this.result = this.maxDamage.total;
this.roll = this.maxDamage;
if( is7){
this.roll = new Roll( `${this.maxDamage}`);
this.roll.roll();
this.result = this.maxDamage;
} else {
this.roll = new Roll( this.maxDamage.result);
this.roll.roll();
this.result = this.maxDamage.result;
}
this.resultString = `Max(${this.rollString})`;
}

Expand Down
3 changes: 3 additions & 0 deletions module/chat/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class chatHelper{
const tokenData = scene.getEmbeddedEntity('Token', tokenId);
if (!tokenData) return null;
const token = new Token(tokenData);
if( !token.scene) token.scene = scene;
return token;
} else {
const actor = game.actors.get( key);
Expand Down Expand Up @@ -113,6 +114,8 @@ export class chatHelper{
}

static getDistance( startToken, endToken){
// startToken.updateSource();
// canvas.sight.initializeTokens();
const ray = new Ray( startToken.center, endToken.center);
const segment = [{ray}];
const distance = {
Expand Down
9 changes: 7 additions & 2 deletions module/dice.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ export class CoC7Dice {
const diceData = {
formula: `${tenDie.results.length}d100+1d10`,
results: diceResults,
throws: [],
whisper: null,
blind: false
};

game.dice3d.show(diceData);

try{
game.dice3d.show(diceData);
} catch(err){
console.error('Roll: ' + err.message);
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "CoC7",
"title": "The Call of Cthulhu 7th edition",
"description": "The Call of Cthulhu 7th edition simple game system",
"version": "0.3.9",
"version": "0.4.0",
"author": "HavelockV",
"minimumCoreVersion": "0.5.2",
"compatibleCoreVersion": "0.6.6",
"compatibleCoreVersion": "0.7.5",
"esmodules": [
"module/coc7.js",
"module/dicebot.js"
Expand Down Expand Up @@ -72,6 +72,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.3.9.zip"
}
"download": "https://github.com/HavlockV/CoC7-FoundryVTT/archive/0.4.0.zip"
}

0 comments on commit ea2fc59

Please sign in to comment.