Exemplo n.º 1
0
 public ActionEntity(BattleAction action)
 {
     Name = action.Name;
     PerRound = action.PerRound;
     Speed = action.Speed;
     Prepped = action.Prepped;
 }
Exemplo n.º 2
0
 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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
        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();
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 16
0
 public void AddActionToPartyMember(BattleAction newAction)
 {
     CurrentPartyMember.AddAction(newAction);
     PartyMemberActions.Add(newAction);
 }
Exemplo n.º 17
0
 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);
 }
Exemplo n.º 19
0
 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);
 }
Exemplo n.º 27
0
 public void Setup()
 {
     action = new BattleAction("attack", 5, 3);
 }
 public PlacementCalculator(BattleAction action)
 {
     maxActionsThisRound = action.ThisRound;
     speed = action.Speed;
     currentPartOfAction = action.Used + 1;
 }
Exemplo n.º 29
0
 public void AddAction(BattleAction newAction)
 {
     Actions.Add(newAction);
 }
 public EditAction(BattleAction action)
 {
     InitializeComponent();
     actionViewModel = new ActionViewModel(action);
     DataContext = actionViewModel;
 }