public MoveLog GetPhysicalDamage(UserChar enemy) { MoveLog moveLog = new MoveLog { type = "Damage", current = id, target = enemy.id }; if (GetRandomFloat(1.0F, 100.0F) > evadeChance) { moveLog.damage = (int)(enemy.physicalDamage * (0.9F * enemy.strength + (0.002F * enemy.strength * GetRandomFloat(0.0F, 100.0F)))); Console.WriteLine(GetRandomFloat(1.0F, 100.0F) + "|" + enemy.criticalChance); if (GetRandomFloat(1.0F, 100.0F) < enemy.criticalChance) { Console.WriteLine(moveLog.damage); moveLog.damage = (int)((moveLog.damage * enemy.criticalDamage)); Console.WriteLine(moveLog.damage); moveLog.isCritical = true; } float totalArmor = armor - enemy.armorPenetration; if (totalArmor < 0) { totalArmor = 0; } moveLog.damage = (int)(moveLog.damage * (100 - totalArmor) / 100); health -= moveLog.damage; moveLog.heal = (int)(moveLog.damage * enemy.healthSteal / 100); enemy.health += moveLog.heal; if (moveLog.isCritical) { Console.WriteLine(id + ": critical damage " + moveLog.damage); } else { Console.WriteLine(id + ": damage " + moveLog.damage); } if (moveLog.heal > 0) { Console.WriteLine(enemy.id + ": health steal " + moveLog.heal); } return(moveLog); } else { moveLog.isEvaded = true; Console.WriteLine(id + " evaded."); } return(moveLog); }
internal static GameState StartNewGame() { GameLogic.ClearList(); MoveLog.StartNewLog(); var moveList = GameLogic.MoveList; var gameState = GenerateGameState(moveList); return(gameState); }
public void WriteMove_legt_LogFile_mit_korrektem_Inhalt_an() { var logFileName = MoveLog.StartNewLog(); MoveLog.WriteMove((1, 2)); var fileContent = File.ReadAllLines(logFileName); Assert.That(fileContent.Length, Is.EqualTo(1)); Assert.That(fileContent[0], Is.EqualTo("1;2")); }
public MoveLog GetMagicalDamage(UserChar enemy) { MoveLog moveLog = new MoveLog { type = "MagicalDamage", current = enemy.id, target = id }; Console.WriteLine(GetRandomFloat(1.0F, 100.0F)); if (GetRandomFloat(1.0F, 100.0F) > evadeChance) { moveLog.damage = (int)(enemy.magicalDamage * (0.9F * enemy.intelligence + (0.002F * enemy.intelligence * GetRandomFloat(0.0F, 100.0F)))); if (GetRandomFloat(1.0F, 100.0F) < enemy.criticalChance) { moveLog.damage = (int)(moveLog.damage * (float)enemy.criticalDamage); moveLog.isCritical = true; } moveLog.damage = (int)(moveLog.damage * (100 - magicResistance) / 100); health -= moveLog.damage; moveLog.heal = (int)(moveLog.damage * enemy.healthSteal / 100); enemy.health += moveLog.heal; if (moveLog.isCritical) { Console.WriteLine(id + ": critical damage " + moveLog.damage); } else { Console.WriteLine(id + ": damage " + moveLog.damage); } if (moveLog.heal > 0) { Console.WriteLine(enemy.id + ": health steal " + moveLog.heal); } return(moveLog); } else { moveLog.isEvaded = true; Console.WriteLine(id + " evaded."); } return(moveLog); }
public virtual MoveLog PureHeal(UserChar teamMate, int heal) { MoveLog moveLog = new MoveLog { type = "PureHeal", current = id, target = teamMate.id }; moveLog.heal = (int)(0.9F * heal + (0.002F * heal * GetRandomFloat(0.0F, 100.0F))); teamMate.health += moveLog.heal; Console.WriteLine(teamMate.id + ": Pure heal " + moveLog.heal); return(moveLog); }
PhaseLog[] ResolveCombat(MoveData[] moveDatas) { PhaseLog[] phaseLogs = new PhaseLog[moveDatas.Length]; for (int i = 0; i < moveDatas.Length; i++) { MoveData moveData = moveDatas[i]; Piece piece = moveData.piece; Move.Direction direction = moveData.direction; // where the piece is during combat Square combatSquare = moveData.isBounce ? moveData.nextSquare : moveData.currentSquare; // check for attackers List <MoveData> attackedBy = new List <MoveData>(); foreach (MoveData otherMoveData in moveDatas) { Piece otherPiece = otherMoveData.piece; if (piece == otherPiece) { continue; } if (otherMoveData.direction == Move.Direction.NONE) { continue; } if (piece.owner == otherPiece.owner) { continue; } Square attackingSquare = otherMoveData.nextSquare; if (combatSquare == attackingSquare) { attackedBy.Add(otherMoveData); } } // Create Phase Log Here List <AttackLog> attackLogs = ApplyAndRecordDamage(piece, attackedBy); Square finalSquare = moveData.isBounce ? moveData.currentSquare : combatSquare; MoveLog moveLog = new MoveLog(combatSquare, finalSquare); PhaseLog phaseLog = new PhaseLog(piece, moveLog, attackLogs.ToArray()); phaseLogs[i] = phaseLog; } return(phaseLogs); }
// Use this for initialization void Start() { Instance = this; blackCam.enabled = false; Camera.main.enabled = true; //starting timer // StartCoroutine("LoseTime"); notationsToggleUI = GameObject.FindGameObjectWithTag("NotationsToggle"); notationsToggle = notationsToggleUI.GetComponent <Toggle>(); log = GetComponent <MoveLog>(); GameObject player1 = GameObject.FindGameObjectWithTag("Player1"); player1emote = player1.GetComponent <EmoteController>(); GameObject player2 = GameObject.FindGameObjectWithTag("Player2"); player2emote = player2.GetComponent <EmoteController>(); setPrefs(); _core = new GameCore(whitePlayer, blackPlayer, boardTokens); if (whitePlayer == PlayerType.AI || blackPlayer == PlayerType.AI) { _core.SetDifficulty(_isHardMode); } _capturedPiece = null; _foreignMoveCompleted = false; if (whitePlayer == PlayerType.Network || blackPlayer == PlayerType.Network) { netController = GameObject.FindGameObjectWithTag("network").GetComponent <NetworkControl>(); netController.SetBoardManager(this); SetNetworkStuff(); } if (whitePlayer != PlayerType.Local) { GetMove(); AnimateAvatars(2); } else { AnimateAvatars(1); } //set the clip the effectSource uses //WILL NOT WORK IF DO NOT START AT MAIN MENU GameObject Audio = GameObject.FindGameObjectWithTag("Audio"); effectSource = Audio.GetComponent <MusicInfo>().effectsSource.GetComponent <AudioSource>(); timeoutPanel = GameObject.FindGameObjectWithTag("timeoutPanel"); if (timeoutPanel) { timeoutPanel.SetActive(false); } }