public void UseSkill(int skillID, int enemyIndex) { if (Player.HasSkill(skillID)) { Skill skill = SkillFactory.Instance.FindSkill(skillID); BattleFactors playerBF = Player.BattleFactors; PlayerSkillEffectStatuses.ForEach(x => x.effector.Use(playerBF, null)); if (skill.IsAoE) { var affectedTargets = MonsterBattleFactors.Where(x => x.healthPoint >= 0 && HitCheck(playerBF, x)).ToList(); skill.Use(playerBF, affectedTargets); skill.SkillEffectors.OfType <SustainSkillEffector>().ToList().ForEach(effector => { SkillEffectStatus status = new SkillEffectStatus { effector = effector, remainedRound = effector.SustainRound }; if (effector is TargetSpeedPointSkillEffector || effector is TargetStopActionSkillEffector) { foreach (var affectedTarget in affectedTargets) { MonstersSkillEffectStatuses[MonsterBattleFactors.IndexOf(affectedTarget)].Add(status); } } else { PlayerSkillEffectStatuses.Add(status); } }); } else { if (HitCheck(playerBF, MonsterBattleFactors[enemyIndex])) { skill.Use(playerBF, new List <BattleFactors> { MonsterBattleFactors[enemyIndex] }); skill.SkillEffectors.OfType <SustainSkillEffector>().ToList().ForEach(x => { SkillEffectStatus status = new SkillEffectStatus { effector = x, remainedRound = x.SustainRound }; if (x is TargetSpeedPointSkillEffector || x is TargetStopActionSkillEffector) { MonstersSkillEffectStatuses[enemyIndex].Add(status); } else { PlayerSkillEffectStatuses.Add(status); } }); } else { OnMiss?.Invoke(false, 0); } } } ProcessTurn(); }
public void StartTurn() { actionAgentList = new List <object>(); if (!PlayerSkillEffectStatuses.Any(x => x.effector is TargetStopActionSkillEffector)) { actionAgentList.Add(Player); } for (int i = 0; i < Monsters.Count; i++) { if (!MonstersSkillEffectStatuses[i].Any(x => x.effector is TargetStopActionSkillEffector) && MonsterBattleFactors[i].healthPoint > 0) { actionAgentList.Add(i); } } actionAgentList.OrderByDescending(x => { if (x is Player) { BattleFactors playerBF = Player.BattleFactors; PlayerSkillEffectStatuses.ForEach(y => y.effector.Use(playerBF, null)); return(playerBF.speedPoint); } else { return(MonsterBattleFactors[(int)x].speedPoint); } }); if (MonsterBattleFactors.Any(x => x.healthPoint > 0)) { OnStartTurn?.Invoke(); ProcessTurn(); } else { EndBattle(); } }