Esempio n. 1
0
        public void RemoveAffliction(ICharacter character, IAffliction affliction)
        {
            if (!_charAfflDictionary.ContainsKey(character))
            {
                return;
            }

            var afflictions = _charAfflDictionary[character];

            afflictions.Remove(affliction);
        }
Esempio n. 2
0
        public void TryToApplyDebuff(ICharacter target, DebuffResistance type, int applyChance)
        {
            var result = new BoolConsolidator();

            target.FireApplyingDebuffEvent(result);
            if (!result.Result())
            {
                return;
            }

            if (!target.Stats.TryToApplyDebuf(type, applyChance))
            {
                return;
            }

            IAffliction affl    = null;
            var         afflFac = Model.AfflictionFactory;

            switch (type)
            {
            case DebuffResistance.PSN:
                affl = afflFac.GetAffliction("Poison");
                target.AddAffliction("PSN");
                break;

            case DebuffResistance.PAR:
                affl = afflFac.GetAffliction("Paralyze");
                target.AddAffliction("PAR");
                break;

            case DebuffResistance.DTH:
                affl = afflFac.GetAffliction("InstaDeath");
                target.AddAffliction("DTH");
                break;

            case DebuffResistance.SIL:
                affl = afflFac.GetAffliction("Silence");
                target.AddAffliction("SIL");
                break;
            }

            if (affl == null)
            {
                return;
            }

            affl.AttachTo(target);
            _charAfflDictionary.GetOrCreate(target).Add(affl);
        }