Ejemplo n.º 1
0
    private void DoApplyTurnOutcome(Outcome outcome, TeamManager.ActionData attackerAction, TeamManager.ActionData defenderAction)
    {
        switch (outcome)
        {
        case Outcome.Parry:
        {
            Melee attackerMeleeAction = (Melee)attackerAction.Action;
            _teamManager.ApplyTeamStaminaChange(attackerAction.TeamID, attackerAction.PlayerID, -(int)attackerMeleeAction.StaminaCost);
            _phaseManager.EnablePhaseSwapForNextSetup();
            break;
        }

        case Outcome.Defend:
        {
            Melee attackerMeleeAction = (Melee)attackerAction.Action;
            Melee defenderMeleeAction = (Melee)defenderAction.Action;
            _teamManager.ApplyTeamStaminaChange(attackerAction.TeamID, attackerAction.PlayerID, -(int)attackerMeleeAction.StaminaCost);
            _teamManager.ApplyTeamStaminaChange(defenderAction.TeamID, defenderAction.PlayerID, -(int)(attackerMeleeAction.StaminaCost + defenderMeleeAction.DefensiveStaminaPenalty));
            break;
        }

        case Outcome.Hit:
        {
            Melee attackerMeleeAction = (Melee)attackerAction.Action;
            _teamManager.ApplyTeamStaminaChange(attackerAction.TeamID, attackerAction.PlayerID, -(int)attackerMeleeAction.StaminaCost);
            _teamManager.ApplyTeamHealthChange(defenderAction.TeamID, defenderAction.PlayerID, -(int)attackerMeleeAction.StaminaCost);
            break;
        }

        case Outcome.ItemUse:
        {
            if (defenderAction.Action.Type == Action.ActionType.ITEM)
            {
                Item defenderItemAction = (Item)defenderAction.Action;
                _teamManager.ApplyTeamHealthChange(defenderAction.TeamID, defenderAction.PlayerID, defenderItemAction.HealthEffect);
                _teamManager.ApplyTeamStaminaChange(defenderAction.TeamID, defenderAction.PlayerID, defenderItemAction.StaminaEffect);
                //Process debuff
                _teamManager.ApplyTeamDebuff(attackerAction.TeamID, attackerAction.PlayerID, defenderItemAction.DebuffEffect);
            }

            if (attackerAction.Action.Type == Action.ActionType.ITEM)
            {
                Item attackerItemAction = (Item)attackerAction.Action;
                _teamManager.ApplyTeamHealthChange(attackerAction.TeamID, attackerAction.PlayerID, attackerItemAction.HealthEffect);
                _teamManager.ApplyTeamStaminaChange(attackerAction.TeamID, attackerAction.PlayerID, attackerItemAction.StaminaEffect);
                //Process debuff
                _teamManager.ApplyTeamDebuff(defenderAction.TeamID, defenderAction.PlayerID, attackerItemAction.DebuffEffect);
                _phaseManager.EnablePhaseSwapForNextSetup();
            }
            else
            {
                Melee attackerMeleeAction = (Melee)attackerAction.Action;
                _teamManager.ApplyTeamStaminaChange(attackerAction.TeamID, attackerAction.PlayerID, -(int)attackerMeleeAction.StaminaCost);
                _teamManager.ApplyTeamHealthChange(defenderAction.TeamID, defenderAction.PlayerID, -(int)attackerMeleeAction.StaminaCost);
            }
            break;
        }
        }

        _phaseManager.PhaseSetup();
    }