Пример #1
0
        public void showDamageToolTip(UnitStatsCalculator usc)
        {
            UIRichTextEx.Default.ClearText();

            if (usc == null)
            {
                return;
            }

            //Damage totalDamage = (Damage)hero.damage + additional_damage;
            unit hero = usc.unit;

            UIRichTextEx.Default.AddText("Damage: " + usc.total_damage, UIFonts.boldArial8, Color.White);

            UIRichTextEx.Default.AddLineInterval();

            UIRichTextEx.Default.AddText("Type: ", Color.Gray); UIRichTextEx.Default.AddText("Hero", Color.Yellow);
            UIRichTextEx.Default.AddText("\nRange: " + hero.range + " (" + hero.attackMethod + ")", Color.Gray);
            UIRichTextEx.Default.AddText("\nSpeed (cooldown): " + hero.cooldown + " sec (" + ((int)(hero.ias * 100)).ToString(DBINT.full_format, DBDOUBLE.provider) + "% IAS)");
            UIRichTextEx.Default.AddText("\nAvg. damage per second: " + usc.dps_normal.ToString(DBDOUBLE.format, DBDOUBLE.provider));

            // atack damage ugrades

            DBUPGRADE upgrade = hero.upgrades.GetByEffectOfType <DbAttackDamageBonus>();

            if (upgrade != null)
            {
                UIRichTextEx.Default.AddText("\nUpgrade: " + upgrade.Profile.Name + " - Level " + upgrade.Level);
            }

            UIRichTextEx.Default.AddLineInterval();

            UIRichTextEx.Default.AddText("Hero attacks do reduced damage to fortified armor", Color.White);

            contentRTB.Rtf = UIRichTextEx.Default.CloseRtf();
        }
Пример #2
0
        void RefreshSelectionStatsCalculator()
        {
            uscList.Clear();

            foreach (unit u in Current.player.selection)
            {
                UnitStatsCalculator usc = new UnitStatsCalculator(u, 0);
                usc.PrepareInfo();
                uscList.Add(usc);
            }
        }
