
/*
 * The Root Component also track of an actor's basic body attributes.

 * Body Types:
 *    humanoid    Two arms, two legs, head on top, junk on bottom.
 *    quadruped   Four legs.
 *    taur        Four legs, humanoid torso in front.
 *    naga        Snake tail, humanoid torso on top.
 *    dryder      Eight legs, two arms
 */
var ComponentControl_root = {

  parts:['arms','legs'],
  partsSingular:['chest','chest','head','face','arm','leg'],

  quadParts:['legs','forelegs','hindlegs'],
  quadPartsSingular:['chest','chest','flank','back','back','head','leg','foreleg','hindleg'],

  nagaParts:['arms'],
  nagaPartsSingular:['chest','chest','back','back','head','tail','tail','tail'],

  taurParts:['arms','forelegs','hindlegs'],
  taurPartsSingular:['chest','chest','flank','back','face','arm','leg','foreleg','hindleg'],

  dryderParts:['arms','legs','legs','legs'],
  dryderPartsSingular:['chest','chest','abdomen','abdomen','back','face','arm','leg','leg','leg'],

  grow: function(actor) {},
  shrink: function(actor) {},
  add: function(actor,type) {},
  remove: function(actor) {},
  change: function(actor,type) {},

  /* One word description */
  describeRandomPart: function(actor,root,isSingular) {
    var root = actor.getComponents()['root'] || 'humanoid';

    if (root.type == 'humanoid') {
      return isSingular ?
        Util.selectAtRandom(this.partsSingular) :
        Util.selectAtRandom(this.parts);
    }
    if (root.type == 'quadruped') {
      return isSingular ?
        Util.selectAtRandom(this.quadPartsSingular) :
        Util.selectAtRandom(this.quadParts);
    }
    if (root.type == 'naga') {
      return isSingular ?
        Util.selectAtRandom(this.nagaPartsSingular) :
        Util.selectAtRandom(this.nagaParts);
    }
    if (root.type == 'taur') {
      return isSingular ?
        Util.selectAtRandom(this.nagaPartsSingular) :
        Util.selectAtRandom(this.nagaParts);
    }
    if (root.type == 'dryder') {
      return isSingular ?
        Util.selectAtRandom(this.dryderPartsSingular) :
        Util.selectAtRandom(this.dryderParts);
    }

    throw "(ComponentRoot) Unrecognized body type: "+root.type;
  },

  getEquipmentSlots: function(actor) {
    return [
      { name:'Weapon', slot:'weapon'},
      { name:'Armor',  slot:'chest'},
      { name:'Helmet', slot:'head'},
    ];
  },

};
