예제 #1
0
        private void HandleAttack(CreatureStats attacker, CreatureStats target, Damage damagedone)
        {
            Direction directionUp;
            Direction directionDown;

            if (attacker.OwnedBy == Owner.PLAYER)
            {
                directionDown = Direction.DOWNRIGHT;
                directionUp   = Direction.UPRIGHT;
            }
            else
            {
                directionDown = Direction.DOWNLEFT;
                directionUp   = Direction.UPLEFT;
            }

            CreatureStats enemyUp   = CombatManager.GetCreatureAt(attacker.GridPosition.InDirection(directionUp));
            CreatureStats enemyDown = CombatManager.GetCreatureAt(attacker.GridPosition.InDirection(directionDown));

            if (enemyDown)
            {
                enemyDown.TakeDamage(new Source(attacker, null), new Damage((int)Mathf.Round(damagedone.Value * 0.5f), DamageType.Physical));
            }
            if (enemyUp)
            {
                enemyUp.TakeDamage(new Source(attacker, null), new Damage((int)Mathf.Round(damagedone.Value * 0.5f), DamageType.Physical));
            }
        }
예제 #2
0
    private static void Attack(CreatureStats permanent)
    {
        CreatureStats enemy  = permanent.GetAttackTarget();
        Damage        damage = new Damage(permanent.Attack, DamageType.Physical);

        enemy.TakeDamage(new Source(creature: permanent), damage);

        permanent.GetComponent <Animator>().Play("Attack");
        StateManager.RegisterAnimation(AnimationAttackDuration);

        EventManager.InvokeCreatureAttack(permanent, enemy, damage);
        EventManager.InvokeCreatureAttacked(enemy, permanent);
    }
예제 #3
0
    private void OnTurn(CreatureStats creature)
    {
        if (creature != ownerStats)
        {
            return;
        }

        DurationLeft--;
        if (DurationLeft <= 0)
        {
            ownerStats.GetComponent <EffectHolder>().RemoveEffect(this);
        }

        creature.TakeDamage(new Source(creature), new Damage(3, DamageType.True));
    }
예제 #4
0
        public void OnUseCard(Owner caster, MapPosition target)
        {
            List <MapPosition> positions = new List <MapPosition>();

            positions.Add(target);
            foreach (MapPosition position in Utils.GetAdjacent(target))
            {
                positions.Add(position);
            }

            foreach (MapPosition pos in positions)
            {
                CreatureStats creatureAt = CombatManager.GetCreatureAt(pos);
                if (creatureAt)
                {
                    creatureAt.TakeDamage(new Source(), new Damage(2, DamageType.Spell));
                }
            }
        }
예제 #5
0
        public void OnUseCard(Owner caster, MapPosition target)
        {
            CreatureStats targetToHit = null;

            int start;
            int end;
            int sign;

            if (caster == Owner.PLAYER)
            {
                start = 0;
                end   = Utils.IsLongLane(target) ? 15 : 14;
                sign  = 1;
            }
            else
            {
                start = Utils.IsLongLane(target) ? 15 : 14;
                end   = 0;
                sign  = -1;
            }


            for (int i = start; i != end; i += sign)
            {
                CreatureStats hitTest = CombatManager.GetCreatureAt(new MapPosition(i, target.y));

                if (hitTest && hitTest.OwnedBy != caster)
                {
                    targetToHit = hitTest;
                    break;
                }
            }

            if (targetToHit != null)
            {
                targetToHit.TakeDamage(new Source(null, null), new Damage(5, DamageType.Spell));
            }
        }