protected virtual Gr1d.Api.Skill.ITargetAgentResult TickSkillAttack(Gr1d.Api.Agent.IAgentUpdateInfo agentUpdate) {
			Gr1d.Api.Skill.ITargetAgentResult ret = null;

			var opponents = (from a in agentUpdate.Node.AllAgents
							 where a.Owner.Id != agentUpdate.Owner.Id
							 orderby a.Stack, a.Level
							 select a).ToList();

			var targetOpponent = opponents.FirstOrDefault();
			if (null != targetOpponent) {
				ret = this.Attack(targetOpponent);
			}

			return ret;
		}
		protected virtual Gr1d.Api.Skill.ITargetNodeResult TickSkillMove(Gr1d.Api.Agent.IAgentUpdateInfo agentUpdate) {
			Gr1d.Api.Skill.ITargetNodeResult ret = null;

			var rnd = new Random();
			var nodes = (from n in agentUpdate.Node.Exits.Values
						 orderby rnd.Next()
						 select n).ToList();

			var targetNode = nodes.FirstOrDefault();
			if (null != targetNode) {
				ret = this.Move(targetNode);
				string msg = string.Format("Current node=[L:{0} R:{1} C:{2}]", targetNode.Layer, targetNode.Row, targetNode.Column);
				this.Deck.Trace(msg, Gr1d.Api.Deck.TraceType.Information);
			}

			return ret;
		}
Пример #3
0
 public void Initialise(Gr1d.Api.Deck.IDeck deck)
 {
     _deck = deck;
     _deck.Trace("Ready for work", TraceType.Information);
 }
		public override void Tick(Gr1d.Api.Agent.IAgentUpdateInfo agentUpdate) {
			base.Tick(agentUpdate);
			this.TickSkillMove(agentUpdate);
		}
	    public virtual void Initialise(Gr1d.Api.Deck.IDeck deck) {
	        this.Deck = deck;
	        this.Deck.Trace("Initialise ...", Gr1d.Api.Deck.TraceType.Information);
	    }
	    public virtual void Tick(Gr1d.Api.Agent.IAgentUpdateInfo agentUpdate) {
	        string msg = string.Format("Tick #{0} ...", this.Deck.TickNumber);
	        this.Deck.Trace(msg, Gr1d.Api.Deck.TraceType.Information);
	    }
	    public virtual void OnAttacked(Gr1d.Api.Agent.IAgentInfo attacker, Gr1d.Api.Agent.IAgentUpdateInfo agentUpdate) {
	        this.Deck.Trace("OnAttacked ...", Gr1d.Api.Deck.TraceType.Information);
	    }
			public SampleMockNodeInformation(int layer, int row, int column, Gr1d.Api.Sector.ISectorInfo sector, IPlayer owner) : base(layer, row, column, sector, owner) { }