Esempio n. 1
0
    public void getAttacked(int rawDamage)
    {
        int dmg        = rawDamage - armor;
        int blockValue = 0;

        if (activeBlock != null)
        {
            blockValue = activeBlock.blockValue;
        }
        dmg        -= blockValue;
        dmg         = Mathf.Max(0, dmg);
        health     -= dmg;
        activeBlock = null;
        refreshUI();
        FloatingDamageTextController.Instance().createFloatingDamageText(transform, rawDamage, armor, blockValue, dmg);

        if (health <= 0)
        {
            if (playerCharacter)
            {
                GameAlertUI.Instance().setText("You died!");
            }
            else
            {
                TurnMaster.Instance().handleEnemyDeath(this);
                Destroy(gameObject);
            }
        }
    }
Esempio n. 2
0
    public void resolveTargeting(Targetable target)
    {
        this.target = target;
        GameAlertUI.Instance().deactivateText();
        if (targetCategory == TargetCategory.Enemy)
        {
            CombatCharacter targetCharacter = target as CombatCharacter;

            //Debug.Log("Resolve Targeting");
            if ((!undodgeable) && targetCharacter.checkDodge(details.character))
            {
                FloatingDamageTextController.Instance().createDodgeText(targetCharacter.transform);
                this.target = null;
            }
            else
            {
                //Debug.Log("Not dodged");
            }
        }

        if (targetOnResolution)
        {
            abilityResolve = true;
            activateTargetAbility();
        }
        else
        {
            precastResolve = true;
        }
    }
Esempio n. 3
0
    protected void startListening()
    {
        listeningStarted = true;
        GameObject go = Instantiate(PrefabDictionary.Instance().targetListener, details.cardBase.transform);

        targetListener = go.GetComponent <TargetListener>();
        targetListener.targetCatgeory = targetCategory;
        targetListener.targetSource   = details.cardBase;
        targetListener.sourceAbility  = this;
        GameAlertUI.Instance().setText(getAlertPromptText());
    }
    public override void preCastTriggerOther(CardDetails details)
    {
        precastResolve = false;
        this.details   = details;
        GameObject go = Instantiate(PrefabDictionary.Instance().multiTargetListener, details.cardBase.transform);

        targetListener = go.GetComponent <MultiTargetListener>();
        targetListener.targetCatgeory           = targetCategory;
        targetListener.targetSource             = details.cardBase;
        targetListener.multiTargetSourceAbility = this;
        targetListener.targetCount   = targetCount;
        targetListener.uniqueTargets = uniqueTargets;
        GameAlertUI.Instance().setText(getAlertPromptText());
    }
    public void resolveTargeting(List <Targetable> targets)
    {
        this.targets   = targets;
        precastResolve = true;
        GameAlertUI.Instance().deactivateText();
        if (targetCategory == TargetCategory.Enemy)
        {
            for (int i = targets.Count - 1; i >= 0; i--)
            {
                CombatCharacter targetCharacter = this.targets[i] as CombatCharacter;

                //Debug.Log("Resolve Targeting");
                if ((!undodgeable) && targetCharacter.checkDodge(details.character))
                {
                    FloatingDamageTextController.Instance().createDodgeText(targetCharacter.transform);
                    this.targets.RemoveAt(i);
                }
                else
                {
                    //Debug.Log("Not dodged");
                }
            }
        }
    }