コード例 #1
0
 public static void Deal_Effect(Main main, bool run_delete, eBuffEvent buff_event)
 {
     foreach (KeyValuePair <long, Chess> data in Main.Inst.dic_chess)
     {
         Chess c = data.Value;
         dealBuff(c, run_delete, buff_event);
     }
     foreach (var item in main.chess_grids)
     {
         dealBuff(item.Value, run_delete, buff_event);
     }
 }
コード例 #2
0
        /* 单个效果的触发 可以直接通过analyse执行效果
         * 这里主要提供群体触发,机会回合切换等时间。(加入有什么效果的事件是其他技能发动时,也可以加,呜噗噗噗噗噗)
         */
        public static void dealBuff(IBuffContainer container, bool run_delete, eBuffEvent buff_event)
        {
            List <Buff> dead_list = new List <Buff>();   //删除标记
            List <Buff> dick      = container.getBuffList();

            foreach (Buff buff in dick)
            {
                analyseBuff_Effect(buff, buff_event);


                // 删除检查&标记
                if (run_delete)
                {
                    buff.my_Duration--;
                    if (buff.my_Duration <= 0)
                    {
                        dead_list.Add(buff);
                        analyseBuff_Effect(buff, eBuffEvent.Buff_Remove);

                        // TODO 删除特效
                        for (int i = buff.vfx_duration.Count - 1; i >= 0; i--)
                        {
                            UnityEngine.Object.Destroy(buff.vfx_duration[i]);
                        }
                    }
                }
            }

            //执行删除
            foreach (Buff i in dead_list)
            {
                if (container.getBuffList().Contains(i))
                {
                    container.getBuffList().Remove(i);
                }
            }
        }
コード例 #3
0
        public static void analyseBuff_Effect(Buff buff, eBuffEvent buff_event)
        {
            if (buff.my_buff_info.my_event != buff_event)
            {
                if (buff.my_buff_info.my_event == eBuffEvent.Buff_Exist &&
                    (buff_event == eBuffEvent.Buff_Add ||
                     buff_event == eBuffEvent.Buff_Remove)
                    )
                {
                    //如果是持续效果,则在增加和删除时触发效果
                }
                else if (buff.my_buff_info.my_event == eBuffEvent.Phase_Prepare &&
                         buff_event == eBuffEvent.Buff_Add)
                {
                    //如果是每回合造成一次效果的,会在添加时触发效果
                }
                else
                {
                    return;
                }
            }
            // continue
            switch (buff.my_buff_info.effect)
            {
            case eBuff_Effect.DOT:
                if (buff.owner_ch != null)
                {
                    DamageInfo new_dmg = new DamageInfo(buff.my_buff_info.values[0]);
                    buff.owner_ch.on_damage(new_dmg);
                }
                break;

            case eBuff_Effect.Move_BAN:
                //无
                //经过无数坑踩过后,决定这边在添加时做逻辑处理,仅显示表现
//                     if (buff.owner_chc != null && (buff_event == eBuffEvent.Buff_Add/* || buff_event == eBuffEvent.Phase_Prepare*/))
//                     {
//                         BK_AnimEvts av = BKTools.addVFX(buff.owner_chc.Main.Instance.bg_unmovable_start);
//                         av.transform.position = buff.owner_chc.transform.position + new Vector3(0, 0, -0.8f);
//                     }
//                     if (buff.owner_chc != null)
//                     {
//                         if (buff_event == eBuffEvent.Buff_Add)
//                         {
//                             switch (buff.my_buff_info.my_TargetBelong)
//                             {
//                                 case eSkill_TargetBelong.Both_Player:
//                                     buff.owner_chc.setMoveBan(ePlayer.Max);
//                                     break;
//                                 case eSkill_TargetBelong.Opponent:
//                                     ePlayer target = ePlayer.Player1;
//                                     if (buff.stand_side == ePlayer.Player1)
//                                     {
//                                         target = ePlayer.Player2;
//                                     }
//                                     buff.owner_chc.setMoveBan(target);
//                                     break;
//                                 case eSkill_TargetBelong.Teammate:
//                                     buff.owner_chc.setMoveBan(ePlayer.Max);
//                                     break;
//                                 default:
//                                     break;
//                             }
//
//                         } else if (buff_event == eBuffEvent.Buff_Remove)
//                         {
//                             buff.owner_chc.setMoveBan(ePlayer.None);
//                         }
//                     }
                break;

            case eBuff_Effect.Attack_BAN:
                break;

            case eBuff_Effect.Halo:
                List <ChessContainer> list = BKTools.GetSkillScope(buff, buff.owner.getContainer());
                foreach (ChessContainer cc in list)
                {
                    if (cc.my_chess != null)
                    {
                        //检查目标类型是否符合
                        if (BKTools.IsTargetFit(buff.my_buff_info.my_TargetBelong, cc.my_chess.belong, buff.stand_side))
                        {
                            foreach (int id in buff.my_buff_info.values)
                            {
                                cc.my_chess.AddBuff(new BuffAdder(buff.stand_side, id));
                                Debug.Log("哎呀~~~又加了一个 card_id:" + cc.my_chess.attribute.card_id);
                            }
                        }
                    }
                    if ((int)buff.my_buff_info.my_TargetBelong > 2)        // 3、4、5地面效果
                    {
                        foreach (int id in buff.my_buff_info.values)
                        {
                            cc.AddBuff(new BuffAdder(buff.stand_side, id));
                            Debug.Log("哎呀~~~又加了一个格子_id:" + cc.number);
                        }
//                                 switch (buff.my_buff_info.my_TargetBelong)
//                                 {
//                                     case eSkill_TargetBelong.地面中立:
//                                         cc.B_unmovable = true;
//                                         break;
//                                     default:
//                                         Debug.Log("warning 填写的BUFF 目标类型尚未实现,填你妈逼。  buff id : " + buff.my_buff_info.id);
//                                         break;
//                                 }
                    }
                }
                break;

            default:
                Debug.Log("buff效果ID错误。buff id-" + buff.my_buff_info.id);
                break;
            }
        }