Esempio n. 1
0
        protected void Effect(int tpc = -1)
        {
            var atomTargets = new AtomCollection();

            atomTargets.AddRange(targets.Select(t => ((Atom)t)).ToList());
            Launch(atomTargets, (object)new object[] { dmg.CalculateDamage(), tpc });
        }
Esempio n. 2
0
        public void PlayerShoots(MapEntity target)
        {
            var damage = DamageCalculator.CalculateDamage(this.Player, target);

            this.HarmAlien(target, damage);
            this.OnPlayerMoved();
        }
Esempio n. 3
0
    public void TakeDamage(InstancePokemonObject enemy, MoveObject move)
    {
        int damage = DamageCalculator.CalculateDamage(enemy.Level, move.Power, enemy.Attack, Pokemon.Defense);

        Pokemon.CurrentHp -= damage;
        StartCoroutine(PauseAndTakeDamage());
    }
Esempio n. 4
0
    // Implementace interface Damageable, umožňuje bossovi dostat poškození
    public void TakeDamage(float damage, float armourPenetration)
    {
        _currentHealth -= DamageCalculator.CalculateDamage(damage, armourPenetration, _bossStats.armour);
        _healthBar.SetValue(_currentHealth / _bossStats.health);

        if (_currentHealth <= 0)
        {
            GetDestroyed();
        }
    }
Esempio n. 5
0
        public void TryToMove(MapEntity entity, int deltaX, int deltaY)
        {
            if (gameOver)
            {
                return;
            }

            var destinationX = entity.TileX + deltaX;
            var destinationY = entity.TileY + deltaY;

            if (destinationX < 0 || destinationX >= this.width || destinationY < 0 || destinationY >= this.height ||
                !this.isWalkable[destinationX, destinationY])
            {
                return;
            }

            if (this.Plasma[new Tuple <int, int>(destinationX, destinationY)] > 0)
            {
                this.PlasmaDamage(entity);
            }

            if (this.Aliens.Any(m => m.TileX == destinationX && m.TileY == destinationY))
            {
                var target = this.Aliens.Single(m => m.TileX == destinationX && m.TileY == destinationY);
                var damage = DamageCalculator.CalculateDamage(entity, target);
                this.HarmAlien(target, damage);
            }
            else if (this.Player.TileX == destinationX && this.Player.TileY == destinationY)
            {
                var damage = DamageCalculator.CalculateDamage(entity, this.Player);
                this.Player.CurrentHealth -= damage;
                this.eventBus.Broadcast(SpaceMarineEvent.ShowMessage, $"Alien hits you for {damage} damage! {(this.Player.CurrentHealth <= 0 ? "YOU DIE!" : "")}");

                if (this.Player.CurrentHealth <= 0)
                {
                    this.gameOver = true;
                }
            }
            else
            {
                // It's clear, so move.
                entity.TileX = destinationX;
                entity.TileY = destinationY;
            }

            if (entity == Player)
            {
                this.OnPlayerMoved();
            }
        }
Esempio n. 6
0
        public AttackReport Attack(Entity target)
        {
            DamageCalculator dmgCalc = new DamageCalculator(this, target);
            double           damage  = dmgCalc.CalculateDamage();

            target.CurrentHealth -= damage;

            return(new AttackReport()
            {
                DamageSource = this,
                Target = target,
                DamageDealt = damage,
                IsCriticalDamage = dmgCalc.IsCriticalDamage
            });
        }
Esempio n. 7
0
    // may need damage and death information here (particle effects, animations, etc)...

    public void TakeDamage(int damage, AttackType attack)
    {
        int damageDealt = DamageCalculator.CalculateDamage(damage, ArmorType, attack);

        DamageEffect();
        if ((_currentHealth - damageDealt) > 0)
        {
            _currentHealth      -= damageDealt;
            HealthBar.fillAmount = _currentHealth / (float)Health;
        }
        else
        {
            _currentHealth       = 0;
            HealthBar.fillAmount = 0;
            Death();
            this.gameObject.SetActive(false);
        }
    }
Esempio n. 8
0
    // Metoda implementovaná interfacem Damageable, dovoluje nepřáteli obdržet poškození
    public void TakeDamage(float damage, float armourPenetration)
    {
        _currentHealth       -= DamageCalculator.CalculateDamage(damage, armourPenetration, _stats.armour);
        _healthBar.fillAmount = _currentHealth / _stats.health;

        if (!_seenTarget)
        {
            _seenTarget = true;
            GetComponent <EnemyFSM>().ChangeState(EnemyStateType.FollowTarget);
        }

        if (_currentHealth <= 0)
        {
            _healthBarCanvas.enabled = false;
            GetDestroyed();
        }
        else
        {
            _healthBarCanvas.enabled = true;
        }
    }
Esempio n. 9
0
    // Metoda je volána, když hráč má obdržet poškození
    public void TakeDamage(float damageTaken, float armourPenetration)
    {
        if (_currentHealth <= 0)
        {
            return;
        }

        if (_rolling)
        {
            if (_rollInvincibilityTiming.x <= _rollTimer && _rollTimer <= _rollInvincibilityTiming.y)
            {
                return;
            }
        }

        _currentHealth -= DamageCalculator.CalculateDamage(damageTaken, armourPenetration, _currentStats.Armour);
        _healthBar.SetValue(_currentHealth / _currentStats.Health);

        if (_currentHealth <= 0)
        {
            _inventory.ShowDeathScreen();
        }
    }
Esempio n. 10
0
        public void with_90_armor_takes_10_percent_damage()
        {
            //ARRANGE
            ICharacter     character = Substitute.For <ICharacter>(); //new ICharacter();
            Inventory_test inventory = new Inventory_test(character);
            InvItem        pants     = new InvItem()
            {
                EquipSlot = EquipSlots.Legs, Armor = 40
            };
            InvItem shild = new InvItem()
            {
                EquipSlot = EquipSlots.RightHand, Armor = 50
            };

            inventory.EquipItem(pants);
            inventory.EquipItem(shild);
            character.Inventory.Returns(inventory);

            //ACT
            int claculatedDamage = DamageCalculator.CalculateDamage(1000, character);

            //ASSERT
            Assert.AreEqual(100, claculatedDamage);
        }
Esempio n. 11
0
 public override float GetDamage(Element other)
 {
     return(DamageCalculator.CalculateDamage(BaseDamage, Element, other));
 }
Esempio n. 12
0
        public void calculates_2_damage_from_10_with_80_precent()
        {
            int finalDamage = DamageCalculator.CalculateDamage(10, 0.8f);

            Assert.AreEqual(2, finalDamage);
        }
Esempio n. 13
0
        public void sets_damage_to_half_with_50_precent()
        {
            int finalDamage = DamageCalculator.CalculateDamage(10, 0.5f);

            Assert.AreEqual(5, finalDamage);
        }