Esempio n. 1
0
 public Status(string _name, int _duration, character _target, character _source)
 {
     name     = _name;
     duration = _duration;
     source   = _source;
     target   = _target;
 }
 void addClick(object sender, RoutedEventArgs args)
 {
     try
     {
         string name       = namebox.Text;
         int    initiative = Convert.ToInt32(initBox.Text);
         int    health     = Convert.ToInt32(healthBox.Text);
         int    armor      = Convert.ToInt32(armorBox.Text);
         if (chosen == null)
         {
             characters.Add(new character(name, initiative, health, armor));
         }
         else
         {
             chosen.name       = name;
             chosen.initiative = initiative;
             chosen.health     = health;
             addButton.Content = "Add";
             chosen            = null;
         }
         memberListView.ItemsSource = characters;
         refreshView();
     }
     catch
     {
     }
 }
Esempio n. 3
0
        void removeFromCombat(object sender, RoutedEventArgs args)
        {
            character senderchar = (sender as Button).DataContext as character;

            characterlist.Remove(senderchar);
            refreshView();
        }
Esempio n. 4
0
        void changeHealth(object sender, RoutedEventArgs args)
        {
            Button             button = sender as Button;
            character          target = button.DataContext as character;
            ChangeHealthDialog chd    = new ChangeHealthDialog(target, refreshView);

            chd.ShowDialog();
        }
 public ChangeHealthDialog(character _character, refresh method)
 {
     refresher     += method;
     this.character = _character;
     InitializeComponent();
     nameBlock.Text = "Name: " + character.name;
     healthBox.Text = character.health.ToString();
 }
Esempio n. 6
0
        void addEffect(object sender, RoutedEventArgs args)
        {
            Button    button = sender as Button;
            character target = button.DataContext as character;

            NewEffect ne = new NewEffect(addEffect, target, characterlist.First(), characterlist);

            ne.ShowDialog();
        }
 public NewEncounterDialog(List <player> players, givelist method)
 {
     this.characters = new List <character>();
     this.playerlist = new List <player>(players);
     oldnames        = new List <player>(players);
     listgiver      += method;
     chosen          = null;
     InitializeComponent();
     refreshView();
 }
Esempio n. 8
0
        void addEffect(string name, int duration, character target, character source)
        {
            Status newStatus = new Status(name, duration, target, source);

            target.inflictEffect(newStatus);
            source.causeEffect(newStatus);

            statuslist.Add(newStatus);
            refreshView();
        }
Esempio n. 9
0
 public NewEffect(giveeffect method, character target, character source, List <character> characters)
 {
     effectgiver += method;
     InitializeComponent();
     TargetBox.ItemsSource  = characters;
     SourceBox.ItemsSource  = characters;
     TargetBox.SelectedItem = target;
     SourceBox.SelectedItem = source;
     Keyboard.Focus(namebox);
 }
Esempio n. 10
0
        void AdvanceTurn(object sender, RoutedEventArgs args)
        {
            character last = characterlist[0];

            characterlist.RemoveAt(0);
            characterlist.Add(last);
            characterlist.First().progress();
            turn++;
            round = (turn / characterlist.Count) + 1;
            refreshView();
        }
Esempio n. 11
0
        public void update(string _name, int _duration, character _target, character _source)
        {
            name     = _name;
            duration = _duration;
            target.removeInflict(this);
            _target.inflictEffect(this);
            target = _target;

            source.removeCause(this);
            _source.causeEffect(this);
            source = _source;
        }
Esempio n. 12
0
 void selectionChanged(object sender, RoutedEventArgs args)
 {
     try
     {
         string name   = namebox.Text;
         int    health = Convert.ToInt32(healthBox.Text);
         int    armor  = Convert.ToInt32(armorBox.Text);
         playerlist.Insert(0, new player(name, health, armor));
     }
     catch { }
     chosen = memberListView.SelectedItem as character;
     refreshView();
 }
Esempio n. 13
0
        void addToCombat(object sender, RoutedEventArgs args)
        {
            character senderchar = (sender as Button).DataContext as character;
            bool      exists     = false;

            foreach (character ch in characterlist)
            {
                if (ch.name.Contains(senderchar.name))
                {
                    exists = true;
                    break;
                }
            }
            if (exists)
            {
                int i = 0;
                while (exists)
                {
                    i++;
                    exists = false;
                    foreach (character ch in characterlist)
                    {
                        if (ch.name.Contains(senderchar.name + i))
                        {
                            exists = true;
                        }
                    }
                }
                characterlist.Add(new character((senderchar.name + i), senderchar.initiative, senderchar.health, senderchar.armor));
            }
            else
            {
                characterlist.Add(new character(senderchar.name, senderchar.initiative, senderchar.health, senderchar.armor));
            }
            character first = characterlist.First();

            sortList();
            while (characterlist.First() != first)
            {
                turn--;
                AdvanceTurn(sender, args);
            }


            refreshView();
        }
Esempio n. 14
0
 public void insert(character _char)
 {
     if (node != null)
     {
         if (_char.initiative > node.character.initiative)
         {
             SinglyLinkedNode newnode = new SinglyLinkedNode(_char, node);
             node = newnode;
         }
         else
         {
             node.insert(_char);
         }
     }
     else
     {
         node = new SinglyLinkedNode(_char, node);
     }
 }
Esempio n. 15
0
 public SinglyLinkedNode(character _char, SinglyLinkedNode _node)
 {
     character = _char;
     node      = _node;
 }