示例#1
0
 public static EventScript.cRestHP ConvToObjectRestHP(string str_rest_hp)
 {
     EventScript.cRestHP cRestHp = new EventScript.cRestHP();
     if (!string.IsNullOrEmpty(str_rest_hp))
     {
         string[] strArray1 = str_rest_hp.Split(',');
         if (strArray1 != null)
         {
             foreach (string str in strArray1)
             {
                 char[] chArray = new char[1] {
                     '-'
                 };
                 string[] strArray2 = str.Split(chArray);
                 if (strArray2 != null && strArray2.Length >= 3)
                 {
                     int result1 = 0;
                     int result2 = 0;
                     int result3 = 0;
                     int.TryParse(strArray2[0], out result1);
                     int.TryParse(strArray2[1], out result2);
                     int.TryParse(strArray2[2], out result3);
                     EventScript.cRestHP.Cond cond = new EventScript.cRestHP.Cond(result1, result2, result3);
                     cRestHp.mCondLists.Add(cond);
                 }
             }
         }
     }
     return(cRestHp);
 }
示例#2
0
        public static string ConvToStringRestHP(EventScript.cRestHP rest_hp)
        {
            string str = string.Empty;

            if (rest_hp != null)
            {
                for (int index = 0; index < rest_hp.mCondLists.Count; ++index)
                {
                    EventScript.cRestHP.Cond mCondList = rest_hp.mCondLists[index];
                    if (index != 0)
                    {
                        str += ",";
                    }
                    str = str + (object)mCondList.mComp + "-" + (object)mCondList.mVal + "-" + (object)mCondList.mCalc;
                }
            }
            return(str);
        }
示例#3
0
        public EventScript.Sequence OnUnitRestHP(TacticsUnitController controller, bool isFirstPlay)
        {
            return(this.StartSequence((EventScript.TestCondition)(trigger =>
            {
                EventScript.cRestHP objectRestHp = EventScript.ConvToObjectRestHP(trigger.RestHP);
                bool flag = true;
                using (List <EventScript.cRestHP.Cond> .Enumerator enumerator = objectRestHp.mCondLists.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        EventScript.cRestHP.Cond current = enumerator.Current;
                        int num = 0;
                        switch (current.mCalc)
                        {
                        case EventScript.cRestHP.Cond.CalcType.SCALE:
                            num = controller.HPPercentage;
                            break;

                        case EventScript.cRestHP.Cond.CalcType.FIXED:
                            num = (int)controller.Unit.CurrentStatus.param.hp;
                            break;
                        }
                        switch (current.mComp)
                        {
                        case EventScript.cRestHP.Cond.CompType.EQUAL:
                            if (num != current.mVal)
                            {
                                flag = false;
                                break;
                            }
                            break;

                        case EventScript.cRestHP.Cond.CompType.NOT_EQUAL:
                            if (num == current.mVal)
                            {
                                flag = false;
                                break;
                            }
                            break;

                        case EventScript.cRestHP.Cond.CompType.GREATER:
                            if (num <= current.mVal)
                            {
                                flag = false;
                                break;
                            }
                            break;

                        case EventScript.cRestHP.Cond.CompType.GREATER_EQUAL:
                            if (num < current.mVal)
                            {
                                flag = false;
                                break;
                            }
                            break;

                        case EventScript.cRestHP.Cond.CompType.LESS:
                            if (num >= current.mVal)
                            {
                                flag = false;
                                break;
                            }
                            break;

                        case EventScript.cRestHP.Cond.CompType.LESS_EQUAL:
                            if (num > current.mVal)
                            {
                                flag = false;
                                break;
                            }
                            break;
                        }
                        if (!flag)
                        {
                            break;
                        }
                    }
                }
                if (trigger.Trigger == EventScript.ScriptSequence.StartConditions.RestHP && (!trigger.IsFirstOnly || isFirstPlay) && controller.IsA(trigger.UnitName))
                {
                    return flag;
                }
                return false;
            }), true, 0));
        }