internal Player(PlayerState state) { _weaponDamage = state.WeaponDamage; _cumulativeAbility = state.CumulativeAbility; _playerHp = state.PlayerHp; _skillIds = new HashSet <int>(state.SkillIds); PlayerId = state.PlayerId; _votedToEndBattle = state.VotedToEndBattle; }
public PlayerState( string playerId, WeaponDamage weaponDamage, Ability cumulativeAbility, PlayerHp playerHp, IEnumerable <int> skillIds, bool votedToEndBattle) { PlayerId = playerId; WeaponDamage = weaponDamage; CumulativeAbility = cumulativeAbility; PlayerHp = playerHp; SkillIds = skillIds; VotedToEndBattle = votedToEndBattle; }
public Player( string playerId, WeaponDamage weaponDamage, Ability cumulativeAbility, PlayerHp playerHp, IEnumerable <int> skillIds) { PlayerId = playerId; _weaponDamage = weaponDamage; _cumulativeAbility = cumulativeAbility; _playerHp = playerHp; _skillIds = new HashSet <int>(skillIds); // Hack: just in case somebody holds reference to mutable types // after creating Player instance. _playerHp = new PlayerHp(playerHp.Current, playerHp.Maximum); // Methods should be internal so only Battle class can access them. }