Exemplo n.º 1
0
 public SPCombatant(PartyBase party, BattleSideEnum side, int tacticLevel, BasicCultureObject culture, Tuple <uint, uint> primaryColorPair, Banner banner)
     : base(GameTexts.FindText("str_ebt_side", side == BattleSideEnum.Attacker ? "Attacker" : "Defender"),
            side, culture, primaryColorPair, new Tuple <uint, uint>(primaryColorPair.Item2, primaryColorPair.Item1), banner)
 {
     Combatant    = party;
     _tacticLevel = tacticLevel;
 }
Exemplo n.º 2
0
 private void OnRaidCompleted(BattleSideEnum battle, MapEvent mapEvent)
 {
     if (mapEvent.IsRaid)
     {
         Settlement settlement = mapEvent.MapEventSettlement;
         if (settlement.IsVillage)
         {
             VillageData settlementAcreProperties;
             this._villageData.TryGetValue(settlement.StringId, out settlementAcreProperties);
             if (settlementAcreProperties.playerAcres > 0)
             {
                 Random rand = new Random();
                 if (rand.Next(1, 101) <= 25)
                 {
                     settlementAcreProperties.playerAcres--;
                     InformationManager.DisplayMessage(new InformationMessage($"The village of {mapEvent.MapEventSettlement.Name} was raided and one of your properties was destroyed."));
                 }
                 else
                 {
                     InformationManager.DisplayMessage(new InformationMessage($"The village of {mapEvent.MapEventSettlement.Name} was raided but none of your property were destroyed."));
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        private void SetupTeam(Team team)
        {
            BattleSideEnum side = team.Side;

            this._siegeDeploymentHandler.RemoveAllBoundaries();
            this._siegeDeploymentHandler.SetDeploymentBoundary(side);
            if (team == this.Mission.PlayerTeam)
            {
                this.RemoveUnavailableDeploymentPoints(side);
                foreach (DeploymentPoint deploymentPoint in this.Mission.ActiveMissionObjects.FindAllWithType <DeploymentPoint>().Where <DeploymentPoint>((Func <DeploymentPoint, bool>)(dp => !dp.IsDisabled && dp.Side == side)))
                {
                    deploymentPoint.Show();
                }
            }
            else
            {
                this.DeploySiegeWeaponsByAi(side);
            }
            this._missionAgentSpawnLogic.SetSpawnTroops(side, true, true);
            foreach (Formation formation in team.FormationsIncludingSpecial)
            {
                formation.ApplyActionOnEachUnit((Action <Agent>)(agent =>
                {
                    if (!agent.IsAIControlled)
                    {
                        return;
                    }
                    agent.SetIsAIPaused(true);
                }));
            }
            this._missionAgentSpawnLogic.OnInitialSpawnForSideEnded(team.Side);
            Mission.Current.IsTeleportingAgents = true;
        }
 public void Initialize(
     int managedNavigationFaceId,
     MatrixFrame managedFrame,
     Vec3 managedDirection,
     BattleSideEnum managedSide,
     int maxUserCount,
     float arcAngle,
     float queueBeginDistance,
     float queueRowSize,
     float costPerRow,
     float baseCost,
     bool blockUsage,
     float agentSpacing,
     float zDifferenceToStopUsing,
     float distanceToStopUsing2d)
 {
     this.ManagedNavigationFaceId = managedNavigationFaceId;
     this._managedFrame           = managedFrame;
     this._managedDirection       = managedDirection;
     this._managedSide            = managedSide;
     this._maxUserCount           = maxUserCount;
     this._arcAngle               = arcAngle;
     this._queueBeginDistance     = queueBeginDistance;
     this._queueRowSize           = queueRowSize;
     this._costPerRow             = costPerRow;
     this._baseCost               = baseCost;
     this._blockUsage             = blockUsage;
     this._agentSpacing           = agentSpacing;
     this._zDifferenceToStopUsing = zDifferenceToStopUsing;
     this._distanceToStopUsing2d  = distanceToStopUsing2d;
     this.UpdateNavigationFaceCost();
 }
Exemplo n.º 5
0
 public override float GetTroopNumberMultiplierForMissingPlayer(MissionPeer spawningPeer)
 {
     if (this._gameType == MissionLobbyComponent.MultiplayerGameType.Captain)
     {
         List <MissionPeer>[] missionPeerListArray = new List <MissionPeer> [2];
         for (int index = 0; index < missionPeerListArray.Length; ++index)
         {
             missionPeerListArray[index] = new List <MissionPeer>();
         }
         foreach (NetworkCommunicator networkPeer in GameNetwork.NetworkPeers)
         {
             MissionPeer component = networkPeer.GetComponent <MissionPeer>();
             if (component != null && component.Team != null && component.Team.Side != BattleSideEnum.None)
             {
                 missionPeerListArray[(int)component.Team.Side].Add(component);
             }
         }
         int[] numArray = new int[2]
         {
             0,
             MultiplayerOptions.OptionType.NumberOfBotsTeam1.GetIntValue()
         };
         numArray[0] = MultiplayerOptions.OptionType.NumberOfBotsTeam2.GetIntValue();
         int            num            = missionPeerListArray[1].Count + numArray[1] - (missionPeerListArray[0].Count + numArray[0]);
         BattleSideEnum battleSideEnum = num == 0 ? BattleSideEnum.None : (num < 0 ? BattleSideEnum.Attacker : BattleSideEnum.Defender);
         if (battleSideEnum == spawningPeer.Team.Side)
         {
             return((float)(1.0 + (double)Math.Abs(num) / (double)(missionPeerListArray[(int)battleSideEnum].Count + numArray[(int)battleSideEnum])));
         }
     }
     return(1f);
 }
Exemplo n.º 6
0
        public static MPCombatant CreateParty(BattleSideEnum side, BasicCultureObject culture,
                                              TeamConfig teamConfig, bool isPlayerTeam)
        {
            bool isAttacker = side == BattleSideEnum.Attacker;
            uint color1     = Utility.BackgroundColor(culture, isAttacker);
            uint color2     = Utility.ForegroundColor(culture, isAttacker);
            var  combatant  = new MPCombatant(side, teamConfig.TacticLevel, culture,
                                              new Tuple <uint, uint>(color1, color2), new Banner(culture.BannerKey, color1, color2));

            if (teamConfig.HasGeneral)
            {
                if (teamConfig.General is MPCharacterConfig general)
                {
                    combatant.AddCharacter(
                        new MPSpawnableCharacter(general, (int)general.CharacterObject.DefaultFormationClass,
                                                 general.FemaleRatio > 0.5, isPlayerTeam), 1);
                }
            }
            for (int i = 0; i < teamConfig.Troops.Troops.Length; ++i)
            {
                var troopConfig = teamConfig.Troops.Troops[i];
                var mpCharacter = troopConfig.Character as MPCharacterConfig;
                if (mpCharacter == null)
                {
                    continue;
                }
                var femaleCount = (int)(troopConfig.Number * mpCharacter.FemaleRatio + 0.49);
                var maleCount   = troopConfig.Number - femaleCount;
                combatant.AddCharacter(new MPSpawnableCharacter(mpCharacter, i, true),
                                       femaleCount);
                combatant.AddCharacter(new MPSpawnableCharacter(mpCharacter, i, false), maleCount);
            }

            return(combatant);
        }
Exemplo n.º 7
0
 internal void OnInitialSpawnForSideEnded(BattleSideEnum side)
 {
     foreach (Team team in this.Mission.Teams.Where <Team>((Func <Team, bool>)(t => t.Side == side)))
     {
         team.OnFormationUnitsSpawned();
     }
     foreach (Team team in this.Mission.Teams.Where <Team>((Func <Team, bool>)(t => t.Side == side)))
     {
         foreach (Formation formation in team.Formations)
         {
             formation.QuerySystem.EvaluateAllPreliminaryQueryData();
         }
         team.MasterOrderController.OnOrderIssued += new OnOrderIssuedDelegate(this.OrderController_OnOrderIssued);
         if (team.SpecialFormations.Any <Formation>((Func <Formation, bool>)(f => f.CountOfUnits > 0)))
         {
             Agent generalAgent = team.GeneralAgent;
             foreach (Formation formation in team.SpecialFormations.Where <Formation>((Func <Formation, bool>)(f => f.CountOfUnits > 0)))
             {
                 team.MasterOrderController.SelectFormation(formation);
                 team.MasterOrderController.SetOrderWithAgent(OrderType.FollowMe, team.GeneralAgent);
                 team.MasterOrderController.ClearSelectedFormations();
                 formation.IsAIControlled = true;
             }
         }
         team.MasterOrderController.OnOrderIssued -= new OnOrderIssuedDelegate(this.OrderController_OnOrderIssued);
     }
 }
        public void SetTimersOfVictoryReactionsForRetreating(BattleSideEnum side)
        {
            this._reactionsStarted = true;
            this.SelectVictoryCondition(side);
            List <Agent> list      = this.Mission.Agents.Where <Agent>((Func <Agent, bool>)(agent => agent.IsHuman && agent.IsAIControlled && agent.Team.Side == side)).ToList <Agent>();
            int          num1      = (int)((double)list.Count * 0.5);
            List <Agent> agentList = new List <Agent>();

            for (int index = 0; index < list.Count && agentList.Count != num1; ++index)
            {
                int num2 = list.Count - index - (num1 - agentList.Count);
                if ((double)MBRandom.RandomFloat <= 0.5 + 0.5 * (double)MBMath.ClampFloat((float)(num1 - num2) / (float)num1, 0.0f, 1f))
                {
                    agentList.Add(list[index]);
                }
            }
            foreach (Agent agent in agentList)
            {
                MatrixFrame frame  = agent.Frame;
                Vec2        asVec2 = frame.origin.AsVec2;
                Vec3        f      = frame.rotation.f;
                agent.SetTargetPositionAndDirectionSynched(ref asVec2, ref f);
                this.SetTimersOfVictoryReactions(agent, 1f, 8f);
            }
        }
        private void SelectVictoryCondition(BattleSideEnum side)
        {
            BattleObserverMissionLogic missionBehaviour = Mission.Current.GetMissionBehaviour <BattleObserverMissionLogic>();

            if (missionBehaviour != null)
            {
                float agentRatioForSide = missionBehaviour.GetDeathToBuiltAgentRatioForSide(side);
                if ((double)agentRatioForSide < 0.25)
                {
                    this._selectedCheerActions = this._highCheerActions;
                }
                else if ((double)agentRatioForSide < 0.75)
                {
                    this._selectedCheerActions = this._midCheerActions;
                }
                else
                {
                    this._selectedCheerActions = this._lowCheerActions;
                }
            }
            else
            {
                this._selectedCheerActions = this._midCheerActions;
            }
        }
Exemplo n.º 10
0
 public MPCombatant(BattleSideEnum side, int tacticLevel, BasicCultureObject culture,
                    Tuple <uint, uint> primaryColorPair, Tuple <uint, uint> alternativeColorPair, Banner banner)
     : base(GameTexts.FindText("str_ebt_side", side == BattleSideEnum.Attacker ? "Attacker" : "Defender"),
            side, culture, primaryColorPair, alternativeColorPair, banner)
 {
     _tacticLevel = tacticLevel;
 }
Exemplo n.º 11
0
 internal static void TroopNumberChangedInternal(BattleSideEnum side, IBattleCombatant battleCombatant, BasicCharacterObject character, int number = 0, int numberKilled = 0, int numberWounded = 0, int numberRouted = 0, int killCount = 0, int numberReadyToUpgrade = 0)
 {
     if (battleCombatant is PartyBase party)
     {
         if (party.MapEvent != null && SimulationModel.IsValidEventType(party.MapEvent.EventType))
         {
             if (SimulationsPool.TryGetSimulationModel(party.MapEvent.Id, out SimulationModel simulationModel))
             {
                 while (numberKilled > 0)
                 {
                     simulationModel.RemoveTroop(side, character.Id);
                     numberKilled--;
                 }
                 while (numberWounded > 0)
                 {
                     simulationModel.RemoveTroop(side, character.Id);
                     numberWounded--;
                 }
                 while (numberRouted > 0)
                 {
                     simulationModel.RemoveTroop(side, character.Id);
                     numberRouted--;
                 }
             }
         }
     }
 }
Exemplo n.º 12
0
 public SPCombatant(PartyBase party, TextObject name, int tacticLevel, BattleSideEnum side, BasicCultureObject basicCulture,
                    Tuple <uint, uint> primaryColorPair, Tuple <uint, uint> alternativeColorPair, Banner banner)
     : base(name, side, basicCulture, primaryColorPair, alternativeColorPair, banner)
 {
     Combatant    = party;
     _tacticLevel = tacticLevel;
 }
Exemplo n.º 13
0
 public BotData(BattleSideEnum side, int kill, int assist, int death, int alive)
 {
     this.Side          = side;
     this.KillCount     = kill;
     this.AssistCount   = assist;
     this.DeathCount    = death;
     this.AliveBotCount = alive;
 }
 public void BotPropertiesChanged(BattleSideEnum side)
 {
     if (this.OnBotPropertiesChanged == null)
     {
         return;
     }
     this.OnBotPropertiesChanged(side);
 }
Exemplo n.º 15
0
 internal virtual bool IsUsableBySide(BattleSideEnum side)
 {
     if (this.IsDeactivated || !this.IsInstantUse && this.HasUser)
     {
         return(false);
     }
     return(this.StandingPointSide == BattleSideEnum.None || side == this.StandingPointSide);
 }
Exemplo n.º 16
0
 public void AddTroops(BattleSideEnum battleSide, FormationClass formationClass, int troopCount)
 {
     if (troopCount <= 0 || battleSide == BattleSideEnum.None)
     {
         return;
     }
     this._battleSideDeploymentPlans[(int)battleSide].AddTroops(formationClass, troopCount);
 }
 public static void GetNumberOfTroopsSacrificedForTryingToGetAway(BattleSideEnum battleSide, MapEvent mapEvent, ref int __result)
 {
     if (BannerlordCheatsSettings.Instance.NoTroopSacrifice &&
         battleSide == mapEvent.PlayerSide)
     {
         __result = 0;
     }
 }
Exemplo n.º 18
0
 protected EnhancedBattleTestAgentOrigin(IBattleCombatant combatant, IEnhancedBattleTestTroopSupplier troopSupplier, BattleSideEnum side, int rank = -1, UniqueTroopDescriptor uniqueNo = default)
 {
     _troopSupplier  = troopSupplier;
     _side           = side;
     BattleCombatant = combatant;
     _descriptor     = !uniqueNo.IsValid ? new UniqueTroopDescriptor(TaleWorlds.Core.Game.Current.NextUniqueTroopSeed) : uniqueNo;
     Rank            = rank == -1 ? MBRandom.RandomInt(10000) : rank;
 }
Exemplo n.º 19
0
 public bool IsSideDepleted(BattleSideEnum side)
 {
     if (side == base.Mission.PlayerTeam.Side)
     {
         return(this._troopSuppliers[(int)side].NumRemovedTroops == this._playerSideSpawnedTroopCount);
     }
     return(this._troopSuppliers[(int)side].NumRemovedTroops == this._otherSideSpawnedTroopCount);
 }
 public static bool IsOpponentOf(this BattleSideEnum s, BattleSideEnum side)
 {
     if (s == BattleSideEnum.Attacker && side == BattleSideEnum.Defender)
     {
         return(true);
     }
     return(s == BattleSideEnum.Defender && side == BattleSideEnum.Attacker);
 }
Exemplo n.º 21
0
 public static BattleSideEnum GetOppositeSide(this BattleSideEnum side)
 {
     if (side == BattleSideEnum.Attacker)
     {
         return(BattleSideEnum.Defender);
     }
     return(side != BattleSideEnum.Defender ? side : BattleSideEnum.Attacker);
 }
Exemplo n.º 22
0
 public void SetSpawnTroops(BattleSideEnum side, bool spawnTroops, bool enforceSpawning = false)
 {
     this._missionSides[(int)side].SetSpawnTroops(spawnTroops);
     if (!(spawnTroops & enforceSpawning))
     {
         return;
     }
     this.CheckInitialSpawns();
 }
Exemplo n.º 23
0
 protected EnhancedBattleTestCombatant(TextObject name, BattleSideEnum side, BasicCultureObject basicCulture, Tuple <uint, uint> primaryColorPair, Tuple <uint, uint> alternativeColorPair, Banner banner)
 {
     Name                 = name;
     Side                 = side;
     BasicCulture         = basicCulture;
     PrimaryColorPair     = primaryColorPair;
     AlternativeColorPair = alternativeColorPair;
     Banner               = banner;
 }
Exemplo n.º 24
0
        internal void AddTroopsFromInvolvedParty(PartyBase involvedParty, BattleSideEnum side)
        {
            if (!IsPlayerInvolved && Hero.MainHero.Id == involvedParty.LeaderHero?.Id)
            {
                IsPlayerInvolved = true;
            }

            Parties[(int)side].AddTroopsFromParty(involvedParty);
        }
        public static void Postfix(MapEvent __instance, PartyBase involvedParty, BattleSideEnum side, bool notFromInit)
        {
            if (!notFromInit)
            {
                return;
            }

            MercenaryContractCampaignEvents.Instance.OnPartyJoinedMapEvent(__instance, involvedParty);
        }
Exemplo n.º 26
0
		public static List<FighterInfo> createMosnterFighterList(List<Template.Auto.Monster.MonsterTemplate> monterList, BattleSideEnum side)
		{
			List<FighterInfo> _fighterList = new List<FighterInfo>();
			int _size = monterList.Count;
			for (int _i = 0; _i < _size; _i++)
			{
				_fighterList.Add(createMonsterProp(_i, monterList[_i], side, FighterType.MONSTER, _i == monterList.Count - 1));
			}
			return _fighterList;
		}
Exemplo n.º 27
0
		public static List<FighterInfo> createListFromMsgHero(BattleSideEnum side, List<BattleMsgHero> msgHeroList)
		{
			List<FighterInfo> _fighterList = new List<FighterInfo>();
			foreach (BattleMsgHero _hero in msgHeroList)
			{
				FighterInfo _info = createFighterFromMsgHero(side, _hero);
				_fighterList.Add(_info);
			}
			return _fighterList;
		}
Exemplo n.º 28
0
		public static HeroTeam createHeroTeam(Battle battle, List<FighterInfo> fighterProps, BattleSideEnum side)
		{
			HeroTeam _team = new HeroTeam(battle, side);
			foreach (FighterInfo _fighterProp in fighterProps)
			{
				BattleFighter _fighter = createHeroFighterFromBattleProp(_team, _fighterProp);
				_team.addActor(_fighter);
			}
			return _team;
		}
 public void Initialize()
 {
     ResetData();
     this.PlayerSide = (PlayerEncounter.PlayerIsAttacker ? BattleSideEnum.Attacker : BattleSideEnum.Defender);
     if (null != MobileParty.MainParty.MapEvent)
     {
         attackerBanner = MobileParty.MainParty.MapEvent.DefenderSide.LeaderParty.Banner;
         defenderBanner = MobileParty.MainParty.MapEvent.AttackerSide.LeaderParty.Banner;
     }
 }
Exemplo n.º 30
0
        public void OnTeamPowerChanged(BattleSideEnum teamSide, float power)
        {
            Action <BattleSideEnum, float> powerChangedEvent = this.OnTeamPowerChangedEvent;

            if (powerChangedEvent == null)
            {
                return;
            }
            powerChangedEvent(teamSide, power);
        }
Exemplo n.º 31
0
 public void ReserveReinforcement(BattleSideEnum side, int numberOfTroops)
 {
     this._numberOfTroopsInQueueForReinforcement[(int)side] += numberOfTroops;
     foreach (MissionAgentSpawnLogic.SpawnPhase spawnPhase in this._phases[(int)side])
     {
         int num = Math.Min(numberOfTroops / this._phases[(int)side].Count, numberOfTroops);
         spawnPhase.RemainingSpawnNumber -= num;
         numberOfTroops -= num;
     }
 }
Exemplo n.º 32
0
 private static void MakeAgentsYell(HideoutMissionController controller, BattleSideEnum side)
 {
     foreach (var agent in controller.Mission.Agents)
     {
         if (agent.IsActive() && agent.Team.Side == side)
         {
             agent.SetWantsToYell();
         }
     }
 }
Exemplo n.º 33
0
        private static bool HasTroopsRemaining(HideoutMissionController controller, BattleSideEnum side)
        {
            IList missionSides = (IList)typeof(HideoutMissionController).GetField("_missionSides", BindingFlags.NonPublic | BindingFlags.Instance)
                                 .GetValue(controller);
            var mSide     = missionSides[(int)side];
            int numTroops = (int)typeof(HideoutMissionController).GetNestedType("MissionSide", BindingFlags.NonPublic)
                            .GetProperty("NumberOfActiveTroops", BindingFlags.Public | BindingFlags.Instance).GetValue(mSide);

            return(numTroops > 0);
        }
Exemplo n.º 34
0
		public static List<FighterInfo> createFighterInfoListFormHeroTemp(List<Template.Auto.Hero.HeroTemplate> heroTemps, BattleSideEnum side)
		{
			List<FighterInfo> _infoList = new List<FighterInfo>();
			int _heroTempSize = heroTemps.Count;
			for (int _i = 0; _i < _heroTempSize; _i++)
			{
				FighterInfo _info = createFighterInfoFromHeroTemp(_i, side, heroTemps[_i]);
				_infoList.Add(_info);
			}
			return _infoList;
		}
Exemplo n.º 35
0
		public static MonsterTeam createMonsterTeam(Battle battle, List<FighterInfo> fighterProps, BattleSideEnum side)
		{
			MonsterTeam _team = new MonsterTeam(battle, side);
			foreach (FighterInfo _fighterProp in fighterProps)
			{
				BattleFighter _fighter = createMonsterFighterFromBattleProp(_team, _fighterProp);
				_team.addActor(_fighter);
			}
			_team.BattleSide = side;
			return _team;
		}
Exemplo n.º 36
0
		public static FighterInfo createFighterFromMsgMonster(BattleSideEnum side, BattleMsgMonster msgMonster)
		{
			FighterInfo _info = new FighterInfo();
			_info.Index = msgMonster.Index;
			_info.BattleSide = side;
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TEMPLATE, msgMonster.TemplateId);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_JOB, 1);
			_info.FighterType = FighterType.MONSTER;
			createMonsterDrop(_info, msgMonster.DropMap);
			return _info;
		}
Exemplo n.º 37
0
		public static FighterInfo createFighterFromMsgHero(BattleSideEnum side, BattleMsgHero msgHero)
		{
			FighterInfo _info = new FighterInfo();
			_info.Index = msgHero.Index;
			_info.BattleSide = side;
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TEMPLATE, msgHero.TemplateId);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_JOB, msgHero.JobId);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TYPE, msgHero.HeroType);
			_info.FighterType = FighterType.HERO;
			_info.BattleProperty = msgHero.FighteProp;
			_info.SkillIdList = msgHero.AllSkill;
			_info.ActiveSkillId = msgHero.ActiveSkillId;
			_info.LeaderSkillId = msgHero.LeaderSkill;
			return _info;
		}