Пример #3
0
        internal void DisplayUnit(DisplayUnitFlags flags)
        {
            if (Current.unit != null)
            {
                // info
                if ((flags & DisplayUnitFlags.Info) != 0)
                {
                    usc = new UnitStatsCalculator(Current.unit, (int)armorDamageNumUD.Value);
                    usc.PrepareInfo();
                }

                // portrait
                if ((flags & DisplayUnitFlags.Portrait) != 0)
                {
                    heroImagePB.Image = Current.unit.iconImage;

                    if (Current.unit.IsInvulnerable)
                    {
                        hpTextBox.Text = "";
                        manaTextBox.Text = "";
                    }
                    else
                    {
                        hpTextBox.Text = Current.unit.hp.convert_to_int() + "/" + Current.unit.max_hp;
                        manaTextBox.Text = Current.unit.mana.convert_to_int() + "/" + Current.unit.max_mana;
                    }
                }

                // stats
                if ((flags & DisplayUnitFlags.Stats) != 0)
                {
                    heroNameLabel.Text = Current.unit.IsHero ? Current.unit.name : Current.unit.ID;

                    ////////////////
                    // normal damage
                    /////////////////
                    if (Current.unit.CanAttack)
                    {
                        damageRTB.Clear();
                        spellDamageRTB.Clear();

                        DamageCalcType damageCalcType = (DamageCalcType)((damageLL.Tag is int) ? (int)damageLL.Tag : 0);

                        usc.CalculateDamage(damageCalcType);

                        addText(spellDamageRTB, usc.spell_damage, usc.spell_damage > 0);

                        addText(damageRTB, "" + usc.damage, Color.White);
                        addText(damageRTB, " + " + usc.bonus_damage, UIColors.bonus_damage, usc.bonus_damage > 0);
                        addText(damageRTB, " " + usc.bonus_damage.ToString(true), UIColors.negative_damage, usc.bonus_damage < 0);

                        damagePB.Visible = true;
                        damageLL.Visible = true;
                        damageRTB.Visible = true;
                        spellDamageRTB.Visible = true;

                        // atack damage ugrades

                        DBUPGRADE upgrade = Current.unit.upgrades.GetByEffectOfType<DbAttackDamageBonus>();
                        if (upgrade != null)
                        {
                            attackUpgradeLabel.Text = upgrade.Level + "";

                            attackUpgradePanel.BackColor = Color.Black;
                            attackUpgradePanel.Visible = true;
                            attackUpgradePanel.BackColor = Color.Gold;
                        }
                        else
                            attackUpgradePanel.Visible = false;
                    }
                    else
                    {
                        damagePB.Visible = false;
                        damageLL.Visible = false;
                        damageRTB.Visible = false;
                        spellDamageRTB.Visible = false;
                    }

                    ////////////////
                    // armor
                    /////////////////
                    armorRTB.Clear();

                    if (Current.unit.IsInvulnerable)
                        addText(armorRTB, "Invulnerable", Color.Red);
                    else
                    {
                        double naked_armor = Current.unit.get_naked_armor();
                        double bonus_armor = Current.unit.armor - naked_armor;

                        addText(armorRTB, "" + naked_armor.ToString(DBDOUBLE.format, DBDOUBLE.provider), Color.White);
                        addText(armorRTB, " " + bonus_armor.ToString(DBDOUBLE.full_format, DBDOUBLE.provider), UIColors.bonus_damage, bonus_armor != 0);
                    }

                    armorPB.Visible = true;
                    armorLL.Visible = true;
                    armorRTB.Visible = true;

                    //////////////////
                    // hero info
                    //////////////////
                    if (Current.unit.IsHero)
                    {
                        heroLevelLL.Text = "Level " + Current.unit.Level + " " + Current.unit.ID;

                        switch (researchRestriction)
                        {
                            case 0:
                                heroLvlDownLink.Text = "<<";
                                heroLvlUpLink.Text = ">>";
                                break;
                            case 1:
                                heroLvlDownLink.Text = "[";
                                heroLvlUpLink.Text = "]";
                                break;
                            case 2:
                                heroLvlDownLink.Text = "{{";
                                heroLvlUpLink.Text = "}}";
                                break;
                        }

                        ////////////////
                        // strength
                        /////////////////
                        strengthRTB.Clear();

                        int naked_str = Current.unit.get_naked_attr(PrimAttrType.Str);
                        int bonus_str = Current.unit.strength.convert_to_int() - naked_str;

                        addText(strengthRTB, "" + naked_str, Color.White);
                        addText(strengthRTB, " + " + bonus_str, UIColors.bonus_damage, bonus_str != 0);
                        ////////////////
                        // agility
                        /////////////////
                        agilityRTB.Clear();

                        int naked_agi = Current.unit.get_naked_attr(PrimAttrType.Agi);
                        int bonus_agi = Current.unit.agility.convert_to_int() - naked_agi;

                        addText(agilityRTB, "" + naked_agi, Color.White);
                        addText(agilityRTB, " + " + bonus_agi, UIColors.bonus_damage, bonus_agi != 0);
                        ////////////////
                        // intelligence
                        /////////////////
                        intelligenceRTB.Clear();

                        int naked_int = Current.unit.get_naked_attr(PrimAttrType.Int);
                        int bonus_int = Current.unit.intelligence.convert_to_int() - naked_int;

                        addText(intelligenceRTB, "" + naked_int, Color.White);
                        addText(intelligenceRTB, " + " + bonus_int, UIColors.bonus_damage, bonus_int != 0);

                        ////////////////
                        // leveling
                        /////////////////
                        heroLvlUpLink.LinkColor = (Current.unit.Level < 25) ? Color.White : Color.Gray;
                        heroLvlDownLink.LinkColor = (Current.unit.Level > 1) ? Color.White : Color.Gray;

                        ///////////////////////
                        // primary attribute
                        //////////////////////
                        switch ((PrimAttrType)Current.unit.primary)
                        {
                            case PrimAttrType.Agi: primAttrPB.Image = global::DotaHIT.Properties.Resources.prim_attr_agi;
                                break;
                            case PrimAttrType.Str: primAttrPB.Image = global::DotaHIT.Properties.Resources.prim_attr_str;
                                break;
                            case PrimAttrType.Int: primAttrPB.Image = global::DotaHIT.Properties.Resources.prim_attr_int;
                                break;
                        }

                        expBarPanel.Visible = true;

                        primAttrPB.Visible = true;

                        strengthLabel.Visible = true;
                        strengthRTB.Visible = true;

                        agilityLabel.Visible = true;
                        agilityRTB.Visible = true;

                        intelligenceLabel.Visible = true;
                        intelligenceRTB.Visible = true;
                    }
                    else
                    {
                        expBarPanel.Visible = false;

                        primAttrPB.Visible = false;

                        strengthLabel.Visible = false;
                        strengthRTB.Visible = false;

                        agilityLabel.Visible = false;
                        agilityRTB.Visible = false;

                        intelligenceLabel.Visible = false;
                        intelligenceRTB.Visible = false;
                    }

                    //////////////////
                    // building info
                    //////////////////

                    if (Current.unit.IsBuilding)
                    {
                        statusLL.Visible = false;
                        statusTS.Visible = false;
                    }
                    else
                    {
                        statusLL.Visible = true;
                        statusTS.Visible = true;
                    }

                    ///////////////////////
                    // buffs
                    ///////////////////////
                    statusTS.Items.Clear();

                    int statusSwitch = (statusLL.Tag is int) ? (int)statusLL.Tag : 0;

                    TargetType[] targets = null;// = AbilityTargets.None;
                    AbilityMatchType matchType = AbilityMatchType.Intersects;

                    switch (statusSwitch)
                    {
                        case 0: // self
                            targets = new TargetType[] { TargetType.Self };
                            break;

                        case 1: // ally
                            targets = new TargetType[] { TargetType.Ally | TargetType.Friend };
                            break;

                        case 2: // foe
                            matchType = AbilityMatchType.NotIntersects;
                            targets = new TargetType[] { TargetType.None, TargetType.Self };
                            break;
                    }

                    DBABILITIES buffContainers = Current.unit.acquiredAbilities.GetSpecific(AbilitySpecs.HasBuff | AbilitySpecs.IsActivated,
                        matchType,
                        targets);

                    StackedAbilitiesDictionary stackedBuffContainers = new StackedAbilitiesDictionary(buffContainers);

                    if (statusSwitch == 0)
                    {
                        foreach (StackedAbilities sa in Current.unit.Buffs.Values)
                            foreach (DBABILITY a in sa)
                                stackedBuffContainers.Add(a, false);
                    }

                    foreach (StackedAbilities stackedBuffContainer in stackedBuffContainers.Values)
                        foreach (DBABILITY ability in stackedBuffContainer)
                        {
                            DBBUFF buff = ability.Buff;
                            ToolStripButton tsb = new ToolStripButton((Image)buff.Profile.Image);
                            tsb.DisplayStyle = ToolStripItemDisplayStyle.Image;
                            tsb.MouseMove += new MouseEventHandler(statusTS_MouseMove);
                            tsb.MouseLeave += new EventHandler(toolTip_MouseLeave);
                            tsb.Tag = buff.Profile;

                            statusTS.Items.Add(tsb);
                        }
                }

                // items
                if ((flags & DisplayUnitFlags.Items) != 0)
                {
                    foreach (Button c in fullInventoryControls)
                    {
                        DBITEMSLOT itemSlot = c.Tag as DBITEMSLOT;

                        c.BackgroundImage = itemSlot.Image;

                        if (!itemSlot.IsNull && itemSlot.Item.usable && itemSlot.Item.abilities.HasActivatedState(AbilityState.AllActivatedFlags))
                        {
                            c.FlatAppearance.BorderColor = UIColors.activeAbility;
                            c.FlatAppearance.BorderSize = 1;
                        }
                        else
                        {
                            c.FlatAppearance.BorderColor = Color.Black;
                            c.FlatAppearance.BorderSize = 0;
                        }
                    }
                }

                // abilities
                if ((flags & DisplayUnitFlags.Abilities) != 0)
                {
                    researchB.Visible = Current.unit.IsHero;
                    ArrangeAbilities(Current.unit.heroAbilities);
                }
                else
                {
                    researchB.Visible = false;
                    researchPointsPanel.Visible = false;
                }
            }
            else
            {
                heroImagePB.Image = null;
                heroNameLabel.Text = "";
                heroLevelLL.Text = "";

                hpTextBox.Text = "";
                manaTextBox.Text = "";

                damageRTB.Text = "";
                spellDamageRTB.Text = "";
                armorRTB.Text = "";
                strengthRTB.Text = "";
                agilityRTB.Text = "";
                intelligenceRTB.Text = "";

                heroLvlUpLink.LinkColor = Color.Gray;
                heroLvlDownLink.LinkColor = Color.Gray;

                damagePB.Visible = false;
                damageLL.Visible = false;
                damageRTB.Visible = false;
                spellDamageRTB.Visible = false;

                armorPB.Visible = false;
                armorLL.Visible = false;
                armorRTB.Visible = false;

                researchB.Visible = false;
                researchPointsPanel.Visible = false;

                expBarPanel.Visible = false;

                primAttrPB.Visible = false;

                strengthLabel.Visible = false;
                strengthRTB.Visible = false;

                agilityLabel.Visible = false;
                agilityRTB.Visible = false;

                intelligenceLabel.Visible = false;
                intelligenceRTB.Visible = false;

                statusLL.Visible = false;
                statusTS.Visible = false;

                if ((flags & DisplayUnitFlags.Items) != 0)
                {
                    ArrayList al = new ArrayList();
                    al.AddRange(heroItemsPanel.Controls);
                    al.AddRange(backpackPanel.Controls);
                    foreach (DBITEMSLOT itemSlot in fullInventory)
                        foreach (Control c in al)
                            if (c.Name == itemSlot.Name + "B")
                            {
                                c.BackgroundImage = null;
                                c.Tag = null;
                            }
                }

                if ((flags & DisplayUnitFlags.Abilities) != 0)
                    foreach (Control c in abilitySlots)
                    {
                        c.Tag = null;
                        c.BackgroundImage = null;
                        c.Text = "";
                    }

                statusTS.Items.Clear();
            }

            cbForm.RefreshBuildCost();

            if ((flags & DisplayUnitFlags.Info) != 0)
                DisplayInfo();

            // ability order is available via inventory switch,
            // so if items are displayed, then ability order must be prepared too
            if ((flags & DisplayUnitFlags.Items) != 0)
                RefreshAbilityOrder();

            if ((flags & DisplayUnitFlags.Stats) != 0)
            {
                selectedUnitTabPage.Refresh();

                if (playerSelectionTabControl.SelectedTab != selectedUnitTabPage)
                    playerSelectionTabControl.SelectedTab = selectedUnitTabPage;
            }
        }
