Exemple #1
0
        private static string CreateHero(Hero hero, bool turn)
        {
            int cardCnt = 1;

            var zoneStr = new StringBuilder();

            string spacer = new string(' ', 5 * (8 - cardCnt) + cardCnt + 1);

            StringBuilder[] zoneStrArray = new[]
            {
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
            };

            char[][] cardAscii = new CardAsciiBuilder().Create()
                                 .Name(hero.Card.Name)
                                 .Exhausted(hero.IsExhausted)
                                 .HeroPowerExhausted(hero.HeroPower.IsExhausted)
                                 .AttackDamage(hero.AttackDamage)
                                 .Health(hero.Health)
                                 .HeroWeaponAttackDamage(hero.Weapon?.AttackDamage ?? 0)
                                 .HeroWeaponDurability(hero.Weapon?.Durability ?? 0)
                                 .Health(hero.Health)
                                 .Windfury(hero.HasWindfury)
                                 .Windfury(hero.IsFrozen)
                                 .Build();

            int x = turn ? 1 : 0;

            zoneStrArray[0 + x].Append(new string(cardAscii[0]));
            zoneStrArray[1 + x].Append(new string(cardAscii[1]));
            zoneStrArray[2 + x].Append(new string(cardAscii[2]));
            zoneStrArray[3 + x].Append(new string(cardAscii[3]) + " " + hero.HeroPower.Card.AbbreviatedName(7));
            zoneStrArray[4 + x].Append(new string(cardAscii[4]));
            zoneStrArray[turn ? 0 : 5].Append(new string(cardAscii[5]) + " " + (hero.Controller == hero.Game.CurrentPlayer ? " <<==" : "     "));
            zoneStrArray[0].Append(" ");
            zoneStrArray[1].Append(" ");
            zoneStrArray[2].Append(" ");
            zoneStrArray[3].Append(" ");
            zoneStrArray[4].Append(" ");
            zoneStrArray[5].Append(" ");

            char[][] zoneAscii = new CardAsciiBuilder().Create().ZoneCards(hero.Controller.SecretZone.Count, hero.Controller.SecretZone.Type).Build();

            int y = turn ? 1 : 0;

            string[] backStrArray = new[] { "", "", "", "", "", "" };
            backStrArray[0 + y]        = new string(zoneAscii[0]);
            backStrArray[1 + y]        = new string(zoneAscii[1]);
            backStrArray[2 + y]        = new string(zoneAscii[2]);
            backStrArray[3 + y]        = new string(zoneAscii[3]);
            backStrArray[4 + y]        = new string(zoneAscii[4]);
            backStrArray[turn ? 0 : 5] = new string(zoneAscii[5]);

            zoneStr.Append(zoneStrArray[0 + y].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[0] + " ¦"));
            zoneStr.Append(zoneStrArray[1 + y].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[1] + " ¦"));
            zoneStr.Append(zoneStrArray[2 + y].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[2] + " ¦"));
            zoneStr.Append(zoneStrArray[3 + y].AppendLine(spacer.Substring(9) + "¦ " + backStrArray[3] + " ¦"));
            zoneStr.Append(zoneStrArray[4 + y].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[4] + " ¦"));
            zoneStr.Append(zoneStrArray[turn ? 0 : 5].AppendLine(spacer.Substring(7) + "¦ " + backStrArray[5] + " ¦"));
            return(zoneStr.ToString());
        }
