Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
Show First 20 Lines • Show All 1,302 Lines • ▼ Show 20 Lines | if (this.state == "") | ||||
let time = gameState.ai.elapsedTime; | let time = gameState.ai.elapsedTime; | ||||
let attackedByStructure = {}; | let attackedByStructure = {}; | ||||
for (let evt of events.Attacked) | for (let evt of events.Attacked) | ||||
{ | { | ||||
if (!this.unitCollection.hasEntId(evt.target)) | if (!this.unitCollection.hasEntId(evt.target)) | ||||
continue; | continue; | ||||
let attacker = gameState.getEntityById(evt.attacker); | let attacker = gameState.getEntityById(evt.attacker); | ||||
let ourUnit = gameState.getEntityById(evt.target); | let ourUnit = gameState.getEntityById(evt.target); | ||||
if (!ourUnit || !attacker || !attacker.position()) | if (!ourUnit || !ourUnit.position() || !attacker || !attacker.position()) | ||||
continue; | continue; | ||||
if (!attacker.hasClass("Unit")) | if (!attacker.hasClass("Unit")) | ||||
{ | { | ||||
attackedByStructure[evt.target] = true; | attackedByStructure[evt.target] = true; | ||||
continue; | continue; | ||||
} | } | ||||
if (PETRA.isSiegeUnit(ourUnit)) | if (PETRA.isSiegeUnit(ourUnit)) | ||||
{ // if our siege units are attacked, we'll send some units to deal with enemies. | { // if our siege units are attacked, we'll send some units to deal with enemies. | ||||
▲ Show 20 Lines • Show All 854 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator