private void _UseSkill(Skill skill, int fromIdx, int toIdx) { var from = _playerData.TeamHeroes[fromIdx]; if (skill == null) { _enemiesData[toIdx].BeHit(_playerData.TeamHeroes[fromIdx].Attack); } else { from.ChangeMp(-skill.MpCost); var changeValue = skill.EffectValue; if (!skill.IsConstant) { changeValue = Mathf.FloorToInt(skill.Multiple * from.Attack); } CharacterData target = null; switch (skill.EffectiveResult) { case EffectiveResult.Restore: target = _playerData.TeamHeroes[toIdx]; if (skill.EffectType == EffectType.Mp) { target.ChangeMp(changeValue); } else { target.ChangeHp(changeValue); } break; case EffectiveResult.Reduce: target = _enemiesData[toIdx]; if (skill.EffectType == EffectType.Mp) { target.ChangeMp(-changeValue); } else { target.BeHit(changeValue, skill.EffectType == EffectType.Real); } break; } } }