Beispiel #1
0
    public void CommandSelect(GameObject charaObj)
    {
        System.Random rnd = new System.Random();
        skillCount = 0;

        EC = Resources.Load("ExcelData/enemy_chara") as enemy_charaList;
        ES = Resources.Load("ExcelData/enemySkill") as enemy_skillList;

        //  スキルをいくつ持っているかカウントする
        if (EC.sheets[0].list[charID].Skill1 != 0)
        {
            skillCount++;
        }
        if (EC.sheets[0].list[charID].Skill2 != 0)
        {
            skillCount++;
        }
        if (EC.sheets[0].list[charID].Skill3 != 0)
        {
            skillCount++;
        }
        if (EC.sheets[0].list[charID].Skill4 != 0)
        {
            skillCount++;
        }
        //  持っているスキルの中からランダムでスキルを選ぶ
        int skillNumber = rnd.Next(1, skillCount + 1);

        switch (skillNumber)
        {
        case 1:
            skillID = EC.sheets[0].list[charID].Skill1 - 1;
            break;

        case 2:
            skillID = EC.sheets[0].list[charID].Skill2 - 1;
            break;

        case 3:
            skillID = EC.sheets[0].list[charID].Skill3 - 1;
            break;

        case 4:
            skillID = EC.sheets[0].list[charID].Skill4 - 1;
            break;

        default:
            break;
        }
        //  スキルを決定する
        charaObj.GetComponent <Status>().SaveSkill(skillID);

        EsetReceive(charaObj);
    }
