예제 #1
0
파일: Game.cs 프로젝트: jirkaceska/C_sharp
        public void FightWith(Command command)
        {
            ((Player.PlayerStrategy)player.Strategy).SetWeapon(command);
            Weapon playerWeapon   = player.SelectWeapon();
            Weapon creatureWeapon = creature.SelectWeapon();

            int result = CompareWeapon(playerWeapon, creatureWeapon);

            switch (result)
            {
            case 1:
                creature.TakeDamage(player.GetDamage(playerWeapon));
                Console.WriteLine("YOU HAVE WON.");
                Console.WriteLine("Creature have {0}/{1} HP", creature.Hitpoints, creature.MaxHP);
                break;

            case 0:
                Console.WriteLine("DRAW.");
                break;

            case -1:
                player.TakeDamage(creature.GetDamage(creatureWeapon));
                Console.WriteLine("YOU HAVE LOST.");
                Console.WriteLine("You have {0}/{1} HP", player.Hitpoints, player.MaxHP);

                break;
            }

            IsInFight = !EvaluateFight();
        }
예제 #2
0
        public void Attack(IFighter another)
        {
            int critModifier = GetCritModifier();

            attackPoints += (int)((critModifier / 100.0) * attackPoints);
            Console.WriteLine($"{Team}->{Name} attacks for {attackPoints} with critModifier {critModifier}");
            another.TakeDamage(attackPoints);
        }
예제 #3
0
        public async Task CodeGenVoidParametersTask()
        {
            int messageCount = Messages;

            for (var i = 0; i < messageCount; i++)
            {
                await _codegenProxy.TakeDamage(10);
            }
        }
예제 #4
0
        public async Task NativeVoidParametersTask()
        {
            int messageCount = Messages;

            for (var i = 0; i < messageCount; i++)
            {
                await _staticProxy.TakeDamage(10);
            }
        }
예제 #5
0
파일: RangeUnit.cs 프로젝트: Domm8/SmallRpg
 private void RangeAttack(IFighter target)
 {
     target.TakeDamage(Damage, this, "bow");
 }
예제 #6
0
 public ValueTask Invoke() => _target.TakeDamage(_value);