Пример #1
0
 public void TestThatEffectApplyEffectIsAppliedToDodge()
 {
     Character bob = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     var target = new Effect("dodge", 1, 1.0, true, bob);
     target.ApplyEffect();
     Assert.AreEqual(target.GetCharacter().GetCharacterDodgeChance(), bob.GetCharacterDodgeChance());
 }
Пример #2
0
 public void TestThatEffectApplyEffectIsAppliedToHealth()
 {
     Character bob = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     var target = new Effect("health", 1, 1.0, true, bob);
     target.ApplyEffect();
     Assert.AreEqual(target.GetCharacter().GetCharacterHitPoints(), bob.GetCharacterHitPoints());
 }
Пример #3
0
        public void TestThatAllBobsDiesAtEndOfTurnTeam02()
        {
            Character[] tf2Blue = new Character[6];
            for (int i = 0; i < 6; i++)
            {
                tf2Blue[i] = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
            }

            Character[] tf2Red = new Character[6];
            for (int i = 0; i < 6; i++)
            {
                tf2Red[i] = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
            }
            var target = new GameBoard(null, tf2Blue, tf2Red, null, null);

            for (int i = 0; i < 6; i++)
            {
                Effect effThat = new Effect("health", 1, 100.0, true, target.getSecondTeamCharacters()[i]);
                target.addEffect(effThat);
            }

            target.turn();
            Assert.AreEqual(target.getSecondTeamCharacters()[0].GetDead(), true);
            Assert.AreEqual(target.getSecondTeamCharacters()[1].GetDead(), true);
            Assert.AreEqual(target.getSecondTeamCharacters()[2].GetDead(), true);
            Assert.AreEqual(target.getSecondTeamCharacters()[3].GetDead(), true);
            Assert.AreEqual(target.getSecondTeamCharacters()[4].GetDead(), true);
            Assert.AreEqual(target.getSecondTeamCharacters()[5].GetDead(), true);
        }
Пример #4
0
 //returns the third ability
 private void setFourthAbility()
 {
     Character bob = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Effect blah = new Effect("health", 1, 1.0, true, bob);
     CharAbility blahAb = new CharAbility("Blah", blah, "attack", 1, bob);
     characterAbilities[3] = blahAb;
 }
Пример #5
0
 public void TestThatCharAbilityHasCorrectEffect()
 {
     Character bob = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Effect blah = new Effect("blah", 1, 0.0, true, bob);
     var target = new CharAbility("Fire", blah, "spell",1, bob);
     Assert.AreEqual(target.getAbilityEffect(), blah);
 }
Пример #6
0
        public void TestThatCharacterHasCorrectAttributeAgilityAtNine()
        {
            int[] attributes = new int[3] { 5, 5, 9 };

            var target = new Character("Bob", null, 5, 5, 9, new Item(), "Warrior");
            int[] targetAttribute = target.GetCharacterAttributes();
            Assert.AreEqual(targetAttribute[2], attributes[2]);
        }
Пример #7
0
 //creates an effect
 public Effect(String attr, int duration, double mag, bool reset, Character target)
 {
     attribute = attr;
     turnDuration = duration;
     magnitude = mag;
     doesReset = reset;
     targetChar = target;
 }
Пример #8
0
 public void TestThatCharClassHasAThirdAbility()
 {
     var target = new CharClass("Warrior", null);
     Character bob = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Effect blah = new Effect("health", 1, 1.0, true, bob);
     CharAbility[] targ2 = target.getCharacterAbilities();
     CharAbility blahAb = new CharAbility("Blah", blah, "attack", 1, bob);
     Assert.AreEqual(targ2[2].getAbilityName(), blahAb.getAbilityName());
 }