Beispiel #2
0
    //  スキルの効果の取得
    public void SkillInfluence(int skillID)
    {
        PC = Resources.Load("ExcelData/player_chara") as player_charaList;
        PS = Resources.Load("ExcelData/playerSkill") as player_skillList;

        EC = Resources.Load("ExcelData/enemy_chara") as enemy_charaList;
        ES = Resources.Load("ExcelData/enemySkill") as enemy_skillList;

        GameObject AttackObj = battleManager.GetComponent <BattleScene>().GetAttackObj();

        //  前の行動で敵が死亡してたら標的を変える
        if (battleManager.GetComponent <BattleScene>().GetReceiveObj(1) == null &&
            battleManager.GetComponent <BattleScene>().GetReceiveObj(2) == null &&
            battleManager.GetComponent <BattleScene>().GetReceiveObj(3) == null)
        {
            // プレイヤーが敵に向かって行動する時用
            if (playerProof)
            {
                if (PS.sheets[0].list[skillID].target.StartsWith("E"))
                {
                    battleManager.GetComponent <command>().changeTarget(playerProof, PS.sheets[0].list[skillID].target);
                    ReceiveChara1 = battleManager.GetComponent <BattleScene>().GetReceiveObj(1);
                }
            }
            //  敵が敵に向かって行動する時用
            else
            {
                if (ES.sheets[0].list[skillID].target.StartsWith("E"))
                {
                    battleManager.GetComponent <command>().changeTarget(playerProof, ES.sheets[0].list[skillID].target);
                    ReceiveChara1 = battleManager.GetComponent <BattleScene>().GetReceiveObj(1);
                }
            }
        }

        //  前の行動でプレイヤーが死亡してたら標的を変える
        if ((battleManager.GetComponent <BattleScene>().GetReceiveObj(1) && battleManager.GetComponent <BattleScene>().GetReceiveObj(1).GetComponent <Status>().GetState() == STATE.ST_DEAD) ||
            (battleManager.GetComponent <BattleScene>().GetReceiveObj(2) && battleManager.GetComponent <BattleScene>().GetReceiveObj(2).GetComponent <Status>().GetState() == STATE.ST_DEAD) ||
            (battleManager.GetComponent <BattleScene>().GetReceiveObj(3) && battleManager.GetComponent <BattleScene>().GetReceiveObj(3).GetComponent <Status>().GetState() == STATE.ST_DEAD))
        {
            // プレイヤーがプレイヤーに向かって行動する時用
            if (playerProof)
            {
                if (PS.sheets[0].list[skillID].target.StartsWith("P"))
                {
                    if (PS.sheets[0].list[skillID].target.Contains("1"))
                    {
                        if (battleManager.GetComponent <command>().GetPlayerChild(0).GetComponent <Status>().GetState() != Status.STATE.ST_DEAD)
                        {
                            battleManager.GetComponent <BattleScene>().SetReceiveObj(battleManager.GetComponent <command>().GetPlayerChild(0));
                        }
                        else if (battleManager.GetComponent <command>().GetPlayerChild(1).GetComponent <Status>().GetState() != Status.STATE.ST_DEAD)
                        {
                            battleManager.GetComponent <BattleScene>().SetReceiveObj(battleManager.GetComponent <command>().GetPlayerChild(1));
                        }
                        else if (battleManager.GetComponent <command>().GetPlayerChild(1).GetComponent <Status>().GetState() != Status.STATE.ST_DEAD)
                        {
                            battleManager.GetComponent <BattleScene>().SetReceiveObj(battleManager.GetComponent <command>().GetPlayerChild(2));
                        }
                        ReceiveChara1 = battleManager.GetComponent <BattleScene>().GetReceiveObj(1);
                    }

                    //  3人に対する行動
                    else
                    {
                        NonTarget3();
                    }
                }
            }
            //  敵がプレイヤーに向かって行動する時用
            else
            {
                if (ES.sheets[0].list[skillID].target.StartsWith("P"))
                {
                    if (ES.sheets[0].list[skillID].target.Contains("1"))
                    {
                        if (battleManager.GetComponent <command>().GetPlayerChild(0).GetComponent <Status>().GetState() != Status.STATE.ST_DEAD)
                        {
                            battleManager.GetComponent <BattleScene>().SetReceiveObj(battleManager.GetComponent <command>().GetPlayerChild(0));
                        }
                        else if (battleManager.GetComponent <command>().GetPlayerChild(1).GetComponent <Status>().GetState() != Status.STATE.ST_DEAD)
                        {
                            battleManager.GetComponent <BattleScene>().SetReceiveObj(battleManager.GetComponent <command>().GetPlayerChild(1));
                        }
                        else if (battleManager.GetComponent <command>().GetPlayerChild(1).GetComponent <Status>().GetState() != Status.STATE.ST_DEAD)
                        {
                            battleManager.GetComponent <BattleScene>().SetReceiveObj(battleManager.GetComponent <command>().GetPlayerChild(2));
                        }
                        ReceiveChara1 = battleManager.GetComponent <BattleScene>().GetReceiveObj(1);
                    }
                    else
                    {
                        NonTarget3();
                    }
                }
            }
        }

        GameObject UseObj = AttackObj;

        if (playerProof)
        {
            battleManager.GetComponent <command>().SetActiveSkillText(PS.sheets[0].list[skillID].skillName);
            animName = PS.sheets[0].list[skillID].effectName;
            if (int.Parse(Regex.Replace(PS.sheets[0].list[skillID].target, @"[^0-9]", "")) == 3)
            {
                targetFlag = true;
            }
        }
        else
        {
            battleManager.GetComponent <command>().SetActiveSkillText(ES.sheets[0].list[skillID].skillName);
            animName = ES.sheets[0].list[skillID].effectName;
            if (int.Parse(Regex.Replace(ES.sheets[0].list[skillID].target, @"[^0-9]", "")) == 3)
            {
                targetFlag = true;
            }
        }

        string charaStatus;
        string useStatus;
        string useStatus2;
        double magnification;
        int    STime;

        //  ステータスを弄るキャラ
        charaStatus = PS.sheets[0].list[skillID].useChara;
        //  使用するステータス
        useStatus  = PS.sheets[0].list[skillID].influence1;
        useStatus2 = PS.sheets[0].list[skillID].influence2;
        //  技の倍率
        magnification = PS.sheets[0].list[skillID].power;
        //  HPに影響を与える技かどうか
        HPCtlFlag = (int)PS.sheets[0].list[skillID].hpCtl;
        //  物理攻撃か魔法攻撃か
        AttackType = (int)PS.sheets[0].list[skillID].attackType;
        //  持続時間
        STime = (int)PS.sheets[0].list[skillID].period;

        //  行動するのが敵の場合は敵のステータスに変更
        if (!playerProof)
        {
            charaStatus   = ES.sheets[0].list[skillID].useChara;
            useStatus     = ES.sheets[0].list[skillID].influence1;
            useStatus2    = ES.sheets[0].list[skillID].influence2;
            magnification = ES.sheets[0].list[skillID].power;
            HPCtlFlag     = (int)ES.sheets[0].list[skillID].hpCtl;
            AttackType    = (int)ES.sheets[0].list[skillID].attackType;
            STime         = (int)ES.sheets[0].list[skillID].period;
        }

        DeleteBuff(AttackObj);
        DeleteBuff(ReceiveChara1);
        DeleteBuff(ReceiveChara2);
        DeleteBuff(ReceiveChara3);

        HealPercent = 0;

        if (charaStatus == "Attack")
        {
            UseObj = AttackObj;
        }
        else if (charaStatus == "Receive")
        {
            UseObj = ReceiveChara1;
        }
        else
        {
        }

        for (int count = 0; count < 3; count++)
        {
            strData str1 = new strData();
            switch (useStatus)
            {
            case ("HP"):
                HealPercent = magnification;
                break;

            case ("ATK"):
                str1.ATK  = (int)Math.Round(UseObj.GetComponent <Status>().GetATK() * magnification);
                str1.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str1);
                break;

            case ("DEF"):
                str1.DEF  = (int)Math.Round(UseObj.GetComponent <Status>().GetDEF() * magnification);
                str1.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str1);
                break;

            case ("SPD"):
                str1.SPD  = (int)Math.Round(UseObj.GetComponent <Status>().GetSPD() * magnification);
                str1.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str1);
                break;

            case ("MAT"):
                str1.MAT  = (int)Math.Round(UseObj.GetComponent <Status>().GetMAT() * magnification);
                str1.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str1);
                break;

            case ("MDF"):
                str1.MDF  = (int)Math.Round(UseObj.GetComponent <Status>().GetMDF() * magnification);
                str1.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str1);
                break;

            case ("LUK"):
                str1.LUK  = (int)Math.Round(UseObj.GetComponent <Status>().GetLUK() * magnification);
                str1.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str1);
                break;

            default:
                break;
            }

            strData str2 = new strData();
            switch (useStatus2)
            {
            case ("HP"):
                HealPercent = magnification;
                break;

            case ("ATK"):
                str2.ATK  = (int)Math.Round(UseObj.GetComponent <Status>().GetATK() * magnification);
                str2.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str2);
                break;

            case ("DEF"):
                str2.DEF  = (int)Math.Round(UseObj.GetComponent <Status>().GetDEF() * magnification);
                str2.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str2);
                break;

            case ("SPD"):
                str2.SPD  = (int)Math.Round(UseObj.GetComponent <Status>().GetSPD() * magnification);
                str2.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str2);
                break;

            case ("MAT"):
                str2.MAT  = (int)Math.Round(UseObj.GetComponent <Status>().GetMAT() * magnification);
                str2.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str2);
                break;

            case ("MDF"):
                str2.MDF  = (int)Math.Round(UseObj.GetComponent <Status>().GetMDF() * magnification);
                str2.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str2);
                break;

            case ("LUK"):
                str2.LUK  = (int)Math.Round(UseObj.GetComponent <Status>().GetLUK() * magnification);
                str2.TIME = STime + TURN;
                UseObj.GetComponent <Status>().changeStatus.Add(str2);
                break;

            default:
                break;
            }

            if (charaStatus == "Attack")
            {
                break;
            }

            if (count == 0)
            {
                UseObj = ReceiveChara2;
            }
            else if (count == 1)
            {
                UseObj = ReceiveChara3;
            }
            else
            {
            }

            if (!UseObj)
            {
                break;
            }
        }
    }
