Пример #1
0
        /// <summary>
        /// Main constructor
        /// </summary>
        /// <param name="stats">Stats to use for this character</param>
        /// <param name="look">Look to use for this character</param>
        /// <param name="brain">Brain to use for this character</param>
        /// <param name="spells">Spells to use for this character</param>
        /// <param name="inventory">Inventory to use for this character</param>
        /// <param name="equipment">Equipment to use for this character</param>
        public Character(Stats stats, Look look, Brain brain, SpellBooks spells, Inventory inventory, Equipment equipment)
        {
            this.Stats     = stats;
            this.Buffs     = new Buffs();
            this.Brain     = brain;
            this.Look      = look;
            this.Spells    = spells;
            this.Inventory = inventory;
            this.Equipment = equipment;
            this.flags     = new HashSet <Flag>();

            Brain.Spells = this.Spells;
            Stats.Update(this);
            Equipment.AddBuff    = b => Buffs.AddBuff(b);
            Equipment.RemoveBuff = b => Buffs.RemoveBuff(RemovalType.DISPEL, b);
            Stats.InitializeResources();
            Stats.GetEquipmentBonus = f => Equipment.GetBonus(f);
            Buffs.Stats             = Stats;
            this.id = idCounter++;
        }