Beispiel #1
0
    public void RunAutocombatForActiveCharacter()
    {
        CharacterTeam opposingTeam = adventure.GetTeamOppositeOfFaction(activeCharacter.curFaction);
        CharacterTeam ownTeam      = adventure.GetTeamForFaction(activeCharacter.curFaction);

        SodaScript acScript = null;

        if (activeCharacter.curFaction == Faction.PLAYER)
        {
            acScript = activeCharacter.activeSodaScript;
        }
        else
        {
            acScript = defaultEnemyScript;
        }

        acScript.Execute(activeCharacter, adventure, cachedSkillCommand);

        //keep track of how many times a team has healed itself in a row. this is used inside of soda script execution to break out of infinite heal loops
        if (cachedSkillCommand.skill.isHealing)
        {
            ownTeam.consecutiveHeals++;
        }
        else
        {
            ownTeam.consecutiveHeals = 0;
        }

        adventure.ReceiveCommand(cachedSkillCommand);
    }
Beispiel #2
0
    public void ExecuteTriggers(CharacterData inActiveCharacter, Adventure inAdventure, SkillCommand inCommandToPopulate)
    {
        //store some data up front that will probably be useful
        activeCharacter = inActiveCharacter;
        adventure       = inAdventure;
        opposingTeam    = inAdventure.GetTeamOppositeOfFaction(activeCharacter.curFaction);
        ownTeam         = inAdventure.GetTeamForFaction(activeCharacter.curFaction);

        if (potentialTargets == null)
        {
            potentialTargets = new List <CharacterData>();
        }
        if (culledTargets == null)
        {
            culledTargets = new List <CharacterData>();
        }

        potentialSkill = null;

        //for a trigger to eval it needs a valid target, and the ability to cast the requested spell
        bool atLeastOneTriggerEvaluated = false;

        for (int i = 0; i < triggers.Count; i++)
        {
            if (EvalTrigger(triggers[i], inCommandToPopulate))
            {
                atLeastOneTriggerEvaluated = true;
                break;
            }
        }

        //if we made it this far, fall back to the default trigger that will always fire
        if (!atLeastOneTriggerEvaluated)
        {
            EvalTrigger(defaultTrigger, inCommandToPopulate);
        }


        //cleanup
        potentialTargets.Clear();
        culledTargets.Clear();
        potentialSkill = null;
    }