Пример #1
0
        public override void CalculateBehaviourItem(List <BattleBehaviourItem> behaviourItems, float weight)
        {
            var items = damageRecorder.Items(true, true);

            while (items.MoveNext())
            {
                BattleUnitRecordItem recordItem = items.Current;
                //这个家伙已经无法行动了
                if (!recordItem.maker.CanAction)
                {
                    continue;
                }

                var behaviourItem = BattleBehaviourItem.CreateInstance(recordItem.maker, BehaviourType);

                int   distance       = baseData.hostBattleUnit.mapGrid.Distance(recordItem.maker.mapGrid);
                float distanceWeight = behaviourSystem.GetDistanceWeight(distance);
                //判断自己是否当前目标的攻击对象
                float isHisTarget = 0.75f;
                if (recordItem.maker.targetBattleUnit != null)
                {
                    isHisTarget = recordItem.maker.targetBattleUnit.Equals(baseData.hostBattleUnit) ? 0.5f : 1f;
                }

                behaviourItem.point = recordItem.point * weight * distanceWeight * isHisTarget;

                battleBehaviourItems.Add(behaviourItem);
            }

            AddToTargetList(behaviourItems);
        }
Пример #2
0
        public override void CalculateBehaviourItem(List <BattleBehaviourItem> behaviourItems, float weight)
        {
            BattleUnit battleUnit = null;

            for (int i = 0; i < baseData.ownBattleTeam.battleUnits.Count; ++i)
            {
                battleUnit = baseData.ownBattleTeam.battleUnits[i];
                //别晃了!他已经...他已经...走了....
                if (!battleUnit.CanAction)
                {
                    continue;
                }

                BattleBehaviourItem behaviourItem = BattleBehaviourItem.CreateInstance(battleUnit, BehaviourType);

                //计算剩余血量
                float hpLost = 1f - (float)battleUnit.battleUnitAttribute.hp / battleUnit.battleUnitAttribute.maxHp;
                //插值计算
                //规则:损失 >= 60% -> 1f
                //     损失 <= 20% -> 0f
                float recoverWeight = Mathf.Lerp(0f, 0.95f, (hpLost - 0.2f) * 2.5f) + Mathf.Lerp(0, 0.05f, (hpLost - 0.6f) / 0.4f);

                //距离
                int   distance       = baseData.hostBattleUnit.mapGrid.Distance(battleUnit.mapGrid);
                float distanceWeight = behaviourSystem.GetDistanceWeight(distance);

                behaviourItem.point = EGameConstL.BattleBehaviourChipMaxPoint * recoverWeight * distanceWeight * weight;

                battleBehaviourItems.Add(behaviourItem);
            }

            AddToTargetList(behaviourItems);
        }
Пример #3
0
        public static BattleBehaviourItem CreateInstance(BattleUnit target, BattleBehaviourType behaviourType)
        {
            if (target == null)
            {
                return(null);
            }

            BattleBehaviourItem item = new BattleBehaviourItem();

            item.targetBattleUnit = target;
            item.behaviourType    = behaviourType;
            item.point            = 0f;

            return(item);
        }
Пример #4
0
        public override void CalculateBehaviourItem(List <BattleBehaviourItem> behaviourItems, float weight)
        {
            BattleUnit battleUnit = null;

            for (int i = 0; i < baseData.enemyBattleTeam.battleUnits.Count; ++i)
            {
                battleUnit = baseData.enemyBattleTeam.battleUnits[i];
                if (!battleUnit.CanAction)
                {
                    continue;
                }

                BattleBehaviourItem item = BattleBehaviourItem.CreateInstance(battleUnit, BehaviourType);
                int   distance           = baseData.hostBattleUnit.mapGrid.Distance(battleUnit.mapGrid);
                float distanceWeight     = behaviourSystem.GetDistanceWeight(distance);
                item.point = EGameConstL.BattleBehaviourChipMaxPoint * weight * distanceWeight;

                battleBehaviourItems.Add(item);
            }

            //调整行为分数
            AddToTargetList(behaviourItems);
        }