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) {
|
let effect = duplicate(__bonusEffect)
|
||||||
if (!this.items.find(effect => effect.system.isspeed == speed)) {
|
effect.id = randomID(16)
|
||||||
let effect = duplicate(__bonusEffect)
|
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
|
await this.createEmbeddedDocuments("Item", [effect])
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -2066,7 +2062,7 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
addCrew(actorId) {
|
addCrew(actorId) {
|
||||||
if ( this.system.crew.length >= this.system.crewmax) {
|
if (this.system.crew.length >= this.system.crewmax) {
|
||||||
ui.notifications.warn("Vehicle crew is already full.")
|
ui.notifications.warn("Vehicle crew is already full.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2127,7 +2123,7 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
addVehicleShields(rollData) {
|
addVehicleShields(rollData) {
|
||||||
let shields = this.items.filter( shield => shield.type == "vehiclemodule" && shield.system.activated && shield.system.shielddicevalue > 0) || []
|
let shields = this.items.filter(shield => shield.type == "vehiclemodule" && shield.system.activated && shield.system.shielddicevalue > 0) || []
|
||||||
for (let shield of shields) {
|
for (let shield of shields) {
|
||||||
rollData.vehicleShieldList.push({ label: `${shield.name} (${shield.system.arccoverage})`, type: "vehicleshield", applied: false, value: shield.system.shielddicevalue })
|
rollData.vehicleShieldList.push({ label: `${shield.name} (${shield.system.arccoverage})`, type: "vehicleshield", applied: false, value: shield.system.shielddicevalue })
|
||||||
}
|
}
|
||||||
|
@ -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