public StatSet(StatSet b) : this() { for (int i = 0; i < (int)Stat.MAX; ++i) { stats[i] = b.stats[i]; } }
public void LevelUp(bool playerPick) { level += 1; // wrap xp over to next level xp -= nextXP; if (xp < 0) { xp = 0; } // update xp counters nextXP = GetRequiredXP(level + 1); rewardXP = GetRewardXP(level); // first, increase base stat points by a few at random // at the beginning, get 3 stat points per level // every 10 levels get 1 more stat point per level StatSet bonusStats = StatSet.ZERO; bonusStats.BoostRandom(3 + level / 10); baseStats += bonusStats; if (playerPick) { RecalculateStats(); Console.Out.WriteLine(name + " has leveled up!"); Console.Out.WriteLine("Base stat points awarded:"); Console.Out.WriteLine(bonusStats.ToString()); Console.Out.WriteLine("Resulting total stats:"); Console.Out.WriteLine(trueStats.ToString()); } }
static void Main(string[] args) { Random rng = new Random(); StatSet.InitializeRNG(rng); Fighter.InitializeRNG(rng); NameGenFemale.InitializeNameGenerator(rng); NameGenMale.InitializeNameGenerator(rng); }
public static StatSet operator +(StatSet a, StatSet b) { StatSet r = new StatSet(a); for (int i = 0; i < (int)Stat.MAX; ++i) { r.stats[i] += b.stats[i]; } return(r); }
public void RecalculateStats() { // calculate true stats, including modifiers (more to do later) trueStats = new StatSet(baseStats); // calculate max hp and sp maxHP = 50 + 5 * trueStats[Stat.VIT]; maxSP = 50 + 5 * trueStats[Stat.END]; if (hp > maxHP) { hp = maxHP; } if (sp > maxSP) { sp = maxSP; } /* * protected int chanceToDrawWeapon; // chance to draw a weapon when unarmed * protected int chanceToThrowWeapon; // chance to throw weapon at enemy * protected int chanceToSwapTrinket; // chance to swap trinkets before attacking * protected int chanceToUseItem; // chance to use an item this turn * protected int chanceToUseSkill; // chance to use a skill this turn * protected int chanceToFeintAttack; // chance to try a feint attack * protected int chanceToCounterAttack; // chance to use a counter attack * protected int chanceToComboAttack; // chance to attack again this turn * protected int chanceToDisarm; // chance to disarm the enemy's weapon * protected int chanceToDetrinket; // chance to disarm the enemy's trinket * protected int chanceToBlock; // chance to block an enemy attack */ // set base chances for battle effects chanceToDrawWeapon = 50; chanceToThrowWeapon = 10; chanceToSwapTrinket = 10; chanceToUseItem = 10; chanceToUseSkill = 10; chanceToFeintAttack = 10; chanceToCounterAttack = 10; chanceToComboAttack = 10; chanceToDisarm = 10; chanceToDetrinket = 10; chanceToBlock = 10; }
public Fighter() { // select gender at random if (RNG.Next(2) > 0) { // male = true gender = true; name = NameGenMale.GetRandomName(); } else { // (f)emale = (f)alse gender = false; name = NameGenFemale.GetRandomName(); } // start at level zero and level up once level = 0; baseStats = StatSet.TEN; LevelUp(false); RecalculateStats(); FullRecovery(); }