Ejemplo n.º 1
0
    //Used mostly for 1 on 1 actions
    //TODO: Refactor the if statment in these functions and put it into a single function
    //TODO: Change this to use the perform action model for parameters
    public void PerformActionSingle(GenericActionModel aAction, GenericCharacter aAttacker, GenericCharacter aDefender)
    {
        Debug.Log("Performing 1 on 1 action");
        Debug.Log("Action name from dictionary: " + aAction.GetActionName());

        if (aAction.GetDoesActionDamage())
        {
            ApplyDamage(aDefender, aAttacker, aAction);
        }

        if (aAction.GetDoesActionHeal())
        {
            ApplyHeal(aDefender, aAttacker, aAction);
        }

        if (aAction.GetDoesActionHaveAffix())
        {
            List <ActionData.AFFIX_LIST_ID> affixList = aAction.GetListOfAffixes();

            if (affixList.Count != 0)
            {
                for (int i = 0; i < affixList.Count; i++)
                {
                    ApplyAffix(aDefender, ActionData.AFFIX_DICTIONARY[affixList[i]]);
                }
            }
        }
    }
Ejemplo n.º 2
0
    //Expose UseAction()
    // -> Have it look at the information from the action and do stuff based on it.

    public void PerformAction(PerformActionDataModel aPerformActionDataModel)
    {
        Debug.Log("Performing Action");

        //TODO: Maybe make null checks around this
        GenericActionModel action         = ActionData.ABILITY_DICTIONARY[aPerformActionDataModel.GetActionID()];
        GenericCharacter   actionUser     = aPerformActionDataModel.GetAttackerData();
        GenericCharacter   actionDefender = aPerformActionDataModel.GetDefenderData();

        if (action != null)
        {
            switch (aPerformActionDataModel.GetTargetAmount())
            {
            case GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET:
                if (actionUser != actionDefender)
                {
                    PerformActionSingle(action, actionUser, actionDefender);
                }
                else if (actionUser == actionDefender)
                {
                    PerformSelfAction(action, actionUser);
                }
                break;

            case GenericActionModel.ACTION_TARGET_AMOUNT.ALL_TARGETS:
                PerformActionAll(action, actionUser);
                break;

            case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE:
                PerformMultiOffensiveAction(action, actionUser);
                break;

            case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE:
                PerformMultiDefensiveAction(action, actionUser);
                break;

            default:
                Debug.Log("Error: Action does not have a target amount type, or is set to none.");
                break;
            }
        }
        else
        {
            Debug.Log("ERROR: Action is null/does not exist!");
        }
    }
Ejemplo n.º 3
0
    public void PerformMultiDefensiveAction(GenericActionModel aAction, GenericCharacter aDefender)
    {
        Debug.Log("Performing multi defensive action");
        Debug.Log("Action name from dictionary: " + aAction.GetActionName());

        int hitTracking = 0;

        for (int i = 0; i < GameManager.GetPlayerManager.GetCharacterList().Count; i++)
        {
            GenericCharacter genericCharacter = GameManager.GetPlayerManager.GetCharacterList()[i];

            if (genericCharacter.IsPlayerControlled() == true)
            {
                if (aAction.GetDoesActionDamage())
                {
                    ApplyDamage(genericCharacter, aDefender, aAction);
                    hitTracking++;
                }

                if (aAction.GetDoesActionHeal())
                {
                    ApplyHeal(genericCharacter, aDefender, aAction);
                    hitTracking++;
                }

                if (aAction.GetDoesActionHaveAffix())
                {
                    List <ActionData.AFFIX_LIST_ID> affixList = aAction.GetListOfAffixes();

                    if (affixList.Count != 0)
                    {
                        for (int j = 0; j < affixList.Count; j++)
                        {
                            ApplyAffix(genericCharacter, ActionData.AFFIX_DICTIONARY[affixList[j]]);
                        }
                    }
                }
            }
        }

        Debug.Log("Action hit " + hitTracking + " times");
    }
Ejemplo n.º 4
0
    public PerformActionDataModel CreatePerformActionDataModel(ActionData.ACTION_LIST_ID aActionID)
    {
        GenericActionModel     actionModel     = ActionData.ABILITY_DICTIONARY[aActionID];
        PerformActionDataModel actionDataModel = null;

        switch (actionModel.GetActionTargetAmount())
        {
        case GenericActionModel.ACTION_TARGET_AMOUNT.ALL_TARGETS:
            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.ALL_TARGETS, GetComponentInParent <GenericCharacterController>().GetCharacterStats());
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE:
            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE, GetComponentInParent <GenericCharacterController>().GetCharacterStats());
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE:
            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE, GetComponentInParent <GenericCharacterController>().GetCharacterStats());
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET:
            GenericCharacter defender;

            if (actionModel.GetActionOffOrDef() == GenericActionModel.ACTION_OFF_OR_DEF.DEFENSIVE)
            {
                defender = GetRandomNonPlayerCharacter();
            }
            else
            {
                defender = GetRandomPlayerCharacter();
            }

            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, GetComponentInParent <GenericCharacterController>().GetCharacterStats(), defender);
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.NO_TARGETS:
        default:
            Debug.Log("ERROR: Tried to create an action model through the AI component but the target type is none or null.");
            break;
        }

        return(actionDataModel);
    }
 public ActionResult(string v, GenericActionModel responseModel)
 {
     this.v             = v;
     this.responseModel = responseModel;
 }
        public override ActionResult GenerateView(Response response)
        {
            GenericActionModel responseModel = new GenericActionModel(true, "/", "Home", "An unknown error has occured. The system administrator has been notified. Error code:" + response.name, false);

            return(new ActionResult("~/Views/Shared/GenericAction.cshtml", responseModel));
        }
        public override ActionResult GenerateView(Response response)
        {
            GenericActionModel responseModel = new GenericActionModel(true, "/ResetPassword", "Reset Password", "You have submitted an expired password reset link. You must reset your password again to change it.", false);

            return(new ActionResult("~/Views/Shared/GenericAction.cshtml", responseModel));
        }
        public override ActionResult GenerateView(Response response)
        {
            GenericActionModel responseModel = new GenericActionModel(true, "/Login", "Login", "You have submitted an invalid password reset link.", false);

            return(new ActionResult("~/Views/Shared/GenericAction.cshtml", responseModel));
        }