コード例 #1
0
ファイル: Creature.cs プロジェクト: tapenjoyGame/cry
    public string GetStatString(bool default_value)
    {
        var stat_string = "";

        foreach (eStatType type in Enum.GetValues(typeof(eStatType)))
        {
            if ((int)type >= 100)
            {
                continue;
            }

            if (default_value != StatInfo.IsDefaultValue(Info.AttackType, type))
            {
                continue;
            }

            int value = StatTotal.GetValue(type);
            if (value == 0)
            {
                continue;
            }

            if (string.IsNullOrEmpty(stat_string) == false)
            {
                stat_string += "\n";
            }

            if (StatInfo.IsPercentValue(type) == true)
            {
                stat_string += string.Format("{0} : [c][7D0000]{1}%[-][/c]", Localization.Get(string.Format("StatType_{0}", type)), value / 100f);
            }
            else
            {
                stat_string += string.Format("{0} : [c][7D0000]{1}[-][/c]", Localization.Get(string.Format("StatType_{0}", type)), value);
            }
        }

        return(stat_string);
    }
コード例 #2
0
    public void DoAction()
    {
        bool show_message = ActionInfo.show_message;

        string text_statType = Localization.Get("StatType_" + ActionInfo.statType);

        switch (ActionInfo.actionType)
        {
        case eActionType.stun:
        case eActionType.hidden:
        case eActionType.sleep:
            m_Creature.CancelAction(false);
            break;

        case eActionType.shield:
        case eActionType.immune:
        case eActionType.provoke:
            break;

        case eActionType.buff:
            if (show_message)
            {
                if (StatInfo.IsPercentValue(ActionInfo.statType) == true)
                {
                    TextManager.Instance.PushMessage(m_Creature, string.Format("{0} +{1}%", text_statType, Value / 100), eBuffColorType.Buff, eTextPushType.Normal);
                }
                else
                {
                    TextManager.Instance.PushMessage(m_Creature, string.Format("{0} +{1}", text_statType, Value), eBuffColorType.Buff, eTextPushType.Normal);
                }
            }
            break;

        case eActionType.buff_percent:
            if (show_message)
            {
                TextManager.Instance.PushMessage(m_Creature, string.Format("{0} +{1:p0}", text_statType, (float)Value / 10000), eBuffColorType.Buff, eTextPushType.Normal);
            }
            break;

        case eActionType.debuff:
            if (show_message)
            {
                if (StatInfo.IsPercentValue(ActionInfo.statType) == true)
                {
                    TextManager.Instance.PushMessage(m_Creature, string.Format("{0} -{1}%", text_statType, -Value / 100), eBuffColorType.DeBuff, eTextPushType.Normal);
                }
                else
                {
                    TextManager.Instance.PushMessage(m_Creature, string.Format("{0} -{1}", text_statType, -Value), eBuffColorType.DeBuff, eTextPushType.Normal);
                }
            }
            break;

        case eActionType.debuff_percent:
            if (show_message)
            {
                TextManager.Instance.PushMessage(m_Creature, string.Format("{0} -{1:p0}", text_statType, -(float)Value / 10000), eBuffColorType.DeBuff, eTextPushType.Normal);
            }
            break;
        }
    }
