コード例 #1
0
    public void ApplyBounus(ObjectController target)
    {
        switch (bounus_type)
        {
        case BounusType.Stats:
            switch (stats_bounus.value_type)
            {
            case SetStatsField.ValueType.Raw:
                target.AddMaxStats(stats_bounus.stats_type, stats_bounus.value);
                break;

            case SetStatsField.ValueType.Percentage:
                if ((int)STATSTYPE.DEFENSE <= (int)stats_bounus.stats_type && (int)stats_bounus.stats_type <= (int)STATSTYPE.HASTE)
                {
                    target.AddMaxStats(stats_bounus.stats_type, (float)System.Math.Round(stats_bounus.value, 1));
                }
                else
                {
                    target.AddMaxStats(stats_bounus.stats_type, (float)System.Math.Round(stats_bounus.value * target.MaxStats.Get(stats_bounus.stats_type), 0));
                }
                break;
            }
            break;

        case BounusType.Passive:
            if (target.GetPassive(passive_bounus.GetType()) != null)
            {
                return;
            }
            CachedPassive = (PassiveSkill)passive_bounus.Instantiate();
            CachedPassive.InitSkill(target);
            target.Passives.Add(CachedPassive);
            break;
        }
    }