oldbody = 0
oldmind = 0
oldsoul = 0
attackCombatMasteryACV = 0
defenseCombatMasteryDCV = 0
toughHP = 0
notSoToughHP = 0


function changeBody(){
	oldtotalpoints = document.sasCharacter.totalpoints.value
	newtotalpoints = oldtotalpoints-oldbody*2
	body = document.sasCharacter.bodystat.value
	oldbody = body
	bodycost = body*2
	document.sasCharacter.bodyCost.value = bodycost
	document.sasCharacter.totalpoints.value = bodycost+newtotalpoints
	changeACV(attackCombatMasteryACV)
	changeHP()
	}
	
function changeMind(){
	oldtotalpoints = document.sasCharacter.totalpoints.value
	newtotalpoints = oldtotalpoints-oldmind*2
	mind = document.sasCharacter.mindstat.value
	oldmind = mind
	mindcost = mind*2
	document.sasCharacter.mindCost.value = mindcost
	document.sasCharacter.totalpoints.value = mindcost+newtotalpoints
	changeACV(attackCombatMasteryACV)
	}
	
function changeSoul(){
	oldtotalpoints = document.sasCharacter.totalpoints.value
	newtotalpoints = oldtotalpoints-oldsoul*2
	soul = document.sasCharacter.soulstat.value
	oldsoul = soul
	soulcost = soul*2
	document.sasCharacter.soulCost.value = soulcost
	document.sasCharacter.totalpoints.value = soulcost+newtotalpoints
	changeACV(attackCombatMasteryACV)
	changeHP()
	}

function changeACV(sentACV){
	
	newACV = Math.floor((eval(oldbody)+eval(oldmind)+eval(oldsoul))/3)
	modifiedACV = eval(newACV) + eval(sentACV)
	document.sasCharacter.acv.value = modifiedACV
	changeDCV(defenseCombatMasteryDCV)
}

function changeDCV(sentDCV){
	newDCV = Math.floor((eval(oldbody)+eval(oldmind)+eval(oldsoul))/3) - 2
	modifiedDCV = eval(newDCV) + eval(sentDCV)
	document.sasCharacter.dcv.value = modifiedDCV
}

function changeHP(){
	newHP = (eval(oldbody)+eval(oldsoul))*5
	modifiedHP = eval(newHP)+eval(toughHP)+eval(notSoToughHP)
	document.sasCharacter.hp.value = modifiedHP
}