예제 #1
0
        public static PartyMember[] GetAllTargetsForAbilityStep(PartyMember source, PartyMember primaryTarget, AbilityTarget abilityTarget, AbilityStep abilityStep)
        {
            var menu = MenuModel.Instance;

            var targets = new List<PartyMember> { primaryTarget };

            if (abilityTarget == AbilityTarget.AllFriendly)
            {
                //apply to all party members
                targets.AddRange(new[]
                {
                    GameModel.Instance.PartyMember1,
                    GameModel.Instance.PartyMember2,
                    GameModel.Instance.PartyMember3,
                    GameModel.Instance.PartyMember4
                });
            }
            else if (abilityTarget == AbilityTarget.AnySingleDefaultFriendlyWithSecondaryTargets ||
                     abilityTarget == AbilityTarget.AnySingleDefaultHostileWithSecondaryTargets ||
                     abilityTarget == AbilityTarget.SingleFriendlyWithSecondaryTargets)
            {
                targets.AddRange(abilityStep
                    .GetSecondaryTargets(source, primaryTarget, null)
                    .Select(x => x as PartyMember));
            }

            return targets.Where(x => x != null).Distinct().ToArray();
        }
예제 #2
0
        public static BattleEntityInBattle[] GetAllTargetsForAbilityStep(BattleEntityInBattle source, BattleEntityInBattle primaryTarget, AbilityTarget abilityTarget, AbilityStep step)
        {
            switch (abilityTarget)
            {
                case AbilityTarget.AnySingleDefaultFriendly:
                case AbilityTarget.AnySingleDefaultHostile:
                case AbilityTarget.SingleFriendlyOnly:
                case AbilityTarget.SingleHostileOnly:
                    //no additional targets, just return the primary target
                    return new[] { primaryTarget };
                case AbilityTarget.AnySingleDefaultFriendlyWithSecondaryTargets:
                case AbilityTarget.AnySingleDefaultHostileWithSecondaryTargets:
                case AbilityTarget.SingleFriendlyWithSecondaryTargets:
                case AbilityTarget.SingleHostileWithSecondaryTargets:
                    //add additional targets
                    var allTargetsWithPrimary = new List<BattleEntityInBattle> { primaryTarget };
                    allTargetsWithPrimary.AddRange(step.GetSecondaryTargets(source.BattleEntity, primaryTarget.BattleEntity, BattleModel.Instance.BattleData)
                        .Select(GetBattleEntityInBattleByBattleEntity));
                    return allTargetsWithPrimary.Distinct().ToArray();
                case AbilityTarget.AllFriendly:
                    //there is no 'primary' target, just return all alive friendly targets
                    return GetAllAliveFriendlyTargets(source);
                case AbilityTarget.AllHostile:
                    //there is no 'primary' target, just return all alive hostile targets
                    return GetAllAliveHostileTargets(source);
                case AbilityTarget.All:
                    //everything is a target!
                    var allTargets = new List<BattleEntityInBattle>();
                    allTargets.AddRange(GetAllAliveFriendlyTargets(source));
                    allTargets.AddRange(GetAllAliveHostileTargets(source));
                    return allTargets.Distinct().ToArray(); //just incase something is added twice
            }

            //should never reach this
            return new[] { primaryTarget };
        }