Exemple #2
0
        public static string[] PrintHelp()
        {
            var result = new string[18];

            var cardAscii = new CardAsciiBuilder().Create().AttackDamage(8).Health(5).Cost(3)
                            .Name("HS Card").Type(CardType.MINION)
                            .Battlecry(true).Deathrattle(true).Exhausted(true).Spellpower(2).Inspire(true)
                            .Poisonus(true).Freeze(true).Silenced(true)
                            .Charge(true).DivineShield(true).Frozen(true).Stealth(true).Enrage(true).Taunt(true).Windfury(true)
                            .Build();

            result[0] = "   " + new string(cardAscii[0]) + " ";
            result[1] = "   " + new string(cardAscii[1]) + " ";
            result[2] = "   " + new string(cardAscii[2]) + " ";
            result[3] = "   " + new string(cardAscii[3]) + " ";
            result[4] = "   " + new string(cardAscii[4]) + " ";
            result[5] = "   " + new string(cardAscii[5]) + " ";

            var notExhausted = new CardAsciiBuilder().Create().Name("!Exhaus").Exhausted(false).Build();

            result[0] += new string(notExhausted[0]) + " ";
            result[1] += new string(notExhausted[1]) + " ";
            result[2] += new string(notExhausted[2]) + " ";
            result[3] += new string(notExhausted[3]) + " ";
            result[4] += new string(notExhausted[4]) + " ";
            result[5] += new string(notExhausted[5]) + " ";

            var exhausted = new CardAsciiBuilder().Create().Name("Exhaust").Exhausted(true).Build();

            result[0] += new string(exhausted[0]) + " ";
            result[1] += new string(exhausted[1]) + " ";
            result[2] += new string(exhausted[2]) + " ";
            result[3] += new string(exhausted[3]) + " ";
            result[4] += new string(exhausted[4]) + " ";
            result[5] += new string(exhausted[5]) + " ";

            var cost = new CardAsciiBuilder().Create().Name("Cost").Cost(5).Build();

            result[0] += new string(cost[0]) + " ";
            result[1] += new string(cost[1]) + " ";
            result[2] += new string(cost[2]) + " ";
            result[3] += new string(cost[3]) + " ";
            result[4] += new string(cost[4]) + " ";
            result[5] += new string(cost[5]) + " ";

            var type = new CardAsciiBuilder().Create().Name("Type").Type(CardType.MINION).Build();

            result[0] += new string(type[0]) + " ";
            result[1] += new string(type[1]) + " ";
            result[2] += new string(type[2]) + " ";
            result[3] += new string(type[3]) + " ";
            result[4] += new string(type[4]) + " ";
            result[5] += new string(type[5]) + " ";

            var atk = new CardAsciiBuilder().Create().Name("Attack").AttackDamage(5).Build();

            result[0] += new string(atk[0]) + " ";
            result[1] += new string(atk[1]) + " ";
            result[2] += new string(atk[2]) + " ";
            result[3] += new string(atk[3]) + " ";
            result[4] += new string(atk[4]) + " ";
            result[5] += new string(atk[5]) + " ";

            var health = new CardAsciiBuilder().Create().Name("Health").Health(5).Build();

            result[0] += new string(health[0]) + " ";
            result[1] += new string(health[1]) + " ";
            result[2] += new string(health[2]) + " ";
            result[3] += new string(health[3]) + " ";
            result[4] += new string(health[4]) + " ";
            result[5] += new string(health[5]) + " ";

            var spell = new CardAsciiBuilder().Create().Name("SpelPow").Spellpower(1).Build();

            result[0] += new string(spell[0]) + " ";
            result[1] += new string(spell[1]) + " ";
            result[2] += new string(spell[2]) + " ";
            result[3] += new string(spell[3]) + " ";
            result[4] += new string(spell[4]) + " ";
            result[5] += new string(spell[5]) + " ";

            var death = new CardAsciiBuilder().Create().Name("DeathR").Deathrattle(true).Build();

            result[0] += new string(death[0]) + " ";
            result[1] += new string(death[1]) + " ";
            result[2] += new string(death[2]) + " ";
            result[3] += new string(death[3]) + " ";
            result[4] += new string(death[4]) + " ";
            result[5] += new string(death[5]) + " ";

            var battle = new CardAsciiBuilder().Create().Name("BatlCry").Battlecry(true).Build();

            result[0] += new string(battle[0]) + " ";
            result[1] += new string(battle[1]) + " ";
            result[2] += new string(battle[2]) + " ";
            result[3] += new string(battle[3]) + " ";
            result[4] += new string(battle[4]) + " ";
            result[5] += new string(battle[5]) + " ";

            var insp = new CardAsciiBuilder().Create().Name("Inspir").Inspire(true).Build();

            result[0] += new string(insp[0]) + " ";
            result[1] += new string(insp[1]) + " ";
            result[2] += new string(insp[2]) + " ";
            result[3] += new string(insp[3]) + " ";
            result[4] += new string(insp[4]) + " ";
            result[5] += new string(insp[5]) + " ";

            var poison = new CardAsciiBuilder().Create().Name("Poisons").Poisonus(true).Build();

            result[06] = "   " + new string(poison[0]) + " ";
            result[07] = "   " + new string(poison[1]) + " ";
            result[08] = "   " + new string(poison[2]) + " ";
            result[09] = "   " + new string(poison[3]) + " ";
            result[10] = "   " + new string(poison[4]) + " ";
            result[11] = "   " + new string(poison[5]) + " ";

            var silence = new CardAsciiBuilder().Create().Name("Silencd").Silenced(true).Build();

            result[06] += new string(silence[0]) + " ";
            result[07] += new string(silence[1]) + " ";
            result[08] += new string(silence[2]) + " ";
            result[09] += new string(silence[3]) + " ";
            result[10] += new string(silence[4]) + " ";
            result[11] += new string(silence[5]) + " ";

            var freeze = new CardAsciiBuilder().Create().Name("Freeze").Freeze(true).Build();

            result[06] += new string(freeze[0]) + " ";
            result[07] += new string(freeze[1]) + " ";
            result[08] += new string(freeze[2]) + " ";
            result[09] += new string(freeze[3]) + " ";
            result[10] += new string(freeze[4]) + " ";
            result[11] += new string(freeze[5]) + " ";

            var charge = new CardAsciiBuilder().Create().Name("Charge").Charge(true).Build();

            result[06] += new string(charge[0]) + " ";
            result[07] += new string(charge[1]) + " ";
            result[08] += new string(charge[2]) + " ";
            result[09] += new string(charge[3]) + " ";
            result[10] += new string(charge[4]) + " ";
            result[11] += new string(charge[5]) + " ";

            var taunt = new CardAsciiBuilder().Create().Name("Taunt").Taunt(true).Build();

            result[06] += new string(taunt[0]) + " ";
            result[07] += new string(taunt[1]) + " ";
            result[08] += new string(taunt[2]) + " ";
            result[09] += new string(taunt[3]) + " ";
            result[10] += new string(taunt[4]) + " ";
            result[11] += new string(taunt[5]) + " ";

            var divine = new CardAsciiBuilder().Create().Name("DivShil").DivineShield(true).Build();

            result[06] += new string(divine[0]) + " ";
            result[07] += new string(divine[1]) + " ";
            result[08] += new string(divine[2]) + " ";
            result[09] += new string(divine[3]) + " ";
            result[10] += new string(divine[4]) + " ";
            result[11] += new string(divine[5]) + " ";

            var stealth = new CardAsciiBuilder().Create().Name("Stealth").Stealth(true).Build();

            result[06] += new string(stealth[0]) + " ";
            result[07] += new string(stealth[1]) + " ";
            result[08] += new string(stealth[2]) + " ";
            result[09] += new string(stealth[3]) + " ";
            result[10] += new string(stealth[4]) + " ";
            result[11] += new string(stealth[5]) + " ";

            var windfury = new CardAsciiBuilder().Create().Name("WiFury").Windfury(true).Build();

            result[06] += new string(windfury[0]) + " ";
            result[07] += new string(windfury[1]) + " ";
            result[08] += new string(windfury[2]) + " ";
            result[09] += new string(windfury[3]) + " ";
            result[10] += new string(windfury[4]) + " ";
            result[11] += new string(windfury[5]) + " ";

            var enraged = new CardAsciiBuilder().Create().Name("Enraged").Enrage(true).Build();

            result[06] += new string(enraged[0]) + " ";
            result[07] += new string(enraged[1]) + " ";
            result[08] += new string(enraged[2]) + " ";
            result[09] += new string(enraged[3]) + " ";
            result[10] += new string(enraged[4]) + " ";
            result[11] += new string(enraged[5]) + " ";

            var heroweap = new CardAsciiBuilder().Create().Name("WeapAtk").HeroWeaponAttackDamage(3).Build();

            result[12] = "   " + new string(heroweap[0]) + " ";
            result[13] = "   " + new string(heroweap[1]) + " ";
            result[14] = "   " + new string(heroweap[2]) + " ";
            result[15] = "   " + new string(heroweap[3]) + " ";
            result[16] = "   " + new string(heroweap[4]) + " ";
            result[17] = "   " + new string(heroweap[5]) + " ";

            var herodura = new CardAsciiBuilder().Create().Name("WeapDur").HeroWeaponDurability(3).Build();

            result[12] += new string(herodura[0]) + " ";
            result[13] += new string(herodura[1]) + " ";
            result[14] += new string(herodura[2]) + " ";
            result[15] += new string(herodura[3]) + " ";
            result[16] += new string(herodura[4]) + " ";
            result[17] += new string(herodura[5]) + " ";

            var pownotex = new CardAsciiBuilder().Create().Name("Pow!Exh").HeroPowerExhausted(false).Build();

            result[12] += new string(pownotex[0]) + " ";
            result[13] += new string(pownotex[1]) + " ";
            result[14] += new string(pownotex[2]) + " ";
            result[15] += new string(pownotex[3]) + " ";
            result[16] += new string(pownotex[4]) + " ";
            result[17] += new string(pownotex[5]) + " ";

            var powex = new CardAsciiBuilder().Create().Name("Pow!Exh").HeroPowerExhausted(true).Build();

            result[12] += new string(powex[0]) + " ";
            result[13] += new string(powex[1]) + " ";
            result[14] += new string(powex[2]) + " ";
            result[15] += new string(powex[3]) + " ";
            result[16] += new string(powex[4]) + " ";
            result[17] += new string(powex[5]) + " ";

            return(result);
        }
