Ejemplo n.º 1
0
        public void Init(Unit sourceUnit, string spellId,
                         Unit targetUnit, CfgSpellData cfgSpellData, Hashtable instanceArgDict)
        {
            base.Init();
            this.sourceUnit      = sourceUnit;
            this.spellId         = spellId;
            this.targetUnit      = targetUnit;
            this.cfgSpellData    = cfgSpellData;
            this.instanceArgDict = instanceArgDict;

            this.originPosition =
                this.instanceArgDict.GetOrGetDefault2 <Vector3>("origin_position", () => this.sourceUnit.GetPosition());
            this.transmitArgDict   = this.instanceArgDict.GetOrGetDefault2("transmit_arg_dict", () => new Hashtable());
            this.attackDir         = this.transmitArgDict.Get <Vector3>(attackDir);
            this.newSpellTriggerId = this.transmitArgDict.Get <string>("new_spell_trigger_id");            // 通过哪个trigger_id启动的技能

            this.argDict                  = DoerAttrParserUtil.ConvertTableWithTypeString(this.cfgSpellData._arg_dict);
            this.isCanMoveWhileCast       = this.cfgSpellData.is_can_move_while_cast;
            this.isSpellAnimationFinished = "触发".Equals(this.cfgSpellData.cast_type);

            if (this.isCanMoveWhileCast && this.sourceUnit != null && !this.sourceUnit.IsDead())
            {
                this.sourceUnit.SetIsMoveWithMoveAnimation(false);
            }
            this.InitCounter();
        }
Ejemplo n.º 2
0
        public List <Unit> RecommendSpellRule(Unit sourceUnit, Unit targetUnit,
                                              CfgSpellData cfgSpellData, Vector3 originPosition, List <Unit> targetUnitList = null)
        {
            //当前敌人
            //随机x个敌人
            //生命最低的x个人敌人
            //全体敌人
            //自己
            //随机x个队友
            //生命最低的x个队友
            //全体队友
            //召唤单位
            //场上所有人(不分敌友)
            if (targetUnit == null)
            {
                return(null);
            }
            if (cfgSpellData._select_unit_arg_dict.IsNullOrEmpty())
            {
                return targetUnitList ?? new List <Unit>()
                       {
                           targetUnit
                       }
            }
            ;

            var selectUnitArgDict = DoerAttrParserUtil.ConvertTableWithTypeString(cfgSpellData._select_unit_arg_dict);
            var selectUnitFaction = selectUnitArgDict.Get <string>("select_unit_faction");
            var selectUnitCount   = selectUnitArgDict.GetOrGetDefault2 <int>("select_unit_count", () => 1000);
            var scope             = SpellConst.Select_Unit_Faction_Dict[selectUnitFaction];

            var rangeInfo = new Hashtable();

            rangeInfo["mode"]   = "circle";
            rangeInfo["radius"] = cfgSpellData.range;
            var conditionDict = new Hashtable();

            conditionDict["order"]      = "distance";
            conditionDict["origin"]     = originPosition;
            conditionDict["faction"]    = sourceUnit.GetFaction();
            conditionDict["scope"]      = scope;
            conditionDict["range_info"] = rangeInfo;
            targetUnitList = targetUnitList ?? Client.instance.combat.unitManager.SelectUnit(conditionDict);

            var count         = selectUnitCount;
            var newTargetList = new List <Unit>();

            //TODO select_unit
            //TODO select_unit
            newTargetList = targetUnitList.Sub(0, Math.Min(targetUnitList.Count, count));
            return(newTargetList.Count == 0 ? new List <Unit>()
            {
                targetUnit
            } : newTargetList);
        }
Ejemplo n.º 3
0
        private void RemovePropertyDict()
        {
            var newPropertyDict = DoerAttrParserUtil.ConvertTableWithTypeString(this.cfgBuffData._property_dict).ToDict <string, float>();

            if (!newPropertyDict.IsNullOrEmpty())
            {
                var propertyComp = this.buffManager.unit.propertyComp;
                propertyComp.StartChange();
                propertyComp.RemovePropSet("buff", this.GetGuid());
                propertyComp.EndChange();
            }
        }