示例#1
0
 public void ApplyStatusEffect(DD4EStatusEffect newStatusEffect)
 {
     // Extend the duration of Status Effect with similar effect
     if (StatusEffects.Exists(s => s.IsSameEffect(newStatusEffect)))
     {
         var newDamageEffect = (newStatusEffect as DD4EDamageModifier);
         if (newDamageEffect != null)
         {
             var index = StatusEffects.IndexOf(StatusEffects.Find(s => s.IsSameEffect(newStatusEffect)));
             if (newDamageEffect.DamageAmount > (StatusEffects[index] as DD4EDamageModifier).DamageAmount)
             {
                 StatusEffects[index] = newStatusEffect;
             }
         }
         else
         {
             var index = StatusEffects.IndexOf(StatusEffects.Find(s => s.IsSameEffect(newStatusEffect)));
             StatusEffects[index].Duration = newStatusEffect.Duration;
         }
     }
     else
     {
         StatusEffects.Add(newStatusEffect);
     }
     OnPropertyChanged("StatusEffects");
 }
        public virtual DD4EStatusEffect Copy()
        {
            var newStatus = new DD4EStatusEffect(Type, Source, Duration);

            newStatus.SaveModifier = this.SaveModifier;
            return(newStatus);
        }
 public override bool IsSameEffect(DD4EStatusEffect other)
 {
     if (base.IsSameEffect(other))
     {
         var otherDamage = (other as DD4EDamageModifier);
         if (otherDamage != null)
         {
             return(this.DamageType == otherDamage.DamageType);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 public virtual bool IsSameEffect(DD4EStatusEffect other)
 {
     return(this.Type == other.Type);
 }
 public override bool IsSameEffect(DD4EStatusEffect other)
 {
     return(this.Type == other.Type);
 }