Skip to content

Commit

Permalink
EffectiveActorConditions track applied effects, fixes bug Zukero#119
Browse files Browse the repository at this point in the history
…and other issues

Up to now when an effect was applied to an actor it was applied to existing conditions of the same type but not tracked. This led to problems like Zukero#119 when a higher magnitude temporary condition removed a lower magnitude infinite condition.

Now all applied effects are tracked. All the data and logic regarding conditions is encapsulated in the EffectiveActorConditions class, which replaces the conditions member of the Actor class. Most of the logic is moved away from the ActorStatsController and all views now use the EffectiveActorConditions class.

The added information does not only prevent bugs but is also displayed to the user. So he knows how many effects are sources for the current conditions and if conditions will follow when the current conditions timeout.
All this does not apply to immunities; their behaviour is unchanged.

To try to make sure everything is working like intended two integration test classes were added which should address most usecases. The tests should be run manually when changing logic regarding the actor conditions to make sure everything is still working.

Manually testing (including rejuvenate, etc) is mandatory after merging this pull request.
  • Loading branch information
Chriz76 committed Jun 21, 2019
1 parent c4119fa commit b993143
Show file tree
Hide file tree
Showing 19 changed files with 800 additions and 258 deletions.
15 changes: 8 additions & 7 deletions AndorsTrail/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@
<!-- =========================================== -->
<!-- Added in v0.6.9 -->

<string name="actorinfo_currentconditions">Active conditions</string> <!-- Translated as: affliction / statuseffect / temporary effect -->
<string name="actorinfo_currentconditions">Active conditions (following conditions in sublines)</string> <!-- Translated as: affliction / statuseffect / temporary effect -->
<string name="actorcondition_info_removes_all">Removes all %1$s</string>
<string name="actorcondition_info_immunity">Immune to %1$s</string>
<string name="actorcondition_sources">, %1$d sources</string>
<string name="iteminfo_effect_chance_of">%1$s chance of %2$s</string>
<string name="iteminfo_effect_duration">(%1$d rounds)</string>

Expand Down Expand Up @@ -448,10 +449,10 @@
<string name="skill_prerequisite_other_skill">To level up this skill, you need at least level %1$d of the %2$s skill.</string>
<string name="skill_prerequisite_level">To level up this skill, you need at least experience level %1$d.</string>
<string name="skill_prerequisite_stat">To level up this skill, you need at least %1$d %2$s (base stats).</string>
<string name="skill_number_of_increases_one">You may select one skill to improve.</string>
<string name="skill_number_of_increases_several">You may select %1$d skills to improve.</string>
<string name="levelup_adds_new_skillpoint">This level also gives you a new skill point to spend!</string>

<string name="skill_number_of_increases_one">You may select one skill to improve.</string>
<string name="skill_number_of_increases_several">You may select %1$d skills to improve.</string>
<string name="levelup_adds_new_skillpoint">This level also gives you a new skill point to spend!</string>

<string name="loadsave_save_to_new_slot">Create new savegame slot</string>
<string name="loadsave_save_overwrite_confirmation_title">Overwrite savegame?</string>
<string name="loadsave_save_overwrite_confirmation">This savegame contains a different player name (%1$s) than your current player name (%2$s). Are you sure you want to overwrite this savegame?</string>
Expand All @@ -470,7 +471,7 @@

<string name="traitsinfo_base_max_hp">Max HP:</string>
<string name="traitsinfo_base_max_ap">Max AP:</string>
<string name="menu_save_saving_not_allowed_in_combat">Cannot save the game while in combat.</string>
<string name="menu_save_saving_not_allowed_in_combat">Cannot save the game while in combat.</string>

<string name="preferences_optimized_drawing_title">Optimized drawing</string>
<string name="preferences_optimized_drawing">Disable this if you see graphical artifacts. Enabling this option will make the game only redraw changed parts of the screen every frame.</string>
Expand Down Expand Up @@ -604,7 +605,7 @@
<string name="skill_longdescription_weapon_prof_1hsword">For each skill level, increases attack chance of rapiers, longswords and broadswords by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill.</string>
<string name="skill_longdescription_weapon_prof_2hsword">For each skill level, increases attack chance of two-handed swords by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill.</string>
<string name="skill_longdescription_weapon_prof_axe">For each skill level, increases attack chance of axes and greataxes by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill.</string>
<string name="skill_longdescription_weapon_prof_blunt">For each skill level, increases attack chance of bludgeoning weapons by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. This includes clubs, quarterstaves, maces, scepters, war hammers and giant hammers.</string>
<string name="skill_longdescription_weapon_prof_blunt">For each skill level, increases attack chance of bludgeoning weapons by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. This includes clubs, quarterstaves, maces, scepters, war hammers and giant hammers.</string>
<string name="skill_longdescription_weapon_prof_unarmed">When fighting without a weapon and shield, gain %1$d attack chance, %2$d damage potential and %3$d block chance per skill level.</string>
<string name="skill_longdescription_armor_prof_shield">Increase damage resistance by %1$d per skill level while having a shield equipped.</string>
<string name="skill_longdescription_armor_prof_unarmored">While fighting without having any piece of armor equipped, gain %1$d block chance per skill level. Items made of cloth are not considered as being armor.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void onClick(View arg0) {
world.model.player.baseTraits.maxHP = 500;
world.model.player.health.max = world.model.player.baseTraits.maxHP;
controllerContext.actorStatsController.setActorMaxHealth(world.model.player);
world.model.player.conditions.clear();
world.model.player.effectiveConditions.clear();
showToast(mainActivity, "DEBUG: hp set to max", Toast.LENGTH_SHORT);
}
})
Expand Down
Loading

0 comments on commit b993143

Please sign in to comment.