- 4
- Posts
- 2
- Years
- Seen Nov 17, 2022
Hello everyone, I'm having some issues with implementing a few custom abilities- four to be exact.
I'm more familiar with python than I am with C++, so I'm probably missing some obvious quick fixes to actually get these to work correctly.
However, after fiddling and comparing them with other similar abilities I'm rather kind of stumped.
I'm working on four abilities,
one of them being called Purity.
The idea behind the ability is to give the user immunity against both poison and steel types, and when hit by said types moves summons Misty Terrain.
The ability works, unfortunately only for the first type (in this case, poison)
The second ability is supposed to have a 50% 50% split on either setting up Misty Terrain or poisoning the opponent upon switch-in.
Misty Terrain works 100% of the time ( i've referenced Effect Spores code for the random percent chance )
The third ability is supposed to prevent the opponent from using any sort of berries, and if they have a berry as their held item, it damages them at the end of each turn. My issue with this ability is trying to check the opponent's held item and to see if they are holding a berry.
The code is a complete mess so I would rather not show that.
The last ability I haven't actually attempted yet.
This one is supposed to prevent the opponent from using any berries as well, instead this time if the opponent is holding a berry, I want the user of this ability to be able to use the berry when needed ( like using the opponent Sitrus berry when low health, or using the chest berry when asleep), without taking the berry as there own held item.
Not entirely sure if that can be done without replacing the user-held item permanently. I think switching the users and the opponents held items temporarily, using the berry, then taking back their previous item should be able to work?? however, I haven't been able to attempt that yet.
I'm more familiar with python than I am with C++, so I'm probably missing some obvious quick fixes to actually get these to work correctly.
However, after fiddling and comparing them with other similar abilities I'm rather kind of stumped.
I'm working on four abilities,
one of them being called Purity.
The idea behind the ability is to give the user immunity against both poison and steel types, and when hit by said types moves summons Misty Terrain.
The ability works, unfortunately only for the first type (in this case, poison)
Code:
Battle::AbilityEffects::MoveImmunity.add(:PURITY,
proc { |ability, user, target, move, type, battle, show_message|
next false if type !=:POISON || if type !=:STEEL
if show_message
battle.pbDisplay(_INTL("{1} absorbs the moves because of it's {2}!", target.pbThis, target.abilityName))
battle.pbShowAbilitySplash(target)
if Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1} purified the surrounding environment!", target.pbThis(true)))
battle.pbStartTerrain(target, :Misty)
else
battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true)))
end
battle.pbHideAbilitySplash(target)
end
end
next true
}
)
The second ability is supposed to have a 50% 50% split on either setting up Misty Terrain or poisoning the opponent upon switch-in.
Misty Terrain works 100% of the time ( i've referenced Effect Spores code for the random percent chance )
Code:
Battle::AbilityEffects::OnSwitchIn.add(:MIASMA,
proc { |ability, user, target, battle, switch_in|
#next false if target.asleep? || target.frozen?
r = battle.pbRandom(2)
next if r == 1 && user.poisoned?
battle.pbShowAbilitySplash(target)
battle.pbDisplay(_INTL("{1} releases a mysterious mist into the air!",target.pbThis))
battle.pbHideAbilitySplash(target)
case r
when 0
#sets up Misty Terrain
battle.pbShowAbilitySplash(target)
battle.pbStartTerrain(target, :Misty)
when 1
#Poison target
if user.pbCanPoison?(target, Battle::Scene::USE_ABILITY_SPLASH)
msg = nil
if !Battle::Scene::USE_ABILITY_SPLASH
msg = _INTL("{1}'s {2} poisoned {3}!", target.pbThis,
target.abilityName, user.pbThis(true))
end
end
user.pbPoison(target, msg)
end
}
)
The third ability is supposed to prevent the opponent from using any sort of berries, and if they have a berry as their held item, it damages them at the end of each turn. My issue with this ability is trying to check the opponent's held item and to see if they are holding a berry.
The code is a complete mess so I would rather not show that.
The last ability I haven't actually attempted yet.
This one is supposed to prevent the opponent from using any berries as well, instead this time if the opponent is holding a berry, I want the user of this ability to be able to use the berry when needed ( like using the opponent Sitrus berry when low health, or using the chest berry when asleep), without taking the berry as there own held item.
Not entirely sure if that can be done without replacing the user-held item permanently. I think switching the users and the opponents held items temporarily, using the berry, then taking back their previous item should be able to work?? however, I haven't been able to attempt that yet.