Пример #1
0
        public void Update(int dt)
        {
            if (Status == Asda2WarPointStatus.Owned)
            {
                //gain scores each one minute to team
                _timeToNextGainPoints -= dt;
                if (_timeToNextGainPoints <= 0)
                {
                    BattleGround.GainScores(OwnedFaction, CharacterFormulas.FactionWarPointsPerTicForCapturedPoints);
                    _timeToNextGainPoints += CharacterFormulas.DefaultTimeGainExpReward;
                }
            }
            if (_isCapturing)
            {
                _tomeToCaprute -= dt;
                if (_tomeToCaprute <= 0)
                {
                    //point captured
                    Status = Asda2WarPointStatus.Owned;
                    Asda2BattlegroundHandler.SendUpdatePointInfoResponse(null, this);
                    Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(BattleGround,
                                                                              BattleGroundInfoMessageType.SuccessToCompletelyOccuptyTheNumOccupationPoints, Id, null, OwnedFaction);
                    Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(BattleGround,
                                                                              BattleGroundInfoMessageType.TheOtherSideHasTemporarilyOccupiedTheNumOccupationPoint, Id, null,
                                                                              (short?)(OwnedFaction == 0 ? 1 : 0));
                    BattleGround.GainScores(OwnedFaction, CharacterFormulas.FactionWarPointsPerTicForCapturedPoints);
                    _isCapturing = false;
                }
            }
            else
            {
                if (CapturingCharacter == null || !BattleGround.IsStarted)
                {
                    return;
                }
                _timeToStartCapturing -= dt;
                if (_timeToStartCapturing <= 0)
                {
                    _tomeToCaprute = CharacterFormulas.DefaultCaptureTime;
                    _isCapturing   = true;
                    OwnedFaction   = CapturingCharacter.Asda2FactionId;
                    CapturingCharacter.GainActPoints(1);
                    BattleGround.GainScores(CapturingCharacter, 1);
                    Status = Asda2WarPointStatus.Capturing;
                    Asda2BattlegroundHandler.SendUpdatePointInfoResponse(null, this);
                    Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(BattleGround,
                                                                              BattleGroundInfoMessageType.SuccessToTemporarilyOccuptyTheNumOccupationPoints, Id, null,
                                                                              CapturingCharacter.Asda2FactionId);
                    Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(BattleGround,
                                                                              BattleGroundInfoMessageType.TheOtherSideHasTemporarilyOccupiedTheNumOccupationPoint, Id, null,
                                                                              (short?)(CapturingCharacter.Asda2FactionId == 1 ? 0 : 1));
                    Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(CapturingCharacter.Client, Id,
                                                                               OcupationPointStartedStatus.Fail);
                    CapturingCharacter.CurrentCapturingPoint = null;

                    CapturingCharacter    = null;
                    _timeToNextGainPoints = CharacterFormulas.DefaultTimeGainExpReward;
                }
            }
        }
Пример #2
0
 public void StopCapture()
 {
     Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(BattleGround,
                                                               BattleGroundInfoMessageType.FailedToTemporarilyOccuptyTheNumOccupationPoints, Id, null,
                                                               CapturingCharacter.Asda2FactionId);
     Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(CapturingCharacter.Client, Id,
                                                                OcupationPointStartedStatus.Fail);
     CapturingCharacter.CurrentCapturingPoint = null;
     CapturingCharacter = null;
     _isCapturing       = false;
 }
Пример #3
0
 public void StopCapture()
 {
     Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(this.BattleGround,
                                                               BattleGroundInfoMessageType.FailedToTemporarilyOccuptyTheNumOccupationPoints, this.Id, (Character)null,
                                                               new short?(this.CapturingCharacter.Asda2FactionId));
     Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(this.CapturingCharacter.Client, this.Id,
                                                                OcupationPointStartedStatus.Fail);
     this.CapturingCharacter.CurrentCapturingPoint = (Asda2WarPoint)null;
     this.CapturingCharacter = (Character)null;
     this._isCapturing       = false;
 }
Пример #4
0
 public void TryCapture(Character activeCharacter)
 {
     lock (this)
     {
         if (this.CapturingCharacter != null)
         {
             activeCharacter.SendWarMsg(string.Format("Point {0} already capturing by {1}.",
                                                      (object)((int)this.Id + 1), (object)this.CapturingCharacter.Name));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.Fail);
         }
         else if ((double)activeCharacter.Asda2Position.GetDistance(new Vector3((float)this.X,
                                                                                (float)this.Y)) > 7.0)
         {
             activeCharacter.SendWarMsg(string.Format("Distance to {0} is too big.",
                                                      (object)((int)this.Id + 1)));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.Fail);
         }
         else if (this.Status != Asda2WarPointStatus.NotOwned &&
                  (int)this.OwnedFaction == (int)activeCharacter.Asda2FactionId)
         {
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.YouAreOcupaingTheSameSide);
         }
         else
         {
             this.CapturingCharacter = activeCharacter;
             activeCharacter.CurrentCapturingPoint = this;
             this.CapturingCharacter.IsMoving      = false;
             this.CapturingCharacter.IsFighting    = false;
             Asda2MovmentHandler.SendEndMoveByFastInstantRegularMoveResponse(this.CapturingCharacter);
             this._isCapturing          = false;
             this._timeToStartCapturing = CharacterFormulas.DefaultTimeToStartCapture;
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.Ok);
         }
     }
 }
