Fix #89 agitators hindrance

This commit is contained in:
sladecraven 2022-10-05 09:40:34 +02:00
parent ef740f4c0d
commit 5a062cc94e
2 changed files with 38 additions and 42 deletions

View File

@ -2025,6 +2025,13 @@ export class PegasusActor extends Actor {
console.log("MR ROLL", rollData) console.log("MR ROLL", rollData)
if (isInit) { if (isInit) {
rollData.title = "MR / Initiative" rollData.title = "MR / Initiative"
rollData.mrVehicle = PegasusUtility.checkIsVehicleCrew(this.id)
if (rollData.mrVehicle) {
rollData.effectsList.push({
label: `Vehicle ${rollData.mrVehicle.name} MR Bonus`,
type: "effect", applied: false, isdynamic: true, value: rollData.mrVehicle.system.mr.currentlevel
})
}
} }
this.startRoll(rollData); this.startRoll(rollData);
} else { } else {
@ -2299,7 +2306,6 @@ export class PegasusActor extends Actor {
return crew return crew
} }
/* -------------------------------------------- */
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.")
@ -2309,11 +2315,13 @@ export class PegasusActor extends Actor {
crewList.push({ id: actorId }) crewList.push({ id: actorId })
this.update({ 'system.crew': crewList }) this.update({ 'system.crew': crewList })
} }
/* -------------------------------------------- */
delCrew(actorId) { delCrew(actorId) {
let crewList = duplicate(this.system.crew.filter(actorDef => actorDef.id != actorId) || []) let crewList = duplicate(this.system.crew.filter(actorDef => actorDef.id != actorId) || [])
this.update({ 'system.crew': crewList }) this.update({ 'system.crew': crewList })
} }
inCrew(actorId) {
return this.system.crew.find(member => member.id == actorId)
}
/* -------------------------------------------- */ /* -------------------------------------------- */
isVehicleFullStop() { isVehicleFullStop() {

View File

@ -1027,7 +1027,12 @@ export class PegasusUtility {
if (target) { if (target) {
let defenderActor = target.actor let defenderActor = target.actor
rollData.defenderTokenId = target.id rollData.defenderTokenId = target.id
rollData.defenderSize = 0
if ( defenderActor.type == "character") {
rollData.defenderSize = Number(defenderActor.system.biodata.sizenum) + Number(defenderActor.system.biodata.sizebonus) rollData.defenderSize = Number(defenderActor.system.biodata.sizenum) + Number(defenderActor.system.biodata.sizebonus)
} else if ( defenderActor.type == "vehicle" ){
rollData.defenderSize = Number(defenderActor.system.statistics.hr.size)
}
//rollData.attackerId = this.id //rollData.attackerId = this.id
console.log("Target/DEFENDER", defenderActor) console.log("Target/DEFENDER", defenderActor)
defenderActor.addHindrancesList(rollData.effectsList) defenderActor.addHindrancesList(rollData.effectsList)
@ -1068,31 +1073,14 @@ export class PegasusUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static glowToken(token) { static checkIsVehicleCrew(actorId) {
let params = let vehicles = game.actors.filter( actor=> actor.type =="vehicle") || []
[{ for(let vehicle of vehicles) {
filterType: "glow", if ( vehicle.inCrew(actorId) ) {
filterId: "superSpookyGlow", return vehicle
outerStrength: 15,
innerStrength: 0,
color: 0x6AAB8E,
quality: 0.5,
padding: 40,
autoDestroy: true,
animated:
{
color:
{
active: true,
loopDuration: 3000,
loops: 2,
animType: "colorOscillation",
val1: 0x6AAB8E,
val2: 0x66FF33
} }
} }
}] return false
TokenMagic.addUpdateFilters(token, params)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */