ported from perforce
This commit is contained in:
55
RobotAndDonkey.Game/Robots/Robot.cs
Normal file
55
RobotAndDonkey.Game/Robots/Robot.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Immutable;
|
||||
using RobotAndDonkey.Game.Cards;
|
||||
using RobotAndDonkey.Game.Data;
|
||||
using RobotAndDonkey.Game.GameState;
|
||||
using RobotAndDonkey.Game.Modifiers;
|
||||
|
||||
namespace RobotAndDonkey.Game.Robots;
|
||||
|
||||
public abstract record Robot(ERobotType Type, ImmutableArray<ECard> Deck, int ProgramCount) : Entity
|
||||
{
|
||||
protected static Currency CreateCurrency(MatchParameters parameters)
|
||||
{
|
||||
var energy = parameters.Difficulty switch
|
||||
{
|
||||
EDifficulty.Easy => Balancing.Instance.RobotEasyEnergy,
|
||||
EDifficulty.Medium => Balancing.Instance.RobotMediumEnergy,
|
||||
_ => Balancing.Instance.RobotHardEnergy
|
||||
};
|
||||
var maxCarry = parameters.Difficulty switch
|
||||
{
|
||||
EDifficulty.Easy => Balancing.Instance.EasyMaxCarry,
|
||||
EDifficulty.Medium => Balancing.Instance.MediumMaxCarry,
|
||||
_ => Balancing.Instance.HardMaxCarry
|
||||
};
|
||||
var handSize = parameters.Difficulty switch
|
||||
{
|
||||
EDifficulty.Easy => Balancing.Instance.EasyHandSize,
|
||||
EDifficulty.Medium => Balancing.Instance.MediumHandSize,
|
||||
_ => Balancing.Instance.HardHandSize
|
||||
};
|
||||
var tapeLength = parameters.Difficulty switch
|
||||
{
|
||||
EDifficulty.Easy => Balancing.Instance.EasyTapeLength,
|
||||
EDifficulty.Medium => Balancing.Instance.MediumTapeLength,
|
||||
_ => Balancing.Instance.HardTapeLength
|
||||
};
|
||||
return new(energy, maxCarry, 0, 0, tapeLength, handSize);
|
||||
}
|
||||
|
||||
public Robot DeepClone()
|
||||
{
|
||||
var result = CreateInstance();
|
||||
result.Currency = Currency;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Type}" + base.ToString();
|
||||
}
|
||||
|
||||
protected abstract Robot CreateInstance();
|
||||
|
||||
public Currency Currency;
|
||||
}
|
||||
Reference in New Issue
Block a user