protected void ApplyDamage(CUseEffect.HpChange hpChange)
    {
        int ratioToAmount;

        switch (hpChange.ratioType)
        {
        case CUseEffect.HpChange.EHpRatioType.Current:
            ratioToAmount = hpChange.RatioToAmount(CurrentHp);
            break;

        case CUseEffect.HpChange.EHpRatioType.Max:
            ratioToAmount = hpChange.RatioToAmount(TotalMaxHp);
            break;

        case CUseEffect.HpChange.EHpRatioType.Lost:
            ratioToAmount = hpChange.RatioToAmount(TotalMaxHp - CurrentHp);
            break;

        default:
            Debug.LogWarning("Not Defined Ratio Type");
            ratioToAmount = 0;
            break;
        }

        int totalDamage = hpChange.fixedAmount + hpChange.enhancePercentRate + ratioToAmount;

        if (hpChange.isTrueDamage)
        {
            DamagedDisregardDefence(totalDamage);
        }
        else
        {
            DamegedRegardDefence(totalDamage);
        }
    }
    protected void ApplyHeal(CUseEffect.HpChange hpChange)
    {
        int ratioToAmount;

        switch (hpChange.ratioType)
        {
        case CUseEffect.HpChange.EHpRatioType.Current:
            Debug.LogWarning("힐에 현재 체력 비례 적용 불가");
            ratioToAmount = hpChange.RatioToAmount(CurrentHp);
            break;

        case CUseEffect.HpChange.EHpRatioType.Max:
            ratioToAmount = hpChange.RatioToAmount(TotalMaxHp);
            break;

        case CUseEffect.HpChange.EHpRatioType.Lost:
            ratioToAmount = hpChange.RatioToAmount(TotalMaxHp - CurrentHp);
            break;

        default:
            Debug.LogWarning("Not Defined Ratio Type");
            ratioToAmount = 0;
            break;
        }
        Heal(hpChange.fixedAmount + hpChange.enhancePercentRate + ratioToAmount);
    }
 public DamageOfTime(int id, CUseEffect.HpChange amount, float currentTime, float period)
 {
     this.id     = id;
     Amount      = amount;
     CurrentTime = currentTime;
     Period      = period;
 }
Exemple #4
0
    private static string CreateHpChangeText(CUseEffect.HpChange hpChange)
    {
        if (!hpChange.IsValid())
        {
            Debug.Log("Hp Change not settinged");
            return("");
        }

        string healDamageText = hpChange.isHeal ? "회복" : "데미지";
        string trueDamageText = (!hpChange.isHeal && hpChange.isTrueDamage) ? "방어 무시 " : "";

        string amountText = "";

        #region 체력 텍스트 만드는 부분
        if (hpChange.fixedAmount > 0)
        {
            amountText += hpChange.fixedAmount;
        }
        if (!String.IsNullOrEmpty(amountText))
        {
            amountText += " + ";
        }
        if (hpChange.enhancePercentRate > 0)
        {
            amountText += "공격력의 " + hpChange.enhancePercentRate + "%";
        }
        if (!String.IsNullOrEmpty(amountText))
        {
            amountText += " + ";
        }
        if (hpChange.ratioPercent > 0)
        {
            switch (hpChange.ratioType)
            {
            case CUseEffect.HpChange.EHpRatioType.Current:
                amountText += "현재 체력의 " + hpChange.ratioPercent + "%";
                break;

            case CUseEffect.HpChange.EHpRatioType.Max:
                amountText += "최대 체력의 " + hpChange.ratioPercent + "%";
                break;

            case CUseEffect.HpChange.EHpRatioType.Lost:
                amountText += "잃은 체력의 " + hpChange.ratioPercent + "%";
                break;

            default:
                break;
            }
        }
        #endregion

        string totalText = amountText + "만큼 " + trueDamageText + healDamageText;

        return(totalText);
    }
 // 체력 변화 처리함수
 protected void ApplyHpChange(CUseEffect.HpChange hpChange)
 {
     if (hpChange.isHeal)
     {
         ApplyHeal(hpChange);
     }
     else
     {
         ApplyDamage(hpChange);
     }
 }