Beispiel #3
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            enemy_skillList data = (enemy_skillList)AssetDatabase.LoadAssetAtPath(exportPath, typeof(enemy_skillList));
            if (data == null)
            {
                data = ScriptableObject.CreateInstance <enemy_skillList> ();
                AssetDatabase.CreateAsset((ScriptableObject)data, exportPath);
                data.hideFlags = HideFlags.NotEditable;
            }

            data.sheets.Clear();
            using (FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
                IWorkbook book = null;
                if (Path.GetExtension(filePath) == ".xls")
                {
                    book = new HSSFWorkbook(stream);
                }
                else
                {
                    book = new XSSFWorkbook(stream);
                }

                foreach (string sheetName in sheetNames)
                {
                    ISheet sheet = book.GetSheet(sheetName);
                    if (sheet == null)
                    {
                        Debug.LogError("[QuestData] sheet not found:" + sheetName);
                        continue;
                    }

                    enemy_skillList.Sheet s = new enemy_skillList.Sheet();
                    s.name = sheetName;

                    for (int i = 1; i <= sheet.LastRowNum; i++)
                    {
                        IRow  row  = sheet.GetRow(i);
                        ICell cell = null;

                        enemy_skillList.Param p = new enemy_skillList.Param();

                        cell = row.GetCell(0); p.ID = (cell == null ? 0.0 : cell.NumericCellValue);
                        cell = row.GetCell(1); p.skillName = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(2); p.effectName = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(3); p.power = (cell == null ? 0.0 : cell.NumericCellValue);
                        cell = row.GetCell(4); p.target = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(5); p.useChara = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(6); p.hpCtl = (cell == null ? 0.0 : cell.NumericCellValue);
                        cell = row.GetCell(7); p.attackType = (cell == null ? 0.0 : cell.NumericCellValue);
                        cell = row.GetCell(8); p.sp = (cell == null ? 0.0 : cell.NumericCellValue);
                        cell = row.GetCell(9); p.period = (cell == null ? 0.0 : cell.NumericCellValue);
                        cell = row.GetCell(10); p.influence1 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(11); p.influence2 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(12); p.time = (cell == null ? "" : cell.StringCellValue);
                        s.list.Add(p);
                    }
                    data.sheets.Add(s);
                }
            }

            ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject;
            EditorUtility.SetDirty(obj);
        }
    }