Ejemplo n.º 1
0
        public void OnHandleClickSelectTargetBtn(AttackTargetType _targetType)
        {
            OperateMode operateMode = OperateMode.DefaultMode;
            Player      hostPlayer  = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

            if (hostPlayer != null)
            {
                operateMode = hostPlayer.GetOperateMode();
            }
            if (operateMode == OperateMode.DefaultMode)
            {
                return;
            }
            if (_targetType != this.m_TargetType)
            {
                this.m_CurSelectedActor.Release();
            }
            SelectEnemyType selectType = SelectEnemyType.SelectLowHp;

            if (hostPlayer != null)
            {
                selectType = hostPlayer.AttackTargetMode;
            }
            uint selectTargetByTag = this.GetSelectTargetByTag(_targetType, selectType);

            Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(selectTargetByTag);

            this.m_TargetType = _targetType;
        }
    // END ENUMERATIONS

    //CONSTRUCTORS
    public TurretBehaviour()
    {
        maxHealth        = 100;
        currentHealth    = maxHealth;
        range            = 1;
        attackDamage     = 1;
        attackSpeed      = 1;
        attackTargetType = AttackTargetType.Single;
        attackEffect     = AttackEffect.None;
        killCount        = 0;
        abilityPoints    = 0;
    }
 public TurretBehaviour(int MaxHealth, float Range, int AttackDamage, int AttackSpeed,
                        AttackTargetType AttackTargetType, AttackEffect AttackEffect, AttackType AttackType, int CurrentExperience, int MaxExperience,
                        int ExperienceMultiplier, int CurrentLevel, int MaxLevel, int KillCount, int AbilityPoints)
 {
     maxHealth            = MaxHealth;
     currentHealth        = MaxHealth;
     range                = Range;
     attackDamage         = AttackDamage;
     attackSpeed          = AttackSpeed;
     attackTargetType     = AttackTargetType;
     attackEffect         = AttackEffect;
     attackType           = AttackType;
     currentExperience    = CurrentExperience;
     maxExperience        = MaxExperience;
     experienceMultiplier = ExperienceMultiplier;
     currentLevel         = CurrentLevel;
     maxLevel             = MaxLevel;
     killCount            = KillCount;
     abilityPoints        = AbilityPoints;
 }
Ejemplo n.º 4
0
 private string GetAttackPowerComputationInstructionsForTarget(AttackTargetType targetType)
 {
     if (targetType == AttackTargetType.Barbarian)
     {
         return("Please compute the barbarians attack power as follows;\nCurrent value of the terrain the barbarian is on (1-5)\nRoll a single dice to get the base power adjustment for combat (1-6)");
     }
     else if (targetType == AttackTargetType.RivalCity || targetType == AttackTargetType.RivalCapitalCity)
     {
         return("Please compute the rival cities attack power as follows;\nCurrent value of the terrain the city is built on multiplied by 2 (2-10)\nRoll a single dice to get the base power adjustment for combat (1-6)\nAdd any leadersheet bonuses\nAdd any military diplomacy bonuses\nAdd any military wonder bonuses\nAdd +1 for each adjacent reinforced control token\nDO NOT INCLUDE ANY AVAILABLE TRADE TOKENS YET");
     }
     else if (targetType == AttackTargetType.RivalControlToken)
     {
         return("Please compute the rival control tokens attack power as follows;\nCurrent value of the control tokens terrain (1-5)\nRoll a single dice to get the base power adjustment for combat (1-6)\nAdd any leadersheet bonuses\nAdd any military diplomacy bonuses\nAdd any military wonder bonuses\nAdd +1 for each adjacent reinforced control token\nAdd +1 if the control token being attacked is reinforced\nDO NOT INCLUDE ANY AVAILABLE TRADE TOKENS YET");
     }
     else if (targetType == AttackTargetType.CityState)
     {
         return("Please compute the city states attack power as follows;\nStatic city state bonus is 8\nRoll a single dice to get the base power adjustment for combat (1-6)");
     }
     return(string.Empty);
 }
Ejemplo n.º 5
0
        public void OnHandleClickSelectTargetBtn(AttackTargetType _targetType)
        {
            if (_targetType != this.m_TargetType)
            {
                this.m_CurSelectedActor.Release();
            }
            SelectEnemyType selectLowHp = SelectEnemyType.SelectLowHp;
            Player          hostPlayer  = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

            if (hostPlayer != null)
            {
                selectLowHp = hostPlayer.AttackTargetMode;
            }
            uint selectTargetByTag = 0;

            selectTargetByTag = this.GetSelectTargetByTag(_targetType, selectLowHp);
            Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(selectTargetByTag);

            this.m_TargetType = _targetType;
        }
Ejemplo n.º 6
0
 public void SelectAttackTarget(AttackTargetType _targetType)
 {
 }
Ejemplo n.º 7
0
 public override void Init()
 {
     this.m_TargetType = AttackTargetType.ATTACK_TARGET_HERO;
 }
