Beispiel #1
0
        protected ItemUsable(ItemSheet.Row data, Guid id, long requiredBlockIndex) : base(data)
        {
            ItemId   = id;
            StatsMap = new StatsMap();

            switch (data)
            {
            case ConsumableItemSheet.Row consumableItemRow:
            {
                foreach (var statData in consumableItemRow.Stats)
                {
                    StatsMap.AddStatValue(statData.StatType, statData.Value);
                }

                break;
            }

            case EquipmentItemSheet.Row equipmentItemRow:
                StatsMap.AddStatValue(equipmentItemRow.Stat.Type, equipmentItemRow.Stat.Value);
                break;
            }

            Skills             = new List <Model.Skill.Skill>();
            BuffSkills         = new List <BuffSkill>();
            RequiredBlockIndex = requiredBlockIndex;
        }
Beispiel #2
0
 // FIXME: 기본 스탯을 복리로 증가시키고 있는데, 단리로 증가시켜야 한다.
 // 이를 위해서는 기본 스탯을 유지하면서 추가 스탯에 더해야 하는데, UI 표현에 문제가 생기기 때문에 논의 후 개선한다.
 // 장비가 보유한 스킬의 확률과 수치 강화가 필요한 상태이다.
 public void LevelUp()
 {
     level++;
     StatsMap.AddStatValue(UniqueStatType, GetIncrementAmountOfEnhancement());
     if (new[] { 4, 7, 10 }.Contains(level) &&
         GetOptionCount() > 0)
     {
         UpdateOptions();
     }
 }
Beispiel #3
0
        public static int GetCP(Costume costume, CostumeStatSheet sheet)
        {
            var statsMap = new StatsMap();

            foreach (var r in sheet.OrderedList.Where(r => r.CostumeId == costume.Id))
            {
                statsMap.AddStatValue(r.StatType, r.Stat);
            }

            return(DecimalToInt(GetStatsCP(statsMap)));
        }
Beispiel #4
0
        public static StatsMap ToStats(this CharacterSheet.Row row, int level)
        {
            var hp  = row.HP;
            var atk = row.ATK;
            var def = row.DEF;
            var cri = row.CRI;
            var hit = row.HIT;
            var spd = row.SPD;

            if (level > 1)
            {
                var multiplier = level - 1;
                hp  += row.LvHP * multiplier;
                atk += row.LvATK * multiplier;
                def += row.LvDEF * multiplier;
                cri += row.LvCRI * multiplier;
                hit += row.LvHIT * multiplier;
                spd += row.LvSPD * multiplier;
            }

            var stats = new StatsMap();

            stats.AddStatValue(StatType.HP, hp);
            stats.AddStatValue(StatType.ATK, atk);
            stats.AddStatValue(StatType.DEF, def);
            stats.AddStatValue(StatType.CRI, cri);
            stats.AddStatValue(StatType.HIT, hit);
            stats.AddStatValue(StatType.SPD, spd);

            return(stats);
        }
Beispiel #5
0
        public void LevelUpV2(IRandom random, EnhancementCostSheetV2.Row row, bool isGreatSuccess)
        {
            level++;
            var rand = isGreatSuccess ? row.BaseStatGrowthMax
                :random.Next(row.BaseStatGrowthMin, row.BaseStatGrowthMax + 1);
            var ratio    = rand.NormalizeFromTenThousandths();
            var baseStat = StatsMap.GetStat(UniqueStatType, true) * ratio;

            if (baseStat > 0)
            {
                baseStat = Math.Max(1.0m, baseStat);
            }

            StatsMap.AddStatValue(UniqueStatType, baseStat);

            if (GetOptionCount() > 0)
            {
                UpdateOptionsV2(random, row, isGreatSuccess);
            }
        }
Beispiel #6
0
        private void UpdateStatsArea()
        {
            if (Model?.item.Value is null)
            {
                statsArea.root.gameObject.SetActive(false);

                return;
            }

            foreach (var stat in statsArea.stats)
            {
                stat.Hide();
            }

            var statCount = 0;

            if (Model.item.Value.ItemBase.Value is Equipment equipment)
            {
                descriptionArea.commonGameObject.SetActive(false);
                descriptionArea.dividerImageGameObject.SetActive(false);
                descriptionArea.levelLimitGameObject.SetActive(false);
                descriptionArea.combatPowerObject.SetActive(true);
                descriptionArea.combatPowerText.text = CPHelper.GetCP(equipment).ToString();

                var uniqueStatType = equipment.UniqueStatType;
                foreach (var statMapEx in equipment.StatsMap.GetStats())
                {
                    if (!statMapEx.StatType.Equals(uniqueStatType))
                    {
                        continue;
                    }

                    AddStat(statMapEx, true);
                    statCount++;
                }

                foreach (var statMapEx in equipment.StatsMap.GetStats())
                {
                    if (statMapEx.StatType.Equals(uniqueStatType))
                    {
                        continue;
                    }

                    AddStat(statMapEx);
                    statCount++;
                }
            }
            else if (Model.item.Value.ItemBase.Value is ItemUsable itemUsable)
            {
                descriptionArea.commonGameObject.SetActive(false);
                descriptionArea.dividerImageGameObject.SetActive(false);
                descriptionArea.levelLimitGameObject.SetActive(false);
                descriptionArea.combatPowerObject.SetActive(false);

                foreach (var statMapEx in itemUsable.StatsMap.GetStats())
                {
                    AddStat(statMapEx);
                    statCount++;
                }
            }
            else if (Model.item.Value.ItemBase.Value is Costume costume)
            {
                var costumeSheet = Game.Game.instance.TableSheets.CostumeStatSheet;
                descriptionArea.commonGameObject.SetActive(false);
                descriptionArea.dividerImageGameObject.SetActive(false);
                descriptionArea.levelLimitGameObject.SetActive(false);
                var statsMap = new StatsMap();
                foreach (var row in costumeSheet.OrderedList.Where(r => r.CostumeId == costume.Id))
                {
                    statsMap.AddStatValue(row.StatType, row.Stat);
                }

                foreach (var statMapEx in statsMap.GetStats())
                {
                    AddStat(statMapEx);
                    statCount++;
                }

                var cpEnable = statCount > 0;
                descriptionArea.combatPowerObject.SetActive(cpEnable);
                if (cpEnable)
                {
                    descriptionArea.combatPowerText.text = CPHelper.GetCP(costume, costumeSheet).ToString();
                }
            }
            else
            {
                descriptionArea.levelLimitGameObject.SetActive(false);
                descriptionArea.combatPowerObject.SetActive(false);
                descriptionArea.commonGameObject.SetActive(false);
                descriptionArea.dividerImageGameObject.SetActive(false);
            }

            if (statCount <= 0)
            {
                statsArea.root.gameObject.SetActive(false);

                return;
            }

            statsArea.root.gameObject.SetActive(true);
        }