예제 #1
0
 public static bool isTargetPlayer(Skill.TargetType targetType, bool isPlayerSide)
 {
     if (targetType == Skill.TargetType.ENEMY)        // 타겟팅 타입이 적일때.
     {
         if (isPlayerSide)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     else         // 타겟팅 타입이 우리편일때.
     {
         if (isPlayerSide)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #2
0
    public static Monster getAutomaticTarget(Monster attacker, Skill.TargetType targetingType, Xint[] subTargingType, BaseSkillData.CheckTargetingType targetingTypeChecker = null)
    {
        if (subTargingType[0] == TargetingData.AUTOMATIC_CLOSE_TARGET_1)        // 히어로와 가장 가까운 타겟.
        {
            if (targetingType == Skill.TargetType.ENEMY)
            {
                return(GameManager.me.characterManager.getCloseEnemyTarget(attacker.isPlayerSide, attacker, targetingTypeChecker, (subTargingType[1] == 0)));
            }
            else
            {
                return(GameManager.me.characterManager.getCloseTeamTarget(attacker.isPlayerSide, attacker, targetingTypeChecker, (subTargingType[1] == 0)));
            }
        }
        else if (subTargingType[0] == TargetingData.AUTOMATIC_LOWEST_HP_TARGET_2)        // 가장 에너지가 적은 녀석.
        {
            if (targetingType == Skill.TargetType.ENEMY)
            {
                return(GameManager.me.characterManager.getLowestHPEnemyTarget(attacker.isPlayerSide, targetingTypeChecker, (subTargingType[1] == 0)));
            }
            else
            {
                return(GameManager.me.characterManager.getLowestHPTeamTarget(attacker.isPlayerSide, attacker, targetingTypeChecker, (subTargingType[1] == 0)));
            }
        }

        return(null);
    }
예제 #3
0
 public SkillData(SkillData other)
 {
     uniqueName           = other.uniqueName;
     targetType           = other.targetType;
     reach                = new Attribute(other.reach);
     reachAngle           = new Attribute(other.reachAngle);
     cooldown             = new Attribute(other.cooldown);
     castTime             = new Attribute(other.castTime);
     totalCastTime        = new Attribute(other.totalCastTime);
     earlyBreakTime       = new Attribute(other.earlyBreakTime);
     naturalSpeedModifier = other.naturalSpeedModifier;
     skillType            = other.skillType;
     attackData           = new AttackData(other.attackData);
     comboId              = new ComboID(other.comboId);
     blockRotation        = other.blockRotation;
     graphics             = other.graphics;
 }
    //Futuramente dar uma olhada na complexidade
    public Battler[][] BuildPossibleTargets(Battler source, Skill.TargetType targetType)
    {
        if (IsAlly(source))
        {
            switch (targetType)
            {
            case Skill.TargetType.Any:
                return(new List <Battler>(Party).Concat(Enemies).Where(b => !b.Fainted).Select(b => new [] { b }).ToArray());

            case Skill.TargetType.OneEnemy:
                return(Enemies.Cast <Battler>().Where(e => !e.Fainted).Select(b => new [] { b }).ToArray());

            case Skill.TargetType.OneAlly:
                return(Party.Cast <Battler>().Where(p => !p.Fainted).Select(p => new [] { p }).ToArray());

            case Skill.TargetType.AllEnemies:
                return(new[] { Enemies.Cast <Battler>().Where(e => !e.Fainted).ToArray() });

            case Skill.TargetType.AllAllies:
                return(new[] { Party.Cast <Battler>().Where(p => !p.Fainted).ToArray() });

            case Skill.TargetType.All:
                return(new[] { new List <Battler>(Party).Concat(Enemies).Where(b => !b.Fainted).ToArray() });

            case Skill.TargetType.Self:
                return(new[] { new[] { source } });

            default:
                throw new ArgumentOutOfRangeException(nameof(targetType), targetType, null);
            }
        }
        else if (IsEnemy(source))
        {
            switch (targetType)
            {
            case Skill.TargetType.Any:
                return(new List <Battler>(Party).Concat(Enemies).Where(b => !b.Fainted).Select(b => new [] { b }).ToArray());

            case Skill.TargetType.OneEnemy:
                return(Party.Cast <Battler>().Where(e => !e.Fainted).Select(p => new [] { p }).ToArray());

            case Skill.TargetType.OneAlly:
                return(Enemies.Cast <Battler>().Where(p => !p.Fainted).Select(e => new [] { e }).ToArray());

            case Skill.TargetType.AllEnemies:
                return(new[] { Party.Cast <Battler>().Where(p => !p.Fainted).ToArray() });

            case Skill.TargetType.AllAllies:
                return(new[] { Enemies.Cast <Battler>().Where(e => !e.Fainted).ToArray() });

            case Skill.TargetType.All:
                return(new[] { new List <Battler>(Party).Concat(Enemies).Where(b => !b.Fainted).ToArray() });

            case Skill.TargetType.Self:
                return(new[] { new[] { source } });

            default:
                throw new ArgumentOutOfRangeException(nameof(targetType), targetType, null);
            }
        }
        else
        {
            return(null);
        }
    }
    public virtual void setData(List <object> l, Dictionary <string, int> k)
    {
        id   = (string)l[k["ID"]];
        name = (string)l[k["NAME"]];
        Util.parseObject(l[k["LEVEL"]], out baseLevel, true, 0);

        switch ((string)l[k["SKILLTYPE"]])
        {
        case "ATTACK":
            skillType       = Skill.Type.ATTACK;
            targetType      = Skill.TargetType.ENEMY;
            checkMissChance = true;
            break;

        case "DEBUFF":
            skillType       = Skill.Type.DEBUFF;
            targetType      = Skill.TargetType.ENEMY;
            checkMissChance = true;
            break;

        case "BUFF":
            skillType       = Skill.Type.BUFF;
            targetType      = Skill.TargetType.ME;
            checkMissChance = false;
            break;

        case "HEAL":
            skillType       = Skill.Type.HEAL;
            targetType      = Skill.TargetType.ME;
            checkMissChance = false;
            break;
        }

        _ti.Clear();
        _tiV.Clear();
        parseSuccessChance(l[k["SUCCESS_CHANCE_1"]]);
        parseSuccessChance(l[k["SUCCESS_CHANCE_2"]]);
        parseSuccessChance(l[k["SUCCESS_CHANCE_3"]]);
        parseSuccessChance(l[k["SUCCESS_CHANCE_4"]]);
        parseSuccessChance(l[k["SUCCESS_CHANCE_5"]]);

        int len = _ti.Count;

        successChance    = new int[len][];
        successValueType = new GameValueType.Type[len];

        for (int i = 0; i < len; ++i)
        {
            successChance[i]    = _ti[i];
            successValueType[i] = _tiV[i];
        }

        _ti.Clear();
        _tiV.Clear();

        _temp = null;


        Util.parseObject(l[k["EXE_TYPE"]], out exeType, true, 0);

        exeData = AttackData.getAttackData(exeType, l[k["E_ATTR1"]], l[k["E_ATTR2"]], l[k["E_ATTR3"]], l[k["E_ATTR4"]], l[k["E_ATTR5"]], l[k["E_ATTR6"]], l[k["E_ATTR7"]]);

        Util.parseObject(l[k["TARGETING_TYPE"]], out targeting, true, 0);

        targetAttr = null;

        setTargetingChecker(l, k);

        skillEffects = new SkillEffectData[hasSkillEffect(l[k["EFFECT_1"]], l[k["EFFECT_2"]], l[k["EFFECT_3"]], l[k["EFFECT_4"]], l[k["EFFECT_5"]])];

        totalEffectNum = skillEffects.Length;

#if UNITY_EDITOR
        if (successChance.Length < totalEffectNum)
        {
            Debug.LogError(id + "  successChance error ");
        }

        if (successValueType.Length < totalEffectNum)
        {
            Debug.LogError(id + "  successValueType error ");
        }
#endif


        for (int i = 0; i < totalEffectNum; ++i)
        {
            int startDelay = -1;

            switch (i)
            {
            case 0:
                skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_1"]]), l[k["E1_ATTR1"]], l[k["E1_ATTR2"]]);

                if (k.ContainsKey("E1_DEALY"))
                {
                    Util.parseObject(l[k["E1_DEALY"]], out startDelay, -1);
                    if (startDelay > 0)
                    {
                        skillEffects[i].startDelay = ((float)startDelay * 0.001f);
                    }
                }

                break;

            case 1:
                skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_2"]]), l[k["E2_ATTR1"]], l[k["E2_ATTR2"]]);

                if (k.ContainsKey("E2_DEALY"))
                {
                    Util.parseObject(l[k["E2_DEALY"]], out startDelay, -1);
                    if (startDelay > 0)
                    {
                        skillEffects[i].startDelay = ((float)startDelay * 0.001f);
                    }
                }

                break;

            case 2:
                skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_3"]]), l[k["E3_ATTR1"]], l[k["E3_ATTR2"]]);

                if (k.ContainsKey("E3_DEALY"))
                {
                    Util.parseObject(l[k["E3_DEALY"]], out startDelay, -1);
                    if (startDelay > 0)
                    {
                        skillEffects[i].startDelay = ((float)startDelay * 0.001f);
                    }
                }


                break;

            case 3:
                skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_4"]]), l[k["E4_ATTR1"]], l[k["E4_ATTR2"]]);

                if (k.ContainsKey("E4_DEALY"))
                {
                    Util.parseObject(l[k["E4_DEALY"]], out startDelay, -1);
                    if (startDelay > 0)
                    {
                        skillEffects[i].startDelay = ((float)startDelay * 0.001f);
                    }
                }


                break;

            case 4:
                skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_5"]]), l[k["E5_ATTR1"]], l[k["E5_ATTR2"]]);

                if (k.ContainsKey("E5_DEALY"))
                {
                    Util.parseObject(l[k["E5_DEALY"]], out startDelay, -1);
                    if (startDelay > 0)
                    {
                        skillEffects[i].startDelay = ((float)startDelay * 0.001f);
                    }
                }

                break;
            }

            skillEffects[i].skillData = this;

            if (skillEffects[i].type == 29)
            {
                isChangeSideSkill = true;
            }
        }


        description = ((string)l[k["DESCRIPTION"]]).Replace("\\n", "\n");;
    }