Skip to content

Commit

Permalink
Добавлен учет параметра active_tick для бонусов
Browse files Browse the repository at this point in the history
  • Loading branch information
voidmain02 committed Aug 18, 2019
1 parent dc6f452 commit d4a14da
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion MiniAiCup.Paperio.Client/GameStateParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ private static BonusInfo ParseBonus(JObject jBonus)
{
return new BonusInfo {
Type = ParseBonusType((string)jBonus["type"]),
Position = ParsePoint((JArray)jBonus["position"])
Position = ParsePoint((JArray)jBonus["position"]),
Steps = (int)jBonus["active_ticks"]
};
}

Expand Down
5 changes: 5 additions & 0 deletions MiniAiCup.Paperio.Core/BonusInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ public class BonusInfo
/// Позиция
/// </summary>
public Point Position { get; set; }

/// <summary>
/// Продолжительность бонуса в шагах
/// </summary>
public int Steps { get; set; }
}
}
4 changes: 0 additions & 4 deletions MiniAiCup.Paperio.Core/GameParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,5 @@ public static class GameParams
public const int NitroSpeed = 6;

public const int SlowDownSpeed = 3;

public const int MinBonusDuration = 10;

public const int MaxBonusDuration = 50;
}
}
8 changes: 4 additions & 4 deletions MiniAiCup.Paperio.Core/SimpleGameSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public GameStateInternal Simulate(GameStateInternal state, int simulationTicks,
switch (bonus.Type)
{
case BonusType.Nitro:
me.NitroStepsLeft += GameParams.MinBonusDuration;
me.NitroStepsLeft += bonus.Steps;
break;
case BonusType.Slowdown:
me.SlowdownStepsLeft += GameParams.MaxBonusDuration;
me.SlowdownStepsLeft += bonus.Steps;
break;
case BonusType.Saw:
break;
Expand Down Expand Up @@ -112,10 +112,10 @@ public GameStateInternal Simulate(GameStateInternal state, int simulationTicks,
switch (bonus.Type)
{
case BonusType.Nitro:
me.NitroStepsLeft += GameParams.MinBonusDuration;
me.NitroStepsLeft += bonus.Steps;
break;
case BonusType.Slowdown:
me.SlowdownStepsLeft += GameParams.MaxBonusDuration;
me.SlowdownStepsLeft += bonus.Steps;
break;
case BonusType.Saw:
break;
Expand Down

0 comments on commit d4a14da

Please sign in to comment.