static int ParseCsv(IntPtr L)
 {
     LuaScriptMgr.CheckArgsCount(L, 2);
     Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.SkillWarConf");
     string[] objs0 = LuaScriptMgr.GetArrayString(L, 2);
     obj.ParseCsv(objs0);
     return(0);
 }
    static int getEffectValue(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.SkillWarConf");
        Dictionary <int, float>        o   = obj.getEffectValue();

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
    static int getSkillCostHPPer(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.SkillWarConf");
        float o = obj.getSkillCostHPPer();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
    static int getBuildSkillType(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.SkillWarConf");
        int o = obj.getBuildSkillType();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
    static int getEffectDataById(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.SkillWarConf");
        int arg0 = (int)LuaScriptMgr.GetNumber(L, 2);

        Games.Module.Wars.CSkillEffectDataItem o = obj.getEffectDataById(arg0);
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Ejemplo n.º 6
0
        public void Init(int skillId, int skillLevel)
        {
            this.skillId    = skillId;
            this.skillLevel = skillLevel;


            skillWarConfig = War.model.GetSkillWarConf(skillId);
            skillWarConfigList.Add(skillWarConfig);


            SetSkillType();

            costHP    = skillWarConfig.getSkillCostHp();
            costHPPer = skillWarConfig.getSkillCostHPPer();
        }
Ejemplo n.º 7
0
        IEnumerator autoHurtSoilderEnd(SkillParameter skillParameter, EffectParameter effectInfo)
        {
            yield return(new WaitForSeconds(effectInfo.waitTime));

            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            //播放技能,针对所有出征士兵
            int unitType = 0;

            unitType = unitType.USolider(true);
            int relation = 0;

            relation = relation.REnemy(true);
            List <UnitCtl> unitSoldierList = War.scene.SearchUnit(unitType, effectInfo.caster.unitData.legionId, relation);

            foreach (UnitCtl unit in unitSoldierList)
            {
                if (unit == null)
                {
                    continue;
                }
                if (effectInfo.effect.animPathEnd != "temp")
                {
                    GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathEnd.ToLower());
                    GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                    effectAnim.transform.position = unit.transform.position;
                }
            }

            foreach (UnitCtl unit in effectInfo.unitCtlList)
            {
                if (unit == null)
                {
                    continue;
                }
                unit.DamageToDeath(effectInfo.caster);
            }


            Debug.Log(string.Format("<color=yellow> autoHurtSoilder=id:{0} {1}</color>",
                                    skillParameter.skillId, effectInfo.unitCtlList.Count));
            //处理技能2
            if (skillParameter.curDealSkillIdx == 1)
            {
                War.skillWarManager.dealSkill2Effect(skillParameter);
            }
        }
    static int _CreateGames_Module_Wars_SkillWarConf(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            Games.Module.Wars.SkillWarConf obj = new Games.Module.Wars.SkillWarConf();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Games.Module.Wars.SkillWarConf.New");
        }

        return(0);
    }
Ejemplo n.º 9
0
        //--------------------自动伤害城池------------------------------
        private int autoHurtBuildAll(SkillParameter skillParameter, EffectParameter effectInfo)
        {
            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            Debug.Log("=========" + effectInfo.effect.animPathStart + "++++++" + effectInfo.effect.animPathEnd);
            //发射技能 :号令天下 无双 连营
            if (effectInfo.effect.isSend == 1)
            {
                float timeProcess = 1.5f;
                float height      = 8.0f;

                int idx = 0;
                foreach (UnitCtl unit in effectInfo.unitCtlList)//获取城市
                {
                    if (effectInfo.effect.animPathStart != "temp")
                    {
                        int     lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid);
                        Vector3 fromPos = War.scene.GetLegionPosition(lengion);
                        War.skillWarManager.sendSkillAnim(fromPos, unit, effectInfo.effect.animPathStart, height, timeProcess);
                        effectInfo.waitTime = timeProcess;
                    }
                    idx++;
                    bool needDealSKill2 = false;
                    if (idx == effectInfo.unitCtlList.Count)
                    {
                        needDealSKill2 = true;
                    }
                    War.skillWarManager.StartCoroutine(autoHurtBuildSingleEnd(skillParameter, effectInfo, unit, needDealSKill2));
                }
            }
            else
            {
                int idx = 0;
                foreach (UnitCtl unit in effectInfo.unitCtlList)//获取城市
                {
                    idx++;
                    bool needDealSKill2 = false;
                    if (idx == effectInfo.unitCtlList.Count)
                    {
                        needDealSKill2 = true;
                    }
                    War.skillWarManager.StartCoroutine(effectHurtSingleStart(skillParameter, effectInfo, unit, needDealSKill2));
                }
            }
            return(0);
        }
Ejemplo n.º 10
0
        //单个技能效果
        IEnumerator effectHurtSingleStart(SkillParameter skillParameter, EffectParameter effectInfo, UnitCtl unit, bool needDealSkill2)
        {
            float idxRand = Random.Range(0.0f, 1.0f);

            //Debug.LogFormat("=====idxRand:{0}", idxRand);
            yield return(new WaitForSeconds(idxRand));

            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            if (effectInfo.effect.animPathStart != "temp")
            {
                GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathStart);
                GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                effectAnim.transform.position = unit.transform.position;
                effectInfo.waitTime           = 0.2f;
            }

            War.skillWarManager.StartCoroutine(autoHurtBuildSingleEnd(skillParameter, effectInfo, unit, needDealSkill2));
        }
    static int set_isSettledBuild(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name isSettledBuild");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index isSettledBuild on a nil value");
            }
        }

        obj.isSettledBuild = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
    static int get_heroVoicePath(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name heroVoicePath");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index heroVoicePath on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.heroVoicePath);
        return(1);
    }
