Beispiel #1
0
        public void SwitchCurrentFightTarget()
        {
            if (CurrentFight == null || CurrentFight.fightState == FightState.FINISHED)
            {
                return;
            }
            var hostileTeam  = CurrentFight.getPlayerTeam(this) == FightTeam.Red ? CurrentFight.TeamBlue : CurrentFight.TeamRed;
            var aliveTargets = hostileTeam.Values.Where(p => !p.IsDead).ToList();

            if (!CurrentFight.Moves.Any())
            {
                Target = aliveTargets[RngUtil.intRange(0, aliveTargets.Count - 1)];
                return;
            }

            var enemiesWithoutAttacks = (from enemy
                                         in aliveTargets
                                         let matchingMove = CurrentFight.Moves.Values.FirstOrDefault(n => n.PeerObjectId == ObjectId && n.TargetObjectId == enemy.ObjectId)
                                                            where matchingMove == null select enemy).ToList();

            if (enemiesWithoutAttacks.IsEmpty())
            {
                return;
            }
            Target = enemiesWithoutAttacks[RngUtil.intRange(0, enemiesWithoutAttacks.Count - 1)];
            Log.DebugFormat("{0} has targeted {1}", ToString(), Target.ToString());
        }
Beispiel #2
0
 internal void Advance()
 {
     if (CurrentFight.Complete)
     {
         MergeSortGroup newGroup = CurrentFight.ToGroup();
         _groups.Add(newGroup);
         AdvanceCurrentFight();
     }
     if (CurrentItemFight != null)
     {
         CurrentItemFight = CurrentFight.GetNextFight();
     }
 }
Beispiel #3
0
        private void PlayerAttack(Character player1, Character player2, string attacjType)
        {
            UserAttackChoice attackChoice = new UserAttackChoice();

            attackChoice.attackingPlayer  = player1;
            attackChoice.defenderPlayer   = player2;
            attackChoice.playerAttackType = attacjType;

            CurrentFight.PlayerAttacks(attackChoice);
            RemoveCharacter();

            if (CurrentFight.WinnerTeam != null)
            {
                DisplayWinner();
            }
            ActivatePlayingTeam();
        }
Beispiel #4
0
        public void makeAMove(int targetId)
        {
//            var timer = new Stopwatch();
//            timer.Start();
//            var delayInMs = RngUtil.intRange(0, (int)moveReplyMaxDelayInMs);
//		    while (timer.ElapsedMilliseconds < delayInMs) continue;

            var newMove = new FightMove
            {
                PeerObjectId   = this.ObjectId,
                AttackSpot     = FightUtils.getRandomHit(),
                BlockSpots     = FightUtils.getRandomBlock(),
                TargetObjectId = targetId
            };

            CurrentFight.AddMoveSendPkg(this, newMove);
        }
Beispiel #5
0
        public void makeAMove()
        {
            if (CurrentFight.hasMovesAgainstAll(this))
            {
                return;
            }
            var newMove = new FightMove
            {
                PeerObjectId   = this.ObjectId,
                AttackSpot     = FightUtils.getRandomHit(),
                BlockSpots     = FightUtils.getRandomBlock(),
                SkillId        = 0,
                TargetObjectId = Target.ObjectId
            };

            DebugUtils.Logp(DebugUtils.Level.INFO, CLASSNAME, "makeAMove", "bot submitting a move");
            CurrentFight.AddMoveSendPkg(this, newMove);
        }
        public SkillReplayControlViewModel()
        {
            replayer = new SkillPlayer(this);

            var config = SkillReplayConfig.Instance;

            Language      = new ReactiveProperty <string>(config.Language);
            TextFFLogsURL = new ReactiveProperty <string>(config.FFLogsURL);
            NumberPort    = new ReactiveProperty <int>(config.Port);
            AutoReplay    = new ReactiveProperty <int>(config.AutoReplay);
            AutoStop      = new ReactiveProperty <int>(config.AutoStop);
            AutoStopTime  = new ReactiveProperty <int>(config.AutoStopTime);
            LanguageList  = config.LanguageList;

            TextPlayButton = IsPlaying.Select(play => play ? "停止" : "再生").ToReactiveProperty();
            OverlayURL     = NumberPort.Select(port => $"https://rawrington.github.io/SkillDisplay/?HOST_PORT=ws://127.0.0.1:{port}/").ToReactiveProperty();


            var IsBusy = new[] { IsLoading, IsPlaying }.CombineLatest(a => a.Any(x => x));

            HasEvent = CurrentFight.CombineLatest(CurrentFriendly, CheckEvents).ToReactiveProperty();

            FriendlyList = OriginalFriendlyList.CombineLatest(CurrentFight, (list, fight) =>
            {
                if (fight != null)
                {
                    string key = $".{fight.id}.";
                    return(list.Where(friend => friend.fights.Contains(key) && friend.type != "LimitBreak").ToList());
                }
                else
                {
                    return(new List <Friendly>());
                }
            }).ToReactiveProperty();

            FriendlyList.Subscribe(list =>
            {
                if (!list.Contains(CurrentFriendly.Value))
                {
                    CurrentFriendly.Value = null;
                }
            });

            CommandLoadFights = IsBusy.Select(b => !b).ToReactiveCommand();
            CommandLoadFights.Subscribe(LoadFights);

            CommandLoadSkill = CurrentFight.CombineLatest(CurrentFriendly, IsBusy, (fight, friend, busy) =>
            {
                if (busy)
                {
                    return(false);
                }
                if (fight == null)
                {
                    return(false);
                }
                if (friend == null)
                {
                    return(false);
                }
                return(true);
            }).ToReactiveCommand();
            CommandLoadSkill.Subscribe(LoadEvents);

            CommandReplay = HasEvent.ToReactiveCommand();
            CommandReplay.Subscribe(Replay);

            TextFFLogsURL.Subscribe(url =>
            {
                config.FFLogsURL = url;
                config.Save();
            });
            NumberPort.Subscribe(port =>
            {
                config.Port = port;
                config.Save();
            });
            AutoReplay.Subscribe(autoreplay =>
            {
                config.AutoReplay = autoreplay;
                config.Save();
            });
            AutoStop.Subscribe(autostop =>
            {
                config.AutoStop = autostop;
                config.Save();
            });
            AutoStopTime.Subscribe(autostoptime =>
            {
                config.AutoStopTime = autostoptime;
                config.Save();
            });

            Language.Subscribe(lang =>
            {
                config.Language = lang;
                config.Save();
            });

            PlayStopTagList = IsPlaying.Select(x => x ? "Stop" : "Play").ToReactiveProperty();
        }