示例#1
0
 public Spell(string name, int cost, int damage, string type)
 {
     this.name = name;
     this.cost = cost;
     this.damage = damage;
     this.type = type;
     this.effect = null;
     this.id = counter;
     Interlocked.Increment(ref counter);
 }
示例#2
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();
        }
示例#3
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();
        }