- Edited
I am trying to implement a new system, currently having some issues with it not being recognized, even when the global.property, custom property and stat have been implemented.
// Toughness system (in theory)
The concept for the Toughness system is to increase the mitigation damage from the player, depending on the current mitigation score. In order for this system to work, a couple of properties (global and custom) and a new player.stat (max_defense) must be set, to establish a link between properties.
First a Global property called “mitigation” must be created, this property must be a number. The Global property “mitigation” is the primary measure that will trigger each Toughness stage of the system. The custom property “Level Toughness” will set each Toughness stage, from 0 to 5.
example:
Level 0 Toughness:
Level 1 Toughness:
Level 2 Toughness:
Level 3 Toughness:
The purpose of creating the “Level Toughness” custom property, is to allow the player to check the stage of toughness they are currently set too. The next step is to create a new player stat called “max_defense”. The max_defense stat must be created, and the value must be higher than the defense value. The purpose of this new stat is to create the conditions necessary to implement a new formula called “percentage”. (edited)
The percentage formula takes the percentage the player wishes to add to the defense and multiplies this percentage by the max_defense amount. The result of this formula will then be added to the current defense value. This is why the max_defense must be higher than the defense value.
Example: if you want the player to take 91% of the damage, that means that the player is only getting a 9% mitigation boost. Therefore, the formula must reflect this parameter, and the structure would be the following:
($defense_amount = 0.09 * player.stat["max_defense"];) = the player taking 91% of the overall damage.
and then you add this number to the current defense:
player.stat["defense"] += $defense_amount;
So if you are using a value of 1000 for the max_defense and 100 for defense value, the 0.09 would be
0.09 * 1000 = 90 (this is the mitigation amount)
90 + 100 = 190 (this is the stat defense amount)
This means that if you take into consideration the damage logic currently establish by default in RIAB.
$stat_diff = $attacker.stat["attack"] - $defender.stat["defense"];
if ($stat_diff <= 0) then
$damage = random(0, 1);
elseif $weapon == null then
$damage = $stat_diff + random(-1, 1);
else
$damage = $stat_diff + random(-1, 1) + random($weapon.min_damage, $weapon.max_damage);
end;
if ($damage < 0) then
$damage = 0;
end;
return $damage```
Then the mitigation system increases the defender stat, which will reduce the return $damage, due to a higher defense amount in the $stat_dif equation.