Ejemplo n.º 1
0
        public EquipmentSystem()
        {
            NodeFilter <EquipmentNode> .Setup(EquipmentNode.GetTypes());

            EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] {
                typeof(Equipment)
            }));
        }
Ejemplo n.º 2
0
        public void SetStats(IEquipmentHolder holder, EquipmentNode node)
        {
            if (node.Equipment == null)
            {
                return;
            }
            //var ownerStats = SlotOwner.GetEntity().Stats;
            //var skillComponent = Item.Get<SkillRequirement>();
            //var skill = skillComponent != null ? skillComponent.Skill : GameData.Skills.GetID(0);
            //if (TargetSlot == EquipmentSlotType.MainHand) {
            //    bool ranged = Item.Tags.Contain(EntityTags.RangedWeapon);
            //    var charSkill = ownerStats.Get(skill);
            //    if (charSkill != null) {
            //        _currentStats.Add(new DerivedStatModHolder(charSkill, Item.Stats.Get(Stats.ToHit), RpgSettings.SkillStandardToHitBonus));
            //    }
            //    _currentStats.Add(new DerivedStatModHolder(ownerStats.Get(ranged ? Stats.BonusPowerRanged : Stats.BonusPowerMelee), Item.Stats.Get(Stats.Power), 1));
            //    _currentStats.Add(new DerivedStatModHolder(ownerStats.Get(ranged ? Stats.BonusToHitRanged : Stats.BonusToHitMelee), Item.Stats.Get(Stats.ToHit), 1));
            //    _currentStats.Add(new DerivedStatModHolder(ownerStats.Get(ranged ? Stats.BonusCritRanged : Stats.BonusCritMelee), Item.Stats.Get(Stats.CriticalHit), 1));
            //}
            ClearStats(node.Equipment);
            var itemStats = node.Equipment.GetEntity().Get <StatsContainer>();

            if (node.Equipment.Mods == null || node.Equipment.Mods.Length != node.Equipment.StatsToEquip.Count)
            {
                node.Equipment.Mods = new StatModHolder[node.Equipment.StatsToEquip.Count];
                for (int i = 0; i < node.Equipment.Mods.Length; i++)
                {
                    node.Equipment.Mods[i] = new DerivedStatModHolder(itemStats.Get(node.Equipment.StatsToEquip[i]), 1);
                }
            }
            var slotStats = holder.Owner.Get <StatsContainer>();

            for (int i = 0; i < node.Equipment.Mods.Length; i++)
            {
                node.Equipment.Mods[i].Attach(slotStats.Get(node.Equipment.Mods[i].StatID));
            }
        }