/// <reference path="../../Bodypart.ts" />
/// <reference path="../../Humanoid/Humanoid.ts" />
/// <reference path="../SexStick.ts" />
/// <reference path="../SexHole.ts" />
/// <reference path="../../../Measure.ts" />
class HumanoidExtremity extends Bodypart {
    public nailsPainted : boolean = false;
    public nailColor = 0;
    public static nailColorNames = ['none', 'red', 'pink'];

    public static getColor (index : number) {
        return HumanoidExtremity.nailColorNames[index];
    }

    public constructor (options? : ThingOptions) {
        super(options);
        this.addGetAlterations((thing) => {
            return {
                Painted : this.nailsPainted,
                Color : this.nailColor
            }
        });

        this.addSetAlterations((thing, changes) => {
            this.nailsPainted = changes.Painted;
            this.nailColor = changes.Color;
        });
    }

    public getSluttiness () {
        return this.getGenderValue();
    }

    public getGenderValue () {
        let nailPaintedCorrection = this.nailColor * 50; // TODO: Don't leave this as-is... there should be plenty of colors.
        let nailPaintedCorrectionWeight = this.nailsPainted ? 3 : 0;

        let gv = this.genderValue;
        let gw = this.genderWeight;

        return ((gv * gw) + (nailPaintedCorrection * nailPaintedCorrectionWeight)) / (gw + nailPaintedCorrectionWeight);
    }

    public arrangeGenderValue (gv : number) {
        this.genderValue = gv; // TODO: This will be extremity size/appearance. Maybe make it more detailed if interested.
        this.nailsPainted = gv > 60;
        if (this.nailsPainted) {
            if (gv > 70) {
                this.nailColor = 2;
            } else {
                this.nailColor = 1;
            }
        }
        (<Humanoid> this.getPartOne()).invalidateCaches();
    }
}