Exemplo n.º 1
0
    public virtual bool Attack(Character target)
    {
        Damage damage = new Damage(this, target, attack * (1 - target.defence / 100));

        Damage.AddDamage(damage);
        //target.LoseHp(attack * (1 - target.defence / 100));
        return(true);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Hit状態に移行させる
    /// </summary>
    /// <param name="damage"></param>
    public void ChangeHitState(Damage damage)
    {
        //無敵状態なら受け付けない
        if (parameter.invincibly.flag)
        {
            return;
        }

        //すでにHitStop状態なら、HitStopを重ねがけ
        if (state.name == (int)STATENAME.HitStop)
        {
            parameter.damage = damage.AddDamage(parameter.damage);
            return;
        }
        state = CreateHitStopState(damage);
    }
Exemplo n.º 3
0
    void CraftUpdate()
    {
        itemName      = material.itemName + " " + blueprint.itemName;
        _Range        = blueprint.baseRange;
        _AttackSpeed  = blueprint.baseAttackSpeed;
        _Weight       = material.weight * blueprint.weightMod;
        _DamageType   = blueprint.damageType;
        _AttackDamage = material.sharpness * blueprint.attackMod;

        Damage temp = new Damage();

        temp.AddDamage(attackDamage, damageType);

        _Damage = temp;

        icon = blueprint.icon;
    }
Exemplo n.º 4
0
    void CraftUpdate()
    {
        itemName = material.itemName + " " + blueprint.itemName;
        _Range = blueprint.baseRange;
        _AttackSpeed = blueprint.baseAttackSpeed;
        _Weight = material.weight * blueprint.weightMod;
        _DamageType = blueprint.damageType;
        _AttackDamage = material.sharpness * blueprint.attackMod;

        Damage temp = new Damage();
        temp.AddDamage(attackDamage, damageType);

        _Damage = temp;

        icon = blueprint.icon;
    }
Exemplo n.º 5
0
    public void DrawHitboxes(Frame currentFrame)
    {
        float dirX = 1;

        if (spr.flipX == true)
        {
            dirX = -1;
        }

        Collider2D[] hit      = new Collider2D[5];
        Vector2      position = transform.position;

        if (previousFrame != currentFrame && currentFrame.newHitID)
        {
            GenerateID();
        }

        for (int i = 0; i < currentFrame.hitboxes.Count; i++)
        {
            currentFrame.hitboxes[i].ID = currentID;

            Vector2 hitBoxPosition = position + new Vector2(currentFrame.hitboxes[i].position.x * dirX,
                                                            currentFrame.hitboxes[i].position.y);

            int number = Physics2D.OverlapCircleNonAlloc(hitBoxPosition, currentFrame.hitboxes[i].radius, hit, hitLayer);

            if (number > 0)
            {
                for (int j = 0; j < number; j++)
                {
                    ICanTakeDamage hitObject = (ICanTakeDamage)hit[j].GetComponentInParent(typeof(ICanTakeDamage));

                    Damage damage = currentFrame.hitboxes[i].GetDamage(spr.flipX).Clone();
                    //damage.attackType = Chr.currentAttackType;

                    damage.hitID    = currentID;
                    damage.Owner    = Chr;
                    damage.position = hitBoxPosition;

                    if (Chr.CurrentAttackBuff != null) //@@@ is null if a projectile hits. Must be changed, since projectile get a buff if an attack is performed while the projectile hits
                    {
                        damage.damageNumber += Chr.CurrentAttackBuff.damageAdd;
                        damage.damageNumber *= Chr.CurrentAttackBuff.damageMulti;
                    }

                    //damage.damageNumber *= Chr.GetCardEffect_DamageMultiplier(damage.attackType);

                    /*
                     * for (int k = 0; k < Chr.cardEffects.Count; k++)
                     * {
                     *  Chr.cardEffects[k].ModifyDamage(damage);
                     * }
                     */


                    if (Chr is Player)
                    {
                        Player player = (Player)Chr;

                        damage.AddDamage(player.soulCharge);
                    }

                    if (hitObject != null)
                    {
                        for (int l = 0; l < Chr.Buffs.Count; l++)
                        {
                            if (Chr.Buffs[l].GetType() == typeof(BuffAddDamageToAttack))
                            {
                                BuffAddDamageToAttack buff = (BuffAddDamageToAttack)Chr.Buffs[l];

                                if (damage.attackType == buff.attackType)
                                {
                                    damage.damageNumber *= (1 + buff.damagePercent);
                                }
                            }
                        }

                        if (hitObject is Character)
                        {
                            Character hitChr = (Character)hitObject;

                            damage.HitPosition = (Chr.transform.position + hitChr.transform.position) / 2f;

                            //hitChr.GetHit(damage);
                            if (ACharacterHit != null)
                            {
                                ACharacterHit(hitChr, damage);
                            }
                        }
                        else if (hitObject is Item)
                        {
                            Item hitItem = (Item)hitObject;

                            hitItem.Owner = Chr;

                            //hitItem.GetHit(damage);
                        }

                        hitObject.GetHit(damage);
                    }
                }
            }
        }

        previousFrame = currentFrame;
    }
Exemplo n.º 6
0
    /// <summary>
    /// Hit��ԂɈڍs������
    /// </summary>
    /// <param name="damage"></param>
    public void ChangeHitState(Damage damage)
    {
        //���G��ԂȂ�󂯕t���Ȃ�
        if (parameter.invincibly.flag) return;

        //���ł�HitStop��ԂȂ�AHitStop��d�˂���
        if (state.name == (int)STATENAME.HitStop)
        {
            parameter.damage = damage.AddDamage(parameter.damage);
            return;
        }
        state = CreateHitStopState(damage);
    }