// --- constructors --- internal Stats(Figure owner, int s, int p, int e, int c, int i, int a, int l) { Owner = owner; _values = new int[7] { s, p, e, c, i, a, l }; _mods = new int[7] { 0, 0, 0, 0, 0, 0, 0 }; }
// --- constructors --- internal Skills(Figure owner) { Owner = owner; // generating starting values _values = new int[19]; _values[(int)Skill.SMALL_GUNS] = (owner.Stats.Agility * 4) + 5; _values[(int)Skill.BIG_GUNS] = (owner.Stats.Agility * 2) + 0; _values[(int)Skill.ENERGY_WEAPONS] = (owner.Stats.Agility * 2) + 0; _values[(int)Skill.UNARMED] = ((owner.Stats.Agility + owner.Stats.Strength) * 2) + 30; _values[(int)Skill.MELEE_WEAPONS] = ((owner.Stats.Agility + owner.Stats.Strength) * 2) + 20; _values[(int)Skill.THROWING] = (owner.Stats.Agility * 4) + 0; _values[(int)Skill.FIRST_AID] = ((owner.Stats.Perception + owner.Stats.Endurance) * 2) + 0; _values[(int)Skill.DOCTOR] = (owner.Stats.Perception + owner.Stats.Intelligence) + 5; _values[(int)Skill.SNEAK] = (owner.Stats.Agility * 3) + 5; _values[(int)Skill.LOCKPICK] = (owner.Stats.Perception + owner.Stats.Agility) + 10; _values[(int)Skill.STEAL] = (owner.Stats.Agility * 3) + 0; _values[(int)Skill.TRAPS] = (owner.Stats.Perception + owner.Stats.Agility) + 10; _values[(int)Skill.SCIENCE] = (owner.Stats.Intelligence * 4) + 0; _values[(int)Skill.REPAIR] = (owner.Stats.Intelligence * 3) + 0; _values[(int)Skill.PILOT] = ((owner.Stats.Agility + owner.Stats.Perception) * 2) + 0; _values[(int)Skill.SPEECH] = (owner.Stats.Charisma * 5) + 0; _values[(int)Skill.BARTER] = (owner.Stats.Charisma * 4) + 0; _values[(int)Skill.GAMBLING] = (owner.Stats.Luck * 5) + 0; _values[(int)Skill.OUTDOORSMAN] = ((owner.Stats.Endurance + owner.Stats.Intelligence) * 2) + 20; }
internal Combat(Figure initiator, Figure[] player, Figure[] enemy) { PlayerFaction = player; EnemyFaction = enemy; Initiator = initiator; RecalcSequence(); Round = 0; }
internal void RecalcSequence() { var temp = new Figure[PlayerFaction.Length + EnemyFaction.Length]; PlayerFaction.CopyTo(temp, 0); EnemyFaction.CopyTo(temp, PlayerFaction.Length); Array.Sort(temp, delegate(Figure f1, Figure f2) { return f1.Stats.Sequence.CompareTo(f2.Stats.Sequence); }); Sequence = (Figure[])temp.Reverse<Figure>(); }
internal void Attack( Figure attacker, Figure defender ) { var attackDie = new Die( Global.Random, 20 ); if ( attackDie.Roll() + attacker.AttackBonus >= defender.ArmorClass ) { int damage = attacker.Damage.Roll().Sum(); defender.Health -= damage; Debug.WriteLine( "{0} hit {1} for {2} and he has {3} health remaining.", attacker.Name, defender.Name, damage, defender.Health ); if ( defender.Health <= 0 ) { if ( defender is AggressiveEnemy ) { var enemy = defender as AggressiveEnemy; _aggressiveEnemies.Remove( enemy ); } Debug.WriteLine( "{0} killed {1}", attacker.Name, defender.Name ); } } else { Debug.WriteLine( "{0} missed {1}", attacker.Name, defender.Name ); } }
static Attack() { att = null; def = null; }
internal static Stats NewRandom(Figure owner, Random rnd, int[] min, int[] max) { return new Stats( owner, rnd.Next(min[(int)Stat.ST], max[(int)Stat.ST] + 1), rnd.Next(min[(int)Stat.PE], max[(int)Stat.PE] + 1), rnd.Next(min[(int)Stat.EN], max[(int)Stat.EN] + 1), rnd.Next(min[(int)Stat.CH], max[(int)Stat.CH] + 1), rnd.Next(min[(int)Stat.IN], max[(int)Stat.IN] + 1), rnd.Next(min[(int)Stat.AG], max[(int)Stat.AG] + 1), rnd.Next(min[(int)Stat.LK], max[(int)Stat.LK] + 1)); }
internal static Stats NewRandom(Figure owner, Random rnd, int min, int max) { return new Stats( owner, rnd.Next(min,max+1), rnd.Next(min,max+1), rnd.Next(min,max+1), rnd.Next(min,max+1), rnd.Next(min,max+1), rnd.Next(min,max+1), rnd.Next(min,max+1) ); }
internal static Stats NewFixed(Figure owner, int[] vals) { return new Stats( owner, vals[(int)Stat.ST], vals[(int)Stat.PE], vals[(int)Stat.EN], vals[(int)Stat.CH], vals[(int)Stat.IN], vals[(int)Stat.AG], vals[(int)Stat.LK]); }
// --- static methodes --- internal static Stats NewFixed(Figure owner, int val) { return new Stats(owner, val, val, val, val, val, val, val); }
internal Stats(Figure owner, int[] stats) : this(owner, stats[0], stats[1], stats[2], stats[3], stats[4], stats[5], stats[6]) { }