Example #1
0
 /// <summary>
 /// Assigns a Turn based on the Default Settings.
 /// </summary>
 public void SetDefaultTurn()
 {
     try
     {
         currentTurn = CombatTurns.Player;
         if (TurnPhaseChanged != null)
         {
             TurnPhaseChanged();
         }
     }
     catch (Exception e)
     {
         Debug.Log("<color=red><b>Error: </b></color>" + e);
     }
 }
Example #2
0
 /// <summary>
 /// Sets the turn to the Requested Turn State.
 /// </summary>
 /// <param name="turn"></param>
 public void SetTurn(CombatTurns turn)
 {
     try
     {
         currentTurn = turn;
         if (TurnPhaseChanged != null)
         {
             TurnPhaseChanged();
         }
         if (TurnPhaseChanged != null)
         {
             TurnPhaseEnded();
         }
     }
     catch (Exception e)
     {
         Debug.Log("<color=red><b>Error: </b></color>" + e);
     }
 }
Example #3
0
    private void init(PlayerCharacter PC, Enemy enemy)
    {
        this.pc = PC;
        this.enemy = enemy;
        this.currentState = CombatStates.InCombat;

        Random random = new Random();

        if (random.Next(0, 101) <= 50)
        {
            this.currentTurn = CombatTurns.Player;
            this.firstTurn = CombatTurns.Player;
        }
        else
        {
            this.currentTurn = CombatTurns.Computer;
            this.firstTurn = CombatTurns.Computer;
            this.ProcessComputerTurn();
        }
    }
Example #4
0
    public void ProcessPlayerTurn(string attackName)
    {
        this.pc.Attack(attackName, this.enemy, this);

        if (this.enemy.CurrentHP <= 0)
        {
            this.currentState = CombatStates.Victory;
        }

        this.currentTurn = CombatTurns.Computer;
        this.ProcessComputerTurn();
    }
Example #5
0
    public void ProcessComputerTurn()
    {
        Attack enemyAttack = this.enemy.Attacks.FindLast(att => att.TPCost <= this.enemy.CurrentTP);
        this.enemy.Attack(enemyAttack.Name, this.pc, this);

        if (this.pc.CurrentHP <= 0)
        {
            this.currentState = CombatStates.Dead;
        }

        this.currentTurn = CombatTurns.Player;
    }