コード例 #1
0
        public void Setup()
        {
            participant = new ActionParticipant("name");
            var participants = new[] { participant };

            partyViewModel = new PartyViewModel(participants);
            addEnemyActionCommand = new AddEnemyActionCommand(partyViewModel);
        }
コード例 #2
0
        public void Setup()
        {
            participant = new ActionParticipant("name");
            var participants = new[] { participant };

            allParticipantsViewModel = new PartyViewModel(participants);
            editPartyMemberCommand = new EditPartyMemberCommand(allParticipantsViewModel);
        }
コード例 #3
0
        public void Setup()
        {
            participant = new ActionParticipant("name");
            var participants = new[] { participant };

            allParticipantsViewModel = new PartyViewModel(participants);
            removeEnemyCommand = new RemoveEnemyCommand(allParticipantsViewModel);
        }
コード例 #4
0
        public void IsValid()
        {
            participant = new ActionParticipant(String.Empty);
            Assert.That(participant.IsValid(), Is.False, "No name");

            participant.AlterInfo("name", false, false);
            Assert.That(participant.IsValid(), Is.True, "Has name");
        }
コード例 #5
0
        public ParticipantViewModel(ActionParticipant participant)
        {
            this.participant = participant;
            SaveParticipantEditsCommand = new SaveParticipantEditsCommand(this);

            Name = participant.Name;
            IsNpc = participant.IsNpc;
            IsEnemy = participant.IsEnemy;
        }
コード例 #6
0
        public void Setup()
        {
            action = new BattleAction("attack");
            participant = new ActionParticipant("name");
            participant.AddAction(action);
            var participants = new[] { participant };

            partyViewModel = new PartyViewModel(participants);
            editPartyMemberActionCommand = new EditPartyMemberActionCommand(partyViewModel);
        }
コード例 #7
0
        public void Setup()
        {
            action = new BattleAction("attack");
            participant = new ActionParticipant("name");
            participant.AddAction(action);
            var participants = new[] { participant };

            partyViewModel = new PartyViewModel(participants);
            removeEnemyActionCommand = new RemoveEnemyActionCommand(partyViewModel);
        }
コード例 #8
0
 public void Constructor()
 {
     participant = new ActionParticipant("name");
     Assert.That(participant.Name, Is.EqualTo("name"));
     Assert.That(participant.IsNpc, Is.True);
     Assert.That(participant.IsEnemy, Is.True);
     Assert.That(participant.Actions, Is.EqualTo(Enumerable.Empty<BattleAction>()));
     Assert.That(participant.Initiative, Is.EqualTo(0));
     Assert.That(participant.Enabled, Is.True);
 }
コード例 #9
0
        public void Setup()
        {
            var participant = new ActionParticipant("name", isNpc: false);
            var participants = new[] { participant };
            var dice = DiceFactory.Create(new Random());

            setInitiativesViewModel = new SetInitiativesViewModel(participants, dice);
            participant.Initiative = 9;

            incrementInitiativeCommand = new IncrementInitiativeCommand(setInitiativesViewModel);
        }
コード例 #10
0
        private void AddPartyMember(Object sender, RoutedEventArgs e)
        {
            var partyMember = new ActionParticipant(String.Empty, false);
            var addPartyMemberWindow = new NewParticipant(partyMember);
            addPartyMemberWindow.Owner = this;
            addPartyMemberWindow.ShowDialog();

            if (partyMember.IsValid())
                partyViewModel.AddParticipant(partyMember);

            fileAccessor.SaveParty(partyViewModel.Party);
        }
コード例 #11
0
        public ParticipantEntity(ActionParticipant participant)
        {
            Name = participant.Name;
            IsNpc = participant.IsNpc;
            IsEnemy = participant.IsEnemy;
            Enabled = participant.Enabled;

            Actions = new List<ActionEntity>();

            foreach (var action in participant.Actions)
                Actions.Add(new ActionEntity(action));
        }
コード例 #12
0
        private IEnumerable<ActionParticipant> CreateDatabase()
        {
            var db = new List<ActionParticipant>();
            db.Add(new ActionParticipant("monster 1"));
            db.Add(new ActionParticipant("monster 2"));
            db.Add(new ActionParticipant("player 1"));

            var withActions = new ActionParticipant("Has actions");
            withActions.AddAction(new BattleAction("action"));
            db.Add(withActions);

            return db;
        }
コード例 #13
0
        public ActionParticipant ConvertToActionParticipant(ParticipantEntity entity)
        {
            var participant = new ActionParticipant(entity.Name, entity.IsEnemy, entity.IsNpc);
            participant.Enabled = entity.Enabled;

            var actions = new List<BattleAction>();

            foreach (var savedAction in entity.Actions)
                actions.Add(ConvertToBattleAction(savedAction));

            participant.AddActions(actions);

            return participant;
        }
