Пример #1
0
        /// <summary>
        /// Process a move this fighter is the target of.
        /// </summary>
        protected void ReceiveMove(List <Effect> ReceivedEffects, PassiveList DamagingMods, double initDmg)
        {
            // Add pertinent pre-damage modifiers
            foreach (PassiveEffect e in ReceivedEffects)
            {
                if (e.InitialCalculationBoolean == true)
                {
                    switch (e.IOType)
                    {
                    case PassiveEffect.ModType.Weakness:
                        SelfDamageModifiers.Add(e);
                        break;

                    case PassiveEffect.ModType.Buff:
                        SelfDamageModifiers.Add(e);
                        break;

                    case PassiveEffect.ModType.Move:
                        SelfMoveModifiers.Add(e);
                        break;
                    }
                }
            }

            Damage(initDmg, DamagingMods);

            foreach (Effect e in ReceivedEffects)
            {
                AddEffect(e);
            }
        }
Пример #2
0
 /// <summary>
 /// Adds an effect to the fighter, if its InitialCalculationBoolean is false or if it is an active effect
 /// </summary>
 public bool AddEffect(Effect e)
 {
     if (e is ActiveEffect)
     {
         FighterEffects.Add((ActiveEffect)e);
         return(true);
     }
     else if (e is PassiveEffect && !((PassiveEffect)e).InitialCalculationBoolean)
     {
         if (((PassiveEffect)e).IOType == PassiveEffect.ModType.Weakness)
         {
             SelfDamageModifiers.Add((PassiveEffect)e);
             return(true);
         }
         else if (((PassiveEffect)e).IOType == PassiveEffect.ModType.Move)
         {
             SelfMoveModifiers.Add((PassiveEffect)e);
             return(true);
         }
         else if (((PassiveEffect)e).IOType == PassiveEffect.ModType.Buff)
         {
             OutDamageModifiers.Add((PassiveEffect)e);
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
        /// <summary>
        /// Shallow clone
        /// </summary>
        public object Clone()
        {
            PassiveList output = new PassiveList();

            foreach (PassiveEffect PE in modifiers)
            {
                output.Add(PE);
            }

            return(output);
        }
Пример #4
0
        /// <summary>
        /// Damage the fighter applying damage modifiers (on both fighter and attacker)
        /// to the damage.
        /// </summary>
        public void Damage(double damage, PassiveList DamageModifiers)
        {
            PassiveList DamageModifierClone = (PassiveList)DamageModifiers.Clone();

            foreach (PassiveEffect mod in SelfDamageModifiers)
            {
                DamageModifierClone.Add(mod);
            }
            damage = DamageModifierClone.CalculateMax(damage, 0);

            Tuple <double, double> pair = SpeedDamage(damage);

            Speed -= pair.Item2;
            damage = DamageModifierClone.CalculateMin(pair.Item1, 0);
            HealthDamage(damage);
        }