public void ResolveAbilities(ActorData actor, AbilityPriority priority)
        {
            AbilityData abilityData = actor.gameObject.GetComponent <AbilityData>();

            // I didn't find any code that calculates what an ability hits aside from UpdateTargeting which is
            // used to draw targeters on the client. In order for it to work on the server we need to
            // * set actor as active owned actor data -- calculations rely on this
            // * AppearAtBoardSquare to set actor's current board square
            // * patch TargeterUtils so that RemoveActorsInvisibleToClient isn't called on the server
            // * disable ActorData.IsVisibleToClient on server (break cover otherwise)
            // * ..?
            foreach (ActorTargeting.AbilityRequestData ard in actor.TeamSensitiveData_authority.GetAbilityRequestData())
            {
                Ability ability = abilityData.GetAbilityOfActionType(ard.m_actionType);

                if (ability.m_runPriority != priority)
                {
                    continue;
                }
                Log.Info($"Resolving {ability.m_abilityName} for {actor.DisplayName}");

                AbilityResolver resolver = GetAbilityResolver(actor, ability, priority, ard);
                resolver.Resolve();
                ActionsThisPhase.AddRange(resolver.Actions);
                Animations.AddRange(resolver.Animations);
                Utils.Add(TargetedActorsThisPhase, resolver.TargetedActors);
                Barriers.AddRange(resolver.Barriers);
            }
        }
Esempio n. 2
0
    public virtual void PlayCard()
    {
        Card card = Owner.Hand.PullCardOutofHand(this);

        AbilityResolver.AddCardAbilities(Abilities, true);
        MegaManager.CurrentPlayer.DiscardPile.PutCardInDiscardPile(card); //TODO: Should go into the play area!
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        cldr            = gameObject.GetComponent <Collider2D>();
        isSelected      = false;
        abilityResolver = GameManager.Instance.GetComponent <AbilityResolver>();
        selectedEvent.AddListener(abilityResolver.OnUnitSelectHandler);
        Debug.Log(gameObject.name);
        switch (gameObject.name)
        {
        case ("PlayerSwordsman(Clone)"):
            menu = GameManager.Instance.menuWarrior;
            break;

        case ("PlayerWizard(Clone)"):
            menu = GameManager.Instance.menuWizard;
            break;

        case ("PlayerHealer(Clone)"):
            menu = GameManager.Instance.menuWizard;
            break;

        default:
            break;
        }
    }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        abilityResolver = GetComponent <AbilityResolver>();

        List <GameObject> tempUnitList = new List <GameObject>();

        //Disable all menus
        menuWarrior.SetActive(false);
        menuWizard.SetActive(false);
        menuHealer.SetActive(false);

        //create the characters on the field in the desired slots
        foreach (GameObject unit in playerUnits)
        {
            List <FieldSlot> emptySlots = GetEmptySlots(playerSlots);
            if (emptySlots.Count == 0)
            {
                continue;
            }
            GameObject obj = Instantiate(unit, transform.position, Quaternion.identity);
            obj.transform.parent        = emptySlots[0].transform;
            obj.transform.localPosition = new Vector3(0, 0.1f, -1);
            tempUnitList.Add(obj);
        }
        playerUnits.Clear();
        playerUnits = tempUnitList.GetRange(0, tempUnitList.Count);
        tempUnitList.Clear();

        foreach (GameObject unit in enemyUnits)
        {
            List <FieldSlot> emptySlots = GetEmptySlots(enemySlots);
            if (emptySlots.Count == 0)
            {
                continue;
            }
            GameObject obj = Instantiate(unit, transform.position, Quaternion.identity);
            obj.transform.parent           = emptySlots[0].transform;
            obj.transform.localPosition    = Vector3.zero;
            obj.GetComponent <Unit>().team = Team.Enemy;
            tempUnitList.Add(obj);
        }
        enemyUnits = tempUnitList.GetRange(0, tempUnitList.Count);

        turnOrder = CreateTurnOrder();
        if (turnOrder[0].GetComponent <Unit>().team == Team.Player)
        {
            gameState = GameState.PlayerTurnMenu;
        }
        else
        {
            gameState = GameState.EnemyTurn;
        }
    }
Esempio n. 5
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }

        abilityStack = new List <ICardAbilityStep>();
        stepMachine  = new StepMachine();
    }
Esempio n. 6
0
 void SetupAbilityResolver()
 {
     AbilityResolver = new AbilityResolver();
 }