Beispiel #1
0
        public CardEffect(string card_Id, float damage, ElementType element_type,
                          BuffCode buff_name_1, int add_Buff_1_Tier, BuffTarget buff_1_Target,
                          BuffCode buff_name_2, int add_Buff_2_Tier, BuffTarget buff_2_Target,
                          BuffCode buff_name_3, int add_Buff_3_Tier, BuffTarget buff_3_Target,
                          BuffCode buff_name_4, int add_Buff_4_Tier, BuffTarget buff_4_Target)
        {
            this.Card_Id         = card_Id;
            this.Damage          = damage;
            this.Element_type    = element_type;
            this.Buff_name_1     = buff_name_1;
            this.Add_Buff_1_Tier = add_Buff_1_Tier;
            this.Buff_1_Target   = buff_1_Target;

            this.Buff_name_2     = buff_name_2;
            this.Add_Buff_2_Tier = add_Buff_2_Tier;
            this.Buff_2_Target   = buff_2_Target;

            this.Buff_name_3     = buff_name_3;
            this.Add_Buff_3_Tier = add_Buff_3_Tier;
            this.Buff_3_Target   = buff_3_Target;

            this.Buff_name_4     = buff_name_4;
            this.Add_Buff_4_Tier = add_Buff_4_Tier;
            this.Buff_4_Target   = buff_4_Target;
        }
Beispiel #2
0
 public AttributeBuff(BuffTarget target, BuffType type, int value, float seconds = PERMANENT_SECONDS)
 {
     _target  = target;
     _type    = type;
     _value   = value;
     _seconds = seconds;
 }
Beispiel #3
0
 public Double Modify(BuffTarget target, Double sourceValue)
 {
     if (ModificationsByTarget.ContainsKey(target))
     {
         return ModificationsByTarget[target](sourceValue);
     }
     return sourceValue;
 }
 protected static Double ApplyBuffModifications(BuffTarget buffTarget, Double statValue, ObservableCollection<Buff> buffs)
 {
     if (buffs != null)
     {
         foreach (var buff in buffs)
         {
             statValue = buff.Modify(buffTarget, statValue);
         }
     }
     return statValue;
 }
Beispiel #5
0
 public static Buff New(BuffTarget buffTarget, Func<Double, Double> buffModification)
 {
     return new Buff(new Dictionary<BuffTarget, Func<Double, Double>> { { buffTarget, buffModification } });
 }
Beispiel #6
0
 /// <summary>
 /// 将所有非空buff加入对应角色上
 /// </summary>
 /// <param name="source">buff发起者</param>
 /// <param name="target">buff承受者</param>
 /// <param name="buff1">buff数据</param>
 /// <param name="buffcode">buff码</param>
 /// <param name="tier">层数</param>
 /// <param name="buff_target">对敌、对己</param>
 public void SetCardEffectBuff(FightHero source, FightHero target, BaseBuff buffdata, int tier, BuffTarget buff_target)
 {
     if (buffdata.Buff_Ename != BuffCode.None)
     {
         Assembly assembly = Assembly.GetExecutingAssembly();
         //参数列表,对应buff的构造函数
         object[] parameters = new object[1];
         parameters[0] = buffdata;
         object obj = assembly.CreateInstance("GameServer.Buff.Buff_" + buffdata.Buff_Id.ToString(), true, System.Reflection.BindingFlags.Default, null, parameters, null, null);
         //BaseBuff buff =new BaseBuff(obj as BaseBuff);
         BaseBuff buff = obj as BaseBuff;
         buff.Tier        = tier;
         buff.Damage_Type = DamageType.Element;
         buff.BuffSource  = source;
         buff.fightRoom   = this;
         if (buff_target == BuffTarget.Self)
         {
             if (source.IsInmmune == true && buff.Buff_Type == BuffType.NegativeState)
             {
                 return;
             }
             if (source.BuffDict.ContainsKey(buff.Buff_Ename))
             {
                 source.BuffDict[buff.Buff_Ename].AddBuffRule(tier);
             }
             else
             {
                 source.BuffDict.Add(buff.Buff_Ename, buff);
             }
         }
         if (buff_target == BuffTarget.Other)
         {
             if (target.IsInmmune == true && buff.Buff_Type == BuffType.NegativeState)
             {
                 return;
             }
             if (target.BuffDict.ContainsKey(buff.Buff_Ename))
             {
                 target.BuffDict[buff.Buff_Ename].AddBuffRule(tier);
             }
             else
             {
                 target.BuffDict.Add(buff.Buff_Ename, buff);
             }
         }
     }
 }