Exemplo n.º 38
0
		public static void initFighterIndexFromMonsterGrop(BattleSideEnum side, List<int> monsterGroup, List<FighterInfo> monsterFighter)
		{

			// 在创建MonsterInfo的时候注入SceneIndex
			int _sceneMonsterCount = 0;
			int _sceneIndex = 0;

			foreach (FighterInfo _info in monsterFighter)
			{
				_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_MONSTER_SCENE, _sceneIndex);
				_info.Index = _sceneMonsterCount;
				if (++_sceneMonsterCount >= monsterGroup[_sceneIndex])
				{
					_sceneIndex++;
					_sceneMonsterCount = 0;
				}
			}

		}
Exemplo n.º 39
0
		public static FighterInfo createFighterInfoFromHeroTemp(int index, BattleSideEnum side, Template.Auto.Hero.HeroTemplate heroTemp)
		{

			Dictionary<int, int> _aProps = createHeroAPropFromTemp(heroTemp);
			FighterInfo _info = FighterInfoCreater.createFighterProp(index, side, FighterType.HERO, _aProps);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TEMPLATE, heroTemp.Id);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_JOB, (int)heroTemp.Job);
			//是在客户端构建的
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TYPE, BattleConstants.FIGHTER_TYPE_HERO);
			_info.ActiveSkillId = heroTemp.ActiveSkill;
			_info.LeaderSkillId = heroTemp.LeaderSkill;

			List<int> _allSkills = new List<int>();
			_allSkills.AddRange(heroTemp.PassiveSkill);
			_allSkills.Add(heroTemp.SpSkill);
			_allSkills.Add(heroTemp.LeaderSkill);
			_allSkills.Add(heroTemp.ActiveSkill);
			_info.SkillIdList = _allSkills;
			return _info;
		}
