Fix #89 agitators hindrance
This commit is contained in:
parent
ef740f4c0d
commit
5a062cc94e
@ -240,7 +240,7 @@ export class PegasusActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getRoleLevel() {
|
getRoleLevel() {
|
||||||
let role = this.items.find(item => item.type == 'role')
|
let role = this.items.find(item => item.type == 'role')
|
||||||
if (role ) {
|
if (role) {
|
||||||
console.log("Role", role)
|
console.log("Role", role)
|
||||||
return role.system.rolelevel
|
return role.system.rolelevel
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ export class PegasusActor extends Actor {
|
|||||||
return role && role.system.perksrole == "tactician"
|
return role && role.system.perksrole == "tactician"
|
||||||
}
|
}
|
||||||
hasTacticianBonus() {
|
hasTacticianBonus() {
|
||||||
let effect = this.items.find( item => item.name.toLowerCase().includes("tactician bonus dice") )
|
let effect = this.items.find(item => item.name.toLowerCase().includes("tactician bonus dice"))
|
||||||
return effect
|
return effect
|
||||||
}
|
}
|
||||||
async addTacticianEffect(name, level) {
|
async addTacticianEffect(name, level) {
|
||||||
@ -266,7 +266,7 @@ export class PegasusActor extends Actor {
|
|||||||
ChatMessage.create({ content: `Tactician Bonus Dice has been added to ${this.name} (${level})` })
|
ChatMessage.create({ content: `Tactician Bonus Dice has been added to ${this.name} (${level})` })
|
||||||
}
|
}
|
||||||
async removeTacticianEffect() {
|
async removeTacticianEffect() {
|
||||||
let effect = this.items.find( item => item.name.toLowerCase().includes("tactician bonus dice") )
|
let effect = this.items.find(item => item.name.toLowerCase().includes("tactician bonus dice"))
|
||||||
if (effect) {
|
if (effect) {
|
||||||
await this.deleteEmbeddedDocuments('Item', [effect.id])
|
await this.deleteEmbeddedDocuments('Item', [effect.id])
|
||||||
ChatMessage.create({ content: `Tactician Bonus Dice has been removed to ${this.name}` })
|
ChatMessage.create({ content: `Tactician Bonus Dice has been removed to ${this.name}` })
|
||||||
@ -279,10 +279,10 @@ export class PegasusActor extends Actor {
|
|||||||
return role && role.system.perksrole == "enhancer"
|
return role && role.system.perksrole == "enhancer"
|
||||||
}
|
}
|
||||||
hasEnhancerBonus() {
|
hasEnhancerBonus() {
|
||||||
let effect = this.items.find( item => item.name.toLowerCase().includes("enhancer bonus dice") )
|
let effect = this.items.find(item => item.name.toLowerCase().includes("enhancer bonus dice"))
|
||||||
return effect
|
return effect
|
||||||
}
|
}
|
||||||
async addEnhancerEffect( name, level) {
|
async addEnhancerEffect(name, level) {
|
||||||
let effect = duplicate(__bonusEffect)
|
let effect = duplicate(__bonusEffect)
|
||||||
effect.name = `${name} Enhancer Bonus Dice ALL`
|
effect.name = `${name} Enhancer Bonus Dice ALL`
|
||||||
effect.system.effectlevel = level
|
effect.system.effectlevel = level
|
||||||
@ -292,7 +292,7 @@ export class PegasusActor extends Actor {
|
|||||||
ChatMessage.create({ content: `Enhancer Bonus Dice has been added to ${this.name} (${level})` })
|
ChatMessage.create({ content: `Enhancer Bonus Dice has been added to ${this.name} (${level})` })
|
||||||
}
|
}
|
||||||
async removeEnhancerEffect() {
|
async removeEnhancerEffect() {
|
||||||
let effect = this.items.find( item => item.name.toLowerCase().includes("enhancer bonus dice") )
|
let effect = this.items.find(item => item.name.toLowerCase().includes("enhancer bonus dice"))
|
||||||
if (effect) {
|
if (effect) {
|
||||||
await this.deleteEmbeddedDocuments('Item', [effect.id])
|
await this.deleteEmbeddedDocuments('Item', [effect.id])
|
||||||
ChatMessage.create({ content: `Enhancer Bonus Dice has been removed to ${this.name}` })
|
ChatMessage.create({ content: `Enhancer Bonus Dice has been removed to ${this.name}` })
|
||||||
@ -305,7 +305,7 @@ export class PegasusActor extends Actor {
|
|||||||
return role && role.system.perksrole == "agitator"
|
return role && role.system.perksrole == "agitator"
|
||||||
}
|
}
|
||||||
hasAgitatorHindrance() {
|
hasAgitatorHindrance() {
|
||||||
let effect = this.items.find( item => item.name.toLowerCase().includes("hindered by agitator") )
|
let effect = this.items.find(item => item.name.toLowerCase().includes("hindered by agitator"))
|
||||||
return effect
|
return effect
|
||||||
}
|
}
|
||||||
async addAgitatorHindrance(name, level) {
|
async addAgitatorHindrance(name, level) {
|
||||||
@ -319,7 +319,7 @@ export class PegasusActor extends Actor {
|
|||||||
ChatMessage.create({ content: `Agitator Hindrance has been added to ${this.name} (${level})` })
|
ChatMessage.create({ content: `Agitator Hindrance has been added to ${this.name} (${level})` })
|
||||||
}
|
}
|
||||||
async removeAgitatorHindrance() {
|
async removeAgitatorHindrance() {
|
||||||
let effect = this.items.find( item => item.name.toLowerCase().includes("hindered by agitator") )
|
let effect = this.items.find(item => item.name.toLowerCase().includes("hindered by agitator"))
|
||||||
if (effect) {
|
if (effect) {
|
||||||
await this.deleteEmbeddedDocuments('Item', [effect.id])
|
await this.deleteEmbeddedDocuments('Item', [effect.id])
|
||||||
ChatMessage.create({ content: `Agitator Hindrance has been removed to ${this.name}` })
|
ChatMessage.create({ content: `Agitator Hindrance has been removed to ${this.name}` })
|
||||||
@ -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() {
|
||||||
|
@ -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 = Number(defenderActor.system.biodata.sizenum) + Number(defenderActor.system.biodata.sizebonus)
|
rollData.defenderSize = 0
|
||||||
|
if ( defenderActor.type == "character") {
|
||||||
|
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,
|
return false
|
||||||
quality: 0.5,
|
|
||||||
padding: 40,
|
|
||||||
autoDestroy: true,
|
|
||||||
animated:
|
|
||||||
{
|
|
||||||
color:
|
|
||||||
{
|
|
||||||
active: true,
|
|
||||||
loopDuration: 3000,
|
|
||||||
loops: 2,
|
|
||||||
animType: "colorOscillation",
|
|
||||||
val1: 0x6AAB8E,
|
|
||||||
val2: 0x66FF33
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
TokenMagic.addUpdateFilters(token, params)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user