Exemplo n.º 1
0
        public List <BattleActionResult> DoAction(BattleAction action, Battle battle)
        {
            var skill = Type.Skills.FirstOrDefault(s => s.Id == action.SkillId);

            if (skill != null)
            {
                var results = new List <BattleActionResult>();

                // Determine target(s)
                if (skill.TargetType == TargetType.Single || skill.TargetType == TargetType.Self)
                {
                    var target = battle.GetMonsterByBattleId(action.TargetBattleId);

                    if (target != null)
                    {
                        return(new List <BattleActionResult> {
                            skill.DoSkillOnTarget(this, target)
                        });
                    }
                    if (target == null)
                    {
                        Logger.LogError("Invalid Action Target", action);
                        return(null);
                    }
                }
                else if (skill.TargetType == TargetType.Group)
                {
                    // TODO: Handle group targetting skills
                }
                else if (skill.TargetType == TargetType.All)
                {
                    // TODO: Handle all targetting skills
                }
                else
                {
                    Logger.LogError("Invalid Skill Target Type", skill);
                    return(null);
                }
                // Execute skill on each target

                if (skill.Type == SkillType.Attack)
                {
                    //return new List<SkillResult> { Attack(skill, target) };
                }
            }

            return(null);
        }
Exemplo n.º 2
0
 public BattleTurn(Monster monster, BattleAction action)
 {
     Monster = monster;
     Action  = action;
 }