public void doMove(int moveNum) { // check for valid moveNum // add later incase i add moves rip int costSP = getMoveSetCost(moveNum); int recSP = getSPrecover(moveNum); Debug.Log("before calc recSP = " + recSP); int recHP = getHPrecover(moveNum); int baseDMG = getMoveBaseDMG(moveNum); int attackerDMG = getAdjustedDMG(baseDMG); bool guard = getGuard(); // gets if the one recieving move has guard up if (guard) // might decide to have crit ignore guard, when crit exists { attackerDMG = (int)(attackerDMG / 2); } if (turn.PlayerTurn) { if (moveNum == 6) { player.Guard = true; } enemy.HP -= attackerDMG; // must prevent spending more SP than have and such player.SP -= costSP; if (player.SP + recSP > player.MaxSP) { player.SP = player.MaxSP; Debug.Log("the SP rec is : " + (player.MaxSP - player.SP)); } else { player.SP += recSP; Debug.Log("the SP rec is : " + recSP); } if (player.HP + recHP > player.MaxHP) { player.HP = player.MaxHP; Debug.Log("the HP rec is : " + (player.MaxHP - player.HP)); } else { player.HP += recHP; Debug.Log("the HP rec is : " + recHP); } // update HP/SP bars player.updatePlayerBar(); enemy.updateEnemyBar(); // relinquish turn turn.PlayerTurn = false; turn.EnemyTurn = true; } else { Debug.Log("it is enemy's turn!"); } // UPDATE prevMove with the move that happened (number) (could be a miss or counter) }
public void doMove(int moveNum) { // check for valid moveNum if (moveNum < 0 || moveNum > 11) { Debug.Log("INVALID MOVE NUMBER, EXITING."); return; } // DELETE/FIX THIS LATER.... // animate.testAnimation("jab","hit"); int costSP = getMoveSetCost(moveNum); int recSP = getSPrecover(moveNum); int recHP = getHPrecover(moveNum); int baseDMG = getMoveBaseDMG(moveNum); int attackerDMG = getAdjustedDMG(baseDMG); bool guard = getGuard(); // gets if the one recieving move has guard up bool dazeEnemy = getDazeChance(moveNum); // If last move was Dazed, clear it now if (player.prevMove == 10) { player.Dazed = false; } // Halve damage of target is guarding if (guard) { attackerDMG = (int)(attackerDMG / 2); } // If you dazed enemy, set their status dazed = true if (dazeEnemy) { enemy.Dazed = true; } // If doing Guard move, set guard status = true if (moveNum == 6) { player.Guard = true; } // Update enemy HP with damage done, without going into negative if (enemy.HP > attackerDMG) { enemy.HP -= attackerDMG; } else { enemy.HP = 0; } // Should not be able to spend SP you don't have (prevented elsewhere) player.SP -= costSP; // Get the SP amount recovered this turn & update SP if (player.SP + recSP > player.MaxSP) { // Debug.Log("the SP rec is : " + (player.MaxSP - player.SP)); recSP = (player.MaxSP - player.SP); player.SP = player.MaxSP; } else { player.SP += recSP; // Debug.Log("the SP rec is : " + recSP); } // Get the HP amount recovered this turn & update HP if (player.HP + recHP > player.MaxHP) { // Debug.Log("the HP rec is : " + (player.MaxHP - player.HP)); recHP = (player.MaxHP - player.HP); player.HP = player.MaxHP; } else { player.HP += recHP; // Debug.Log("the HP rec is : " + recHP); } animate.playerTextRoll(recHP, recSP); // animate.playerHPText(recHP); // animate.playerSPText(recSP); animate.enemyHPText(-attackerDMG); // update HP/SP bars player.updatePlayerBar(); enemy.updateEnemyBar(); // UPDATE prevMove with the move that happened (number) (could be a miss or counter) player.prevMove = moveNum; Debug.Log("PLAYER MOVE NUMBER ==== " + moveNum); }