Ejemplo n.º 13
0
        IEnumerator autoHurtBuildSingleEnd(SkillParameter skillParameter, EffectParameter effectInfo, UnitCtl unit, bool needDealSkill2)
        {
            yield return(new WaitForSeconds(effectInfo.waitTime));

            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            Debug.Log("++++++animPathEnd: " + effectInfo.effect.animPathEnd);
            if (effectInfo.effect.animPathEnd != "temp")
            {
                GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathEnd);
                GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                effectAnim.transform.position = unit.transform.position;
                DelayDestory destoryTimer = effectAnim.GetComponent <DelayDestory>();
                if (destoryTimer != null && effectInfo.effect.time > 0)
                {
                    destoryTimer.DelayTime = effectInfo.effect.time;
                    effectInfo.effectAnim  = effectAnim;
                }
                // effectInfo.waitTime = 0.2f;
            }

            War.skillWarManager.StartCoroutine(autoHurtBuildAllHurtSingle(skillParameter, effectInfo, unit, needDealSkill2));
        }
    static int set_aiTypeArray(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name aiTypeArray");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index aiTypeArray on a nil value");
            }
        }

        obj.aiTypeArray = LuaScriptMgr.GetArrayNumber <int>(L, 3);
        return(0);
    }
    static int set_effectDataList(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name effectDataList");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index effectDataList on a nil value");
            }
        }

        obj.effectDataList = (List <Games.Module.Wars.CSkillEffectDataItem>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <Games.Module.Wars.CSkillEffectDataItem>));
        return(0);
    }
    static int set_consume(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name consume");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index consume on a nil value");
            }
        }

        obj.consume = (int)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
    static int get_displayConfig(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name displayConfig");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index displayConfig on a nil value");
            }
        }

        LuaScriptMgr.PushObject(L, obj.displayConfig);
        return(1);
    }
    static int set_skillDescribe(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.SkillWarConf obj = (Games.Module.Wars.SkillWarConf)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name skillDescribe");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index skillDescribe on a nil value");
            }
        }

        obj.skillDescribe = LuaScriptMgr.GetString(L, 3);
        return(0);
    }
Ejemplo n.º 19
0
        IEnumerator autoAddBuildAllTimer(SkillParameter skillParameter, EffectParameter effectInfo)
        {
            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            float addSoild   = effectInfo.value;
            int   timerCount = effectInfo.effect.time;

            while (true)
            {
                yield return(new WaitForSeconds(1.0f));

                try
                {
                    foreach (UnitCtl unit in effectInfo.unitCtlList)    //获取城市
                    {
                        unit.Damage(addSoild, effectInfo.effect.addSoldierMax, effectInfo.caster);
                    }
                    Debug.Log(string.Format("<color=yellow> autoHurtBuildAllTimer all= effectid:{0} v:{1} </color>",
                                            effectInfo.effect.id, addSoild));
                    timerCount--;
                    if (timerCount <= 0)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    if (Application.isEditor)
                    {
                        Debug.Log(e);
                    }
                    break;
                }
            }
            Debug.Log(string.Format("<color=white> autoHurtBuildAllTimer done=</color>"));
        }
Ejemplo n.º 20
0
 public void AddSkillWarConf(SkillWarConf skillWarConf)
 {
     skillWarConfDic.Add(skillWarConf.id, skillWarConf);
 }
Ejemplo n.º 21
0
        IEnumerator manualHurtRangEnd(SkillParameter skillParameter, EffectParameter effectInfo)
        {
            yield return(new WaitForSeconds(0.2f));

            //UnitCtl curUnit = War.scene.GetBuild(skillParameter.curHeroBuildId);

            foreach (UnitCtl unit in effectInfo.unitCtlList)
            {
                try
                {
                    if (unit == null || unit.unitData == null)
                    {
                        continue;
                    }
                    if (unit.unitData.hp <= 0)
                    {
                        continue;
                    }

                    if (unit.unitData.unitType == UnitType.Build)
                    {
                        int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid);
                        if (lengion == unit.unitData.legionId)
                        {
                            yield break;
                        }

                        float hurt = effectInfo.value - (effectInfo.unitCtlList.Count - 1);
                        if (hurt >= 1)
                        {
                            DamageVO damageVo = War.skillWarManager.GetDamageParameter(hurt, false, DamageType.ATTACK, unit, effectInfo.caster);
                            unit.Damage(damageVo, 0f, 0.2f, effectInfo.effect.hurtCount);
                        }
                    }
                    else
                    {
                        TrackParamClass param = new TrackParamClass();
                        param.caster     = effectInfo.caster;
                        param.high       = 4.0f;
                        param.range      = 5.0f;
                        param.speedTrack = 20.0f;
                        param.unitCtlCur = unit;
                        unit.GetComponent <SkillTrackController>().addForceParabola(effectInfo.receivePos, 6.0f, param);
                    }
                }
                catch (System.Exception e)
                {
                    if (Application.isEditor)
                    {
                        Debug.Log(e);
                    }

                    break;
                }
            }

            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            Debug.Log(string.Format("<color=yellow> manualHurtRang=id:{0} {1} leftcount{2}</color>",
                                    skillParameter.skillId, effectInfo.value, effectInfo.unitCtlList.Count));
            if (skillParameter.curDealSkillIdx == 1)
            {
                War.skillWarManager.dealSkill2Effect(skillParameter);
            }
        }
