public TargettedSkill Act(GameState state, ItemResolver <Character> c) { Behavior behavior = Behaviors [c.Item.CharacterClass]; foreach (BehaviorSkill behaviorSkill in behavior.Skills.Where(x => x.OverrideCondition != GameCondition.None)) { if (ConditionFinder.IsConditionTrue(behaviorSkill.OverrideCondition, state, c)) { TargettedSkill targettedSkill = ConsiderSkill(behaviorSkill.SkillName, state, c); if (targettedSkill != null) { return(targettedSkill); } } } foreach (BehaviorSkill behaviorSkill in behavior.Skills) { TargettedSkill targettedSkill = ConsiderSkill(behaviorSkill.SkillName, state, c); if (targettedSkill != null) { return(targettedSkill); } } return(null); }
public TargettingInfo SelectTarget(Skill skill, GameState state, ItemResolver <Character> c) { bool isEnemy = state.Enemies.Contains(c.Item); ImmutableArray <Character> team = isEnemy ? state.Enemies : state.Party; ImmutableArray <Character> opposingTeam = isEnemy ? state.Party : state.Enemies; // This logic is very greedy, and doesn't consider anything but % health if (skill.Action.Type.HasFlag(ActionType.Heal)) { return(ConditionFinder.FindBestHealingTarget(state, c)); } if (skill.Action.Type.HasFlag(ActionType.Damage)) { return(ConditionFinder.FindBestDamageTarget(state, c)); } return(TargettingInfo.Empty); }