Skip to content

Commit

Permalink
Update stumped
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobFischer committed Mar 19, 2017
1 parent 1237da1 commit 5a8610a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 22 deletions.
41 changes: 25 additions & 16 deletions Games/Stumped/Beaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ class Beaver : Stumped.GameObject
/// </summary>
public int Branches { get; protected set; }

/// <summary>
/// Number of turns this beaver is distracted for (0 means not distracted).
/// </summary>
public int Distracted { get; protected set; }

/// <summary>
/// The number of fish this beaver is holding.
/// </summary>
Expand All @@ -60,11 +55,21 @@ class Beaver : Stumped.GameObject
/// </summary>
public Stumped.Player Owner { get; protected set; }

/// <summary>
/// True if the Beaver has finished being recruited and can do things, False otherwise.
/// </summary>
public bool Recruited { get; protected set; }

/// <summary>
/// The tile this beaver is on.
/// </summary>
public Stumped.Tile Tile { get; protected set; }

/// <summary>
/// Number of turns this beaver is distracted for (0 means not distracted).
/// </summary>
public int TurnsDistracted { get; protected set; }


// <<-- Creer-Merge: properties -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
// you can add additional properties(s) here. None of them will be tracked or updated by the server.
Expand All @@ -83,12 +88,12 @@ protected Beaver() : base()
/// <summary>
/// Attacks another adjacent beaver.
/// </summary>
/// <param name="tile">The tile of the beaver you want to attack.</param>
/// <param name="beaver">The beaver to attack. Must be on an adjacent tile.</param>
/// <returns>True if successfully attacked, false otherwise.</returns>
public bool Attack(Stumped.Tile tile)
public bool Attack(Stumped.Beaver beaver)
{
return this.RunOnServer<bool>("attack", new Dictionary<string, object> {
{"tile", tile}
{"beaver", beaver}
});
}

Expand All @@ -105,12 +110,14 @@ public bool BuildLodge()
/// <summary>
/// Drops some of the given resource on the beaver's tile. Fish dropped in water disappear instantly, and fish dropped on land die one per tile per turn.
/// </summary>
/// <param name="tile">The Tile to drop branches/fish on. Must be the same Tile that the Beaver is on, or an adjacent one.</param>
/// <param name="resource">The type of resource to drop ('branch' or 'fish').</param>
/// <param name="amount">The amount of the resource to drop, numbers <= 0 will drop all of that type.</param>
/// <param name="amount">The amount of the resource to drop, numbers <= 0 will drop all the resource type.</param>
/// <returns>True if successfully dropped the resource, false otherwise.</returns>
public bool Drop(string resource, int amount=0)
public bool Drop(Stumped.Tile tile, string resource, int amount=0)
{
return this.RunOnServer<bool>("drop", new Dictionary<string, object> {
{"tile", tile},
{"resource", resource},
{"amount", amount}
});
Expand All @@ -119,19 +126,19 @@ public bool Drop(string resource, int amount=0)
/// <summary>
/// Harvests the branches or fish from a Spawner on an adjacent tile.
/// </summary>
/// <param name="tile">The tile you want to harvest.</param>
/// <param name="spawner">The Spawner you want to harvest. Must be on an adjacent tile.</param>
/// <returns>True if successfully harvested, false otherwise.</returns>
public bool Harvest(Stumped.Tile tile)
public bool Harvest(Stumped.Spawner spawner)
{
return this.RunOnServer<bool>("harvest", new Dictionary<string, object> {
{"tile", tile}
{"spawner", spawner}
});
}

/// <summary>
/// Moves this beaver from its current tile to an adjacent tile.
/// </summary>
/// <param name="tile">The tile this beaver should move to. Costs 2 moves normally, 3 if moving upstream, and 1 if moving downstream.</param>
/// <param name="tile">The tile this beaver should move to.</param>
/// <returns>True if the move worked, false otherwise.</returns>
public bool Move(Stumped.Tile tile)
{
Expand All @@ -143,12 +150,14 @@ public bool Move(Stumped.Tile tile)
/// <summary>
/// Picks up some branches or fish on the beaver's tile.
/// </summary>
/// <param name="tile">The Tile to pickup branches/fish from. Must be the same Tile that the Beaver is on, or an adjacent one.</param>
/// <param name="resource">The type of resource to pickup ('branch' or 'fish').</param>
/// <param name="amount">The amount of the resource to drop, numbers <= 0 will pickup all of that type.</param>
/// <param name="amount">The amount of the resource to drop, numbers <= 0 will pickup all of the resource type.</param>
/// <returns>True if successfully picked up a resource, false otherwise.</returns>
public bool Pickup(string resource, int amount=0)
public bool Pickup(Stumped.Tile tile, string resource, int amount=0)
{
return this.RunOnServer<bool>("pickup", new Dictionary<string, object> {
{"tile", tile},
{"resource", resource},
{"amount", amount}
});
Expand Down
10 changes: 10 additions & 0 deletions Games/Stumped/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class Game : BaseGame
/// </summary>
public IList<Stumped.Job> Jobs { get; protected set; }

/// <summary>
/// Constant number used to calculate what it costs to spawn a new lodge.
/// </summary>
public double LodgeCostConstant { get; protected set; }

/// <summary>
/// How many lodges must be complete at once to win the game.
/// </summary>
Expand Down Expand Up @@ -85,6 +90,11 @@ class Game : BaseGame
/// </summary>
public IList<Stumped.Spawner> Spawner { get; protected set; }

/// <summary>
/// Constant number used to calculate how many breanches/fish Beavers harvest from spawners.
/// </summary>
public double SpawnerHarvestConstant { get; protected set; }

/// <summary>
/// All the types of spawners in the game.
/// </summary>
Expand Down
8 changes: 4 additions & 4 deletions Games/Stumped/Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Job : Stumped.GameObject
/// <summary>
/// How many turns a beaver attacked by this job is distracted by.
/// </summary>
public int Distracts { get; protected set; }
public int DistractionPower { get; protected set; }

/// <summary>
/// Scalar for how many fish this job harvests at once.
Expand Down Expand Up @@ -88,12 +88,12 @@ protected Job() : base()
/// <summary>
/// Recruits a Beaver of this Job to a lodge
/// </summary>
/// <param name="lodge">The Tile that is a lodge owned by you that you wish to spawn the Beaver of this Job on.</param>
/// <param name="tile">The Tile that is a lodge owned by you that you wish to spawn the Beaver of this Job on.</param>
/// <returns>The recruited Beaver if successful, null otherwise.</returns>
public Stumped.Beaver Recruit(Stumped.Tile lodge)
public Stumped.Beaver Recruit(Stumped.Tile tile)
{
return this.RunOnServer<Stumped.Beaver>("recruit", new Dictionary<string, object> {
{"lodge", lodge}
{"tile", tile}
});
}

Expand Down
9 changes: 7 additions & 2 deletions Games/Stumped/Spawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ class Spawner : Stumped.GameObject
{
#region Properties
/// <summary>
/// How much of the resource is left.
/// True if this Spawner has been harvested this turn, and it will not heal at the end of the turn, false otherwise.
/// </summary>
public bool HasBeenHarvested { get; protected set; }

/// <summary>
/// How much health this spawner has, which is used to calculate how much of its resource can be harvested.
/// </summary>
public int Health { get; protected set; }

/// <summary>
/// The tile this resource is on.
/// The tile this Spawner is on.
/// </summary>
public Stumped.Tile Tile { get; protected set; }

Expand Down

0 comments on commit 5a8610a

Please sign in to comment.