public virtual ITargetNodeResult MockClaim(IAgent self, INodeInformation target) { ITargetNodeResult ret; var selfAgentInfo = (AgentInfo)self; if (selfAgentInfo.Node == target) { if (target.Owner.Id == selfAgentInfo.Owner.Id) { ret = new TargetNodeResult { AffectedNode = target, Result = NodeResultType.FailedInvalidTarget, Cooldown = 1, LastsFor = 1, Warmup = 1, Message = "Failed (invalid-target: claim own node) mock claim." }; } else { ret = new TargetNodeResult { AffectedNode = target, Result = NodeResultType.Success, Cooldown = 1, LastsFor = 1, Warmup = 1, Message = "Success mock claim." }; } } else { ret = new TargetNodeResult { AffectedNode = target, Result = NodeResultType.FailedOutOfRange, Cooldown = 1, LastsFor = 1, Warmup = 1, Message = "Failed (out-of-range) mock claim." }; } this.WaitToNextTick(self); if (ret.Result == NodeResultType.Success) { var mockTarget = (NodeInformation)target; mockTarget.Owner = selfAgentInfo.Owner; } this.Trace(self, TraceType.Information , "MOCK-Claim!" , "Self={", self, "}" , "Target={", target, "}" , "Result={", ret, "}"); return ret; }
public virtual ITargetNodeResult MockVirus(IAgent self, INodeInformation target) { ITargetNodeResult ret; ret = new TargetNodeResult { AffectedNode = target, Cooldown = 1, LastsFor = 1, Warmup = 1, Result = NodeResultType.FailedDifficulty, Message = "Failed (not-implemented-by-runtime) mock virus." }; this.WaitToNextTick(self); return ret; }
public virtual ITargetNodeResult MockMove(IAgent self, INodeInformation target) { ITargetNodeResult ret; var okTarget = (NodeInformation)target; var selfAgentUpdateInfo = this.Agents[self]; var okSelfAgentUpdateInfo = (AgentUpdateInfo)selfAgentUpdateInfo; var currentNode = (from n in target.Exits.Values let a = n.AllAgents.Where(ag => ag.Id == selfAgentUpdateInfo.Id).FirstOrDefault() where null != a select n).FirstOrDefault(); this.WaitToNextTick(self); if (null == currentNode) { ret = new TargetNodeResult { AffectedNode = null, Result = NodeResultType.FailedOutOfRange, Cooldown = 1, LastsFor = 1, Warmup = 1, Message = "MOCK: Target node is not nesting with current node of agent." }; } else { var okCurrentNode = (NodeInformation)currentNode; okCurrentNode.AllAgentsList.Remove(selfAgentUpdateInfo); okTarget.AllAgentsList.Add(selfAgentUpdateInfo); okSelfAgentUpdateInfo.NodePrevious = currentNode; okSelfAgentUpdateInfo.Node = target; ret = new TargetNodeResult { AffectedNode = null, Result = NodeResultType.Success, Cooldown = 1, LastsFor = 1, Warmup = 1, Message = "Success mock move." }; } this.Trace(self, TraceType.Information , "MOCK-Move!" , "Self={", self, "}" , "Target={", target, "}" , "Result={", ret, "}"); return ret; }