/* * Copyright (C) 2012 Joe AmRhein * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.arconus.dicecommander.model.entities.character; import com.arconus.dicecommander.model.entities.character.power.CharPower; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; public class GameCharacter implements Comparable<GameCharacter> { private UUID id; private String name; private int level; private List<CharPower> charPowers; private StatBlock statBlock; private SkillAttributes[] skillAttributes; public GameCharacter() { init(""); } private void init(String name) { id = UUID.randomUUID(); this.name = name; level = 1; charPowers = new ArrayList<CharPower>(); statBlock = new StatBlock(); skillAttributes = new SkillAttributes[17]; for (int i = 0; i < skillAttributes.length; i++) { skillAttributes[i] = new SkillAttributes(); } } public String getId() { return id.toString(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public void addCharPower(CharPower charPower) { charPowers.add(charPower); Collections.sort(charPowers); } public List<CharPower> getCharPowers() { return charPowers; } public void setCharPowers(List<CharPower> charPowers) { this.charPowers = charPowers; } public void removeCharPower(int position) { charPowers.remove(position); } public StatBlock getStatBlock() { return statBlock; } public void setStatBlock(StatBlock statBlock) { this.statBlock = statBlock; } public String toString() { return name; } @Override public int compareTo(GameCharacter another) { return name.compareTo(another.getName()); } }