/// <summary> /// The phase calls this, after an universal moment of time has passed /// </summary> /// <param name="phase"></param> public ActionReport DecideWhatTodo(Phase phase) { if (currentActionLimitation == 0) { currentActionLimitation = random.Next(4, 8); } // AM I alive? if (this.IsAlive) { // Where am I? //Phase phase = FindOutInWhichPhaseIAm(); // Is there anything I can attack? if (CurrentAttackTarget == null || !CurrentAttackTarget.Being.IsAlive || sameTargetIteration > currentActionLimitation) { CurrentAttackTarget = phase.GetLivingBeingClosestTo(this); sameTargetIteration = 0; currentActionLimitation = random.Next(4, 8); } else { sameTargetIteration++; } if (CurrentAttackTarget == null) { return(MoveAround(phase)); } else { // Am In range? if (AmIInRange(CurrentAttackTarget)) { return(Attack(CurrentAttackTarget)); } else { return(MoveToward(CurrentAttackTarget)); } } } else { if (this.IsALivingBeing) { // if you are dead you keep losing 10 hp // when you have less thatn 200, it will decompose. this.Attributes.Durability -= 10; return(new ActionReport()); } else { // do nothing return(new ActionReport()); } } }