Exemple #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);
            }
        }
    }
    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;
        }
    }
    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");
                }
            }
        }
    }