/********************************************************************************************/ /**************************************** Character Actions *********************************/ /********************************************************************************************/ // This will likely move to one big ugly filewith every ability public void doAction() { List <CharacterClass> targetsToDo = null; /************************************************** MOVING ******************************/ if (actionToDo.name == "Move") { int[] tempOldCoords = actionFrom.battleLocation; int tempIntDistance = map.getIntDistanceFromCoords(tempOldCoords, coords); // If destination is in range if (tempIntDistance <= actionFrom.MP) { // Immediately set position to where you chose to move to //setToPosition (actionFrom, coords [0], coords [1]); currentPos = actionFrom.battleAvatar.transform.position; moveTarget = map.getAbovePosFromCoords(coords[0], coords[1]); isMoving = true; actionFrom.MP -= map.getIntDistanceFromCoords(tempOldCoords, coords); } else { print("Insufficient MP, " + actionFrom.MP.ToString() + " of " + tempIntDistance.ToString()); continueTurn(); } actionToDo = null; /************************************************ ATTACKING *****************************/ } else if (actionToDo.name == "Basic Attack") { print("Attacking Time"); string battleMessage = actionFrom.Attack(actionTo); // Check if you killed the target if (actionTo.checkDead()) { killCharacter(actionTo); } actionToDo = null; endCharacterTurn(); /************************************************ SPECIAL *******************************/ } else if (actionToDo != null) { if (actionToDo.targetingType == "Single") { if (actionToDo.cast(actionTo)) { killCharacter(actionTo); } } else if (actionToDo.targetingType == "Area") { // If we've selected an area to cast on, cycle through the appropriate targets and apply the ability if (actionToDo.targets == "Enemy") { targetsToDo = getEnemiesInRange(coords[0], coords[1], areaRange, actionFrom.team); } else if (actionToDo.targets == "Ally") { targetsToDo = getAlliesInRange(coords[0], coords[1], areaRange, actionFrom.team); } else if (actionToDo.targets == "All") { targetsToDo = getCharactersInRange(coords[0], coords[1], areaRange); } targetsToDo = getEnemiesInRange(coords[0], coords[1], areaRange, actionFrom.team); for (int i = 0; i < targetsToDo.Count; i++) { if (actionToDo.cast(targetsToDo [i])) { // If it kills killCharacter(targetsToDo [i]); } ; } actionToDo.doAnimation(map.getAbovePosFromCoords(coords [0], coords [1])); } actionToDo = null; endCharacterTurn(); } }