예제 #1
0
파일: FightingPit.cs 프로젝트: Pavelkva/RPG
 public void nextTurn()
 {
     player.ApplyFlatDamage();
     player.GetSpellBuffs().ForEach(spellPropert => spellPropert.RemainingTime -= 1);
     player.GetSpellBuffs().RemoveAll(spellPropert => spellPropert.RemainingTime == 0);
     player.SpellBook.ForEach(spell => spell.CooldownReamingTime -= 1);
     playerController.PlayerTurn();
     enemyNpc.ApplyFlatDamage();
     enemyNpc.GetSpellBuffs().ForEach(spellPropert => spellPropert.RemainingTime -= 1);
     enemyNpc.GetSpellBuffs().RemoveAll(spellPropert => spellPropert.RemainingTime == 0);
     enemyNpc.SpellBook.ForEach(spell => spell.CooldownReamingTime -= 1);
     enemyNpc.PlayTurn(player);
     TurnNumber += 1;
 }
예제 #2
0
        static void Main(string[] args)
        {
            Player      player      = new Player("Bojovnik1", new FighterEffectManager());
            EnemyNpc    enemy       = new EnemyNpc("Bojovnik2", new FighterEffectManager());
            FightingPit fightingPit = new FightingPit(player, enemy);

            Spell ignite = new Spell("ohen", 10, 2);

            ignite.AddSpellEffectTarget(SpellEffect.FlatAtribute.hp, -2, 0, 1, SpellEffect.Modificator.intelect);
            ignite.AddSpellEffectTarget(SpellEffect.FlatAtribute.hp, -2, 5, 0.1f, SpellEffect.Modificator.intelect);
            ignite.AddSpellEffectCaster(SpellEffect.FlatAtribute.hp, -2, 0, 0, SpellEffect.Modificator.intelect);
            player.SpellBook.Add(ignite);

            Spell spellSily = new Spell("sila", 50, 2);

            spellSily.AddSpellEffectCaster(BonusAtribute.Atributes.StrengthBonus, 5, 5, 0, SpellEffect.Modificator.intelect);
            player.SpellBook.Add(spellSily);

            Weapon zbran = new Weapon("obourucak", Weapon.handle.TwoHand);

            zbran.AddAtribute(BonusAtribute.Atributes.StrengthBonus, 10);
            zbran.MaxDamage = 10;
            zbran.MinDamage = 5;
            player.AddToInventory(zbran);

            Weapon zbran2 = new Weapon("dyka", Weapon.handle.OneHand);

            zbran2.MaxDamage = 4;
            zbran2.MinDamage = 1;
            player.AddToInventory(zbran2);

            Equipment stit = new Equipment("stit", Equipment.Parts.OffHand);

            stit.AddAtribute(BonusAtribute.Atributes.ArmorBonus, 50);
            player.AddToInventory(stit);



            player.OnAttack    += ukaz;
            enemy.OnAttack     += ukaz;
            player.OnSpellCast += ukazSpell;
            enemy.OnSpellCast  += ukazSpell;


            while (true)
            {
                fightingPit.ShowFighters();
                fightingPit.nextTurn();
                foreach (SpellEffect spellProperty in player.GetSpellBuffs())
                {
                    Console.WriteLine("player:" + spellProperty);
                }
                foreach (SpellEffect spellProperty in enemy.GetSpellBuffs())
                {
                    Console.WriteLine("enemy: " + spellProperty);
                }
            }
        }