Пример #1
0
        //Constructor
        public Character(string name, int str, int dex, int con, int intel, int wis, Weapon weapon, Armor armor)
        {
            this.name = name;
            this.str = str;
            this.dex = dex;
            this.con = con;
            this.intel = intel;
            this.wis = wis;

            XPValue = Convert.ToInt32((double)level * XPVALUEMULTIPLIER);

            this.maxHP = (int)((double)con * hpMultiplier);
            this.maxMP = (int)((double)intel * mpMultiplier);
            this.manaGen = (int)((double)wis * manaGenMultiplier);
            this.weapon = weapon;
            this.armor = armor;
            this.HP = maxHP;
            this.MP = maxMP;

            //setting attack values on construction
            //this.physDamage = (int)(this.weapon.getPhysicalDamage() + this.str);
            setAttack();

            //setting resists on construction
            //this.physResist = (int)(this.armor.getPhysicalResist() + this.str);
            //this.magResist = (int)(this.armor.getMagicResist() + this.wis);
            setResist();
        }
Пример #2
0
        public CharacterClass(string name, int str, int dex, int con, int intel, int wis)
        {
            Armor WoodenShield = new Armor("Wooden Sheild", 10, "Normal", 10, "Fire");
            Weapon RustySword = new Weapon("Rusty Sword", 30, "Normal", 40, "Fire");

            this.name = name;
            this.str = str;
            this.dex = dex;
            this.con = con;
            this.intel = intel;
            this.wis = wis;

            this.maxHP = (int)((double)con * hpMultiplier);
            this.maxMP = (int)((double)intel * mpMultiplier);
            this.manaGen = (int)((double)wis * manaGenMultiplier);
            this.weapon = RustySword;
            this.armor = WoodenShield;
            this.HP = maxHP;
            this.MP = maxMP;

            //setting attack values on construction
            this.physDamage = (int)(this.weapon.getPhysicalDamage() + this.str);

            //setting resists on construction
            this.physResist = (int)(this.armor.getPhysicalResist() + (this.str/2));
            this.magResist = (int)(this.armor.getMagicResist() + this.wis);
        }
Пример #3
0
        //Default Constructor (Build a character)
        public Character(CharacterClass charClass)
        {
            Console.Clear();
            Console.WriteLine("Welcome to the Character Builder!");
            Console.Write("    Please Select a name: ");
            this.name = Console.ReadLine();
            //Console.ReadLine(); //Wait
            Console.Clear();

            str = charClass.str;
            dex = charClass.dex;
            con = charClass.con;
            intel = charClass.intel;
            wis = charClass.wis;

            XPValue = Convert.ToInt32((double)level * XPVALUEMULTIPLIER);

            this.maxHP = (int)((double)con * hpMultiplier);
            this.maxMP = (int)((double)intel * mpMultiplier);
            this.manaGen = (int)((double)wis * manaGenMultiplier);
            weapon = new Weapon("Rusty Sword", 20, "Normal", 0, "None");
            armor = new Armor("Wooden Sheild", 10, "Normal", 0, "None");
            this.HP = maxHP;
            this.MP = maxMP;

            //setting attack values on construction
            //this.physDamage = (int)(this.weapon.getPhysicalDamage() + this.str);
            setAttack();

            //setting resists on construction
            //this.physResist = (int)(this.armor.getPhysicalResist() + this.str);
            //this.magResist = (int)(this.armor.getMagicResist() + this.wis);
            setResist();
        }
Пример #4
0
        public void testAttack()
        {
            Armor WoodenSheild = new Armor("Wooden Sheild", 10, "Normal", 10, "Fire");
            Weapon RustySword = new Weapon("Rusty Sword", 30, "Normal", 40, "Fire");

            Character Joe = new Character("Joe", 100, 20, 2.0, 2.0, 1.0, RustySword, WoodenSheild);
            Character Bob = new Character("Bob", 100, 20, 1.0, 2.0, 1.0, RustySword, WoodenSheild);
            Bob.Attack(Joe);

            Assert.AreEqual(40, Joe.getHP());
        }
Пример #5
0
        //Constructor
        public Character(string name, int maxHP, int maxMP, double toughness, double strength, double manaGen, Weapon weapon, Armor armor)
        {
            this.name = name;
            this.maxHP = maxHP;
            this.maxMP = maxMP;
            this.toughness = toughness;
            this.strength = strength;
            this.manaGen = manaGen;
            this.weapon = weapon;
            this.armor = armor;
            this.HP = maxHP;
            this.MP = maxMP;

            //setting attack values on construction
            this.physDamage = (int)(this.weapon.getPhysicalDamage() * this.strength);
            this.magDamage = (int)(this.weapon.getMagicDamage() * this.strength);

            //setting resists on construction
            this.physResist = (int)(this.armor.getPhysicalResist() * this.toughness);
            this.magResist = (int)(this.armor.getMagicResist() * this.toughness);
        }