Exemplo n.º 40
0
		public virtual List<FighterInfo> getSideFighters(BattleSideEnum battelSide)
		{
			List<FighterInfo> _sideFighter = new List<FighterInfo>();
			foreach (FighterInfo _prop in FighterProp)
			{
				if (_prop.BattleSide == battelSide)
				{
					_sideFighter.Add(_prop);
				}
			}
			return _sideFighter;
		}
Exemplo n.º 41
0
		public static FighterInfo createMonsterProp(int index, Template.Auto.Monster.MonsterTemplate monsterTemp, BattleSideEnum battleSide, FighterType type, bool boss)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<Integer, Integer> _aProp = createMonsterAProp(monsterTemp, boss);
			Dictionary<int, int> _aProp = createMonsterAProp(monsterTemp, boss);
			FighterInfo _info = FighterInfoCreater.createFighterProp(index, battleSide, type, _aProp);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TEMPLATE, monsterTemp.Id); // 测试代码很糙请无视
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_JOB, 0);
			_info.addNormalProp(BattleKeyConstants.BATTLE_PROP_MONSTER_AI_ID, monsterTemp.AiID);
			_info.addNormalProp(BattleKeyConstants.BATTLE_PROP_MONSTER_DEFAULT_CD, monsterTemp.CD);
			return _info;
		}
