コード例 #1
0
        GameState RemoveEffect(string effectName, TargettingInfo targettingInfo, GameState state)
        {
            Character c = state.AllCharacters.WithID(targettingInfo.TargetID);

            c = c.WithStatusEffects(c.StatusEffects.RemoveAll(x => x.Name == effectName));
            return(state.UpdateCharacter(c));
        }
コード例 #2
0
        GameState ApplyCooldown(TargettingInfo targettingInfo, GameState state)
        {
            Character c = state.AllCharacters.WithID(targettingInfo.InvokerID);

            c = c.WithUpdatedSkill(c.Skills.WithID(targettingInfo.TargetID).WithAvailable(true));
            return(state.UpdateCharacter(c));
        }
コード例 #3
0
        public void ProcessAction(int skillIndex, long targetID)
        {
            Skill          s    = Engine.CurrentState.ActiveCharacter.Skills[skillIndex];
            TargettingInfo info = TargettingInfo.From(Engine.CurrentState.ActivePlayerID, targetID);

            Engine.ProcessActivePlayerAction(new TargettedSkill(s, info));
            CheckForNewLevel();
        }
コード例 #4
0
        GameState ApplyEffect(string effectName, int power, TargettingInfo targettingInfo, GameState state)
        {
            var character = CharacterResolver.Create(targettingInfo.TargetID, state);

            if (character.Item.HasEffect(effectName))
            {
                return(ExtendEffect(effectName, power, character, state));
            }
            else
            {
                return(AddNewEffect(effectName, power, character, state));
            }
        }
コード例 #5
0
        TargettedSkill ConsiderSkill(string skillName, GameState state, ItemResolver <Character> c)
        {
            Skill skill = c.Item.SkillWithName(skillName);

            if (skill != null && skill.Available)
            {
                TargettingInfo targetting = SelectTarget(skill, state, c);
                if (targetting != TargettingInfo.Empty)
                {
                    return(new TargettedSkill(skill, targetting));
                }
            }
            return(null);
        }
コード例 #6
0
        public GameState Apply(TargettedAction targettedAction, GameState state)
        {
            TargettingInfo targettingInfo = targettedAction.TargetInfo;
            Character      invoker        = state.AllCharacters.WithIDOrNull(targettingInfo.InvokerID);

            if (invoker == null || !invoker.IsAlive)
            {
                return(state);
            }

            Action     action = targettedAction.Action;
            ActionType type   = action.Type;

            if (type.HasFlag(ActionType.Damage) || type.HasFlag(ActionType.Heal))
            {
                Character target = state.AllCharacters.WithIDOrNull(targettingInfo.TargetID);
                if (target == null || !target.IsAlive)
                {
                    return(state);
                }
            }

            if (type.HasFlag(ActionType.Damage))
            {
                state = ApplyDamage(action.Power, CharacterResolver.Create(targettingInfo.TargetID, state), state);
            }

            if (type.HasFlag(ActionType.Heal))
            {
                state = ApplyHeal(action.Power, CharacterResolver.Create(targettingInfo.TargetID, state), state);
            }

            if (type.HasFlag(ActionType.Cooldown))
            {
                state = ApplyCooldown(targettingInfo, state);
            }

            if (type.HasFlag(ActionType.Effect))
            {
                state = ApplyEffect(action.EffectName, action.Power, targettingInfo, state);
            }

            if (type.HasFlag(ActionType.RemoveEffect))
            {
                state = RemoveEffect(action.EffectName, targettingInfo, state);
            }

            return(state);
        }
コード例 #7
0
        TargettedAction CreateCooldownAction(TargettedSkill s)
        {
            TargettingInfo targettingInfo = new TargettingInfo(s.TargetInfo.InvokerID, s.Skill.ID);

            return(new TargettedAction(CooldownAction, targettingInfo));
        }
コード例 #8
0
        public static TargettingInfo FindBestDamageTarget(GameState state, ItemResolver <Character> c)
        {
            Character lowestHealth = state.GetOpponents(c).OrderBy(x => x.Health.Current / (double)x.Health.Max).First();

            return(TargettingInfo.From(c.Item.ID, lowestHealth.ID));
        }
コード例 #9
0
        static GameState AddNewEffect(string effectName, int power, ItemResolver <Character> character, GameState state)
        {
            state = state.UpdateCharacter(character.Item.AddStatusEffect(new StatusEffect(effectName)));
            character.Update(state);

            Action          removeAction          = new Action(ActionType.RemoveEffect, 0, effectName);
            TargettedAction removeActionTargetted = new TargettedAction(removeAction, TargettingInfo.Self(character));
            DelayedAction   removeEffectAction    = DelayedAction.Create(removeActionTargetted, Time.ActionAmount - power);

            return(state.AddDelayedAction(removeEffectAction));
        }
コード例 #10
0
 public TargettedAction WithTargetInfo(TargettingInfo targetInfo)
 {
     return(new TargettedAction(Action, targetInfo));
 }
コード例 #11
0
 public TargettedAction(Action action, TargettingInfo targetInfo)
 {
     Action     = action;
     TargetInfo = targetInfo;
 }
コード例 #12
0
 public TargettedSkill(Skill skill, TargettingInfo targetInfo)
 {
     Skill      = skill;
     TargetInfo = targetInfo;
 }