Esempio n. 1
0
        public void EquipEffect()
        {
            Assert.AreEqual(100f, hero.GetStat(StatType.Health).Value);

            IEffect helmEffect_health = new EquipEffect(EffectTarget.Character, StatType.Health, 60f);
            IEffect helmEffect_energy = new EquipEffect(EffectTarget.Character, StatType.Energy, -60f);
            IEffect helmEffect_int    = new EquipEffect(EffectTarget.Character, StatType.Intelligence, 10f);

            Equipment helm_air = new Equipment(997, "helm of air", "air", EquipSlot.Head);

            helm_air.AddEquipEffect(helmEffect_health);
            helm_air.AddEquipEffect(helmEffect_energy);
            helm_air.AddEquipEffect(helmEffect_int);
            hero.Interact(helm_air);
            hero.EquipItem(helm_air);

            Assert.AreEqual(helm_air.Equiped, true);

            Assert.AreEqual(160f, ((RegenerationStat)hero.GetStat(StatType.Health)).MaxValue);
            Assert.AreEqual(100f, ((RegenerationStat)hero.GetStat(StatType.Health)).Value);

            Assert.AreEqual(40f, ((RegenerationStat)hero.GetStat(StatType.Energy)).MaxValue);
            Assert.AreEqual(40f, ((RegenerationStat)hero.GetStat(StatType.Energy)).Value);

            Assert.AreEqual(40f, hero.GetStat(StatType.Intelligence).Value);



            //change helm

            //hero.EquipItem(
        }
Esempio n. 2
0
    //更新初始数据
    public void Init(int id)
    {
        this.id = id;
        var datas = ConfigEquipManager.Instance().allDatas[id];

        name      = datas.name;
        equipType = datas.equipType;
        level     = datas.level;

        foreach (var v in datas.attributes)
        {
            attributes.Add(v.Key, v.Value);
        }
        //TODO 生成特殊效果
        var effectIds = datas.effects;

        foreach (int vid in effectIds)
        {
            if (vid != 0)
            {
                effects.Add(EquipEffect.CreatEffect(vid));
            }
        }

        if (attributes.ContainsKey(-1))
        {
            attributes = null;
        }

        InitDesc();
    }
Esempio n. 3
0
 public void EquipEffect(EquipEffect effect)
 {
     modifiers.Add(effect);
     if (value > MaxValue)
     {
         value = MaxValue;
     }
 }
Esempio n. 4
0
        public void CreateEquipItemTest()
        {
            Equipment   helm_air       = new Equipment(997, "helm of air", "air", EquipSlot.Head);
            EquipEffect increaseHealth = new EquipEffect(EffectTarget.Character, StatType.Health, +30f);

            helm_air.AddEquipEffect(increaseHealth);

            Assert.AreEqual(997, helm_air.Id);
            Assert.AreEqual(EquipSlot.Head, helm_air.Slot);
            Assert.AreEqual("helm of air", helm_air.Name);
            Assert.AreEqual("air", helm_air.Description);

            Assert.AreEqual(increaseHealth.Target, helm_air.EquipEffects[0].Target);
            Assert.AreEqual(increaseHealth.TargetStat, helm_air.EquipEffects[0].TargetStat);
            Assert.AreEqual(increaseHealth.Value, helm_air.EquipEffects[0].Value);
        }
Esempio n. 5
0
        public void Init()
        {
            List <IStat> stats = new List <IStat>
            {
                new RegenerationStat(100f, StatType.Health),
                new RegenerationStat(100f, StatType.Energy),
                new RegenerationStat(100f, StatType.Stamina),
                new Stat(30f, StatType.Intelligence),
                new Stat(50f, StatType.Luck)
            };

            hero = new Hero("Kazisvet III.", "z Bozi vule král", stats, new Storage <IItem>(), new Storage <ConsumableItem>(), new Storage <IEquiped>());

            IEffect restoreHealth = new InstantEffect(EffectTarget.Character, StatType.Health, 40f);

            healthPotion = new ConsumableItem(99, "Health of Potion", "Get 40hp", restoreHealth);

            helm = new Equipment(999, "helm of fire", "fireeee", EquipSlot.Head);
            EquipEffect increaseHealth = new EquipEffect(EffectTarget.Character, StatType.Health, +30f);

            helm.AddEquipEffect(increaseHealth);

            iron = new Resources(19, "iron", "resource item");
        }
Esempio n. 6
0
 public void RemoveEquipEffect(EquipEffect effect)
 {
     EquipEffects.Find(x => x.TargetStat == effect.TargetStat).IncreastValue(-effect.Value);
     EquipEffects.RemoveAll(x => x.Value == 0);
 }
Esempio n. 7
0
 public void EquipEffect(EquipEffect effect)
 {
     modifiers.Add(effect);
 }