- 2
- Posts
- 10
- Years
- Seen Aug 2, 2023
Hello! I'm attempting to change the Multitype ability so that it acts the same as the anime/movies. I know for someone who has little to no experience with ruby that this is probably going to be a huge headache, but I was hoping someone here might be able to point me in the right direction. For reference I'm using Essentials v15.1.
The general idea is that as long as the player has the corresponding plate, Arceus will change to a type that gives 1/2 or 0 damage, eg., if the attack is psychic and you own the dread plate Arceus will change it's type to dark before damage is calculated and then return to normal type after damage is calculated. The form (sprite) change seems very simple to do, but the tough part for me is figuring out how to change the type and then where to place the new lines so that it operates properly before and after the damage calculation.
So far I'm looking at the script for the Color Change ability. It seems like this is the closest ability to what I'm trying to do. The biggest differences are that it needs to change to a different type based on the attack's type, not to the attack's type itself, and it needs to initiate before the damage is calculated, not after. I'm foreseeing lots of if/else statements for each possible type and presence of plates, but I think most of it should be extremely repetitive.
# Color Change
movetype=thismove.pbType(thismove.type,user,target)
if target.hasWorkingAbility(:COLORCHANGE) && totaldamage>0 &&
!PBTypes.isPseudoType?(type) && !target.pbHasType?(movetype)
target.type1=movetype
target.type2=movetype
@battle.pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,
PBAbilities.getName(target.ability),PBTypes.getName(movetype)))
PBDebug.log("[#{target.pbThis}'s Color Change made it #{PBTypes.getName(movetype)}-type]")
end
So far I'm imagining something like this for before the damage is calculated:
# Multitype
movetype=thismove.pbType(thismove.type,user,target)
if target.hasWorkingAbility(:MULTITYPE) && !PBTypes.isPseudoType?(type)
if movetype=PSYCHIC && $PokemonBag.pbQuantity(:DREADPLATE)>0
target.type1=DARK
target.type2=DARK
self.form=17
transformed=true
elseif movetype=PSYCHIC && $PokemonBag.pbQuantity(:IRONPLATE)>0
target.type1=STEEL
target.type2=STEEL
self.form=8
transformed=true
elseif movetype=PSYCHIC && $PokemonBag.pbQuantity(:MINDPLATE)>0
target.type1=PSYCHIC
target.type2=PSYCHIC
self.form=14
transformed=true
elseif movetype=NORMAL && $PokemonBag.pbQuantity(:SPOOKYPLATE)>0
target.type1=GHOST
target.type2=GHOST
self.form=7
transformed=true
# This pattern continues for all type and plate combinations
@battle.pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,
PBAbilities.getName(target.ability),PBTypes.getName(movetype)))
PBDebug.log("[#{target.pbThis}'s Multitype made it #{PBTypes.getName(movetype)}-type]")
end
As you can see I'm very lost. Any advice is greatly appreciated!
The general idea is that as long as the player has the corresponding plate, Arceus will change to a type that gives 1/2 or 0 damage, eg., if the attack is psychic and you own the dread plate Arceus will change it's type to dark before damage is calculated and then return to normal type after damage is calculated. The form (sprite) change seems very simple to do, but the tough part for me is figuring out how to change the type and then where to place the new lines so that it operates properly before and after the damage calculation.
So far I'm looking at the script for the Color Change ability. It seems like this is the closest ability to what I'm trying to do. The biggest differences are that it needs to change to a different type based on the attack's type, not to the attack's type itself, and it needs to initiate before the damage is calculated, not after. I'm foreseeing lots of if/else statements for each possible type and presence of plates, but I think most of it should be extremely repetitive.
# Color Change
movetype=thismove.pbType(thismove.type,user,target)
if target.hasWorkingAbility(:COLORCHANGE) && totaldamage>0 &&
!PBTypes.isPseudoType?(type) && !target.pbHasType?(movetype)
target.type1=movetype
target.type2=movetype
@battle.pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,
PBAbilities.getName(target.ability),PBTypes.getName(movetype)))
PBDebug.log("[#{target.pbThis}'s Color Change made it #{PBTypes.getName(movetype)}-type]")
end
So far I'm imagining something like this for before the damage is calculated:
# Multitype
movetype=thismove.pbType(thismove.type,user,target)
if target.hasWorkingAbility(:MULTITYPE) && !PBTypes.isPseudoType?(type)
if movetype=PSYCHIC && $PokemonBag.pbQuantity(:DREADPLATE)>0
target.type1=DARK
target.type2=DARK
self.form=17
transformed=true
elseif movetype=PSYCHIC && $PokemonBag.pbQuantity(:IRONPLATE)>0
target.type1=STEEL
target.type2=STEEL
self.form=8
transformed=true
elseif movetype=PSYCHIC && $PokemonBag.pbQuantity(:MINDPLATE)>0
target.type1=PSYCHIC
target.type2=PSYCHIC
self.form=14
transformed=true
elseif movetype=NORMAL && $PokemonBag.pbQuantity(:SPOOKYPLATE)>0
target.type1=GHOST
target.type2=GHOST
self.form=7
transformed=true
# This pattern continues for all type and plate combinations
@battle.pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,
PBAbilities.getName(target.ability),PBTypes.getName(movetype)))
PBDebug.log("[#{target.pbThis}'s Multitype made it #{PBTypes.getName(movetype)}-type]")
end
As you can see I'm very lost. Any advice is greatly appreciated!