コード例 #1
0
ファイル: Begin.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Starts the order for the specified game and hero.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <returns></returns>
 public string Start(Game game, IOrderTaker who)
 {
     return string.Empty;
 }
コード例 #2
0
 public Factory(IOrderTaker orderTaker, IReportGenerator reportGenerator)
 {
     _orderTaker      = orderTaker;
     _reportGenerator = reportGenerator;
 }
コード例 #3
0
ファイル: End.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Ends the order for the specified game and hero.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <returns></returns>
 string IOrder.End(Game game, IOrderTaker who)
 {
     return string.Empty;
 }
コード例 #4
0
ファイル: Begin.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Determines whether this order can start.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <param name="logline">The logline.</param>
 /// <returns></returns>
 public bool CanStart(Game game, IOrderTaker who, out string logline)
 {
     logline = string.Empty;
      return true;
 }
コード例 #5
0
ファイル: Hire.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Starts the order for the specified game and hero.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <returns></returns>
 public string Start(Game game, IOrderTaker who)
 {
     // Our start condition checked and who is a Hero
      Hero h = who as Hero;
      if (h == null)
     throw new InvalidOperationException("This cannot happen since the cast was checked at start condition");
      return h.Name + " starts negotiations to hire a new hero." + Environment.NewLine;
 }
コード例 #6
0
ファイル: Hire.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Ends the order for the specified game and hero.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <returns></returns>
 public string End(Game game, IOrderTaker who)
 {
     // Our start condition checked and who is a Hero
      Hero h = who as Hero;
      if (h == null)
     throw new InvalidOperationException("This cannot happen since the cast was checked at start condition");
      string newheroname = (string)this.Parameters["name"];
      Hero newhero = new Hero();
      newhero.Identifier = game.Pool.ConsumeIdentifier();
      newhero.Name = newheroname;
      h.Owner.Heroes.Add(newhero.Identifier, newhero);
      return h.Name + " hires " + newheroname + "." + Environment.NewLine;
 }
コード例 #7
0
ファイル: Hire.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Determines whether this order can start.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <param name="logline">The logline.</param>
 /// <returns></returns>
 public bool CanStart(Game game, IOrderTaker who, out string logline)
 {
     // check if the hero is in a city
      // check if the player has hero points left
      // should we also check on the length of the name being given?
      if (who is Hero) {
     logline = string.Empty;
     return true;
      }
      logline = "Only heroes can hire other heroes." + Environment.NewLine;
      return false;
 }
コード例 #8
0
ファイル: Name.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Ends the order for the specified game and hero.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <returns></returns>
 public string End(Game game, IOrderTaker who)
 {
     if (!Parameters.ContainsKey("name"))
     throw new InvalidOperationException("This cannot happen, parsed Name order should have parameter name");
      string newname = (string)Parameters["name"];
      if (who is Player) {
     Player p = who as Player;
     string oldname = p.Name;
     p.Name = newname;
     return "Player renamed from " + oldname + "to " + newname + "." + Environment.NewLine;
      }
      if (who is Hero) {
     Hero h = who as Hero;
     string oldname = h.Name;
     h.Name = newname;
     return "Hero renamed from " + oldname + "to " + newname + "." + Environment.NewLine;
      }
      return "An error occurred while trying to use the order Name." + Environment.NewLine;
 }
コード例 #9
0
ファイル: Name.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Determines whether this order can start.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <param name="logline">The logline.</param>
 /// <returns></returns>
 public bool CanStart(Game game, IOrderTaker who, out string logline)
 {
     // no requirements on naming players or heroes
      logline = string.Empty;
      return true;
 }