New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditions in Battles #815

Merged
merged 10 commits into from Mar 14, 2016

should fix negativ Damage on attack and condition appyement

  • Loading branch information...
Tondorian committed Mar 14, 2016
commit a9fdd28966ff871fbacd956848c7b85e4741cb12
@@ -457,7 +457,6 @@ bool Game_BattleAlgorithm::Normal::Execute() {
Reset();
int to_hit;
if (source->GetType() == Game_Battler::Type_Ally) {
Game_Actor* ally = static_cast<Game_Actor*>(source);
int hit_chance = source->GetHitChance();
@@ -483,12 +482,13 @@ bool Game_BattleAlgorithm::Normal::Execute() {
}
int effect = (source->GetAtk() / 2 - (*current_target)->GetDef() / 4);
if (effect < 0)
effect = 0;
int act_perc = (rand() % 40) - 20;
// Change rounded up
int change = (int)(std::ceil(effect * act_perc / 100.0));
effect += change;
if(effect < 0) {
effect = 0;
}
this->hp = (effect * (critical_hit ? 3 : 1) * (source->IsCharged() ? 2 : 1)) / ((*current_target)->IsDefending() ? 2 : 1);
if ((*current_target)->GetHp() - this->hp <= 0) {
View
@@ -341,27 +341,45 @@ int Game_Battler::ApplyConditions()
int src_sp = 0;
if (state.hp_change_type == state.ChangeType_lose) {
src_hp = -std::min(source_hp - 1, hp);
if(src_hp > 0) {
src_hp = 0;
}
}
else if(state.hp_change_type == state.ChangeType_gain) {
src_hp = std::min(source_hp, hp);
if(src_hp < 0) {
src_hp = 0;
}
}
else {
src_hp = 0;
}
if (state.sp_change_type == state.ChangeType_lose) {
source_sp = -std::min(source_sp, sp);
src_sp = -std::min(source_sp, sp);
if(src_sp > 0) {
src_sp = 0;
}
}
else if(state.sp_change_type == state.ChangeType_gain) {
source_sp = std::min(source_sp, sp);
src_sp = std::min(source_sp, sp);
if(src_sp < 0 ) {
src_sp = 0;
}

This comment has been minimized.

@Ghabry

Ghabry Mar 12, 2016

Member

RPG2k3 added RPG::State::ChangeType_gain, which is what you handle in your ELSE case. But RPG::State::ChangeType_none (No change at all) is not handled.

@Ghabry

Ghabry Mar 12, 2016

Member

RPG2k3 added RPG::State::ChangeType_gain, which is what you handle in your ELSE case. But RPG::State::ChangeType_none (No change at all) is not handled.

This comment has been minimized.

@Tondorian

Tondorian Mar 12, 2016

Member

in ChangeType_none case i only need to set src_s/hp = 0?

@Tondorian

Tondorian Mar 12, 2016

Member

in ChangeType_none case i only need to set src_s/hp = 0?

This comment has been minimized.

@Ghabry

Ghabry Mar 12, 2016

Member

Yeah, 0 change

@Ghabry

Ghabry Mar 12, 2016

Member

Yeah, 0 change

}
else {
source_sp = 0;
src_sp = 0;
}
this->ChangeHp(src_hp);
this->ChangeSp(src_sp);
damageTaken += src_hp;
}
return -damageTaken;
if(damageTaken < 0) {
return -damageTaken;
}
else {
return damageTaken;
}
}
ProTip! Use n and p to navigate between commits in a pull request.