Ejemplo n.º 1
0
    private void addSkills17()
    {
        EnemyBoardSkill           stopCol       = null;
        Func <List <Vector2Int> > randOrbPerCol = () => {
            System.Random rand          = new System.Random(getRandomSeedByTurn(stopCol));
            List <int>    remainingRows = new List <int>();
            for (int i = 0; i < Board.ROWS; i++)
            {
                remainingRows.Add(i);
            }
            remainingRows.Add(rand.Next(Board.ROWS));
            List <Vector2Int> chosenOrbs = new List <Vector2Int>();
            for (int c = 0; c < Board.COLUMNS; c++)
            {
                int randRow = rand.Next(remainingRows.Count);
                chosenOrbs.Add(new Vector2Int(c, remainingRows[randRow]));
                remainingRows.RemoveAt(randRow);
            }
            return(chosenOrbs);
        };

        stopCol = EnemyBoardSkill.MarkOrderSkill(() => GameController.Instance.isTurnMod(3), randOrbPerCol, 0.1f, skillTrans, 1);
        stopCol.addSetSkill(0.1f, (Orb o) => ORB_VALUE.STOP);
        skillList.Add(stopCol);

        skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(4), EnemyBuffs.DMG_MITI_50, () => this, 1, skillTrans));
        EnemyTimer DOT = EnemyTimer.Create(() => true, 2f, -1, skillTrans);

        DOT.addDOTSkill(() => 5);
        DOT.addTimeDelay(1f);
        skillList.Add(DOT);
        skillList.Add(EnemyAttack.Create(() => true, false, () => Player.Instance.gameObject, () => (int)(-GameController.Instance.getTimeOnFloor() * 2), skillTrans));
    }
Ejemplo n.º 2
0
    private void addSkills19()
    {
        EnemyBoardSkill           antiRow       = null;
        Func <List <Vector2Int> > randOrbPerRow = () => {
            System.Random rand          = new System.Random(getRandomSeedByTurn(antiRow));
            List <int>    remainingCols = new List <int>();
            for (int i = 0; i < Board.COLUMNS; i++)
            {
                remainingCols.Add(i);
            }
            List <Vector2Int> chosenOrbs = new List <Vector2Int>();
            for (int r = Board.ROWS - 1; r >= 0; r--)
            {
                int randCol = rand.Next(remainingCols.Count);
                chosenOrbs.Add(new Vector2Int(remainingCols[randCol], r));
                remainingCols.RemoveAt(randCol);
            }
            return(chosenOrbs);
        };

        antiRow = EnemyBoardSkill.MarkOrderSkill(() => GameController.Instance.isTurnMod(3, 1), randOrbPerRow, 0.1f, skillTrans, 1);
        antiRow.addSetSkill(0.1f, (Orb o) => ORB_VALUE.POISON);
        skillList.Add(antiRow);

        skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(4, 2), EnemyBuffs.DMG_MITI_50, () => this, 1, skillTrans));
        EnemyTimer DOT = EnemyTimer.Create(() => true, 2f, -1, skillTrans);

        DOT.addDOTSkill(() => 2);
        skillList.Add(DOT);
        skillList.Add(EnemyAttack.Create(() => true, false, () => Player.Instance.gameObject, () => (int)(-GameController.Instance.getTimeOnFloor() * 5), skillTrans));
    }
    public static EnemyHPBuff Create(Func <bool> wtu, EnemyBuffs buff, Func <Enemy> getTarget, int turnDur, Transform parent)
    {
        EnemyHPBuff HPbuff = Create(parent).AddComponent <EnemyHPBuff>();

        HPbuff.initValues(convertBuffToSkill(buff), wtu, turnDur, 0f);
        HPbuff.buff      = buff;
        HPbuff.getTarget = getTarget;
        return(HPbuff);
    }
    protected override void addAllSkills()
    {
        EnemyOrbSkill equalRates = EnemyOrbSkill.Create(() => true, (ORB_VALUE o) => o <= ORB_VALUE.NINE ? OrbSpawnRate.NORMAL : OrbSpawnRate.DECREASED, -1, skillTrans);

        skillList.Add(equalRates);

        EnemyTimer evenGrowth = EnemyTimer.Create(() => true, 2f, -1, skillTrans);

        evenGrowth.addDOTSkill(() => - 2 * (int)GameController.Instance.getState().timeOnTurn);
        skillList.Add(evenGrowth);

        EnemyHPBuff randHPBuff = EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(4), default, () => this, 2, skillTrans);
