Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Gathered and turned the battle type speed factor magic numbers into c…

…onst.

I also renamed SEMI_WAIT into SEMI ACTIVE, which sounds more logical.
  • Loading branch information...
commit 0fddae0bfdc0f7081b64eb00beb14091a6ddf7fa 1 parent 45ddff8
Yohann Ferreira authored
2  dat/config/debug_battle.lua
View
@@ -24,7 +24,7 @@ function BootBattleTest()
-- Set the battle to wait, semi active or active
--battle:SetBattleType(hoa_battle.BattleMode.BATTLE_TYPE_WAIT);
- --battle:SetBattleType(hoa_battle.BattleMode.BATTLE_TYPE_SEMI_WAIT);
+ --battle:SetBattleType(hoa_battle.BattleMode.BATTLE_TYPE_SEMI_ACTIVE);
battle:SetBattleType(hoa_battle.BattleMode.BATTLE_TYPE_ACTIVE);
ModeManager:Push(battle, false, false);
12 src/modes/battle/battle.cpp
View
@@ -458,7 +458,7 @@ void BattleMode::Update() {
// that the command menu is open whenever we find a character in the command state. If the command menu is not open, we
// forcibly open it and make the player choose a command for the character so that the battle may continue.
if (!_last_enemy_dying
- && (_battle_type == BATTLE_TYPE_WAIT || _battle_type == BATTLE_TYPE_SEMI_WAIT)) {
+ && (_battle_type == BATTLE_TYPE_WAIT || _battle_type == BATTLE_TYPE_SEMI_ACTIVE)) {
for (uint32 i = 0; i < _character_actors.size(); i++) {
if (_character_actors[i]->GetState() == ACTOR_STATE_COMMAND) {
if (_state != BATTLE_STATE_COMMAND) {
@@ -805,18 +805,18 @@ void BattleMode::_Initialize() {
// We also factor the idle time using the battle type setting
// ACTIVE BATTLE
- float time_factor = 1.0f;
+ float time_factor = BATTLE_ACTIVE_FACTOR;
// WAIT battle type is always safe, since the character has got all the time
// he/she wants to think so we can dimish the idle time of character and jump
// right to the command status.
if (_battle_type == BATTLE_TYPE_WAIT)
- time_factor = 3.0f;
- // SEMI_WAIT battle type is a bit more dangerous as if the player is taking
+ time_factor = BATTLE_WAIT_FACTOR;
+ // SEMI_ACTIVE battle type is a bit more dangerous as if the player is taking
// too much time to think, the enemies will have slightly more chances to hit.
// Yet, the semi wait battles are far simpler than active ones, so we
// can make them relatively faster.
- else if (_battle_type == BATTLE_TYPE_SEMI_WAIT)
- time_factor = 1.5f;
+ else if (_battle_type == BATTLE_TYPE_SEMI_ACTIVE)
+ time_factor = BATTLE_SEMI_ACTIVE_FACTOR;
float proportion;
for (uint32 i = 0; i < _character_actors.size(); i++) {
10 src/modes/battle/battle.h
View
@@ -31,6 +31,7 @@
#include <list>
+struct B;
Yohann Ferreira Owner

Huh? Remove that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
namespace hoa_battle {
//! \brief Determines whether the code in the hoa_battle namespace should print debug statements or not.
@@ -48,12 +49,19 @@ enum BATTLE_TYPE {
BATTLE_TYPE_WAIT = 0,
//! Monsters will wait for characters to finish their command before attacking
//! but will move up until being ready anyway.
- BATTLE_TYPE_SEMI_WAIT = 1,
+ BATTLE_TYPE_SEMI_ACTIVE = 1,
//! The battle will continue progressing while player selects commands
BATTLE_TYPE_ACTIVE = 2,
BATTLE_TYPE_TOTAL = 3
};
+//! Tells the battle speed factor used in wait battle modes.
+const float BATTLE_WAIT_FACTOR = 3.0f;
+//! Tells the battle speed factor used in semi-active battle modes.
+const float BATTLE_SEMI_ACTIVE_FACTOR = 1.5f;
+//! Tells the battle speed factor used in active battle modes.
+const float BATTLE_ACTIVE_FACTOR = 1.0f;
+
/** ****************************************************************************
*** \brief A companion class to BattleMode that holds various multimedia data
***
8 src/modes/battle/battle_actors.cpp
View
@@ -220,10 +220,12 @@ void BattleActor::RegisterDamage(uint32 amount, BattleTarget* target) {
// Make the stun effect disappear faster depending on the battle type,
// to not advantage the attacker.
BattleMode* BM = BattleMode::CurrentInstance();
- if (BM->GetBattleType() == BATTLE_TYPE_SEMI_WAIT)
- stun_time /= 1.5f;
+ if (BM->GetBattleType() == BATTLE_TYPE_SEMI_ACTIVE)
+ stun_time /= BATTLE_SEMI_ACTIVE_FACTOR;
else if (BM->GetBattleType() == BATTLE_TYPE_WAIT)
- stun_time /= 3;
+ stun_time /= BATTLE_WAIT_FACTOR;
+ else if (BM->GetBattleType() == BATTLE_TYPE_ACTIVE)
+ stun_time /= BATTLE_ACTIVE_FACTOR;
_state_timer.StunTimer(stun_time);
// Run a shake effect for the same time.
2  src/modes/battle/battle_command.cpp
View
@@ -969,7 +969,7 @@ void CommandSupervisor::_UpdateCategory() {
// The only time we do not allow the player to abort the command menu is if they are running the battle with the "wait" setting active and the
// current character is in the command state. Under these circumstances, the player has to enter a command for this character before the battle
// is allowed to continue.
- if ((BM->GetBattleType() == BATTLE_TYPE_WAIT || BM->GetBattleType() == BATTLE_TYPE_SEMI_WAIT)
+ if ((BM->GetBattleType() == BATTLE_TYPE_WAIT || BM->GetBattleType() == BATTLE_TYPE_SEMI_ACTIVE)
&& (GetCommandCharacter()->GetState() == ACTOR_STATE_COMMAND)) {
BM->GetMedia().cancel_sound.Play();
}
2  src/modes/mode_bindings.cpp
View
@@ -630,7 +630,7 @@ void BindModeCode() {
// Battle settings
luabind::value("BATTLE_TYPE_INVALID", BATTLE_TYPE_INVALID),
luabind::value("BATTLE_TYPE_WAIT", BATTLE_TYPE_WAIT),
- luabind::value("BATTLE_TYPE_SEMI_WAIT", BATTLE_TYPE_SEMI_WAIT),
+ luabind::value("BATTLE_TYPE_SEMI_ACTIVE", BATTLE_TYPE_SEMI_ACTIVE),
luabind::value("BATTLE_TYPE_ACTIVE", BATTLE_TYPE_ACTIVE),
luabind::value("BATTLE_TYPE_TOTAL", BATTLE_TYPE_TOTAL)
]
Yohann Ferreira

Huh? Remove that

Please sign in to comment.
Something went wrong with that request. Please try again.