123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- using CommonAI.Data;
- using CommonLang;
- using System;
- using System.Collections.Generic;
- namespace XmdsCommonServer.XLS.Data
- {
- public class MonsterData
- {
-
-
-
- public int ID;
-
-
-
- public string Name;
-
-
-
- public string Title;
-
-
-
- public byte Atype;
-
-
-
- public byte Sex;
-
-
-
- public int Level;
-
-
-
- public byte Qcolor;
-
-
-
- public byte Type;
-
-
-
- public byte LvRepress;
-
-
-
- public int SkillType;
-
-
-
- public byte Fight_Type;
-
-
-
- public float Fight_Count;
-
-
-
- public float AliveTime;
-
-
-
- public float KillPlayerTime;
-
-
-
- public int Prob1;
-
-
-
- public int ReviveID1;
-
-
-
- public int Prob2;
-
-
-
- public int ReviveID2;
-
-
-
- public int Prob3;
-
-
-
- public int ReviveID3;
-
-
-
- public int Prob4;
-
-
-
- public int ReviveID4;
-
-
-
- public int DialogChance;
-
-
-
- public string DialogWords;
-
-
-
- public int DeadDialogChance;
-
-
-
- public string DeadDialogWords;
-
-
-
- public int MaxHP;
-
-
-
- public int MaxAttack;
-
-
-
- public int MaxDefence;
-
-
-
- public int CritRate;
-
-
-
- public int CritDamage;
-
-
-
- public int ResCrit;
-
-
-
-
- public int Resist;
-
-
-
- public int IgnoreDefencePer;
-
-
-
- public byte isAttack;
-
-
-
- public string Ability;
-
-
-
- public string CallAbilityPerHP;
-
-
-
- public string AbilityPar;
-
-
-
- public List<int> AbilityList = null;
-
-
-
- public List<int> AbilityPerHPList = null;
-
-
-
- public List<int> AbilityParList = null;
-
-
-
- public int ShareType = 0;
-
- public int MPValue = 0;
-
- public UnitFateType FateType = UnitFateType.None;
- public int GetRandomID(int srcID, Random random)
- {
- int ret = 0;
- int rt = 0;
- if (Prob1 == 0) { ret = srcID; }
- else
- {
- int sum = Prob1 + Prob2 + Prob3 + Prob4;
- if (sum < 10000)
- {
- XLSLoader.log.Log("Monster ID = [" + srcID + "] RandomRate Error");
- }
- int a = Prob1;
- int b = a + Prob2;
- int c = b + Prob3;
- int d = c + Prob4;
- rt = random.Next(0, 10000);
- if (c != d && IsInRange(rt, c, d))
- {
- ret = GetProbValue(Prob4);
- }
- else if (b != c && IsInRange(rt, b, c))
- {
- ret = GetProbValue(Prob3);
- }
- else if (a != b && IsInRange(rt, a, b))
- {
- ret = GetProbValue(Prob2);
- }
- else if (0 != a && IsInRange(rt, 0, a))
- {
- ret = GetProbValue(Prob1);
- }
- }
- return ret;
- }
-
-
-
-
-
-
-
- private static bool IsInRange(int value, int min, int max)
- {
- return value >= min && value < max;
- }
- private int GetProbValue(int prob)
- {
- int ret = 0;
- if (prob == Prob1) { ret = ReviveID1; }
- else if (prob == Prob2) { ret = ReviveID2; }
- else if (prob == Prob3) { ret = ReviveID3; }
- else if (prob == Prob4) { ret = ReviveID4; }
- return ret;
- }
- public void InitData(Random random)
- {
-
-
- if (!string.IsNullOrEmpty(Ability))
- {
- AbilityList = new List<int>();
- string[] strArray = Ability.Split(';');
- if (strArray != null && strArray.Length > 0)
- {
- for (int i = 0; i < strArray.Length; i++)
- {
- ParseStrAddList(ref AbilityList, strArray[i]);
- }
- }
-
- if (!string.IsNullOrEmpty(CallAbilityPerHP))
- {
- AbilityPerHPList = new List<int>();
- strArray = CallAbilityPerHP.Split('|');
- if (strArray != null && strArray.Length > 0)
- {
- for (int i = 0; i < strArray.Length; i++)
- {
- ParseStrAddList(ref AbilityPerHPList, strArray[i]);
- }
- }
- }
- if (!string.IsNullOrEmpty(AbilityPar))
- {
- AbilityParList = new List<int>();
- strArray = AbilityPar.Split('|');
- if (strArray != null && strArray.Length > 0)
- {
- for (int i = 0; i < strArray.Length; i++)
- {
- ParseStrAddList(ref AbilityParList, strArray[i]);
- }
- }
- }
- if (AbilityParList != null && AbilityPerHPList != null)
- {
- if(AbilityPerHPList.Count != AbilityParList.Count )
- {
- throw new Exception("Ability ParseError");
- }
- }
- }
- }
- private void ParseStrAddList(ref List<int> list, string content)
- {
- int v = 0;
- if (Int32.TryParse(content, out v))
- {
- list.Add(v);
- }
- }
- }
- }
|