Exemple #3
0
        private static string CreateZone <T>(Zone <T> zone, IZone outzone, bool turn) where T : IPlayable
        {
            var zoneStr = new StringBuilder();

            string spacer = zone.Count == 10 ? new string(' ', 1) : new string(' ', 5 * (8 - zone.Count) + zone.Count + 1);

            StringBuilder[] zoneStrArray = new StringBuilder[]
            {
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
                new StringBuilder("¦" + spacer),
            };
            for (int i = 0; i < zone.Count; i++)
            {
                char[][] cardAscii = new char[6][];

                var spell  = zone[i] as Spell;
                var minion = zone[i] as Minion;
                var weapon = zone[i] as Weapon;

                if (spell != null)
                {
                    cardAscii = new CardAsciiBuilder().Create()
                                .Name(spell.Card.AbbreviatedName(7))
                                .Cost(spell.Cost)
                                .SpellText(Regex.Replace(spell.Card.Text, @"<[^>]*>", "").Replace(Environment.NewLine, ""))
                                .Type(CardType.SPELL)
                                .Build();
                }
                else if (minion != null)
                {
                    cardAscii = new CardAsciiBuilder().Create()
                                .Name(minion.Card.AbbreviatedName(7))
                                .Cost(minion.Cost)
                                .Type(minion.Card.Type)
                                .AttackDamage(minion.AttackDamage)
                                .Health(minion.Health)
                                .Spellpower(minion[GameTag.SPELLPOWER])
                                .Deathrattle(minion.HasDeathrattle)
                                .Battlecry(minion.HasBattleCry)
                                .Inspire(minion.HasInspire)
                                .Poisonus(minion[GameTag.POISONOUS] == 1)
                                .Silenced(minion.IsSilenced)
                                .Freeze(minion[GameTag.FREEZE] == 1)
                                .Charge(minion.HasCharge)
                                .Taunt(minion.HasTaunt)
                                .Stealth(minion.HasStealth)
                                .Enrage(minion.IsEnraged)
                                .Frozen(minion.IsFrozen)
                                .DivineShield(minion.HasDivineShield)
                                .Windfury(minion.HasWindfury)
                                .Exhausted(minion.IsExhausted)
                                .Build();
                }
                else if (weapon != null)
                {
                    cardAscii = new CardAsciiBuilder().Create()
                                .Name(weapon.Card.AbbreviatedName(7))
                                .Cost(weapon.Cost)
                                .Type(weapon.Card.Type)
                                .AttackDamage(weapon.AttackDamage)
                                .Durability(weapon.Durability)
                                .Deathrattle(weapon[GameTag.DEATHRATTLE] == 1)
                                .Battlecry(weapon[GameTag.BATTLECRY] == 1)
                                .Windfury(weapon[GameTag.WINDFURY] == 1)
                                .Exhausted(weapon.IsExhausted)
                                .Build();
                }

                int x = turn ? 1 : 0;
                zoneStrArray[0 + x].Append(new string(cardAscii[0]));
                zoneStrArray[1 + x].Append(new string(cardAscii[1]));
                zoneStrArray[2 + x].Append(new string(cardAscii[2]));
                zoneStrArray[3 + x].Append(new string(cardAscii[3]));
                zoneStrArray[4 + x].Append(new string(cardAscii[4]));
                zoneStrArray[turn ? 0 : 5].Append(new string(cardAscii[5]));

                if (i < zone.Count)
                {
                    zoneStrArray[0].Append(" ");
                    zoneStrArray[1].Append(" ");
                    zoneStrArray[2].Append(" ");
                    zoneStrArray[3].Append(" ");
                    zoneStrArray[4].Append(" ");
                    zoneStrArray[5].Append(" ");
                }
            }

            string[] backStrArray = new string[] { "", "", "", "", "", "" };

            char[][] zoneAscii = new CardAsciiBuilder().Create().ZoneCards(outzone.Count, outzone.Type).Build();
            int      y         = turn ? 1 : 0;

            backStrArray[0 + y]        = new string(zoneAscii[0]);
            backStrArray[1 + y]        = new string(zoneAscii[1]);
            backStrArray[2 + y]        = new string(zoneAscii[2]);
            backStrArray[3 + y]        = new string(zoneAscii[3]);
            backStrArray[4 + y]        = new string(zoneAscii[4]);
            backStrArray[turn ? 0 : 5] = new string(zoneAscii[5]);

            zoneStr.Append(zoneStrArray[0].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[0] + " ¦"));
            zoneStr.Append(zoneStrArray[1].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[1] + " ¦"));
            zoneStr.Append(zoneStrArray[2].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[2] + " ¦"));
            zoneStr.Append(zoneStrArray[3].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[3] + " ¦"));
            zoneStr.Append(zoneStrArray[4].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[4] + " ¦"));
            zoneStr.Append(zoneStrArray[5].AppendLine(spacer.Substring(1) + "¦ " + backStrArray[5] + " ¦"));
            return(zoneStr.ToString());
        }