Exemplo n.º 42
0
		public static List<FighterInfo> createTestFighterList(int count, BattleSideEnum side, FighterType type)
		{
			List<FighterInfo> _fighterList = new List<FighterInfo>();
			for (int _i = 0; _i < count; _i++)
			{
				_fighterList.Add(createPropFromTest(_i, side, type, _i == count - 1));
			}
			return _fighterList;
		}
Exemplo n.º 43
0
		public static List<FighterInfo> createListFromTest(BattleSideEnum side)
		{
			return createTestFighterList(9, side, FighterType.MONSTER);
		}
Exemplo n.º 44
0
		public static FighterInfo createFighterProp(int index, BattleSideEnum side, FighterType type, Dictionary<int, int> prop)
		{
			FighterInfo _info = new FighterInfo();
			_info.Index = index;
			_info.BattleProperty = prop;
			_info.BattleSide = side;
			_info.FighterType = type;
			return _info;
		}
Exemplo n.º 45
0
		public static FighterInfo createPropFromTest(int index, BattleSideEnum battleSide, FighterType type, bool boss)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<Integer, Integer> _aProp = createTestAProp(type.isHero(), boss);
			Dictionary<int, int> _aProp = createTestAProp(type.Hero, boss);
			FighterInfo _info = createFighterProp(index, battleSide, type, _aProp);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TEMPLATE, 111001); // 测试代码很糙请无视
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_JOB, 1);
			return _info;
		}
