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 ProcessTurn()
        {
            OnProcess?.Invoke();
            if (actionAgentList.Count > 0)
            {
                if (actionAgentList[0] == Player)
                {
                    OnPlayerActionRequest?.Invoke();
                    actionAgentList.Remove(Player);
                }
                else
                {
                    int enemyIndex = (int)actionAgentList[0];

                    BattleFactors monsterBF = MonsterBattleFactors[enemyIndex];
                    BattleFactors playerBF  = Player.BattleFactors;
                    PlayerSkillEffectStatuses.ForEach(x => x.effector.Use(playerBF, null));
                    if (HitCheck(monsterBF, playerBF))
                    {
                        Skill skill = Monsters[enemyIndex].Action();
                        if (skill == null)
                        {
                            Player.AbilityFactors.HP -= Math.Max(monsterBF.physicalAttackPoint - playerBF.physicalDefencePoint, 1);
                        }
                        else
                        {
                            skill.Use(monsterBF, new List <BattleFactors> {
                                playerBF
                            });
                            skill.SkillEffectors.OfType <SustainSkillEffector>().ToList().ForEach(x =>
                            {
                                SkillEffectStatus status = new SkillEffectStatus {
                                    effector = x, remainedRound = x.SustainRound
                                };
                                if (x is TargetSpeedPointSkillEffector || x is TargetStopActionSkillEffector)
                                {
                                    PlayerSkillEffectStatuses.Add(status);
                                }
                                else
                                {
                                    MonstersSkillEffectStatuses[enemyIndex].Add(status);
                                }
                            });
                        }
                    }
                    else
                    {
                        OnMiss?.Invoke(true, enemyIndex);
                    }
                    ProcessTurn();
                }
            }
            else
            {
                EndTurn();
            }
        }
        public void NormalAttack(int enemyIndex)
        {
            BattleFactors enemyBF  = MonsterBattleFactors[enemyIndex];
            BattleFactors playerBF = Player.BattleFactors;

            PlayerSkillEffectStatuses.ForEach(x => x.effector.Use(playerBF, null));
            if (HitCheck(playerBF, enemyBF))
            {
                enemyBF.healthPoint -= Math.Max(playerBF.physicalAttackPoint - enemyBF.physicalDefencePoint, 1);
                if (enemyBF.healthPoint <= 0 && actionAgentList.Any(x => x is int && (int)x == enemyIndex))
                {
                    actionAgentList.RemoveAll(x => x is int && (int)x == enemyIndex);
                }
            }
            else
            {
                OnMiss?.Invoke(false, 0);
            }
            ProcessTurn();
        }
示例#4
0
        public void ChangeMoleState(MoleStates state)
        {
            var previousState = State;

            State = state;

            switch (state)
            {
            case MoleStates.Hiding:

                SetImage(Properties.Resources.holeNoMole);

                break;

            case MoleStates.Shown:

                SetImage(Properties.Resources.holeWithMole);
                OnShow?.Invoke();

                break;

            case MoleStates.Hit:

                SetImage(Properties.Resources.holeWithMoleHit);
                OnHit?.Invoke();

                break;

            case MoleStates.Missed:

                SetImage(Properties.Resources.holeMissed);
                OnMiss?.Invoke();

                break;

            default:
                break;
            }

            ResetDurations();
        }
示例#5
0
 public void Miss()
 {
     Debug.Log("Miss called");
     animator.SetTrigger(Miss1);
     OnMiss?.Invoke(this);
 }
示例#6
0
 public void PerformOnMiss(HitInfo miss) => OnMiss?.Invoke(miss);