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)); }
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)); }
void Start() { target = GameObject.FindGameObjectWithTag("Player").transform; holdingPoint = GetComponentInChildren <HoldingPointAI>(); enemyTimer = GetComponentInChildren <EnemyTimer>(); turnManager = GameObject.FindObjectOfType <TurnManager>(); turnManager.onEnemiesTurn += ExecuteTurn; }
public static EnemyTimer Create(Func <bool> wtu, float skillRate, int turnDur, Transform parent) { EnemyTimer eTimer = Create(parent).AddComponent <EnemyTimer>(); eTimer.initValues(EnemySkillType.TIMER, wtu, turnDur, 0f); eTimer.skillRate = skillRate; return(eTimer); }
public void stopall() { ExplosionTimer.Stop(); EnemyTimer.Stop(); EnemyTimer1.Stop(); EnemyTimer2.Stop(); EnemyTimer3.Stop(); EnemyTimer4.Stop(); BombTimer.Stop(); }
public IEnumerator clearAllMarkedTimerOrbs() { foreach (EnemySkill es in activeSkills) { if (es is EnemyTimer) { EnemyTimer et = es as EnemyTimer; yield return(StartCoroutine(et.clearAllMarkedOrbs())); } } }
// Use this for initialization void Start() { timer = GetComponentInParent <EnemyTimer> (); timer.generateAnEnemy = GenerateEnemy; playerHitScript = Player.GetComponent <PlayerHitDetection> (); playerHitScript.killEnemy = KillEnemy; playerControlScript = Player.GetComponent <PlayerControlScript> (); gameOverCanvas.enabled = false; sound = GetComponentInParent <SoundScript> (); spawner = GetComponent <EnemySpawner> (); Floor2.SetActive(false); }
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);
// to-do: go ham on turns when minibosses die for attack and skill 3 private void addSkills3() { EnemyTimer decOnPlayer = EnemyTimer.Create(() => true, 3f, -1, skillTrans); decOnPlayer.addIncSkill((Orb o) => - 1); skillList.Add(decOnPlayer); EnemyBoardSkill setFoursToNullify = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(4), (Orb o) => o.getOrbValue() == ORB_VALUE.FOUR, 0.1f, skillTrans); setFoursToNullify.addSetSkill(0.1f, (Orb o) => ORB_VALUE.NULLIFY); skillList.Add(setFoursToNullify); Func <bool> wtu = () => { List <Enemy> eList = GameController.Instance.getCurrEnemies(); foreach (Enemy e in eList) { if (e.getState().number == 6) { return(false); } } return(GameController.Instance.isTurnMod(4, 3)); }; EnemyBoardSkill setHealsToAnti = EnemyBoardSkill.MarkIfSkill(wtu, (Orb o) => o.getOrbValue() == ORB_VALUE.ZERO, 0.1f, skillTrans); setHealsToAnti.addSetSkill(0.1f, (Orb o) => ORB_VALUE.POISON); skillList.Add(setHealsToAnti); Func <Orb, bool> allOrbsLessThan = (Orb o) => { int range = 3 + (3 - GameController.Instance.getCurrEnemies().Count); return(o.isDigit() && o.getIntValue() <= range); }; EnemyBoardSkill markLess = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(3), allOrbsLessThan, 0.1f, skillTrans); skillList.Add(markLess); Func <int> getDmg = () => { List <Orb> markedOrbs = Board.Instance.getAllMarkedOrbsBy(getSkillID(markLess, markLess.getActivatedTurn()), null); int sum = 0; foreach (Orb o in markedOrbs) { if (o.isDigit()) { sum += o.getIntValue(); } } return(sum * -9); }; skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(3), false, () => Player.Instance.gameObject, getDmg, skillTrans)); }
private void addSkills9() { EnemyTimer setOnPlayer = EnemyTimer.Create(() => true, 9f, -1, skillTrans); setOnPlayer.addSetSkill((Orb o) => o.getOrbValue() == ORB_VALUE.ZERO ? ORB_VALUE.NINE : o.getOrbValue()); skillList.Add(setOnPlayer); EnemyBoardSkill setFivesToNullify = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(4, 2), (Orb o) => o.getOrbValue() == ORB_VALUE.FIVE, 0.1f, skillTrans); setFivesToNullify.addSetSkill(0.1f, (Orb o) => ORB_VALUE.NULLIFY); skillList.Add(setFivesToNullify); Func <bool> wtu = () => { List <Enemy> eList = GameController.Instance.getCurrEnemies(); foreach (Enemy e in eList) { if (e.getState().number == 6) { return(false); } } return(GameController.Instance.isTurnMod(4, 1)); }; EnemyBoardSkill setNinesToStop = EnemyBoardSkill.MarkIfSkill(wtu, (Orb o) => o.getOrbValue() == ORB_VALUE.NINE, 0.1f, skillTrans); setNinesToStop.addSetSkill(0.1f, (Orb o) => ORB_VALUE.STOP); skillList.Add(setNinesToStop); Func <Orb, bool> allOrbsGreaterThan = (Orb o) => { int range = 6 - (3 - GameController.Instance.getCurrEnemies().Count); return(o.isDigit() && o.getIntValue() >= range); }; EnemyBoardSkill markGreater = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(3, 2), allOrbsGreaterThan, 0.1f, skillTrans); skillList.Add(markGreater); Func <int> getDmg = () => { List <Orb> markedOrbs = Board.Instance.getAllMarkedOrbsBy(getSkillID(markGreater, markGreater.getActivatedTurn()), null); int sum = 0; foreach (Orb o in markedOrbs) { if (o.isDigit()) { sum += o.getIntValue(); } } return(sum * -3); }; skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(3, 2), false, () => Player.Instance.gameObject, getDmg, skillTrans)); }
public bool toggleAllTimerSkills(bool toActivate) { bool anyTimerActivated = false; foreach (EnemySkill es in activeSkills) { if (es is EnemyTimer) { EnemyTimer et = es as EnemyTimer; et.toggleSkill(toActivate); anyTimerActivated = toActivate; } } return(anyTimerActivated); }
private void Form1_Load(object sender, EventArgs e) { P1.Image = Properties.Resources._11; P1.SizeMode = PictureBoxSizeMode.AutoSize; P1.BringToFront(); bomb.Image = Properties.Resources.dynamite2; bomb.SizeMode = PictureBoxSizeMode.StretchImage; bomb.Location = P1.Location; bomb.BringToFront(); EnemyTimer.Start(); EnemyTimer1.Start(); EnemyTimer2.Start(); EnemyTimer3.Start(); EnemyTimer4.Start(); }
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)); }
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)); }
private void addSkills6() { EnemyTimer rmvOnPlayer = EnemyTimer.Create(() => true, 6f, -1, skillTrans); rmvOnPlayer.addRmvSkill((Orb o) => o.isDigit() && o.isEven()); skillList.Add(rmvOnPlayer); Func <ORB_VALUE, OrbSpawnRate> decreasedEvens = (ORB_VALUE orbVal) => { if ((int)orbVal <= 9) { return((int)orbVal % 2 == 0 ? OrbSpawnRate.DECREASED : OrbSpawnRate.INCREASED); } return(Board.getDefaultOrbSpawnRates()[(int)orbVal]); }; skillList.Add(EnemyOrbSkill.Create(() => true, decreasedEvens, -1, skillTrans)); Func <bool> wtu = () => GameController.Instance.getCurrEnemies().Count == 1 ? GameController.Instance.isTurnMod(2) : false; EnemyBoardSkill set369ToEmpty = EnemyBoardSkill.MarkIfSkill(wtu, (Orb o) => o.getOrbValue() == ORB_VALUE.THREE || o.getOrbValue() == ORB_VALUE.SIX || o.getOrbValue() == ORB_VALUE.NINE, 0.1f, skillTrans); set369ToEmpty.addSetSkill(0.1f, (Orb o) => ORB_VALUE.EMPTY); skillList.Add(set369ToEmpty); EnemyBoardSkill markAll = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(3, 1), (Orb o) => true, 0.1f, skillTrans); skillList.Add(markAll); Func <int> getDmg = () => { List <Orb> markedOrbs = Board.Instance.getAllMarkedOrbsBy(getSkillID(markAll, markAll.getActivatedTurn()), null); int sum = 0; foreach (Orb o in markedOrbs) { if (o.isDigit()) { sum += o.getIntValue(); } } return(sum * -6); }; skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(3, 1), false, () => Player.Instance.gameObject, getDmg, skillTrans)); }
private void Form1_KeyDown(object sender, KeyEventArgs e) { lf = true; if (e.KeyCode == Keys.Left && !CheckCollision()) { Anime.Start(); P1.Location = new Point(P1.Location.X - 4, P1.Location.Y); } else if (e.KeyCode == Keys.Left && CheckCollision()) { P1.Location = new Point(P1.Location.X + 4, P1.Location.Y); } if (e.KeyCode == Keys.Right && !CheckCollision()) { AnimeRight.Start(); P1.Location = new Point(P1.Location.X + 5, P1.Location.Y); } else if (e.KeyCode == Keys.Right && CheckCollision()) { P1.Location = new Point(P1.Location.X - 4, P1.Location.Y); } if (e.KeyCode == Keys.Up && !CheckCollision()) { P1.Location = new Point(P1.Location.X, P1.Location.Y - 5); AnimeUp.Start(); } else if (e.KeyCode == Keys.Up && CheckCollision()) { P1.Location = new Point(P1.Location.X, P1.Location.Y + 4); } if (e.KeyCode == Keys.Down && !CheckCollision()) { P1.Location = new Point(P1.Location.X, P1.Location.Y + 5); AnimeDown.Start(); } else if (e.KeyCode == Keys.Down && CheckCollision()) { P1.Location = new Point(P1.Location.X, P1.Location.Y - 4); } if (e.KeyCode == Keys.Z && bomb.Visible == false) { bomb.Image = Properties.Resources.graphics_bombs_934360; bomb.Location = P1.Location; bomb.Visible = true; BombTimer.Start(); } if (e.KeyCode == Keys.P) { ExplosionTimer.Stop(); EnemyTimer.Stop(); EnemyTimer1.Stop(); EnemyTimer2.Stop(); EnemyTimer3.Stop(); EnemyTimer4.Stop(); BombTimer.Stop(); label2.Visible = true; pictureBox29.Visible = true; P1.Visible = false; bomb.Visible = false; explosion1.Visible = false; explosion2.Visible = false; explosion3.Visible = false; explosion4.Visible = false; } if (e.KeyCode == Keys.R) { EnemyTimer.Start(); EnemyTimer1.Start(); EnemyTimer2.Start(); EnemyTimer3.Start(); EnemyTimer4.Start(); label2.Visible = false; pictureBox29.Visible = false; P1.Visible = true; } //if ((P1.Bounds.IntersectsWith(enemy1.Bounds) && enemy1.Visible == true) || (P1.Bounds.IntersectsWith(enemy2.Bounds) && enemy2.Visible == true) || (P1.Bounds.IntersectsWith(enemy3.Bounds) && enemy3.Visible == true) || (P1.Bounds.IntersectsWith(enemy4.Bounds) && enemy4.Visible == true) || (P1.Bounds.IntersectsWith(enemy5.Bounds) && enemy5.Visible == true)) ////if (explosion1.Visible && P1.Bounds.IntersectsWith(explosion1.Bounds) || explosion2.Visible && P1.Bounds.IntersectsWith(explosion2.Bounds) || explosion3.Visible && P1.Bounds.IntersectsWith(explosion3.Bounds) || explosion4.Visible && P1.Bounds.IntersectsWith(explosion4.Bounds)) //{ // DEAD3.Visible = true; // P1.Dispose(); // stopall(); // MessageBox.Show("YOU SUCK!"); // Form home = new Form2(); // this.Hide(); // home.Show(); //} else if (enemy1.Visible == false && enemy2.Visible == false && enemy3.Visible == false && enemy4.Visible == false && enemy5.Visible == false) { MessageBox.Show("YOU WON!"); Form home = new Form2(); this.Hide(); home.Show(); } }
private void StopEnemyMoving() { EnemyTimer.Stop(); }
private void addHardSkill(int index) { System.Random rand = new System.Random(getRandomSeedByFloor()); Func <bool> wtu = () => true; Func <ORB_VALUE, OrbSpawnRate> newSpawnRates; bool markZeroAndFives = currState.number % 5 == 0; bool isAnti = RNG.Next(2) == 0; switch (index) { case 0: int numNullify = rand.Next(1, 3); wtu = () => GameController.Instance.isTurnMod(2 * numNullify, RNG.Next(numNullify)); Func <Orb, bool> randZeros = (Orb o) => { List <Orb> currZeros = new List <Orb>(); for (int i = 0; i < Board.COLUMNS; i++) { for (int j = 0; j < Board.ROWS; j++) { Orb z = Board.Instance.getOrb(i, j); if (z.getOrbValue() == ORB_VALUE.ZERO) { currZeros.Add(z); } } } for (int i = 0; i < numNullify && currZeros.Count > 0; i++) { int orb = rand.Next(currZeros.Count); if (currZeros[orb] == o) { return(true); } currZeros.RemoveAt(orb); } return(false); }; EnemyBoardSkill zerosToNullify = EnemyBoardSkill.MarkIfSkill(wtu, randZeros, 0.1f, skillTrans); zerosToNullify.addSetSkill(0.1f, (Orb o) => ORB_VALUE.NULLIFY); skillList.Add(zerosToNullify); break; case 1: int numOrbReduce = rand.Next(1, 4); newSpawnRates = (ORB_VALUE orbVal) => { if (markZeroAndFives) { return(orbVal == ORB_VALUE.ZERO || orbVal == ORB_VALUE.FIVE ? OrbSpawnRate.DECREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal]); } return(orbVal <= ORB_VALUE.NINE && (int)orbVal % 2 == 0 ? OrbSpawnRate.DECREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal]); }; wtu = () => GameController.Instance.isTurnMod(2 * numOrbReduce, RNG.Next(numOrbReduce)); skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, numOrbReduce, skillTrans)); break; case 2: wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3)); Func <Orb, bool> evensOrFives = (Orb o) => o.isDigit() && o.getIntValue() % (markZeroAndFives ? 5 : 2) == 0; EnemyBoardSkill clearEvensOrFives = EnemyBoardSkill.MarkIfSkill(wtu, evensOrFives, 0.1f, skillTrans); clearEvensOrFives.addRmvSkill(0); skillList.Add(clearEvensOrFives); break; case 3: wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3)); EnemyBoardSkill replaceWithAntiOrStop = null; replaceWithAntiOrStop = EnemyBoardSkill.MarkOrderSkill(wtu, () => getRandomPattern(replaceWithAntiOrStop), 0.1f, skillTrans, 1); replaceWithAntiOrStop.addSetSkill(0.1f, (Orb o) => isAnti ? ORB_VALUE.POISON : ORB_VALUE.STOP); skillList.Add(replaceWithAntiOrStop); break; case 4: wtu = () => GameController.Instance.isTurnMod(4, RNG.Next(4)); EnemyBoardSkill emptyFourLines = null; emptyFourLines = EnemyBoardSkill.MarkOrderSkill(wtu, () => getFourLines(emptyFourLines), 0.1f, skillTrans, 1); emptyFourLines.addSetSkill(0.1f, (Orb o) => ORB_VALUE.EMPTY); skillList.Add(emptyFourLines); break; case 5: wtu = () => GameController.Instance.isTurnMod(3, RNG.Next(3)); EnemyBoardSkill allHealsToAntiOrStop = EnemyBoardSkill.MarkIfSkill(wtu, (Orb o) => o.getOrbValue() == ORB_VALUE.ZERO, 0.1f, skillTrans, 1); allHealsToAntiOrStop.addSetSkill(0.1f, (Orb o) => isAnti ? ORB_VALUE.POISON : ORB_VALUE.STOP); skillList.Add(allHealsToAntiOrStop); break; case 6: int numNoneZeroTurns = rand.Next(1, 3); newSpawnRates = (ORB_VALUE orbVal) => orbVal == ORB_VALUE.ZERO ? OrbSpawnRate.NONE : Board.getDefaultOrbSpawnRates()[(int)orbVal]; wtu = () => GameController.Instance.isTurnMod(2 * numNoneZeroTurns, RNG.Next(numNoneZeroTurns)); skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, numNoneZeroTurns, skillTrans)); break; case 7: int antiOrStop = rand.Next(2, 4); newSpawnRates = (ORB_VALUE orbVal) => orbVal == (antiOrStop == 2 ? ORB_VALUE.POISON : ORB_VALUE.STOP) ? OrbSpawnRate.INCREASED : Board.getDefaultOrbSpawnRates()[(int)orbVal]; wtu = () => GameController.Instance.isTurnMod(antiOrStop, RNG.Next(antiOrStop - 1)); skillList.Add(EnemyOrbSkill.Create(wtu, newSpawnRates, 1, skillTrans)); break; case 8: int numTimerTurns = rand.Next(1, 3); wtu = () => GameController.Instance.isTurnMod(2 * numTimerTurns, RNG.Next(numTimerTurns)); EnemyTimer numDOT = EnemyTimer.Create(wtu, Mathf.Clamp(currState.number / 10f, 0f, 10f), numTimerTurns, skillTrans); numDOT.addDOTSkill(() => - currState.number); skillList.Add(numDOT); break; case 9: int numDecrement = rand.Next(1, 4); wtu = () => GameController.Instance.isTurnMod(numDecrement + 2, RNG.Next(numDecrement)); EnemyBoardSkill decrementPattern = null; decrementPattern = EnemyBoardSkill.MarkOrderSkill(wtu, () => getRandomPattern(decrementPattern), 0.1f, skillTrans, numDecrement); decrementPattern.addIncSkill(0.1f, (Orb o) => - numDecrement); skillList.Add(decrementPattern); break; } }