private void HandleLaunch(BoardWar launcher, BoardWar victim, int player) { BoardWar.LaunchInfo lI = launcher.launchInfo; int invertedX = victim.width - lI.x - 1; int depth = victim.TakeDamage(invertedX, lI.len, lI.type); HandleLaunchAnimations(launcher, victim, depth, lI.type); if (depth > 0) { launcher.AddToScore(PD.GetScore(depth, lI.len, lI.bonus)); } if (player == 1 && player1Human || player == 2 && player2Human) { GameObject zGo = GetGameObject(Vector3.zero, "zGo", null, false, "Zapper"); ZappyGun z = zGo.AddComponent <ZappyGun>(); Vector3 pos = victim.GetMirror().GetScreenPosFromXY(invertedX, victim.GetHitDepth(invertedX, lI.len, lI.type)); z.Init(PD, lI.type, lI.len, launcher.GetScreenPosFromXY(lI.x, lI.topy), pos.y - 0.4f); zaps.Add(z); } if (player == 1 && player2Human || player == 2 && player1Human) { GameObject zGoMirror = GetGameObject(Vector3.zero, "zGoMirror", null, false, "Zapper"); ZappyGun mirrorZ = zGoMirror.AddComponent <ZappyGun>(); Vector3 pos = victim.GetScreenPosFromXY(invertedX, victim.GetHitDepth(invertedX, lI.len, lI.type)); mirrorZ.Init(PD, lI.type, lI.len, launcher.GetMirror().GetScreenPosFromXY(lI.x, lI.topy), pos.y - 0.4f, true); zaps.Add(mirrorZ); } launcher.AcceptLaunch(); }
public OnlinePlayer(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor) : base(mine, theirs, cursor) { state = 0; GameObject Persist = GameObject.Find("PersistData") as GameObject; PD = Persist.GetComponent <PersistData>(); opponent = (CSteamID)PD.onlineOpponentId; actionQueue = new List <AIAction>(); }
public AICore(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor, int difficulty = 0) { myBoard = mine; easyMode = false; enemyBoard = theirs; c = cursor; confused = 0; setUpDifficulty(difficulty); AdditionalSetup(); }
private depthInfo getTypeAndDepth(BoardWar board, int x) { int topy = board.GetHighestYAtX(x); int type = board.GetTopValueAtX(x); int depth = 1; for (int y = topy - 1; y >= 0; y--) { Tile val = board.GetValueAtXY(x, y); if (!val.IsDead() && val.GetColorVal() != type) { break; } depth++; } return(new depthInfo(x, type, depth, 0, topy)); }
private BoardMirror CreateBoardMirror(int player, BoardWar b1, BoardWar b2, bool show = true) { GameObject g = new GameObject("boardMirror" + player); g.AddComponent("BoardMirror"); BoardMirror m; if (specialMode || (player == 2 && PD.gameType == PersistData.GT.Campaign)) { m = g.AddComponent <BoardMirrorSpecial>(); } else { m = g.AddComponent <BoardMirror>(); } m.parent = b1; m.player = player; m.mirrorTop = b2; m.Setup(th, show); return(m); }
public void CreateAI(BoardWar myBoard, BoardWar theirBoard, int type, int difficulty = 0) { switch (type) { case (int)PersistData.GT.Training: AI = new TrainingAI(myBoard, theirBoard, this); break; case (int)PersistData.GT.Challenge: AI = new TrainingAI(myBoard, theirBoard, this); break; default: AI = new AIversion2(myBoard, theirBoard, this, difficulty); break; } if (type == (int)PersistData.GT.Training && difficulty == 2) { AI.forceState(3); } if (PD.GetSaveData().savedOptions["easymode"] == 1) { AI.EasyModo(); AI.boostDifficulty(difficulty); } }
protected depthInfoResults getTypesAndDepths(BoardWar board, bool includeOneLength, bool mirrorX, int currentX = -1) { depthInfo[] vals = new depthInfo[board.width]; int count = 0; for (int x = 0; x < board.width; x++) { depthInfo res = getTypeAndDepth(board, x); if (mirrorX) { res.x = board.width - 1 - x; } if (currentX >= 0) { res.distance = distanceBetweenTwoXCoords(x, currentX, board.width); } if (res.depth > 1 || includeOneLength) { vals[count++] = res; } } return(new depthInfoResults(vals, count)); }
private void HandleLaunchAnimations(BoardWar launcher, BoardWar victim, int damageDealt, int type) { CutsceneChar sender, receiver; if (launcher.player == 1) { sender = actor1; receiver = actor2; } else { sender = actor2; receiver = actor1; } if (damageDealt == 0) { if (victim.DidLastMoveBlockCurrentAttack()) { sender.DoReaction(CutsceneChar.Reaction.block, true); receiver.DoReaction(CutsceneChar.Reaction.block, false); } else { if (++launcher.misses < 2) { return; } sender.DoReaction(CutsceneChar.Reaction.miss2, true); receiver.DoReaction(CutsceneChar.Reaction.miss2, false); } if (PD.p2Char == PersistData.C.FuckingBalloon) { if (Random.value > 0.65f) { if (Random.value > 0.98f) { actor1.SayThingFromReaction(CutsceneChar.SpeechType.nonDamageNegative); } else { actor2.SayThingFromReaction(CutsceneChar.SpeechType.nonDamagePositive); } } } else { if (Random.value > 0.33f) { if (Random.value > 0.5f) { sender.SayThingFromReaction(CutsceneChar.SpeechType.nonDamageNegative); } else { receiver.SayThingFromReaction(CutsceneChar.SpeechType.nonDamagePositive); } } } return; } launcher.misses = 0; receiver.FlickerColor(type); if (firstLaunch) { firstLaunch = false; sender.DoReaction(CutsceneChar.Reaction.firstStrike, true); receiver.DoReaction(CutsceneChar.Reaction.firstStrike, false); } else if (damageDealt == 3) { sender.DoReaction(CutsceneChar.Reaction.combo3, true); receiver.DoReaction(CutsceneChar.Reaction.combo3, false); } else if (damageDealt == 2) { sender.DoReaction(CutsceneChar.Reaction.combo2, true); receiver.DoReaction(CutsceneChar.Reaction.combo2, false); } else if (launcher.chain >= 2) { sender.DoReaction(CutsceneChar.Reaction.hit3, true); receiver.DoReaction(CutsceneChar.Reaction.hit3, false); } else if (launcher.chain == 1) { sender.DoReaction(CutsceneChar.Reaction.hit2, true); receiver.DoReaction(CutsceneChar.Reaction.hit2, false); } else { sender.DoReaction(CutsceneChar.Reaction.hit, true); receiver.DoReaction(CutsceneChar.Reaction.hit, false); } if (Random.value > 0.33f) { if (Random.value > 0.5f) { sender.SayThingFromReaction(CutsceneChar.SpeechType.doDamage); } else { receiver.SayThingFromReaction(CutsceneChar.SpeechType.takeDamage); } } }
private depthPenetrateKill GetDepthAndKillForDisplay(BoardCursorCore launcherCur, BoardWar launcher, BoardWar victim) { int invertedx = victim.width - launcherCur.getX() - 1; int[] lengthType = launcher.GetLaunchDetails(launcherCur.getX()); launcher.UpdateBlockNexter(lengthType[0]); int topy = victim.GetHighestYAtX(invertedx); int d = victim.GetHitDepth(invertedx, lengthType[0], lengthType[1], topy); return(new depthPenetrateKill(d, d < topy, topy - d, victim.CanBeKilled(invertedx, lengthType[0]))); }
private BoardCursorBot GetBotCursor(int p, float o, int w, int h, TweenHandler th, BoardWar boardA, BoardWar boardB) { GameObject g = GetGameObject(Vector3.zero, "", null, false, "HUDText"); BoardCursorBot c = g.AddComponent <BoardCursorBot>(); c.SetPD(PD); c.xOffset = o; c.player = p; c.setWidthAndHeight(w, h); c.Setup(th, h, false || (PD.isDemo && p <= PD.demoPlayers)); c.CreateAI(boardA, boardB, (int)PD.gameType, (PD.isDemo?Random.Range(4, 9):PD.difficulty)); return(c); }
private BoardCursorActualCore CreatePlayerCursor(bool isHuman, float offset, int player, BoardWar b1, BoardWar b2, bool force2P = false) { BoardCursorActualCore c; if (isHuman || force2P) { if (tutorialAssist != null) { c = GetTutorialCursor(player, offset, width, height, th); } else { c = GetUserCursor(player, offset, width, height, th, !force2P); } if (player == 1) { c.SetController(PD.controller, PD.GetKeyBindings()); } else { c.SetController(PD.controller2, PD.GetKeyBindings(1)); } } else { c = GetBotCursor(player, offset, width, height, th, b1, b2); } return(c); }
private void CreateBoards(float p1Xoffset, float p2Xoffset) { paused = false; gameOver = false; board1 = CreateBoard(1, p1Xoffset); board2 = CreateBoard(2, p2Xoffset); }
public TrainingAI(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor) : base(mine, theirs, cursor) { state = 0; }
public void SetBoards(BoardWar b1, BoardWar b2) { bo1 = b1; bo2 = b2; }
private bool StillHasTypeAtPos(BoardWar board, int x, int type) { return(board.GetTopValueAtX(x) == type); }
public AIversion2(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor, int difficulty = 0) : base(mine, theirs, cursor, difficulty) { }