示例#1
0
        private void PredictAbilitiesHelper(MTile tile, MAbility ability, bool lWeapon, CWeapon parentWeapon, bool wpnAbility)
        {
            var target     = tile.GetCurrentOccupant() as CChar;
            var prediction = new AgentAbilityData();

            prediction.Ability      = ability;
            prediction.LWeapon      = lWeapon;
            prediction.ParentWeapon = parentWeapon;
            prediction.Target       = target;
            prediction.Weight       = 0;
            prediction.WpnAbiltiy   = wpnAbility;
            if (ability.Data.Hostile)
            {
                if (target.Proxy.LParty != this._agent.Proxy.LParty)
                {
                    this.HandleAbility(prediction);
                    this._predictions.Add(prediction);
                }
            }
            else
            {
                if (target.Proxy.LParty == this._agent.Proxy.LParty)
                {
                    this.HandleAbility(prediction);
                    this._predictions.Add(prediction);
                }
            }
        }
示例#2
0
        private void HandleAbility(AgentAbilityData prediction)
        {
            var data = new ActionData();

            data.Ability      = prediction.Ability.Type;
            data.WpnAbility   = prediction.WpnAbiltiy;
            data.LWeapon      = prediction.LWeapon;
            data.ParentWeapon = null;
            data.Source       = this._agent;
            data.Target       = prediction.Target.Tile;
            var action = new MAction(data);

            action.TryPredict();
            foreach (var hit in action.Data.Hits)
            {
                if (prediction.Ability.Data.Hostile)
                {
                    if (prediction.Target.Proxy.LParty != this._agent.Proxy.LParty)
                    {
                        prediction.Weight += hit.Data.Dmg;
                    }
                    else
                    {
                        prediction.Weight -= hit.Data.Dmg;
                    }
                }
                else
                {
                    if (prediction.Target.Proxy.LParty != this._agent.Proxy.LParty)
                    {
                        prediction.Weight -= hit.Data.Dmg;
                    }
                    else
                    {
                        prediction.Weight += hit.Data.Dmg;
                    }
                }
            }
        }