Ejemplo n.º 5
0
    private void addSkills11()
    {
        Func <Enemy> getEnemy = () => {
            foreach (Enemy e in GameController.Instance.getCurrEnemies())
            {
                if (e.getEnemyID() != getEnemyID())
                {
                    return(e);
                }
            }
            return(null);
        };

        skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(2), EnemyBuffs.DMG_ABSORB, getEnemy, 1, skillTrans));

        EnemyBoardSkill  oneEmptyPerDigit = null;
        Func <Orb, bool> randDigits       = (Orb o) => {
            System.Random rand = new System.Random(getRandomSeedByTurn(oneEmptyPerDigit));
            for (int i = 0; i < 10; i++)
            {
                List <Orb> currDigit = new List <Orb>();
                for (int j = 0; j < Board.COLUMNS; j++)
                {
                    for (int k = 0; k < Board.ROWS; k++)
                    {
                        Orb z = Board.Instance.getOrb(j, k);
                        if (z.getOrbValue() == (ORB_VALUE)i)
                        {
                            currDigit.Add(z);
                        }
                    }
                }
                if (o.getIntValue() == i && currDigit[rand.Next(currDigit.Count)] == o)
                {
                    return(true);
                }
            }
            return(false);
        };

        oneEmptyPerDigit = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(2), randDigits, 0.1f, skillTrans);
        oneEmptyPerDigit.addSetSkill(0.1f, (Orb o) => ORB_VALUE.EMPTY);
        skillList.Add(oneEmptyPerDigit);

        Func <ORB_VALUE, OrbSpawnRate> incAnti = (ORB_VALUE orbVal) => orbVal == ORB_VALUE.POISON ? OrbSpawnRate.INCREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal];

        skillList.Add(EnemyOrbSkill.Create(() => GameController.Instance.isTurnMod(2, 1), incAnti, 1, skillTrans));

        skillList.Add(EnemyAttack.Create(() => true, false, () => Player.Instance.gameObject, () => (currState.currHealth - currState.maxHealth) / 2 - 100, skillTrans));
        skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(2), false, () => gameObject, () => currState.currHealth / 2, skillTrans));
    }
Ejemplo n.º 6
0
    private void addSkills28()
    {
        Func <Enemy> getTarget = () => GameController.Instance.getCurrEnemies()[RNG.Next(GameController.Instance.getCurrEnemies().Count)];

        skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(3, 2), EnemyBuffs.DMG_REFLECT, getTarget, 1, skillTrans));

        EnemyBoardSkill decEight = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(3), (Orb o) => o.getOrbValue() == ORB_VALUE.EIGHT, 0.1f, skillTrans);

        decEight.addIncSkill(0.1f, (Orb o) => - 3);
        skillList.Add(decEight);

        EnemyTimer DOT8 = EnemyTimer.Create(() => GameController.Instance.isTurnMod(3, 1), 1f, 1, skillTrans);

        DOT8.addDOTSkill(() => - 8);
        skillList.Add(DOT8);
        skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(3, 2), false, () => Player.Instance.gameObject, () => - currState.damage, skillTrans));
    }
Ejemplo n.º 7
0
    private void addSkills27()
    {
        Func <Enemy> getTarget = () => GameController.Instance.getCurrEnemies()[RNG.Next(GameController.Instance.getCurrEnemies().Count)];

        skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(3, 1), EnemyBuffs.DMG_MITI_50, getTarget, 1, skillTrans));

        EnemyBoardSkill decSeven = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(3, 2), (Orb o) => o.getOrbValue() == ORB_VALUE.SEVEN, 0.1f, skillTrans);

        decSeven.addIncSkill(0.1f, (Orb o) => - 2);
        skillList.Add(decSeven);

        EnemyTimer DOT7 = EnemyTimer.Create(() => GameController.Instance.isTurnMod(3), 1f, 1, skillTrans);

        DOT7.addDOTSkill(() => - 7);
        skillList.Add(DOT7);
        skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(3, 1), false, () => Player.Instance.gameObject, () => - currState.damage, skillTrans));
    }
