public Being(string name, int level, AnimationController controller, Input input, bool isPlayer, bool isLocal) { this.name = name; this.controller = controller; this.level = level; this.isPlayer = isPlayer; this.isLocal = isLocal; this.input = input; changeAnimation("idle"); if (isPlayer) { stats.setStatValue(StatType.Agility, 10); stats.setStatValue(StatType.Life, 10); stats.setStatValue(StatType.Magic, 10); stats.setStatValue(StatType.Strength, 10); stats.setStatValue(StatType.Speed, 10); foreach (Stat stat in controller.statRatios.statsTable.Values) { stats.addStatValue(stat.getType(), stat.getValue() * (level - 1)); } } else { foreach (Stat stat in controller.statRatios.statsTable.Values) { stats.setStatValue(stat.getType(), stat.getValue() * level); } } guid = Guid.NewGuid(); newLevel(); }
private static StatSet rollStats(Being being, ItemClass itemClass, ItemType type) { StatSet stats = new StatSet(); #region Calculate how many random stat modifiers there shall be int randomStatItems = 0; switch (itemClass) { case ItemClass.Normal: randomStatItems++; break; case ItemClass.Magic: randomStatItems += 1 + rand.Next() % 2; break; case ItemClass.Rare: randomStatItems += 2 + rand.Next() % 2; break; case ItemClass.Unique: randomStatItems += 4 + rand.Next() % 6; break; } #endregion if (type == ItemType.Chest) { stats.addStatValue(StatType.Defense, 20 + rand.Next() % 10); } if (type == ItemType.Head) { stats.addStatValue(StatType.Defense, 5 + rand.Next() % 5); } if (type == ItemType.Legs) { stats.addStatValue(StatType.Defense, 7 + rand.Next() % 10); } if (type == ItemType.MainHand) { stats.addStatValue(StatType.MinDamage, 2); stats.addStatValue(StatType.MaxDamage, 2); } switch (itemClass) { case ItemClass.Normal: break; case ItemClass.Magic: if (stats.getStatValue(StatType.Defense) > 0) { stats.setStatValue(StatType.Defense, stats.getStatValue(StatType.Defense) + 3); } break; case ItemClass.Rare: if (stats.getStatValue(StatType.Defense) > 0) { stats.setStatValue(StatType.Defense, stats.getStatValue(StatType.Defense) * 2); } break; case ItemClass.Unique: if (stats.getStatValue(StatType.Defense) > 0) { stats.setStatValue(StatType.Defense, stats.getStatValue(StatType.Defense) * 3); } break; } #region Add that random amount of modifiers for (; randomStatItems > 0; randomStatItems--) { //get random modifier StatType[] values = (Stats.StatType[])Enum.GetValues(typeof(StatType)); StatType stat = values[rand.Next(0, values.Length)]; stats.addStatValue(stat, (int)(1 + rand.Next() % 8)); } #endregion return(stats); }