public PlayerBattleStats(Solidity solidity, int maxEnergy, int energyRegen, WeaponInfo[] weapons) : base(solidity) { _energy = new BoundedInt(maxEnergy, 0, maxEnergy); EnergyRegen = energyRegen; Weapons = weapons; CurrentWeaponId = 0; }
public void CtorTest() { BoundedInt value = new BoundedInt(0, 99); value.Value = 50; Assert.AreEqual(50, value); }
public void ValueInRange_Value_CastsImplicitlyToInt() { var boundedInt = new BoundedInt(1, 3, 2); int value = boundedInt; value.ShouldBe(2); }
public void ValueInRange_Value_ReturnsValue(int value) { var boundedInt = new BoundedInt(1, 3, 2); boundedInt.Value = value; boundedInt.Value.ShouldBe(value); }
public void OutOfRangeValue_Value_ReturnsDefault(int value) { var boundedInt = new BoundedInt(10, 20, 15); boundedInt.Value = value; boundedInt.Value.ShouldBe(15); }
public Character(Character other) { characterName = other.Name; health = other.Health; poise = other.Poise; speed = other.Speed; defenses = other.Defenses; combatSprite = other.combatSprite; combatController = other.combatController; actions = new List <ActionData>(other.actions); }
public static List <BoundedInt> GenerateIndices <T>(List <List <T> > x) { var result = new List <BoundedInt>(); var bi = new BoundedInt(); bi.Value = 0; for (var i = 0; i < x.Count; i++) { bi.UpperLimit = x[i].Count - 1; result.Add(new BoundedInt(bi)); } return(result); }
// Create a RepFR open-stim word list from a list of repetitions and counts, // and a list of candidate words. public static StimWordList Generate( RepCounts rep_cnts, List <string> input_words, bool do_stim, double top_percent_spaced = 0.2) { var shuffled = Shuffle(input_words); var repeats = new List <RepWordList>(); var singles = new RepWordList(); var shuf = new BoundedInt(shuffled.Count, "Words required exceeded input word list size."); foreach (var rc in rep_cnts) { if (rc.rep == 1) { for (int i = 0; i < rc.count; i++) { singles.Add(shuffled[shuf.i++]); } } else if (rc.rep > 1 && rc.count > 0) { var rep_words = new RepWordList(rc.rep); for (int i = 0; i < rc.count; i++) { rep_words.Add(shuffled[shuf.i++]); } repeats.Add(rep_words); } } return(Generate(repeats, singles, do_stim, top_percent_spaced)); }
public void ValueTooBig() { BoundedInt value = new BoundedInt(0, 99); value.Value = 100; }
public void ValueTooSmall() { BoundedInt value = new BoundedInt(0, 99); value.Value = -1; }
public void InitialValueTest() { BoundedInt value = new BoundedInt(50, 99); Assert.AreEqual(50, value); }
private void _changeHealth(int healthDelta) { CurrentHealth += healthDelta; CurrentHealth = BoundedInt.Clamp(CurrentHealth, (int)MaxHealth); }
public BoundedInt(BoundedInt other) : this(other.min, other.max, other.current) { }