Пример #9
0
        public GameUI()
        {
            InitializeComponent();
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("de");

            Character bob = new Character("Bob", null, 10, 10, 10, null, "Wizard");
            bob.SetFirstAbilityForCharacter(new CharAbility("It Has Begun",new Effect("health", 1, 10, false, null),"attack",10,null));
            bob.SetSecondAbilityForCharacter(new CharAbility("Devour Soul", new Effect("attackPower", 1, 10, false, null), "attack", 10, null));
            bob.SetThirdAbilityForCharacter(new CharAbility("Enrage", new Effect("dodge", 1, 1, false, null), "spell", 10, null));
            bob.SetFourthAbilityForCharacter(new CharAbility("Time Branch", new Effect("crit",1,1,false,null), "spell", 100, null));

            Character george = new Character("George", null, 1, 1, 10, null, "Warrior");
            george.SetFirstAbilityForCharacter(new CharAbility("Let's Do This!", new Effect("health", 1, 40, false, null), "attack", 1, null));
            george.SetSecondAbilityForCharacter(new CharAbility("Poke", new Effect("health", 1, 1, false, null), "attack", 1, null));
            george.SetThirdAbilityForCharacter(new CharAbility("Prod", new Effect("health", 1, 2, false, null), "attack", 2, null));
            george.SetFourthAbilityForCharacter(new CharAbility("Glitter Strike", new Effect("spellPower", 1, 10, false, null), "spell", 10, null));

            String[] names = {"Red", "Blue"};
            Character[] team1 = {bob, null, null, null, null, null};
            Character[] team2 = {george, null, null, null, null, null};
            board = new GameBoard(names , team1, team2, null, null);

            Player1Health.Value = team1[0].GetCharacterHitPoints();
            PlayerHealth2.Value = team2[0].GetCharacterHitPoints();
            if (board.getTurn())
            {
                CurrentTeam.Text = names[0];
                CurrentCharacterName.Text = team1[0].GetCharacterName();

                attack1.Text = board.getFirstTeamCharacters()[0].GetCharacterAbilities()[0].getAbilityName();
                attack2.Text = board.getFirstTeamCharacters()[0].GetCharacterAbilities()[1].getAbilityName();
                attack3.Text = board.getFirstTeamCharacters()[0].GetCharacterAbilities()[2].getAbilityName();
                attack4.Text = board.getFirstTeamCharacters()[0].GetCharacterAbilities()[3].getAbilityName();
            }
            else
            {
                CurrentTeam.Text = names[1];
                CurrentCharacterName.Text = team2[0].GetCharacterName();

                attack1.Text = board.getSecondTeamCharacters()[0].GetCharacterAbilities()[0].getAbilityName();
                attack2.Text = board.getSecondTeamCharacters()[0].GetCharacterAbilities()[1].getAbilityName();
                attack3.Text = board.getSecondTeamCharacters()[0].GetCharacterAbilities()[2].getAbilityName();
                attack4.Text = board.getSecondTeamCharacters()[0].GetCharacterAbilities()[3].getAbilityName();
            }

            georgeImg.Image = Image.FromFile("C:/Documents and Settings/heidtbkd/TacCom/Source/TacCom/WindowsFormsApplication1/textures/characters/george/George_The_Fancy_Man.png");
            bobImg.Image = Image.FromFile("C:/Documents and Settings/heidtbkd/TacCom/Source/TacCom/WindowsFormsApplication1/textures/characters/bob/bob.png");

            Size imgSize = new Size();
            imgSize.Width = 400;
            imgSize.Height = 400;

            georgeImg.Image = resizeImage(georgeImg.Image, imgSize);
            bobImg.Image = resizeImage(bobImg.Image, imgSize);
        }
Пример #10
0
        public CharAbility(String ability, Effect effect, String modif, int cost, Character targ)
        {
            abilityName = ability;
            abilityEffects = effect;
            target = targ;
            modifier = modif;

            if (cost < 1)
            {
                mpCost = 1;
            }
            else if (cost > 100)
            {
                mpCost = 100;
            }
            else
            {
                mpCost = cost;
            }
        }
