Button um Kampf beizutreten
Changes: + Button um Kampf beizutreten + buttons um initiative zu verändern für Fernangriffe und Zauber
This commit is contained in:
@@ -269,27 +269,6 @@ export class M5Roll {
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.resistanceMind"));
|
||||
}
|
||||
|
||||
static async initativeRoll(actor: any) {
|
||||
let newInitiative; // the initiative value for the combatant
|
||||
|
||||
// ...
|
||||
// The intnitiative value is calculated here
|
||||
// ...
|
||||
|
||||
let combatant = game["combat"].getCombatantByActor(actor._id);
|
||||
if (!combatant) {
|
||||
await game["combat"].createEmbeddedDocuments("Combatant", [{ actorId: actor._id }]);
|
||||
combatant = game["combat"].getCombatantByActor(actor._id);
|
||||
}
|
||||
|
||||
const initiatives = {
|
||||
_id: combatant._id,
|
||||
initiative: actor.system.calc.attributes.gw.value,
|
||||
};
|
||||
|
||||
await game["combat"].updateEmbeddedDocuments("Combatant", [initiatives]);
|
||||
}
|
||||
|
||||
static resistanceBody(actor: any) {
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
rollData.i = {
|
||||
|
||||
@@ -363,6 +363,57 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||
character.createItem((game as Game).i18n.localize("TYPES.Item.effect"), M5ItemType.EFFECT);
|
||||
});
|
||||
|
||||
html.find(".join-combat").on("click", async (event) => {
|
||||
if (!!game["combat"]) {
|
||||
let combatant = game["combat"].getCombatantByActor(this.actor._id);
|
||||
if (!combatant) {
|
||||
await game["combat"].createEmbeddedDocuments("Combatant", [{ actorId: this.actor._id }]);
|
||||
combatant = game["combat"].getCombatantByActor(this.actor._id);
|
||||
}
|
||||
|
||||
const initiatives = {
|
||||
_id: combatant._id,
|
||||
initiative: this.actor.system.calc.attributes.gw.value,
|
||||
};
|
||||
|
||||
await game["combat"].updateEmbeddedDocuments("Combatant", [initiatives]);
|
||||
}
|
||||
});
|
||||
|
||||
html.find(".ranged-combat").on("click", async (event) => {
|
||||
if (!!game["combat"]) {
|
||||
let combatant = game["combat"].getCombatantByActor(this.actor._id);
|
||||
if (!combatant) {
|
||||
await game["combat"].createEmbeddedDocuments("Combatant", [{ actorId: this.actor._id }]);
|
||||
combatant = game["combat"].getCombatantByActor(this.actor._id);
|
||||
}
|
||||
|
||||
const initiatives = {
|
||||
_id: combatant._id,
|
||||
initiative: 0.01 * this.actor.system.calc.attributes.gw.value,
|
||||
};
|
||||
|
||||
await game["combat"].updateEmbeddedDocuments("Combatant", [initiatives]);
|
||||
}
|
||||
});
|
||||
|
||||
html.find(".spell-combat").on("click", async (event) => {
|
||||
if (!!game["combat"]) {
|
||||
let combatant = game["combat"].getCombatantByActor(this.actor._id);
|
||||
if (!combatant) {
|
||||
await game["combat"].createEmbeddedDocuments("Combatant", [{ actorId: this.actor._id }]);
|
||||
combatant = game["combat"].getCombatantByActor(this.actor._id);
|
||||
}
|
||||
|
||||
const initiatives = {
|
||||
_id: combatant._id,
|
||||
initiative: 0.001 * this.actor.system.calc.attributes.gw.value,
|
||||
};
|
||||
|
||||
await game["combat"].updateEmbeddedDocuments("Combatant", [initiatives]);
|
||||
}
|
||||
});
|
||||
|
||||
// Drag & Drop
|
||||
const dragDrop = new DragDrop({
|
||||
dragSelector: ".items-list .item",
|
||||
|
||||
@@ -225,6 +225,10 @@
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
.wide-button {
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
.learn-button {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
Reference in New Issue
Block a user