Ejemplo n.º 8
0
    private void addSkills13()
    {
        Func <Enemy> getEnemy = () => {
            foreach (Enemy e in GameController.Instance.getCurrEnemies())
            {
                if (e.getEnemyID() != getEnemyID())
                {
                    return(e);
                }
            }
            return(null);
        };
        Func <GameObject> getGameObject = () => {
            foreach (Enemy e in GameController.Instance.getCurrEnemies())
            {
                if (e.getEnemyID() != getEnemyID())
                {
                    return(e.gameObject);
                }
            }
            return(null);
        };

        skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(2, 1), false, getGameObject, () => - getEnemy().getState().currHealth / 2, skillTrans));
        skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(2, 1), EnemyBuffs.DMG_REFLECT, getEnemy, 1, skillTrans));

        EnemyBoardSkill incAll = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(2), (Orb o) => true, 0f, skillTrans);

        incAll.addIncSkill(0.05f, (Orb o) => 1);
        skillList.Add(incAll);

        Func <ORB_VALUE, OrbSpawnRate> incNullify = (ORB_VALUE orbVal) => orbVal == ORB_VALUE.NULLIFY ? OrbSpawnRate.INCREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal];

        skillList.Add(EnemyOrbSkill.Create(() => GameController.Instance.isTurnMod(2), incNullify, 1, skillTrans));

        skillList.Add(EnemyAttack.Create(() => true, false, () => Player.Instance.gameObject, () => - GameController.Instance.getCurrTurn() * 50 - 100, skillTrans));
    }
    private void addMedSkill(int index)
    {
        System.Random rand = new System.Random(getRandomSeedByFloor());
        Func <bool> wtu    = () => true;
        Func <ORB_VALUE, OrbSpawnRate> newSpawnRates;

        switch (index)
        {
        case 0:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill clearPattern = null;
            clearPattern = EnemyBoardSkill.MarkOrderSkill(wtu, () => getRandomPattern(clearPattern), 0.1f, skillTrans, 1);
            clearPattern.addRmvSkill(0);
            skillList.Add(clearPattern);
            break;

        case 1:
            int numHealReduce = rand.Next(1, 3);
            newSpawnRates = (ORB_VALUE orbVal) => orbVal == ORB_VALUE.ZERO ? OrbSpawnRate.DECREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal];
            wtu           = () => GameController.Instance.isTurnMod(2 * numHealReduce, RNG.Next(numHealReduce));
            skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, numHealReduce, skillTrans));
            break;

        case 2:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill setOneDigitAsRand = null;
            Func <Orb, bool> markAllOneDigit  = (Orb o) => {
                System.Random rand2 = new System.Random(getRandomSeedByTurn(setOneDigitAsRand));
                int digitToMark     = rand2.Next(1, 10);
                return(o.getIntValue() == digitToMark);
            };
            Func <Orb, ORB_VALUE> changeDigit = (Orb o) => {
                System.Random rand2 = new System.Random(getRandomSeedByTurn(setOneDigitAsRand));
                List <ORB_VALUE> possibleOrbVals = new List <ORB_VALUE>();
                for (int i = 1; i < 10; i++)
                {
                    possibleOrbVals.Add((ORB_VALUE)i);
                }
                possibleOrbVals.Remove(o.getOrbValue());
                return(possibleOrbVals[rand2.Next(possibleOrbVals.Count)]);
            };
            setOneDigitAsRand = EnemyBoardSkill.MarkIfSkill(wtu, markAllOneDigit, 0.1f, skillTrans);
            setOneDigitAsRand.addSetSkill(0.1f, changeDigit);
            skillList.Add(setOneDigitAsRand);
            break;

        case 3:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill replaceWithEmpty = null;
            replaceWithEmpty = EnemyBoardSkill.MarkOrderSkill(wtu, () => getRandomPattern(replaceWithEmpty), 0.1f, skillTrans, 1);
            replaceWithEmpty.addSetSkill(0.1f, (Orb o) => ORB_VALUE.EMPTY);
            skillList.Add(replaceWithEmpty);
            break;

        case 4:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill replaceWithStop = null;
            replaceWithStop = EnemyBoardSkill.MarkOrderSkill(wtu, () => getOneLine(replaceWithStop), 0.1f, skillTrans, 1);
            replaceWithStop.addSetSkill(0.1f, (Orb o) => ORB_VALUE.STOP);
            skillList.Add(replaceWithStop);
            break;

        case 5:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill allHealsToEmpty = EnemyBoardSkill.MarkIfSkill(wtu, (Orb o) => o.getOrbValue() == ORB_VALUE.ZERO, 0.1f, skillTrans, 1);
            allHealsToEmpty.addSetSkill(0.1f, (Orb o) => ORB_VALUE.EMPTY);
            skillList.Add(allHealsToEmpty);
            break;

        case 6:
            newSpawnRates = (ORB_VALUE orbVal) => OrbSpawnRate.NORMAL;
            skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, -1, skillTrans));
            break;

        case 7:
            int numEmptyInc = rand.Next(1, 3);
            newSpawnRates = (ORB_VALUE orbVal) => orbVal == ORB_VALUE.EMPTY ? OrbSpawnRate.INCREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal];
            wtu           = () => GameController.Instance.isTurnMod(2 * numEmptyInc, RNG.Next(numEmptyInc));
            skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, numEmptyInc, skillTrans));
            break;

        case 8:
            EnemyBuffs hpBuff = (EnemyBuffs)(rand.Next(3) + 1);
            skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(3, RNG.Next(3)), hpBuff, () => this, 1, skillTrans));
            break;

        case 9:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill decFourLines = null;
            decFourLines = EnemyBoardSkill.MarkOrderSkill(wtu, () => getFourLines(decFourLines), 0.1f, skillTrans, 1);
            decFourLines.addIncSkill(0.1f, (Orb o) => - 1);
            skillList.Add(decFourLines);
            break;
        }
    }
    private void addEasySkill(int index)
    {
        System.Random rand = new System.Random(getRandomSeedByFloor());
        Func <bool> wtu    = () => true;
        Func <ORB_VALUE, OrbSpawnRate> newSpawnRates;

        switch (index)
        {
        case 0:
            int numShuffles = rand.Next(1, 3);
            wtu = () => GameController.Instance.isTurnMod(numShuffles, RNG.Next(numShuffles));
            skillList.Add(EnemyBoardSkill.ShuffleSkill(wtu, numShuffles * 5, 0.075f, skillTrans));
            break;

        case 1:
            EnemyBoardSkill clearOneLine = null;
            clearOneLine = EnemyBoardSkill.MarkOrderSkill(wtu, () => getOneLine(clearOneLine), 0.1f, skillTrans);
            clearOneLine.addRmvSkill(0);
            skillList.Add(clearOneLine);
            break;

        case 2:
            bool healSelfOnly = RNG.Next(2) == 0;
            int percentHeal   = rand.Next(1, 6);
            wtu = () => GameController.Instance.isTurnMod(percentHeal, RNG.Next(percentHeal));
            Func <GameObject> getTarget = () => healSelfOnly ? gameObject : GameController.Instance.getCurrEnemies()[RNG.Next(GameController.Instance.getCurrEnemies().Count)].gameObject;
            Func <int> getDmg           = () => getTarget().GetComponent <Enemy>().getState().maxHealth *percentHeal / 10;
            skillList.Add(EnemyAttack.Create(wtu, true, getTarget, getDmg, skillTrans));
            break;

        case 3:
            EnemyBoardSkill setOneLineEmpty = null;
            setOneLineEmpty = EnemyBoardSkill.MarkOrderSkill(wtu, () => getOneLine(setOneLineEmpty), 0.1f, skillTrans, 1);
            setOneLineEmpty.addSetSkill(0.1f, (Orb o) => ORB_VALUE.EMPTY);
            skillList.Add(setOneLineEmpty);
            break;

        case 4:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill clearFourLines = null;
            clearFourLines = EnemyBoardSkill.MarkOrderSkill(wtu, () => getFourLines(clearFourLines), 0.1f, skillTrans, 1);
            clearFourLines.addRmvSkill(0);
            skillList.Add(clearFourLines);
            break;

        case 5:
            wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            EnemyBoardSkill clearAllHeals = EnemyBoardSkill.MarkIfSkill(wtu, (Orb o) => o.getOrbValue() == ORB_VALUE.ZERO, 0.1f, skillTrans, 1);
            clearAllHeals.addRmvSkill(0);
            skillList.Add(clearAllHeals);
            break;

        case 6:
            newSpawnRates = (ORB_VALUE orbVal) => orbVal == ORB_VALUE.NULLIFY ? OrbSpawnRate.DECREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal];
            skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, -1, skillTrans));
            break;

        case 7:
            newSpawnRates = (ORB_VALUE orbVal) => orbVal == (ORB_VALUE)rand.Next(1, 10) ? OrbSpawnRate.MAX : Board.getDefaultOrbSpawnRates()[(int)orbVal];
            wtu           = () => GameController.Instance.isTurnMod(3, RNG.Next(3));
            skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, 1, skillTrans));
            break;

        case 8:
            EnemyBuffs hpBuff       = (EnemyBuffs)(rand.Next(3) + 1);
            Func <Enemy> getTarget2 = () => GameController.Instance.getCurrEnemies()[RNG.Next(GameController.Instance.getCurrEnemies().Count)];
            skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(2, RNG.Next(2)), hpBuff, getTarget2, 1, skillTrans));
            break;

        case 9:
            EnemyBoardSkill decOneLine = null;
            decOneLine = EnemyBoardSkill.MarkOrderSkill(wtu, () => getOneLine(decOneLine), 0.1f, skillTrans);
            decOneLine.addIncSkill(0.1f, (Orb o) => - 1);
            skillList.Add(decOneLine);
            break;
        }
    }