Beispiel #1
0
        protected override void OnTurnCounterUpdating(ICharacter character, BoolConsolidator result)
        {
            var timeStep        = character.Stats.GetTotalStat(BaseStat.SPD);
            var currentStrength = GetVar(character, "par_Strength");
            var newStrength     = currentStrength - timeStep;

            SetVar(character, "par_Strength", newStrength);

            if (newStrength <= 0)
            {
                RemoveFrom(character);
            }
            result.AddResult(false);
        }
Beispiel #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);
        }
Beispiel #3
0
        public bool UpdateTurnCounter(bool invokeEvents = true)
        {
            if (IsDead)
            {
                return(false);
            }

            var timeStep = _stats.GetTotalStat(Stat.SPD);

            if (invokeEvents)
            {
                var eventResult = new BoolConsolidator();
                TurnCounterUpdating(this, eventResult);
                if (!eventResult.Result())
                {
                    return(false);
                }
            }

            var result = false;

            TurnCounter += timeStep;

            if (TurnCounter >= TimeToAction)
            {
                UseMP(-10d);
                TurnCounter -= TimeToAction;
                result       = true;
                _stats.ReduceBuffEffectiveness();
                if (invokeEvents)
                {
                    TurnTriggered(this);
                }
                ResetDamageTaken();
            }

            if (invokeEvents)
            {
                TurnCounterUpdated(this);
            }

            TakesTurn = result;
            return(result);
        }
Beispiel #4
0
        public void ApplyAffliction(ICharacter target, string affliction)
        {
            var affl   = Model.AfflictionFactory.GetAffliction(affliction);
            var result = new BoolConsolidator();

            if (affl.Type == AfflictionType.Buff)
            {
                target.FireApplyingBuffEvent(result);
            }
            else
            {
                target.FireApplyingDebuffEvent(result);
            }

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

            affl.AttachTo(target);
            target.AddAffliction(affliction);
            _charAfflDictionary.GetOrCreate(target).Add(affl);
        }
Beispiel #5
0
 public void FireApplyingBuffEvent(BoolConsolidator result)
 {
     ApplyingBuff(this, result);
 }
 protected virtual void OnApplyingBuff(ICharacter character, BoolConsolidator result)
 {
 }
 protected virtual void OnTurnCounterUpdating(ICharacter character, BoolConsolidator result)
 {
 }