Ejemplo n.º 8
0
        private uint GetSelectTargetByTag(AttackTargetType targetType, SelectEnemyType selectType)
        {
            List <ActorRoot> list       = new List <ActorRoot>();
            List <ActorRoot> list2      = new List <ActorRoot>();
            List <ActorRoot> list3      = new List <ActorRoot>();
            List <ActorRoot> list4      = new List <ActorRoot>();
            Player           hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

            if (hostPlayer == null || !hostPlayer.Captain)
            {
                return(0u);
            }
            PoolObjHandle <ActorRoot>         captain    = hostPlayer.Captain;
            List <PoolObjHandle <ActorRoot> > gameActors = Singleton <GameObjMgr> .GetInstance().GameActors;

            int count = gameActors.get_Count();

            for (int i = 0; i < count; i++)
            {
                ActorRoot handle = gameActors.get_Item(i).handle;
                if (handle.HorizonMarker.IsVisibleFor(captain.handle.TheActorMeta.ActorCamp) && captain.handle.CanAttack(handle))
                {
                    if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
                    {
                        if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Hero) && DistanceSearchCondition.Fit(handle, captain, captain.handle.ActorControl.SearchRange))
                        {
                            list.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Organ))
                    {
                        if (DistanceSearchCondition.Fit(handle, captain, captain.handle.ActorControl.SearchRange))
                        {
                            list4.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Monster) && DistanceSearchCondition.Fit(handle, captain, captain.handle.ActorControl.SearchRange))
                    {
                        MonsterWrapper monsterWrapper = handle.AsMonster();
                        if (monsterWrapper.cfgInfo.bSoldierType == 7 || monsterWrapper.cfgInfo.bSoldierType == 8 || monsterWrapper.cfgInfo.bSoldierType == 9)
                        {
                            list3.Add(handle);
                        }
                        else
                        {
                            list2.Add(handle);
                        }
                    }
                }
            }
            uint lowerValueTargetIdByTag;

            if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
            {
                this.SortActorListByTag(captain, ref list, selectType);
                lowerValueTargetIdByTag = this.GetLowerValueTargetIdByTag(captain, list, selectType);
            }
            else
            {
                this.SortActorListByTag(captain, ref list3, selectType);
                this.SortActorListByTag(captain, ref list2, selectType);
                this.SortActorListByTag(captain, ref list4, selectType);
                List <ActorRoot> list5 = new List <ActorRoot>();
                for (int j = 0; j < list3.get_Count(); j++)
                {
                    list5.Add(list3.get_Item(j));
                }
                for (int k = 0; k < list2.get_Count(); k++)
                {
                    list5.Add(list2.get_Item(k));
                }
                for (int l = 0; l < list4.get_Count(); l++)
                {
                    list5.Add(list4.get_Item(l));
                }
                lowerValueTargetIdByTag = this.GetLowerValueTargetIdByTag(captain, list5, selectType);
            }
            return(lowerValueTargetIdByTag);
        }
Ejemplo n.º 9
0
        private uint GetSelectTargetByTag(AttackTargetType targetType, SelectEnemyType selectType)
        {
            List <ActorRoot> actorList  = new List <ActorRoot>();
            List <ActorRoot> list2      = new List <ActorRoot>();
            List <ActorRoot> list3      = new List <ActorRoot>();
            List <ActorRoot> list4      = new List <ActorRoot>();
            Player           hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

            if ((hostPlayer == null) || (hostPlayer.Captain == 0))
            {
                return(0);
            }
            PoolObjHandle <ActorRoot>         captain    = hostPlayer.Captain;
            List <PoolObjHandle <ActorRoot> > gameActors = Singleton <GameObjMgr> .GetInstance().GameActors;

            int count = gameActors.Count;

            for (int i = 0; i < count; i++)
            {
                PoolObjHandle <ActorRoot> handle2 = gameActors[i];
                ActorRoot handle = handle2.handle;
                if (handle.HorizonMarker.IsVisibleFor(captain.handle.TheActorMeta.ActorCamp) && captain.handle.CanAttack(handle))
                {
                    if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
                    {
                        if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Hero) && DistanceSearchCondition.Fit(handle, (ActorRoot)captain, captain.handle.ActorControl.SearchRange))
                        {
                            actorList.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Organ))
                    {
                        if (DistanceSearchCondition.Fit(handle, (ActorRoot)captain, captain.handle.ActorControl.SearchRange))
                        {
                            list4.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Monster) && DistanceSearchCondition.Fit(handle, (ActorRoot)captain, captain.handle.ActorControl.SearchRange))
                    {
                        MonsterWrapper wrapper = handle.AsMonster();
                        if (((wrapper.cfgInfo.bSoldierType == 7) || (wrapper.cfgInfo.bSoldierType == 8)) || (wrapper.cfgInfo.bSoldierType == 9))
                        {
                            list3.Add(handle);
                        }
                        else
                        {
                            list2.Add(handle);
                        }
                    }
                }
            }
            if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
            {
                this.SortActorListByTag(captain, ref actorList, selectType);
                return(this.GetLowerValueTargetIdByTag(captain, actorList, selectType));
            }
            this.SortActorListByTag(captain, ref list3, selectType);
            this.SortActorListByTag(captain, ref list2, selectType);
            this.SortActorListByTag(captain, ref list4, selectType);
            List <ActorRoot> list6 = new List <ActorRoot>();
            int num4 = 0;

            for (num4 = 0; num4 < list3.Count; num4++)
            {
                list6.Add(list3[num4]);
            }
            for (num4 = 0; num4 < list2.Count; num4++)
            {
                list6.Add(list2[num4]);
            }
            for (num4 = 0; num4 < list4.Count; num4++)
            {
                list6.Add(list4[num4]);
            }
            return(this.GetLowerValueTargetIdByTag(captain, list6, selectType));
        }