= evt.inflictor.traits.up.req) { // Notify the player. if (this.traits.id.specific) console.write(this.traits.id.specific + " has gained a promotion!"); else console.write("One of your units has gained a promotion!"); // Reset his upgrade points. evt.inflictor.traits.up.curr = 0; // Transmogrify him into his next rank. evt.inflictor.template = getEntityTemplate(evt.inflictor.traits.up.newentity); } } // If the fallen is worth any loot, if (this.traits.loot && (this.traits.loot.food || this.traits.loot.wood || this.traits.loot.stone || this.traits.loot.ore)) { // Give the inflictor his resources. if (this.traits.loot.food) getGUIGlobal().GiveResources("Food", parseInt(this.traits.loot.food)); if (this.traits.loot.wood) getGUIGlobal().GiveResources("Wood", parseInt(this.traits.loot.wood)); if (this.traits.loot.stone) getGUIGlobal().GiveResources("Stone", parseInt(this.traits.loot.stone)); if (this.traits.loot.ore) getGUIGlobal().GiveResources("Ore", parseInt(this.traits.loot.ore)); } // Notify player. if( evt.inflictor ) console.write( this.traits.id.generic + " got the point of " + evt.inflictor.traits.id.generic + "'s Gladius." ); else console.write( this.traits.id.generic + " died in mysterious circumstances." ); // Make him cry out in pain. curr_pain = getGUIGlobal().newRandomSound("voice", "pain", this.traits.audio.path); curr_pain.play(); // We've taken what we need. Kill the swine. this.kill(); } else if( evt.inflictor && this.actions.attack ) { // If we're not already doing something else, take a measured response - hit 'em back. // You know, I think this is quite possibly the first AI code the AI divlead has written // for 0 A.D.... if( this.isIdle() ) this.order( ORDER_ATTACK, evt.inflictor ); } ]]>