Ejemplo n.º 22
0
        bool AIUse_SelectUnit(SkillOperateData skillData)
        {
            skillData.receiveList.Clear();

            List <UnitCtl> buildList = War.scene.buildList;
            //ai目标
            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillData.skillId);

            if (skillWarConf.getTargetType() == (int)eSkillWarTargetType.eEffectTargetBuildBeHitMinHp)//正在被攻击&人口最少,没有被攻击则选人口最少的
            {
                int unitType = 0;
                unitType = unitType.UBuild(true);
                int relation = 0;
                relation = relation.ROwn(true);
                List <UnitCtl> listTmp = War.scene.SearchUnit(unitType, legionData.legionId, relation);
                foreach (UnitCtl unit in listTmp)
                {
                    if (unit.unitData.behit == true)
                    {
                        skillData.receiveList.Add(unit);
                        return(true);
                    }
                }
                //没有正在被攻击的城池,选择人口钌俚锰
                UnitCtl unitMin = null;
                float   hpTmp   = 10000.0f;
                foreach (UnitCtl unit in listTmp)
                {
                    if (unit.hp <= hpTmp)
                    {
                        hpTmp   = unit.hp;
                        unitMin = unit;
                    }
                }
                if (unitMin != null)
                {
                    if (skillData.EnableUse(unitMin))
                    {
                        skillData.receiveList.Add(unitMin);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            List <UnitCtl> candidatesList = new List <UnitCtl> ();

            foreach (UnitCtl entity in buildList)
            {
                if (skillData.EnableUse(entity))
                {
                    candidatesList.Add(entity);
                }
            }

            UnitCtl select = null;

            foreach (UnitCtl entity in candidatesList)
            {
                select = entity;
                if (select.legionData.type != LegionType.Neutral)
                {
                    break;
                }
            }

            if (select != null)
            {
                skillData.receiveList.Add(select);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 23
0
        IEnumerator autoAddBuildAllEnd(SkillParameter skillParameter, EffectParameter effectInfo)
        {
            yield return(new WaitForSeconds(effectInfo.waitTime));

            SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            float addSoild = effectInfo.value;

            foreach (UnitCtl unit in effectInfo.unitCtlList)//获取城市
            {
                try
                {
                    int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid);
                    if (lengion != unit.unitData.legionId)
                    {
                        continue;
                    }
                    //添加持续效果
                    if (effectInfo.effect.buffAnimPath != "temp")
                    {
                        GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.buffAnimPath.ToLower());
                        GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                        effectAnim.transform.position = unit.transform.position;
                        DelayDestory destoryTimer = effectAnim.GetComponent <DelayDestory>();
                        if (destoryTimer != null)
                        {
                            destoryTimer.DelayTime = effectInfo.effect.time;
                        }
                    }
                    //按百分比加兵
                    if (effectInfo.effect.type == (int)eSKillWarEffectType.eEffectAddSoldierPer)
                    {
                        addSoild = unit.unitData.maxHp * effectInfo.value / 100;
                        Debug.LogFormat("add soldier rate: {0} {1}", effectInfo.value, addSoild);
                    }
                    else if (effectInfo.effect.type == (int)eSKillWarEffectType.eEffectAddSoldierHitMax)
                    {
                        if (unit.unitData.beattack != true)
                        {
                            addSoild = 0;
                        }
                    }
                    Debug.Log("========add soldier: " + addSoild);
                    unit.Damage(addSoild, effectInfo.effect.addSoldierMax, effectInfo.caster);
                }
                catch (Exception e)
                {
                    if (Application.isEditor)
                    {
                        Debug.Log(e);
                    }
                }
            }

            //处理2技能
            if (skillParameter.curDealSkillIdx == 1)
            {
                War.skillWarManager.dealSkill2Effect(skillParameter);
            }

            if (effectInfo.effect.time > 0)
            {
                War.skillWarManager.StartCoroutine(autoAddBuildAllTimer(skillParameter, effectInfo));
            }

            Debug.Log(string.Format("<color=yellow> autoAddBuildAll all=skill id:{0}, lvl:{1} v:{2}</color>",
                                    skillParameter.skillId, skillParameter.skillLvl, addSoild));
        }