public SpecialMove GetSignature(PositionLayout requiredPosition) { if (signatures.ContainsKey(requiredPosition)) { List <SpecialMove> moveIDs = signatures [requiredPosition]; return(moveIDs [UsefulActions.RandomiseNumber(0, moveIDs.Count)]); } return(null); }
public bool CanUseSignature(PositionLayout requiredPosition) { if (signatures.ContainsKey(requiredPosition)) { if (signatures [requiredPosition].Count > 0) { return(true); } } return(false); }
public bool CanUseFinisher(PositionLayout requiredPosition) { if (finishers.ContainsKey(requiredPosition)) { if (finishers [requiredPosition].Count > 0) { return(true); } } return(false); }
public bool CanUseMove(PositionLayout requiredPosition) { if (favouriteMoves.ContainsKey(requiredPosition)) { if (favouriteMoves [requiredPosition].Count > 0) { return(true); } } if (normalMoves.ContainsKey(requiredPosition)) { if (normalMoves [requiredPosition].Count > 0) { return(true); } } return(false); }
public MoveData GetRandomMove(PositionLayout requiredPosition) { List <MoveData> moves = null; if (favouriteMoves.ContainsKey(requiredPosition) && UsefulActions.RandomiseChance(80)) { moves = favouriteMoves [requiredPosition]; } if (normalMoves.ContainsKey(requiredPosition)) { moves = normalMoves [requiredPosition]; } if (moves == null || moves.Count == 0) { return(null); } return(moves [UsefulActions.RandomiseNumber(0, moves.Count)]); }
public MoveResult AttemptMove(Wrestler receivingWrestler, float costMultiplier = 1) { PositionLayout currentLayout = GetCurrentPositionLayout(); return(AttemptMove(receivingWrestler, myData.myMoves.GetRandomMove(currentLayout), costMultiplier)); }
public MoveData GetMove() { PositionLayout currentLayout = GetCurrentPositionLayout(); return(myData.myMoves.GetRandomMove(currentLayout)); }
public SpecialMove GetSignature() { PositionLayout currentLayout = GetCurrentPositionLayout(); return(myData.myMoves.GetSignature(currentLayout)); }
public SpecialMove GetFinisher() { PositionLayout currentLayout = GetCurrentPositionLayout(); return(myData.myMoves.GetFinisher(currentLayout)); }
public WrestlerData(string textToParse) { /*string textToParse = File.ReadAllText (filePath); * if (textToParse.Length == 0) * throw new Exception ("File with path '" + filePath + "' is empty.");*/ string textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Name: "); name = textFromFile; textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Wrestling Style: "); wrestlingStyle = GetWrestlingStyle(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Weight: "); weight = ushort.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Grapple Strength: "); grappleStrength = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Striking Strength: "); strikingStrength = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Running Strength: "); runningStrength = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Diving Strength: "); divingStrength = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Heart: "); heart = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Health: "); health = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Health Recovery: "); healthRecovery = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Stamina: "); stamina = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Stamina Recovery: "); staminaRecovery = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Head Resistance: "); headResistance = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Torso Resistance: "); torsoResistance = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Arms Resistance: "); armResistance = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Legs Resistance: "); legResistance = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Technique: "); technique = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Speed: "); speed = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Block: "); block = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Counter: "); counter = float.Parse(textFromFile); textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Submission: "); submission = float.Parse(textFromFile); myMoves = new MoveList(); //Add moves to the moves list textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Finishers: "); while (textFromFile.Length > 1) { int indexOfComma = textFromFile.IndexOf(','); int indexOfIDStart = indexOfComma + 2; int indexOfEnd = textFromFile.IndexOf(']'); string specialMoveName = textFromFile.Substring(1, indexOfComma - 1); string moveIDText = textFromFile.Substring(indexOfIDStart, indexOfEnd - indexOfIDStart); ushort moveID = ushort.Parse(moveIDText); MoveData originalMove = MoveDictionary.GetMove(moveID); PositionLayout requiredPosition = new PositionLayout(originalMove.requiredPosition, originalMove.requiredOpponentPosition); myMoves.AddToFinishers(requiredPosition, moveID, specialMoveName); textFromFile = textFromFile.Remove(0, indexOfEnd + 1); if (textFromFile.Length != 0) { textFromFile = textFromFile.Remove(0, 2); } } textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Signatures: "); while (textFromFile.Length > 1) { int indexOfComma = textFromFile.IndexOf(','); int indexOfIDStart = indexOfComma + 2; int indexOfEnd = textFromFile.IndexOf(']'); string specialMoveName = textFromFile.Substring(1, indexOfComma - 1); string moveIDText = textFromFile.Substring(indexOfIDStart, indexOfEnd - indexOfIDStart); ushort moveID = ushort.Parse(moveIDText); MoveData originalMove = MoveDictionary.GetMove(moveID); PositionLayout requiredPosition = new PositionLayout(originalMove.requiredPosition, originalMove.requiredOpponentPosition); myMoves.AddToSignatures(requiredPosition, moveID, specialMoveName); textFromFile = textFromFile.Remove(0, indexOfEnd + 1); if (textFromFile.Length != 0) { textFromFile = textFromFile.Remove(0, 2); } } textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Favourite Moves: "); while (textFromFile.Length > 1) { int indexOfComma = textFromFile.IndexOf(','); if (indexOfComma == -1) { indexOfComma = textFromFile.Length - 1; } string moveIDText = textFromFile.Substring(0, indexOfComma); ushort moveID = ushort.Parse(moveIDText); MoveData originalMove = MoveDictionary.GetMove(moveID); PositionLayout requiredPosition = new PositionLayout(originalMove.requiredPosition, originalMove.requiredOpponentPosition); myMoves.AddToFavouriteMoves(requiredPosition, moveID); if (indexOfComma + 2 > textFromFile.Length) { break; } textFromFile = textFromFile.Remove(0, indexOfComma + 2); } textFromFile = UsefulActions.GetDataFromUnparsedFile(textToParse, "Normal Moves: "); while (textFromFile.Length > 1) { int indexOfComma = textFromFile.IndexOf(','); if (indexOfComma == -1) { indexOfComma = textFromFile.Length - 1; } string moveIDText = textFromFile.Substring(0, indexOfComma); ushort moveID = ushort.Parse(moveIDText); MoveData originalMove = MoveDictionary.GetMove(moveID); PositionLayout requiredPosition = new PositionLayout(originalMove.requiredPosition, originalMove.requiredOpponentPosition); myMoves.AddToMoves(requiredPosition, moveID); if (indexOfComma + 2 > textFromFile.Length) { break; } textFromFile = textFromFile.Remove(0, indexOfComma + 2); } }
private void AddToDictionary(Dictionary <PositionLayout, List <MoveData> > myDictionary, PositionLayout requiredPosition, ushort moveID) { MoveData move = MoveDictionary.GetMove(moveID); List <MoveData> moves = null; if (myDictionary.ContainsKey(requiredPosition)) { moves = myDictionary [requiredPosition]; moves.Add(move); //We're adding to a reference, so we do not have to readd the list to the dictionary return; } moves = new List <MoveData> (); moves.Add(move); myDictionary.Add(requiredPosition, moves); }
public void AddToMoves(PositionLayout requiredPosition, ushort moveID) { AddToDictionary(normalMoves, requiredPosition, moveID); }
public void AddToFavouriteMoves(PositionLayout requiredPosition, ushort moveID) { AddToDictionary(favouriteMoves, requiredPosition, moveID); }
public void AddToSignatures(PositionLayout requiredPosition, ushort moveID, string signatureName) { AddToSpecialMoveDictionary(signatures, requiredPosition, moveID, signatureName); }
public void AddToFinishers(PositionLayout requiredPosition, ushort moveID, string finisherName) { AddToSpecialMoveDictionary(finishers, requiredPosition, moveID, finisherName); }