Example #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());
 }
Example #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());
 }
        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);
        }
Example #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;
 }
 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);
 }
        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]);
        }
Example #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;
 }
 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());
 }
Example #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);
        }
Example #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;
            }
        }
 public void TestThatCharacterHasZeroSpellPower()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("spellPower", 20);
     Assert.AreEqual(target.GetCharacterSpellPower(), 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);
 }
 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);
 }
 public void TestThatCharacterHasImageIsNull()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.IsNull(target.GetCharacterImage());
 }
 public void TestThatCharacterHasCorrectCriticalChance()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterCriticalChance(), (10 * 0.06));
 }
        public void TestThatCharacterIsDeadAfterTakingDamage()
        {
            var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");

            target.DeductCharacterHitPoints(100);
            Assert.AreEqual(target.GetDead(), true);
        }
 public void TestThatCharacterHasCorrectMagicPointsAfterDeductingZero()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("magicPoints",0);
     Assert.AreEqual(target.GetCharacterMagicPoints(), 100);
 }
        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]);
        }
 public void TestThatCharacterHasCorrectInitialDodgeChance()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterInitialDodgeChance(), (10 * 0.04));
 }
 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);
 }
 public void TestThatCharacterHasCorrectHitPointsAfterDeductingOne()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterHitPoints(1);
     Assert.AreEqual(target.GetCharacterHitPoints(), 99);
 }
 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);
 }
 public void TestThatCharacterInitializes()
 {
     var target = new Character("Bob", null,10,10,10, new Item(), "Warrior");
     Assert.IsNotNull(target);
 }
 public void TestThatCharacterHasCorrectSpellPower()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterSpellPower(), 20);
 }
 public void TestThatCharacterIsDead()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.SetDead();
     Assert.AreEqual(target.GetDead(), true);
 }
 public void TestThatCharacterHasCorrectAttackPowerAfterDeductingZero()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("attackPower", 0);
     Assert.AreEqual(target.GetCharacterAttackPower(), 20);
 }
 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);
 }
 public void TestThatCharacterHasCorrectSpellPowerAfterDeductingOverAll()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     target.DeductCharacterStat("spellPower", 21);
     Assert.AreEqual(target.GetCharacterSpellPower(), 0);
 }
 public void TestThatCharacterHasCorrectMagicPoints()
 {
     var target = new Character("Bob", null, 10, 10, 10, new Item(), "Warrior");
     Assert.AreEqual(target.GetCharacterMagicPoints(), 100);
 }
 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);
 }