/*
Tiamat - a role-playing game framework
Attribute.java - used to store character attributes
 
 Copyright  (C) 2004 Hugues Johnson
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package com.huguesjohnson.tiamat;

import java.lang.String;
import java.lang.StringBuffer;
import com.huguesjohnson.tiamat.NamedObject;

/** Attribute - used to store character attributes
 * @author Hugues Johnson
 */
public class Attribute extends NamedObject{

/* begin public properties */
    //the base (initial) value for this attribute
    private long baseValue;
    /**
     * Returns the base (initial) value for this attribute.
     * @return The base (initial) value for this attribute.
     */
    public long getBaseValue(){ return(this.baseValue); }
    /**
     * Sets the base (initial) value for this attribute.
     * @param baseValue The new base value.
     */
    public void setBaseValue(long baseValue){ this.baseValue=baseValue; }
    //the current value for this attribute    
    private long currentValue;
    /**
     * Returns the current value for this attribute.
     * @return The current value for this attribute.
     */
    public long getCurrentValue(){ return(this.currentValue); }
    /**
     * Sets the current value for this attribute.
     * @param currentValue The new current value.
     */
    public void setCurrentValue(long currentValue){ this.currentValue=currentValue; }
/* end public properties */

/* begin constructors */
    //sets currentValue=baseValue
    /**
     * Create a new instance of Attribute.
     * @param name The name of this Attribute.
     * @param description The description of this Attribute.
     * @param baseValue The base (initial) value for this attribute, also sets the current value to this base value.
     */
    public Attribute(String name,String description,long baseValue){
        super(name,description);
        this.baseValue=this.currentValue=baseValue;
    }
    /**
     * Create a new instance of Attribute.
     * @param name The name of this Attribute.
     * @param description The description of this Attribute.
     * @param baseValue The base (initial) value for this attribute.
     * @param currentValue The current value for this attribute.
     */
    public Attribute(String name,String description,long baseValue,long currentValue){
        super(name,description);
        this.baseValue=baseValue;
        this.currentValue=currentValue;
    }
/* end constructors */
    
/* begin public methods */
    /** 
     * Returns a string representation of the object.
     * @return A string representation of the object. 
     */
    public String toString(){
        StringBuffer tostring=new StringBuffer(this.getClass().getName());
        tostring.append("\n  name="+this.getName());
        tostring.append("\n  description="+this.getDescription());
        tostring.append("\n  baseValue="+this.baseValue);
        tostring.append("\n  currentValue="+this.currentValue);
        return(tostring.toString());
    }
/* end public methods */
}