Initial support for setting battle choices.
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		
							
								
								
									
										20
									
								
								src/Battling/TurnChoices/AttackTurnChoice.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/Battling/TurnChoices/AttackTurnChoice.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
#ifndef CREATURELIB_ATTACKTURNCHOICE_HPP
 | 
			
		||||
#define CREATURELIB_ATTACKTURNCHOICE_HPP
 | 
			
		||||
 | 
			
		||||
#include "BaseTurnChoice.hpp"
 | 
			
		||||
#include "../Models/LearnedAttack.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling{
 | 
			
		||||
    class AttackTurnChoice : public BaseTurnChoice {
 | 
			
		||||
        LearnedAttack* _attack;
 | 
			
		||||
    public:
 | 
			
		||||
        AttackTurnChoice(Creature* c) : BaseTurnChoice(c){}
 | 
			
		||||
 | 
			
		||||
        inline LearnedAttack* GetAttack() const{
 | 
			
		||||
            return _attack;
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_ATTACKTURNCHOICE_HPP
 | 
			
		||||
							
								
								
									
										21
									
								
								src/Battling/TurnChoices/BaseTurnChoice.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/Battling/TurnChoices/BaseTurnChoice.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
#ifndef CREATURELIB_BASETURNCHOICE_HPP
 | 
			
		||||
#define CREATURELIB_BASETURNCHOICE_HPP
 | 
			
		||||
 | 
			
		||||
#include "TurnChoiceKind.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling{
 | 
			
		||||
    class BaseTurnChoice {
 | 
			
		||||
        Creature* _user;
 | 
			
		||||
    protected:
 | 
			
		||||
        BaseTurnChoice(Creature* user) : _user(user){};
 | 
			
		||||
    public:
 | 
			
		||||
        virtual ~BaseTurnChoice() = default;
 | 
			
		||||
        [[nodiscard]] virtual TurnChoiceKind GetKind() const = 0;
 | 
			
		||||
        [[nodiscard]] inline Creature* GetUser() const{
 | 
			
		||||
            return _user;
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_BASETURNCHOICE_HPP
 | 
			
		||||
							
								
								
									
										17
									
								
								src/Battling/TurnChoices/PassTurnChoice.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/Battling/TurnChoices/PassTurnChoice.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
#ifndef CREATURELIB_PASSTURNCHOICE_HPP
 | 
			
		||||
#define CREATURELIB_PASSTURNCHOICE_HPP
 | 
			
		||||
 | 
			
		||||
#include "BaseTurnChoice.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling {
 | 
			
		||||
    class PassTurnChoice : public BaseTurnChoice{
 | 
			
		||||
    public:
 | 
			
		||||
        PassTurnChoice(Creature* c) : BaseTurnChoice(c){}
 | 
			
		||||
 | 
			
		||||
        TurnChoiceKind GetKind() const override {
 | 
			
		||||
            return TurnChoiceKind ::Pass;
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_PASSTURNCHOICE_HPP
 | 
			
		||||
							
								
								
									
										15
									
								
								src/Battling/TurnChoices/TurnChoiceKind.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/Battling/TurnChoices/TurnChoiceKind.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
#ifndef CREATURELIB_TURNCHOICEKIND_HPP
 | 
			
		||||
#define CREATURELIB_TURNCHOICEKIND_HPP
 | 
			
		||||
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling {
 | 
			
		||||
    enum class TurnChoiceKind : uint8_t {
 | 
			
		||||
        Pass,
 | 
			
		||||
        Attack,
 | 
			
		||||
        Item,
 | 
			
		||||
        Switch,
 | 
			
		||||
        RunAway
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
#endif //CREATURELIB_TURNCHOICEKIND_HPP
 | 
			
		||||
		Reference in New Issue
	
	Block a user