GameLogic
 All Data Structures Files Functions Variables Friends
Public Member Functions
gameController::Shot Class Reference

#include <Action.h>

Inheritance diagram for gameController::Shot:
gameController::Action

Public Member Functions

 Shot (std::shared_ptr< gameModel::Environment > env, std::shared_ptr< gameModel::Player > actor, std::shared_ptr< gameModel::Ball > ball, gameModel::Position target)
 
auto execute () const -> std::pair< std::vector< ActionResult >, std::vector< gameModel::Foul >>
 
auto successProb () const -> double override
 
auto check () const -> ActionCheckResult override
 
auto executeAll () const -> std::vector< std::pair< std::shared_ptr< gameModel::Environment >, double >> override
 
auto isShotOnGoal () const -> std::optional< ActionResult >
 
auto shotType () const -> std::optional< communication::messages::types::DeltaType >
 
const std::shared_ptr< const
gameModel::Ball
getBall () const
 
- Public Member Functions inherited from gameController::Action
 Action ()=default
 
 Action (std::shared_ptr< gameModel::Environment > env, std::shared_ptr< gameModel::Player > actor, gameModel::Position target)
 
virtual ~Action ()=default
 
const gameModel::PositiongetTarget () const
 

Additional Inherited Members

- Protected Attributes inherited from gameController::Action
std::shared_ptr
< gameModel::Player
actor
 
std::shared_ptr
< gameModel::Environment
env
 
gameModel::Position target {}
 

Detailed Description

Represents actions with the game's balls except for the Snitch

Constructor & Destructor Documentation

gameController::Shot::Shot ( std::shared_ptr< gameModel::Environment env,
std::shared_ptr< gameModel::Player actor,
std::shared_ptr< gameModel::Ball ball,
gameModel::Position  target 
)

main constructor for the Shot class.

Parameters
envthe environment to operate on
actorthe acting player as shared pointer.
ballThe ball to be moved
targetthe target position of the shot.

Member Function Documentation

auto gameController::Shot::check ( ) const -> ActionCheckResult
overridevirtual

Checks if the Action is possible an if it may result in a foul

Returns
See ActionCheckResult

Implements gameController::Action.

auto gameController::Shot::execute ( ) const -> std::pair< std::vector< ActionResult >, std::vector< gameModel::Foul >>
virtual

executes the Action. Method is not deterministic.

Exceptions
std::runtime_exceptionif Action is impossible
Returns
List of ramifications from the action execution, list of fouls during the execution

Implements gameController::Action.

auto gameController::Shot::executeAll ( ) const -> std::vector< std::pair< std::shared_ptr< gameModel::Environment >, double >>
overridevirtual

Produces a list with all possible outcomes of the Action and the respective transition probabilities.

Returns
List of pairs consisting of the resulting Environment and the probability of landing in that state

Implements gameController::Action.

const std::shared_ptr< const gameModel::Ball > gameController::Shot::getBall ( ) const

Getter

Returns
the ball of the Shot
auto gameController::Shot::isShotOnGoal ( ) const -> std::optional<ActionResult>

Checks if the defined Shot will result in a goal if it succeeds

Returns
an ActionResult with the appropriate message or nothing if no goal will be scored
auto gameController::Shot::shotType ( ) const -> std::optional<communication::messages::types::DeltaType>

Returns the type of Shot as DeltaType

Returns
either DeltaType::QUAFFLE_THROW, DeltaType::BLUDGER_BEATING, or nothing
auto gameController::Shot::successProb ( ) const -> double
overridevirtual

When throwing Quaffle, returns probability that ball lands on target. When shooting Bludger, returns probability of knocking out player on target.

Returns
probability for the shot to succeed

Implements gameController::Action.


The documentation for this class was generated from the following files: