Exemplo n.º 1
0
    /// <summary>
    /// 判断某一skilleffect是否是有害的.
    /// </summary>
    /// <param name="type">skilleffect的类型</param>
    /// <param name="resID">skilleffect的资源ID</param>
    /// <returns></returns>
    public static bool IsHarmfulEffect(SkillEffectType type, uint resID)
    {
        switch (type)
        {
        case SkillEffectType.Buff:
            SkillBuffTableItem resBuff = DataManager.BuffTable[resID] as SkillBuffTableItem;
            return(resBuff == null || resBuff.harmful);

        case SkillEffectType.Impact:
            SkillImpactTableItem resImpact = DataManager.ImpactTable[resID] as SkillImpactTableItem;
            return(resImpact == null || resImpact.harmful);

        case SkillEffectType.Displacement:
            SkillDisplacementTableItem resDisplacement = DataManager.DisplacementTable[resID] as SkillDisplacementTableItem;
            return(resDisplacement == null || resDisplacement.harmful);

        case SkillEffectType.Spasticity:
            return(true);

        default:
            ErrorHandler.Parse(ErrorCode.LogicError, "invalid skill effect type: " + type);
            break;
        }

        return(true);
    }
Exemplo n.º 2
0
    public void Add(BattleUnit owner, SkillBuffTableItem buffRes, SkillRandEventTableItem randEventResource, /*const*/ ref AttackerAttr buffCreaterAttr)
    {
        BattleUnitRandEvent item = new BattleUnitRandEvent(buffRes, randEventResource);

        item.LoadScript(owner, ref buffCreaterAttr);
        mContainer[(int)randEventResource.triggerType].Add(item);
    }
Exemplo n.º 3
0
    public BattleUnitRandEvent(SkillBuffTableItem buffRes, SkillRandEventTableItem resource)
    {
        fromBuffRes    = buffRes;
        cdMilliseconds = 0;

        randEventResource = resource;
    }
Exemplo n.º 4
0
    public override bool Initialize(SkillEffectInitParam param)
    {
        SkillBuffInitParam buffInit = param as SkillBuffInitParam;

        mBuffRes = buffInit.buffResource;

        return(mBuffRes != null && base.Initialize(param));
    }
Exemplo n.º 5
0
    public static ErrorCode RemoveRandEvent(BattleUnit owner,
                                            BattleUnitRandEventContainer randEventContainer,
                                            SkillBuffTableItem buffRes,
                                            SkillEffectStopReason stopReason
                                            )
    {
        if (buffRes.randEvent == uint.MaxValue)
        {
            return(ErrorCode.Succeeded);
        }

        randEventContainer.Remove(buffRes, stopReason);

        return(ErrorCode.Succeeded);
    }
Exemplo n.º 6
0
    protected virtual void onSkillBuffAdded(uint resID)
    {
        SkillBuffTableItem buffRes = DataManager.BuffTable[resID] as SkillBuffTableItem;
        Vector3            headPos = Vector3.zero;

        if (!string.IsNullOrEmpty(buffRes.icon) && (headPos = this.GetBonePositionByName("head")) != Vector3.zero)
        {
            headPos   = CameraController.Instance.WorldToScreenPoint(headPos);
            headPos.z = 0.0f;

            BattleUIEvent evt = new BattleUIEvent(BattleUIEvent.BATTLE_UI_BUFF_ADDED);
            evt.bmpPath = buffRes.icon;
            evt.pos     = headPos;
            EventSystem.Instance.PushEvent(evt);
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 添加randEventResourceID指定的skillrandevent资源.
    /// </summary>
    /// <param name="randEventResourceID"></param>
    public static ErrorCode AddRandEvent(BattleUnit owner,
                                         BattleUnitRandEventContainer randEventContainer,
                                         SkillBuffTableItem buffRes,
                                         AttackerAttr buffCreaterAttr
                                         )
    {
        if (buffRes.randEvent == uint.MaxValue)
        {
            return(ErrorCode.Succeeded);
        }

        SkillRandEventTableItem randEventRes = DataManager.RandEventTable[buffRes.randEvent] as SkillRandEventTableItem;

        randEventContainer.Add(owner, buffRes, randEventRes, ref buffCreaterAttr);

        return(ErrorCode.Succeeded);
    }
Exemplo n.º 8
0
    public void Remove(SkillBuffTableItem buffRes, SkillEffectStopReason stopReason)
    {
        SkillRandEventTableItem randEventRes = DataManager.RandEventTable[buffRes.randEvent] as SkillRandEventTableItem;

        if (randEventRes == null)
        {
            return;
        }

        List <BattleUnitRandEvent> typedContainer = mContainer[(int)randEventRes.triggerType];

        BattleUnitRandEvent node = typedContainer.Find(x => (x.fromBuffRes.resID == buffRes.resID && x.randEventResource.resID == randEventRes.resID));

        if (node != null)
        {
            node.StopScript(stopReason);
            typedContainer.Remove(node);
        }
    }
Exemplo n.º 9
0
    private void OnWeaponSuccess()
    {
        if (mVisual == null || mVisual.Visual == null)
        {
            return;
        }
        if (mWeapon == null || !mWeapon.IsCompleteOrDestroy)
        {
            return;
        }

        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem;

        Transform bone = mVisual.GetBoneByName(mWeaopnRes.mountpoint);

        if (bone == null)
        {
            bone = mVisual.VisualTransform;
        }

        string animname = AnimationNameDef.GetAnimNameByStatename(mWeaopnRes.ani_pre, AnimationNameDef.PrefixXiuxi);

        PlayAnimaton(animname);


        AttachMent attachment = mAttachMents[(int)AttachMountType.Weapon];

        if (attachment == null)
        {
            return;
        }

        if (mWeaopnRes.weapon_buff != uint.MaxValue)
        {
            SkillBuffTableItem sbt = DataManager.BuffTable[mWeaopnRes.weapon_buff] as SkillBuffTableItem;
            if (sbt != null)
            {
                ParticleUtility.AddEffect2MV(mWeapon, (int)sbt._3DEffectID, sbt._3DEffectBindpoint, ParticleMng);
            }
        }
    }
Exemplo n.º 10
0
 public ErrorCode RemoveRandEvent(SkillBuffTableItem buffRes, SkillEffectStopReason stopReason)
 {
     return(SkillDetails.RemoveRandEvent(this, mRandEventContainer, buffRes, stopReason));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 添加randEventResourceID指定的skillrandevent资源.
 /// </summary>
 /// <param name="buffRes">来自哪个buff.</param>
 /// <param name="buffCreaterAttr">buff创建者的属性</param>
 public ErrorCode AddRandEvent(SkillBuffTableItem buffRes, AttackerAttr buffCreaterAttr)
 {
     return(SkillDetails.AddRandEvent(this, mRandEventContainer, buffRes, buffCreaterAttr));
 }
Exemplo n.º 12
0
    private bool checkSkillCommon()
    {
        DataType myName           = DataType.DATA_SKILL_COMMON;
        IDictionaryEnumerator itr = DataManager.SkillCommonTable.GetEnumerator();

        while (itr.MoveNext())
        {
            SkillCommonTableItem item = itr.Value as SkillCommonTableItem;
            if (!checkParam(item.myCd != uint.MaxValue, myName, item.resID, "cd"))
            {
                return(false);
            }

            if (!checkParam(item.manaCost != uint.MaxValue && item.bulletCost != uint.MaxValue,
                            myName, item.resID, "cost"))
            {
                return(false);
            }

            if (!checkParam(item.skillUseStateDuration > item.skillEffectStartTime, myName, item.resID, "技能覆盖时间",
                            "assert(技能开始时间 < 技能覆盖时间)"))
            {
                return(false);
            }

            if (!checkParam(item.skillUseStateLoopLeft != 0, myName, item.resID, "技能使用阶段的循环次数"))
            {
                return(false);
            }

            if (!checkParam(item.maxRange > 0 && item.minRange >= 0, myName, item.resID, "skillrange"))
            {
                return(false);
            }

            if (item.chargeBehaviour != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_BEHAVIOUR, item.chargeBehaviour))
            {
                return(false);
            }

            if (item.useBehaviour != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_BEHAVIOUR, item.useBehaviour))
            {
                return(false);
            }

            if (item.buffToSkillUser != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_BUFF, item.buffToSkillUser))
            {
                return(false);
            }

            if (item.buffToSkillUser != uint.MaxValue)
            {
                SkillBuffTableItem buffItem = DataManager.BuffTable[item.buffToSkillUser] as SkillBuffTableItem;
                if (!checkParam(buffItem.lifeMilliseconds == uint.MaxValue, DataType.DATA_SKILL_BUFF, (int)item.buffToSkillUser,
                                "buffToSkillUser", "控制行为的buff的持续时间必须为-1"))
                {
                    return(false);
                }
            }

            if (item.skillEffect2UserInUseState != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_EFFECT, item.skillEffect2UserInUseState))
            {
                return(false);
            }

            if (item.targetSelection != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_TARGET_SELECTION, item.targetSelection))
            {
                return(false);
            }

            if (item.skillEffect2Others != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_EFFECT, item.skillEffect2Others))
            {
                return(false);
            }

            if (item.projectileResID != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_PROJECTILE_SETTINGS, item.projectileResID))
            {
                return(false);
            }

            if (item.creationID != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_CREATION, item.creationID))
            {
                return(false);
            }
        }
//      foreach (int key in DataManager.SkillCommonTable.Keys)
//      {
//
//      }

        return(true);
    }
Exemplo n.º 13
0
    private bool checkBuff()
    {
        DataType myName           = DataType.DATA_SKILL_BUFF;
        IDictionaryEnumerator itr = DataManager.BuffTable.GetEnumerator();

        while (itr.MoveNext())
        {
            SkillBuffTableItem item = itr.Value as SkillBuffTableItem;
            if (!checkParam(item.removeCondition < BuffRemoveCondition.Count, myName, item.resID, "buff移除条件"))
            {
                return(false);
            }

            if (!checkParam(item.stackCountMax > 0, myName, item.resID, "叠加次数"))
            {
                return(false);
            }

            if (item.dotEffectTargetSelection != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_TARGET_SELECTION, item.dotEffectTargetSelection))
            {
                return(false);
            }

            if (item.dotEffect2Others != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_EFFECT, item.dotEffect2Others))
            {
                return(false);
            }

            if (item.randEvent != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_RAND_EVENT, item.randEvent))
            {
                return(false);
            }

            if (item.newModelID != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_MODEL, item.newModelID))
            {
                return(false);
            }

            if (item.newWeaponID != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_WEAPON, item.newWeaponID))
            {
                return(false);
            }

            if (item.superNewWeaponID != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_WEAPON, item.superNewWeaponID))
            {
                return(false);
            }

            try
            {
                SkillUtilities.ParseProperties(item.properties);
            }
            catch (System.Exception exp)
            {
                GameDebug.LogError("buff.txt[" + item.resID + "]的属性格式错误.");
            }

            if (item.effect2OwnerOnExpired != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_EFFECT, item.effect2OwnerOnExpired))
            {
                return(false);
            }

            if (item.targetSelectionOnExpired != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_TARGET_SELECTION, item.targetSelectionOnExpired))
            {
                return(false);
            }

            if (item.effect2OthersOnExpired != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_SKILL_EFFECT, item.effect2OthersOnExpired))
            {
                return(false);
            }

            if (item._3DEffectID != uint.MaxValue &&
                !checkLink(myName, item.resID, DataType.DATA_EFFECT, item._3DEffectID))
            {
                return(false);
            }
        }
//      foreach (int key in DataManager.BuffTable.Keys)
//      {
//
//      }

        return(true);
    }