Exemplo n.º 1
0
 public void EnqueueDeferred(IEntity source, ActionGraph g)
 {
     // Don't queue unimplemented cards
     if (g != null)
     {
         EnqueueDeferred(source, g.Unravel());
     }
 }
Exemplo n.º 2
0
        public void ForceRun(IEntity owningEntity, ActionGraph g, IEntity target = null)
        {
            var actions = g.Unravel();

#if _TRIGGER_DEBUG
            DebugLog.WriteLine("Game " + Game.GameId + ": Running forced trigger for " + owningEntity.ShortDescription + " with actions: "
                               + string.Join(" ", actions.Select(a => a.ToString())));
#endif
            QueuedTriggersCount++;
            Game.RunActionBlock(BlockType.TRIGGER, owningEntity, actions, target);
        }
Exemplo n.º 3
0
        // Compile all the ActionGraph fields in a Behaviour into lists of QueueActions
        internal static CardBehaviour FromGraph(CardBehaviourGraph b)
        {
            var compiled      = new CardBehaviour();
            var behaviourList = new List <string>();

            // Find all the fields we can compile
            var behaviourClass = typeof(CardBehaviourGraph).GetFields();

            foreach (var field in behaviourClass)
            {
                if (field.FieldType == typeof(ActionGraph))
                {
                    behaviourList.Add(field.Name);
                }
            }

            // Compile each field that exists
            foreach (var fieldName in behaviourList)
            {
                var         field      = b.GetType().GetField(fieldName);
                ActionGraph fieldValue = field.GetValue(b) as ActionGraph;
                if (fieldValue != null)
                {
                    compiled.GetType().GetField(fieldName).SetValue(compiled, fieldValue.Unravel());
                }
                else
                {
                    compiled.GetType().GetField(fieldName).SetValue(compiled, new List <QueueAction>());
                }
            }

            // Copy event triggers
            compiled.TriggersByZone = b.TriggersByZone;

            return(compiled);
        }
Exemplo n.º 4
0
 public static List <QueueAction> Then(this List <QueueAction> ql, ActionGraph act)
 {
     ql.AddRange(act.Unravel());
     return(ql);
 }
Exemplo n.º 5
0
 public Trigger(ActionGraph action, Condition condition = null)
 {
     Condition = condition;
     Action    = action.Unravel();
 }
Exemplo n.º 6
0
 public Task <ActionResult> RunAsync(IEntity source, ActionGraph g)
 {
     return(g != null?RunAsync(source, g.Unravel()) : Task.FromResult(ActionResult.None));
 }
Exemplo n.º 7
0
		public void StartBlock(IEntity source, ActionGraph g, BlockStart gameBlock = null) {
			if (g != null)
				StartBlock(source, g.Unravel(), gameBlock);
		}