Exemplo n.º 46
0
		public HeroTeam(Battle battle, BattleSideEnum side) : base(battle, side)
		{
			this.waitingHeroList = new LinkedList<HeroPoint>();
			clearPoint();
		}
Exemplo n.º 47
0
		public static List<FighterInfo> getSideFighter(Battle battle, BattleSideEnum side)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.kx.sglm.gs.battle.share.data.BattleSource _source = battle.getBattleSource();
			BattleSource _source = battle.BattleSource;
			return _source.getSideFighters(side);
		}
Exemplo n.º 48
0
        private void EndBattle(Heroes.Core.Battle.Heros.Hero attackHero, Heroes.Core.Battle.Heros.Hero defendHero,
            Heroes.Core.Battle.Quick.Monster defendMonster, Heroes.Core.Town defendCastle,
            BattleSideEnum victory)
        {
            SetQtyLeft(attackHero, _attackHeroOriginal);

            if (defendHero != null)
            {
                SetQtyLeft(defendHero, _defendHeroOriginal);
            }

            if (defendMonster != null)
            {
                SetQtyLeft(defendMonster, _monsterOriginal);
            }
        }
Exemplo n.º 49
0
        private bool CheckVictory()
        {
            bool hasArmy = false;
            if (_attackHero != null)
            {
                foreach (Heroes.Core.Battle.Armies.Army c in _attackHero._armyKSlots.Values)
                {
                    if (c._qtyLeft > 0)
                    {
                        hasArmy = true;
                        break;
                    }
                }

                if (!hasArmy)
                {
                    // attacker loss
                    _victory = BattleSideEnum.Defender;

                    if (_defendHero != null)
                        EndBattle(_attackHero, _defendHero, _monster, null, _victory);
                    else if (_monster != null)
                        EndBattle(_attackHero, _defendHero, _monster, null, _victory);

                    return true;
                }
            }

            hasArmy = false;
            if (_defendHero != null)
            {
                foreach (Heroes.Core.Battle.Armies.Army c in _defendHero._armyKSlots.Values)
                {
                    if (c._qtyLeft > 0)
                    {
                        hasArmy = true;
                        break;
                    }
                }

                if (!hasArmy)
                {
                    _victory = BattleSideEnum.Attacker;
                    EndBattle(_attackHero, _defendHero, _monster, null, _victory);

                    return true;
                }
            }

            hasArmy = false;
            if (_monster != null)
            {
                foreach (Heroes.Core.Battle.Armies.Army c in _monster._armyKSlots.Values)
                {
                    if (c._qtyLeft > 0)
                    {
                        hasArmy = true;
                        break;
                    }
                }

                if (!hasArmy)
                {
                    _victory = BattleSideEnum.Attacker;
                    EndBattle(_attackHero, _defendHero, _monster, null, _victory);

                    return true;
                }
            }

            return false;
        }
Exemplo n.º 50
0
		public MonsterTeam(Battle battle, BattleSideEnum side) : base(battle, side)
		{
		}
Exemplo n.º 51
0
 public BattleEndedEventArg(BattleSideEnum victory)
 {
     _victory = victory;
 }
Exemplo n.º 52
0
        private void EndBattle(Heroes.Core.Battle.Characters.Hero attackHero, Heroes.Core.Battle.Characters.Hero defendHero,
            Heroes.Core.Battle.Characters.Monster defendMonster, Heroes.Core.Town defendCastle,
            BattleSideEnum victory)
        {
            SetQtyLeft(attackHero);

            if (defendHero != null)
            {
                SetQtyLeft(defendHero);
            }

            if (defendMonster != null)
            {
                SetQtyLeft(defendMonster);
            }

            // raise victory event
            BattleEndedEventArg eventArg = new BattleEndedEventArg(victory);
            OnBattleEnded(eventArg);
        }