Esempio n. 1
0
 public RaidFight(GameFightJoinMessage msg, ConnectedHost host, MapInformations CurrentMap)
 {
     if (!(host.Bot.Game.World.Map.Data == null))
     {
         mHost = host;
     }
     Defenders           = new List <FighterModel>();
     Challengers         = new List <FighterModel>();
     JoinigInfos         = msg;
     FightType           = (FightTypeEnum)msg.fightType;
     CurrentMap.Updated += ActualizeMap;
     Challengers.Add(new FighterModel(playedFighter.PlayerBaseInformations.Id, (short)playedFighter.PlayerBaseInformations.CellId, TeamEnum.TEAM_CHALLENGER, this));
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fightType"></param>
 /// <param name="state"></param>
 /// <param name="character"></param>
 public void ExecuteFightActions(FightTypeEnum fightType, FightStateEnum state, CharacterEntity character)
 {
     foreach (var fightAction in m_fightActions.Where(faction => faction.Fight == fightType && faction.State == state))
     {
         if (ConditionParser.Instance.Check(fightAction.Conditions, character))
         {
             foreach (var action in fightAction.ActionsList)
             {
                 ActionEffectManager.Instance.ApplyEffect(character, action.Effect, action.Parameters);
             }
         }
     }
 }
Esempio n. 3
0
        public Fight(Map.Map map, FightTypeEnum type, List <Fighter> defenders, List <Fighter> challengers, FightStartingPositions fightStartingPositions)
        {
            this.Id                     = (int)(DateTime.Now.Ticks + new Random().Next(1, 99999)); //Uniqid a faire
            this.Map                    = map;
            this.FightType              = type;
            this.Defenders              = defenders;
            this.Challengers            = challengers;
            this.FightStartingPositions = fightStartingPositions;
            this.FightState             = FightStateEnum.FIGHT_CHOICE_PLACEMENT;
            this.Round                  = 0;

            this.StartPlacementPhaseTimer();
        }
Esempio n. 4
0
 public static void SendGameFightJoinMessage(IPacketReceiver client, bool canBeCancelled, bool canSayReady,
                                             bool isFightStarted, int timeMaxBeforeFightStart, FightTypeEnum fightTypeEnum)
 {
     client.Send(new GameFightJoinMessage(!isFightStarted, canBeCancelled, canSayReady, isFightStarted,
                                          (short)timeMaxBeforeFightStart, (sbyte)fightTypeEnum));
 }
Esempio n. 5
0
 public static void SendGameFightStartingMessage(IPacketReceiver client, FightTypeEnum fightTypeEnum, int attackerId, int defenderId)
 {
     client.Send(new GameFightStartingMessage((sbyte)fightTypeEnum, attackerId, defenderId));
 }
Esempio n. 6
0
 public CustomLootAttribute(string criteria, FightTypeEnum fightType)
 {
     this.Criteria  = criteria;
     this.FightType = fightType;
 }
Esempio n. 7
0
 public static void SendGameFightStartingMessage(IPacketReceiver client, FightTypeEnum fightTypeEnum)
 {
     client.Send(new GameFightStartingMessage((sbyte)fightTypeEnum, 0, 0));
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fightType"></param>
 /// <param name="state"></param>
 /// <param name="character"></param>
 public void ExecuteFightActions(FightTypeEnum fightType, FightStateEnum state, CharacterEntity character)
 {
     foreach(var fightAction in m_fightActions.Where(faction => faction.Fight == fightType && faction.State == state))
     {
         if (ConditionParser.Instance.Check(fightAction.Conditions, character))
         {
             foreach (var action in fightAction.ActionsList)
             {
                 ActionEffectManager.Instance.ApplyEffect(character, action.Effect, action.Parameters);
             }
         }
     }
 }
        protected AbstractFight(FightTypeEnum type, 
            MapInstance  mapInstance, 
            long id, 
            long team0LeaderId, 
            int team0Alignment,
            int team0FlagCell, 
            long team1LeaderId, 
            int team1Alignment,
            int team1FlagCell, 
            long startTimeout, 
            long turnTime, 
            bool cancelButton = false, 
            bool canWinHonor = false,
            params AbstractEndingBehavior[] endingBehaviors)
        {
            m_endingBehaviors = new Queue<AbstractEndingBehavior>(endingBehaviors);
            m_activableObjects = new Dictionary<AbstractFighter, List<AbstractActivableObject>>();
            m_processingTargets = new LinkedList<CastInfos>();
            m_currentApCost = -1;

            Type = type;
            Id = id;
            Map = mapInstance;
            State = FightStateEnum.STATE_PLACEMENT;
            LoopState = FightLoopStateEnum.STATE_INIT;
            CancelButton = cancelButton;
            TurnTime = turnTime;
            StartTime = startTimeout;
            NextLoopTimeout = startTimeout;
            Result = new FightEndResult(Id, canWinHonor);
            Cells = new Dictionary<int, FightCell>();
            TurnProcessor = new FightTurnProcessor();

            foreach (var cell in mapInstance.Cells)
                Cells.Add(cell.Id, new FightCell(cell.Id, cell.Walkable , cell.LineOfSight));

            SpectatorTeam = new SpectatorTeam(this);
            Team0 = new FightTeam(0, team0LeaderId, team0Alignment, team0FlagCell, this, new List<FightCell>(Cells.Values.Where(cell => mapInstance.FightTeam0Cells.Contains(cell.Id))));
            Team1 = new FightTeam(1, team1LeaderId, team1Alignment, team1FlagCell, this, new List<FightCell>(Cells.Values.Where(cell => mapInstance.FightTeam1Cells.Contains(cell.Id))));
            Team0.OpponentTeam = Team1;
            Team1.OpponentTeam = Team0;

            AddUpdatable(SpectatorTeam);
            AddUpdatable(Team0);
            AddUpdatable(Team1);
            AddHandler(SpectatorTeam.Dispatch);
            AddHandler(Team0.Dispatch);
            AddHandler(Team1.Dispatch);
        }