Turn-Based Battle - Damage Modifiers

9

Index

Features on these Courses

Attached Files

The following files have been attached to this tutorial:

.c3p

tb-battle-arraycritmods.c3p

Download now 172.88 KB

Stats

3,436 visits, 6,298 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 18 May, 2021. Last updated 24 May, 2021
.C3P

tb-battle-arraycritmods.c3p

Download now 172.88 KB

Going back to the Pokemon Calculation, the modifier adds in a load of other effects to change the damage output of an attack. They include things like effects due to weather, how many targets a move will hit, attack bonuses, critical hits and the random element we talked about in the last section. If a particular modifier is not in effect, it has a value of 1 so it doesn't change the overall calculation.

In the example from the Damage Calculation tutorial, we simply moved the random expression to the Damage Modifier function, instead of being in the main calculation.

In this tutorial, we're going to expand this function to work with an array. It can then be used for both the player and the opponent's damage modifier calculations thanks to a parameter. The array will store the stats for the two combatants as well as any modifiers the system needs to use – in this example there will be two in use: a Standard modifier and a Critical Chance. In the array, the standard modifier value is the actual value used in the modifier calculation, whereas the Critical Chance value is used to store the number used in the random number check to trigger a critical hit.

To go with the Critical Hit check, there is a CriticalHit Boolean to track if a critical hit has been triggered and a global constant number CRITMODIFIER to store the modifier value for the boost in critical hit damage.

  • 0 Comments

Want to leave a comment? Login or Register an account!