Beispiel #1
0
        public override void Execute(EffectContext context)
        {
            ConditionContext cContext = new ConditionContext
            {
                Game    = context.Game,
                Subject = context.ExecutingPlayer,
                Targets = context.Targets,
            };

            bool pass = true;

            foreach (BaseCondition condition in Conditions)
            {
                if (!condition.Check(cContext))
                {
                    pass = false;
                    break;
                }
            }

            if (pass)
            {
                foreach (BaseEffect effect in EffectsIfConditionsPass)
                {
                    effect.Execute(context);
                }
            }
            else
            {
                foreach (BaseEffect effect in EffectsIfConditionsFails)
                {
                    effect.Execute(context);
                }
            }
        }
Beispiel #2
0
        public override void Execute(EffectContext context)
        {
            List <Player> playersToApply = new List <Player>();

            switch (AppliesTo)
            {
            case EffectApplication.ExecutingPlayer:
                ApplyToPlayer(context.ExecutingPlayer, context);
                break;

            case EffectApplication.ReferenceChain:
                Player curPlayer = context.ExecutingPlayer;
                foreach (string reference in ReferenceChain)
                {
                    curPlayer = curPlayer.GetReference(reference);
                    if (curPlayer == null)
                    {
                        Debug.LogError("Could not follow reference chain. Reference does not exist: " + reference);
                        return;
                    }
                }
                ApplyToPlayer(curPlayer, context);
                break;

            case EffectApplication.Target:
                if (context.Targets == null)
                {
                    return;
                }
                if (context.Targets.Count <= Target)
                {
                    return;
                }
                ApplyToPlayer(context.Targets[Target], context);
                break;

            case EffectApplication.PlayerQuery:
                playersToApply.AddRange(context.Game.Players);
                break;

            case EffectApplication.TargetQuery:
                if (context.Targets == null)
                {
                    return;
                }
                playersToApply.AddRange(context.Targets);
                break;
            }

            List <Player> queried = Query.Query(playersToApply);

            foreach (Player player in queried)
            {
                ApplyToPlayer(player, context);
            }
        }
Beispiel #3
0
        protected override void ApplyToPlayer(Player player, EffectContext context)
        {
            switch (Modification)
            {
            case FlagModification.Add:
                player.AddFlag(Flag);
                break;

            case FlagModification.Remove:
                player.RemoveFlag(Flag);
                break;
            }
        }
Beispiel #4
0
        protected override void ApplyToPlayer(Player player, EffectContext context)
        {
            string response = "";

            if (Query.Query(context.Game.Players).Contains(player))
            {
                response = QueryPassResponse;
            }
            else
            {
                response = QueryFailResponse;
            }
            context.ExecutingPlayer.BillBoard.Add(player.Name + response);
        }
        protected override void ApplyToPlayer(Player player, EffectContext context)
        {
            switch (SetTo)
            {
            case SetReferenceMode.ExecutingPlayer:
                player.SetReference(Reference, context.ExecutingPlayer);
                break;

            case SetReferenceMode.TargetedPlayer:
                if (context.Targets == null)
                {
                    return;
                }
                if (context.Targets.Count <= SetToTarget)
                {
                    return;
                }
                player.SetReference(Reference, context.Targets[SetToTarget]);
                break;
            }
        }
 protected override void ApplyToPlayer(Player player, EffectContext context)
 {
     context.ExecutingPlayer.BillBoard.Add(player.Name + " is " + player.CurrentAllegiance);
 }
Beispiel #7
0
 public abstract void Execute(EffectContext context);
Beispiel #8
0
 protected override void ApplyToPlayer(Player player, EffectContext context)
 {
     player.BillBoard.Add(Message);
 }
Beispiel #9
0
 protected override void ApplyToPlayer(Player player, EffectContext context)
 {
     player.CurrentStatus = SetStatusTo;
 }
Beispiel #10
0
 /// <summary>
 /// This is called on every effect, and is how it modifies
 /// game state
 /// </summary>
 /// <param name="game">the game it's affecting</param>
 protected abstract void ApplyToPlayer(Player player, EffectContext context);
 protected override void ApplyToPlayer(Player player, EffectContext context)
 {
     player.ModifyCounter(Counter, ModificationAmount);
 }