public StatInfo AddStats(eEquipType type, eAttackType attack_type, int equip_grade, int enchant, StatInfo stat_info) { EquipStat stat = null; switch (type) { case eEquipType.weapon: stat = StatInfo.Weapons.Find(e => e.Grade == equip_grade && e.Enchant == enchant); if (stat == null) { throw new System.Exception(string.Format("Can't Find Weapon Stat Info : grade({0}), enchant({1})", equip_grade, enchant)); } stat_info.AddValue(eStatType.PhysicAttack, stat.Value); stat_info.AddValue(eStatType.MagicAttack, stat.Value); stat_info.AddValue(eStatType.Heal, stat.Value); break; case eEquipType.armor: stat = StatInfo.Armors.Find(e => e.Grade == equip_grade && e.Enchant == enchant); if (stat == null) { throw new System.Exception(string.Format("Can't Find Armor Stat Info : grade({0}), enchant({1})", equip_grade, enchant)); } switch (attack_type) { case eAttackType.physic: stat_info.AddValue(eStatType.PhysicDefense, stat.Value); stat_info.AddValue(eStatType.MagicDefense, (int)(stat.Value * stat.DefenseRate)); break; case eAttackType.magic: stat_info.AddValue(eStatType.MagicDefense, stat.Value); stat_info.AddValue(eStatType.PhysicDefense, (int)(stat.Value * stat.DefenseRate)); break; case eAttackType.heal: stat_info.AddValue(eStatType.PhysicDefense, (int)(stat.Value * stat.DefenseRate)); stat_info.AddValue(eStatType.MagicDefense, (int)(stat.Value * stat.DefenseRate)); break; } break; } return(stat_info); }
public void CalculateStat(List <Buff> buffs) { Stat = new StatInfo(); foreach (eStatType type in Enum.GetValues(typeof(eStatType))) { if ((int)type >= 100) { continue; } int value = Base.GetValue(type); Stat.SetValue(type, value); } if (buffs != null) { foreach (Buff buff in buffs) { if (buff.IsFinish == true) { continue; } switch (buff.ActionInfo.actionType) { case eActionType.buff: case eActionType.debuff: { int buff_value = buff.Value; switch (buff.ActionInfo.statType) { case eStatType.Attack: { Stat.AddValue(eStatType.PhysicAttack, buff_value); Stat.AddValue(eStatType.MagicAttack, buff_value); Stat.AddValue(eStatType.Heal, buff_value); } break; case eStatType.Defense: { Stat.AddValue(eStatType.PhysicDefense, buff_value); Stat.AddValue(eStatType.MagicDefense, buff_value); } break; default: Stat.AddValue(buff.ActionInfo.statType, buff_value); break; } } break; case eActionType.buff_percent: case eActionType.debuff_percent: { long buff_value = buff.ActionInfo.actionType == eActionType.buff_percent ? buff.Value : -buff.Value; switch (buff.ActionInfo.statType) { case eStatType.Attack: { Stat.AddValue(eStatType.PhysicAttack, (int)(Base.GetValue(eStatType.PhysicAttack) * buff_value / 10000)); Stat.AddValue(eStatType.MagicAttack, (int)(Base.GetValue(eStatType.MagicAttack) * buff_value / 10000)); Stat.AddValue(eStatType.Heal, (int)(Base.GetValue(eStatType.Heal) * buff_value / 10000)); } break; case eStatType.Defense: { Stat.AddValue(eStatType.PhysicDefense, (int)(Base.GetValue(eStatType.PhysicAttack) * buff_value / 10000)); Stat.AddValue(eStatType.MagicDefense, (int)(Base.GetValue(eStatType.MagicDefense) * buff_value / 10000)); } break; default: // if (StatInfo.IsPercentValue(buff.ActionInfo.statType) == true) // Stat.AddValue(buff.ActionInfo.statType, buff_value); // else Stat.AddValue(buff.ActionInfo.statType, (int)(Base.GetValue(buff.ActionInfo.statType) * buff_value / 10000)); break; } } break; } } } }
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; } } }