Пример #11
0
 public void TestThatCharacterHasZeroSpellPower()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("spellPower", 20);
     Assert.AreEqual(target.GetCharacterSpellPower(), 0);
 }
Пример #12
0
 public void TestThatCharacterHasZeroDodgeChance()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("dodgeChance", 10 * .04);
     Assert.AreEqual(target.GetCharacterDodgeChance(), 0);
 }
Пример #13
0
 public void TestThatCharacterHasZeroCritChance()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("critChance", 10 * .06);
     Assert.AreEqual(target.GetCharacterCriticalChance(), 0.0);
 }
Пример #14
0
 public void TestThatCharacterHasImageIsNull()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.IsNull(target.GetCharacterImage());
 }
Пример #15
0
 public void TestThatCharacterHasCorrectCriticalChance()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterCriticalChance(), (10 * 0.06));
 }
Пример #16
0
        public void TestThatCharacterIsDeadAfterTakingDamage()
        {
            var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");

            target.DeductCharacterHitPoints(100);
            Assert.AreEqual(target.GetDead(), true);
        }
Пример #17
0
 public void TestThatCharacterHasCorrectMagicPointsAfterDeductingZero()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("magicPoints",0);
     Assert.AreEqual(target.GetCharacterMagicPoints(), 100);
 }
Пример #18
0
        public void TestThatCharacterHasCorrectInitialAttributeStrength()
        {
            int[] attributes = new int[3] { 10, 10, 10 };

            var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
            int[] targetAttribute = target.GetCharacterInitialAttributes();
            Assert.AreEqual(targetAttribute[0], attributes[0]);
        }
Пример #19
0
 public void TestThatCharacterHasCorrectInitialDodgeChance()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterInitialDodgeChance(), (10 * 0.04));
 }
Пример #20
0
 public void TestThatCharacterHasCorrectInitialAttributeArray()
 {
     int[] attributes = new int[3] { 10, 10, 10 };
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterInitialAttributes(), attributes);
 }
Пример #21
0
 public void TestThatCharacterHasCorrectHitPointsAfterDeductingOne()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterHitPoints(1);
     Assert.AreEqual(target.GetCharacterHitPoints(), 99);
 }
Пример #22
0
 public void TestThatCharacterHasCorrectDodgeChanceAfterDeductingOverAll()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("dodgeChance", 11 * .04);
     Assert.AreEqual(target.GetCharacterDodgeChance(), 0);
 }
Пример #23
0
 public void TestThatCharacterInitializes()
 {
     var target = new Character("Bob", null,10,10,10, new Item(), "Warrior");
     Assert.IsNotNull(target);
 }
Пример #24
0
 public void TestThatCharacterHasCorrectSpellPower()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterSpellPower(), 20);
 }
Пример #25
0
 public void TestThatCharacterIsDead()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.SetDead();
     Assert.AreEqual(target.GetDead(), true);
 }
Пример #26
0
 public void TestThatCharacterHasCorrectAttackPowerAfterDeductingZero()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("attackPower", 0);
     Assert.AreEqual(target.GetCharacterAttackPower(), 20);
 }
Пример #27
0
 public void TestThatSetAbility4SetsTheAbilityListCorrectly()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     CharAbility ca = new CharAbility("Hit", new Effect("health", 1, 10, false, null), "attack", 10, null);
     target.SetFourthAbilityForCharacter(ca);
     Assert.AreEqual(target.GetCharacterAbilities()[3], ca);
 }
Пример #28
0
 public void TestThatCharacterHasCorrectSpellPowerAfterDeductingOverAll()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("spellPower", 21);
     Assert.AreEqual(target.GetCharacterSpellPower(), 0);
 }
Пример #29
0
 public void TestThatCharacterHasCorrectMagicPoints()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterMagicPoints(), 100);
 }
Пример #30
0
 public void TestThatCharacterHasCorrectCritChangeAfterDeductingOverAll()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("critChance", 11 * .06);
     Assert.AreEqual(target.GetCharacterCriticalChance(), 0.0);
 }