function playerAttack() {

    // Restrict command-bar
    setCommandAvailability(false);

    // Check if enemy will evade this attack. If they do, a message is displayed
    if (!didEvade(enemy.evasMod, enemy.name)) {
      // Calculate damage
      let damage = calculateDamage(player.damMod);

      // Subtract damage from enemy HP
      setEnemyHP(enemyHP - damage);

      // Show message declaring the amount of damage dealt
      dispatch({
        type: CHANGE_MESSAGE,
        payload: `You dealt ${damage} points of damage to the ${enemy.name}`,
      })
    }

    // End the player's turn regardless of whether it hit or missed
    setPlayerTurn(false);
  }
// The player decides to make an attack
The player decides to make an attack
The player decides to make an attack
function playerAttack() {
    setCommandAvailability(false);
    if (!didEvade(enemy.evasMod, enemy.name)) {
      let damage = calculateDamage(player.damMod);
      setEnemyHP(enemyHP - damage);
      dispatch({
        type: CHANGE_MESSAGE,
        payload: `You dealt ${damage} points of damage to the ${enemy.name}`,
      })
    }
    setPlayerTurn(false);
  }
function playerAttack ( ) { setCommandAvailability ( false ) ; if ( ! didEvade ( enemy . evasMod , enemy . name ) ) { let damage = calculateDamage ( player . damMod ) ; setEnemyHP ( enemyHP - damage ) ; dispatch ( { type : CHANGE_MESSAGE , payload : ` ${ damage } ${ enemy . name } ` , } ) } setPlayerTurn ( false ) ; }
The player decides to make an attack
The player decides to make an attack
// Restrict command-bar // Check if enemy will evade this attack. If they do, a message is displayed // Calculate damage // Subtract damage from enemy HP // Show message declaring the amount of damage dealt // End the player's turn regardless of whether it hit or missed