예제 #1
0
 public EffectOnDamaged(bool isDebuff, int maxDurationTurns, int numberOfUses, ReactionCardType reaction)
 {
     _isDebuff         = isDebuff;
     _numberOfUses     = numberOfUses;
     _maxDurationTurns = maxDurationTurns;
     _reaction         = reaction;
 }
예제 #2
0
 public EffectOnEvaded(bool isDebuff, int numberOfUses, int maxDurationTurns, ReactiveTriggerScope triggerScope, ReactionCardType reaction)
 {
     _isDebuff         = isDebuff;
     _numberOfUses     = numberOfUses;
     _maxDurationTurns = maxDurationTurns;
     _triggerScope     = triggerScope;
     _reaction         = reaction;
 }
예제 #3
0
 public ProposedReaction(ReactionCardType a, Member source, Target target)
 {
     Reaction = a;
     Source   = source;
     Target   = target;
 }
예제 #4
0
 public ProposedReaction(ReactionCardType a, Member source, Member target)
     : this(a, source, new Single(target))
 {
 }
예제 #5
0
    protected static Func <EffectResolved, Maybe <ProposedReaction> > CreateMaybeEffect(IDictionary <int, Member> members, int possessingMemberId, Member originator, ReactionCardType reaction, Func <EffectResolved, bool> condition) =>
    effect =>
    {
        var reactingMaybeMember = effect.Target.Members.Where(m => m.Id == possessingMemberId);
        if (reactingMaybeMember.None() || !condition(effect))
        {
            return(Maybe <ProposedReaction> .Missing());
        }

        var possessor = reactingMaybeMember.First();
        var action    = reaction.ActionSequence;
        var reactor   = action.Reactor == ReactiveMember.Originator ? originator : possessor;

        Target target = new Single(possessor);
        if (action.Scope == ReactiveTargetScope.Attacker)
        {
            target = new Single(effect.Source);
        }
        if (action.Scope == ReactiveTargetScope.AllEnemies)
        {
            target = new Multiple(members.Values.Where(x => x.IsConscious() && x.TeamType == TeamType.Enemies).ToArray());
        }
        // TODO: Implement other scopes

        return(new ProposedReaction(reaction, reactor, target));
    };
예제 #6
0
 public ReactOnEvaded(bool isDebuff, int numberOfUses, int maxDurationTurns, ReactiveTriggerScope triggerScope, IDictionary <int, Member> allMembers, int possessingMemberId, Member originator, ReactionCardType reaction)
     : base(isDebuff, maxDurationTurns, numberOfUses, CreateMaybeEffect(allMembers, possessingMemberId, originator, reaction, effect =>
                                                                        effect.EffectData.EffectType == EffectType.Attack &&
                                                                        effect.BattleBefore.Members[possessingMemberId].State.Counters["Evade"] > effect.BattleAfter.Members[possessingMemberId].State.Counters["Evade"] &&
                                                                        triggerScope.IsInTriggerScope(originator, allMembers[possessingMemberId], effect.Source)))
 {
 }
 public EffectOnShieldBroken(bool isDebuff, int maxDurationTurns, ReactiveTriggerScope triggerScope, ReactionCardType reaction)
 {
     _isDebuff         = isDebuff;
     _maxDurationTurns = maxDurationTurns;
     _reaction         = reaction;
 }
 public ReactOnShieldBroken(bool isDebuff, int numberOfUses, int maxDurationTurns, IDictionary <int, Member> allMembers, int possessingMemberId, Member originator, ReactionCardType reaction)
     : base(isDebuff, maxDurationTurns, numberOfUses, CreateMaybeEffect(allMembers, possessingMemberId, originator, reaction, effect =>
                                                                        effect.EffectData.EffectType == EffectType.Attack &&
                                                                        effect.BattleBefore.Members[possessingMemberId].State.Counters["Shield"] > 0 &&
                                                                        effect.BattleAfter.Members[possessingMemberId].State.Counters["Shield"] == 0))
 {
 }
예제 #9
0
 public ReactOnDamaged(bool isDebuff, int numberOfUses, int maxDurationTurns, IDictionary <int, Member> allMembers, int possessingMemberId, Member originator, ReactionCardType reaction)
     : base(isDebuff, maxDurationTurns, numberOfUses, CreateMaybeEffect(allMembers, possessingMemberId, originator, reaction, effect =>
                                                                        effect.BattleBefore.Members[possessingMemberId].State.Counters["HP"] > effect.BattleAfter.Members[possessingMemberId].State.Counters["HP"]))
 {
 }