From 6a3e02e15c1626958540626bf2ccf39f8e365ca5 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 3 Aug 2012 19:31:35 +0200 Subject: [PATCH] added battle/monster file structure --- Debug/makefile | 1 + Debug/sources.mk | 1 + Debug/src/battle/subdir.mk | 24 ++++++++++++ Release/makefile | 1 + Release/sources.mk | 1 + Release/src/battle/subdir.mk | 24 ++++++++++++ src/battle/Monster.cpp | 22 +++++++++++ src/battle/Monster.h | 76 ++++++++++++++++++++++++++++++++++++ 8 files changed, 150 insertions(+) create mode 100644 Debug/src/battle/subdir.mk create mode 100644 Release/src/battle/subdir.mk create mode 100644 src/battle/Monster.cpp create mode 100644 src/battle/Monster.h diff --git a/Debug/makefile b/Debug/makefile index 7439cad..253ef22 100644 --- a/Debug/makefile +++ b/Debug/makefile @@ -9,6 +9,7 @@ RM := rm -rf # All of the sources participating in the build are defined here -include sources.mk -include src/sdl/subdir.mk +-include src/battle/subdir.mk -include src/subdir.mk -include subdir.mk -include objects.mk diff --git a/Debug/sources.mk b/Debug/sources.mk index 414d559..8a951ac 100644 --- a/Debug/sources.mk +++ b/Debug/sources.mk @@ -25,4 +25,5 @@ C_UPPER_DEPS := SUBDIRS := \ src/sdl \ src \ +src/battle \ diff --git a/Debug/src/battle/subdir.mk b/Debug/src/battle/subdir.mk new file mode 100644 index 0000000..37e4161 --- /dev/null +++ b/Debug/src/battle/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/battle/Monster.cpp + +OBJS += \ +./src/battle/Monster.o + +CPP_DEPS += \ +./src/battle/Monster.d + + +# Each subdirectory must supply rules for building sources it contributes +src/battle/%.o: ../src/battle/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -I/usr/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Release/makefile b/Release/makefile index 7439cad..253ef22 100644 --- a/Release/makefile +++ b/Release/makefile @@ -9,6 +9,7 @@ RM := rm -rf # All of the sources participating in the build are defined here -include sources.mk -include src/sdl/subdir.mk +-include src/battle/subdir.mk -include src/subdir.mk -include subdir.mk -include objects.mk diff --git a/Release/sources.mk b/Release/sources.mk index 414d559..8a951ac 100644 --- a/Release/sources.mk +++ b/Release/sources.mk @@ -25,4 +25,5 @@ C_UPPER_DEPS := SUBDIRS := \ src/sdl \ src \ +src/battle \ diff --git a/Release/src/battle/subdir.mk b/Release/src/battle/subdir.mk new file mode 100644 index 0000000..213b6f0 --- /dev/null +++ b/Release/src/battle/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/battle/Monster.cpp + +OBJS += \ +./src/battle/Monster.o + +CPP_DEPS += \ +./src/battle/Monster.d + + +# Each subdirectory must supply rules for building sources it contributes +src/battle/%.o: ../src/battle/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -I/usr/include/SDL -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/src/battle/Monster.cpp b/src/battle/Monster.cpp new file mode 100644 index 0000000..1a52b79 --- /dev/null +++ b/src/battle/Monster.cpp @@ -0,0 +1,22 @@ +/* + * Monster.cpp + * + * Created on: Aug 3, 2012 + * Author: holy + */ + +#include "Monster.h" + +namespace battle { + +Monster::Monster() { + // TODO Auto-generated constructor stub + +} + +Monster::~Monster() { + // TODO Auto-generated destructor stub + +} + +} /* namespace battle */ diff --git a/src/battle/Monster.h b/src/battle/Monster.h new file mode 100644 index 0000000..adebbb2 --- /dev/null +++ b/src/battle/Monster.h @@ -0,0 +1,76 @@ +/* + * Monster.h + * + * Created on: Aug 3, 2012 + * Author: holy + */ + +#ifndef BATTLE_MONSTER_H_ +#define BATTLE_MONSTER_H_ + +#include + +namespace battle { + +class Monster { + +public: + Monster(); + ~Monster(); + +public: + const char *Name() const { return name; } + Uint8 Level() const { return level; } + const /* Sprite */ void *Sprite() const { return sprite; } + + Uint16 MaxHealth() const { return maxHealth; } + Uint16 Health() const { return health; } + int RelativeHealth(int max) { return health * max / maxHealth; } + + Uint16 MaxMana() const { return maxMana; } + Uint16 Mana() const { return mana; } + int RelativeMana(int max) { return mana * max / maxMana; } + + Uint16 Attack() const { return attack; } + Uint16 Defense() const { return defense; } + Uint16 Agility() const { return agility; } + Uint16 Intelligence() const { return intelligence; } + Uint16 Gut() const { return gut; } + Uint16 MagicResistance() const { return magicResistance; } + + Uint16 ExpReward() const { return expReward; } + Uint16 GoldReward() const { return goldReward; } + + const /* Item */ void *DropItem() const { return dropItem; } + Uint8 DropChance() const { return dropChance; } + + const /* Script */ void *AttackScript() { return attackScript; } + const /* Script */ void *DefenseScript() { return defenseScript; } + +private: + const char *name; + /* Sprite */ void *sprite; + /* Item */ void *dropItem; + /* Script */ void *attackScript; + /* Script */ void *defenseScript; + + Uint16 maxHealth, health; + Uint16 maxMana, mana; + + Uint16 attack; + Uint16 defense; + Uint16 agility; + Uint16 intelligence; + Uint16 gut; + Uint16 magicResistance; + + Uint16 expReward, goldReward; + + Uint8 level; + Uint8 dropChance; + +}; + +} + +#endif /* BATTLE_MONSTER_H_ */ -- 2.39.2