Пример #4
0
        public void showDamageToolTip(UnitStatsCalculator usc)
        {
            UIRichTextEx.Default.ClearText();

            if (usc == null) return;

            //Damage totalDamage = (Damage)hero.damage + additional_damage;
            unit hero = usc.unit;

            UIRichTextEx.Default.AddText("Damage: " + usc.total_damage, UIFonts.boldArial8, Color.White);

            UIRichTextEx.Default.AddLineInterval();

            UIRichTextEx.Default.AddText("Type: ", Color.Gray); UIRichTextEx.Default.AddText("Hero", Color.Yellow);
            UIRichTextEx.Default.AddText("\nRange: " + hero.range + " (" + hero.attackMethod + ")", Color.Gray);
            UIRichTextEx.Default.AddText("\nSpeed (cooldown): " + hero.cooldown + " sec (" + ((int)(hero.ias * 100)).ToString(DBINT.full_format, DBDOUBLE.provider) + "% IAS)");
            UIRichTextEx.Default.AddText("\nAvg. damage per second: " + usc.dps_normal.ToString(DBDOUBLE.format, DBDOUBLE.provider));

            // atack damage ugrades

            DBUPGRADE upgrade = hero.upgrades.GetByEffectOfType<DbAttackDamageBonus>();
            if (upgrade != null)
                UIRichTextEx.Default.AddText("\nUpgrade: " + upgrade.Profile.Name + " - Level " + upgrade.Level);

            UIRichTextEx.Default.AddLineInterval();

            UIRichTextEx.Default.AddText("Hero attacks do reduced damage to fortified armor", Color.White);

            contentRTB.Rtf = UIRichTextEx.Default.CloseRtf();
        }