Exemplo n.º 1
0
//      private const int key_BuffId3_SkillConfig = 2;
        public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            var buffId1 = self.GetSkillIntParam(skillConfig, key_BuffId1_SkillConfig);
            var buffId2 = self.GetSkillIntParam(skillConfig, key_BuffId2_SkillConfig);
            var tarBuff = target.GetBuffList().Where(b => target.GetBuffID(b) == buffId1);

            if (tarBuff != null && tarBuff.FirstOrDefault() != null)
            {
                BattleModule.AddBuff(target, self, buffId2, BattleReason.Skill);
                BattleModule.RemoveBuff(target, self, buffId1, BattleReason.Skill);
            }
            else
            {
                BattleModule.AddBuff(target, self, buffId1, BattleReason.Skill);
                BattleModule.RemoveBuff(target, self, buffId2, BattleReason.Skill);
            }

            return(true);
        }
        override public BuffSuperpositionRet OnBuffSuperposition(SkillObj tarObj, SkillObj srcObj, BattleReason reason, BuffConfig_New buffConfig)
        {
            BuffSuperpositionRet ret;

            ret.bType = BuffSuperpositionType.None;
            ret.buff  = null;
            var buffKey = tarObj.GetBuffKey(buffConfig);

            foreach (var tarBuff in tarObj.GetBuffList())
            {
                var tarBuffConfig = tarObj.GetBuffConfig(tarObj.GetBuffID(tarBuff));
                if (tarBuffConfig != null && tarObj.GetBuffKey(tarBuffConfig).Equals(buffKey))
                {
                    BattleModule.RemoveBuff(tarObj, srcObj, tarObj.GetBuffID(tarBuff), BattleReason.Replace);
                    //BattleModule.DetachBuff(tarObj, srcObj, tarBuff, tarBuffConfig);
                }
            }

            ret.bType = BuffSuperpositionType.Add;
            ret.buff  = new BuffInfo_New();
            return(ret);
        }