コード例 #3
0
ファイル: SkillInfo.cs プロジェクト: tapenjoyGame/cry
    public void AddStats(StatInfo info, StatInfo base_stat, eAttackType attack_type, float grade_percent, short level)
    {
        foreach (var action in Actions)
        {
            switch (action.actionType)
            {
            case eActionType.passive:
                switch (action.statType)
                {
                case eStatType.Defense:
                    info.AddValue(eStatType.PhysicDefense, action.GetValue(grade_percent, level));
                    info.AddValue(eStatType.MagicDefense, action.GetValue(grade_percent, level));
                    break;

                case eStatType.Attack:
                    switch (attack_type)
                    {
                    case eAttackType.heal:
                        info.AddValue(eStatType.Heal, action.GetValue(grade_percent, level));
                        break;

                    case eAttackType.physic:
                        info.AddValue(eStatType.PhysicAttack, action.GetValue(grade_percent, level));
                        break;

                    case eAttackType.magic:
                        info.AddValue(eStatType.MagicAttack, action.GetValue(grade_percent, level));
                        break;
                    }
                    break;

                default:
//                             if (StatInfo.IsPercentValue(action.statType))
//                                 info.AddValue(action.statType, action.GetValue(1f, level));
//                             else
                    info.AddValue(action.statType, action.GetValue(grade_percent, level));
                    break;
                }
                break;

            case eActionType.passive_percent:
                switch (action.statType)
                {
                case eStatType.Defense:
                    info.AddValue(eStatType.PhysicDefense, base_stat.GetValue(eStatType.PhysicDefense) * action.GetValue(1f, level) / 10000);
                    info.AddValue(eStatType.MagicDefense, base_stat.GetValue(eStatType.MagicDefense) * action.GetValue(1f, level) / 10000);
                    break;

                case eStatType.Attack:
                    switch (attack_type)
                    {
                    case eAttackType.heal:
                        info.AddValue(eStatType.Heal, base_stat.GetValue(eStatType.Heal) * action.GetValue(1f, level) / 10000);
                        break;

                    case eAttackType.physic:
                        info.AddValue(eStatType.PhysicAttack, base_stat.GetValue(eStatType.PhysicAttack) * action.GetValue(1f, level) / 10000);
                        break;

                    case eAttackType.magic:
                        info.AddValue(eStatType.MagicAttack, base_stat.GetValue(eStatType.MagicAttack) * action.GetValue(1f, level) / 10000);
                        break;
                    }
                    break;

                default:
                    if (StatInfo.IsPercentValue(action.statType))
                    {
                        info.AddValue(action.statType, action.GetValue(1f, level));
                    }
                    else
                    {
                        info.AddValue(action.statType, base_stat.GetValue(action.statType) * action.GetValue(1f, level) / 10000);
                    }
                    break;
                }
                break;
            }
        }
    }
コード例 #4
0
ファイル: PopupHeroDetail.cs プロジェクト: tapenjoyGame/cry
    string GetDetailString()
    {
        Dictionary <eStatType, float> stat_dic = new Dictionary <eStatType, float>();

        foreach (Rune rune in m_Creature.Runes)
        {
            foreach (SkillInfo.Action action in rune.Info.Skill.Actions)
            {
                if (stat_dic.ContainsKey(action.statType) == false)
                {
                    stat_dic.Add(action.statType, action.increasePerLevel * rune.Level);
                }
                else
                {
                    stat_dic[action.statType] += action.increasePerLevel * rune.Level;
                }
            }
        }

        var stat_string = "";

        foreach (eStatType type in Enum.GetValues(typeof(eStatType)))
        {
            if ((int)type >= 100)
            {
                continue;
            }

            if (StatInfo.IsDefaultValue(m_Creature.Info.AttackType, type) == false)
            {
                continue;
            }

            int value = m_Creature.StatTotal.GetValue(type);
            if (value == 0)
            {
                continue;
            }

            if (string.IsNullOrEmpty(stat_string) == false)
            {
                stat_string += "\n";
            }

            if (StatInfo.IsPercentValue(type) == true)
            {
                if (stat_dic.ContainsKey(type) == true)
                {
                    stat_string += string.Format("[c][F6D79F]{0}[-][/c] [c][E8AD05]{1}%[-][/c] [c][00B050](+{2}%)[-][/c]", Localization.Get(string.Format("StatType_{0}", type)), value / 100f, stat_dic[type]);
                    stat_dic.Remove(type);
                }
                else
                {
                    stat_string += string.Format("[c][F6D79F]{0}[-][/c] [c][E8AD05]{1}%[-][/c]", Localization.Get(string.Format("StatType_{0}", type)), value / 100f);
                }
            }
            else
            {
                if (stat_dic.ContainsKey(type) == true)
                {
                    stat_string += string.Format("[c][F6D79F]{0}[-][/c] [c][E8AD05]{1}[-][/c] [c][00B050](+{2})[-][/c]", Localization.Get(string.Format("StatType_{0}", type)), value, stat_dic[type]);
                    stat_dic.Remove(type);
                }
                else
                {
                    stat_string += string.Format("[c][F6D79F]{0}[-][/c] [c][E8AD05]{1}[-][/c]", Localization.Get(string.Format("StatType_{0}", type)), value);
                }
            }
        }

        stat_string += "\n";

        foreach (KeyValuePair <eStatType, float> values in stat_dic)
        {
            if (StatInfo.IsPercentValue(values.Key) == true)
            {
                stat_string += string.Format("[c][00B050]{0} +{1}%[-][/c]\n", Localization.Get(string.Format("StatType_{0}", values.Key)), values.Value);
            }
            else
            {
                stat_string += string.Format("[c][00B050]{0} +{2}%[-][/c]\n", Localization.Get(string.Format("StatType_{0}", values.Key)), values.Value);
            }
        }


        return(stat_string);
    }
