Exemplo n.º 1
0
 public static RoleAttributeList RALByResistStr(RoleAttributeList ral, string str)
 {
     if (!string.IsNullOrEmpty(str))
     {
         RoleAttributeList RAL   = ral;
         string[]          allSs = str.Split('|');
         for (int i = 0; i < allSs.Length; i++)
         {
             string[] Ss = allSs[i].Split(':');
             RAL.Set(StringToInteger(Ss[1]), ROHelp.STATE_TAG(Ss[0]));
         }
         return(RAL);
     }
     return(ral);
 }
Exemplo n.º 2
0
    public void checkSpecialStr(string specialStr, string propid)
    {
        UseState = false;
        _state   = new StandardState(propid);
        functionsWithoutState = new List <string>();
        //state
        int lastTime = 0;
        List <StandardState.ChangeInRAL> ralList = new List <StandardState.ChangeInRAL>();

        //
        string[] strings = specialStr.Split('|');
        for (int i = 0; i < strings.Length; i++)
        {
            string[] tmp      = strings[i].Split(':');
            string   fn       = tmp[0];
            string[] paramStr = tmp[1].Split(',');
            if (fn.Contains("add") && paramStr.Length > 1)
            {
                UseState = true;
                int time = SDDataManager.Instance.getInteger(paramStr[1]);
                lastTime = Mathf.Max(lastTime, time);
                int        d = SDDataManager.Instance.getInteger(paramStr[0]);
                NumberData D = new NumberData(d);
                if (fn.Contains("_pc"))
                {
                    D.dataTag = NumberData.DataType.percent;
                }
                //
                if (fn.Contains("HP"))
                {
                    _state.ChangeInBarChart.HP = D;
                }
                else if (fn.Contains("MP"))
                {
                    _state.ChangeInBarChart.MP = D;
                }
                else if (fn.Contains("TP"))
                {
                    _state.ChangeInBarChart.TP = D;
                }
            }
            else if (fn.Contains("up_"))
            {
                UseState = true;
                int time = SDDataManager.Instance.getInteger(paramStr[1]);
                lastTime = Mathf.Max(lastTime, time);
                int        d = SDDataManager.Instance.getInteger(paramStr[0]);
                NumberData D = new NumberData(d);
                if (fn.Contains("_pc"))
                {
                    D.dataTag = NumberData.DataType.percent;
                }
                StandardState.ChangeInRAL cral;
                bool isad = ROHelp.CheckStringIsADElseST(fn.Split('_')[1]
                                                         , out AttributeData ad, out StateTag st);
                if (isad)
                {
                    cral = new StandardState.ChangeInRAL(D, ad);
                }
                else
                {
                    cral = new StandardState.ChangeInRAL(D, st);
                }
                ralList.Add(cral);
            }
            else if (fn.Contains("debuff_"))
            {
                StateTag tag = ROHelp.STATE_TAG(fn.Split('_')[1]);
                if (fn.Split('_')[1].ToLower() == "random")
                {
                    tag = (StateTag)(UnityEngine.Random.Range(0, (int)StateTag.End));
                }
                _state.stateTag = tag;
            }
            else if (fn.Contains("stateDmg"))
            {
                UseState = true;
                int time = SDDataManager.Instance.getInteger(paramStr[1]);
                lastTime = Mathf.Max(lastTime, time);
                int        d = SDDataManager.Instance.getInteger(paramStr[0]);
                NumberData D = new NumberData(d);
                if (fn.Contains("_pc"))
                {
                    D.dataTag = NumberData.DataType.percent;
                }
                _state.ExtraDmg = D;
            }
            //其余转为直接影响列表
            else
            {
                functionsWithoutState.Add(strings[i]);
            }
        }
    }
Exemplo n.º 3
0
    void UsePropWithoutState(string FN, SDConstants.AOEType AOE
                             , BattleRoleData currentActionUnit, BattleRoleData propTargetUnit)
    {
        string[] fns = FN.Split(':');
        string[] fnElements = fns[0].Split('_');
        string[] paramstrs = fns[1].Split(',');
        int      p0 = 0; int p1 = 0;

        p0 = SDDataManager.Instance.getInteger(paramstrs[0]);
        if (paramstrs.Length > 1)
        {
            p1 = SDDataManager.Instance.getInteger(paramstrs[1]);
        }

        NumberData param0 = new NumberData(p0); NumberData param1 = new NumberData(p1);
        string     functionName = fns[0];

        if (functionName.Contains("addHP"))
        {
            addHp(currentActionUnit, propTargetUnit, param0
                  , AOE);
        }
        else if (functionName.Contains("addMP"))
        {
            addMp(currentActionUnit, propTargetUnit, param0
                  , AOE);
        }
        else if (functionName.Contains("addTP"))
        {
            addTp(currentActionUnit, propTargetUnit, param0
                  , AOE);
        }
        else if (functionName.Contains("revive"))
        {
            bool flag = false;
            if (propTargetUnit.IsDead)
            {
                flag = true;
            }
            else
            {
                List <BattleRoleData> lit = DealWithAOEAction(currentActionUnit
                                                              , propTargetUnit, AOE);
                foreach (BattleRoleData unit in lit)
                {
                    if (unit.IsDead)
                    {
                        flag           = true;
                        propTargetUnit = unit;
                        break;
                    }
                }
            }
            if (flag)
            {
                revive(currentActionUnit, propTargetUnit, param0, param1
                       , AOE);
            }
        }
        else if (functionName.Contains("catch"))
        {
            if (!propTargetUnit.IsDead &&
                propTargetUnit.HpController.CurrentHp * 1f / propTargetUnit.HpController.MaxHp
                <= 0.2f)
            {
                catchSlave(currentActionUnit, propTargetUnit, param0);
            }
        }
        else if (functionName.Contains("remove"))
        {
            List <BattleRoleData> list = DealWithAOEAction
                                             (currentActionUnit, propTargetUnit, AOE);
            if (fnElements[1].ToLower() != "all")
            {
                StateTag tag = ROHelp.STATE_TAG(fnElements[1]);
                if (fnElements[1].ToLower() == "random")
                {
                    tag = (StateTag)(UnityEngine.Random.Range(0, (int)StateTag.End));
                }
                for (int i = 0; i < list.Count; i++)
                {
                    list[i].clearPerTagStates(tag);
                }
            }
            else
            {
                for (int i = 0; i < list.Count; i++)
                {
                    list[i].clearAllStates();
                }
            }
        }
        else if (functionName.Contains("damage"))
        {
            damage(currentActionUnit, propTargetUnit, param0, AOE);
        }
    }