public ActionEntity(BattleAction action)
 {
     Name = action.Name;
     PerRound = action.PerRound;
     Speed = action.Speed;
     Prepped = action.Prepped;
 }
 public ActionViewModel(BattleAction action)
 {
     this.action = action;
     SaveActionEditsCommand = new SaveActionEditsCommand(this);
     DecrementPerRoundCommand = new DecrementPerRoundCommand(this);
     SetToUneditedVariables();
 }
 public void HasCorrectDescription()
 {
     var action = new BattleAction("attack", 1, 1);
     queueableAction = new QueueableAction("attacker", action, 7);
     Assert.That(queueableAction.Placement, Is.EqualTo(-6));
     Assert.That(queueableAction.Description, Is.EqualTo("attacker's attack"));
 }
 public void AddAction()
 {
     var action = new BattleAction("attack name", 1, 2);
     participant.AddAction(action);
     var hasBeenAdded = participant.Actions.Contains(action);
     Assert.That(hasBeenAdded, Is.True);
 }
        public void PreppedCanBeSet()
        {
            action = new BattleAction(action.Name, action.PerRound, action.Speed, false);
            Assert.That(action.Prepped, Is.False);

            action = new BattleAction(action.Name, action.PerRound, action.Speed, true);
            Assert.That(action.Prepped, Is.True);
        }
        public void AddsAction()
        {
            var action = new BattleAction("attack name", 1, 1);
            var actionCount = participant.Actions.Count();
            participantViewModel.AddAction(action);

            Assert.That(participant.Actions, Contains.Item(action));
            Assert.That(participant.Actions.Count(), Is.EqualTo(actionCount + 1));
        }
        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 QueueableAction(String participantName, BattleAction action, Int32 initiative)
        {
            var calculator = new PlacementCalculator(action);
            Placement = calculator.ComputePlacement(initiative);

            if (action.ThisRound == 1)
                Description = String.Format("{0}'s {1}", participantName, action.Name);
            else
                Description = String.Format("{0}'s {1} {2}", participantName, NumberToNthWord(action.Used + 1), action.Name);
        }
        private IEnumerable<BattleAction> ConvertAttacks(IEnumerable<Attack> attacks)
        {
            var actions = new List<BattleAction>();

            foreach (var attack in attacks)
            {
                var action = new BattleAction(attack.Name, attack.PerRound, attack.Speed, attack.Prepped);
                actions.Add(action);
            }

            return actions;
        }
        private void AddActionToPartyMember(Object sender, RoutedEventArgs e)
        {
            var action = new BattleAction(String.Empty);
            var addActionWindow = new EditAction(action);
            addActionWindow.Owner = this;
            addActionWindow.ShowDialog();

            if (action.IsValid())
                partyViewModel.AddActionToPartyMember(action);

            fileAccessor.SaveParty(partyViewModel.Party);
        }
        private void Save(Object sender, RoutedEventArgs e)
        {
            var action = new BattleAction(String.Empty);
            var newActionWindow = new EditAction(action);

            newActionWindow.Owner = this;
            newActionWindow.ShowDialog();

            if (action.IsValid())
                participantViewModel.AddAction(action);

            Close();
        }
        public void IsValid()
        {
            action = new BattleAction(String.Empty);
            Assert.That(action.IsValid(), Is.False);

            action.AlterInfo("name", .5, 0);
            Assert.That(action.IsValid(), Is.True);

            action.AlterInfo(String.Empty, .5, 0);
            Assert.That(action.IsValid(), Is.False);

            action.AlterInfo("name", 0, 0);
            Assert.That(action.IsValid(), Is.False);
        }
        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 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 AddActionToPartyMember(BattleAction newAction)
 {
     CurrentPartyMember.AddAction(newAction);
     PartyMemberActions.Add(newAction);
 }
 public void AddActionToEnemy(BattleAction newAction)
 {
     CurrentEnemy.AddAction(newAction);
     EnemyActions.Add(newAction);
 }
 public void Setup()
 {
     action = new BattleAction("name", 1.5, 2);
     actionViewModel = new ActionViewModel(action);
 }
 public void RemoveAction(BattleAction action)
 {
     Actions.Remove(action);
 }
 public void Setup()
 {
     action = new BattleAction("attack", 2, 7);
     calculator = new PlacementCalculator(action);
 }
 public void Setup()
 {
     var action = new BattleAction("name", 1, 1);
     actionViewModel = new ActionViewModel(action);
     decrementPerRoundCommand = new DecrementPerRoundCommand(actionViewModel);
 }
 public void AddAction(BattleAction action)
 {
     participant.AddAction(action);
 }
 public void SetPlacementByInitiative()
 {
     action = new BattleAction("attack", 1, 1);
     calculator = new PlacementCalculator(action);
     Assert.That(calculator.ComputePlacement(10), Is.EqualTo(-9));
 }
 public void Setup()
 {
     var action = new BattleAction("bow", 2, 7);
     action.FinishCurrentPartOfAction();
     queueableAction = new QueueableAction("attacker", action, 7);
 }
        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 void Setup()
 {
     action = new BattleAction("name", .5, 1);
     actionViewModel = new ActionViewModel(action);
     saveActionEditsCommand = new SaveActionEditsCommand(actionViewModel);
 }
 public void Setup()
 {
     action = new BattleAction("attack", 5, 3);
 }
 public PlacementCalculator(BattleAction action)
 {
     maxActionsThisRound = action.ThisRound;
     speed = action.Speed;
     currentPartOfAction = action.Used + 1;
 }
 public void AddAction(BattleAction newAction)
 {
     Actions.Add(newAction);
 }
 public EditAction(BattleAction action)
 {
     InitializeComponent();
     actionViewModel = new ActionViewModel(action);
     DataContext = actionViewModel;
 }