/*
* 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;
public class StatBlock {
private int strength;
private int dexterity;
private int constitution;
private int intellegence;
private int wisdom;
private int charisma;
public StatBlock() {
strength = 10;
dexterity = 10;
constitution = 10;
intellegence = 10;
wisdom = 10;
charisma = 10;
}
public StatBlock(int strength, int dexterity, int constitution, int intellegence, int wisdom, int charisma) {
this.strength = strength;
this.dexterity = dexterity;
this.constitution = constitution;
this.intellegence = intellegence;
this.wisdom = wisdom;
this.charisma = charisma;
}
public int getStrength() {
return strength;
}
public void setStrength(int strength) {
this.strength = strength;
}
public int getDexterity() {
return dexterity;
}
public void setDexterity(int dexterity) {
this.dexterity = dexterity;
}
public int getConstitution() {
return constitution;
}
public void setConstitution(int constitution) {
this.constitution = constitution;
}
public int getIntellegence() {
return intellegence;
}
public void setIntellegence(int intellegence) {
this.intellegence = intellegence;
}
public int getWisdom() {
return wisdom;
}
public void setWisdom(int wisdom) {
this.wisdom = wisdom;
}
public int getCharisma() {
return charisma;
}
public void setCharisma(int charisma) {
this.charisma = charisma;
}
public int getCharStat(CharStat stat) {
int ret = 0;
switch (stat) {
case STR:
ret = strength;
break;
case DEX:
ret = dexterity;
break;
case CON:
ret = constitution;
break;
case INT:
ret = intellegence;
break;
case WIS:
ret = wisdom;
break;
case CHA:
ret = charisma;
break;
}
return ret;
}
public int getBonus(CharStat stat) {
int ret = getCharStat(stat);
//D&D bonus formula doesn't work for negative numbers since java rounds negative floats up
if (ret >= 10)
return (ret - 10) / 2;
else
return (ret - 10) / 2 - 1;
}
}