Example #1
0
        void update_list()
        {
            EffectList.Items.Clear();

            foreach (TokenLink link in fLinks)
            {
                string tokens = "";
                foreach (IToken token in link.Tokens)
                {
                    string name = "";

                    if (token is CreatureToken)
                    {
                        CreatureToken ct = token as CreatureToken;
                        name = ct.Data.DisplayName;
                    }

                    if (token is Hero)
                    {
                        Hero hero = token as Hero;
                        name = hero.Name;
                    }

                    if (token is CustomToken)
                    {
                        CustomToken ct = token as CustomToken;
                        name = ct.Name;
                    }

                    if (name == "")
                    {
                        name = "(unknown map token)";
                    }

                    if (tokens != "")
                    {
                        tokens += ", ";
                    }

                    tokens += name;
                }

                ListViewItem lvi = EffectList.Items.Add(tokens);
                lvi.SubItems.Add(link.Text);
                lvi.Tag = link;
            }
        }
        public override void Undo()
        {
            base.Undo();

            if (_token is CreatureToken)
            {
                CreatureToken creature      = _token as CreatureToken;
                EncounterSlot encounterSlot = _encounter.FindSlot(creature.SlotID);
                encounterSlot.CombatData.Add(creature.Data);
            }
            else if (_token is Hero)
            {
                Hero hero = _token as Hero;
                //TODO:  Remove from initiative
                //hero.CombatData.Initiative = -2147483648;
                //hero.CombatData.Location = CombatData.NoPoint;
            }
            else if (_token is CustomToken)
            {
                _encounter.CustomTokens.Add(_token as CustomToken);
            }
        }
 public CreatureEventArgs(CreatureToken token)
 {
     this.fToken = token;
 }
Example #4
0
        private void hover_token_changed(object sender, EventArgs e)
        {
            SplitContainer item    = base.Controls[0] as SplitContainer;
            MapView        mapView = item.Panel1.Controls[0] as MapView;

            this.fParentMap.HoverToken = mapView.HoverToken;
            string category = "";
            string str      = null;

            if (mapView.HoverToken is CreatureToken)
            {
                CreatureToken hoverToken    = mapView.HoverToken as CreatureToken;
                EncounterSlot encounterSlot = mapView.Encounter.FindSlot(hoverToken.SlotID);
                ICreature     creature      = Session.FindCreature(encounterSlot.Card.CreatureID, SearchType.Global);
                int           hP            = encounterSlot.Card.HP;
                int           damage        = hP - hoverToken.Data.Damage;
                int           num           = hP / 2;
                if (!mapView.ShowCreatureLabels)
                {
                    category = creature.Category;
                    if (category == "")
                    {
                        category = "Creature";
                    }
                }
                else
                {
                    category = hoverToken.Data.DisplayName;
                }
                if (hoverToken.Data.Damage == 0)
                {
                    str = "Not wounded";
                }
                if (damage < hP)
                {
                    str = "Wounded";
                }
                if (damage < num)
                {
                    str = "Bloodied";
                }
                if (damage <= 0)
                {
                    str = "Dead";
                }
                if (hoverToken.Data.Conditions.Count != 0)
                {
                    str = string.Concat(str, Environment.NewLine);
                    foreach (OngoingCondition condition in hoverToken.Data.Conditions)
                    {
                        str = string.Concat(str, Environment.NewLine);
                        str = string.Concat(str, condition.ToString(this.fParentMap.Encounter, false));
                    }
                }
            }
            if (mapView.HoverToken is Hero)
            {
                Hero hero = mapView.HoverToken as Hero;
                category = hero.Name;
                str      = string.Concat(hero.Race, " ", hero.Class);
                str      = string.Concat(str, Environment.NewLine);
                str      = string.Concat(str, "Player: ", hero.Player);
            }
            if (mapView.HoverToken is CustomToken)
            {
                CustomToken customToken = mapView.HoverToken as CustomToken;
                if (mapView.ShowCreatureLabels)
                {
                    category = customToken.Name;
                    str      = "(custom token)";
                }
            }
            this.Tooltip.ToolTipTitle = category;
            this.Tooltip.ToolTipIcon  = ToolTipIcon.Info;
            this.Tooltip.SetToolTip(mapView, str);
        }
Example #5
0
        void hover_token_changed(object sender, EventArgs e)
        {
            SplitContainer splitter = Controls[0] as SplitContainer;
            MapView        map      = splitter.Panel1.Controls[0] as MapView;

            fParentMap.HoverToken = map.HoverToken;

            string title = "";
            string info  = null;

            if (map.HoverToken is CreatureToken)
            {
                CreatureToken ct       = map.HoverToken as CreatureToken;
                EncounterSlot slot     = map.Encounter.FindSlot(ct.SlotID);
                ICreature     creature = Session.FindCreature(slot.Card.CreatureID, SearchType.Global);

                int hp_total    = slot.Card.HP;
                int hp_current  = hp_total - ct.Data.Damage;
                int hp_bloodied = hp_total / 2;

                if (map.ShowCreatureLabels)
                {
                    title = ct.Data.DisplayName;
                }
                else
                {
                    title = creature.Category;
                    if (title == "")
                    {
                        title = "Creature";
                    }
                }

                if (ct.Data.Damage == 0)
                {
                    info = "Not wounded";
                }
                if (hp_current < hp_total)
                {
                    info = "Wounded";
                }
                if (hp_current < hp_bloodied)
                {
                    info = "Bloodied";
                }
                if (hp_current <= 0)
                {
                    info = "Dead";
                }

                if (ct.Data.Conditions.Count != 0)
                {
                    info += Environment.NewLine;

                    foreach (OngoingCondition oc in ct.Data.Conditions)
                    {
                        info += Environment.NewLine;
                        info += oc.ToString(fParentMap.Encounter, false);
                    }
                }
            }

            if (map.HoverToken is Hero)
            {
                Hero hero = map.HoverToken as Hero;

                title = hero.Name;

                info  = hero.Race + " " + hero.Class;
                info += Environment.NewLine;
                info += "Player: " + hero.Player;
            }

            if (map.HoverToken is CustomToken)
            {
                CustomToken ct = map.HoverToken as CustomToken;

                if (map.ShowCreatureLabels)
                {
                    title = ct.Name;
                    info  = "(custom token)";
                }
            }

            Tooltip.ToolTipTitle = title;
            Tooltip.ToolTipIcon  = ToolTipIcon.Info;
            Tooltip.SetToolTip(map, info);
        }