public void Setup()
        {
            participant = new ActionParticipant("name");
            var participants = new[] { participant };

            partyViewModel = new PartyViewModel(participants);
            addEnemyActionCommand = new AddEnemyActionCommand(partyViewModel);
        }
        public void Setup()
        {
            participant = new ActionParticipant("name");
            var participants = new[] { participant };

            allParticipantsViewModel = new PartyViewModel(participants);
            editPartyMemberCommand = new EditPartyMemberCommand(allParticipantsViewModel);
        }
        public void Setup()
        {
            participant = new ActionParticipant("name");
            var participants = new[] { participant };

            allParticipantsViewModel = new PartyViewModel(participants);
            removeEnemyCommand = new RemoveEnemyCommand(allParticipantsViewModel);
        }
        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");
        }
        public ParticipantViewModel(ActionParticipant participant)
        {
            this.participant = participant;
            SaveParticipantEditsCommand = new SaveParticipantEditsCommand(this);

            Name = participant.Name;
            IsNpc = participant.IsNpc;
            IsEnemy = participant.IsEnemy;
        }
        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);
        }
        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);
        }
 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);
 }
        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);
        }
        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);
        }
        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));
        }
        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;
        }
        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;
        }
        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);
        }
        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);
        }
        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);
        }
        public void RemoveParticipant(ActionParticipant participant)
        {
            allParticipants.Remove(participant);

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

            UpdateParties();
        }
 public void AddParticipant(ActionParticipant newParticipant)
 {
     allParticipants.Add(newParticipant);
     UpdateParties();
 }
 public void Setup()
 {
     participant = new ActionParticipant("name", true);
     participantViewModel = new ParticipantViewModel(participant);
     saveParticipantEditsCommand = new SaveParticipantEditsCommand(participantViewModel);
 }
        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);
        }
 public void Setup()
 {
     participant = new ActionParticipant("name", false, false);
     participantViewModel = new ParticipantViewModel(participant);
 }
 public void GetNextParticipantToSetInitiative()
 {
     currentParticipant = participants.FirstOrDefault(x => x.Initiative == 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);
        }
 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;
            }
        }
        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);
        }