Fix #11 Speed management
This commit is contained in:
parent
241c7fa1ae
commit
52b7279cb8
@ -1656,7 +1656,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (subKey == "ranged-dmg") {
|
if (subKey == "ranged-dmg") {
|
||||||
this.addVehicleWeapons(rollData, vehicle)
|
this.addVehicleWeapons(rollData, vehicle)
|
||||||
}
|
}
|
||||||
if (subKey == "defense") {
|
if (subKey == "defence") {
|
||||||
if (vehicle.isVehicleFullStop()) {
|
if (vehicle.isVehicleFullStop()) {
|
||||||
ui.notifications.warn("MAN not added to Defense due to Full Stop.")
|
ui.notifications.warn("MAN not added to Defense due to Full Stop.")
|
||||||
} else {
|
} else {
|
||||||
@ -1858,24 +1858,35 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* VEHICLE STUFF */
|
/* VEHICLE STUFF */
|
||||||
manageCurrentSpeed(speed) {
|
async manageCurrentSpeed(speed) {
|
||||||
|
// Delete any previous effect
|
||||||
|
let effect = this.items.find(effect => effect.system.isspeed != undefined)
|
||||||
|
if (effect) {
|
||||||
|
await this.deleteEmbeddedDocuments("Item", [effect.id])
|
||||||
|
}
|
||||||
|
|
||||||
if (speed == "fullstop") {
|
if (speed == "fullstop") {
|
||||||
this.update({ 'system.secondary.moverange': "nomovement" })
|
this.update({ 'system.secondary.moverange': "nomovement" })
|
||||||
}
|
}
|
||||||
if (speed == "crawling") {
|
if (speed == "crawling") {
|
||||||
this.update({ 'system.secondary.moverange': "threatzone" })
|
await this.update({ 'system.secondary.moverange': "threatzone" })
|
||||||
|
await this.manageVehicleSpeedBonus("crawling", "Crawling MAN Bonus", "man", 3)
|
||||||
}
|
}
|
||||||
if (speed == "slow") {
|
if (speed == "slow") {
|
||||||
this.update({ 'system.secondary.moverange': "close" })
|
await this.update({ 'system.secondary.moverange': "close" })
|
||||||
|
await this.manageVehicleSpeedBonus("slow", "Slow MAN Bonus", "man", 1)
|
||||||
}
|
}
|
||||||
if (speed == "average") {
|
if (speed == "average") {
|
||||||
this.update({ 'system.secondary.moverange': "medium" })
|
await this.update({ 'system.secondary.moverange': "medium" })
|
||||||
|
await this.manageVehicleSpeedBonus("average", "Avoid attack Bonus", "all", 1)
|
||||||
}
|
}
|
||||||
if (speed == "fast") {
|
if (speed == "fast") {
|
||||||
this.update({ 'system.secondary.moverange': "long" })
|
await this.update({ 'system.secondary.moverange': "long" })
|
||||||
|
await this.manageVehicleSpeedBonus("fast", "Avoid attack Bonus", "all", 3)
|
||||||
}
|
}
|
||||||
if (speed == "extfast") {
|
if (speed == "extfast") {
|
||||||
this.update({ 'system.secondary.moverange': "extreme" })
|
await this.update({ 'system.secondary.moverange': "extreme" })
|
||||||
|
await this.manageVehicleSpeedBonus("extfast", "Avoid attack Bonus", "all", 5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1894,22 +1905,14 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
manageVehicleSpeedBonus(speed, name, stat, level) {
|
async manageVehicleSpeedBonus(speed, name, stat, level) {
|
||||||
if (this.system.statistics.ad.currentspeed == speed) {
|
|
||||||
if (!this.items.find(effect => effect.system.isspeed == speed)) {
|
|
||||||
let effect = duplicate(__bonusEffect)
|
let effect = duplicate(__bonusEffect)
|
||||||
|
effect.id = randomID(16)
|
||||||
effect.name = name
|
effect.name = name
|
||||||
effect.system.stataffected = stat
|
effect.system.stataffected = stat
|
||||||
effect.system.effectlevel = level
|
effect.system.effectlevel = level
|
||||||
effect.system.isspeed = speed
|
effect.system.isspeed = speed
|
||||||
this.createEmbeddedDocuments("Item", [effect])
|
await this.createEmbeddedDocuments("Item", [effect])
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let effect = this.items.find(effect => effect.system.isspeed == speed)
|
|
||||||
if (effect) {
|
|
||||||
this.deleteEmbeddedDocuments("Item", [effect.id])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1998,13 +2001,6 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Speed effect management
|
|
||||||
this.manageVehicleSpeedBonus("crawling", "Crawling MAN Bonus", "man", 3)
|
|
||||||
this.manageVehicleSpeedBonus("slow", "Slow MAN Bonus", "man", 1)
|
|
||||||
this.manageVehicleSpeedBonus("average", "Avoid attack Bonus", "all", 1)
|
|
||||||
this.manageVehicleSpeedBonus("fast", "Avoid attack Bonus", "all", 3)
|
|
||||||
this.manageVehicleSpeedBonus("extfast", "Avoid attack Bonus", "all", 5)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -215,7 +215,7 @@ export class PegasusVehicleSheet extends ActorSheet {
|
|||||||
this.actor.rollPoolFromVehicle( 'per', false, "ranged-dmg");
|
this.actor.rollPoolFromVehicle( 'per', false, "ranged-dmg");
|
||||||
});
|
});
|
||||||
html.find('.defense-roll').click((event) => {
|
html.find('.defense-roll').click((event) => {
|
||||||
this.actor.rollPoolFromVehicle( 'def', true, "defence");
|
this.actor.rollPoolFromVehicle( 'agi', true, "defence");
|
||||||
});
|
});
|
||||||
html.find('.damage-resistance').click((event) => {
|
html.find('.damage-resistance').click((event) => {
|
||||||
this.actor.rollVehicleDamageResistance( );
|
this.actor.rollVehicleDamageResistance( );
|
||||||
|
Loading…
Reference in New Issue
Block a user