rem: break; 
add: break; 
context: function entityInit(){	// Initialise an entity when it is first spawned (generate starting hitpoints, etc).	this.addCreateQueue = entityAddCreateQueue;		// Generate civ code (1st four characters of civ name, in lower case eg "Carthaginians" => "cart").	if (this.traits.id && this.traits.id.civ)	{		this.traits.id.civ_code = this.traits.id.civ.toString().substring (0, 4)		this.traits.id.civ_code = this.traits.id.civ_code.toString().toLowerCase()		// Exception to make the Romans into rome.		if (this.traits.id.civ_code == "roma") this.traits.id.civ_code = "rome"		// Exception to make the Hellenes into hele.		if (this.traits.id.civ_code == "hell") this.traits.id.civ_code = "hele"	}	// If entity can contain garrisoned units, empty it.	if (this.traits.garrison && this.traits.garrison.max)		this.traits.garrison.curr = 0	// If entity has health, set current to same.	if (this.traits.health && this.traits.health.max)		this.traits.health.curr = this.traits.health.max	if (this.traits.supply)	{		// If entity has supply, set current to same.		if (this.traits.supply.max)			this.traits.supply.curr = this.traits.supply.max		// If entity has type of supply and no subtype, set subtype to same		// (so we don't have to say type="wood", subtype="wood"		if (this.traits.supply.type && !this.traits.supply.subtype)			this.traits.supply.subtype = this.traits.supply.type	}	if (!this.traits.promotion)		this.traits.promotion = new Object();			// If entity becomes another entity after it gains enough experience points, set up secondary attributes.	if (this.traits.promotion.req)	{		// Get the name of the entity. (I wish there was a safer way of doing it, but currently unravelling the exported template string.)		entityName = this.template.toString()		entityName = entityName.substring (24, entityName.length - 1)			// Determine whether current is basic, advanced or elite, and set rank to suit.		switch (entityName.substring (entityName.length-2, entityName.length))		{			case "_b":				// Basic. Upgrades to Advanced.				this.traits.promotion.rank="1"				nextSuffix = "_a"			break;			case "_a":				// Advanced. Upgrades to Elite.				this.traits.promotion.rank="2"				nextSuffix = "_e"			break;			case "_e":				// Elite. Maximum rank.				this.traits.promotion.rank="3"				nextSuffix = ""			break;			default:				// Does not gain promotions.				this.traits.promotion.rank="0"				nextSuffix = ""			break;		}			// The entity it should become (unless specified otherwise) is the base entity plus promotion suffix.		if (!this.traits.promotion.newentity && nextSuffix != "" && this.traits.promotion.rank != "0")			this.traits.promotion.newentity = entityName.substring (1, entityName.length-2) + nextSuffix		// If entity is an additional rank and the correct actor has not been specified		// (it's just inherited the Basic), point it to the correct suffix. (Saves us specifying it each time.)		actorStr = this.actor.toString();		if (this.traits.promotion.rank > "1"			&& actorStr.substring (actorStr.length-5, actorStr.length) != nextSuffix + ".xml")			this.actor = actorStr.substring (1,actorStr.length-5) + nextSuffix + ".xml";	}	else		this.traits.promotion.rank="0"	// Attach Auras if the entity is entitled to them.	if ( this.traits.auras )	{		for ( name in this.traits.auras )		{			console.write ( "Creating " + name + " aura for " + this + ".");			switch ( name )			{				case "courage":					a = this.traits.auras.courage;					this.addAura ( name, a.radius, new DamageModifyAura( this, true, a.bonus ) );				break;				case "fear":					a = this.traits.auras.fear;					this.addAura ( name, a.radius, new DamageModifyAura( this, false, -a.bonus ) );				break;				case "infidelity":					a = this.traits.auras.infidelity;					this.addAura ( name, a.radius, new InfidelityAura( this ) );				break;				default:					console.write ( "Unknown aura: " + name + " on " + this + "; ignoring it." );				break;			}		}	}			if (!this.traits.id)		this.traits.id = new Object();/*		// Generate entity's personal name (if it needs one).	if (this.traits.id.personal)	{		// todo		// Look in the appropriate array for a random string.		switch (this.traits.id.classes[])		{			case "Male":				this.traits.id.personal.table1 = "Male"			break;			case "Female":				this.traits.id.personal.table1 = "Female"			break;			default:				this.traits.id.personal.table1 = "Gen"			break;			}						this.traits.id.personal.name = getRandom (this.traits.id.civ_code + this.traits.id.personal.table1 + "1")		this.traits.id.personal.name = this.traits.id.personal.name + " " + getRandom (this.traits.id.civ_code + this.traits.id.personal.table1 + "2")	}	else		this.traits.id.personal.name = "";*/	// Log creation of entity to console.	//if (this.traits.id.personal && this.traits.id.personal.name)	//	console.write ("A new " + this.traits.id.specific + " (" + this.traits.id.generic + ") called " + this.traits.id.personal.name + " has entered your dungeon.")	//else		//	console.write ("A new " + this.traits.id.specific + " (" + this.traits.id.generic + ") has entered your dungeon.")}
meta: 1070	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1070/c6c006d4fe66743bdc399a80e96340a90ca4203c/template_entity_script.js/buggy/binaries/data/mods/official/entities/template_entity_script.js