Пример #5
0
 //todo disable on move\take dmg\stun
 public void TryCapture(Character activeCharacter)
 {
     lock (this)
     {
         if (CapturingCharacter != null)
         {
             activeCharacter.SendWarMsg(string.Format("Point {0} already capturing by {1}.", Id + 1,
                                                      CapturingCharacter.Name));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                        OcupationPointStartedStatus.Fail);
             return;
         }
         if (activeCharacter.Asda2Position.GetDistance(new Vector3(X, Y)) > 7)
         {
             activeCharacter.SendWarMsg(string.Format("Distance to {0} is too big.", Id + 1));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                        OcupationPointStartedStatus.Fail);
             return;
         }
         if (Status != Asda2WarPointStatus.NotOwned && OwnedFaction == activeCharacter.Asda2FactionId)
         {
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                        OcupationPointStartedStatus.YouAreOcupaingTheSameSide);
             return;
         }
         CapturingCharacter = activeCharacter;
         activeCharacter.CurrentCapturingPoint = this;
         CapturingCharacter.IsMoving           = false;
         CapturingCharacter.IsFighting         = false;
         Asda2MovmentHandler.SendEndMoveByFastInstantRegularMoveResponse(CapturingCharacter);
         _isCapturing          = false;
         _timeToStartCapturing = CharacterFormulas.DefaultTimeToStartCapture;
         Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                    OcupationPointStartedStatus.Ok);
     }
 }
Пример #6
0
        public void Update(int dt)
        {
            if (this.Status == Asda2WarPointStatus.Owned)
            {
                this._timeToNextGainPoints -= dt;
                if (this._timeToNextGainPoints <= 0)
                {
                    this.BattleGround.GainScores(this.OwnedFaction,
                                                 CharacterFormulas.FactionWarPointsPerTicForCapturedPoints);
                    this._timeToNextGainPoints += CharacterFormulas.DefaultTimeGainExpReward;
                }
            }

            if (this._isCapturing)
            {
                this._tomeToCaprute -= dt;
                if (this._tomeToCaprute > 0)
                {
                    return;
                }
                this.Status = Asda2WarPointStatus.Owned;
                Asda2BattlegroundHandler.SendUpdatePointInfoResponse((IRealmClient)null, this);
                Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(this.BattleGround,
                                                                          BattleGroundInfoMessageType.SuccessToCompletelyOccuptyTheNumOccupationPoints, this.Id,
                                                                          (Character)null, new short?(this.OwnedFaction));
                Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(this.BattleGround,
                                                                          BattleGroundInfoMessageType.TheOtherSideHasTemporarilyOccupiedTheNumOccupationPoint, this.Id,
                                                                          (Character)null, new short?(this.OwnedFaction == (short)0 ? (short)1 : (short)0));
                this.BattleGround.GainScores(this.OwnedFaction,
                                             CharacterFormulas.FactionWarPointsPerTicForCapturedPoints);
                this._isCapturing = false;
            }
            else
            {
                if (this.CapturingCharacter == null || !this.BattleGround.IsStarted)
                {
                    return;
                }
                this._timeToStartCapturing -= dt;
                if (this._timeToStartCapturing > 0)
                {
                    return;
                }
                this._tomeToCaprute = CharacterFormulas.DefaultCaptureTime;
                this._isCapturing   = true;
                this.OwnedFaction   = this.CapturingCharacter.Asda2FactionId;
                this.CapturingCharacter.GainActPoints((short)1);
                this.BattleGround.GainScores(this.CapturingCharacter, (short)1);
                this.Status = Asda2WarPointStatus.Capturing;
                Asda2BattlegroundHandler.SendUpdatePointInfoResponse((IRealmClient)null, this);
                Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(this.BattleGround,
                                                                          BattleGroundInfoMessageType.SuccessToTemporarilyOccuptyTheNumOccupationPoints, this.Id,
                                                                          (Character)null, new short?(this.CapturingCharacter.Asda2FactionId));
                Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(this.BattleGround,
                                                                          BattleGroundInfoMessageType.TheOtherSideHasTemporarilyOccupiedTheNumOccupationPoint, this.Id,
                                                                          (Character)null,
                                                                          new short?(this.CapturingCharacter.Asda2FactionId == (short)1 ? (short)0 : (short)1));
                Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(this.CapturingCharacter.Client, this.Id,
                                                                           OcupationPointStartedStatus.Fail);
                this.CapturingCharacter.CurrentCapturingPoint = (Asda2WarPoint)null;
                this.CapturingCharacter    = (Character)null;
                this._timeToNextGainPoints = CharacterFormulas.DefaultTimeGainExpReward;
            }
        }