- 2
- Posts
- 163
- Days
- Seen Nov 23, 2024
Hello there,
I'm currently scripting some new starters with a triple type. To make this more manageable and to make it easier for the player to utilize the STAB bonus I want to make an attack that can change its type to one of the three types of the user, which is most effective against the target.
I've been trying to use pbBaseType and pbCalcType and took inspiration of the calculations for effectiveness and the script of judgment.
The script I'm currently at is:
Some examples of how the attack should work:
I'm currently scripting some new starters with a triple type. To make this more manageable and to make it easier for the player to utilize the STAB bonus I want to make an attack that can change its type to one of the three types of the user, which is most effective against the target.
I've been trying to use pbBaseType and pbCalcType and took inspiration of the calculations for effectiveness and the script of judgment.
The script I'm currently at is:
Code:
class Battle::Move::TypeDependsOnTargetType < Battle::Move
def pbBaseType(user,target)
userTypes = user.pbTypes(true)
targetTypes = target.pbTypes(true)
bestType = Normal
effValue = 0.0
userTypes.each do |type|
effectiveness = pbCalcTypeModSingle(type, targetTypes, user, target)
if effectiveness > effValue
bestType = type
effValue = effectiveness
end
end
return bestType
end
end
Some examples of how the attack should work:
- If Charizard uses it against Heracross it would be flying-type
- If Charizard uses it against Tinkaton it would be fire-type
- If Charizard uses it against a Iron Thorns it would be fire-type due to Iron Thorns 4 times resistance against flying