ENH: Rework attack roll
parent
b78de8fffc
commit
0c9282b8a5
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"OSE.Edit": "Edit",
|
"OSE.Edit": "Edit",
|
||||||
"OSE.Delete": "Delete",
|
"OSE.Delete": "Delete",
|
||||||
|
"OSE.Show": "Show",
|
||||||
"OSE.Add": "Add",
|
"OSE.Add": "Add",
|
||||||
"OSE.Ok": "Ok",
|
"OSE.Ok": "Ok",
|
||||||
"OSE.Cancel": "Cancel",
|
"OSE.Cancel": "Cancel",
|
||||||
|
@ -150,6 +151,7 @@
|
||||||
"OSE.items.Slow": "Slow",
|
"OSE.items.Slow": "Slow",
|
||||||
"OSE.items.ArmorAC": "AC",
|
"OSE.items.ArmorAC": "AC",
|
||||||
"OSE.items.ArmorAAC": "AAC",
|
"OSE.items.ArmorAAC": "AAC",
|
||||||
|
"OSE.items.Bonus": "Bonus",
|
||||||
|
|
||||||
"OSE.armor.type": "Armor Type",
|
"OSE.armor.type": "Armor Type",
|
||||||
"OSE.armor.unarmored": "Unarmored",
|
"OSE.armor.unarmored": "Unarmored",
|
||||||
|
@ -185,6 +187,7 @@
|
||||||
|
|
||||||
"OSE.messages.GetExperience": "{name} gained {value} experience points!",
|
"OSE.messages.GetExperience": "{name} gained {value} experience points!",
|
||||||
"OSE.messages.AttackSuccess": "<b>Hits AC {result}!</b> ({bonus})",
|
"OSE.messages.AttackSuccess": "<b>Hits AC {result}!</b> ({bonus})",
|
||||||
|
"OSE.messages.AttackAscendingSuccess": "<b>Hits AC {result}!</b>",
|
||||||
"OSE.messages.AttackFailure": "<b>Attack fails</b> ({bonus})",
|
"OSE.messages.AttackFailure": "<b>Attack fails</b> ({bonus})",
|
||||||
"OSE.messages.InflictsDamage": "Inflicts damage!",
|
"OSE.messages.InflictsDamage": "Inflicts damage!",
|
||||||
"OSE.ChatContextDamage": "Apply Damage",
|
"OSE.ChatContextDamage": "Apply Damage",
|
||||||
|
|
|
@ -72,7 +72,7 @@ export class OseActor extends Actor {
|
||||||
rollData: {
|
rollData: {
|
||||||
type: "Above",
|
type: "Above",
|
||||||
target: this.data.data.saves[save].value,
|
target: this.data.data.saves[save].value,
|
||||||
details: game.i18n.format("OSE.SavingThrowDetails", {save: label}),
|
details: game.i18n.format("OSE.SavingThrowDetails", { save: label }),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -127,7 +127,9 @@ export class OseActor extends Actor {
|
||||||
rollData: {
|
rollData: {
|
||||||
type: "Check",
|
type: "Check",
|
||||||
target: this.data.data.scores[score].value,
|
target: this.data.data.scores[score].value,
|
||||||
details: game.i18n.format("OSE.AttributeCheckDetails", {score: label}),
|
details: game.i18n.format("OSE.AttributeCheckDetails", {
|
||||||
|
score: label,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -181,7 +183,9 @@ export class OseActor extends Actor {
|
||||||
rollData: {
|
rollData: {
|
||||||
type: "Below",
|
type: "Below",
|
||||||
target: this.data.data.exploration[expl],
|
target: this.data.data.exploration[expl],
|
||||||
details: game.i18n.format("OSE.ExplorationCheckDetails", {expl: label}),
|
details: game.i18n.format("OSE.ExplorationCheckDetails", {
|
||||||
|
expl: label,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -215,7 +219,10 @@ export class OseActor extends Actor {
|
||||||
};
|
};
|
||||||
|
|
||||||
let dmgParts = [];
|
let dmgParts = [];
|
||||||
if ((!attData.dmg || !game.settings.get("ose", "variableWeaponDamage")) && this.type == "character") {
|
if (
|
||||||
|
(!attData.dmg || !game.settings.get("ose", "variableWeaponDamage")) &&
|
||||||
|
this.type == "character"
|
||||||
|
) {
|
||||||
dmgParts.push("1d6");
|
dmgParts.push("1d6");
|
||||||
} else {
|
} else {
|
||||||
dmgParts.push(attData.dmg);
|
dmgParts.push(attData.dmg);
|
||||||
|
@ -243,38 +250,35 @@ export class OseActor extends Actor {
|
||||||
|
|
||||||
const rollParts = ["1d20"];
|
const rollParts = ["1d20"];
|
||||||
const dmgParts = [];
|
const dmgParts = [];
|
||||||
|
|
||||||
if ((!attData.dmg || !game.settings.get("ose", "variableWeaponDamage")) && this.data.type == "character") {
|
if ((!attData.dmg || !game.settings.get("ose", "variableWeaponDamage")) &&
|
||||||
|
this.data.type == "character") {
|
||||||
dmgParts.push("1d6");
|
dmgParts.push("1d6");
|
||||||
} else {
|
} else {
|
||||||
dmgParts.push(attData.dmg);
|
dmgParts.push(attData.dmg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let ascending = game.settings.get("ose", "ascendingAC");
|
let ascending = game.settings.get("ose", "ascendingAC");
|
||||||
if (ascending) {
|
if (ascending) {
|
||||||
rollParts.push(data.thac0.bba.toString());
|
rollParts.push(data.thac0.bba.toString());
|
||||||
if (attData.type == "missile") {
|
|
||||||
rollParts.push(
|
|
||||||
data.scores.dex.mod.toString(),
|
|
||||||
data.thac0.mod.missile.toString()
|
|
||||||
);
|
|
||||||
} else if (attData.type == "melee") {
|
|
||||||
rollParts.push(
|
|
||||||
data.scores.str.mod.toString(),
|
|
||||||
data.thac0.mod.melee.toString()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (attData.type == "missile") {
|
||||||
let thac0 = 0;
|
rollParts.push(
|
||||||
|
data.scores.dex.mod.toString(),
|
||||||
|
data.thac0.mod.missile.toString()
|
||||||
|
);
|
||||||
|
} else if (attData.type == "melee") {
|
||||||
|
rollParts.push(
|
||||||
|
data.scores.str.mod.toString(),
|
||||||
|
data.thac0.mod.melee.toString()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (attData.bonus) {
|
||||||
|
rollParts.push(attData.bonus);
|
||||||
|
}
|
||||||
|
let thac0 = data.thac0.value;
|
||||||
if (attData.type == "melee") {
|
if (attData.type == "melee") {
|
||||||
dmgParts.push(data.scores.str.mod);
|
dmgParts.push(data.scores.str.mod);
|
||||||
thac0 = data.thac0.melee;
|
|
||||||
} else if (attData.type == "missile") {
|
|
||||||
thac0 = data.thac0.missile;
|
|
||||||
} else {
|
|
||||||
thac0 = data.thac0.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const rollData = {
|
const rollData = {
|
||||||
|
@ -290,7 +294,7 @@ export class OseActor extends Actor {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let skip = options.event && options.event.ctrlKey;
|
let skip = options.event && options.event.ctrlKey;
|
||||||
|
|
||||||
// Roll and return
|
// Roll and return
|
||||||
return OseDice.Roll({
|
return OseDice.Roll({
|
||||||
event: options.event,
|
event: options.event,
|
||||||
|
@ -303,7 +307,7 @@ export class OseActor extends Actor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async applyDamage(amount=0, multiplier=1) {
|
async applyDamage(amount = 0, multiplier = 1) {
|
||||||
amount = Math.floor(parseInt(amount) * multiplier);
|
amount = Math.floor(parseInt(amount) * multiplier);
|
||||||
const hp = this.data.data.hp;
|
const hp = this.data.data.hp;
|
||||||
|
|
||||||
|
@ -312,7 +316,7 @@ export class OseActor extends Actor {
|
||||||
|
|
||||||
// Update the Actor
|
// Update the Actor
|
||||||
return this.update({
|
return this.update({
|
||||||
"data.hp.value": dh
|
"data.hp.value": dh,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ export class OseDice {
|
||||||
};
|
};
|
||||||
result.target = data.rollData.thac0;
|
result.target = data.rollData.thac0;
|
||||||
if (game.settings.get("ose", "ascendingAC")) {
|
if (game.settings.get("ose", "ascendingAC")) {
|
||||||
result.details = game.i18n.format('OSE.messages.AttackSuccess', {result: roll.total, bonus: result.target});
|
result.details = game.i18n.format('OSE.messages.AttackAscendingSuccess', {result: roll.total});
|
||||||
result.isSuccess = true;
|
result.isSuccess = true;
|
||||||
} else {
|
} else {
|
||||||
// B/X Historic THAC0 Calculation
|
// B/X Historic THAC0 Calculation
|
||||||
|
|
|
@ -53,14 +53,19 @@ export class OseItem extends Item {
|
||||||
// Dialog
|
// Dialog
|
||||||
new Dialog({
|
new Dialog({
|
||||||
title: "Choose Attack Range",
|
title: "Choose Attack Range",
|
||||||
content: '',
|
content: "",
|
||||||
buttons: {
|
buttons: {
|
||||||
melee: {
|
melee: {
|
||||||
icon: '<i class="fas fa-fist-raised"></i>',
|
icon: '<i class="fas fa-fist-raised"></i>',
|
||||||
label: "Melee",
|
label: "Melee",
|
||||||
callback: () => {
|
callback: () => {
|
||||||
this.actor.rollAttack(
|
this.actor.rollAttack(
|
||||||
{ type: "melee", label: this.name, dmg: this.data.data.damage },
|
{
|
||||||
|
type: "melee",
|
||||||
|
label: this.name,
|
||||||
|
dmg: this.data.data.damage,
|
||||||
|
bonus: data.bonus,
|
||||||
|
},
|
||||||
{ event: { ctrlKey: skipDialog } }
|
{ event: { ctrlKey: skipDialog } }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -89,7 +94,7 @@ export class OseItem extends Item {
|
||||||
type = "melee";
|
type = "melee";
|
||||||
}
|
}
|
||||||
this.actor.rollAttack(
|
this.actor.rollAttack(
|
||||||
{ type: type, label: this.name, dmg: this.data.data.damage },
|
{ type: type, label: this.name, dmg: data.damage, bonus: data.bonus },
|
||||||
{ event: { ctrlKey: skipDialog } }
|
{ event: { ctrlKey: skipDialog } }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
.form-group {
|
.form-group {
|
||||||
margin: 2px;
|
margin: 1px;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||||
label {
|
label {
|
||||||
background: rgba(0, 0, 0, 0.1);
|
background: rgba(0, 0, 0, 0.1);
|
||||||
|
|
|
@ -166,6 +166,7 @@
|
||||||
"weapon": {
|
"weapon": {
|
||||||
"description": "",
|
"description": "",
|
||||||
"damage": "1d6",
|
"damage": "1d6",
|
||||||
|
"bonus": 0,
|
||||||
"qualities": "",
|
"qualities": "",
|
||||||
"slow": false,
|
"slow": false,
|
||||||
"missile": true,
|
"missile": true,
|
||||||
|
|
|
@ -54,8 +54,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
{{#if ../owner}}
|
{{#if ../owner}}
|
||||||
<a class="item-control item-edit" title='{{localize "Ose.Edit"}}'><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title='{{localize "OSE.Edit"}}'><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title='{{localize "Ose.Delete"}}'><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title='{{localize "OSE.Delete"}}'><i class="fas fa-trash"></i></a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -160,8 +160,8 @@
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="attribute-value"
|
<div class="attribute-value"
|
||||||
title="{{localize 'OSE.Thac0'}}({{data.thac0.value}}) - {{localize 'OSE.scores.str.long'}}({{data.scores.str.mod}}) - {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})">
|
title="{{localize 'OSE.scores.str.long'}}({{data.scores.str.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})">
|
||||||
{{data.thac0.melee}}
|
{{add data.scores.str.mod data.thac0.mod.melee}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -200,8 +200,8 @@
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="attribute-value"
|
<div class="attribute-value"
|
||||||
title="{{localize 'OSE.Thac0'}}({{data.thac0.value}}) - {{localize 'OSE.scores.dex.long'}}({{data.scores.dex.mod}}) - {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})">
|
title="{{localize 'OSE.scores.dex.long'}}({{data.scores.dex.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})">
|
||||||
{{data.thac0.missile}}
|
{{add data.scores.dex.mod data.thac0.mod.missile}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
<input type="text" name="data.damage" value="{{data.damage}}" data-dtype="String" />
|
<input type="text" name="data.damage" value="{{data.damage}}" data-dtype="String" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>{{localize 'OSE.items.Bonus'}}</label>
|
||||||
|
<div class="form-fields">
|
||||||
|
<input type="text" name="data.bonus" value="{{data.bonus}}" data-dtype="Number" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{localize 'OSE.items.Slow'}}</label>
|
<label>{{localize 'OSE.items.Slow'}}</label>
|
||||||
<div class="form-fields">
|
<div class="form-fields">
|
||||||
|
|
Loading…
Reference in New Issue