コード例 #14
0
        public void Setup()
        {
            var name = new ActionParticipant("Name");
            var otherName = new ActionParticipant("Other Name");
            var participants = new[] { name, otherName };

            var action = new BattleAction("attack", 1, 1, true);
            name.Initiative = 2;
            otherName.Initiative = 1;
            name.AddAction(action);
            otherName.AddAction(action);

            roundViewModel = new RoundViewModel(1, participants);
        }
コード例 #15
0
        public SetInitiativesViewModel(IEnumerable<ActionParticipant> participants, IDice dice)
        {
            this.participants = participants;
            this.dice = dice;

            DecrementInitiativeCommand = new DecrementInitiativeCommand(this);
            IncrementInitiativeCommand = new IncrementInitiativeCommand(this);
            GetNextInitiativeCommand = new GetNextInitiativeCommand(this);

            ZeroOutAllInitiatives();
            SetNpcInitiatives();

            currentParticipant = participants.FirstOrDefault(p => p.Initiative == 0);
        }
コード例 #16
0
        public void Setup()
        {
            var name = new ActionParticipant("name");
            var otherName = new ActionParticipant("other name");
            var participants = new[] { name, otherName };

            var firstAction = new BattleAction("attack 1", 1, 1, true);
            var secondAction = new BattleAction("attack 2", 1, 1, true);

            name.AddAction(firstAction);
            otherName.AddAction(secondAction);

            name.Initiative = 2;
            otherName.Initiative = 1;

            roundViewModel = new RoundViewModel(1, participants);
            getNextActionsCommand = new GetNextActionsCommand(roundViewModel);
        }
コード例 #17
0
        public void RemoveParticipant(ActionParticipant participant)
        {
            allParticipants.Remove(participant);

            if (participant == CurrentPartyMember)
                CurrentPartyMember = null;
            else if (participant == CurrentEnemy)
                CurrentEnemy = null;

            UpdateParties();
        }
コード例 #18
0
 public void AddParticipant(ActionParticipant newParticipant)
 {
     allParticipants.Add(newParticipant);
     UpdateParties();
 }
コード例 #19
0
 public void Setup()
 {
     participant = new ActionParticipant("name", true);
     participantViewModel = new ParticipantViewModel(participant);
     saveParticipantEditsCommand = new SaveParticipantEditsCommand(participantViewModel);
 }
コード例 #20
0
        public void Setup()
        {
            var actions = new List<BattleAction>();
            for (var i = 0; i < 3; i++)
                actions.Add(new BattleAction("name " + i, i, i, (i % 2 == 0)));

            participant = new ActionParticipant("name");
            participant.AddActions(actions);
        }
コード例 #21
0
 public void Setup()
 {
     participant = new ActionParticipant("name", false, false);
     participantViewModel = new ParticipantViewModel(participant);
 }
コード例 #22
0
 public void GetNextParticipantToSetInitiative()
 {
     currentParticipant = participants.FirstOrDefault(x => x.Initiative == 0);
 }
コード例 #23
0
        public void Setup()
        {
            enabledGoodGuy = new ActionParticipant("good guy", isEnemy: false);
            enabledBadGuy = new ActionParticipant("bad guy");
            var disabledGoodGuy = new ActionParticipant("good guy", isEnemy: false);
            disabledGoodGuy.Enabled = false;
            var disabledBadGuy = new ActionParticipant("bad guy");
            disabledBadGuy.Enabled = false;

            var participants = new[]
            {
                enabledGoodGuy,
                enabledBadGuy,
                disabledGoodGuy,
                disabledBadGuy
            };

            goodAction = new BattleAction("Good");
            badAction = new BattleAction("Bad");

            enabledGoodGuy.AddAction(goodAction);
            enabledBadGuy.AddAction(badAction);

            partyViewModel = new PartyViewModel(participants);
        }
コード例 #24
0
 public NewParticipant(ActionParticipant participant)
 {
     InitializeComponent();
     participantViewModel = new ParticipantViewModel(participant);
     DataContext = participantViewModel;
 }
コード例 #25
0
        private ActionParticipant GetActionParticipant(Object rawObject)
        {
            try
            {
                return (ActionParticipant)rawObject;
            }
            catch (InvalidCastException)
            {
                var oldParticipant = (Participant)rawObject;
                var participant = new ActionParticipant(oldParticipant.Name, oldParticipant.IsEnemy, oldParticipant.IsNpc);
                participant.Enabled = oldParticipant.Enabled;

                var actions = ConvertAttacks(oldParticipant.Attacks);
                participant.AddActions(actions);

                return participant;
            }
        }
コード例 #26
0
        public void Setup()
        {
            npc = new ActionParticipant("3", isNpc: true);

            participants = new[]
            {
                new ActionParticipant("1", isNpc: false),
                new ActionParticipant("2", isNpc: false),
                npc
            };

            var participant = participants.First();
            participant.Initiative = 9;

            var dice = DiceFactory.Create(new Random());

            setInitiativesViewModel = new SetInitiativesViewModel(participants, dice);
        }