コード例 #5
0
ファイル: SkillInfo.cs プロジェクト: tapenjoyGame/cry
        public string DescPerLevel(float grade_percent, int level, int new_level)
        {
            string DescPreset = (new_level == 0) ? "SkillDesc_" : "SkillDescPerLevel_";

            switch (actionType)
            {
            case eActionType.buff_percent:
            case eActionType.passive_percent:
                return(Localization.Format(DescPreset + "BuffPercent", Localization.Get("StatType_" + statType), GetValuePerLevel(grade_percent, level, new_level) / 100f));

            case eActionType.buff:
            case eActionType.passive:
                if (StatInfo.IsPercentValue(statType))
                {
                    return(Localization.Format(DescPreset + "BuffPercent", Localization.Get("StatType_" + statType), GetValuePerLevel(grade_percent, level, new_level) / 100f));
                }
                return(Localization.Format(DescPreset + "Buff", Localization.Get("StatType_" + statType), GetValuePerLevel(grade_percent, level, new_level)));

            case eActionType.debuff_percent:
                return(Localization.Format(DescPreset + "DebuffPercent", Localization.Get("StatType_" + statType), GetValuePerLevel(grade_percent, level, new_level) / 100f));

            case eActionType.debuff:
                if (StatInfo.IsPercentValue(statType))
                {
                    return(Localization.Format(DescPreset + "DebuffPercent", Localization.Get("StatType_" + statType), GetValuePerLevel(grade_percent, level, new_level) / 100f));
                }
                return(Localization.Format(DescPreset + "Debuff", Localization.Get("StatType_" + statType), GetValuePerLevel(grade_percent, level, new_level)));

            case eActionType.stun:
                return(Localization.Get(DescPreset + "Stun"));

            case eActionType.hidden:
                return(Localization.Get(DescPreset + "Hidden"));

            case eActionType.sleep:
                return(Localization.Get(DescPreset + "Sleep"));

            case eActionType.provoke:
                return(Localization.Get(DescPreset + "Provoke"));

            case eActionType.shield:
            {
                string desc            = "";
                string str_attack_type = "";

                if (attack_types.Count == 1)
                {
                    str_attack_type = Localization.Format("AttackType_Desc", Localization.Get("AttackType_" + attack_types[0]));
                }

                if (value != -1)
                {
                    desc = Localization.Format(DescPreset + "Shield", str_attack_type, Mathf.CeilToInt(GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total));
                }

                return(desc);
            }

            case eActionType.immune:
            {
                string desc            = "";
                string str_attack_type = "";

                if (attack_types.Count == 1)
                {
                    str_attack_type = Localization.Format("AttackType_Desc", Localization.Get("AttackType_" + attack_types[0]));
                }

                if (immune_types.Count > 0)
                {
                    if (string.IsNullOrEmpty(desc) == false)
                    {
                        desc += "\n";
                    }

                    string str_immunes = "";
                    foreach (eImmuneType immune_type in immune_types)
                    {
                        if (string.IsNullOrEmpty(str_immunes) == false)
                        {
                            str_immunes += ", ";
                        }
                        str_immunes += Localization.Get("ImmuneType_" + immune_type);
                    }
                    desc += Localization.Format(DescPreset + "Immune", str_attack_type, str_immunes);
                }
                return(desc);
            }

            case eActionType.heal:
                return(Localization.Format(DescPreset + "Heal", Mathf.CeilToInt(GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total)));

            case eActionType.heal_mana:
                return(Localization.Format(DescPreset + "HealMana", GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total * 0.01f));

            case eActionType.damage:
                return(Localization.Format(DescPreset + "Damage", Mathf.CeilToInt(GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total)));

            case eActionType.damage_mana:
                return(Localization.Format(DescPreset + "DamageMana", GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total * 0.01f));

            case eActionType.dot_damage:
                return(Localization.Format(DescPreset + "DotDamage", Mathf.CeilToInt(GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total)));

            case eActionType.dot_damage_mana:
                return(Localization.Format(DescPreset + "DotDamageMana", GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total * 0.01f));

            case eActionType.dot_heal:
                return(Localization.Format(DescPreset + "DotHeal", Mathf.CeilToInt(GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total)));

            case eActionType.dot_heal_mana:
                return(Localization.Format(DescPreset + "DotHealMana", GetValuePerLevel(grade_percent, level, new_level) * action_value.value_percent_total * 0.01f));

            case eActionType.hp_drain:
                if (new_level > 0)
                {
                    return(null);
                }
                return(Localization.Format(DescPreset + "HPDrain", GetValuePerLevel(grade_percent, level, new_level) * 0.01f));

            default:
                return("Unknown");
            }
        }