summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/AI/AIRuntimeFilterSkill.cs
blob: 6d808ef3b23b2cff84a0bb2c3338fa43d641af4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Xml;
using XUtliPoolLib;

namespace XMainClient
{
	internal class AIRuntimeFilterSkill : AIRunTimeNodeAction
	{
		private string _target_name;

		private bool _use_mp;

		private bool _use_name;

		private bool _use_hp;

		private bool _use_cool_down;

		private bool _use_attack_field;

		private bool _use_combo;

		private bool _use_install = false;

		private int _skill_type;

		private string _skill_name;

		private bool _detect_all_attack_field;

		private int _max_skill_num;

		public AIRuntimeFilterSkill(XmlElement node) : base(node)
		{
			this._target_name = node.GetAttribute("Shared_TargetName");
			this._use_mp = (node.GetAttribute("UseMP") != "0");
			this._use_name = (node.GetAttribute("UseName") != "0");
			this._use_hp = (node.GetAttribute("UseHP") != "0");
			this._use_cool_down = (node.GetAttribute("UseCoolDown") != "0");
			this._use_attack_field = (node.GetAttribute("UseAttackField") != "0");
			this._use_combo = (node.GetAttribute("UseCombo") != "0");
			this._use_install = (node.GetAttribute("UseInstall") != "0");
			this._skill_type = int.Parse(node.GetAttribute("SkillType"));
			this._skill_name = node.GetAttribute("SkillName");
			this._detect_all_attack_field = (node.GetAttribute("DetectAllPlayInAttackField") != "0");
			string attribute = node.GetAttribute("MaxSkillNum");
			bool flag = !string.IsNullOrEmpty(attribute);
			if (flag)
			{
				this._max_skill_num = int.Parse(attribute);
			}
			else
			{
				this._max_skill_num = 0;
			}
		}

		public override bool Update(XEntity entity)
		{
			XGameObject xgameObjectByName = entity.AI.AIData.GetXGameObjectByName(this._target_name);
			FilterSkillArg filterSkillArg = new FilterSkillArg();
			filterSkillArg.mAIArgUseMP = this._use_mp;
			filterSkillArg.mAIArgUseName = this._use_name;
			filterSkillArg.mAIArgUseHP = this._use_hp;
			filterSkillArg.mAIArgUseCoolDown = this._use_cool_down;
			filterSkillArg.mAIArgUseAttackField = this._use_attack_field;
			filterSkillArg.mAIArgUseCombo = this._use_combo;
			filterSkillArg.mAIArgUseInstall = this._use_install;
			filterSkillArg.mAIArgSkillType = this._skill_type;
			filterSkillArg.mAIArgSkillName = this._skill_name;
			filterSkillArg.mAIArgDetectAllPlayInAttackField = this._detect_all_attack_field;
			filterSkillArg.mAIArgMaxSkillNum = this._max_skill_num;
			XEntity target = null;
			bool flag = xgameObjectByName != null;
			if (flag)
			{
				target = XSingleton<XEntityMgr>.singleton.GetEntity(xgameObjectByName.UID);
			}
			return XSingleton<XAISkill>.singleton.SelectSkill(entity, target, filterSkillArg);
		}
	}
}