Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/defenseManager.js
Show First 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | m.DefenseManager.prototype.assignDefenders = function(gameState) | ||||
let potentialDefenders = []; | let potentialDefenders = []; | ||||
gameState.getOwnUnits().forEach(function(ent) { | gameState.getOwnUnits().forEach(function(ent) { | ||||
if (!ent.position()) | if (!ent.position()) | ||||
return; | return; | ||||
if (ent.getMetadata(PlayerID, "plan") == -2 || ent.getMetadata(PlayerID, "plan") == -3) | if (ent.getMetadata(PlayerID, "plan") == -2 || ent.getMetadata(PlayerID, "plan") == -3) | ||||
return; | return; | ||||
if (ent.hasClass("Support") || ent.attackTypes() === undefined) | if (ent.hasClass("Support") || ent.attackTypes() === undefined) | ||||
return; | return; | ||||
if (ent.hasClass("Catapult")) | if (ent.hasClass("StoneThrower")) | ||||
return; | return; | ||||
if (ent.hasClass("FishingBoat") || ent.hasClass("Trader")) | if (ent.hasClass("FishingBoat") || ent.hasClass("Trader")) | ||||
return; | return; | ||||
if (ent.getMetadata(PlayerID, "transport") !== undefined || | if (ent.getMetadata(PlayerID, "transport") !== undefined || | ||||
ent.getMetadata(PlayerID, "transporter") !== undefined) | ent.getMetadata(PlayerID, "transporter") !== undefined) | ||||
return; | return; | ||||
if (gameState.ai.HQ.victoryManager.criticalEnts.has(ent.id())) | if (gameState.ai.HQ.victoryManager.criticalEnts.has(ent.id())) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | for (let evt of events.Attacked) | ||||
// try to garrison any attacked support unit if low healthlevel | // try to garrison any attacked support unit if low healthlevel | ||||
if (target.hasClass("Support") && target.healthLevel() < this.Config.garrisonHealthLevel.medium && | if (target.hasClass("Support") && target.healthLevel() < this.Config.garrisonHealthLevel.medium && | ||||
!target.getMetadata(PlayerID, "transport") && plan != -2 && plan != -3) | !target.getMetadata(PlayerID, "transport") && plan != -2 && plan != -3) | ||||
{ | { | ||||
this.garrisonAttackedUnit(gameState, target); | this.garrisonAttackedUnit(gameState, target); | ||||
continue; | continue; | ||||
} | } | ||||
// try to garrison any attacked catapult | // try to garrison any attacked stone thrower | ||||
if (target.hasClass("Catapult") && | if (target.hasClass("StoneThrower") && | ||||
Freagarach: Captial + period? | |||||
Done Inline ActionsThanks, will do! Nescio: Thanks, will do! | |||||
!target.getMetadata(PlayerID, "transport") && plan != -2 && plan != -3) | !target.getMetadata(PlayerID, "transport") && plan != -2 && plan != -3) | ||||
{ | { | ||||
this.garrisonSiegeUnit(gameState, target); | this.garrisonSiegeUnit(gameState, target); | ||||
continue; | continue; | ||||
} | } | ||||
if (!attacker || !attacker.position()) | if (!attacker || !attacker.position()) | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 285 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Captial + period?