private static void ShotResultOpposingPlayerModification(ref ShotResultProbabilities probabilities, PlayerMatchInstance playerAttacking, ShotType type) { // Now it's probably going to be where you put all the effects from the previous attack of the other player such as: // "After my smashes, your next attack is worst" or something like that //This is where you put the opposing player's defensive traits effect like //"The smashes against me are less strong" or something like this. }
//Constructor to be used by ShotMaker public Shot(int playerShooting, ShotType type, ShotCoord from, ShotCoord to, ShotResultProbabilities shotResultProbabilities, bool isServe, float shotTime) { this.playerShooting = playerShooting; this.type = type; this.from = from; this.to = to; this.shotResultProbabilities = shotResultProbabilities; this.shotTime = shotTime; }
public static Shot CreateShot(int playerShooting, Shot previousShot, Advantage advantage, ShotType previousShotType) { PlayerMatchInstance player = MatchEngine.Instance.GetPlayer(playerShooting); ShotType type = GenerateShotTypeProbabilities(previousShot.type, player).Calculate(); ShotCoord from = previousShot.to; ShotCoord to = CalculateShotCoord(GenerateShotCoordProbabilities(type, player)); ShotResultProbabilities shotResultProbabilities = GenerateShotResultProbabilities(to, playerShooting, type, advantage, previousShotType); float shotTime = ShotTime.GetTimeForType(type, MatchEngine.Instance.MatchPreferences); return(new Shot(playerShooting, type, from, to, shotResultProbabilities, false, shotTime)); }
private static void ShotResultAdvantageModification(ref ShotResultProbabilities probabilities, int playerShooting, Advantage advantage) { if (advantage.Player == playerShooting) { probabilities.AddCrit(ADVANTAGE_CRIT * advantage.Amount); } else { probabilities.AddFail(DISADVANTAGE_FAIL * advantage.Amount); } }
private static ShotResultProbabilities GenerateShotResultProbabilities(ShotCoord to, int playerShooting, ShotType type, Advantage advantage, ShotType previousShotType) { ShotResultProbabilities probabilities = ShotResultProbabilities.GetShotTypeResultProbabilities(type); ShotResultAttributesModification(ref probabilities, MatchEngine.Instance.GetPlayer(playerShooting), MatchEngine.Instance.GetOtherPlayer(playerShooting), type, previousShotType); ShotResultAdvantageModification(ref probabilities, playerShooting, advantage); ShotResultOpposingPlayerModification(ref probabilities, MatchEngine.Instance.GetPlayer(playerShooting), type); return(probabilities); }
public static Serve CreateServe(int playerShooting, Score score) { PlayerMatchInstance player = MatchEngine.Instance.GetPlayer(playerShooting); int points = GetPlayerServingPoints(playerShooting, score); ShotCoord from = GetFromForServing(points); ShotCoord to = GetToForServing(points); ShotType type = ShotType.LONG; ShotResultProbabilities shotResultProbabilities = GenerateShotResultProbabilities(playerShooting, type); float shotTime = ShotTime.GetTimeForType(type, MatchEngine.Instance.MatchPreferences); return(new Serve(playerShooting, type, from, to, shotResultProbabilities, shotTime)); }
private static void ShotResultAttributesModification(ref ShotResultProbabilities probabilities, PlayerMatchInstance playerShooting, PlayerMatchInstance playerDefending, ShotType shotType, ShotType previousShotType) { probabilities.AddCrit(GetCritFromAttribute(playerShooting, playerDefending, shotType, previousShotType)); //You calculate the difference between the atk of the atking player and the def of the defing player }
//------------------------------------------------------------------------------------------------------------------ // SHOT RESULTS //------------------------------------------------------------------------------------------------------------------ private static ShotResultProbabilities GenerateShotResultProbabilities(int playerShooting, ShotType type) { return(ShotResultProbabilities.GetShotTypeResultProbabilities(type)); }
public Serve(int playerShooting, ShotType type, ShotCoord from, ShotCoord to, ShotResultProbabilities shotResultProbabilities, float shotTime) : base(playerShooting, type, from, to, shotResultProbabilities, true, shotTime) { }