Inheritance: ModelBase
        static BattleInfo()
        {
            SessionService.Instance.Subscribe("api_port/port", _ => r_Current = null);

            var rFirstStages = new[]
            {
                "api_req_sortie/battle",
                "api_req_battle_midnight/sp_midnight",
                "api_req_sortie/airbattle",
                "api_req_combined_battle/airbattle",
                "api_req_combined_battle/battle",
                "api_req_combined_battle/battle_water",
                "api_req_combined_battle/sp_midnight",

                "api_req_practice/battle",
            };
            SessionService.Instance.Subscribe(rFirstStages, r => r_Current?.ProcessFirstStage(r));

            var rSecondStages = new[]
            {
                "api_req_battle_midnight/battle",
                "api_req_combined_battle/midnight_battle",

                "api_req_practice/midnight_battle",
            };
            SessionService.Instance.Subscribe(rSecondStages, r => r_Current?.ProcessSecondStage(r));
        }
        protected override void Process(ProgressInfo rpProgress, BattleInfo rpBattle, RawBattleResult rpResult)
        {
            if (!rpBattle.IsBossBattle)
                return;

            var rSortie = SortieInfo.Current;
            if (MapIDs.Contains(rSortie.Map.ID) && rpResult.Rank >= LowestRank)
                rpProgress.Progress++;
        }
        internal BattleEvent(MapInfo rpMap, RawMapExploration rpData, string rpNodeWikiID) : base(rpData)
        {
            Battle = new BattleInfo(rpData);

            int rNodeID;
            if (rpNodeWikiID.IsNullOrEmpty())
                rNodeID = rpData.Node << 16;
            else
                rNodeID = rpNodeWikiID[0] - 'A';
            EnemyEncounters = EnemyEncounterService.Instance.GetEncounters(rpMap.ID, rNodeID, rpMap.Difficulty);
        }
        public FakeStage(BattleInfo rpOwner) : base(rpOwner)
        {
            Func<IParticipant, BattleParticipantSnapshot> rSelector = r =>
            {
                var rHP = ((FriendShip)r).Ship.HP;
                return new BattleParticipantSnapshot(rHP.Maximum, rHP.Current) { Participant = r };
            };

            FriendMain = rpOwner.Participants.FriendMain.Select(rSelector).ToList().AsReadOnly();
            FriendEscort = rpOwner.Participants.FriendEscort?.Select(rSelector).ToList().AsReadOnly();
        }
Beispiel #5
0
        public FakeStage(BattleInfo rpOwner) : base(rpOwner)
        {
            Func <IParticipant, BattleParticipantSnapshot> rSelector = r =>
            {
                var rHP = ((FriendShip)r).Ship.HP;
                return(new BattleParticipantSnapshot(rHP.Maximum, rHP.Current)
                {
                    Participant = r
                });
            };

            FriendMain   = rpOwner.Participants.FriendMain.Select(rSelector).ToArray();
            FriendEscort = rpOwner.Participants.FriendEscort?.Select(rSelector).ToArray();
        }
        protected override void Process(ProgressInfo rpProgress, BattleInfo rpBattle, RawBattleResult rpResult)
        {
            var rBits = new BitVector32(rpProgress.Progress);

            if (rpResult.Rank >= BattleRank.S)
                rBits[r_Sections[1]] = Math.Min(rBits[r_Sections[1]] + 1, 6);
            if (rpBattle.IsBossBattle)
                rBits[r_Sections[2]] = Math.Min(rBits[r_Sections[2]] + 1, 24);
            if (rpBattle.IsBossBattle && rpResult.Rank >= BattleRank.B)
                rBits[r_Sections[3]] = Math.Min(rBits[r_Sections[3]] + 1, 12);

            rpProgress.Progress = rBits.Data;
            UpdatePercentage(rpProgress, rBits);
        }
        internal BattleInfo()
        {
            r_Current = this;

            var rFleets = KanColleGame.Current.Port.Fleets;
            if (rFleets.CombinedFleetType == 0)
                Participants.FriendMain = KanColleGame.Current.Sortie.Fleet.Ships.Select(r => new FriendShip(r)).ToList<IParticipant>();
            else
            {
                Participants.FriendMain = rFleets[1].Ships.Select(r => new FriendShip(r)).ToList<IParticipant>().AsReadOnly();
                Participants.FriendEscort = rFleets[2].Ships.Select(r => new FriendShip(r)).ToList<IParticipant>().AsReadOnly();
            }

            CurrentStage = new FakeStage(this);
            OnPropertyChanged(nameof(CurrentStage));
        }
 internal protected BattleStage(BattleInfo rpOwner)
 {
     Owner = rpOwner;
 }
 internal protected BattleStage(BattleInfo rpOwner)
 {
     Owner = rpOwner;
 }
 protected override void Process(ProgressInfo rpProgress, BattleInfo rpBattle, RawBattleResult rpResult)
 {
     rpProgress.Progress += rpBattle.CurrentStage.Enemy.Count(r => r.State == BattleParticipantState.Sunk && TargetType.Contains(r.Participant.Info.Type.ID));
 }
 protected abstract void Process(ProgressInfo rpProgress, BattleInfo rpBattle, RawBattleResult rpResult);
 internal BattleEvent(RawMapExploration rpData) : base(rpData)
 {
     Battle = new BattleInfo();
 }
        internal BattleInfo(Fleet rpParticipantFleet)
        {
            r_Current = this;

            Participants.FriendMain = rpParticipantFleet.Ships.Select(r => new FriendShip(r)).ToList<IParticipant>();
        }
 protected override void Process(ProgressInfo rpProgress, BattleInfo rpBattle, RawBattleResult rpResult)
 {
     rpProgress.Progress++;
 }