Esempio n. 1
0
 public void ForEach_buff(Action <Actor, BuffResultInfo> action, BuffResultInfo buffResultInfo)
 {
     foreach (var item in m_actorMap)
     {
         action(item.Value, buffResultInfo);
     }
 }
Esempio n. 2
0
 public virtual void Load(BinaryHelper helper)
 {
     ID                 = helper.ReadInt();
     BuffName           = helper.ReadString();
     BuffDesc           = helper.ReadString();
     BuffIcon           = helper.ReadInt();
     BuffType           = helper.ReadInt();
     BuffEffectType     = helper.ReadInt();
     BuffPercent        = helper.ReadFloat();
     BuffPercentParam   = helper.ReadFloat();
     BuffDuration       = helper.ReadFloat();
     BuffDurationParam  = helper.ReadFloat();
     IsFirstWork        = helper.ReadBool();
     Period             = helper.ReadFloat();
     IsNotRemoveForDead = helper.ReadBool();
     Replaceable        = helper.ReadInt();
     BuffEffectID       = helper.ReadInt();
     MultiplyParam      = helper.ReadFloat();
     AddParam           = helper.ReadFloat();
     for (int i = 0; i < PropertyCount; ++i)
     {
         if (PropertyPercentList == null)
         {
             PropertyPercentList = new float[PropertyCount];
         }
         PropertyPercentList[i] = helper.ReadFloat();
     }
     for (int j = 0; j < PropertyCount; ++j)
     {
         if (PropertyValueList == null)
         {
             PropertyValueList = new float[PropertyCount];
         }
         PropertyValueList[j] = helper.ReadFloat();
     }
     BuffResultCount = helper.ReadInt();
     BuffResultList  = new List <BuffResultInfo>(BuffResultCount);
     for (int index = 0; index < BuffResultCount; ++index)
     {
         BuffResultInfo info = new BuffResultInfo();
         info.ID = helper.ReadInt();
         for (int innerIndex = 0; innerIndex < info.ParamList.Length; ++innerIndex)
         {
             info.ParamList[innerIndex] = helper.ReadFloat();
         }
         BuffResultList.Add(info);
     }
 }
Esempio n. 3
0
    void CheckActorDistance(Actor target, BuffResultInfo info)
    {
        if (target.Type == ActorType.enNPC)
        {
            NPC npc = target as NPC;
            if (npc.GetNpcType() == ENNpcType.enBlockNPC ||
                npc.GetNpcType() == ENNpcType.enFunctionNPC)
            {
                return;
            }
        }
        else if (target.Type == ActorType.enMain)
        {
            if (target.IsActorExit)
            {
                return;
            }
        }
        if (target.IsDead)
        {
            return;
        }

        switch ((ENTargetType)info.ParamList[2])//判断技能目标类型
        {
        case ENTargetType.enEnemy:
        {
            if (!ActorTargetManager.IsEnemy(m_selfActor, target))
            {
                return;
            }
        }
        break;

        case ENTargetType.enFriendly:
        {
            if (!ActorTargetManager.IsFriendly(m_selfActor, target))
            {
                return;
            }
        }
        break;

        case ENTargetType.enSelf:
        {
            if (m_selfActor != target)
            {
                return;
            }
        }
        break;

        case ENTargetType.enNullTarget:
            break;

        case ENTargetType.enFriendlyAndSelf:
        {
            if (!ActorTargetManager.IsFriendly(m_selfActor, target) && m_selfActor != target)
            {
                return;
            }
        }
        break;

        default:
            break;
        }
        float distance = ActorTargetManager.GetTargetDistance(m_selfActor.RealPos, target.RealPos);
        bool  tmpFlag  = true;

        if (distance <= info.ParamList[1])//判断光环半径
        {
            foreach (Buff tmpBuf in target.MyBuffControl.BuffList)
            {
                if (tmpBuf.BuffID == (int)info.ParamList[2])
                {
                    tmpFlag = false;
                }
            }
            if (tmpFlag)
            {
                IResult addBuffResult = BattleFactory.Singleton.CreateResult(ENResult.AddBuff, m_selfActor.ID, target.ID, 0, 0, new float[1] {
                    info.ParamList[3]
                });
                if (addBuffResult != null)
                {
                    addBuffResult.ResultExpr(new float[1] {
                        info.ParamList[3]
                    });                                                          //添加技能ID
                    BattleFactory.Singleton.DispatchResult(addBuffResult);
                }
            }
        }
        else
        {
            tmpFlag = false;
            foreach (Buff tmpBuf in target.MyBuffControl.BuffList)
            {
                if (tmpBuf.BuffID == info.ParamList[2])
                {
                    tmpFlag = true;
                }
            }
            if (tmpFlag)
            {
                IResult rbResult = BattleFactory.Singleton.CreateResult(ENResult.RemoveBuff, m_selfActor.ID, target.ID, 0, 0, new float[2] {
                    (float)ResultRemoveBuff.ENRemoveBuffType.enBuffID, info.ParamList[3]
                });
                if (rbResult != null)
                {
                    rbResult.ResultExpr(new float[2] {
                        (float)ResultRemoveBuff.ENRemoveBuffType.enBuffID, info.ParamList[3]
                    });
                    BattleFactory.Singleton.DispatchResult(rbResult);
                }
            }
        }
    }