// プレイヤクラス
function Player()
{
    // 名前
    this.name = "noname";
    
    // プレイヤパラメータを決めるためのウェイト値
    this.hitPointWeight = 0;
    this.attackPointWeight = 0;
    this.defencePointWeight = 0;
    this.quicknessPointWeight = 0;

    // 実際のパラメータ
    this.hitPoint = 0;
    this.attackPoint = 0;
    this.defencePoint = 0;
    this.quicknessPoint = 0;
    
    // 対戦相手により決定される値。
    this.attackProbability = 1;

    // メンバメソッド

    // パラメータウェイトを元に実際のパラメータを算出する。
    this.setupParameters = function()
    {
        // パラメータが0にならないように調整する。
        if(this.hitPointWeight < 1) this.hitPointWeight = 1;
        if(this.attackPointWeight < 1) this.attackPointWeight = 1;
        if(this.defencePointWeight < 1) this.defencePointWeight = 1;
        if(this.quicknessPointWeight < 1) this.quicknessPointWeight = 1;

        // パラメータ値は合計100になるように計算する。
        var totalWeight = this.hitPointWeight + this.attackPointWeight + this.defencePointWeight + this.quicknessPointWeight;

        this.hitPoint = this.hitPointWeight * 100 / totalWeight;
        this.attackPoint = this.attackPointWeight * 100  / totalWeight;
        this.defencePoint = this.defencePointWeight * 100  / totalWeight;
        this.quicknessPoint = this.quicknessPointWeight * 100  / totalWeight;
    }
}
