Example #1
0
    public void MakeDamage(BaseCharacter target, float baseDamage)
    {
        if (target != null)
        {
            if (target.tag.Contains("Side") && target.tag != Side.ToString())
            {
                bool iscritical = CharInfo.IsCritical(AtkType == AttackAnimType.Weak_Atk ? true : false);
                //Set damage to the hitting character
                if (AtkType != AttackAnimType.Weak_Atk)
                {
                    CameraManagerScript.Instance.CameraShake(CameraShakeType.PowerfulAttackHit);
                }

                target.SetDamage((baseDamage) * (iscritical ? 2 : 1),
                                 Elemental, iscritical, CharInfo.ClassType == CharacterClassType.Desert && AtkType != AttackAnimType.Weak_Atk ? true : false);

                int chances = Random.Range(0, 100);
                if (chances < 100)
                {
                    foreach (ScriptableObjectAttackEffect item in BulletEffects)
                    {
                        target.Buff_DebuffCo(new Buff_DebuffClass(item.Name, item.Duration.x, item.Value.x, item.StatsToAffect, item.StatsChecker, new ElementalResistenceClass(), ElementalType.Dark, item.AnimToFire, item.Particles));
                    }
                }
            }
        }
    }
Example #2
0
    //Setup the Tile effect
    private void TargetCharacter_TileMovementCompleteEvent(BaseCharacter movingChar)
    {
        movingChar.TileMovementCompleteEvent -= TargetCharacter_TileMovementCompleteEvent;
        foreach (var Effect in Effects)
        {
            //Creation of the Buff/Debuff
            Buff_DebuffClass bdClass = new Buff_DebuffClass(Effect.Name, Effect.Duration.x, Effect.Value.x,
                                                            Effect.StatsToAffect, Effect.StatsChecker, new ElementalResistenceClass(), ElementalType.Dark, Effect.AnimToFire, Effect.Particles);

            movingChar.Buff_DebuffCo(bdClass);
        }



        //If is a Portal-In

        /*if (BattleTileT == BattleTileType.Portal && PortalInfo.Portal == PortalType.In)
         * {
         *  StartCoroutine(movingChar.UsePortal(GridManagerScript.Instance.Portals.Where(r => r.IDPortal == PortalInfo.IDPortal && r.Portal == PortalType.Out).First()));
         *  return;
         * }
         * //If is a Portal-Out
         * if (BattleTileT == BattleTileType.Portal && PortalInfo.Portal == PortalType.Out && movingChar.IsUsingAPortal)
         * {
         *  //TODO
         *  return;
         * }
         * //If is freeze tile
         * if (BattleTileT == BattleTileType.Debuff_Freeze_ForTime)
         * {
         *  float freezeDuration = Random.Range(((Vector2)this.GetType().GetField("Duration_" + BattleTileT.ToString()).GetValue(this)).x, ((Vector2)this.GetType().GetField("Duration_" + BattleTileT.ToString()).GetValue(this)).y);
         *  StartCoroutine(movingChar.Freeze(freezeDuration, 0));
         *  return;
         * }
         * //If is trap tile
         * if (BattleTileT == BattleTileType.Debuff_Trap_ForTime)
         * {
         *
         * }
         *
         *      //Get Duration from the right variables
         *      float BuffDebuffDuration = Random.Range(((Vector2)this.GetType().GetField("Duration_" + BattleTileT.ToString()).GetValue(this)).x, ((Vector2)this.GetType().GetField("Duration_" + BattleTileT.ToString()).GetValue(this)).y);
         *      //Splitting the Enum name in order to have the right info
         *      string[] res = BattleTileT.ToString().Split('_');
         *      //Getting the buff debuff value
         *      float BuffDebuffValue = res.Length == 3 ?
         *      Random.Range(((Vector2)this.GetType().GetField(BattleTileT.ToString()).GetValue(this)).x, ((Vector2)this.GetType().GetField(BattleTileT.ToString()).GetValue(this)).y) : 0;*/



        /*  if ((BuffDebuffStatsType)System.Enum.Parse(typeof(BuffDebuffStatsType), res[1]) == BuffDebuffStatsType.ElementalResistance)
         * {
         *    //deciding the type of elemental + weakness of that elemental
         *    ElementalWeaknessType ewt = bdClass.AnimToFire == CharacterAnimationStateType.Buff ? (ElementalWeaknessType)System.Convert.ToInt16(res[4]) : (ElementalWeaknessType)(-System.Convert.ToInt16(res[4]));
         *    bdClass.ElementalResistence = new ElementalResistenceClass((ElementalType)System.Enum.Parse(typeof(ElementalType), res[3]), ewt);
         * }
         * else if ((BuffDebuffStatsType)System.Enum.Parse(typeof(BuffDebuffStatsType), res[1]) == BuffDebuffStatsType.ElementalPower)
         * {
         *    //Set up the elemental type
         *    bdClass.ElementalPower = (ElementalType)System.Enum.Parse(typeof(ElementalType), res[1]);
         * }*/

        /*   if (!BattleTileT.ToString().Contains("_OverTime"))
         * {
         *     movingChar.TileMovementCompleteEvent -= TargetCharacter_TileMovementCompleteEvent;
         *     BattleTileT = BattleTileType.Base;
         *     SetupTile();
         *     isMovingEventSubscribed = false;
         * }*/
    }