protected MoveResult AttemptMove(Wrestler attackingWrestler, Wrestler receivingWrestler, IMove move, MoveType moveType) { MoveResult result = MoveResult.NORMAL; switch (moveType) { case MoveType.NORMAL: result = attackingWrestler.AttemptMove(receivingWrestler, (MoveData)move); break; case MoveType.SIGNATURE: result = attackingWrestler.AttemptSignature(receivingWrestler, (SpecialMove)move); break; case MoveType.FINISHER: result = attackingWrestler.AttemptFinisher(receivingWrestler, (SpecialMove)move); break; } string textToBuffer = null; MoveData moveData = move.GetMove(); switch (result) { case MoveResult.NORMAL: textToBuffer = moveData.description; if (move is SpecialMove) { textToBuffer += " executing the {Move}"; } break; case MoveResult.BLOCKED: textToBuffer = "{Receiver} blocked the {Move} attempt from {Attacker}"; break; case MoveResult.COUNTERED: textToBuffer = "{Receiver} countered {Attacker}'s {Move} attempt"; break; case MoveResult.DODGED: textToBuffer = "{Receiver} dodged {Attacker}'s {Move} attempt"; break; } textToBuffer = FormatText(textToBuffer, attackingWrestler, receivingWrestler, move); Output.AddToOutput(textToBuffer); return(result); //MoveResult is used as a return type so a subclass can decide what happens next }
private bool Step(int xPos, int yPos) { _currentIteration++; var currentSquare = _board.GetSquare(xPos, yPos); currentSquare.HasVisited = true; currentSquare.Value = _currentIteration; Console.WriteLine(_board.Draw()); if (_board.IsCovered()) { _resultPath = new List <Square>(); _resultPath.Add(_board.GetSquare(xPos, yPos)); return(true); } var moves = _move.GetMove(currentSquare); foreach (var move in moves) { bool result = Step(move.X, move.Y); if (result) { _resultPath.Add(currentSquare); return(true); } } Console.WriteLine(_board.Draw()); _currentIteration--; currentSquare.Value = 0; currentSquare.HasVisited = false; return(false); }
//Left public because in the future there may be match specific moves public MoveResult AttemptMove(Wrestler receivingWrestler, IMove move, float costMultiplier = 1) { float staminaCost = 0.4f * (byte)move.GetStaminaCost() * costMultiplier; float maxSuccessChance = myData.technique / staminaCost; //Without increasing this value, people with less technique than someone's counter stat can never ever land a move maxSuccessChance *= UsefulActions.ClampValue(GetStaminaAsAPercentage()) * 3; MoveData moveData = move.GetMove(); float damage = GetDamageByOffenceType(moveData) * staminaCost; damage = UsefulActions.RandomiseNumber(damage); ConsumeStamina(MOVE_BASE_STAMINA_COST * staminaCost); MoveResult result = receivingWrestler.ReceiveMove(maxSuccessChance, moveData, damage); receivingWrestler.ChangeTarget(this); //Without this, multi-man matches get kinda silly with someone getting beat up for free if (result == MoveResult.COUNTERED) { AddStun(receivingWrestler.GetCounterStunLength()); ChangePosition(moveData.reversalPosition); return(result); } if (result == MoveResult.NORMAL) { AddMomentum(MOVE_BASE_MOMENTUM_GAIN + damage / 50); //No charisma stat, simply made it so that wrestlers who hit harder gain more momentum } float moveTime = UsefulActions.RandomiseNumber(moveData.lowerMoveTime, moveData.upperMoveTime); //How long the move took AddCooldown(moveTime); receivingWrestler.AddStun(moveTime); return(result); }
/// <summary> /// The human player's action /// </summary> public PlayerAction GetAction(IMove moveProvider) { return(moveProvider.GetMove()); }