Пример #6
0
        static void Main(string[] args)
        {
            //Build and create a 3d board
            //Application.Run(new Board());

            Armor WoodenShield = new Armor ("Wooden Sheild", 10, "Normal", 10, "Fire");
            Weapon RustySword = new Weapon ("Rusty Sword", 30, "Normal", 40, "Fire");

            Weapon BetterSword = new Weapon("Better Sword", 50, "Normal", 60, "Electric");
            Armor BetterArmor = new Armor("Better Armor", 50, "Normal", 20, "Electric");

            SpellEffect poison = new SpellEffect("Poison", "Normal", 2, 3);

            Spell NewSpell = new Spell("testSpell", 5, 20, "Fire", poison);
            Spell NextSpell = new Spell("nextSpell", 2, 5, "Fire");

            Character Joe = new Character("Joe", 5, 5, 5, 5, 5, RustySword, WoodenShield);
            Character Bob = new Character ("Bob", 10, 10, 5, 2, 2, RustySword, WoodenShield);

            Bob.LevelCharacter(3);

            Console.WriteLine(Bob.getWeapon().getName());
            Bob.changeWeapon(BetterSword);
            Console.WriteLine(Bob.getWeapon().getName());
            Bob.changeWeapon(RustySword);

            Console.WriteLine(Joe.getHP());
            //Joe.hurt(Bob);
            Console.WriteLine(Joe.getHP());
            Joe.heal(100F);
            Console.WriteLine(Joe.getHP());

            //change weapon test
            Bob.changeWeapon(BetterSword);
            Bob.Attack(Joe);
            Console.WriteLine(Joe.getHP());
            Joe.heal(100F);
            Console.WriteLine(Joe.getHP());

            Joe.changeArmor(BetterArmor);
            Bob.Attack(Joe);
            Console.WriteLine(Joe.getHP());
            Joe.heal(100F);
            Console.WriteLine(Joe.getHP());

            //string path = serializer(Joe);
            //Character Joe2 = deserializer(path);

            Joe.LearnSpell(NewSpell);
            Joe.LearnSpell(NewSpell);

            Joe.CastSpell(Bob);

            List<SpellEffect> effectList = new List<SpellEffect>();
            effectList = SpellEffect.ImportEffects("../../ImportFiles/effect-list.csv", effectList);

            List<Spell> spellList = new List<Spell>();
            spellList = Spell.ImportSpells("../../ImportFiles/spell-list.csv", spellList, effectList);

            foreach (Spell spell in spellList)
            {
                Console.WriteLine(spell.getName());
            }

            //StartMenu game = new StartMenu();
            StartMenu menu = new StartMenu();

            menu.startMenu();

            //Wait
            Console.ReadKey();
        }
Пример #7
0
        public void changeArmor(Armor newArmor)
        {
            //setting the character's new armor
            this.armor = newArmor;

            //setting the new resists
            this.physResist = (int)(this.armor.getPhysicalResist() * this.toughness);
            this.magResist = (int)(this.armor.getMagicResist() * this.toughness);
        }
Пример #8
0
        public void changeArmor(Armor newArmor)
        {
            //setting the character's new armor
            this.armor = newArmor;

            //setting the new resists
            //this.physResist = (int)(this.armor.getPhysicalResist() + this.str);
            //this.magResist = (int)(this.armor.getMagicResist() * this.wis);
            setResist();
        }
Пример #9
0
        static void Main(string[] args)
        {
            Armor WoodenSheild = new Armor ("Wooden Sheild", 10, "Normal", 10, "Fire");
            Weapon RustySword = new Weapon ("Rusty Sword", 30, "Normal", 40, "Fire");

            Weapon BetterSword = new Weapon("Better Sword", 50, "Normal", 60, "Electric");
            Armor BetterArmor = new Armor("Better Armor", 50, "Normal", 20, "Electric");

            SpellEffect poison = new SpellEffect("Poison", "Normal", 2, 3);

            Spell NewSpell = new Spell("testSpell", 5, 20, "Fire", poison);
            Spell NextSpell = new Spell("nextSpell", 2, 5, "Fire");

            Character Joe = new Character ("Joe", 100, 20, 2.0, 2.0, 1.0, RustySword, WoodenSheild);
            Character Bob = new Character ("Bob", 100, 20, 1.0, 2.0, 1.0, RustySword, WoodenSheild);

            Console.WriteLine(Bob.getWeapon().getName());
            Bob.changeWeapon(BetterSword);
            Console.WriteLine(Bob.getWeapon().getName());
            Bob.changeWeapon(RustySword);

            Console.WriteLine(Joe.getHP());
            Joe.hurt(Bob);
            Console.WriteLine(Joe.getHP());
            Joe.heal(100F);
            Console.WriteLine(Joe.getHP());

            //change weapon test
            Bob.changeWeapon(BetterSword);
            Bob.Attack(Joe);
            Console.WriteLine(Joe.getHP());
            Joe.heal(100F);
            Console.WriteLine(Joe.getHP());

            Joe.changeArmor(BetterArmor);
            Bob.Attack(Joe);
            Console.WriteLine(Joe.getHP());
            Joe.heal(100F);
            Console.WriteLine(Joe.getHP());

            string path = serializer(Joe);
            Character Joe2 = deserializer(path);

            Joe.LearnSpell(NewSpell);
            Joe.LearnSpell(NewSpell);

            List<SpellEffect> effectList = new List<SpellEffect>();
            effectList = SpellEffect.ImportEffects("../../ImportFiles/effect-list.csv", effectList);

            List<Spell> spellList = new List<Spell>();
            spellList = Spell.ImportSpells("../../ImportFiles/spell-list.csv", spellList, effectList);

            foreach (Spell spell in spellList)
            {

                Console.WriteLine(spell.getName());
            }
            Console.WriteLine(Environment.CurrentDirectory);

            PlayGame game = new PlayGame();

            //Wait
            Console.ReadKey();
        }